Commit b8f86f8d authored by admin's avatar admin

问题分类接口完成

parent e9bb3198
......@@ -13,38 +13,6 @@
stopOnStyle = "0">
</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 = "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
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
......
......@@ -123,7 +123,7 @@
} else {
imageName = [CommonFunc md5Data:data];
NSString *fullPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", imageName]];
[_imageNameArray addObject:imageName];
// [_imageNameArray addObject:imageName];
[data writeToFile:fullPath atomically:NO];
}
......
......@@ -11,7 +11,7 @@
@protocol CategoryTableViewDelegate <NSObject>
- (void)categoryTableViewClick:(NSString *)categoryName GroupTitle:(NSString *)groupTitle;
- (void)categoryTableViewClick:(NSString *)categoryName;
@end
......
......@@ -40,61 +40,59 @@
- (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.dataSource = self;
self.titleArray = [NSMutableArray arrayWithArray:[NSArray arrayWithObjects:@"15分钟退单",@"便民服务",@"基础管理",@"轻松购系统",@"营运物料",@"服务承诺",@"人员形象",@"全员服务",@"其他", nil]];
self.titleArray = [NSMutableArray array];
self.categoryArray = [NSMutableArray array];
NSInteger selectedIndex = 0;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
[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];
}
- (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
{
_cateStr = [NSString stringWithFormat:@"%@",notification.userInfo[@"groupName"]];
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];
// }
// }];
[self requestCategoryListWithGroupUuid:notification.userInfo[@"groupUuid"]];
}
- (void)dealloc
......@@ -126,10 +124,9 @@
// cell点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// NSString *cateName = _categoryArray[indexPath.row];
NSString *group = _titleArray[indexPath.row];
if (_categroyDeleagte && [_categroyDeleagte respondsToSelector:@selector(categoryTableViewClick:GroupTitle:)]) {
[_categroyDeleagte categoryTableViewClick:_cateStr GroupTitle:group];
NSString *cateName = _titleArray[indexPath.row];
if (_categroyDeleagte && [_categroyDeleagte respondsToSelector:@selector(categoryTableViewClick:)]) {
[_categroyDeleagte categoryTableViewClick:cateName];
}
}
......
......@@ -9,7 +9,7 @@
#import <UIKit/UIKit.h>
@protocol GroupTableViewDelegate <NSObject>
- (void)groupTableViewClick:(NSString *)groupName;
- (void)groupTableViewClick:(NSInteger)groupRow;
@end
@interface GroupTableView : UITableView
......
......@@ -41,9 +41,9 @@
[self selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
// NSMutableArray *array = [[NSUserDefaults standardUserDefaults] objectForKey:@"groupTitle"];
// self.titleArray = [NSMutableArray arrayWithArray:array];
_titleArray = [NSMutableArray arrayWithObjects:@"服务", @"环境企划", @"环境物业",@"价格",@"质量",@"商户信用分类",@"审批比价采购",@"送货跟单",@"指标",@"其他", nil];
NSMutableArray *array = [[NSUserDefaults standardUserDefaults] objectForKey:@"groupAllName"];
self.titleArray = [NSMutableArray arrayWithArray:array];
self.delegate = self;
self.dataSource = self;
......@@ -76,11 +76,12 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *title = [NSString stringWithFormat:@"%@", _titleArray[indexPath.row]];
NSDictionary *dict =[[NSDictionary alloc] initWithObjectsAndKeys:title, @"groupName", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kQuestionGroupNotification object:self userInfo:dict];
NSMutableDictionary *dict = [[NSUserDefaults standardUserDefaults] objectForKey:@"groupTitle"];
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:)]) {
[_groupDeleagte groupTableViewClick:title];
[_groupDeleagte groupTableViewClick:indexPath.row];
}
}
......
......@@ -47,9 +47,10 @@
@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, assign) NSInteger stateRow;
@property (nonatomic, assign) NSInteger timeRow;
......@@ -81,8 +82,32 @@
object:nil];
_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
......@@ -468,13 +493,13 @@
[parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 1) {
// 分组
[parameters setObject:_groupName forKey:@"group"];
[parameters setObject:_allGroupNameArray[_groupRow] forKey:@"group"];
NSArray *array = @[@{@"field":@"group",
@"direction":@"asc"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 2) {
[parameters setObject:_groupTitle forKey:@"group"];
[parameters setObject:_allGroupNameArray[_groupRow] forKey:@"group"];
[parameters setObject:_categoryName forKey:@"category"];
NSArray *array = @[@{@"field":@"category",
@"direction":@"asc"}];
......@@ -604,15 +629,14 @@
_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;
_groupTitle = groupTitle;
}
- (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