MineViewController.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. //
  2. // SettingViewController.m
  3. // IBOSS
  4. //
  5. // Created by apple on 2017/5/4.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. // 功能描述:设置控制器
  9. //
  10. #import "MineViewController.h"
  11. #import "PWModifyViewController.h"
  12. #import "Reachability.h"
  13. #import "Util.h"
  14. @interface MineViewController (){
  15. UIScrollView *scroll;
  16. // 滑动线
  17. UILabel *_sliderLabel;
  18. // 滚动条
  19. UIScrollView *_mainScrollView;
  20. // 基本信息按钮
  21. UIButton *_lastMonthBtn;
  22. // 业绩信息按钮
  23. UIButton *_currentMonthBtn;
  24. // 装修信息按钮
  25. UIButton *_currentYearBtn;
  26. CurrentStaffLastMonthPerformanceRankVc *lastMonthRankVc;
  27. CurrentStaffCurrentMonthPerformanceRankVc *currentMonthRankVc;
  28. CurrentStaffCurrentYearPerformanceRankVc *currentYearRankVc;
  29. }
  30. /**
  31. ASIDownManager请求对象
  32. */
  33. @property (nonatomic,strong) ASIDownManager *downManager;
  34. @end
  35. static int navcount = 3;
  36. @implementation MineViewController
  37. #pragma mark - 公共函数
  38. /**
  39. viewDidLoad
  40. */
  41. - (void)viewDidLoad {
  42. [super viewDidLoad];
  43. self.navigationItem.title = @"iBOSS";
  44. UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide:)];
  45. //设置成NO表示当前控件响应后会传播到其他控件上,默认为YES。
  46. tapGestureRecognizer.cancelsTouchesInView = NO;
  47. //将触摸事件添加到当前view
  48. [self.view addGestureRecognizer:tapGestureRecognizer];
  49. _staffList=[[NSMutableArray alloc]init];
  50. [self initUI];
  51. [self loadStaffData];
  52. }
  53. /**
  54. didReceiveMemoryWarning
  55. */
  56. - (void)didReceiveMemoryWarning {
  57. [super didReceiveMemoryWarning];
  58. }
  59. #pragma mark - 私有函数
  60. /**
  61. 初始化ui
  62. */
  63. - (void)initUI{
  64. [self.view setBackgroundColor:[UIColor whiteColor]];
  65. UIImage *pic = [UIImage imageNamed:@"banner_setting"];
  66. UIImageView *bannerView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.width*pic.size.height/pic.size.width)];
  67. [bannerView setImage:pic];
  68. [self.view addSubview:bannerView];
  69. UIView *separatorView = [[UIView alloc]init];
  70. [separatorView setBackgroundColor:LineBackgroundColor];
  71. separatorView.frame=CGRectMake(0, CGRectGetMaxY(bannerView.frame), self.view.frame.size.width, 10);
  72. [self.view addSubview: separatorView];
  73. CGFloat titleHeight = 50;
  74. CGFloat lblx = 20;
  75. CGFloat fontsize = 14;
  76. CGFloat valuey = 13;
  77. CGFloat valueheight = 25;
  78. CGFloat heightLine =1;
  79. CGFloat height = 350;
  80. scroll = [UIScrollView new];
  81. scroll.frame=CGRectZero;
  82. [self.view addSubview:scroll];
  83. //头布局
  84. UIView *headView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(separatorView.frame), Screen_Width, height)];
  85. UIButton *btnHead = [UIButton buttonWithType:UIButtonTypeCustom];
  86. btnHead.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  87. [scroll addSubview: headView];
  88. //名称 —————————
  89. UIView *vname = [UIView new];
  90. vname.frame=CGRectMake(0, 0, Screen_Width, titleHeight);
  91. [headView addSubview:vname];
  92. UILabel *lbtotal = [UILabel new];
  93. lbtotal.frame=CGRectMake(lblx, valuey, Screen_Width - 3*lblx, valueheight);
  94. lbtotal.font = [UIFont boldSystemFontOfSize:fontsize];
  95. NSString *str = [NSString stringWithFormat:@"用户名:%@(%@)",kkUserName,kkUserCode];
  96. lbtotal.text = str;
  97. [vname addSubview:lbtotal];
  98. bannerView = [[UIImageView alloc] initWithFrame:CGRectMake(Screen_Width - lblx - 18,valuey+4,18,12.5)];
  99. [bannerView setImage:[UIImage imageNamed:@"setting_right"]];
  100. [vname addSubview:bannerView];
  101. //分割线
  102. UIView *viewBackgroud = [UIView new];
  103. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vname.frame), Screen_Width, 10);
  104. viewBackgroud.backgroundColor = LineBackgroundColor;
  105. [headView addSubview:viewBackgroud];
  106. UIView *vPerformanceTargetTitle = [UIView new];
  107. vPerformanceTargetTitle.frame=CGRectMake(0,CGRectGetMaxY(viewBackgroud.frame), Screen_Width, titleHeight);
  108. [headView addSubview:vPerformanceTargetTitle];
  109. UIImageView *imgview1 = [UIImageView new];
  110. imgview1.frame=CGRectMake(Screen_Width/2-35-17,valuey+3, 14, 19);
  111. [imgview1 setImage:[UIImage imageNamed:@"performancerank"]];
  112. [vPerformanceTargetTitle addSubview:imgview1];
  113. UILabel *lblPerformanceTargetTitle = [UILabel new];
  114. lblPerformanceTargetTitle.frame=CGRectMake(Screen_Width/2-35, valuey, 70, valueheight);
  115. lblPerformanceTargetTitle.font = [UIFont boldSystemFontOfSize:17];
  116. lblPerformanceTargetTitle.text =@"业绩目标";
  117. [vPerformanceTargetTitle addSubview:lblPerformanceTargetTitle];
  118. viewBackgroud = [UIView new];
  119. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vPerformanceTargetTitle.frame), Screen_Width, heightLine);
  120. viewBackgroud.backgroundColor = LineBackgroundColor;
  121. [headView addSubview:viewBackgroud];
  122. UIView *navView = [[UIView alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(viewBackgroud.frame), Screen_Width, 40)];
  123. [headView setBackgroundColor:[UIColor whiteColor]];
  124. [headView addSubview:navView];
  125. _lastMonthBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  126. [_lastMonthBtn setTitleColor:[UIColor redColor] forState:UIControlStateSelected];
  127. [_lastMonthBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  128. _lastMonthBtn.frame = CGRectMake(2, 0, Screen_Width/navcount, navView.frame.size.height);
  129. _lastMonthBtn.titleLabel.font = [UIFont systemFontOfSize:TitleFontOfSize];
  130. [_lastMonthBtn addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventTouchUpInside];
  131. [_lastMonthBtn setTitle:@"上月" forState:UIControlStateNormal];
  132. _lastMonthBtn.tag = 1;
  133. _lastMonthBtn.selected = YES;
  134. [navView addSubview:_lastMonthBtn];
  135. _currentMonthBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  136. _currentMonthBtn.frame = CGRectMake(_lastMonthBtn.frame.origin.x+_lastMonthBtn.frame.size.width, _lastMonthBtn.frame.origin.y, Screen_Width/navcount, navView.frame.size.height);
  137. [_currentMonthBtn setTitleColor:[UIColor redColor] forState:UIControlStateSelected];
  138. [_currentMonthBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  139. _currentMonthBtn.titleLabel.font = [UIFont systemFontOfSize:TitleFontOfSize];
  140. [_currentMonthBtn addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventTouchUpInside];
  141. [_currentMonthBtn setTitle:@"本月" forState:UIControlStateNormal];
  142. _currentMonthBtn.tag = 2;
  143. [navView addSubview:_currentMonthBtn];
  144. // 装修
  145. _currentYearBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  146. _currentYearBtn.frame = CGRectMake(_currentMonthBtn.frame.origin.x+_currentMonthBtn.frame.size.width, _currentMonthBtn.frame.origin.y, Screen_Width/navcount, navView.frame.size.height);
  147. [_currentYearBtn setTitleColor:[UIColor redColor] forState:UIControlStateSelected];
  148. [_currentYearBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  149. _currentYearBtn.titleLabel.font = [UIFont systemFontOfSize:TitleFontOfSize];
  150. [_currentYearBtn addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventTouchUpInside];
  151. [_currentYearBtn setTitle:@"本年" forState:UIControlStateNormal];
  152. _currentYearBtn.tag = 3;
  153. [navView addSubview:_currentYearBtn];
  154. // 选中后的红线
  155. _sliderLabel = [[UILabel alloc]initWithFrame:CGRectMake(_lastMonthBtn.frame.origin.x, 40-2, Screen_Width/navcount, 2)];
  156. UIView *line = [[UIView alloc] initWithFrame:CGRectMake(((Screen_Width/navcount)-75)/2, 0, 75, 2)];
  157. line.backgroundColor = [UIColor redColor];
  158. [_sliderLabel addSubview:line];
  159. [navView addSubview:_sliderLabel];
  160. viewBackgroud = [UIView new];
  161. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(navView.frame), Screen_Width, 1);
  162. viewBackgroud.backgroundColor = LineBackgroundColor;
  163. [headView addSubview:viewBackgroud];
  164. // 滚动view
  165. _mainScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(viewBackgroud.frame), Screen_Width,180)];
  166. _mainScrollView.delegate = self;
  167. _mainScrollView.backgroundColor = [UIColor whiteColor];
  168. _mainScrollView.pagingEnabled = YES;
  169. _mainScrollView.showsHorizontalScrollIndicator = NO;
  170. _mainScrollView.showsVerticalScrollIndicator = NO;
  171. [headView addSubview:_mainScrollView];
  172. lastMonthRankVc=[[CurrentStaffLastMonthPerformanceRankVc alloc]init];
  173. currentMonthRankVc=[[CurrentStaffCurrentMonthPerformanceRankVc alloc]init];
  174. currentYearRankVc=[[CurrentStaffCurrentYearPerformanceRankVc alloc]init];
  175. NSArray *views = @[lastMonthRankVc.view,currentMonthRankVc.view ,
  176. currentYearRankVc.view];
  177. for (NSInteger i = 0; i< views.count; i++) {
  178. //把三个vc的view依次贴到mainScrollView上面
  179. UIView *pageView = [[UIView alloc]initWithFrame:CGRectMake(Screen_Width * i, 0, _mainScrollView.frame.size.width, _mainScrollView.frame.size.height)];
  180. [pageView addSubview:views[i]];
  181. [_mainScrollView addSubview:pageView];
  182. }
  183. _mainScrollView.contentSize = CGSizeMake(Screen_Width*(views.count), 0);
  184. //滚动到_currentIndex对应的tab
  185. [_mainScrollView setContentOffset:CGPointMake((_mainScrollView.frame.size.width)*_currentIndex, 0) animated:YES];
  186. [self sliderWithTag:self.currentIndex+1];
  187. [self sliderAction:_currentMonthBtn];
  188. viewBackgroud = [UIView new];
  189. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(_mainScrollView.frame), Screen_Width, 10);
  190. viewBackgroud.backgroundColor = LineBackgroundColor;
  191. [headView addSubview:viewBackgroud];
  192. float margin = 5;
  193. CGRect cg = CGRectMake(Screen_Width - lblx - 9,valuey+4,9,15 );
  194. UIView *vPerformanceRank = [UIView new];
  195. vPerformanceRank.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, titleHeight);
  196. [headView addSubview:vPerformanceRank];
  197. UIImageView *imgview;
  198. imgview = [UIImageView new];
  199. imgview.frame=CGRectMake(lblx, valuey + margin, 15, 16);
  200. [imgview setImage:[UIImage imageNamed:@"performancerank"]];
  201. [vPerformanceRank addSubview:imgview];
  202. UIButton *btnPerformanceRank= [UIButton buttonWithType:UIButtonTypeCustom];
  203. btnPerformanceRank.frame=CGRectMake(CGRectGetMaxX(imgview.frame)+2*margin, valuey, Screen_Width - CGRectGetMaxX(imgview.frame), valueheight);
  204. btnPerformanceRank.userInteractionEnabled=YES;
  205. btnPerformanceRank.titleLabel.font = [UIFont systemFontOfSize:fontsize];
  206. btnPerformanceRank.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  207. [btnPerformanceRank setTitle:@"业绩排行" forState:UIControlStateNormal];
  208. [btnPerformanceRank setTitleColor:NavTitleColor forState:UIControlStateNormal];
  209. [btnPerformanceRank addTarget:self action:@selector(performanceRank) forControlEvents:UIControlEventTouchUpInside];
  210. [vPerformanceRank addSubview:btnPerformanceRank];
  211. bannerView = [[UIImageView alloc] initWithFrame:cg];
  212. [bannerView setImage:[UIImage imageNamed:@"setting_right_arrow"]];
  213. [vPerformanceRank addSubview:bannerView];
  214. viewBackgroud = [UIView new];
  215. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vPerformanceRank.frame), Screen_Width,heightLine);
  216. viewBackgroud.backgroundColor = LineBackgroundColor;
  217. [headView addSubview:viewBackgroud];
  218. UIView *vSetting = [UIView new];
  219. vSetting.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, titleHeight);
  220. [headView addSubview:vSetting];
  221. imgview = [UIImageView new];
  222. imgview.frame=CGRectMake(lblx, valuey + margin, 15, 15);
  223. [imgview setImage:[UIImage imageNamed:@"setting"]];
  224. [vSetting addSubview:imgview];
  225. UIButton *btnSetting= [UIButton buttonWithType:UIButtonTypeCustom];
  226. btnSetting.frame=CGRectMake(CGRectGetMaxX(imgview.frame)+2*margin, valuey, Screen_Width - CGRectGetMaxX(imgview.frame), valueheight);
  227. btnSetting.userInteractionEnabled=YES;
  228. btnSetting.titleLabel.font = [UIFont systemFontOfSize:fontsize];
  229. btnSetting.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  230. [btnSetting setTitle:@"设置" forState:UIControlStateNormal];
  231. [btnSetting setTitleColor:NavTitleColor forState:UIControlStateNormal];
  232. [btnSetting addTarget:self action:@selector(setting) forControlEvents:UIControlEventTouchUpInside];
  233. [vSetting addSubview:btnSetting];
  234. cg = CGRectMake(Screen_Width - lblx - 9,valuey+4,9,15 );
  235. bannerView = [[UIImageView alloc] initWithFrame:cg];
  236. [bannerView setImage:[UIImage imageNamed:@"setting_right_arrow"]];
  237. [vSetting addSubview:bannerView];
  238. viewBackgroud = [UIView new];
  239. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vSetting.frame), Screen_Width,10);
  240. viewBackgroud.backgroundColor = LineBackgroundColor;
  241. [headView addSubview:viewBackgroud];
  242. headView.frame = CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(viewBackgroud.frame));
  243. scroll.contentSize = CGSizeMake(self.view.frame.size.width, CGRectGetMaxY(headView.frame)+rectStatusHeight+rectNavHeight);
  244. scroll.frame=CGRectMake(0, CGRectGetMaxY(separatorView.frame), Screen_Width,self.view.frame.size.height-CGRectGetMaxY(separatorView.frame)-rectStatusHeight-rectNavHeight);
  245. //
  246. // viewBackgroud = [UIView new];
  247. // viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vPerformanceRank.frame), Screen_Width,heightLine);
  248. // viewBackgroud.backgroundColor = LineBackgroundColor;
  249. // [headView addSubview:viewBackgroud];
  250. // UIView *vNotification = [UIView new];
  251. // vNotification.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, titleHeight);
  252. // [headView addSubview:vNotification];
  253. //
  254. // imgview = [UIImageView new];
  255. // imgview.frame=CGRectMake(lblx, valuey + margin, 15, 15);
  256. // [imgview setImage:[UIImage imageNamed:@"notification"]];
  257. // [vNotification addSubview:imgview];
  258. //
  259. // UIButton *btnNotification= [UIButton buttonWithType:UIButtonTypeCustom];
  260. // btnNotification.frame=CGRectMake(CGRectGetMaxX(imgview.frame)+2*margin, valuey, Screen_Width - CGRectGetMaxX(imgview.frame), valueheight);
  261. // btnNotification.titleLabel.font = [UIFont systemFontOfSize:fontsize];
  262. // btnNotification.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  263. // [btnNotification setTitle:@"通知公告" forState:UIControlStateNormal];
  264. // [btnNotification setTitleColor:NavTitleColor forState:UIControlStateNormal];
  265. // [btnNotification addTarget:self action:@selector(notification) forControlEvents:UIControlEventTouchUpInside];
  266. // [vNotification addSubview:btnNotification];
  267. //
  268. // bannerView = [[UIImageView alloc] initWithFrame:cg];
  269. // [bannerView setImage:[UIImage imageNamed:@"setting_right_arrow"]];
  270. // [vNotification addSubview:bannerView];
  271. //
  272. // viewBackgroud = [UIView new];
  273. // viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vNotification.frame), Screen_Width,heightLine);
  274. // viewBackgroud.backgroundColor = LineBackgroundColor;
  275. // [headView addSubview:viewBackgroud];
  276. }
  277. /**
  278. 滑动tag
  279. @param tag <#tag description#>
  280. */
  281. - (void)sliderWithTag:(NSInteger)tag{
  282. self.currentIndex = tag;
  283. _lastMonthBtn.selected = NO;
  284. _currentMonthBtn.selected = NO;
  285. _currentYearBtn.selected = NO;
  286. UIButton *sender = [self buttonWithTag:tag];
  287. sender.selected = YES;
  288. //动画
  289. _sliderLabel.frame = CGRectMake(sender.frame.origin.x, _sliderLabel.frame.origin.y, _sliderLabel.frame.size.width, _sliderLabel.frame.size.height);
  290. }
  291. /**
  292. 滑动label位置
  293. @param scrollView <#scrollView description#>
  294. */
  295. - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
  296. //实时计算当前位置,实现和titleView上的按钮的联动
  297. CGFloat contentOffSetX = scrollView.contentOffset.x;
  298. CGFloat X = contentOffSetX/ navcount;
  299. CGRect frame = _sliderLabel.frame;
  300. frame.origin.x = X;
  301. _sliderLabel.frame = frame;
  302. if(X > _sliderLabel.frame.size.width/2){
  303. UIView *line = _sliderLabel.subviews[0];
  304. line.frame = CGRectMake(((Screen_Width/navcount)-40)/2, 0, 40, 2);
  305. }else{
  306. UIView *line = _sliderLabel.subviews[0];
  307. line.frame = CGRectMake(((Screen_Width/navcount)-70)/2, 0, 70, 2);
  308. }
  309. }
  310. /**
  311. 滑动完成
  312. @param scrollView <#scrollView description#>
  313. */
  314. - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
  315. CGFloat contentOffSetX = scrollView.contentOffset.x;
  316. int index_ = contentOffSetX/Screen_Width;
  317. [self sliderWithTag:index_+1];
  318. }
  319. /**
  320. 返回相应的button
  321. @param tag <#tag description#>
  322. @return <#return value description#>
  323. */
  324. - (UIButton *)buttonWithTag:(NSInteger )tag{
  325. if (tag == 1) {
  326. return _lastMonthBtn;
  327. }else if (tag == 2){
  328. return _currentMonthBtn;
  329. }
  330. else if (tag == 3){
  331. return _currentYearBtn;
  332. }
  333. else{
  334. return nil;
  335. }
  336. }
  337. /**
  338. 按钮点击事件
  339. @param sender <#sender description#>
  340. */
  341. - (void)sliderAction:(UIButton *)sender{
  342. if (self.currentIndex == sender.tag) {
  343. return;
  344. }
  345. // 切换controller
  346. [self.view endEditing:YES];
  347. [self sliderAnimationWithTag:sender.tag];
  348. [UIView animateWithDuration:0.3 animations:^{
  349. _mainScrollView.contentOffset = CGPointMake(Screen_Width*(sender.tag-1), 0);
  350. } completion:^(BOOL finished) {
  351. }];
  352. }
  353. /**
  354. 滑动tag
  355. @param tag <#tag description#>
  356. */
  357. - (void)sliderAnimationWithTag:(NSInteger)tag{
  358. self.currentIndex = tag;
  359. _lastMonthBtn.selected = NO;
  360. _currentMonthBtn.selected = NO;
  361. _currentYearBtn.selected = NO;
  362. UIButton *sender = [self buttonWithTag:tag];
  363. sender.selected=YES;
  364. [sender sendActionsForControlEvents:(UIControlEventTouchUpInside)];
  365. //动画
  366. [UIView animateWithDuration:0.3 animations:^{
  367. _sliderLabel.frame = CGRectMake(sender.frame.origin.x, _sliderLabel.frame.origin.y, _sliderLabel.frame.size.width, _sliderLabel.frame.size.height);
  368. } completion:^(BOOL finished) {
  369. }];
  370. }
  371. /**
  372. 隐藏键盘
  373. @param tap <#tap description#>
  374. */
  375. - (void)keyboardHide:(UITapGestureRecognizer*)tap{
  376. [self.view endEditing:YES];
  377. }
  378. -(void)loadStaffData{
  379. NSString *urlStr = ServerURL;
  380. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  381. [dict setObject:@"GetStaffRelations" forKey:@"Action"];
  382. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  383. [dict setObject:kkUserCode forKey:@"UserCode"];
  384. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  385. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  386. [dict setObject:kkUserID forKey:@"UserID"];
  387. self.downManager = [[ASIDownManager alloc] init];
  388. _downManager.delegate = self;
  389. _downManager.onRequestSuccess = @selector(onStaffLoadFinish:);
  390. _downManager.onRequestFail = @selector(onStaffLoadFail:);
  391. [_downManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  392. }
  393. /**
  394. 加载数据成功回调
  395. @param sender <#sender description#>
  396. */
  397. - (void)onStaffLoadFinish:(ASIDownManager *)sender {
  398. // 服务器返回数据
  399. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  400. // 服务器返回数据状态值
  401. int iStatus = resultModel.status;
  402. // 服务器返回数据消息
  403. NSString *message = resultModel.message;
  404. // 服务器返回数据状态值正确
  405. if (iStatus == 0) {
  406. // 服务器返回数据结果
  407. NSArray * infoArr = (NSArray *)resultModel.result;
  408. if(infoArr!=nil&&infoArr.count>0){
  409. for(int i=0;i<infoArr.count;i++){
  410. NSDictionary *dic=[infoArr objectAtIndex:i];
  411. StaffModel *staffModel=[ StaffModel dk_modelWithDictionary:dic];
  412. [_staffList addObject:staffModel];
  413. }
  414. [currentMonthRankVc loadStaffData:_staffList];
  415. [lastMonthRankVc loadStaffData:_staffList];
  416. }
  417. }
  418. else if(iStatus == ActionResultStatusAuthError
  419. ||iStatus == ActionResultStatusNoLogin
  420. ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
  421. [self showReLoginDialog:message];
  422. }
  423. else {
  424. [self showAlertViewText:message];
  425. }
  426. }
  427. /**
  428. 数据加载失败回调
  429. @param sender <#sender description#>
  430. */
  431. - (void)onStaffLoadFail:(ASIDownManager *)sender {
  432. [self showAlertViewText:@"网络异常"];
  433. }
  434. -(void)performanceRank{
  435. PerformanceRankListVc *rankVc=[[PerformanceRankListVc alloc]init];
  436. self.hidesBottomBarWhenPushed=YES;
  437. rankVc.staffList=_staffList;
  438. [self.navigationController setNavigationBarHidden:NO animated:YES];
  439. [self.navigationController pushViewController:rankVc animated:YES];
  440. self.hidesBottomBarWhenPushed=NO;
  441. }
  442. -(void)setting{
  443. SettingViewController *setVc=[[SettingViewController alloc]init];
  444. self.hidesBottomBarWhenPushed=YES;
  445. [self.navigationController setNavigationBarHidden:NO animated:YES];
  446. [self.navigationController pushViewController:setVc animated:YES];
  447. self.hidesBottomBarWhenPushed=NO;
  448. }
  449. -(void)notification{
  450. self.hidesBottomBarWhenPushed=YES;
  451. NotificationHomeVc *homeVC = [[NotificationHomeVc alloc] init];
  452. [self.navigationController pushViewController:homeVC animated:YES];
  453. [self.navigationController setNavigationBarHidden:NO animated:YES];
  454. self.hidesBottomBarWhenPushed=NO;
  455. }
  456. @end