add
This commit is contained in:
@@ -7,6 +7,13 @@
|
||||
//
|
||||
|
||||
#import "GiGaFeedBackViewController.h"
|
||||
#import "GIGaFeedQQViewCell.h"
|
||||
#import "GIGaFeedPhontosViewCell.h"
|
||||
#import "GiGaFeedContentViewCell.h"
|
||||
#import "GiGaFeedLeiIingViewCell.h"
|
||||
#import "SJPhotoPicker.h"
|
||||
#import "GiGaNetManager.h"
|
||||
#import "GiGaAPIResult.h"
|
||||
|
||||
@interface GiGaFeedBackViewController ()
|
||||
|
||||
@@ -17,7 +24,171 @@
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self addNavTitile:@"意见反馈"];
|
||||
|
||||
[self.view addSubview:self.tableView];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.backgroundColor = GIGA_MAIN_BGCOLOR;
|
||||
self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
|
||||
self.tableView.sectionFooterHeight = 0;
|
||||
self.tableView.estimatedSectionFooterHeight= 0;
|
||||
self.tableView.estimatedSectionHeaderHeight = 0;
|
||||
|
||||
|
||||
self.tableView.frame = CGRectMake(0, 1, KMainW, self.view.bounds.size.height - SAFE_NAV_HEIGHT);
|
||||
|
||||
[self.tableView registerClass:[GIGaFeedPhontosViewCell class] forCellReuseIdentifier:@"GIGaFeedPhontosViewCell"];
|
||||
// Do any additional setup after loading the view.
|
||||
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 80)];
|
||||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
btn.layer.masksToBounds = YES;
|
||||
btn.layer.cornerRadius = 20;
|
||||
btn.frame = CGRectMake((self.view.frame.size.width - 245) /2 , 20, 245,40);
|
||||
btn.backgroundColor = [UIColor whiteColor];
|
||||
NSAttributedString *atti = [GiGaHelper stringWithText:@"提交" textColor:GIGA_MAIN_BGCOLOR textFont:GIGA_TEXTFONTBOLD(18) leterSpace:0];
|
||||
[btn addTarget:self action:@selector(tijiaoAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
[btn setAttributedTitle:atti forState:UIControlStateNormal];
|
||||
[footer addSubview:btn];
|
||||
self.tableView.tableFooterView = footer;
|
||||
|
||||
|
||||
}
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return 4;
|
||||
}
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (indexPath.section == 0) {
|
||||
GiGaFeedLeiIingViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GiGaFeedLeiIingViewCell"];
|
||||
if (!cell) {
|
||||
cell = [[[NSBundle mainBundle] loadNibNamed:@"GiGaFeedLeiIingViewCell" owner:self options:nil] lastObject];
|
||||
}
|
||||
return cell;
|
||||
}else if (indexPath.section == 1){
|
||||
GiGaFeedContentViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GiGaFeedContentViewCell"];
|
||||
if (!cell) {
|
||||
cell = [[[NSBundle mainBundle] loadNibNamed:@"GiGaFeedContentViewCell" owner:self options:nil] lastObject];
|
||||
}
|
||||
return cell;
|
||||
}else if (indexPath.section == 2){
|
||||
GIGaFeedQQViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GIGaFeedQQViewCell"];
|
||||
if (!cell) {
|
||||
cell = [[[NSBundle mainBundle] loadNibNamed:@"GIGaFeedQQViewCell" owner:self options:nil] lastObject];
|
||||
}
|
||||
return cell;
|
||||
}else if (indexPath.section == 3){
|
||||
|
||||
GIGaFeedPhontosViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GIGaFeedPhontosViewCell"];
|
||||
if (!cell) {
|
||||
cell = [[GIGaFeedPhontosViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"GIGaFeedPhontosViewCell"];;
|
||||
}
|
||||
|
||||
__weak typeof(cell) weakCell = cell;
|
||||
cell.pickerBalock = ^{
|
||||
[[SJPhotoPicker shareSJPhotoPicker] showPhotoPickerToController:self pickedAssets:^(NSArray<PHAsset *> *assets) {
|
||||
// 添加按钮6张以上被遮挡可不写
|
||||
// if ((weakCell.images.count + assets.count) > 6) {
|
||||
// GIGA_ShowToast(@"最多六张");
|
||||
// return ;
|
||||
// }
|
||||
[weakCell.images addObjectsFromArray:assets];
|
||||
//weakSelf.images = [NSMutableArray arrayWithArray:assets];
|
||||
[weakCell.collectionView reloadData];
|
||||
|
||||
}];
|
||||
};
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (indexPath.section == 0) {
|
||||
return 40;
|
||||
}else if (indexPath.section == 1){
|
||||
return 142;
|
||||
}else if (indexPath.section == 2){
|
||||
return 40;
|
||||
}else if (indexPath.section == 3){
|
||||
return 218;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||||
if (section == 3) {
|
||||
return 36;
|
||||
}else{
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
||||
if (section == 3) {
|
||||
UIView *view = [[UIView alloc] init];
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.frame = CGRectMake(15,0, 200, 36);
|
||||
label.font = GIGA_TEXTFONTMEDIUM(13);
|
||||
label.text= @"上传图片(最多6张)";
|
||||
label.textColor = [UIColor whiteColor];
|
||||
[view addSubview:label];
|
||||
return view;
|
||||
}
|
||||
UIView *view = [[UIView alloc] init];
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
||||
return 0.1;
|
||||
}
|
||||
|
||||
#pragma mark 提交
|
||||
|
||||
-(void)tijiaoAction{
|
||||
GIGaFeedPhontosViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:3]];
|
||||
NSArray *names =cell.imageNames;
|
||||
|
||||
NSLog(@"names:%@",names);
|
||||
|
||||
GiGaFeedLeiIingViewCell *kindcell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
|
||||
if ([kindcell.kidLabel.text isEqualToString:@"选择反馈类型"]) {
|
||||
GIGA_ShowToast(@"请选择评论类型");
|
||||
return;
|
||||
}
|
||||
|
||||
GiGaFeedContentViewCell *contencell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]];
|
||||
|
||||
if (contencell.contentFiled.text.length==0) {
|
||||
GIGA_ShowToast(@"请输入评论");
|
||||
return;
|
||||
}
|
||||
|
||||
GIGaFeedQQViewCell *qqcell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:3]];
|
||||
if (qqcell.QTextFiled.text.length == 0) {
|
||||
qqcell.QTextFiled.text = @"";
|
||||
}
|
||||
|
||||
|
||||
if (names.count <= 0) {
|
||||
GIGA_ShowToast(@"请选择图片");
|
||||
return;
|
||||
}
|
||||
|
||||
[GiGaNetManager uploadImage:@"sys/sysdict/v1/maskproposaltype" imageNames:names parms:@{} responseBlock:^(NSDictionary *responseDict, NSDictionary *responseHeaderFields, NSError *error) {
|
||||
if (error) {
|
||||
GILog(@"err:%@",error.localizedDescription);
|
||||
}else{
|
||||
GiGaAPIResult *result = [[GiGaAPIResult alloc] initWithDictionary:responseDict];
|
||||
GIGA_ShowToast(result.message);
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
@@ -25,14 +196,6 @@
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user