口袋优选

KBMySuperViewController.m 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //
  2. // KBMySuperViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/7/12.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBMySuperViewController.h"
  9. @interface KBMySuperViewController ()
  10. @end
  11. @implementation KBMySuperViewController
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. [self configNavigationBar];
  15. [self initSubViews];
  16. [self request];
  17. }
  18. - (void)configNavigationBar {
  19. [self.navigationBar setNavTitle:@"我的邀请人"];
  20. self.navigationBar.backgroundColor = [UIColor changeColor];
  21. self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor];
  22. UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  23. [leftBtn setImage:[UIImage imageNamed:@"back_white"] forState:UIControlStateNormal];
  24. [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  25. [self.navigationBar setCustomLeftButtons:@[leftBtn]];
  26. }
  27. - (void)backAction {
  28. [self.navigationController popViewControllerAnimated:YES];
  29. }
  30. - (void)initSubViews {
  31. UIView *bg = [[UIView alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, 153)];
  32. bg.backgroundColor = [UIColor whiteColor];
  33. [self.view addSubview:bg];
  34. NSArray *title = @[@"邀请人:加载中...",@"Ta的邀请码:加载中...",@"邀请时间:加载中..."];
  35. for (int i = 0 ;i < 3 ; i++) {
  36. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(30, 15+(20+26)*i, SCREEN_WIDTH-60, 20)];
  37. label.textColor = [UIColor YHColorWithHex:0x666666];
  38. label.font = [UIFont systemFontOfSize:14];
  39. label.text = title[i];
  40. label.tag = 1000+i;
  41. [bg addSubview:label];
  42. UIView *line = [[UIView alloc] initWithFrame:CGRectMake(30, 45*(i+1), SCREEN_WIDTH-60, 1)];
  43. line.backgroundColor = [UIColor YHColorWithHex:0xD8D8D8];
  44. [bg addSubview:line];
  45. }
  46. }
  47. - (void)request {
  48. [SVProgressHUD show];
  49. NSString *url = [NSString stringWithFormat:@"%@/api/v2/adzoneCreate/parentInfo",BaseURL];
  50. [KBHttp post:url params:nil success:^(id json) {
  51. NSArray *titles = @[[NSString stringWithFormat:@"邀请人:%@",json[@"data"][@"name"]],
  52. [NSString stringWithFormat:@"Ta的邀请码:%@",json[@"data"][@"invite_code"]],
  53. [NSString stringWithFormat:@"邀请时间:%@",json[@"data"][@"first_level_vermicelli_time"]]
  54. ];
  55. for (int i = 0; i < 3; i++) {
  56. UILabel *label = [self.view viewWithTag:1000+i];
  57. label.text = titles[i];
  58. }
  59. [SVProgressHUD dismiss];
  60. } failure:^(NSError *error) {
  61. [MBProgressHUD showMessage:@"加载失败"];
  62. [SVProgressHUD dismiss];
  63. }];
  64. }
  65. - (void)didReceiveMemoryWarning {
  66. [super didReceiveMemoryWarning];
  67. // Dispose of any resources that can be recreated.
  68. }
  69. /*
  70. #pragma mark - Navigation
  71. // In a storyboard-based application, you will often want to do a little preparation before navigation
  72. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  73. // Get the new view controller using [segue destinationViewController].
  74. // Pass the selected object to the new view controller.
  75. }
  76. */
  77. @end