// // SecurityController.m // AIIM // // Created by qitewei on 2025/5/5. // #import "SecurityController.h" #import "ChangePasswordController.h" #import "GCoverController.h" #import "SecurityPasswordController.h" #import "AppLockPasswordController.h" #import "APPLockerChangeController.h" #import "DeleteAccountController.h" #import "UserNetApi.h" #import "UDManager.h" #import "APPLocker.h" @interface SecurityController () @property (nonatomic, strong) NSMutableArray * cellDatas; @property (nonatomic, strong) UITableView * tableView; @end @implementation SecurityController - (void)viewDidLoad { [super viewDidLoad]; [self configUI]; [self initCelldata]; } - (void)configUI{ [self setNavigationBarHidden:NO animated:YES]; [self setNavigationTitle:NSLocalizedString(@"userCenter-zhanghaoaq", @"")]; // 设置导航栏背景色 [self setNavigationBarTransparent:YES]; [self setNavigationBarBackgroundColor:UIColor.clearColor]; // 设置标题颜色和字体 [self setNavigationTitleColor:[UIColor whiteColor] font:[UIFont boldSystemFontOfSize:16]]; UIImageView * bgImageView = [[UIImageView alloc] initWithImage:kImageMake(@"loginBG")]; [self.view addSubview:bgImageView]; [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.bottom.mas_equalTo(0); }]; [self.view addSubview:self.tableView]; [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.mas_equalTo(0); make.top.mas_equalTo(SCREEN_TOP); make.left.mas_equalTo(16); make.right.mas_equalTo(-16); }]; // 设置返回按钮 [self setBackButtonTitle:@""]; [self setBackButtonColor:[UIColor whiteColor]]; self.view.backgroundColor = UIColor.blackColor; self.tableView.sectionHeaderTopPadding = 0; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellT"]; } -(void)initCelldata{ NSDictionary *d4 =@{ @"name":@"userCenter-xiugaimm", @"image":@"wxiugmm", }; NSDictionary *d5 =@{ @"name":@"userCenter-anquanmm", @"image":@"wanquan", }; NSDictionary *d6 =@{ @"name":@"userCenter-yingysm", @"image":@"wyingys", }; NSDictionary *d12 =@{ @"name":@"userCenter-chongzhimm", @"image":@"wchongzmm", }; NSDictionary *d13 =@{ @"name":@"userCenter-zhuxiaozh", @"image":@"wzhuxiaozz", }; _cellDatas = [[NSMutableArray alloc] init]; [_cellDatas addObject:d4]; [_cellDatas addObject:d6]; [_cellDatas addObject:d5]; [_cellDatas addObject:d12]; [_cellDatas addObject:d13]; } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return self.cellDatas.count; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 52.0; } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ return [UIView new]; } - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ if(section==1||section==2){ return 60; } return 5.f; } - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ UIView *view =[UIView new]; if(section==1){ UILabel *notlb = [[UILabel alloc] init]; notlb.frame = CGRectMake(0, 0, tableView.frame.size.width, 60); [view addSubview:notlb]; notlb.font = [UIFont systemFontOfSize:15]; notlb.textColor = [UIColor whiteColor]; notlb.numberOfLines=2; notlb.text = NSLocalizedString(@"APPnote-yingyongsuo", @""); } if(section==2){ UILabel *notlb = [[UILabel alloc] init]; notlb.frame = CGRectMake(0, 0, tableView.frame.size.width, 60); [view addSubview:notlb]; notlb.font = [UIFont systemFontOfSize:15]; notlb.textColor = [UIColor whiteColor]; notlb.numberOfLines=2; notlb.text = NSLocalizedString(@"APPnote-anquanmim", @""); } return view; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return 5.f; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSInteger section =indexPath.section; NSString *cellT =@"cellT"; UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:cellT forIndexPath:indexPath]; if(cell==nil){ cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellT]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.backgroundColor = [UIColor clearColor]; NSDictionary *time =_cellDatas[section]; NSString *title = NSLocalizedString(time[@"name"], @""); cell.imageView.image = [UIImage imageNamed:time[@"image"]]; cell.textLabel.text =title; cell.textLabel.textColor = [UIColor whiteColor]; UIImageView *right = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow-right"]]; CGRect ctfrm = cell.contentView.frame; right.frame = CGRectMake(ctfrm.size.width-30, 16, 20, 20); [cell.contentView addSubview:right]; cell.contentView.layer.borderWidth = 0.5f; cell.contentView.layer.borderColor = [UIColor lightGrayColor].CGColor; //globalColor(GCTypeGreen); cell.contentView.layer.cornerRadius = 8.0f; // 可选,设置圆角 return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.section == 0) { //修改密码 ChangePasswordController * changePwdVc = [[ChangePasswordController alloc] init]; [self.navigationController pushViewController:changePwdVc animated:YES]; } if (indexPath.section == 1) { //应用密码 if ([APPLocker.sharedLocker isPasswordSet]) { APPLockerChangeController * appLockChangeVc = [[APPLockerChangeController alloc] init]; [self.navigationController pushViewController:appLockChangeVc animated:YES]; }else{ AppLockPasswordController * appLockVc = [[AppLockPasswordController alloc] init]; appLockVc.mode = LockViewModeSet; UINavigationController * navi = [[UINavigationController alloc] initWithRootViewController:appLockVc]; navi.modalPresentationStyle = UIModalPresentationFullScreen; appLockVc.onSuccess = ^{ }; appLockVc.onCancel = ^{ }; [self presentViewController:navi animated:YES completion:nil]; } } if (indexPath.section == 2) { //安全密码,不交验直接设置新的 SecurityPasswordController * securityPwdVc = [[SecurityPasswordController alloc] init]; [self.navigationController pushViewController:securityPwdVc animated:YES]; } if (indexPath.section == 3) { // 重置密码 GCoverController * resetPwdVc = [[GCoverController alloc] init]; resetPwdVc.isLogin = YES; resetPwdVc.modalPresentationStyle = UIModalPresentationFullScreen; [self presentViewController:resetPwdVc animated:YES completion:nil]; } if (indexPath.section == 4) { //注销账号 DeleteAccountController * deleteAccountVc = [[DeleteAccountController alloc] init]; [self.navigationController pushViewController:deleteAccountVc animated:YES]; } } - (UITableView *)tableView{ if (!_tableView) { _tableView = [[UITableView alloc] initWithFrame:CGRectZero]; _tableView.delegate = self; _tableView.dataSource = self; _tableView.backgroundColor = UIColor.clearColor; } return _tableView; } #pragma mark statusBar - (UIStatusBarStyle)preferredStatusBarStyle{ return UIStatusBarStyleLightContent; } @end