// // ASPointsHomeViewController.m // Asteria // // Created by iOS on 2023/6/19. // #import "ASPointsHomeViewController.h" #import "ASPointHeadView.h" #import "ASPointEranCell.h" #import "ASPointDetailViewController.h" @interface ASPointsHomeViewController () @property (nonatomic, strong) ASPointHeadView *headV; @property (nonatomic, strong) UITableView *tableV; @end @implementation ASPointsHomeViewController - (void)viewDidLoad { [super viewDidLoad]; [self loadSubVs]; [self configSubV]; } - (void)configSubV { [self setTitleStr:@"Points"]; [self setNavRightSearch:^{ // TODO: - to Search VC }]; NSString *points = ASUserInfoManager.shared.userPoints; [self.headV setData:points]; __weak typeof(self) weakSelf = self; [self.headV setRuleCallBack:^{ UIViewController *vc = [CTMediator.sharedInstance getWebViewVc:@{ @"title":@"Points Rules", @"url":@"https://baidu.com" }]; [weakSelf.navigationController pushViewController:vc animated:true]; }]; [self.headV setDetailCallBack:^{ ASPointDetailViewController *vc = [ASPointDetailViewController new]; [weakSelf.navigationController pushViewController:vc animated:true]; }]; self.customNavBar.backgroundColor = _F0FFFA; } - (void)loadSubVs { [self.view addSubview:self.tableV]; [self.tableV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.customNavBar.mas_bottom); make.leading.trailing.bottom.equalTo(self.view); }]; } // MARK: - subVs - (ASPointHeadView *)headV { if (!_headV) { ASPointHeadView *v = [[ASPointHeadView alloc] initWithFrame:CGRectZero]; _headV = v; } return _headV; } - (UITableView *)tableV { if (!_tableV) { UITableView *v = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; [v registerClass:[ASPointEranCell class] forCellReuseIdentifier:@"ASPointEranCell"]; v.delegate = self; v.dataSource = self; [v baseSet]; v.tableHeaderView = self.headV; _tableV = v; } return _tableV; } // MARK: - UITableViewDelegate,UITableViewDataSource - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 10; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ASPointEranCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASPointEranCell" forIndexPath:indexPath]; [cell setData:@"Browsing hD Lace Wig Page ≥ 15 Seconds" des:@"1 Points Per $1 " status:indexPath.row%2 == 1]; return cell; } @end