萤石云 iOSSDK,移植跨平台相关工程
Davin
2024-12-18 b4e1288a9b63eb820e9c9489c56aac4bf6b31067
EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZVisitorRecordViewController.m
@@ -10,8 +10,12 @@
#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
@@ -21,7 +25,11 @@
    [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.
@@ -35,11 +43,11 @@
//临时密码变化通知
-(void)notificationChangeTemP{
    [self getTemPList];
    [_header beginRefreshing];
}
-(void)addSubViews{
    [super addSubViews];
    //
    _visitorRecordV=[[HDLEZVisitorRecordView alloc] init];
    [self.view addSubview:_visitorRecordV];
@@ -49,7 +57,18 @@
    }];
    _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];
}
/*获取临时密码列表
@@ -58,7 +77,19 @@
    __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"];
        }
    }];
}
@@ -79,10 +110,17 @@
-(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