// // DRMySuperViewController.m // YouHuiProject // // Created by 小花 on 2018/7/12. // Copyright © 2018年 kuxuan. All rights reserved. // #import "DRMySuperViewController.h" @interface DRMySuperViewController () @end @implementation DRMySuperViewController - (void)viewDidLoad { [super viewDidLoad]; [self configNavigationBar]; [self initSubViews]; [self request]; } - (void)configNavigationBar { [self.navigationBar setNavTitle:@"我的邀请人"]; self.navigationBar.backgroundColor = [UIColor changeColor]; self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor]; UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; [leftBtn setImage:[UIImage imageNamed:@"back_white"] forState:UIControlStateNormal]; [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside]; [self.navigationBar setCustomLeftButtons:@[leftBtn]]; } - (void)backAction { [self.navigationController popViewControllerAnimated:YES]; } - (void)initSubViews { UIView *bg = [[UIView alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, 153)]; bg.backgroundColor = [UIColor whiteColor]; [self.view addSubview:bg]; NSArray *title = @[@"邀请人:加载中...",@"Ta的邀请码:加载中...",@"邀请时间:加载中..."]; for (int i = 0 ;i < 3 ; i++) { UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(30, 15+(20+26)*i, SCREEN_WIDTH-60, 20)]; label.textColor = [UIColor YHColorWithHex:0x666666]; label.font = [UIFont systemFontOfSize:14]; label.text = title[i]; label.tag = 1000+i; [bg addSubview:label]; UIView *line = [[UIView alloc] initWithFrame:CGRectMake(30, 45*(i+1), SCREEN_WIDTH-60, 1)]; line.backgroundColor = [UIColor YHColorWithHex:0xD8D8D8]; [bg addSubview:line]; } } - (void)request { [SVProgressHUD show]; NSString *url = [NSString stringWithFormat:@"%@/api/v2/adzoneCreate/parentInfo",BaseURL]; [DRHttp post:url params:nil success:^(id json) { NSArray *titles = @[[NSString stringWithFormat:@"邀请人:%@",json[@"data"][@"name"]], [NSString stringWithFormat:@"Ta的邀请码:%@",json[@"data"][@"invite_code"]], [NSString stringWithFormat:@"邀请时间:%@",json[@"data"][@"first_level_vermicelli_time"]] ]; for (int i = 0; i < 3; i++) { UILabel *label = [self.view viewWithTag:1000+i]; label.text = titles[i]; } [SVProgressHUD dismiss]; } failure:^(NSError *error) { [MBProgressHUD showMessage:@"加载失败"]; [SVProgressHUD dismiss]; }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end