AccountSecurityViewController.m 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //
  2. // AccountSecurityViewController.m
  3. // BuguLive
  4. //
  5. // Created by GuoMs on 16/7/18.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "AccountSecurityViewController.h"
  9. //#import "LPhoneLoginVC.h"
  10. #import "ASTableViewCell.h"
  11. #import "ASView.h"
  12. #import "AccSecModel.h"
  13. #import "PhoneLoginViewController.h"
  14. @interface AccountSecurityViewController ()
  15. @property(nonatomic,retain)ASView *asView;
  16. @property (strong, nonatomic) IBOutlet UITableView *AStableView;
  17. @property (nonatomic, strong) NetHttpsManager *httpManager;
  18. @property (nonatomic, strong) AccSecModel *model;
  19. @end
  20. @implementation AccountSecurityViewController
  21. - (void)viewWillAppear:(BOOL)animated
  22. {
  23. [super viewWillAppear:animated];
  24. self.navigationItem.leftBarButtonItem=[UIBarButtonItem itemWithTarget:self action:@selector(returnToMeVc) image:@"com_arrow_vc_back" highImage:@"com_arrow_vc_back"];
  25. [self getNetAccAndSecWorking];
  26. }
  27. - (void)viewDidLoad
  28. {
  29. [super viewDidLoad];
  30. self.title =ASLocalizedString(@"帐号与安全");
  31. [self.AStableView registerNib:[UINib nibWithNibName:@"ASTableViewCell" bundle:nil] forCellReuseIdentifier:@"ASOfCell"];
  32. self.asView = [[[NSBundle mainBundle]loadNibNamed:@"ASView" owner:self options:nil]lastObject];
  33. self.asView.backgroundColor = kBackGroundColor;
  34. self.asView.frame = CGRectMake(0, 0, kScreenW, 140);
  35. UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenW , 210)];
  36. [headerView addSubview:self.asView];
  37. self.AStableView.tableHeaderView = headerView;
  38. self.AStableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  39. self.AStableView.backgroundColor = kBackGroundColor;
  40. self.AStableView.scrollEnabled = NO;
  41. _httpManager = [NetHttpsManager manager];
  42. }
  43. #pragma mark - 账户与安全网络请求
  44. - (void)getNetAccAndSecWorking
  45. {
  46. NSMutableDictionary *dict = [NSMutableDictionary new];
  47. [dict setValue:@"settings" forKey:@"ctl"];
  48. [dict setValue:@"security" forKey:@"act"];
  49. if (self.userid.length)
  50. {
  51. [dict setObject:self.userid forKey:@"to_user_id"];
  52. }
  53. [_httpManager POSTWithParameters:dict SuccessBlock:^(NSDictionary *responseJson) {
  54. self.model = [AccSecModel mj_objectWithKeyValues:responseJson];
  55. if ([self.model.is_security isEqualToString:@"0"])
  56. {
  57. }
  58. else
  59. {
  60. self.asView.SecutyLable.text = ASLocalizedString(@"安全等级:高");
  61. self.asView.ShieldImageView.image = [UIImage imageNamed:@"me_shield_light"];
  62. }
  63. [self.AStableView reloadData];
  64. } FailureBlock:^(NSError *error) {
  65. }];
  66. }
  67. #pragma mark - 返回上一级
  68. - (void)returnToMeVc
  69. {
  70. [self.navigationController popViewControllerAnimated:YES];
  71. }
  72. #pragma mark - Table view data source
  73. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  74. {
  75. return 1;
  76. }
  77. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  78. {
  79. return 1;
  80. }
  81. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  82. {
  83. return 45*kAppRowHScale;
  84. }
  85. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  86. {
  87. ASTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASOfCell" forIndexPath:indexPath];
  88. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  89. cell.phoneNumber.text = self.model.mobile;
  90. return cell;
  91. }
  92. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  93. {
  94. if ([self.model.is_security isEqualToString:@"0"])
  95. {
  96. PhoneLoginViewController *phoneLogin = [[PhoneLoginViewController alloc]initWithNibName:NSStringFromClass([PhoneLoginViewController class]) bundle:[NSBundle mainBundle]];
  97. phoneLogin.LSecBPhone = YES;
  98. [self.navigationController pushViewController:phoneLogin animated:YES];
  99. }
  100. else
  101. {
  102. [[BGHUDHelper sharedInstance] tipMessage:ASLocalizedString(@"您已绑定手机")];
  103. }
  104. }
  105. @end