ASPointsHomeViewController.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //
  2. // ASPointsHomeViewController.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/6/19.
  6. //
  7. #import "ASPointsHomeViewController.h"
  8. #import "ASPointHeadView.h"
  9. #import "ASPointEranCell.h"
  10. #import "ASPointDetailViewController.h"
  11. @interface ASPointsHomeViewController ()<UITableViewDelegate,UITableViewDataSource>
  12. @property (nonatomic, strong) ASPointHeadView *headV;
  13. @property (nonatomic, strong) UITableView *tableV;
  14. @end
  15. @implementation ASPointsHomeViewController
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. [self loadSubVs];
  19. [self configSubV];
  20. }
  21. - (void)configSubV {
  22. [self setTitleStr:@"Points"];
  23. [self setNavRightSearch:^{
  24. // TODO: - to Search VC
  25. }];
  26. NSString *points = ASUserInfoManager.shared.userPoints;
  27. [self.headV setData:points];
  28. __weak typeof(self) weakSelf = self;
  29. [self.headV setRuleCallBack:^{
  30. UIViewController *vc = [CTMediator.sharedInstance getWebViewVc:@{
  31. @"title":@"Points Rules",
  32. @"url":@"https://baidu.com"
  33. }];
  34. [weakSelf.navigationController pushViewController:vc animated:true];
  35. }];
  36. [self.headV setDetailCallBack:^{
  37. ASPointDetailViewController *vc = [ASPointDetailViewController new];
  38. [weakSelf.navigationController pushViewController:vc animated:true];
  39. }];
  40. self.customNavBar.backgroundColor = _F0FFFA;
  41. }
  42. - (void)loadSubVs {
  43. [self.view addSubview:self.tableV];
  44. [self.tableV mas_makeConstraints:^(MASConstraintMaker *make) {
  45. make.top.equalTo(self.customNavBar.mas_bottom);
  46. make.leading.trailing.bottom.equalTo(self.view);
  47. }];
  48. }
  49. // MARK: - subVs
  50. - (ASPointHeadView *)headV {
  51. if (!_headV) {
  52. ASPointHeadView *v = [[ASPointHeadView alloc] initWithFrame:CGRectZero];
  53. _headV = v;
  54. }
  55. return _headV;
  56. }
  57. - (UITableView *)tableV {
  58. if (!_tableV) {
  59. UITableView *v = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
  60. [v registerClass:[ASPointEranCell class] forCellReuseIdentifier:@"ASPointEranCell"];
  61. v.delegate = self;
  62. v.dataSource = self;
  63. [v baseSet];
  64. v.tableHeaderView = self.headV;
  65. _tableV = v;
  66. }
  67. return _tableV;
  68. }
  69. // MARK: - UITableViewDelegate,UITableViewDataSource
  70. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  71. return 10;
  72. }
  73. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  74. ASPointEranCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASPointEranCell" forIndexPath:indexPath];
  75. [cell setData:@"Browsing hD Lace Wig Page ≥ 15 Seconds" des:@"1 Points Per $1 " status:indexPath.row%2 == 1];
  76. return cell;
  77. }
  78. @end