Commit 50ba09db authored by admin's avatar admin

添加了部分权限

parent 16b457f6
......@@ -26,6 +26,7 @@
LoginViewController *loginVC = [[LoginViewController alloc] init];
self.window.rootViewController = loginVC;
return YES;
}
......
......@@ -26,6 +26,7 @@
[self setupTabbar];
self.delegate = self;
}
- (void)viewWillAppear:(BOOL)animated
......@@ -61,10 +62,6 @@
AnnounceViewController *announce = (AnnounceViewController *)[self setUpOneChildViewController:[[AnnounceViewController alloc] init] title:@"公告" imageName:@"notice_unchecked" selImageName:@"notice_checked"];
announce.tabBarItem.tag = 3928;
// // 添加nav
// UINavigationController *announceNav = [[UINavigationController alloc] initWithRootViewController:announce];
// [announceNav.navigationBar setBarTintColor:kNavigationBarColor];
// [announceNav.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
MineViewController *mine = (MineViewController *)[self setUpOneChildViewController:[[MineViewController alloc] init] title:@"我的" imageName:@"aboutme_unchecked" selImageName:@"aboutme_checke"];
mine.tabBarItem.tag = 18274;
......
......@@ -128,6 +128,8 @@
- (void)addComment:(UIButton *)sender
{
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500504"]) {
if (!_backGroundView) {
_backGroundView = [[UIView alloc] initWithFrame:self.view.bounds];
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeBackGroundView)];
......@@ -155,6 +157,11 @@
_commentView.frame = toFrame;
}];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您没有添加评论的权限!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}
}
// 提交评论
......@@ -214,6 +221,9 @@
- (void)addZan:(ZanButton *)sender
{
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500505"]) {
sender.selected = !sender.selected;
NSDate *date = [NSDate date];
......@@ -260,6 +270,10 @@
}
}];
}
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您没有点赞的权限!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}
}
......
......@@ -172,8 +172,16 @@
- (void)addQuestionClick:(UIButton *)sender
{
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500503"]) {
AddQuestionViewController *addQuestionVC = [[AddQuestionViewController alloc] init];
[self.navigationController pushViewController:addQuestionVC animated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您没有新增问题权限!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}
}
- (void)dropCilck:(MenuButton *)sender
......
......@@ -199,13 +199,16 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
TaskGroup *taskGroup = _taskData[indexPath.section];
TaskModel *task = taskGroup.answers[indexPath.row];
if (task.state == 0) {
//InspectNoUpLoadViewController *inspectNotVC = [[InspectNoUpLoadViewController alloc] init];
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500103"]) {
//InspectNoUpLoadViewController *inspectNotVC = [[InspectNoUpLoadViewController alloc] init];
InspectNotUploadViewController *inspectNotVC = [[InspectNotUploadViewController alloc] init];
inspectNotVC.questionCount = taskGroup.questionCount;
inspectNotVC.taskModel = task;
......@@ -213,14 +216,16 @@
inspectNotVC.praiseUuid = _taskDetail.uuid;
inspectNotVC.questionUuid = task.uuid;
[self.navigationController pushViewController:inspectNotVC animated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您没有编辑检查点的权限!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}
} else {
InspectUploadedViewController *inspectVC = [[InspectUploadedViewController alloc] init];
inspectVC.questionCount = taskGroup.questionCount;
inspectVC.taskModel = task;
[self.navigationController pushViewController:inspectVC animated:YES];
}
}
// cell的高度
......
......@@ -124,6 +124,8 @@
}
- (void)addComment:(UIButton *)sender
{
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500202"]) {
if (!_backGroundView) {
_backGroundView = [[UIView alloc] initWithFrame:self.view.bounds];
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeBackGroundView)];
......@@ -151,20 +153,21 @@
_commentView.frame = toFrame;
}];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您没有评论的权限!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}
}
// 提交评论
- (void)submitComment:(UIButton *)sender
{
NSDate *date = [NSDate date];
NSTimeZone *zone = [NSTimeZone systemTimeZone];
NSInteger interval = [zone secondsFromGMTForDate:date];
NSDate *localeDate = [date dateByAddingTimeInterval:interval];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:localeDate];
NSString *dateString = [dateFormatter stringFromDate:date];
NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
......
......@@ -64,7 +64,7 @@
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) HomeHeaderView *headView;
@property (nonatomic, strong) NSArray *titleArray; // section标题
@property (nonatomic, strong) NSMutableArray *titleArray; // section标题
@property (nonatomic, strong) NSArray *btnTitleArray; // section标题
@property (nonatomic, strong) NSArray *announeArray; // 公告内容
......@@ -95,9 +95,36 @@
customLab.font = [UIFont boldSystemFontOfSize:19];
self.navigationItem.titleView = customLab;
self.titleArray = [NSMutableArray array];
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500101"] || [permissions containsObject:@"500102"]) {
[self.titleArray addObject:@"口碑巡检"];
[self requestInspectList];
}
if ([permissions containsObject:@"500201"]) {
[self.titleArray addObject:@"口碑排名"];
[self requestRankingList];
}
if ([permissions containsObject:@"500301"] || [permissions containsObject:@"500302"]) {
[self.titleArray addObject:@"图说口碑"];
}
if ([permissions containsObject:@"500401"] || [permissions containsObject:@"500402"]) {
[self.titleArray addObject:@"口碑标准"];
}
if ([permissions containsObject:@"500501"] || [permissions containsObject:@"500502"]) {
[self.titleArray addObject:@"问题知识"];
[self requestQuestionList];
}
if ([permissions containsObject:@"500701"] || [permissions containsObject:@"500702"]) {
[self.titleArray addObject:@"在线抽查"];
}
NSLog(@"self.titlar = %@", self.titleArray);
// 初始化容器
self.titleArray = [NSArray arrayWithObjects:@"图说口碑", @"8月口碑巡检",@"问题与知识",@"口碑任务", nil];
self.btnTitleArray = [NSArray arrayWithObjects:@"在线抽查", @"口碑巡检",@"口碑标准",@"图说口碑",@"问题知识",@"口碑排名",@"查看抽查", nil];
//self.titleArray = [NSMutableArray arrayWithObjects:@"图说口碑", @"8月口碑巡检",@"问题与知识",@"口碑任务", nil];
self.btnTitleArray = [NSArray arrayWithObjects:@"在线抽查", @"口碑巡检",@"口碑标准",@"图说口碑",@"问题知识",@"口碑排名",@"查看抽查", nil];
self.announeArray = [NSArray arrayWithObjects:@"关于展开10月口碑巡检的说明", @"迎2015十一大促活动启动", @"9月口碑巡检结果排名已公布", nil];
// 初始化
......@@ -121,13 +148,7 @@
self.tableView.tableHeaderView = self.headView;
//
[self requestRankingList];
// 巡检列表
[self requestInspectList];
// 问题与知识
[self requestQuestionList];
// 设置下拉刷新
self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
......@@ -355,13 +376,14 @@
CGFloat itemW = kScreenWidth / 4;
CGFloat itemH = self.headView.scrollView.frame.size.height;
for (int i = 0; i < 7; i++) {
for (int i = 0; i < _titleArray.count; i++) {
HomeCellItem *item = [[HomeCellItem alloc] init];
item.frame = CGRectMake(i * itemW, 0, itemW, itemH);
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"task_0%d", i]];
NSString *nameStr = _titleArray[i];
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%@", nameStr]];
[item setImage:image forState:UIControlStateNormal];
[item setTitleColor:kPictureCellDetailsColor forState:UIControlStateNormal];
[item setTitle:[NSString stringWithFormat:@"%@", self.btnTitleArray[i]] forState:UIControlStateNormal];
[item setTitle:nameStr forState:UIControlStateNormal];
[item addTarget:self action:@selector(itemClick:) forControlEvents:UIControlEventTouchUpInside];
[self.headView.scrollView addSubview:item];
}
......@@ -552,7 +574,7 @@
#pragma mark - TableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return _titleArray.count + _rankData.count;
return 4 + _rankData.count;
}
......@@ -760,13 +782,21 @@
titleLabel.font = [UIFont systemFontOfSize:17.0];
if (section == 0) {
titleLabel.text = _titleArray[section];
titleLabel.text = @"测试";
// titleLabel.text = _titleArray[section];
} else if (section == 1) {
titleLabel.text = _titleArray[section];
titleLabel.text = @"测试";
//titleLabel.text = _titleArray[section];
} else if (section == 2 + _rankData.count) {
titleLabel.text = _titleArray[section - _rankData.count];
titleLabel.text = @"测试";
// titleLabel.text = _titleArray[section - _rankData.count];
} else {
titleLabel.text = _titleArray[section - _rankData.count];
titleLabel.text = @"测试";
//titleLabel.text = _titleArray[section - _rankData.count];
}
[sectionView addSubview:titleLabel];
......
......@@ -144,9 +144,12 @@
NSString *user_code = dict[@"user_code"];
NSString *user_name = dict[@"user_name"];
NSString *user_uuid = dict[@"user_uuid"];
NSArray *permissions = dict[@"permissions"];
[userDefault setObject:user_code forKey:@"user_code"];
[userDefault setObject:user_name forKey:@"user_name"];
[userDefault setObject:user_uuid forKey:@"user_uuid"];
[userDefault setObject:permissions forKey:@"permissions"];
self.rootTBC = [[RootTabBarController alloc] init];
[MBProgressHUD hideHUDForView:window animated:YES];
......@@ -198,9 +201,11 @@
NSString *user_code = dict[@"user_code"];
NSString *user_name = dict[@"user_name"];
NSString *user_uuid = dict[@"user_uuid"];
NSArray *permissions = dict[@"permissions"];
[[NSUserDefaults standardUserDefaults] setObject:user_code forKey:@"user_code"];
[[NSUserDefaults standardUserDefaults] setObject:user_name forKey:@"user_name"];
[[NSUserDefaults standardUserDefaults] setObject:user_uuid forKey:@"user_uuid"];
[[NSUserDefaults standardUserDefaults] setObject:permissions forKey:@"permissions"];
// 进入RootTabBar
self.rootTBC = [[RootTabBarController alloc] init];
[MBProgressHUD hideHUDForView:window 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