// // QXRealNameFinishedViewController.m // QXLive // // Created by 启星 on 2025/5/14. // #import "QXRealNameFinishedViewController.h" #import "QXSettingCell.h" #import "QXMineNetwork.h" @interface QXRealNameFinishedViewController () @property (nonatomic,strong)UIImageView *headerImageView; @property (nonatomic,strong)UILabel *statusLabel; @property (nonatomic,strong)UITableView *tableView; @property (nonatomic,strong)NSDictionary *cellTypeDict; @property (nonatomic,strong)NSDictionary *valueDict; @property (nonatomic,strong)NSDictionary *controllerDict; @end @implementation QXRealNameFinishedViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. } -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:NO animated:YES]; } -(void)setNavgationItems{ [super setNavgationItems]; self.navigationItem.title = QXText(@"实名认证"); } -(void)getRealInfo{ MJWeakSelf [QXMineNetwork getRealNameInfoSuccessBlock:^(NSDictionary * _Nonnull dict) { NSString *real_name = [NSString stringWithFormat:@"%@",dict[@"real_name"]]; NSString *card_id = [NSString stringWithFormat:@"%@",dict[@"card_id"]]; weakSelf.valueDict = @{ QXText(@"真实姓名"):real_name, QXText(@"证件类型"):@"身份证", QXText(@"身份证号"):card_id, }; [weakSelf.tableView reloadData]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { }]; } -(void)initSubViews{ self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"home_realname_finished_icon"]]; [self.view addSubview:self.headerImageView]; [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(NavContentHeight+16); make.size.mas_equalTo(CGSizeMake(195, 195)); make.centerX.equalTo(self.view); }]; self.statusLabel = [[UILabel alloc] init]; self.statusLabel.font = [UIFont systemFontOfSize:14]; self.statusLabel.textColor = RGB16(0x333333); self.statusLabel.text = QXText(@"您已实名认证"); [self.view addSubview:self.statusLabel]; [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.headerImageView.mas_bottom).offset(25); make.height.mas_equalTo(21); make.centerX.equalTo(self.view); }]; NSArray *section1 = @[ QXText(@"真实姓名"), QXText(@"证件类型"), QXText(@"身份证号") ]; // NSArray *section2 = @[ // QXText(@"更新本人实名信息"), // ]; // // NSArray *section3 = @[ // QXText(@"更正实名人"), // ]; self.cellTypeDict = @{ QXText(@"真实姓名"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyDetail], QXText(@"证件类型"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyDetail], QXText(@"身份证号"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyDetail], // QXText(@"更新本人实名信息"):[NSNumber numberWithInteger:QXSettingCellTypeTitleTopAndArrow], // QXText(@"更正实名人"):[NSNumber numberWithInteger:QXSettingCellTypeTitleTopAndArrow], }; self.controllerDict = @{ QXText(@"真实姓名"):@"", QXText(@"证件类型"):@"", QXText(@"身份证号"):@"", // QXText(@"更新本人实名信息"):@"", // QXText(@"更正实名人"):@"", }; self.valueDict = @{ QXText(@"真实姓名"):@"", QXText(@"证件类型"):@"", QXText(@"身份证号"):@"", // QXText(@"更新本人实名信息"):QXText(@"若您在公安机关变更了姓名,可点击此处更新"), // QXText(@"更正实名人"):QXText(@"若账号实名人非账号实际使用人,可点击此处进行更正"), }; [self.dataArray addObject:section1]; // [self.dataArray addObject:section2]; // [self.dataArray addObject:section3]; [self.view addSubview:self.tableView]; [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.statusLabel.mas_bottom).offset(12); make.bottom.equalTo(self.view); make.left.right.equalTo(self.view); }]; [self getRealInfo]; } #pragma mark - UITableViewDelegate,UITableViewDataSource -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return self.dataArray.count; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ NSArray *arr = self.dataArray[section]; return arr.count; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ QXSettingCell *cell = [QXSettingCell cellWithTableView:tableView]; NSArray *arr = self.dataArray[indexPath.section]; NSString *text = arr[indexPath.row]; NSString *value = self.valueDict[text]; cell.titleLabel.text = text; cell.detailLabel.text = value; cell.cellType = [self.cellTypeDict[text] integerValue]; cell.needLine = NO; return cell; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.section == 0) { return 50; } return 57; } -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ return [UIView new]; } -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return 12; } -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ return [UIView new]; } -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return 0.01; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ [tableView deselectRowAtIndexPath:indexPath animated:YES]; NSArray *arr = self.dataArray[indexPath.section]; NSString *text = arr[indexPath.row]; NSString *controller = self.controllerDict[text]; if (controller.length == 0) { return; } UIViewController *vc = [[NSClassFromString(controller) alloc] init]; [self.navigationController pushViewController:vc animated:YES]; } -(UITableView *)tableView{ if (!_tableView) { _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStyleGrouped)]; _tableView.dataSource = self; _tableView.delegate = self; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; _tableView.backgroundColor = [UIColor clearColor]; } return _tableView; } @end