BogoLogoutTextViewController.m 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. //
  2. // BogoLogoutTextViewController.m
  3. // BuguLive
  4. //
  5. // Created by 宋晨光 on 2021/9/28.
  6. // Copyright © 2021 xfg. All rights reserved.
  7. //
  8. #import "BogoLogoutTextViewController.h"
  9. #import "BogoLogoutTextItmeCell.h"
  10. #import "BogoSetAccountModel.h"
  11. #import "BogoLogoutViewController.h"
  12. @interface BogoLogoutTextViewController ()<UITableViewDelegate,UITableViewDataSource,UITextViewDelegate>
  13. @property (weak, nonatomic) IBOutlet UIView *itemView;
  14. @property(nonatomic, strong) UITableView *tableView;
  15. @property(nonatomic, strong) NSMutableArray *listArr;
  16. @property(nonatomic, strong) BogoSetAccountModel *model;
  17. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *topConstraint;
  18. @property (weak, nonatomic) IBOutlet UITextView *agreeT;
  19. @property (weak, nonatomic) IBOutlet UIButton *selectBtn;
  20. @property(nonatomic, assign) BOOL isSelect;
  21. @property (weak, nonatomic) IBOutlet UIButton *confirmBtn;
  22. @end
  23. @implementation BogoLogoutTextViewController
  24. - (void)viewDidLoad {
  25. [super viewDidLoad];
  26. // Do any additional setup after loading the view from its nib.
  27. self.isSelect = NO;
  28. self.itemView.layer.cornerRadius = 10;
  29. self.itemView.layer.masksToBounds = YES;
  30. [self.itemView addSubview:self.tableView];
  31. self.tableView.frame = self.itemView.bounds;
  32. [self setModel];
  33. self.topConstraint.constant = kStatusBarHeight;
  34. self.confirmBtn.enabled = NO;
  35. [self setAgreeTextView];
  36. }
  37. - (void)viewWillAppear:(BOOL)animated {
  38. [super viewWillAppear:animated];
  39. self.navigationController.navigationBar.hidden = YES;
  40. }
  41. -(void)setModel{
  42. NSMutableDictionary *paramDic = [NSMutableDictionary dictionary];
  43. [paramDic setObject:@"cancellation" forKey:@"act"];
  44. [paramDic setObject:@"login" forKey:@"ctl"];
  45. [paramDic setObject:[BGIMLoginManager sharedInstance].loginParam.identifier forKey:@"uid"];
  46. self.listArr = [NSMutableArray array];
  47. [[NetHttpsManager manager] POSTWithParameters:paramDic SuccessBlock:^(NSDictionary *responseJson) {
  48. if ([[responseJson valueForKey:@"status"] integerValue] == 1) {
  49. self.model = [BogoSetAccountModel modelWithDictionary:[responseJson valueForKey:@"data"]];
  50. [self.listArr addObject:ASLocalizedString(@"账户信息、会员、贵族等权限")];
  51. [self.listArr addObject:[NSString stringWithFormat:ASLocalizedString(@"账户剩余钻石数量:%@"),self.model.diamonds]];
  52. [self.listArr addObject:[NSString stringWithFormat:ASLocalizedString(@"账户剩余可提现77票:%@"),self.model.ticket]];
  53. [self.listArr addObject:ASLocalizedString(@"交易记录及其他个人上传信息")];
  54. [self.tableView reloadData];
  55. }else{
  56. [FanweMessage alertHUD:[responseJson valueForKey:@"error"]];
  57. }
  58. } FailureBlock:^(NSError *error) {
  59. }];
  60. }
  61. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  62. return 1;
  63. }
  64. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  65. return self.listArr.count;
  66. }
  67. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  68. return kRealValue(35);
  69. }
  70. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  71. BogoLogoutTextItmeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BogoLogoutTextItmeCell" forIndexPath:indexPath];
  72. cell.contentL.text = self.listArr[indexPath.row];
  73. cell.contentL.backgroundColor = kClearColor;
  74. cell.contentView.backgroundColor = kClearColor;
  75. cell.backgroundColor = kClearColor;
  76. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  77. return cell;
  78. }
  79. - (IBAction)clickCancleBtn:(QMUIButton *)sender {
  80. [self.navigationController popViewControllerAnimated:YES];
  81. }
  82. - (IBAction)clickLogoutBtn:(UIButton *)sender {
  83. BogoLogoutViewController *vc = [BogoLogoutViewController new];
  84. vc.phoneNum = self.phoneNum;
  85. [self.navigationController pushViewController:vc animated:YES];
  86. }
  87. -(UITableView *)tableView{
  88. if (!_tableView) {
  89. _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH - kTopHeight) style:UITableViewStylePlain];
  90. _tableView.delegate = self;
  91. _tableView.dataSource = self;
  92. [_tableView registerNib:[UINib nibWithNibName:@"BogoLogoutTextItmeCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"BogoLogoutTextItmeCell"];
  93. _tableView.tableFooterView = [UIView new];
  94. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  95. _tableView.backgroundColor = UIColor.whiteColor;
  96. _tableView.scrollEnabled = NO;
  97. }
  98. return _tableView;
  99. }
  100. - (IBAction)clickSelectBtn:(UIButton *)sender {
  101. self.isSelect = !self.isSelect;
  102. if (self.isSelect) {
  103. [self.selectBtn setImage:[UIImage imageNamed:@"bogo_regiset_select"] forState:UIControlStateNormal];
  104. self.confirmBtn.enabled = YES;
  105. }else{
  106. [self.selectBtn setImage:[UIImage imageNamed:@"bogo_regiset_normal"] forState:UIControlStateNormal];
  107. self.confirmBtn.enabled = NO;
  108. }
  109. }
  110. //我已阅读并同意《用户服务协议》、《隐私权政策》
  111. -(void)setAgreeTextView{
  112. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:self.agreeT.text];
  113. //设置行间距以及字体大小、颜色
  114. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  115. paragraphStyle.lineSpacing = 4;// 字体的行间距
  116. NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:11.0],
  117. NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#333333"],
  118. NSParagraphStyleAttributeName:paragraphStyle};
  119. [attributedString setAttributes:attributes range:NSMakeRange(0, attributedString.length)];
  120. [attributedString addAttribute:NSLinkAttributeName
  121. value:@"action1://"
  122. range:[[attributedString string] rangeOfString:ASLocalizedString(@"《注销协议》")]];
  123. NSDictionary *linkAttributes = @{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#0BA5FF"]};
  124. self.agreeT.backgroundColor = [UIColor clearColor];
  125. self.agreeT.linkTextAttributes = linkAttributes;
  126. self.agreeT.attributedText = attributedString;
  127. self.agreeT.scrollEnabled = NO;
  128. self.agreeT.font = [UIFont systemFontOfSize:12.0];
  129. self.agreeT.textAlignment = NSTextAlignmentCenter;
  130. self.agreeT.editable = NO;
  131. self.agreeT.delegate = self;
  132. // [self.view addSubview:self.agreeT];
  133. // YYTextContainer *container = [YYTextContainer containerWithSize:CGSizeMake(kWBCellNameWidth, 9999)];
  134. // container.maximumNumberOfRows = 1;
  135. // _nameTextLayout = [YYTextLayout layoutWithContainer:container text:attributedString];
  136. }
  137. #pragma mark -
  138. - (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange
  139. {
  140. BGMainWebViewController *tmpController = [BGMainWebViewController webControlerWithUrlStr:self.BuguLive.appModel.user_unsubscribe isShowIndicator:YES isShowNavBar:YES isShowBackBtn:YES];
  141. [[AppDelegate sharedAppDelegate] pushViewController:tmpController animated:YES];
  142. tmpController.navigationController.navigationBar.hidden = NO;
  143. return YES;
  144. }
  145. @end