SecurityController.m 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. //
  2. // SecurityController.m
  3. // AIIM
  4. //
  5. // Created by qitewei on 2025/5/5.
  6. //
  7. #import "SecurityController.h"
  8. #import "ChangePasswordController.h"
  9. #import "GCoverController.h"
  10. #import "SecurityPasswordController.h"
  11. #import "AppLockPasswordController.h"
  12. #import "APPLockerChangeController.h"
  13. #import "DeleteAccountController.h"
  14. #import "UserNetApi.h"
  15. #import "UDManager.h"
  16. #import "APPLocker.h"
  17. @interface SecurityController ()<UITableViewDelegate,UITableViewDataSource>
  18. @property (nonatomic, strong) NSMutableArray * cellDatas;
  19. @property (nonatomic, strong) UITableView * tableView;
  20. @end
  21. @implementation SecurityController
  22. - (void)viewDidLoad {
  23. [super viewDidLoad];
  24. [self configUI];
  25. [self initCelldata];
  26. }
  27. - (void)configUI{
  28. [self setNavigationBarHidden:NO animated:YES];
  29. [self setNavigationTitle:NSLocalizedString(@"userCenter-zhanghaoaq", @"")];
  30. // 设置导航栏背景色
  31. [self setNavigationBarTransparent:YES];
  32. [self setNavigationBarBackgroundColor:UIColor.clearColor];
  33. // 设置标题颜色和字体
  34. [self setNavigationTitleColor:[UIColor whiteColor] font:[UIFont boldSystemFontOfSize:16]];
  35. UIImageView * bgImageView = [[UIImageView alloc] initWithImage:kImageMake(@"loginBG")];
  36. [self.view addSubview:bgImageView];
  37. [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.left.right.top.bottom.mas_equalTo(0);
  39. }];
  40. [self.view addSubview:self.tableView];
  41. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.bottom.mas_equalTo(0);
  43. make.top.mas_equalTo(SCREEN_TOP);
  44. make.left.mas_equalTo(16);
  45. make.right.mas_equalTo(-16);
  46. }];
  47. // 设置返回按钮
  48. [self setBackButtonTitle:@""];
  49. [self setBackButtonColor:[UIColor whiteColor]];
  50. self.view.backgroundColor = UIColor.blackColor;
  51. self.tableView.sectionHeaderTopPadding = 0;
  52. [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellT"];
  53. }
  54. -(void)initCelldata{
  55. NSDictionary *d4 =@{
  56. @"name":@"userCenter-xiugaimm",
  57. @"image":@"wxiugmm",
  58. };
  59. NSDictionary *d5 =@{
  60. @"name":@"userCenter-anquanmm",
  61. @"image":@"wanquan",
  62. };
  63. NSDictionary *d6 =@{
  64. @"name":@"userCenter-yingysm",
  65. @"image":@"wyingys",
  66. };
  67. NSDictionary *d12 =@{
  68. @"name":@"userCenter-chongzhimm",
  69. @"image":@"wchongzmm",
  70. };
  71. NSDictionary *d13 =@{
  72. @"name":@"userCenter-zhuxiaozh",
  73. @"image":@"wzhuxiaozz",
  74. };
  75. _cellDatas = [[NSMutableArray alloc] init];
  76. [_cellDatas addObject:d4];
  77. [_cellDatas addObject:d6];
  78. [_cellDatas addObject:d5];
  79. [_cellDatas addObject:d12];
  80. [_cellDatas addObject:d13];
  81. }
  82. #pragma mark - Table view data source
  83. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  84. return self.cellDatas.count;
  85. }
  86. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  87. return 1;
  88. }
  89. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  90. return 52.0;
  91. }
  92. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
  93. return [UIView new];
  94. }
  95. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  96. if(section==1||section==2){
  97. return 60;
  98. }
  99. return 5.f;
  100. }
  101. - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
  102. UIView *view =[UIView new];
  103. if(section==1){
  104. UILabel *notlb = [[UILabel alloc] init];
  105. notlb.frame = CGRectMake(0, 0, tableView.frame.size.width, 60);
  106. [view addSubview:notlb];
  107. notlb.font = [UIFont systemFontOfSize:15];
  108. notlb.textColor = [UIColor whiteColor];
  109. notlb.numberOfLines=2;
  110. notlb.text = NSLocalizedString(@"APPnote-yingyongsuo", @"");
  111. }
  112. if(section==2){
  113. UILabel *notlb = [[UILabel alloc] init];
  114. notlb.frame = CGRectMake(0, 0, tableView.frame.size.width, 60);
  115. [view addSubview:notlb];
  116. notlb.font = [UIFont systemFontOfSize:15];
  117. notlb.textColor = [UIColor whiteColor];
  118. notlb.numberOfLines=2;
  119. notlb.text = NSLocalizedString(@"APPnote-anquanmim", @"");
  120. }
  121. return view;
  122. }
  123. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  124. return 5.f;
  125. }
  126. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  127. NSInteger section =indexPath.section;
  128. NSString *cellT =@"cellT";
  129. UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:cellT forIndexPath:indexPath];
  130. if(cell==nil){
  131. cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellT];
  132. }
  133. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  134. cell.backgroundColor = [UIColor clearColor];
  135. NSDictionary *time =_cellDatas[section];
  136. NSString *title = NSLocalizedString(time[@"name"], @"");
  137. cell.imageView.image = [UIImage imageNamed:time[@"image"]];
  138. cell.textLabel.text =title;
  139. cell.textLabel.textColor = [UIColor whiteColor];
  140. UIImageView *right = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow-right"]];
  141. CGRect ctfrm = cell.contentView.frame;
  142. right.frame = CGRectMake(ctfrm.size.width-30, 16, 20, 20);
  143. [cell.contentView addSubview:right];
  144. cell.contentView.layer.borderWidth = 0.5f;
  145. cell.contentView.layer.borderColor = [UIColor lightGrayColor].CGColor; //globalColor(GCTypeGreen);
  146. cell.contentView.layer.cornerRadius = 8.0f; // 可选,设置圆角
  147. return cell;
  148. }
  149. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  150. if (indexPath.section == 0) {
  151. //修改密码
  152. ChangePasswordController * changePwdVc = [[ChangePasswordController alloc] init];
  153. [self.navigationController pushViewController:changePwdVc animated:YES];
  154. }
  155. if (indexPath.section == 1) {
  156. //应用密码
  157. if ([APPLocker.sharedLocker isPasswordSet]) {
  158. APPLockerChangeController * appLockChangeVc = [[APPLockerChangeController alloc] init];
  159. [self.navigationController pushViewController:appLockChangeVc animated:YES];
  160. }else{
  161. AppLockPasswordController * appLockVc = [[AppLockPasswordController alloc] init];
  162. appLockVc.mode = LockViewModeSet;
  163. UINavigationController * navi = [[UINavigationController alloc] initWithRootViewController:appLockVc];
  164. navi.modalPresentationStyle = UIModalPresentationFullScreen;
  165. appLockVc.onSuccess = ^{
  166. };
  167. appLockVc.onCancel = ^{
  168. };
  169. [self presentViewController:navi animated:YES completion:nil];
  170. }
  171. }
  172. if (indexPath.section == 2) {
  173. //安全密码,不交验直接设置新的
  174. SecurityPasswordController * securityPwdVc = [[SecurityPasswordController alloc] init];
  175. [self.navigationController pushViewController:securityPwdVc animated:YES];
  176. }
  177. if (indexPath.section == 3) {
  178. // 重置密码
  179. GCoverController * resetPwdVc = [[GCoverController alloc] init];
  180. resetPwdVc.isLogin = YES;
  181. resetPwdVc.modalPresentationStyle = UIModalPresentationFullScreen;
  182. [self presentViewController:resetPwdVc animated:YES completion:nil];
  183. }
  184. if (indexPath.section == 4) {
  185. //注销账号
  186. DeleteAccountController * deleteAccountVc = [[DeleteAccountController alloc] init];
  187. [self.navigationController pushViewController:deleteAccountVc animated:YES];
  188. }
  189. }
  190. - (UITableView *)tableView{
  191. if (!_tableView) {
  192. _tableView = [[UITableView alloc] initWithFrame:CGRectZero];
  193. _tableView.delegate = self;
  194. _tableView.dataSource = self;
  195. _tableView.backgroundColor = UIColor.clearColor;
  196. }
  197. return _tableView;
  198. }
  199. #pragma mark statusBar
  200. - (UIStatusBarStyle)preferredStatusBarStyle{
  201. return UIStatusBarStyleLightContent;
  202. }
  203. @end