YOUPAILCVerifyBigCastVC.m 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. //
  2. // YOUPAILCVerifyBigCastVC.m
  3. // LiveChat
  4. //
  5. // Created by 张灿 on 2018/8/29.
  6. // Copyright © 2018年 caicai. All rights reserved.
  7. //
  8. #import "YOUPAILCVerifyBigCastVC.h"
  9. #import "YOUPAILCVerifyBigCastModel.h"
  10. #import "YOUPAILCCoinBtnCell.h"
  11. #import "YOUPAILCBigCastProtocolVC.h"
  12. #import "YOUPAILCCameraAuditVC.h"
  13. #import "YOUPAILCEditUserMsgVC.h"
  14. #import "YOUPAILCBigCastSkillVC.h"
  15. @interface YOUPAILCVerifyBigCastVC ()<UITableViewDataSource,UITableViewDelegate>
  16. @property(nonatomic,strong)UITableView* youpaiptableView;
  17. @property(nonatomic,strong)YOUPAILCVerifyBigCastModel* youpaipverModel;
  18. @property(nonatomic,strong)UIButton* youpaipapplyBtn;
  19. @end
  20. @implementation YOUPAILCVerifyBigCastVC
  21. - (UITableView *)youpaiptableView{
  22. if (!_youpaiptableView) {
  23. _youpaiptableView = [[UITableView alloc]initWithFrame:CGRectMake(0, NavBarHeight, KScreenWidth, KScreenHeight-NavBarHeight) style:UITableViewStyleGrouped];
  24. _youpaiptableView.showsVerticalScrollIndicator = NO;
  25. _youpaiptableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  26. _youpaiptableView.backgroundColor = LCBkgColor;
  27. _youpaiptableView.delegate = self;
  28. _youpaiptableView.dataSource = self;
  29. _youpaiptableView.estimatedSectionHeaderHeight = CGFLOAT_MIN;
  30. _youpaiptableView.estimatedSectionFooterHeight = CGFLOAT_MIN;
  31. }
  32. return _youpaiptableView;
  33. }
  34. - (void)viewDidLoad {
  35. [super viewDidLoad];
  36. self.title = @"成为女神";
  37. [self youpaifinitUI];
  38. }
  39. - (void)youpaifinitUI{
  40. [self.view addSubview:self.youpaiptableView];
  41. UIButton* applyBtn = [[UIButton alloc]initWithFrame:CGRectMake(40, KScreenHeight - 77.0f - SafeHeight, KScreenWidth-80,48)];
  42. applyBtn.backgroundColor = HexColorFromRGB(0x4F4B5B);
  43. applyBtn.titleLabel.font = LCFont17;
  44. applyBtn.layer.cornerRadius = 24;
  45. applyBtn.layer.masksToBounds = YES;
  46. [applyBtn setTitle:@"提交审核" forState:(UIControlStateNormal)];
  47. [applyBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  48. [applyBtn addTarget:self action:@selector(applyClick) forControlEvents:(UIControlEventTouchUpInside)];
  49. applyBtn.userInteractionEnabled = NO;
  50. self.youpaipapplyBtn = applyBtn;
  51. [self.view addSubview:applyBtn];
  52. }
  53. - (void)viewWillAppear:(BOOL)animated{
  54. [super viewWillAppear:animated];
  55. [self youpaifinitData];
  56. }
  57. - (void)youpaifinitData{
  58. [LCHttpHelper requestWithURLString:JoinBigCast parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  59. NSDictionary* dict = (NSDictionary*)responseObject;
  60. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  61. if (code==0) {
  62. self.youpaipverModel = [YOUPAILCVerifyBigCastModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
  63. if (self.youpaipverModel.youpaipapply_status == 0 || self.youpaipverModel.youpaipapply_status == 2 ) {//等于2的时候可以显示备注信息
  64. [self.youpaipapplyBtn setTitle:@"提交审核" forState:(UIControlStateNormal)];
  65. if (self.youpaipverModel.youpaipagree_protocol ==1 && self.youpaipverModel.youpaipcamera_status==1 && self.youpaipverModel.youpaipphoto_status==1 &&self.youpaipverModel.youpaipskill_status==1) {
  66. [self.youpaipapplyBtn setBackgroundImage:[LCTools ColorImage:self.youpaipapplyBtn.mj_size FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)];
  67. self.youpaipapplyBtn.userInteractionEnabled = YES;
  68. }else{
  69. [self.youpaipapplyBtn setBackgroundImage:nil forState:(UIControlStateNormal)];
  70. self.youpaipapplyBtn.userInteractionEnabled = NO;
  71. }
  72. }else{
  73. if (self.youpaipverModel.youpaipapply_status == 1) {
  74. [self.youpaipapplyBtn setTitle:@"审核中" forState:(UIControlStateNormal)];
  75. }
  76. if (self.youpaipverModel.youpaipapply_status == 3) {
  77. [self.youpaipapplyBtn setTitle:@"已通过审核" forState:(UIControlStateNormal)];
  78. }
  79. [self.youpaipapplyBtn setBackgroundImage:nil forState:(UIControlStateNormal)];
  80. self.youpaipapplyBtn.userInteractionEnabled = NO;
  81. }
  82. [self.youpaiptableView reloadData];
  83. }
  84. } failure:^(NSError *error) {
  85. }];
  86. }
  87. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  88. return 3;
  89. }
  90. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  91. return CGFLOAT_MIN;
  92. }
  93. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  94. return 70;
  95. }
  96. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  97. YOUPAILCCoinBtnCell * cell = [[YOUPAILCCoinBtnCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"YOUPAILCCoinBtnCell"];
  98. if (indexPath.row==0) {
  99. cell.youpaipheadLabel.text = @"服务协议";
  100. if (self.youpaipverModel.youpaipagree_protocol == 1) {
  101. [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)];
  102. [cell.youpaipfooterBtn setTitle:@"已同意" forState:(UIControlStateNormal)];
  103. }else{
  104. [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)];
  105. [cell.youpaipfooterBtn setTitle:@"去查看" forState:(UIControlStateNormal)];
  106. }
  107. }else if (indexPath.row==1){
  108. cell.youpaipheadLabel.text = @"自拍认证";
  109. if (self.youpaipverModel.youpaipcamera_status ==1 ) {
  110. [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)];
  111. [cell.youpaipfooterBtn setTitle:@"已完成" forState:(UIControlStateNormal)];
  112. }else{
  113. [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)];
  114. [cell.youpaipfooterBtn setTitle:@"去完成" forState:(UIControlStateNormal)];
  115. }
  116. }else if (indexPath.row==2){
  117. cell.youpaipheadLabel.text = @"完善相册";
  118. if (self.youpaipverModel.youpaipphoto_status ==1 ) {
  119. [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)];
  120. [cell.youpaipfooterBtn setTitle:@"已完成" forState:(UIControlStateNormal)];
  121. }else{
  122. [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)];
  123. [cell.youpaipfooterBtn setTitle:@"去完成" forState:(UIControlStateNormal)];
  124. }
  125. }
  126. // else{
  127. // cell.headLabel.text = @"女神技能";
  128. // if (self.verModel.skill_status ==1 ) {
  129. // [cell.footerBtn setBackgroundImage:[UIImage imageWithColor:HexColorFromRGB(0xCCCCCC) size:CGSizeMake(64, 30)] forState:(UIControlStateNormal)];
  130. // [cell.footerBtn setTitle:@"已认证" forState:(UIControlStateNormal)];
  131. // }else{
  132. // [cell.footerBtn setBackgroundImage:[UIImage imageWithColor:ZYPinkColor size:CGSizeMake(64, 30)] forState:(UIControlStateNormal)];
  133. // [cell.footerBtn setTitle:@"去申请" forState:(UIControlStateNormal)];
  134. // }
  135. // }
  136. cell.youpaipfooterBtn.userInteractionEnabled = NO;
  137. return cell;
  138. }
  139. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  140. if (indexPath.row==0) {
  141. YOUPAILCBigCastProtocolVC* bc = [[YOUPAILCBigCastProtocolVC alloc]init];
  142. if (self.youpaipverModel.youpaipagree_protocol ==1) {
  143. bc.youpaipagree = YES;
  144. }else{
  145. bc.youpaipagree = NO;
  146. }
  147. [self.navigationController pushViewController:bc animated:YES];
  148. }else if (indexPath.row==1){
  149. YOUPAILCCameraAuditVC* audit = [[YOUPAILCCameraAuditVC alloc]init];
  150. [self.navigationController pushViewController:audit animated:YES];
  151. }else if (indexPath.row==2){
  152. YOUPAILCEditUserMsgVC* editPhoto = [[YOUPAILCEditUserMsgVC alloc]init];
  153. [self.navigationController pushViewController:editPhoto animated:YES];
  154. }else{
  155. YOUPAILCBigCastSkillVC* skill = [[YOUPAILCBigCastSkillVC alloc]init];
  156. [self.navigationController pushViewController:skill animated:YES];
  157. }
  158. }
  159. - (void)applyClick{
  160. [LCHttpHelper requestWithURLString:ApplyBigCast parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  161. NSDictionary* dict = (NSDictionary*)responseObject;
  162. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  163. if (code==0) {
  164. [ZCHUDHelper showTitle:@"已提交申请"];
  165. [LCHttpHelper requestWithURLString:BigCastSetVideoStatus parameters:@{@"status":@(1)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  166. NSDictionary* dict = (NSDictionary*)responseObject;
  167. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  168. if (code==0) {
  169. [LCSaveData saveVideoOpenStatu:YES];
  170. [LCTools updateTabCenter];
  171. }
  172. } failure:^(NSError *error) {
  173. }];
  174. [self.navigationController popViewControllerAnimated:YES];
  175. }
  176. } failure:^(NSError *error) {
  177. }];
  178. }
  179. @end