| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628 |
- //
- // SalesAchievementRankHomeViewController.m
- // IBOSS
- //
- // Created by guan hong hou on 2017/8/21.
- // Copyright © 2017年 elongtian. All rights reserved.
- //
- // 功能描述:销售业绩排行主页控制器
- #import "SalesAchievementRankHomeViewController.h"
- #import "SalesAchievementRankModel.h"
- #import "SideSlipModel.h"
- #import "SalesAchievementSearchModel.h"
- #import "SalesAchievementListFrame.h"
- @implementation SalesAchievementRankHomeViewController
- /**
- 导航数
- */
- static int navcount = 2;
- #pragma 公共函数
- /**
- 视图加载完成函数
- */
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.navigationItem.title = @"销售业绩排行";
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- [button setBackgroundImage:[UIImage imageNamed:@"icon_back.png"]
- forState:UIControlStateNormal];
- [button addTarget:self action:@selector(goBack)
- forControlEvents:UIControlEventTouchUpInside];
- button.frame = CGRectMake(0, 0, 15, 18);
- UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
- self.navigationItem.leftBarButtonItem = menuButton;
- //右边
- UIView *v = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 40, 16)];
- UIButton *btnfilter = [UIButton buttonWithType:UIButtonTypeCustom];
- [btnfilter addTarget:self action:@selector(search)
- forControlEvents:UIControlEventTouchUpInside];
- btnfilter.frame = CGRectMake(0, 0, 16, 16);
- [btnfilter setTitleColor:NavBarItemColor forState:UIControlStateNormal];
- [btnfilter setBackgroundImage:[UIImage imageNamed:@"icon_filter_white"]
- forState:UIControlStateNormal];
- [v addSubview:btnfilter];
- UIButton *filterLbl = [[UIButton alloc]init];
- filterLbl.frame=CGRectMake(CGRectGetMaxX(btnfilter.frame)+3,0,28, 16);
- [filterLbl setTitle:@"筛选" forState:UIControlStateNormal];
- [filterLbl setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- filterLbl.titleLabel.font = [UIFont systemFontOfSize:ButtonFontOfSize];
- [filterLbl addTarget:self action:@selector(search)
- forControlEvents:UIControlEventTouchUpInside];
- [v addSubview:filterLbl];
- UIBarButtonItem *menubtnAdd = [[UIBarButtonItem alloc] initWithCustomView:v];
- self.navigationItem.rightBarButtonItem = menubtnAdd;
- _rankType = @"1";
- _mEndDate = [DateFormat getCurrentDate];
- _mStartDate = [DateFormat getDateBefore:31];
- [self initUI];
- [self setMainSrollView];
- [self sliderWithTag:self.currentIndex+1];
- [self loadData];
- }
- /**
- 初始化销售业绩图表控制器
- @return <#return value description#>
- */
- - ( SalesAchievementChartViewController *)chartViewVC{
- if (_chartViewVC == nil) {
- _chartViewVC = [[SalesAchievementChartViewController alloc] init];
-
- }
- return _chartViewVC ;
- }
- /**
- 初始化销售业绩列表控制器
- @return <#return value description#>
- */
- - (SalesAchievementDataListViewController *)dataListVC{
- if (_dataListVC == nil) {
- _dataListVC = [[SalesAchievementDataListViewController alloc] init];
-
- }
- return _dataListVC;
- }
- #pragma mark - 委托函数
- /**
- 滑动label位置
- @param scrollView <#scrollView description#>
- */
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
- //实时计算当前位置,实现和titleView上的按钮的联动
- CGFloat contentOffSetX = scrollView.contentOffset.x;
- CGFloat X = contentOffSetX/ navcount;
- CGRect frame = _sliderLabel.frame;
- frame.origin.x = X;
- _sliderLabel.frame = frame;
- }
- /**
- 滑动完成
- @param scrollView <#scrollView description#>
- */
- - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
- CGFloat contentOffSetX = scrollView.contentOffset.x;
- int index = contentOffSetX/Screen_Width;
- [self sliderWithTag:index + 1];
- }
- /**
- 加载总数数据成功回调
-
- @param sender <#sender description#>
- */
- - (void)onSalesAchievementFinish:(ASIDownManager *)sender {
-
- for(UIView *view in [_chartViewVC.view subviews])
- {
- if(view.tag==1001){
- [view removeFromSuperview];
- }
- }
- // 服务器返回数据
- // 服务器返回数据
- NSDictionary *dic = [sender.mWebStr JSONValue];
- // 服务器返回数据状态值
- if (dic && [dic isKindOfClass:[NSDictionary class]])
- {
- // 服务器返回数据状态值
- int iStatus = [[dic objectForKey:@"Status"] intValue];
- [self cancel];
- // 服务器返回数据消息
- NSString *message = [dic objectForKey:@"Message"];
- // 服务器返回数据状态值正确
- if (iStatus == 0) {
- // 服务器返回数据结果
- NSArray * infoArr = [dic objectForKey:@"Result"];
- // double totalAmount = 0;
- _rankList = [[NSMutableArray alloc]init];
- _dataListVC.refreshTableView.mTableView.backgroundView = nil;
- if(infoArr != nil && infoArr.count > 0){
- double totalAmount = 0;
- for(int i = 0;i < infoArr.count;i++){
- NSDictionary *dic = infoArr[i];
- double goodsAmount = [[dic objectForKey:@"GoodsAmount"] doubleValue];
- totalAmount += goodsAmount;
- }
-
- for(int i = 0;i < infoArr.count;i++){
- NSDictionary *dic = infoArr[i];
- double goodsAmount = [[dic objectForKey:@"GoodsAmount"] doubleValue];
- NSString *objectName = [dic objectForKey:@"ObjectName"];
- NSInteger objectCustomerCount = [[dic objectForKey:@"ObjectCustomerCount"]integerValue];
- NSInteger orderSort = [[dic objectForKey:@"OrderSort"]integerValue];
- NSInteger salesItemCount = [[dic objectForKey:@"ObjectNoCount"]integerValue];
- SalesAchievementRankModel *model = [SalesAchievementRankModel new];
- [model setGoodsAmount:goodsAmount];
- [model setObjectName:objectName];
- [model setOrderSort:orderSort];
- [model setSalesCustomerCount:objectCustomerCount];
- [model setSalesItemCount:salesItemCount];
- double salesPercent = goodsAmount / totalAmount * 100;
- NSString *percent = [NSString stringWithFormat:@"%.2f",salesPercent];
- [model setPercent:percent];
- double customerAverage = goodsAmount/objectCustomerCount;
- [model setAverage:customerAverage];
- SalesAchievementListFrame *frame = [[SalesAchievementListFrame alloc]init];
- [frame setSalesAchievementListFrame:model];
- [_rankList addObject:frame];
- }
-
- NSString *totalAmountStr = [NSString stringWithFormat:@"¥%.2f", totalAmount];
- _salesAmountLabel.text = totalAmountStr;
- if(_currentIndex == 1){
- _chartViewVC.rankList = _rankList;
- [_chartViewVC refreshData];
- }
- else if(_currentIndex == 2){
- _dataListVC.rankList = _rankList;
- [_dataListVC refreshData];
- }
-
- }
- else{
- if(_currentIndex == 1){
- if( _chartViewVC.histogramView!=nil){
- [ _chartViewVC.histogramView removeFromSuperview];
- }
- for(UIView *view in [_chartViewVC.view subviews])
- {
- if(view.tag==1001){
- [view removeFromSuperview];
- }
- }
- _noDataView = [self noDataViewByFrame:CGRectMake(0,CGRectGetMaxY(_chartViewVC.bottomSeparatorView.frame),Screen_Width,Screen_Height-rectNavHeight-rectStatusHeight-160)];
- _noDataView.tag=1001;
- // 有刷新数据的时候
- [_chartViewVC.view addSubview:_noDataView];
-
- }
- else if(_currentIndex == 2){
- [_dataListVC.rankPagingList removeAllObjects];
- [_dataListVC.rankList removeAllObjects];
- [_dataListVC.refreshTableView reloadData];
- // 无数据的view
- UIView *noDataView = [self noDataViewByFrame:_dataListVC.refreshTableView.mTableView.bounds];
- // 有刷新数据的时候
- _dataListVC.refreshTableView.mTableView.backgroundView = noDataView;
- _dataListVC.refreshTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- [self showAlertViewBackText:@"未找到匹配结果"];
-
- }
-
- }
-
- }
-
-
- // 服务器返回数据状态值异常
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){
-
- [self showReLoginDialog:message];
- }
- else{
- // [vCustomTableView FinishLoading];
- [self showAlertViewText:message];
- }
- }
- }
- /**
- 电话权限加载失败
- @param sender <#sender description#>
- */
- - (void)onSalesAchievementFail:(ASIDownManager *)sender {
- [self showAlertViewText:@"网络异常"];
- }
- #pragma mark - 私有函数
- /*
- 初始化UI
- */
- - (void)initUI{
- [self.navigationController.navigationBar setShadowImage:[UIImage new]];
- self.edgesForExtendedLayout = UIRectEdgeNone;
- UIView *titleView = [[UIView alloc]init];
- titleView.backgroundColor = self.navigationController.navigationBar.barTintColor;
- titleView.frame = CGRectMake(0, 0, Screen_Width, 40);
- UILabel *titleSalesAmount = [[UILabel alloc]init];
- titleSalesAmount.frame = CGRectMake(20, 10, 100, 25);
- titleSalesAmount.text = @"销售金额 (元)";
- titleSalesAmount.textColor = [UIColor whiteColor];
- titleSalesAmount.font = [UIFont systemFontOfSize:16];
- [titleView addSubview:titleSalesAmount];
- [self.view addSubview:titleView];
- _salesAmountLabel = [[UILabel alloc]init];
- _salesAmountLabel.frame = CGRectMake(CGRectGetMaxX(titleSalesAmount.frame),10, 200, 25);
- _salesAmountLabel.textColor = [UIColor whiteColor];
- _salesAmountLabel.font = [UIFont systemFontOfSize:16];
- [titleView addSubview:_salesAmountLabel];
- UIView *navView = [[UIView alloc]initWithFrame:CGRectMake(0, 40, Screen_Width, 40)];
- [self.view addSubview:navView];
- [self.view setBackgroundColor:[UIColor whiteColor]];
- _chartButton = [UIButton buttonWithType:UIButtonTypeCustom];
- [_chartButton setTitleColor:[UIColor redColor] forState:UIControlStateSelected];
- [_chartButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- _chartButton.frame = CGRectMake(0, 0, Screen_Width/navcount, navView.frame.size.height);
- _chartButton.titleLabel.font = [UIFont systemFontOfSize:ButtonFontOfSize];
- [_chartButton addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventTouchUpInside];
- [_chartButton setTitle:@"图形(前10条)" forState:UIControlStateNormal];
- _chartButton.tag = 1;
- _chartButton.selected = YES;
- [navView addSubview:_chartButton];
- _dataButton= [UIButton buttonWithType:UIButtonTypeCustom];
- _dataButton.frame = CGRectMake(CGRectGetMaxX(_chartButton.frame),0, Screen_Width/navcount, navView.frame.size.height);
- [_dataButton setTitleColor:[UIColor redColor] forState:UIControlStateSelected];
- [_dataButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- _dataButton.titleLabel.font = [UIFont systemFontOfSize:ButtonFontOfSize];
- [_dataButton addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventTouchUpInside];
- [ _dataButton setTitle:@"全部列表数据" forState:UIControlStateNormal];
- _dataButton.titleLabel.font = [UIFont systemFontOfSize:ButtonFontOfSize];
- _dataButton.tag = 2;
- [navView addSubview: _dataButton];
- _sliderLabel = [[UILabel alloc]initWithFrame:CGRectMake(_chartButton.frame.origin.x, 40-2, Screen_Width/navcount, 2)];
- UIView *line = [[UIView alloc] initWithFrame:CGRectMake(((Screen_Width/navcount)-50)/2, 0, 50, 2)];
- line.backgroundColor = [UIColor redColor];
- [_sliderLabel addSubview:line];
- [navView addSubview:_sliderLabel];
- __weak typeof(self) weakself = self;
- // 抽屉对象
- self.filterController = [[SideSlipFilterController alloc] initWithSponsor:self resetBlock:^(NSArray *dataList) {
- for (SideSlipModel *model in dataList) {
- model.selectedItemList = nil;
- model.customDict = nil;
- }
- } commitBlock:^(NSArray *dataList) {
- // 查询条件
- SideSlipModel *serviceRegionModel = dataList[0];
- SalesAchievementSearchModel *m = [serviceRegionModel.customDict objectForKey:SEARCH_RANGE_MODEL];
- _rankType = m.rankType;
- _mStartDate = m.startDate;
- _mEndDate = m.endDate;
- if(_rankType == nil){
- [self showAlertViewText:@"请选择排行类型"];
- return;
- }
-
- if(_mStartDate == nil){
- [self showAlertViewText:@"请选择开始日期"];
- return;
- }
- if(_mEndDate == nil){
- [self showAlertViewText:@"请选择结束日期"];
- return;
- }
- NSUInteger result = [DateFormat compareDate:_mStartDate withDate:_mEndDate];
- if(result == -1){
- [self showAlertViewText:@"开始日期不能大于结束日期"];
- return;
- }
- NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
- [dateFormat setDateFormat:@"yyyy-MM-dd"];//设定时间格式,这里可以设置成自己需要的格式
- NSDate *startD = [dateFormat dateFromString:_mStartDate];
- NSDate *endD = [dateFormat dateFromString:_mEndDate];
- NSInteger days = [DateFormat calculateDaysFromBegin:startD end:endD];
- if(days > 31){
- [self showAlertViewText:@"日期间隔天数不能大于31天"];
- return;
- }
- _salesAmountLabel.text=@"";
- [self loadData];
- [weakself.filterController dismiss];
- }];
- _filterController.animationDuration = AnimationDuration;
- _filterController.hasHeadView = YES;
- _filterController.sideSlipLeading = UIScreenSideSlipLeading*[UIScreen mainScreen].bounds.size.width;
- _filterController.dataList = [self packageDataList];
- }
- /**
- 无数据的view
-
- @param frame <#frame description#>
- @return <#return value description#>
- */
- - (UIView *)noDataViewByFrame:(CGRect)frame{
- UIView *noDataView = [[UIView alloc]init];
- noDataView.frame = frame;
- UIImageView *nodataImgView = [[UIImageView alloc] initWithFrame:CGRectMake(noDataView.frame.size.width/2-16,noDataView.frame.size.height/2-16,32,32)];
- [nodataImgView setImage:[UIImage imageNamed:@"icon_no_data"]];
- [noDataView addSubview:nodataImgView];
- UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(noDataView.frame.size.width/2-16-12,CGRectGetMaxY(nodataImgView.frame)+3,70, 25)];
- label.font = [UIFont systemFontOfSize:NoDataFontOfSize];
- label.text = @"无数据";
- label.numberOfLines = 2;
- label.textColor = [UIColor lightGrayColor];
- [noDataView addSubview:label];
- return noDataView;
- }
- /**
- 数据源
-
- @return <#return value description#>
- */
- - (NSArray *)packageDataList {
- NSMutableArray *dataArray = [NSMutableArray array];
- SideSlipModel *model = [[SideSlipModel alloc] init];
- model.containerCellClass = @"SalesAchievementSearchCell";
- model.regionTitle = @"查询条件";
- [dataArray addObject:model];
- return [dataArray mutableCopy];
- }
- /**
- 打开抽屉
- */
- -(void)search{
- [_filterController show];
- }
- /**
- 滑动tag
- @param tag <#tag description#>
- */
- - (void)sliderWithTag:(NSInteger)tag{
- self.currentIndex = tag;
- _chartButton.selected = NO;
- _dataButton.selected = NO;
- UIButton *sender = [self buttonWithTag:tag];
- sender.selected = YES;
- //动画
- _sliderLabel.frame = CGRectMake(sender.frame.origin.x, _sliderLabel.frame.origin.y, _sliderLabel.frame.size.width, _sliderLabel.frame.size.height);
- if(_rankList!=nil&&_rankList.count>0){
- if(_currentIndex == 1){
- _chartViewVC.rankList = _rankList;
- [_chartViewVC refreshData];
- }
- else if(_currentIndex == 2){
- _dataListVC.rankList = _rankList;
- [_dataListVC refreshData];
- }
- }
- else{
- if(_currentIndex == 1){
- if( _chartViewVC.histogramView!=nil){
- [ _chartViewVC.histogramView removeFromSuperview];
- }
- for(UIView *view in [_chartViewVC.view subviews])
- {
- if(view.tag==1001){
- [view removeFromSuperview];
- }
- }
- _noDataView = [self noDataViewByFrame:CGRectMake(0,CGRectGetMaxY(_chartViewVC.bottomSeparatorView.frame),Screen_Width,Screen_Height-rectNavHeight-rectStatusHeight-160)];
- _noDataView.tag=1001;
- // 有刷新数据的时候
- [_chartViewVC.view addSubview:_noDataView];
-
- }
- else if(_currentIndex == 2){
- [_dataListVC.rankPagingList removeAllObjects];
- [_dataListVC.rankList removeAllObjects];
- [_dataListVC.refreshTableView reloadData];
- _noDataView=[[UIView alloc]init];
- _noDataView.frame= _dataListVC.refreshTableView.bounds;
- UIImageView *nodataImgView=[[UIImageView alloc] initWithFrame:CGRectMake(_noDataView.frame.size.width/2-16,_noDataView.frame.size.height/2-16,32,32)];
- [nodataImgView setImage:[UIImage imageNamed:@"icon_no_data"]];
- [_noDataView addSubview:nodataImgView];
- UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(_noDataView.frame.size.width/2-16-12,CGRectGetMaxY(nodataImgView.frame)+3,70, 25)];
- label.font=[UIFont systemFontOfSize:NoDataFontOfSize];
- label.text = @"无数据";
- label.numberOfLines = 2;
- label.textColor = [UIColor lightGrayColor];
- [_noDataView addSubview:label];
- // 有刷新数据的时候
- _dataListVC.refreshTableView.mTableView.backgroundView = _noDataView;
- _dataListVC.refreshTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
-
- }
-
- }
-
- }
- /**
- 安全区视图发生变化
- */
- -(void)viewSafeAreaInsetsDidChange{
- self.view.backgroundColor = [UIColor whiteColor];
- _mainScrollView.frame = CGRectMake(0, 80, Screen_Width,self.view.safeAreaLayoutGuide.layoutFrame.size.height-80);
- for (NSInteger i = 0; i < _mainScrollView.subviews.count; i++) {
- _mainScrollView.subviews[i].frame = CGRectMake(Screen_Width * i, 0, Screen_Width,CGRectGetHeight(_mainScrollView.frame));
- }
- [self.chartViewVC viewSafeAreaInsetsDidChange];
- [self.dataListVC viewSafeAreaInsetsDidChange];
- [super viewSafeAreaInsetsDidChange];
- }
- /**
- 初始化scrollView
- */
- - (void)setMainSrollView{
- _mainScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 80, Screen_Width, self.view.frame.size.height)];
- _mainScrollView.delegate = self;
- _mainScrollView.backgroundColor = [UIColor whiteColor];
- _mainScrollView.pagingEnabled = YES;
- _mainScrollView.showsHorizontalScrollIndicator = NO;
- _mainScrollView.showsVerticalScrollIndicator = NO;
- [self.view addSubview:_mainScrollView];
- NSArray *views = @[self.chartViewVC.view,self.dataListVC.view];
- for (NSInteger i = 0; i < views.count; i++) {
- //把三个vc的view依次贴到mainScrollView上面
- UIView *pageView = [[UIView alloc]initWithFrame:CGRectMake(Screen_Width * i, 0, _mainScrollView.frame.size.width, _mainScrollView.frame.size.height - 100)];
- [pageView addSubview:views[i]];
- [_mainScrollView addSubview:pageView];
- }
- _mainScrollView.contentSize = CGSizeMake(Screen_Width*(views.count), 0);
- //滚动到_currentIndex对应的tab
- [_mainScrollView setContentOffset:CGPointMake((_mainScrollView.frame.size.width)*_currentIndex, 0) animated:YES];
- }
- /**
- * 返回函数
- */
- - (void)goBack
- {
- [self.navigationController popViewControllerAnimated:YES];
-
- }
- /**
- 加载数据
- */
- -(void)loadData{
- [self startLoading];
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"SalesPerformanceRankingIphone" forKey:@"Action"];
- [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [dict setObject:_mStartDate forKey:@"AccountDateFrom"];
- [dict setObject:_mEndDate forKey:@"AccountDateTo"];
- [dict setObject:_rankType forKey:@"SortType"];
- _downManager = [[ASIDownManager alloc] init];
- _downManager.delegate = self;
- _downManager.OnImageDown = @selector(onSalesAchievementFinish:);
- _downManager.OnImageFail = @selector(onSalesAchievementFail:);
- [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
- }
- /**
- 隐藏进度条
- */
- - (void)cancel {
- [self stopLoading];
- }
- /**
- 按钮点击事件
- @param sender <#sender description#>
- */
- - (void)sliderAction:(UIButton *)sender{
- if (self.currentIndex == sender.tag) {
- return;
- }
- [self.view endEditing:YES];
- [self sliderAnimationWithTag:sender.tag];
- [UIView animateWithDuration:0.3 animations:^{
- _mainScrollView.contentOffset = CGPointMake(Screen_Width * (sender.tag-1), 0);
- } completion:^(BOOL finished) {
-
- }];
- if(_rankList!=nil&&_rankList.count>0){
- if(_currentIndex == 1){
- _chartViewVC.rankList = _rankList;
- [_chartViewVC refreshData];
- }
- else if(_currentIndex == 2){
- _dataListVC.rankList = _rankList;
- [_dataListVC refreshData];
- }
- }
- else{
- if(_currentIndex == 1){
- if( _chartViewVC.histogramView!=nil){
- [ _chartViewVC.histogramView removeFromSuperview];
- }
- for(UIView *view in [_chartViewVC.view subviews])
- {
- if(view.tag==1001){
- [view removeFromSuperview];
- }
- }
-
- _noDataView = [self noDataViewByFrame:CGRectMake(0,CGRectGetMaxY(_chartViewVC.bottomSeparatorView.frame),Screen_Width,Screen_Height-rectNavHeight-rectStatusHeight-160)];
- _noDataView.tag=1001;
- [_chartViewVC.view addSubview:_noDataView];
-
- }
- else if(_currentIndex == 2){
- [_dataListVC.rankPagingList removeAllObjects];
- [_dataListVC.rankList removeAllObjects];
- [_dataListVC.refreshTableView reloadData];
- UIView *noDataView = [self noDataViewByFrame:_dataListVC.refreshTableView.mTableView.bounds];
- // 有刷新数据的时候
- _dataListVC.refreshTableView.mTableView.backgroundView = noDataView;
- _dataListVC.refreshTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
-
- }
-
- }
- }
- /**
- 滑动tag
- @param tag <#tag description#>
- */
- - (void)sliderAnimationWithTag:(NSInteger)tag{
- self.currentIndex = tag;
- _chartButton.selected = NO;
- _dataButton.selected = NO;
- UIButton *sender = [self buttonWithTag:tag];
- sender.selected = YES;
- //动画
- [UIView animateWithDuration:0.3 animations:^{
- _sliderLabel.frame = CGRectMake(sender.frame.origin.x, _sliderLabel.frame.origin.y, _sliderLabel.frame.size.width, _sliderLabel.frame.size.height);
-
- } completion:^(BOOL finished) {
-
- }];
-
-
- }
- /*
- 获得导航按钮
- */
- - (UIButton *)buttonWithTag:(NSInteger )tag{
- if (tag == 1) {
- return _chartButton;
- }
- else if (tag == 2){
- return _dataButton;
- }
-
- else{
- return nil;
- }
- }
- @end
|