depositAccountVC.m 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. //
  2. // depositAccountVC.m
  3. // YBVideo
  4. //
  5. // Created by IOS1 on 2019/7/5.
  6. // Copyright © 2019 cat. All rights reserved.
  7. //
  8. #import "depositAccountVC.h"
  9. #import "orderVideoCell.h"
  10. #import "YBGetVideoObj.h"
  11. @interface depositAccountVC ()<UITableViewDelegate,UITableViewDataSource>{
  12. UILabel *coinL;
  13. UITableView *listTable;
  14. NSMutableArray *listArray;
  15. int page;
  16. }
  17. @end
  18. @implementation depositAccountVC
  19. - (void)viewDidLoad {
  20. [super viewDidLoad];
  21. self.view.backgroundColor = RGB_COLOR(@"#110D24", 1);
  22. self.titleL.text = YZMsg(@"投放账户");
  23. page = 1;
  24. listArray = [NSMutableArray array];
  25. [self creatUI];
  26. }
  27. - (void)creatUI{
  28. listTable = [[UITableView alloc]initWithFrame:CGRectMake(0, 64+statusbarHeight, _window_width, _window_height-64-statusbarHeight) style:1];
  29. listTable.delegate = self;
  30. listTable.dataSource = self;
  31. listTable.backgroundColor = RGB_COLOR(@"#110D24", 1);
  32. listTable.separatorStyle = 0;
  33. [self.view addSubview:listTable];
  34. listTable.mj_header = [MJRefreshHeader headerWithRefreshingBlock:^{
  35. page = 1;
  36. [self requestData];
  37. }];
  38. listTable.mj_footer = [MJRefreshBackFooter footerWithRefreshingBlock:^{
  39. page ++;
  40. [self requestData];
  41. }];
  42. UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 64+statusbarHeight, _window_width, 145)];
  43. view.backgroundColor = RGB_COLOR(@"#110D24", 1);
  44. listTable.tableHeaderView = view;
  45. UILabel *lelfL = [[UILabel alloc]init];
  46. lelfL.textColor = RGB_COLOR(@"#969696", 1);
  47. lelfL.text = YZMsg(@"账户余额");
  48. lelfL.font = [UIFont systemFontOfSize:14];
  49. [view addSubview:lelfL];
  50. [lelfL mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.left.equalTo(view).offset(15);
  52. make.top.equalTo(view);
  53. make.height.mas_equalTo(50);
  54. }];
  55. coinL = [[UILabel alloc]init];
  56. coinL.textColor = RGB_COLOR(@"#FB483A", 1);
  57. coinL.text = @"¥200";
  58. coinL.font = [UIFont systemFontOfSize:14];
  59. [view addSubview:coinL];
  60. [coinL mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.right.equalTo(view).offset(-15);
  62. make.top.equalTo(view);
  63. make.height.mas_equalTo(50);
  64. }];
  65. UILabel *contentL = [[UILabel alloc]init];
  66. contentL.textColor = RGB_COLOR(@"#979797", 1);
  67. contentL.text = YZMsg(@"*账户余额可用于下次视频投放,也可联系客服申请提现。");
  68. contentL.font = [UIFont systemFontOfSize:10];
  69. [view addSubview:contentL];
  70. [contentL mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.left.equalTo(view).offset(15);
  72. make.top.equalTo(lelfL.mas_bottom).offset(8);
  73. }];
  74. UILabel *orderL = [[UILabel alloc]init];
  75. orderL.textColor = RGB_COLOR(@"#ffffff", 1);
  76. orderL.text = YZMsg(@"我的订单");
  77. orderL.font = [UIFont systemFontOfSize:15];
  78. [view addSubview:orderL];
  79. [orderL mas_makeConstraints:^(MASConstraintMaker *make) {
  80. make.left.equalTo(view).offset(15);
  81. make.bottom.equalTo(view);
  82. make.height.mas_equalTo(40);
  83. }];
  84. [self requestData];
  85. }
  86. - (void)requestData{
  87. [YBNetworking postWithUrl:@"Popular.GetPutin" Dic:@{@"uid":[Config getOwnID],@"token":[Config getOwnToken],@"p":@(page)} Suc:^(int code, id info, NSString *msg) {
  88. [listTable.mj_header endRefreshing];
  89. [listTable.mj_footer endRefreshing];
  90. if (code == 0) {
  91. NSDictionary *infoDic = [info firstObject];
  92. NSArray *list = [infoDic valueForKey:@"list"];
  93. if (page == 1) {
  94. [listArray removeAllObjects];
  95. coinL.text = [NSString stringWithFormat:@"¥%@",minstr([infoDic valueForKey:@"coin"])];
  96. }
  97. [listArray addObjectsFromArray:list];
  98. }
  99. [listTable reloadData];
  100. } Fail:^(id fail) {
  101. [listTable.mj_header endRefreshing];
  102. [listTable.mj_footer endRefreshing];
  103. }];
  104. }
  105. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  106. return 1;
  107. }
  108. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  109. return listArray.count;
  110. }
  111. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  112. orderVideoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"orderVideoCELL"];
  113. if (!cell) {
  114. cell = [[[NSBundle mainBundle] loadNibNamed:@"orderVideoCell" owner:nil options:nil] lastObject];
  115. }
  116. NSDictionary *subDic = listArray[indexPath.row];
  117. NearbyVideoModel *model = [[NearbyVideoModel alloc]initWithDic:subDic];
  118. [cell.thumbImgV sd_setImageWithURL:[NSURL URLWithString:model.videoImage]];
  119. cell.nameL.text = model.userName;
  120. cell.titleL.text = model.videoTitle;
  121. cell.timeL.text = [NSString stringWithFormat:@"%@:%@ %@:%@",YZMsg(@"下单时间"),minstr([subDic valueForKey:@"paytime"]),YZMsg(@"下单金额"),minstr([subDic valueForKey:@"money"])];
  122. return cell;
  123. }
  124. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  125. return 100;
  126. }
  127. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  128. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  129. NSDictionary *subDic = listArray[indexPath.row];
  130. [self coverClickVideoid:minstr([subDic valueForKey:@"id"])];
  131. }
  132. - (void)coverClickVideoid:(NSString *)videoid {
  133. NSLog(@"播放视频");
  134. [YBGetVideoObj lookManeger].fromWhere = @"depositAccountVC";
  135. [YBGetVideoObj lookManeger].videoID = videoid;
  136. [YBGetVideoObj lookManeger].playIndex = 0;
  137. [YBGetVideoObj lookManeger].videoList = @[].mutableCopy;
  138. [YBGetVideoObj lookManeger].paging = 1;
  139. [YBGetVideoObj lookManeger].baseUrl = @"";
  140. [[YBGetVideoObj lookManeger]goLookVC];
  141. }
  142. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  143. return 5;
  144. }
  145. - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
  146. UIView *vv = [[UIView alloc]initWithFrame:CGRectMake(0, 0, _window_width, 5)];
  147. vv.backgroundColor = RGB_COLOR(@"#110D24", 1);
  148. return vv;
  149. }
  150. /*
  151. #pragma mark - Navigation
  152. // In a storyboard-based application, you will often want to do a little preparation before navigation
  153. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  154. // Get the new view controller using [segue destinationViewController].
  155. // Pass the selected object to the new view controller.
  156. }
  157. */
  158. @end