Commit ce9164a1 authored by admin's avatar admin

权限修改完毕

parent c694e41b
No preview for this file type
...@@ -97,6 +97,11 @@ ...@@ -97,6 +97,11 @@
self.titleArray = [NSMutableArray array]; self.titleArray = [NSMutableArray array];
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"]; NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500101"] || [permissions containsObject:@"500102"]) {
[self.titleArray addObject:@"口碑巡检"];
[self requestInspectList];
}
if ([permissions containsObject:@"500201"]) { if ([permissions containsObject:@"500201"]) {
[self.titleArray addObject:@"口碑排名"]; [self.titleArray addObject:@"口碑排名"];
[self requestRankingList]; [self requestRankingList];
...@@ -108,23 +113,19 @@ ...@@ -108,23 +113,19 @@
[self requestQuestionList]; [self requestQuestionList];
} }
if ([permissions containsObject:@"500101"] || [permissions containsObject:@"500102"]) {
[self.titleArray addObject:@"口碑巡检"];
[self requestInspectList];
}
if ([permissions containsObject:@"500301"] || [permissions containsObject:@"500302"]) { if ([permissions containsObject:@"500301"] || [permissions containsObject:@"500302"]) {
//[self.titleArray addObject:@"图说口碑"]; [self.titleArray addObject:@"图说口碑"];
} }
if ([permissions containsObject:@"500401"] || [permissions containsObject:@"500402"]) { if ([permissions containsObject:@"500401"] || [permissions containsObject:@"500402"]) {
//[self.titleArray addObject:@"口碑标准"]; [self.titleArray addObject:@"口碑标准"];
} }
if ([permissions containsObject:@"500701"] || [permissions containsObject:@"500702"]) { if ([permissions containsObject:@"500701"] || [permissions containsObject:@"500702"]) {
// [self.titleArray addObject:@"在线抽查"]; [self.titleArray addObject:@"在线抽查"];
} }
NSLog(@"self.titlar = %@", self.titleArray);
// 初始化容器 // 初始化容器
//self.titleArray = [NSMutableArray arrayWithObjects:@"图说口碑", @"8月口碑巡检",@"问题与知识",@"口碑任务", nil]; //self.titleArray = [NSMutableArray arrayWithObjects:@"图说口碑", @"8月口碑巡检",@"问题与知识",@"口碑任务", nil];
self.btnTitleArray = [NSArray arrayWithObjects:@"在线抽查", @"口碑巡检",@"口碑标准",@"图说口碑",@"问题知识",@"口碑排名",@"查看抽查", nil]; self.btnTitleArray = [NSArray arrayWithObjects:@"在线抽查", @"口碑巡检",@"口碑标准",@"图说口碑",@"问题知识",@"口碑排名",@"查看抽查", nil];
...@@ -399,15 +400,17 @@ ...@@ -399,15 +400,17 @@
UINavigationController *nav; UINavigationController *nav;
if (button.tag - 332892 == 0) { if (button.tag - 332892 == 0) {
InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:inspectListVC];
} else if (button.tag - 332892 == 1) {
RankingListViewController *rankingListVC = [[RankingListViewController alloc] init]; RankingListViewController *rankingListVC = [[RankingListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:rankingListVC]; nav = [[UINavigationController alloc] initWithRootViewController:rankingListVC];
} else if (button.tag - 332892 == 1) {
} else {
QuestionViewController *questionVC = [[QuestionViewController alloc] init]; QuestionViewController *questionVC = [[QuestionViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:questionVC]; nav = [[UINavigationController alloc] initWithRootViewController:questionVC];
} else {
InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:inspectListVC];
} }
[nav.navigationBar setBarTintColor:kNavigationBarColor]; [nav.navigationBar setBarTintColor:kNavigationBarColor];
...@@ -453,7 +456,11 @@ ...@@ -453,7 +456,11 @@
#pragma mark - TableView Delegate/DataSource #pragma mark - TableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{ {
if (_titleArray.count == 6) {
return 3;
} else {
return _titleArray.count; return _titleArray.count;
}
} }
...@@ -461,20 +468,41 @@ ...@@ -461,20 +468,41 @@
{ {
if (section == 0) { if (section == 0) {
return _allRankListArray.count + 1; return _taskListDataArray.count;
} else if (section == 1 ) { } else if (section == 1 ) {
return _allQuestionArray.count; return _allRankListArray.count + 1;
} else { } else {
return _taskListDataArray.count; return _allQuestionArray.count;
} }
} }
// cell显示的内容
// cell显示的内容 // cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ {
if (indexPath.section == 0) { if (indexPath.section == 0) {
InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell];
if (!cell) {
cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell];
}
TaskListModel *taskList = _taskListDataArray[indexPath.row];
cell.taskList = taskList;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.allView.backgroundColor = kProgressViewAllBackColor;
UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
cell.alreadyView.image = image;
return cell;
} else if (indexPath.section == 1) {
if (indexPath.row == 0) { if (indexPath.row == 0) {
HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell]; HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell];
if (!cell) { if (!cell) {
...@@ -492,7 +520,13 @@ ...@@ -492,7 +520,13 @@
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell; return cell;
} }
} else if (indexPath.section == 1) {
} else {
// 问题与知识 // 问题与知识
QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell]; QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell];
if (!cell) { if (!cell) {
...@@ -503,26 +537,74 @@ ...@@ -503,26 +537,74 @@
cell.question = question; cell.question = question;
return cell; return cell;
} else {
InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell];
if (!cell) {
cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell];
}
TaskListModel *taskList = _taskListDataArray[indexPath.row];
cell.taskList = taskList;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.allView.backgroundColor = kProgressViewAllBackColor;
UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
cell.alreadyView.image = image;
return cell;
} }
} }
// if ([title isEqualToString:@"口碑排名"]) {
// if (indexPath.section == i) {
// HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell];
// if (!cell) {
// cell = [[HomeTitleTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeTitleTableCell];
// }
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
// return cell;
// } else {
// RankingListCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeRankingListCell];
// if (!cell) {
// cell = [[RankingListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell];
// }
// cell.rankList = _allRankListArray[indexPath.row - 1];
// cell.gradeImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", (int)indexPath.row]];
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
// return cell;
// }
// } else if ([title isEqualToString:@"问题知识"]) {
// if (indexPath.section == i) {
// // 问题与知识
// QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell];
// if (!cell) {
// cell = [[QuestionListTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeQuestionListTableCell];
// }
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
// QuestionModel *question = _allQuestionArray[indexPath.row];
// cell.question = question;
// return cell;
// }
// } else if ([title isEqualToString:@"口碑巡检"]) {
// InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell];
// if (!cell) {
// cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell];
// }
// TaskListModel *taskList = _taskListDataArray[indexPath.row];
// cell.taskList = taskList;
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
// cell.allView.backgroundColor = kProgressViewAllBackColor;
// UIImage *image = [UIImage imageNamed:@"progress-bar"];
// image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
// cell.alreadyView.image = image;
// return cell;
//
// } else {
// return nil;
// }
// cell点击事件 // cell点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
if (indexPath.section == 0) { if (indexPath.section == 0) {
InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init];
TaskListModel *taskList = self.taskListDataArray[indexPath.row];
inspectTaskVC.uuid = taskList.uuid;
inspectTaskVC.store_uuid = taskList.store_uuid;
inspectTaskVC.multiplier = (CGFloat)taskList.reportCount / taskList.questionCount ;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:inspectTaskVC animated:YES];
} else if (indexPath.section == 1) {
if (indexPath.row == 0) { if (indexPath.row == 0) {
NSLog(@"不能点击"); NSLog(@"不能点击");
} else { } else {
...@@ -537,22 +619,15 @@ ...@@ -537,22 +619,15 @@
[self.navigationController pushViewController:rankDetailVC animated:YES]; [self.navigationController pushViewController:rankDetailVC animated:YES];
} }
} else if (indexPath.section == 1) {
} else {
QuestionDetailViewController *questionDetailVC = [[QuestionDetailViewController alloc] init]; QuestionDetailViewController *questionDetailVC = [[QuestionDetailViewController alloc] init];
QuestionModel *question = self.allQuestionArray[indexPath.row]; QuestionModel *question = self.allQuestionArray[indexPath.row];
questionDetailVC.questionUuid = question.uuid; questionDetailVC.questionUuid = question.uuid;
self.hidesBottomBarWhenPushed = YES; self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:questionDetailVC animated:YES]; [self.navigationController pushViewController:questionDetailVC animated:YES];
} else {
InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init];
TaskListModel *taskList = self.taskListDataArray[indexPath.row];
inspectTaskVC.uuid = taskList.uuid;
inspectTaskVC.store_uuid = taskList.store_uuid;
inspectTaskVC.multiplier = (CGFloat)taskList.reportCount / taskList.questionCount ;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:inspectTaskVC animated:YES];
} }
} }
......
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