// // YOUPAILCVerifyBigCastVC.m // LiveChat // // Created by 张灿 on 2018/8/29. // Copyright © 2018年 caicai. All rights reserved. // #import "YOUPAILCVerifyBigCastVC.h" #import "YOUPAILCVerifyBigCastModel.h" #import "YOUPAILCCoinBtnCell.h" #import "YOUPAILCBigCastProtocolVC.h" #import "YOUPAILCCameraAuditVC.h" #import "YOUPAILCEditUserMsgVC.h" #import "YOUPAILCBigCastSkillVC.h" @interface YOUPAILCVerifyBigCastVC () @property(nonatomic,strong)UITableView* youpaiptableView; @property(nonatomic,strong)YOUPAILCVerifyBigCastModel* youpaipverModel; @property(nonatomic,strong)UIButton* youpaipapplyBtn; @end @implementation YOUPAILCVerifyBigCastVC - (UITableView *)youpaiptableView{ if (!_youpaiptableView) { _youpaiptableView = [[UITableView alloc]initWithFrame:CGRectMake(0, NavBarHeight, KScreenWidth, KScreenHeight-NavBarHeight) style:UITableViewStyleGrouped]; _youpaiptableView.showsVerticalScrollIndicator = NO; _youpaiptableView.separatorStyle = UITableViewCellSeparatorStyleNone; _youpaiptableView.backgroundColor = LCBkgColor; _youpaiptableView.delegate = self; _youpaiptableView.dataSource = self; _youpaiptableView.estimatedSectionHeaderHeight = CGFLOAT_MIN; _youpaiptableView.estimatedSectionFooterHeight = CGFLOAT_MIN; } return _youpaiptableView; } - (void)viewDidLoad { [super viewDidLoad]; self.title = @"成为女神"; [self youpaifinitUI]; } - (void)youpaifinitUI{ [self.view addSubview:self.youpaiptableView]; UIButton* applyBtn = [[UIButton alloc]initWithFrame:CGRectMake(40, KScreenHeight - 77.0f - SafeHeight, KScreenWidth-80,48)]; applyBtn.backgroundColor = HexColorFromRGB(0x4F4B5B); applyBtn.titleLabel.font = LCFont17; applyBtn.layer.cornerRadius = 24; applyBtn.layer.masksToBounds = YES; [applyBtn setTitle:@"提交审核" forState:(UIControlStateNormal)]; [applyBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; [applyBtn addTarget:self action:@selector(applyClick) forControlEvents:(UIControlEventTouchUpInside)]; applyBtn.userInteractionEnabled = NO; self.youpaipapplyBtn = applyBtn; [self.view addSubview:applyBtn]; } - (void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [self youpaifinitData]; } - (void)youpaifinitData{ [LCHttpHelper requestWithURLString:JoinBigCast parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) { self.youpaipverModel = [YOUPAILCVerifyBigCastModel mj_objectWithKeyValues:[dict objectForKey:@"data"]]; if (self.youpaipverModel.youpaipapply_status == 0 || self.youpaipverModel.youpaipapply_status == 2 ) {//等于2的时候可以显示备注信息 [self.youpaipapplyBtn setTitle:@"提交审核" forState:(UIControlStateNormal)]; if (self.youpaipverModel.youpaipagree_protocol ==1 && self.youpaipverModel.youpaipcamera_status==1 && self.youpaipverModel.youpaipphoto_status==1 &&self.youpaipverModel.youpaipskill_status==1) { [self.youpaipapplyBtn setBackgroundImage:[LCTools ColorImage:self.youpaipapplyBtn.mj_size FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)]; self.youpaipapplyBtn.userInteractionEnabled = YES; }else{ [self.youpaipapplyBtn setBackgroundImage:nil forState:(UIControlStateNormal)]; self.youpaipapplyBtn.userInteractionEnabled = NO; } }else{ if (self.youpaipverModel.youpaipapply_status == 1) { [self.youpaipapplyBtn setTitle:@"审核中" forState:(UIControlStateNormal)]; } if (self.youpaipverModel.youpaipapply_status == 3) { [self.youpaipapplyBtn setTitle:@"已通过审核" forState:(UIControlStateNormal)]; } [self.youpaipapplyBtn setBackgroundImage:nil forState:(UIControlStateNormal)]; self.youpaipapplyBtn.userInteractionEnabled = NO; } [self.youpaiptableView reloadData]; } } failure:^(NSError *error) { }]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 3; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return CGFLOAT_MIN; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 70; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ YOUPAILCCoinBtnCell * cell = [[YOUPAILCCoinBtnCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"YOUPAILCCoinBtnCell"]; if (indexPath.row==0) { cell.youpaipheadLabel.text = @"服务协议"; if (self.youpaipverModel.youpaipagree_protocol == 1) { [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)]; [cell.youpaipfooterBtn setTitle:@"已同意" forState:(UIControlStateNormal)]; }else{ [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)]; [cell.youpaipfooterBtn setTitle:@"去查看" forState:(UIControlStateNormal)]; } }else if (indexPath.row==1){ cell.youpaipheadLabel.text = @"自拍认证"; if (self.youpaipverModel.youpaipcamera_status ==1 ) { [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)]; [cell.youpaipfooterBtn setTitle:@"已完成" forState:(UIControlStateNormal)]; }else{ [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)]; [cell.youpaipfooterBtn setTitle:@"去完成" forState:(UIControlStateNormal)]; } }else if (indexPath.row==2){ cell.youpaipheadLabel.text = @"完善相册"; if (self.youpaipverModel.youpaipphoto_status ==1 ) { [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)]; [cell.youpaipfooterBtn setTitle:@"已完成" forState:(UIControlStateNormal)]; }else{ [cell.youpaipfooterBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(64, 22.0f) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight] forState:(UIControlStateNormal)]; [cell.youpaipfooterBtn setTitle:@"去完成" forState:(UIControlStateNormal)]; } } // else{ // cell.headLabel.text = @"女神技能"; // if (self.verModel.skill_status ==1 ) { // [cell.footerBtn setBackgroundImage:[UIImage imageWithColor:HexColorFromRGB(0xCCCCCC) size:CGSizeMake(64, 30)] forState:(UIControlStateNormal)]; // [cell.footerBtn setTitle:@"已认证" forState:(UIControlStateNormal)]; // }else{ // [cell.footerBtn setBackgroundImage:[UIImage imageWithColor:ZYPinkColor size:CGSizeMake(64, 30)] forState:(UIControlStateNormal)]; // [cell.footerBtn setTitle:@"去申请" forState:(UIControlStateNormal)]; // } // } cell.youpaipfooterBtn.userInteractionEnabled = NO; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.row==0) { YOUPAILCBigCastProtocolVC* bc = [[YOUPAILCBigCastProtocolVC alloc]init]; if (self.youpaipverModel.youpaipagree_protocol ==1) { bc.youpaipagree = YES; }else{ bc.youpaipagree = NO; } [self.navigationController pushViewController:bc animated:YES]; }else if (indexPath.row==1){ YOUPAILCCameraAuditVC* audit = [[YOUPAILCCameraAuditVC alloc]init]; [self.navigationController pushViewController:audit animated:YES]; }else if (indexPath.row==2){ YOUPAILCEditUserMsgVC* editPhoto = [[YOUPAILCEditUserMsgVC alloc]init]; [self.navigationController pushViewController:editPhoto animated:YES]; }else{ YOUPAILCBigCastSkillVC* skill = [[YOUPAILCBigCastSkillVC alloc]init]; [self.navigationController pushViewController:skill animated:YES]; } } - (void)applyClick{ [LCHttpHelper requestWithURLString:ApplyBigCast parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) { [ZCHUDHelper showTitle:@"已提交申请"]; [LCHttpHelper requestWithURLString:BigCastSetVideoStatus parameters:@{@"status":@(1)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) { [LCSaveData saveVideoOpenStatu:YES]; [LCTools updateTabCenter]; } } failure:^(NSError *error) { }]; [self.navigationController popViewControllerAnimated:YES]; } } failure:^(NSError *error) { }]; } @end