Commit 4b7ee334 authored by Sandy's avatar Sandy

jinghuxinan权限登录 首页切换

parent 10ae2296
...@@ -9,11 +9,17 @@ ...@@ -9,11 +9,17 @@
#import "BaseScrollTableViewController.h" #import "BaseScrollTableViewController.h"
#import "spotCheckViewController.h" #import "spotCheckViewController.h"
@interface BANewHomeViewController : BaseScrollTableViewController @interface BANewHomeViewController : BaseScrollTableViewController
@property(nonatomic,strong)NSString*unFinishedTaskCount;
@property(nonatomic,strong)NSString*finishedTaskCount;
@property(nonatomic,strong)NSString*progress;
@property(nonatomic,strong)NSString*dayCount;
@property (nonatomic, strong) NSArray *arrContents;
@property(nonatomic,strong)NSArray * noticeArr;
@property(nonatomic,strong) UITableView *tableView;
@property(nonatomic,strong) UIView *leftView;
@property(nonatomic,strong)NSString*unSurveyNum; @property(nonatomic,strong)NSString*unSurveyNum;
@property(nonatomic,strong)NSString*surveyTime; @property(nonatomic,strong)NSString*surveyTime;
@property(nonatomic,strong)NSString*surveyStatus; @property(nonatomic,strong)NSString*surveyStatus;
@property(nonatomic,strong)NSString*dayCount;
@end @end
...@@ -14,8 +14,17 @@ ...@@ -14,8 +14,17 @@
#import "TypePickerView.h" #import "TypePickerView.h"
#import "BATaskListViewController.h" #import "BATaskListViewController.h"
#import "BackGroundMusicViewController.h" #import "BackGroundMusicViewController.h"
#import "NewHomeViewController.h"
@interface BANewHomeViewController () #import "BRNetworkMgr.h"
#import "RDVTabBarController.h"
#import <UIImageView+WebCache.h>
#import <SDImageCache.h>
#import "TypePickerView.h"
#import "TaskListViewController.h"
#import "BackGroundMusicViewController.h"
#import "DBDaoMgr.h"
#import "NoteDetailViewController.h"
@interface BANewHomeViewController ()<UITableViewDelegate,UITableViewDataSource>
{ {
UIButton* btnUnRead; UIButton* btnUnRead;
UIButton* btnAll; UIButton* btnAll;
...@@ -30,6 +39,16 @@ ...@@ -30,6 +39,16 @@
UILabel *strRight; UILabel *strRight;
UILabel *str1; UILabel *str1;
UILabel *str3; UILabel *str3;
UIImageView* prcessImage;
UIView* prcessBgView;
UILabel* lblNum;
UILabel *strnum;
UIImageView* typePickerViewbg;
UITableView *checkList;
UIView *leftView;
UIImageView *imageViewHeaderBG;
} }
@end @end
...@@ -61,6 +80,7 @@ ...@@ -61,6 +80,7 @@
UIImageView* headbg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 200)]; UIImageView* headbg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 200)];
headbg.image = [UIImage imageNamed:@"NavBar/bigAreaNav_bg.png"]; headbg.image = [UIImage imageNamed:@"NavBar/bigAreaNav_bg.png"];
[headView addSubview:headbg]; [headView addSubview:headbg];
imageViewHeaderBG = headbg;
UILabel* lblTitle = [[UILabel alloc] init]; UILabel* lblTitle = [[UILabel alloc] init];
lblTitle.text = @"首页"; lblTitle.text = @"首页";
...@@ -71,7 +91,7 @@ ...@@ -71,7 +91,7 @@
[lblTitle autoAlignAxis:ALAxisVertical toSameAxisOfView:headView]; [lblTitle autoAlignAxis:ALAxisVertical toSameAxisOfView:headView];
[lblTitle autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:25]; [lblTitle autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:25];
UIImageView* typePickerViewbg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 75, CGRectGetWidth(self.view.frame), 40)]; typePickerViewbg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 75, CGRectGetWidth(self.view.frame), 40)];
typePickerViewbg.image = [UIImage imageNamed:@"NavBar/tab_home_left_daqu.png"]; typePickerViewbg.image = [UIImage imageNamed:@"NavBar/tab_home_left_daqu.png"];
[headView addSubview:typePickerViewbg]; [headView addSubview:typePickerViewbg];
...@@ -361,6 +381,7 @@ ...@@ -361,6 +381,7 @@
[UIApplication showLoadingView:@"正在加载数据"]; [UIApplication showLoadingView:@"正在加载数据"];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadUI) name:@"reloadNumber" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadUI) name:@"reloadNumber" object:nil];
[self initRightView];
} }
#pragma ----------------去抽查----------- #pragma ----------------去抽查-----------
...@@ -563,7 +584,18 @@ ...@@ -563,7 +584,18 @@
- (void)typePickerViewClickAtIndex:(int)index - (void)typePickerViewClickAtIndex:(int)index
{ {
NSLog(@"click:%d",index); if(index ==0){
[checkList setHidden:true];
[leftView setHidden:false];
typePickerViewbg.image = [UIImage imageNamed:@"NavBar/tab_home_left_daqu.png"];
// imageViewHeaderBG.image = [UIImage imageNamed:@"NavBar/top_bg_tab_left.png"];
} else{
[checkList setHidden:false];
[leftView setHidden:true];
typePickerViewbg.image = [UIImage imageNamed:@"NavBar/tab_home_right_daqu.png"];
// imageViewHeaderBG.image = [UIImage imageNamed:@"NavBar/top_bg_tab_right.png"];
}
} }
- (void)viewWillAppear:(BOOL)animated - (void)viewWillAppear:(BOOL)animated
{ {
...@@ -571,7 +603,7 @@ ...@@ -571,7 +603,7 @@
self.navigationController.navigationBarHidden = YES; self.navigationController.navigationBarHidden = YES;
self.rdv_tabBarController.navigationController.navigationBarHidden = YES; self.rdv_tabBarController.navigationController.navigationBarHidden = YES;
[self requestDatas];
if ([[UIApplication getObjectType:Number key:kShouldRequestDataWhenBack] boolValue]) { if ([[UIApplication getObjectType:Number key:kShouldRequestDataWhenBack] boolValue]) {
// [self.dictTableDatas removeAllObjects]; // [self.dictTableDatas removeAllObjects];
// [self reRequestTableViewDatas]; // [self reRequestTableViewDatas];
...@@ -731,6 +763,160 @@ ...@@ -731,6 +763,160 @@
} }
} }
-(void)initRightView{
checkList = [[UITableView alloc]initWithFrame:CGRectMake(0, 120, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame)-164)];
// checkList = [[UITableView alloc]init];
checkList.delegate = self;
checkList.dataSource = self;
[checkList setHidden:YES];
[self.view addSubview:checkList];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellIdentifier = @"NoticeListCell";
CheckListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell = [[CheckListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
cell.lblTitle.text = self.arrContents[indexPath.row][@"title"];
cell.lblcontent.text = self.arrContents[indexPath.row][@"context"];
cell.lblCreateTime.text = [self.arrContents[indexPath.row][@"createTime"] substringToIndex:10];
if ([self.arrContents[indexPath.row][@"isRead"] isEqualToString:@"01"]) {
cell.lblTitle.textColor = [UIColor darkGrayColor];
cell.lblCreateTime.textColor = [UIColor darkGrayColor];
cell.lblcontent.textColor = [UIColor darkGrayColor];
cell.view.hidden = NO;
}else if ([self.arrContents[indexPath.row][@"isRead"] isEqualToString:@"02"]) {
cell.lblTitle.textColor = [UIColor lightGrayColor];
cell.lblCreateTime.textColor = [UIColor lightGrayColor];
cell.lblcontent.textColor = [UIColor lightGrayColor];
cell.view.hidden = YES;
}
cell.tag = 100+[self.arrContents[indexPath.row][@"isRead"] intValue];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *strTitle = _noticeArr[indexPath.row][@"title"];
CGFloat hight1 = [strTitle boundingRectWithSize:CGSizeMake(215, CGFLOAT_MAX)
options:NSStringDrawingUsesFontLeading|NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15]}
context:nil].size.height;
NSString *strContent = _noticeArr[indexPath.row][@"content"];
CGFloat hight2 = [strContent boundingRectWithSize:CGSizeMake(275, CGFLOAT_MAX)
options:NSStringDrawingUsesFontLeading|NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13]}
context:nil].size.height+10+22+10+5;
if (hight2 > 20) {
return hight1+15+40+10;
}
else
{
return hight1+15+20+10;
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.arrContents.count;
}
#pragma mark ============= UITableView Delegate =============
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.selectedIndexPath = indexPath;
[tableView deselectRowAtIndexPath:indexPath animated:YES];
NSString* nid = _noticeArr[indexPath.row][@"noticeId"];
[DBDaoMgr updateNoticeById:nid];
[[NSNotificationCenter defaultCenter] postNotificationName:kShouldReQueryCountInit object:nil];
NoteDetailViewController *detailVC = [[NoteDetailViewController alloc] initWithNibName:nil bundle:nil];
detailVC.dictNotice = self.arrContents[indexPath.row];
[self.rdv_tabBarController.navigationController pushViewController:detailVC animated:YES];
}
- (void)requestDatas
{
[UIApplication showLoadingView:kTextShowInProgress];
NSString *interface = @"queryNoticeListEX";
NSDictionary *params = @{@"type":@"2"};
NSOperation *operation = [self.networkMgr operationWithURL:kBaseEXURL(interface)
interface:interface
params:params
dataType:BRNetMgrDataTypeJSON
method:BRNetMgrMethodPost];
[self.networkMgr startOperation:operation];
}
#pragma mark ============= BRNetworkMgr Delegate =============
- (void)httpOperationSuccess:(AFHTTPRequestOperation *)operation
result:(NSDictionary *)result
{
if ([operation.userInfo[@"interface"] isEqualToString:@"queryInitCountEX"]) {
// vcTask.arrItemTitles = [NSMutableArray arrayWithArray:
// @[[NSString stringWithFormat:@"未完成(%@)", result[@"unFinishedTaskCount"]],
// [NSString stringWithFormat:@"已完成(%@)", result[@"finishedTaskCount"]]]];
// [vcTask reloadItemTitles];
self.unFinishedTaskCount = result[@"unFinishedTaskCount"];
self.progress = [NSString stringWithFormat:@"%@",result[@"progress"]];
[DataMgr getInstance].unfinishedTaskCountToDacuxiao = result[@"dacuxiaoUndoneNum"];
[DataMgr getInstance].unfinishedTaskCountToXiaocuxiao = result[@"xiaocuxiaoUndoneNum"];
[DataMgr getInstance].unfinishedTaskCountToDaoshi = result[@"daoshiUndoneNum"];
[DataMgr getInstance].unfinishedTaskCountToMeicheng = result[@"meichenUndoneNum"];
[DataMgr getInstance].unfinishedTaskCountToXiuxiqu = result[@"xiuxiquUndoneNum"];
[DataMgr getInstance].unfinishedTaskCountToGuanggaowei = result[@"guanggaoweiUndoneNum"];
[DataMgr getInstance].unfinishedTaskCountToBeijingyinyue = result[@"beijingyinyueUndoneNum"];
[DataMgr getInstance].unfinishedTaskCountToYingyunwuliao = result[@"yingyunwuliaoUndoneNum"];
[DataMgr getInstance].serverTime = result[@"serverTime"];
NSNotification *notification =[NSNotification notificationWithName:@"reloadNumber" object:nil userInfo:nil];
//通过通知中心发送通知
[[NSNotificationCenter defaultCenter] postNotification:notification];
} else {
self.arrContents = result[@"noticeList"];
[checkList reloadData];
if(_arrContents!= nil &&[_arrContents count]>0){
[self setTableViewBackground:nil];
} else{
[self setTableViewBackground:@"pic_zanwushuju.png"];
}
}
}
-(void)setTableViewBackground:(NSString *) imgName{
if(imgName != nil){
UIImageView *view = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imgName]];
checkList.backgroundView = view;
}
}
- (void)httpOperationFailed:(AFHTTPRequestOperation *)operation
error:(NSError *)error
{
}
/* /*
#pragma mark - Navigation #pragma mark - Navigation
......
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