Commit b8f86f8d authored by admin's avatar admin

问题分类接口完成

parent e9bb3198
...@@ -13,38 +13,6 @@ ...@@ -13,38 +13,6 @@
stopOnStyle = "0"> stopOnStyle = "0">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "redstar/Classes/Module/Function/Question/AddQuestion/ViewController/AddQuestionViewController.m"
timestampString = "473677271.6783"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "315"
endingLineNumber = "315"
landmarkName = "-alertView:clickedButtonAtIndex:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "redstar/Classes/Module/Function/Question/AddQuestion/ViewController/AddQuestionViewController.m"
timestampString = "473677272.558419"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "312"
endingLineNumber = "312"
landmarkName = "-alertView:clickedButtonAtIndex:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy <BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent <BreakpointContent
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
} else { } else {
imageName = [CommonFunc md5Data:data]; imageName = [CommonFunc md5Data:data];
NSString *fullPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", imageName]]; NSString *fullPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", imageName]];
[_imageNameArray addObject:imageName]; // [_imageNameArray addObject:imageName];
[data writeToFile:fullPath atomically:NO]; [data writeToFile:fullPath atomically:NO];
} }
......
...@@ -49,19 +49,23 @@ ...@@ -49,19 +49,23 @@
@property (nonatomic, strong) NSMutableDictionary *saveDict; @property (nonatomic, strong) NSMutableDictionary *saveDict;
@property (nonatomic, strong) NSMutableArray *categoryArray; @property (nonatomic, strong) NSMutableArray *categoryArray;
@property (nonatomic, strong) NSMutableDictionary *questionDict; @property (nonatomic, strong) NSMutableArray *questionArray;
@property (nonatomic, assign) NSInteger categoryNum; @property (nonatomic, assign) NSInteger categoryNum;
@property (nonatomic, assign) NSInteger questionNum; @property (nonatomic, assign) NSInteger questionNum;
@property (nonatomic) BOOL isComplete;
@property (nonatomic) BOOL isLoad;
@property (nonatomic, strong) NSMutableDictionary *groupUuidDict;
@end @end
@implementation AddQuestionViewController @implementation AddQuestionViewController
- (void)viewDidLoad - (void)viewDidLoad
{ {
[super viewDidLoad]; [super viewDidLoad];
[self createNewDict]; self.categoryArray = [NSMutableArray array];
self.questionArray = [NSMutableArray array];
self.view.backgroundColor = kFootViewBackGroundColor; self.view.backgroundColor = kFootViewBackGroundColor;
...@@ -82,40 +86,73 @@ ...@@ -82,40 +86,73 @@
self.imageNameArray = [NSMutableArray array]; self.imageNameArray = [NSMutableArray array];
self.titleArray = [NSArray arrayWithObjects:@"选择对应专业组", @"选择问题分类", nil]; self.titleArray = [NSArray arrayWithObjects:@"选择对应专业组", @"选择问题分类", nil];
[self addTableView]; [self addTableView];
// takePhoto代理 // takePhoto代理
[self.footerView.reportBtn addTarget:self action:@selector(upLoadQuestionPic:) forControlEvents:UIControlEventTouchUpInside]; [self.footerView.reportBtn addTarget:self action:@selector(upLoadQuestionPic:) forControlEvents:UIControlEventTouchUpInside];
// self.saveDict = [NSMutableDictionary dictionary]; [self requestGroupTitle];
// [_saveDict setObject:@"请选择" forKey:@"selectLabel"];
// [_saveDict setObject:@"请选择" forKey:@"selectLabel1"];
_rowNumber = 4; _rowNumber = 4;
_categoryNum = 0; _categoryNum = 0;
_questionNum = 0; _questionNum = 0;
_isComplete = NO;
_isLoad = NO;
} }
// // 请求问题专业组
- (void)createNewDict - (void)requestGroupTitle
{ {
self.categoryArray = [NSMutableArray arrayWithObjects:@"服务", @"环境企划", @"环境物业",@"价格",@"质量",@"商户信用分类",@"审批比价采购",@"送货跟单",@"指标",@"其他", nil]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionGroupURL]];
self.questionDict = [NSMutableDictionary dictionary]; [httpClient getQuestionGroupWithCompletion:^(id response, NSError *error) {
[_questionDict setObject:[NSArray arrayWithObjects:@"15分钟退单",@"便民服务",@"基础管理",@"轻松购系统",@"营运物料",@"服务承诺",@"人员形象",@"全员服务",@"其他", nil] forKey:@"服务"]; NSLog(@"问题与专业分组 === %@", response);
[_questionDict setObject:[NSArray arrayWithObjects:@"导视系统",@"背景音乐",@"物料规范",@"儿童区",@"休息区",@"其他", nil] forKey:@"环境企划"]; NSDictionary *dataDict = response[@"data"];
[_questionDict setObject:[NSArray arrayWithObjects:@"基础环境",@"物料标识",@"停车场",@"卫生间",@"硬件改造",@"人员",@"其他", nil] forKey:@"环境物业"]; NSArray *dataArray = dataDict[@"records"];
[_questionDict setObject:[NSArray arrayWithObjects:@"七折管理",@"价签物料",@"其他", nil] forKey:@"价格"]; NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[_questionDict setObject:[NSArray arrayWithObjects:@"绿色陈展",@"三年质保",@"其他", nil] forKey:@"质量"]; NSMutableArray *nameArray = [NSMutableArray array];
[_questionDict setObject:[NSArray arrayWithObjects:@"商户信用分类", nil] forKey:@"商户信用分类"]; for (NSDictionary *groupDict in dataArray) {
[_questionDict setObject:[NSArray arrayWithObjects:@"审批、比价、采购", nil] forKey:@"审批比价采购"]; NSString *name = [NSString stringWithFormat:@"%@", groupDict[@"name"]];
[_questionDict setObject:[NSArray arrayWithObjects:@"送货跟单", nil] forKey:@"送货跟单"]; NSString *groupUuid = [NSString stringWithFormat:@"%@", groupDict[@"uuid"]];
[_questionDict setObject:[NSArray arrayWithObjects:@"指标", nil] forKey:@"指标"]; [dict setObject:groupUuid forKey:name];
[_questionDict setObject:[NSArray arrayWithObjects:@"其他", nil] forKey:@"其他"]; [nameArray addObject:name];
}
_groupUuidDict = dict;
_categoryArray = nameArray;
_isComplete = YES;
if (nameArray.count != 0) {
NSString *nameStr = [NSString stringWithFormat:@"%@", nameArray[0]];
[self requestCategoryWithGroupUuid:[dict objectForKey:nameStr]];
}
[self.tableView reloadData];
}];
}
- (void)requestCategoryWithGroupUuid:(NSString *)groupUuid
{
NSString *url = [NSString stringWithFormat:@"%@%@%@",kRedStarURL, kQuestionCategoryURL, groupUuid];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *http = [[HttpClient alloc] initWithUrl:url];
[http getQuestionCategoryWithCompletion:^(id response, NSError *error) {
NSLog(@"分类categaory response= %@", response);
if (response[@"success"]) {
NSDictionary *dictData = response[@"data"];
NSArray *array = dictData[@"records"];
NSMutableArray *categoryArray = [NSMutableArray array];
for (NSDictionary *dict in array) {
NSString *category = [NSString stringWithFormat:@"%@", dict[@"name"]];
[categoryArray addObject:category];
}
_questionArray = categoryArray;
_isLoad = YES;
[self.tableView reloadData];
}
}];
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
...@@ -282,8 +319,8 @@ ...@@ -282,8 +319,8 @@
NSDictionary *parameters; NSDictionary *parameters;
if (_imageNameArray.count == 0) { if (_imageNameArray.count == 0) {
parameters = @{@"category":_selectLabel.text, parameters = @{@"category":_selectLabel1.text,
@"group":_selectLabel1.text, @"group":_selectLabel.text,
@"title":content, @"title":content,
@"content":title @"content":title
}; };
...@@ -302,8 +339,8 @@ ...@@ -302,8 +339,8 @@
[imageArray addObject:dict]; [imageArray addObject:dict];
} }
parameters = @{@"category":_selectLabel.text, parameters = @{@"category":_selectLabel1.text,
@"group":_selectLabel1.text, @"group":_selectLabel.text,
@"title":content, @"title":content,
@"content":title, @"content":title,
@"attachments":imageArray}; @"attachments":imageArray};
...@@ -367,8 +404,19 @@ ...@@ -367,8 +404,19 @@
line.backgroundColor = kSeparateLineColor; line.backgroundColor = kSeparateLineColor;
[cell.contentView addSubview:line]; [cell.contentView addSubview:line];
NSString *cateStr = nil;
if (_categoryArray.count != 0) {
if (_isComplete) {
cateStr = _categoryArray[_categoryNum];
} else {
cateStr = @"";
}
} else {
cateStr = @"";
}
NSString *cateStr = _categoryArray[_categoryNum];
if (indexPath.row == 0) { if (indexPath.row == 0) {
if (!self.selectLabel) { if (!self.selectLabel) {
_selectLabel = [[UILabel alloc] init]; _selectLabel = [[UILabel alloc] init];
...@@ -400,8 +448,19 @@ ...@@ -400,8 +448,19 @@
if (!self.selectLabel1) { if (!self.selectLabel1) {
self.selectLabel1 = [[UILabel alloc] init]; self.selectLabel1 = [[UILabel alloc] init];
} }
NSArray *seleArray = [_questionDict objectForKey:cateStr];
_selectLabel1.text = seleArray[_questionNum]; if (_questionArray.count != 0) {
if (_isLoad) {
_selectLabel1.text = _questionArray[_questionNum];
} else {
_selectLabel1.text = @"";
}
} else {
_selectLabel1.text = @"";
}
_selectLabel1.translatesAutoresizingMaskIntoConstraints = NO; _selectLabel1.translatesAutoresizingMaskIntoConstraints = NO;
_selectLabel1.textColor = kOnLineCellDetailColor; _selectLabel1.textColor = kOnLineCellDetailColor;
_selectLabel1.textAlignment = NSTextAlignmentRight; _selectLabel1.textAlignment = NSTextAlignmentRight;
...@@ -506,15 +565,19 @@ ...@@ -506,15 +565,19 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
if (indexPath.row == 0) { if (indexPath.row == 0) {
self.categoryActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:CATEGORYLIST]; self.categoryActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:nil];
for (NSString *groupName in _categoryArray) {
[_categoryActionSheet addButtonWithTitle:groupName];
}
_categoryActionSheet.delegate = self; _categoryActionSheet.delegate = self;
[_categoryActionSheet showInView:self.view]; [_categoryActionSheet showInView:self.view];
} else if (indexPath.row == 1) { } else if (indexPath.row == 1) {
self.questionActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:nil]; self.questionActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:nil];
NSString *cateStr = _categoryArray[_categoryNum];
NSArray *seleArray = [_questionDict objectForKey:cateStr]; for (NSString *selectStr in _questionArray) {
for (NSString *selectStr in seleArray) {
[_questionActionSheet addButtonWithTitle:selectStr]; [_questionActionSheet addButtonWithTitle:selectStr];
} }
...@@ -555,18 +618,19 @@ ...@@ -555,18 +618,19 @@
if (actionSheet == _categoryActionSheet) { if (actionSheet == _categoryActionSheet) {
if (buttonIndex < _categoryArray.count) { if ((buttonIndex -1) < _categoryArray.count) {
_selectLabel.text = [_categoryArray objectAtIndex:buttonIndex]; _selectLabel.text = [_categoryArray objectAtIndex:(buttonIndex -1)];
_categoryNum = buttonIndex; _categoryNum = (buttonIndex -1);
NSString *groupUuid = [_groupUuidDict objectForKey:_selectLabel.text];
_isLoad = NO;
[self requestCategoryWithGroupUuid:groupUuid];
_questionNum = 0; _questionNum = 0;
[self.tableView reloadData]; [self.tableView reloadData];
} }
} else if (actionSheet == _questionActionSheet){ } else if (actionSheet == _questionActionSheet){
NSString *cateStr = _categoryArray[_categoryNum]; if ((buttonIndex -1) < _questionArray.count) {
NSArray *seleArray = [_questionDict objectForKey:cateStr]; _selectLabel1.text = [_questionArray objectAtIndex:(buttonIndex -1)];
if ((buttonIndex - 1) < seleArray.count) {
_selectLabel1.text = [seleArray objectAtIndex:(buttonIndex - 1)];
_questionNum = buttonIndex - 1; _questionNum = buttonIndex - 1;
} }
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
@protocol CategoryTableViewDelegate <NSObject> @protocol CategoryTableViewDelegate <NSObject>
- (void)categoryTableViewClick:(NSString *)categoryName GroupTitle:(NSString *)groupTitle; - (void)categoryTableViewClick:(NSString *)categoryName;
@end @end
......
...@@ -40,61 +40,59 @@ ...@@ -40,61 +40,59 @@
- (void)setup - (void)setup
{ {
self.questionDict = [NSMutableDictionary dictionary];
[_questionDict setObject:[NSArray arrayWithObjects:@"15分钟退单",@"便民服务",@"基础管理",@"轻松购系统",@"营运物料",@"服务承诺",@"人员形象",@"全员服务",@"其他", nil] forKey:@"服务"];
[_questionDict setObject:[NSArray arrayWithObjects:@"导视系统",@"背景音乐",@"物料规范",@"儿童区",@"休息区",@"其他", nil] forKey:@"环境企划"];
[_questionDict setObject:[NSArray arrayWithObjects:@"基础环境",@"物料标识",@"停车场",@"卫生间",@"硬件改造",@"人员",@"其他", nil] forKey:@"环境物业"];
[_questionDict setObject:[NSArray arrayWithObjects:@"七折管理",@"价签物料",@"其他", nil] forKey:@"价格"];
[_questionDict setObject:[NSArray arrayWithObjects:@"绿色陈展",@"三年质保",@"其他", nil] forKey:@"质量"];
[_questionDict setObject:[NSArray arrayWithObjects:@"商户信用分类", nil] forKey:@"商户信用分类"];
[_questionDict setObject:[NSArray arrayWithObjects:@"审批、比价、采购", nil] forKey:@"审批比价采购"];
[_questionDict setObject:[NSArray arrayWithObjects:@"送货跟单", nil] forKey:@"送货跟单"];
[_questionDict setObject:[NSArray arrayWithObjects:@"指标", nil] forKey:@"指标"];
[_questionDict setObject:[NSArray arrayWithObjects:@"其他", nil] forKey:@"其他"];
self.delegate = self; self.delegate = self;
self.dataSource = self; self.dataSource = self;
self.titleArray = [NSMutableArray arrayWithArray:[NSArray arrayWithObjects:@"15分钟退单",@"便民服务",@"基础管理",@"轻松购系统",@"营运物料",@"服务承诺",@"人员形象",@"全员服务",@"其他", nil]]; self.titleArray = [NSMutableArray array];
self.categoryArray = [NSMutableArray array]; self.categoryArray = [NSMutableArray array];
NSInteger selectedIndex = 0; NSInteger selectedIndex = 0;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0]; NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
[self selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; [self selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
NSMutableArray *array = [[NSUserDefaults standardUserDefaults] objectForKey:@"groupAllName"];
NSMutableDictionary *dict = [[NSUserDefaults standardUserDefaults] objectForKey:@"groupTitle"];
if (array.count != 0) {
NSString *name = array[0];
NSString *groupUuid = [dict objectForKey:name];
[self requestCategoryListWithGroupUuid:groupUuid];
}
//注册通知 //注册通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadCurrentTableView:) name:kQuestionGroupNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadCurrentTableView:) name:kQuestionGroupNotification object:nil];
} }
- (void)requestCategoryListWithGroupUuid:(NSString *)groupUuid
{
NSString *url = [NSString stringWithFormat:@"%@%@%@",kRedStarURL, kQuestionCategoryURL, groupUuid];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *http = [[HttpClient alloc] initWithUrl:url];
[http getQuestionCategoryWithCompletion:^(id response, NSError *error) {
NSLog(@"分类categaory response= %@", response);
if (response[@"success"]) {
NSDictionary *dictData = response[@"data"];
NSArray *array = dictData[@"records"];
NSMutableArray *groupArray = [NSMutableArray array];
NSMutableArray *categoryArray = [NSMutableArray array];
for (NSDictionary *dict in array) {
NSString *category = [NSString stringWithFormat:@"%@", dict[@"name"]];
NSString *group = [NSString stringWithFormat:@"%@", dict[@"groupName"]];
[categoryArray addObject:category];
[groupArray addObject:group];
}
_titleArray = categoryArray;
_categoryArray = categoryArray;
[self reloadData];
}
}];
}
- (void)reloadCurrentTableView:(NSNotification *)notification - (void)reloadCurrentTableView:(NSNotification *)notification
{ {
_cateStr = [NSString stringWithFormat:@"%@",notification.userInfo[@"groupName"]]; [self requestCategoryListWithGroupUuid:notification.userInfo[@"groupUuid"]];
NSArray *selectArray = [NSArray arrayWithArray:[_questionDict objectForKey:_cateStr]];
_titleArray = [NSMutableArray arrayWithArray:selectArray];
[self reloadData];
// NSString *url = [NSString stringWithFormat:@"%@%@%@",kRedStarURL, kQuestionCategoryURL, notification.userInfo[@"groupName"]];
// url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
// HttpClient *http = [[HttpClient alloc] initWithUrl:url];
// [http getQuestionCategoryWithCompletion:^(id response, NSError *error) {
// NSLog(@"分类categaory response= %@", response);
// if (response[@"success"]) {
// NSDictionary *dictData = response[@"data"];
// NSArray *array = dictData[@"records"];
// NSMutableArray *groupArray = [NSMutableArray array];
// NSMutableArray *categoryArray = [NSMutableArray array];
// for (NSDictionary *dict in array) {
// NSString *category = [NSString stringWithFormat:@"%@", dict[@"name"]];
// NSString *group = [NSString stringWithFormat:@"%@", dict[@"groupName"]];
// [categoryArray addObject:category];
// [groupArray addObject:group];
//
// }
// _titleArray = categoryArray;
// _categoryArray = categoryArray;
// [self reloadData];
// }
// }];
} }
- (void)dealloc - (void)dealloc
...@@ -126,10 +124,9 @@ ...@@ -126,10 +124,9 @@
// cell点击事件 // cell点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
// NSString *cateName = _categoryArray[indexPath.row]; NSString *cateName = _titleArray[indexPath.row];
NSString *group = _titleArray[indexPath.row]; if (_categroyDeleagte && [_categroyDeleagte respondsToSelector:@selector(categoryTableViewClick:)]) {
if (_categroyDeleagte && [_categroyDeleagte respondsToSelector:@selector(categoryTableViewClick:GroupTitle:)]) { [_categroyDeleagte categoryTableViewClick:cateName];
[_categroyDeleagte categoryTableViewClick:_cateStr GroupTitle:group];
} }
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@protocol GroupTableViewDelegate <NSObject> @protocol GroupTableViewDelegate <NSObject>
- (void)groupTableViewClick:(NSString *)groupName; - (void)groupTableViewClick:(NSInteger)groupRow;
@end @end
@interface GroupTableView : UITableView @interface GroupTableView : UITableView
......
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
[self selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; [self selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
// NSMutableArray *array = [[NSUserDefaults standardUserDefaults] objectForKey:@"groupTitle"]; NSMutableArray *array = [[NSUserDefaults standardUserDefaults] objectForKey:@"groupAllName"];
// self.titleArray = [NSMutableArray arrayWithArray:array];
_titleArray = [NSMutableArray arrayWithObjects:@"服务", @"环境企划", @"环境物业",@"价格",@"质量",@"商户信用分类",@"审批比价采购",@"送货跟单",@"指标",@"其他", nil]; self.titleArray = [NSMutableArray arrayWithArray:array];
self.delegate = self; self.delegate = self;
self.dataSource = self; self.dataSource = self;
...@@ -76,11 +76,12 @@ ...@@ -76,11 +76,12 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
NSString *title = [NSString stringWithFormat:@"%@", _titleArray[indexPath.row]]; NSString *title = [NSString stringWithFormat:@"%@", _titleArray[indexPath.row]];
NSDictionary *dict =[[NSDictionary alloc] initWithObjectsAndKeys:title, @"groupName", nil]; NSMutableDictionary *dict = [[NSUserDefaults standardUserDefaults] objectForKey:@"groupTitle"];
[[NSNotificationCenter defaultCenter] postNotificationName:kQuestionGroupNotification object:self userInfo:dict]; NSString *groupUuid = [dict objectForKey:title];
NSDictionary *categaryDict =[[NSDictionary alloc] initWithObjectsAndKeys:groupUuid, @"groupUuid", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kQuestionGroupNotification object:self userInfo:categaryDict];
if(_groupDeleagte && [_groupDeleagte respondsToSelector:@selector(groupTableViewClick:)]) { if(_groupDeleagte && [_groupDeleagte respondsToSelector:@selector(groupTableViewClick:)]) {
[_groupDeleagte groupTableViewClick:title]; [_groupDeleagte groupTableViewClick:indexPath.row];
} }
} }
......
...@@ -47,9 +47,10 @@ ...@@ -47,9 +47,10 @@
@property (nonatomic, assign) NSInteger scopeRow; @property (nonatomic, assign) NSInteger scopeRow;
// 分组 // 分组
@property (nonatomic, copy) NSString *groupName; @property (nonatomic, assign) NSInteger groupRow;
@property (nonatomic, strong) NSMutableArray *allGroupNameArray;
// 分类 // 分类
@property (nonatomic, copy) NSString *groupTitle;
@property (nonatomic, copy) NSString *categoryName; @property (nonatomic, copy) NSString *categoryName;
@property (nonatomic, assign) NSInteger stateRow; @property (nonatomic, assign) NSInteger stateRow;
@property (nonatomic, assign) NSInteger timeRow; @property (nonatomic, assign) NSInteger timeRow;
...@@ -81,8 +82,32 @@ ...@@ -81,8 +82,32 @@
object:nil]; object:nil];
_page = 0; _page = 0;
//[self requestGroupTitle]; _groupRow = 0;
[self requestGroupTitle];
}
// 请求问题专业组
- (void)requestGroupTitle
{
self.allGroupNameArray = [NSMutableArray array];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionGroupURL]];
[httpClient getQuestionGroupWithCompletion:^(id response, NSError *error) {
NSLog(@"问题与专业分组 === %@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
NSMutableArray *nameArray = [NSMutableArray array];
for (NSDictionary *groupDict in dataArray) {
NSString *name = [NSString stringWithFormat:@"%@", groupDict[@"name"]];
NSString *groupUuid = [NSString stringWithFormat:@"%@", groupDict[@"uuid"]];
[dict setObject:groupUuid forKey:name];
[nameArray addObject:name];
}
[[NSUserDefaults standardUserDefaults] setObject:dict forKey:@"groupTitle"];
[[NSUserDefaults standardUserDefaults] setObject:nameArray forKey:@"groupAllName"];
_allGroupNameArray = nameArray;
}];
} }
- (void)dealloc - (void)dealloc
...@@ -468,13 +493,13 @@ ...@@ -468,13 +493,13 @@
[parameters setObject:array forKey:@"queryOrders"]; [parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 1) { } else if (_screenView.groupTabBar.selectNumber == 1) {
// 分组 // 分组
[parameters setObject:_groupName forKey:@"group"]; [parameters setObject:_allGroupNameArray[_groupRow] forKey:@"group"];
NSArray *array = @[@{@"field":@"group", NSArray *array = @[@{@"field":@"group",
@"direction":@"asc"}]; @"direction":@"asc"}];
[parameters setObject:array forKey:@"queryOrders"]; [parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 2) { } else if (_screenView.groupTabBar.selectNumber == 2) {
[parameters setObject:_groupTitle forKey:@"group"]; [parameters setObject:_allGroupNameArray[_groupRow] forKey:@"group"];
[parameters setObject:_categoryName forKey:@"category"]; [parameters setObject:_categoryName forKey:@"category"];
NSArray *array = @[@{@"field":@"category", NSArray *array = @[@{@"field":@"category",
@"direction":@"asc"}]; @"direction":@"asc"}];
...@@ -604,15 +629,14 @@ ...@@ -604,15 +629,14 @@
_scopeRow = row; _scopeRow = row;
} }
- (void)groupTableViewClick:(NSString *)groupName - (void)groupTableViewClick:(NSInteger)groupRow
{ {
_groupName = groupName; _groupRow = groupRow;
} }
- (void)categoryTableViewClick:(NSString *)categoryName GroupTitle:(NSString *)groupTitle - (void)categoryTableViewClick:(NSString *)categoryName
{ {
_categoryName = categoryName; _categoryName = categoryName;
_groupTitle = groupTitle;
} }
- (void)stateTableViewClick:(NSInteger)row - (void)stateTableViewClick:(NSInteger)row
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment