| | |
| | | #import "HDLEZVisitorRecordView.h" |
| | | //#import "HDLFVTempPassViewController.h" |
| | | //#import "HDLFVHttpRequestManager.h" |
| | | #import "MJRefreshNormalHeader.h" |
| | | #import "HDLEZCreatTempPassViewController.h" |
| | | #import "HDLEZTempDetailViewController.h" |
| | | @interface HDLEZVisitorRecordViewController ()<HDLEZVisitorRecordViewDelegate> |
| | | @property (nonatomic, strong) HDLEZVisitorRecordView *visitorRecordV; |
| | | @property (nonatomic, strong) MJRefreshNormalHeader *header; |
| | | |
| | | @end |
| | | |
| | |
| | | [super viewDidLoad]; |
| | | [self setTopBarViewWithTitle:HDLEZLocallizedString(@"device_temp_pass")]; |
| | | [self.topBarView.bottomLine setHidden:YES]; |
| | | |
| | | //添加按钮 |
| | | [self.topBarView.rightButton setHidden:NO]; |
| | | [self.topBarView.rightButton setBackgroundImage:[UIImage imageNamed:@"hdl_ez_temp_add"] forState:UIControlStateNormal]; |
| | | [self.topBarView.rightButton addTarget:self action:@selector(addTemp) forControlEvents:UIControlEventTouchUpInside]; |
| | | |
| | | //注册临时密码列表变化通知 |
| | | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationChangeTemP) name:HDLEZNotificationChangeTemP object:nil]; |
| | | // Do any additional setup after loading the view. |
| | |
| | | |
| | | //临时密码变化通知 |
| | | -(void)notificationChangeTemP{ |
| | | [self getTemPList]; |
| | | [_header beginRefreshing]; |
| | | } |
| | | |
| | | -(void)addSubViews{ |
| | | |
| | | [super addSubViews]; |
| | | // |
| | | _visitorRecordV=[[HDLEZVisitorRecordView alloc] init]; |
| | | [self.view addSubview:_visitorRecordV]; |
| | |
| | | }]; |
| | | _visitorRecordV.choseDelegate=self; |
| | | |
| | | [self getTemPList]; |
| | | //下拉刷新 |
| | | // 设置回调(一旦进入刷新状态,就调用target的action,也就是调用self的loadNewData方法) |
| | | _header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(getTemPList)]; |
| | | // 设置自动切换透明度(在导航栏下面自动隐藏) |
| | | _header.automaticallyChangeAlpha = YES; |
| | | // 隐藏时间 |
| | | _header.lastUpdatedTimeLabel.hidden = YES; |
| | | // 隐藏刷新状态文本 |
| | | _header.stateLabel.hidden = YES; |
| | | _visitorRecordV.mj_header=_header; |
| | | [_header beginRefreshing]; |
| | | // [self getTemPList]; |
| | | } |
| | | |
| | | /*获取临时密码列表 |
| | |
| | | __weak __typeof(self)weakSelf = self; |
| | | [[EZHttpUtil sharedManager] getTempListByHDL:self.deviceId completion:^(ResponseData * _Nonnull responseData) { |
| | | HDLEZLog(@"临时密码列表:%@",responseData.data); |
| | | weakSelf.visitorRecordV.temPList=[NSArray yy_modelArrayWithClass:[HDLEZTemInfoModel class] json:responseData.data]; |
| | | [weakSelf.header endRefreshing]; |
| | | if (responseData.success) { |
| | | weakSelf.visitorRecordV.temPList=[NSArray yy_modelArrayWithClass:[HDLEZTemInfoModel class] json:responseData.data]; |
| | | if (weakSelf.visitorRecordV.temPList.count==0) {//展示无数据 |
| | | [weakSelf showNoDataViewWithMessage:HDLEZLocallizedString(@"hdl_ez_common_no_data")]; |
| | | }else{ |
| | | [weakSelf hideNoDataView]; |
| | | } |
| | | }else{ |
| | | [weakSelf.view makeToast:responseData.message |
| | | duration:1.5 |
| | | position:@"center"]; |
| | | } |
| | | }]; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | -(void)visitorRecordViewdidSelectRecord:(HDLEZTemInfoModel *)tempDetailModel{ |
| | | // HDLFVTempPassViewController *vc=[[HDLFVTempPassViewController alloc] init]; |
| | | // vc.temPassType=HDLFVTemPassType_Detail; |
| | | // vc.temPdetailModel=tempDetailModel; |
| | | // vc.isShowDetail=YES; |
| | | // [self.navigationController pushViewController:vc animated:YES ]; |
| | | HDLEZTempDetailViewController *vc=[[HDLEZTempDetailViewController alloc] init]; |
| | | vc.temPdetailModel=tempDetailModel; |
| | | vc.deviceId=self.deviceId; |
| | | [self.navigationController pushViewController:vc animated:YES ]; |
| | | } |
| | | |
| | | /*添加临时密码 |
| | | */ |
| | | -(void)addTemp{ |
| | | HDLEZCreatTempPassViewController *vc=[[HDLEZCreatTempPassViewController alloc] init]; |
| | | vc.deviceId=self.deviceId; |
| | | [self.navigationController pushViewController:vc animated:YES]; |
| | | } |
| | | @end |