YBCenterMoreView.m 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. //
  2. // YBCenterMoreView.m
  3. // YBVideo
  4. //
  5. // Created by YB007 on 2022/6/1.
  6. // Copyright © 2022 cat. All rights reserved.
  7. //
  8. #import "YBCenterMoreView.h"
  9. #import "YBCenterMoreCell.h"
  10. #import "depositAccountVC.h"
  11. #import "YBGetProVC.h"
  12. #import "SetViewControllor.h"
  13. #import "watchingRecordsVC.h"
  14. #import "commodityRecordsVC.h"
  15. #import "PubH5.h"
  16. #import "YBRechargeVC.h"
  17. #import "RoomManagementVC.h"
  18. #import "YBApplyConditionVC.h"
  19. #import "YBApplyStoreVC.h"
  20. #import "YBDayTaskVC.h"
  21. #import "YBGoodsLikeVC.h"
  22. #import "ShopHomeVC.h"
  23. //#import "HotVideoDetailVC.h"
  24. #import "UphotOrderVC.h"
  25. #import "LookHistoryVC.h"
  26. #import "AdvertManagerVC.h"
  27. #import "YBRedProfitVC.h"
  28. #import "YBCreatorVC.h"
  29. @interface YBCenterMoreView()<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource>{
  30. UITableView *listTable;
  31. NSMutableArray *listArray;
  32. NSString *build;
  33. }
  34. @property(nonatomic,strong)UIView *bgView;
  35. @property (nonatomic, strong)NSString *isSeller;
  36. @end
  37. @implementation YBCenterMoreView
  38. +(instancetype)showMoreViewWithSeller:(NSString *)isSeller{
  39. YBCenterMoreView *view = [[YBCenterMoreView alloc]init];
  40. view.frame = CGRectMake(0, 0, _window_width, _window_height);
  41. view.isSeller = isSeller;
  42. [[UIApplication sharedApplication].delegate.window addSubview:view];
  43. [view createUI];
  44. return view;
  45. }
  46. - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch; {
  47. if ([touch.view isDescendantOfView:self.bgView]) {
  48. return NO;
  49. }
  50. return YES;
  51. }
  52. -(void)dissmissView {
  53. [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
  54. [self removeFromSuperview];
  55. }
  56. -(void)createUI {
  57. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dissmissView)];
  58. tap.delegate = self;
  59. [self addGestureRecognizer:tap];
  60. self.backgroundColor = RGB_COLOR(@"#000000", 0.3);
  61. _bgView = [[UIView alloc]init];
  62. _bgView.backgroundColor = UIColor.whiteColor;
  63. _bgView.layer.cornerRadius = 10;
  64. _bgView.layer.masksToBounds = YES;
  65. [self addSubview:_bgView];
  66. [_bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  67. make.width.equalTo(self.mas_width).multipliedBy(0.56);
  68. make.right.equalTo(self.mas_right);
  69. make.height.centerY.equalTo(self);
  70. }];
  71. listTable = [[UITableView alloc]initWithFrame:CGRectZero style:0];
  72. listTable.delegate = self;
  73. listTable.dataSource = self;
  74. listTable.backgroundColor = UIColor.whiteColor;
  75. listTable.separatorStyle = 0;
  76. listTable.bounces = NO;
  77. listTable.showsVerticalScrollIndicator = NO;
  78. listTable.contentInset = UIEdgeInsetsMake(statusbarHeight+10, 0, ShowDiff+10, 0);
  79. [_bgView addSubview:listTable];
  80. [listTable mas_makeConstraints:^(MASConstraintMaker *make) {
  81. make.centerX.equalTo(_bgView);
  82. make.width.equalTo(_bgView.mas_width).offset(-2);
  83. make.top.equalTo(_bgView.mas_top).offset(0);
  84. make.bottom.equalTo(_bgView.mas_bottom).offset(0);
  85. }];
  86. listArray = @[@{@"id":@"0",@"name":YZMsg(@"我的钱包"),@"img":@"我的钱包"},
  87. @{@"id":@"10",@"name":YZMsg(@"我的收藏"),@"img":@"我的收藏"},
  88. @{@"id":@"1",@"name":YZMsg(@"我的收益"),@"img":@"我的收益"},
  89. @{@"id":@"2",@"name":YZMsg(@"我的小店"),@"img":@"店铺申请"},
  90. @{@"id":@"11",@"name":YZMsg(@"上热门明细"),@"img":@"上热门明细"},
  91. @{@"id":@"8",@"name":YZMsg(@"房间管理"),@"img":@"房间管理"},
  92. @{@"id":@"17",@"name":YZMsg(@"创作者中心"),@"img":@"mine_create_center"},
  93. @{@"id":@"15",@"name":YZMsg(@"红包收益"),@"img":@"红包收益"},
  94. @{@"id":@"14",@"name":YZMsg(@"直播动态"),@"img":@"直播动态"},
  95. @{@"id":@"3",@"name":YZMsg(@"直播权限说明"),@"img":@"权限说明"},
  96. @{@"id":@"4",@"name":YZMsg(@"邀请好友赚钱"),@"img":@"邀请好友赚钱"},
  97. @{@"id":@"5",@"name":YZMsg(@"观看记录"),@"img":@"观看记录"},
  98. // @{@"id":@"6",@"name":YZMsg(@"商品记录"),@"img":@"商品记录"},
  99. @{@"id":@"12",@"name":YZMsg(@"广告管理"),@"img":@"广告管理"},
  100. @{@"id":@"9",@"name":YZMsg(@"每日任务"),@"img":@"每日任务"},
  101. @{@"id":@"16",@"name":YZMsg(@"青少年模式"),@"img":@"个中头部-青年"},
  102. @{@"id":@"13",@"name":YZMsg(@"在线客服"),@"img":@"我的客服"},
  103. @{@"id":@"7",@"name":YZMsg(@"个性设置"),@"img":@"个性设置"},
  104. ].mutableCopy;
  105. if ([PublicObj isUp]) {
  106. [listArray removeObject:@{@"id":@"1",@"name":YZMsg(@"我的收益"),@"img":@"我的收益"}];
  107. [listArray removeObject: @{@"id":@"11",@"name":YZMsg(@"上热门明细"),@"img":@"上热门明细"}];
  108. [listArray removeObject:@{@"id":@"4",@"name":YZMsg(@"邀请好友赚钱"),@"img":@"邀请好友赚钱"}];
  109. // [listArray removeObject:@{@"id":@"6",@"name":YZMsg(@"商品记录"),@"img":@"商品记录"}];
  110. [listArray removeObject:@{@"id":@"12",@"name":YZMsg(@"广告管理"),@"img":@"广告管理"}];
  111. [listArray removeObject:@{@"id":@"9",@"name":YZMsg(@"每日任务"),@"img":@"每日任务"}];
  112. }
  113. if ([minstr([YBInviteCode getAgentSwitch]) isEqual:@"0"]) {
  114. [listArray removeObject:@{@"id":@"4",@"name":YZMsg(@"邀请好友赚钱"),@"img":@"邀请好友赚钱"}];
  115. }
  116. if([[common getVideoAwardSwitch] isEqual:@"0"]){
  117. [listArray removeObject:@{@"id":@"15",@"name":YZMsg(@"红包收益"),@"img":@"红包收益"}];
  118. }
  119. /// 青少年
  120. int young_switch = [YBYoungManager shareInstance].youngSwitch;
  121. if (young_switch == 1) {
  122. listArray = @[@{@"id":@"5",@"name":YZMsg(@"观看记录"),@"img":@"观看记录"},
  123. @{@"id":@"16",@"name":YZMsg(@"青少年模式"),@"img":@"个中头部-青年"},
  124. @{@"id":@"13",@"name":YZMsg(@"在线客服"),@"img":@"我的客服"},
  125. @{@"id":@"7",@"name":YZMsg(@"个性设置"),@"img":@"个性设置"},
  126. ].mutableCopy;
  127. }
  128. /// 客服
  129. if ([common getServiceSwitch] != 1) {
  130. [listArray removeObject:@{@"id":@"13",@"name":YZMsg(@"在线客服"),@"img":@"我的客服"}];
  131. }
  132. [listTable reloadData];
  133. }
  134. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  135. return listArray.count;
  136. }
  137. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  138. YBCenterMoreCell *cell = [tableView dequeueReusableCellWithIdentifier:@"centerMoreCELL"];
  139. if (!cell) {
  140. cell = [[[NSBundle mainBundle] loadNibNamed:@"YBCenterMoreCell" owner:nil options:nil] lastObject];
  141. cell.backgroundColor = UIColor.whiteColor;
  142. cell.contentView.backgroundColor = UIColor.whiteColor;
  143. }
  144. NSDictionary *subDic = listArray[indexPath.row];
  145. cell.nameL.text = minstr([subDic valueForKey:@"name"]);
  146. cell.thumbImgV.image = [UIImage imageNamed:minstr([subDic valueForKey:@"img"])];
  147. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  148. return cell;
  149. }
  150. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  151. return 50;
  152. }
  153. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  154. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  155. [self dissmissView];
  156. NSDictionary *subDic = listArray[indexPath.row];
  157. int idInt = [minstr([subDic valueForKey:@"id"]) intValue];
  158. switch (idInt) {
  159. case 0:{
  160. //钱包
  161. YBRechargeVC *chargeVC = [[YBRechargeVC alloc]init];
  162. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:chargeVC animated:YES];
  163. }break;
  164. case 1:{
  165. //我的收益
  166. [self doProfit];
  167. }break;
  168. case 2:{
  169. ShopHomeVC *shop = [[ShopHomeVC alloc]init];
  170. shop.shop_name = minstr([subDic valueForKey:@"name"]);
  171. shop.shop_switch = _isSeller;
  172. [[YBBaseAppDelegate sharedAppDelegate] pushViewController:shop animated:YES];
  173. }break;
  174. case 3:{
  175. //直播权限说明
  176. [self doWebView:[NSString stringWithFormat:@"%@/appapi/liveauthority/index?uid=%@&token=%@",h5url,[Config getOwnID],[Config getOwnToken]]];
  177. }break;
  178. case 4:{
  179. //邀请好友赚钱
  180. [self doWebView:[NSString stringWithFormat:@"%@/appapi/agent/index?uid=%@&token=%@",h5url,[Config getOwnID],[Config getOwnToken]]];
  181. }break;
  182. case 5:{
  183. //观看记录
  184. [self doWatchingRecords];
  185. }break;
  186. case 6:{
  187. //商品记录
  188. [self doCommodityRecordsVC];
  189. }break;
  190. case 7:
  191. [self doSet];
  192. break;
  193. case 8:{
  194. RoomManagementVC *roomVC = [[RoomManagementVC alloc]init];
  195. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:roomVC animated:YES];
  196. }break;
  197. case 9:{
  198. YBDayTaskVC *roomVC = [[YBDayTaskVC alloc]init];
  199. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:roomVC animated:YES];
  200. }break;
  201. case 10:{
  202. YBGoodsLikeVC *liveVC = [[YBGoodsLikeVC alloc]init];
  203. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:liveVC animated:YES];
  204. }
  205. break;
  206. case 11:{
  207. UphotOrderVC *detailVc = [[UphotOrderVC alloc]init];
  208. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:detailVc animated:YES];
  209. }break;
  210. case 12:{
  211. AdvertManagerVC *adVC = [[AdvertManagerVC alloc]init];
  212. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:adVC animated:YES];
  213. }break;
  214. case 13:{
  215. NSString *url = minstr([common getServiceUrl]);
  216. if ([PublicObj checkNull:url]) {
  217. return;
  218. }
  219. PubH5*serviceVC = [[PubH5 alloc]init];
  220. serviceVC.url = url;
  221. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:serviceVC animated:YES];
  222. }break;
  223. case 14:{
  224. /// 直播动态
  225. PubH5 *h5vc = [[PubH5 alloc]init];
  226. h5vc.url =[h5url stringByAppendingString:[NSString stringWithFormat:@"/appapi/lrecording/record?uid=%@&token=%@&touid=%@",[Config getOwnID],[Config getOwnToken],[Config getOwnID]]];
  227. [[YBBaseAppDelegate sharedAppDelegate] pushViewController:h5vc animated:YES];
  228. }break;
  229. case 15:{
  230. // 红包收益
  231. [self doRedProfit];
  232. }break;
  233. case 16:{
  234. // 青少年模式
  235. [[YBYoungManager shareInstance] checkYoungStatus:YoungFrom_Center];
  236. }break;
  237. case 17:{
  238. // 创作者
  239. YBCreatorVC *cvc = [[YBCreatorVC alloc]init];
  240. [[YBBaseAppDelegate sharedAppDelegate] pushViewController:cvc animated:YES];
  241. }break;
  242. default:
  243. break;
  244. }
  245. }
  246. - (void)doDepositAccount{
  247. depositAccountVC *vc = [[depositAccountVC alloc]init];
  248. vc.hidesBottomBarWhenPushed = YES;
  249. [[YBBaseAppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  250. }
  251. -(void)doRedProfit{
  252. YBRedProfitVC *vc = [[YBRedProfitVC alloc]init];
  253. vc.hidesBottomBarWhenPushed = YES;
  254. [[YBBaseAppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  255. }
  256. - (void)doProfit{
  257. YBGetProVC *vc = [[YBGetProVC alloc]init];
  258. vc.hidesBottomBarWhenPushed = YES;
  259. [[YBBaseAppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  260. }
  261. - (void)doWatchingRecords{
  262. watchingRecordsVC *vc = [[watchingRecordsVC alloc]init];
  263. vc.hidesBottomBarWhenPushed = YES;
  264. [[YBBaseAppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  265. }
  266. - (void)doCommodityRecordsVC{
  267. // commodityRecordsVC *vc = [[commodityRecordsVC alloc]init];
  268. // vc.hidesBottomBarWhenPushed = YES;
  269. // [[YBBaseAppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  270. // LookHistoryVC *history = [[LookHistoryVC alloc]init];
  271. // [[YBBaseAppDelegate sharedAppDelegate]pushViewController:history animated:YES];
  272. }
  273. - (void)doSet{
  274. SetViewControllor *vc = [[SetViewControllor alloc]init];
  275. vc.hidesBottomBarWhenPushed = YES;
  276. [[YBBaseAppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  277. }
  278. - (void)doWebView:(NSString *)url{
  279. PubH5 *vc = [[PubH5 alloc]init];
  280. vc.hidesBottomBarWhenPushed = YES;
  281. vc.url = url;
  282. [[YBBaseAppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  283. }
  284. @end