12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157 |
- //
- // MSYMineinfoEditVC.m
- // AliyunOSSiOS
- //
- // Created by admin on 2022/3/1.
- //
- #import "MSYMineinfoEditVC.h"
- #import "MSYMineInfoProgressCell.h"
- #import "YOUPAIMineInfoHeadCell.h"
- #import "YOUPAIMineNickNameCell.h"
- #import "YOUPAIMineInfoPhotoCell.h"
- #import "LZAlertWindow.h"
- #import "YOUPAIMineLabelEditVC.h"
- #import "YOUPAILCUpdateNickVC.h"
- #import "YOUPAILZBigCastAudioSetVC.h"
- #import "YOUPAILCUpdateCityVC.h"
- #import "YOUPAILZUpdateSignVC.h"
- #import "UIViewController+YOUPAIUPImage.h"
- #import "UIViewController+TFPresent.h"
- #import "UIViewController+YOUPAIYBImageBrowser.h"
- #import "UIViewController+TFPresent.h"
- #import "YOUPAIMineInfoScanImageCell.h"
- #import "YYKit.h"
- typedef enum MINEINFOEDIT_TYPE {
- MINEINFOEDIT_PROGRESS=0, // 进度
- MINEINFOEDIT_HEAD=1, // 头像
- MINEINFOEDIT_NICKNAME = 2, // 昵称
- MINEINFOEDIT_PHOTO, // 相册
- MINEINFOEDIT_VIDEO, // 视频
- MINEINFOEDIT_VOICE, // 声音
- MINEINFOEDIT_BRIIRTHDAY, // 生日
- MINEINFOEDIT_ADDRESS, // 地址
- MINEINFOEDIT_HEIGHT,// 身高
- MINEINFOEDIT_WEIGHT,// 体重
- MINEINFOEDIT_PROFESSINON, // 职业
- // MINEINFOEDIT_INCOME, // 收入
- // MINEINFOEDIT_EDUCATION, // 学历
- // MINEINFOEDIT_MARITAL, // 婚姻
- MINEINFOEDIT_INTRODUCE, // 自我介绍
- MINEINFOEDIT_LABEL, // 标签
-
- } MINEINFOEDIT_TYPE;
- @interface MSYMineinfoEditVC ()
- @property(strong, nonatomic) UIBarButtonItem *rightItem;
- /**
- // 头像认证结果
- 1 认证成功 可以提交
- 2 人工审核 提交接口无需提交
- */
- @property(assign, nonatomic) NSInteger youpaipCompareAvatar;
- @property(strong, nonatomic) NSDictionary* selectData;
- @end
- @implementation MSYMineinfoEditVC
- -(UITableView *)tableView{
- if (_tableView == nil){
- _tableView = [UITableView new];
- _tableView.dataSource = self;
- _tableView.delegate = self;
- [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
- [_tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
-
- [_tableView registerClass:[MSYMineInfoProgressCell class] forCellReuseIdentifier:@"MSYMineInfoProgressCell"];
- [_tableView registerClass:[YOUPAIMineInfoHeadCell class] forCellReuseIdentifier:@"YOUPAIMineInfoHeadCell"];
- [_tableView registerClass:[YOUPAIMineNickNameCell class] forCellReuseIdentifier:@"YOUPAIMineNickNameCell"];
- [_tableView registerClass:[YOUPAIMineVoiceCell class] forCellReuseIdentifier:@"YOUPAIMineVoiceCell"];
- [_tableView registerClass:[YOUPAIMineBirthdayCell class] forCellReuseIdentifier:@"YOUPAIMineBirthdayCell"];
- [_tableView registerClass:[YOUPAIMineAddressCell class] forCellReuseIdentifier:@"YOUPAIMineAddressCell"];
- [_tableView registerClass:[YOUPAIMineHeightCell class] forCellReuseIdentifier:@"YOUPAIMineHeightCell"];
- [_tableView registerClass:[YOUPAIMineProfessionCell class] forCellReuseIdentifier:@"YOUPAIMineProfessionCell"];
- [_tableView registerClass:[YOUPAIMineIncomeCell class] forCellReuseIdentifier:@"YOUPAIMineIncomeCell"];
- [_tableView registerClass:[YOUPAIMineEducationCell class] forCellReuseIdentifier:@"YOUPAIMineEducationCell"];
- [_tableView registerClass:[YOUPAIMineMaritalStatusCell class] forCellReuseIdentifier:@"YOUPAIMineMaritalStatusCell"];
- [_tableView registerClass:[YOUPAIMineIntroduceCell class] forCellReuseIdentifier:@"YOUPAIMineIntroduceCell"];
- [_tableView registerClass:[YOUPAIMineLabelCell class] forCellReuseIdentifier:@"YOUPAIMineLabelCell"];
- [_tableView registerClass:[YOUPAIMineInfoPhotoCell class] forCellReuseIdentifier:@"YOUPAIMineInfoPhotoCell"];
- [_tableView registerClass:[YOUPAIMineInfoVideoCell class] forCellReuseIdentifier:@"YOUPAIMineInfoVideoCell"];
-
-
-
- }
- return _tableView;
- }
- -(UIBarButtonItem *)rightItem{
- if (_rightItem == nil){
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- [button addTarget:self action:@selector(youpaifAPIEditUserInfo) forControlEvents:UIControlEventTouchUpInside];
- button.frame = CGRectMake(0, 0, 56, 24);
- [button setTitle:@"保存" forState:0];
- [button setTitleColor:LZ7C69FEColor forState:0];
- // [button setBackgroundColor:HexColorFromRGB(0xFF5CA2)];
- button.titleLabel.font = LCFont14;
- button.layer.cornerRadius = 12;
- button.layer.masksToBounds = YES;
- [self.view addSubview:button];
-
- // 设置rightBarButtonItem
- _rightItem = [[UIBarButtonItem alloc] initWithCustomView:button];
- }
- return _rightItem;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.title = @"编辑资料";
- self.navigationItem.rightBarButtonItem = self.rightItem;
- [self.view addSubview:self.tableView];
- [self makelayout];
- [self youpaifAPIloadUserInfo];
- [self youpaifgetSelectData];
- }
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- self.navigationController.navigationBar.hidden = NO;
- }
- -(void)makelayout{
- [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(NavBarHeight);
- make.bottom.mas_equalTo(0).offset(-SafeHeight);
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- }];
- }
- -(YOUPAIUesrInfoEditModel *)youpaipRequestData{
- if (_youpaipRequestData == nil){
- _youpaipRequestData = [YOUPAIUesrInfoEditModel new];
- }
- return _youpaipRequestData;
- }
- @end
- // MARK: tablevie delegate
- @implementation MSYMineinfoEditVC (tableview)
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return 16;
- }
- - (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
- if (indexPath.row == MINEINFOEDIT_PROGRESS) {
- MSYMineInfoProgressCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MSYMineInfoProgressCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:true];
- CGFloat progress = [_youpaipRequestData youpaifProgress] ;
- cell.progressView.progress = progress;
- cell.progressLab.text = [NSString stringWithFormat:@"%0.1f%%",progress*100];
- NSDictionary *task = self.youpaipshowModel.task;
- NSDictionary *headtask = task[@"over_task"];
- BOOL isshow = ([[headtask objectForKey:@"is_show"] intValue] == 1);
- if (isshow && progress<1){
- [cell.bubbleLab setHidden:NO];
- cell.bubbleLab.text = headtask[@"des"];
- }else{
- [cell.bubbleLab setHidden:true];
- }
- return cell;
-
- }else if (indexPath.row == MINEINFOEDIT_HEAD) {
- YOUPAIMineInfoHeadCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineInfoHeadCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:false];
- if (self.youpaipRequestData.youpaipavatar.length>0){
- NSURL *url = [[LCTools getImageUrlWithAddress:self.youpaipRequestData.youpaipavatar] urlWithImageScale:60];
- [cell.headImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@""]];
- }
-
- NSDictionary *task = self.youpaipshowModel.task;
- NSDictionary *headtask = task[@"avatar_task"];
- BOOL isshow = ([[headtask objectForKey:@"is_show"] intValue] == 1);
- if (isshow){
- [cell.bubbleLab setHidden:NO];
- cell.bubbleLab.text = headtask[@"des"];
- }else{
- [cell.bubbleLab setHidden:YES];
- }
- return cell;
- }
- else if (indexPath.row == MINEINFOEDIT_NICKNAME) {
- YOUPAIMineNickNameCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineNickNameCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:false];
- cell.vlaueLab.text = self.youpaipRequestData.youpaipnickname;
- cell.vlaueLab.textColor = LZ273145Color;
- return cell;
- }
- else if (indexPath.row == MINEINFOEDIT_PHOTO) {
- YOUPAIMineInfoPhotoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineInfoPhotoCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:true];
- cell.delegate = (id)self;
- cell.youpaipimages = _youpaipRequestData.youpaipalbums;
- [cell.collectionView reloadData];
- if (_youpaipRequestData.youpaipalbums.count>0){
- [cell.bubbleLab setHidden:YES];
- }
- cell.titleLab.text =[NSString stringWithFormat:@"展示照片(%zd/6)",_youpaipRequestData.youpaipalbums.count] ;
- NSDictionary *task = self.youpaipshowModel.task;
- NSDictionary *headtask = task[@"album_task"];
- BOOL isshow = ([[headtask objectForKey:@"is_show"] intValue] == 1);
- if (isshow){
- [cell.bubbleLab setHidden:NO];
- cell.bubbleLab.text = headtask[@"des"];
- }else{
- [cell.bubbleLab setHidden:YES];
- }
-
- return cell;
- }
- else if (indexPath.row == MINEINFOEDIT_VIDEO) {
- YOUPAIMineInfoVideoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineInfoVideoCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:true];
- cell.delegate = (id)self;
- [cell.bubbleLab setHidden:true];
- if (_youpaipRequestData.youpaipvideo.length>0){
- NSURL *url = [LCTools getImageUrlWithAddress:_youpaipRequestData.youpaipvideo];
- cell.youpaipImageView.image = [UIImage imageWithVideo:url];
- cell.youpaipImageView.contentMode = UIViewContentModeScaleAspectFill;
- [cell.youpaipplayerImageView setHidden:false] ;
- }else{
-
- cell.youpaipImageView.image = [UIImage imageNamed:@"icon_180_up_plus"];
- [cell.youpaipplayerImageView setHidden:true] ;
- cell.youpaipImageView.contentMode = UIViewContentModeCenter;
- // 男的删掉,女的保留
- if (self.youpaipshowModel.youpaipgender == 1){
- NSDictionary *task = self.youpaipshowModel.task;
- NSDictionary *headtask = task[@"video_task"];
- BOOL isshow = ([[headtask objectForKey:@"is_show"] intValue] == 1);
- if (isshow){
- [cell.bubbleLab setHidden:NO];
- cell.bubbleLab.text = headtask[@"des"];
- }else{
- [cell.bubbleLab setHidden:YES];
- }
- }
-
- }
-
- return cell;
- }
- else if (indexPath.row == MINEINFOEDIT_VOICE) { // 声音展示
- YOUPAIMineVoiceCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineVoiceCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:false];
- if ([self.youpaipRequestData.youpaipvoice length]>0){
- cell.vlaueLab.text = @"重新录制";
- cell.vlaueLab.textColor = LZ273145Color;
- }else{
- cell.vlaueLab.text = @"去录制";
- cell.vlaueLab.textColor = LZA3AABEColor;
- }
-
- return cell;
- }
- else if (indexPath.row == MINEINFOEDIT_BRIIRTHDAY) { // 生日
-
- YOUPAIMineBirthdayCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineBirthdayCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:false];
-
-
- if (self.youpaipRequestData.youpaipbirthday.length>0){
- cell.vlaueLab.text = self.youpaipRequestData.youpaipbirthday;
- cell.vlaueLab.textColor = LZ273145Color;
- }else{
- cell.vlaueLab.textColor = LZA3AABEColor;
- }
-
- return cell;
- }
- else if (indexPath.row == MINEINFOEDIT_ADDRESS ) { // 所在地
- YOUPAIMineAddressCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineAddressCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:false];
- cell.vlaueLab.text = self.youpaipRequestData.youpaipcityId;
- cell.vlaueLab.textColor = LZ273145Color;
- return cell;
-
- }
- else if (indexPath.row == MINEINFOEDIT_HEIGHT) { // 身高
- YOUPAIMineHeightCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineHeightCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:false];
- cell.titleLab.text = @"身高";
- if ([self.youpaipRequestData.youpaipheight intValue]>0){
- cell.vlaueLab.text = self.youpaipRequestData.youpaipheight;
- cell.vlaueLab.textColor = LZ273145Color;
- }else{
- cell.vlaueLab.text = @"去完善";
- cell.vlaueLab.textColor = LZA3AABEColor;
- }
- return cell;
-
- }
- else if (indexPath.row == MINEINFOEDIT_WEIGHT) { // 体重
- YOUPAIMineHeightCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineHeightCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:false];
- cell.titleLab.text = @"体重";
- if ([self.youpaipRequestData.youpaipweight intValue]>0){
- cell.vlaueLab.text = self.youpaipRequestData.youpaipweight;
- cell.vlaueLab.textColor = LZ273145Color;
- }else{
- cell.vlaueLab.text = @"去完善";
- cell.vlaueLab.textColor = LZA3AABEColor;
- }
-
- return cell;
-
- }
-
- else if (indexPath.row == MINEINFOEDIT_PROFESSINON) { // 职业
- YOUPAIMineProfessionCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineProfessionCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:false];
- if ([self.youpaipRequestData.youpaipoccupation length]>0){
- cell.vlaueLab.text = self.youpaipRequestData.youpaipoccupation;
- cell.vlaueLab.textColor = LZ273145Color;
- }else{
- cell.vlaueLab.text = @"去完善";
- cell.vlaueLab.textColor = LZA3AABEColor;
- }
-
- return cell;
-
- }
- // else if (indexPath.row == MINEINFOEDIT_INCOME ) { // 年收入
- // YOUPAIMineIncomeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineIncomeCell" forIndexPath:indexPath];
- // [cell.rightArrow setHidden:false];
- // if ([self.youpaipRequestData.youpaipannual_income length]>0){
- // cell.vlaueLab.text = self.youpaipRequestData.youpaipannual_income;
- // cell.vlaueLab.textColor = LZ273145Color;
- // }else{
- // cell.vlaueLab.text = @"去完善";
- // cell.vlaueLab.textColor = LZA3AABEColor;
- // }
- //
- // return cell;
- //
- // }
- // else if (indexPath.row == MINEINFOEDIT_EDUCATION) { // 学历
- // YOUPAIMineEducationCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineEducationCell" forIndexPath:indexPath];
- // [cell.rightArrow setHidden:false];
- // if ([self.youpaipRequestData.youpaipeducation length]>0){
- // cell.vlaueLab.text = self.youpaipRequestData.youpaipeducation;
- // cell.vlaueLab.textColor = LZ273145Color;
- // }else{
- // cell.vlaueLab.text = @"去完善";
- // cell.vlaueLab.textColor = LZA3AABEColor;
- // }
- // return cell;
- //
- // }
- // else if (indexPath.row == MINEINFOEDIT_MARITAL) { // 婚姻状态
- // YOUPAIMineMaritalStatusCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineMaritalStatusCell" forIndexPath:indexPath];
- // [cell.rightArrow setHidden:false];
- // if ([self.youpaipRequestData.youpaipis_marriage length]>0){
- // cell.vlaueLab.text = self.youpaipRequestData.youpaipis_marriage;
- // cell.vlaueLab.textColor = LZ273145Color;
- // }else{
- // cell.vlaueLab.text = @"去完善";
- // cell.vlaueLab.textColor = LZA3AABEColor;
- // }
- //
- // return cell;
- //
- // }
- else if (indexPath.row == MINEINFOEDIT_INTRODUCE) { //自我介绍
- YOUPAIMineIntroduceCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineIntroduceCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:false];
- if (_youpaipRequestData.youpaipsignature.length>0){
- cell.vlaueLab.text = _youpaipRequestData.youpaipsignature;
- [cell.statusLab setHidden:true];
- [cell.bubbleLab setHidden:true];
- cell.vlaueLab.textColor = LZ273145Color;
- }else{
-
-
- cell.vlaueLab.text = @"添加自我介绍,更容易获得别人的关注哦~";
- [cell.statusLab setHidden:false];
-
- cell.vlaueLab.textColor = LZA3AABEColor;
- }
- NSDictionary *task = self.youpaipshowModel.task;
- NSDictionary *headtask = task[@"sign_task"];
- BOOL isshow = ([[headtask objectForKey:@"is_show"] intValue] == 1);
- if (isshow){
- [cell.bubbleLab setHidden:NO];
- cell.bubbleLab.text = headtask[@"des"];
- }else{
- [cell.bubbleLab setHidden:YES];
- }
-
- return cell;
-
- }
- else if (indexPath.row == MINEINFOEDIT_LABEL) { //标签
- YOUPAIMineLabelCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineLabelCell" forIndexPath:indexPath];
- [cell.rightArrow setHidden:false];
- if (self.youpaipRequestData.youpaiplabel.count>0){
- cell.dataSouce = self.youpaipRequestData.youpaiplabel;
- [cell reloadData];
- [cell.statusLab setHidden:true];
- [cell.stackView setHidden:false];
- [cell.vlaueLab setHidden:true];
- }else{
- [cell.vlaueLab setHidden:false];
- [cell.stackView setHidden:true];
- [cell.vlaueLab setHidden:false];
- [cell.statusLab setHidden:false];
- }
-
-
- return cell;
-
- }
- else{
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
- return cell;
- }
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- if (indexPath.row == MINEINFOEDIT_PROGRESS){
- return 95;
- }else if (indexPath.row == MINEINFOEDIT_PHOTO){
- return YOUPAIMineInfoPhotoCell.cellheight;
- }
- else if (indexPath.row == MINEINFOEDIT_VIDEO){
- return YOUPAIMineInfoVideoCell.cellheight;
- }
- else if (indexPath.row == MINEINFOEDIT_INTRODUCE){
- return 77.5;
- }
- else if (indexPath.row == MINEINFOEDIT_LABEL){
- return 77.5;
- }
- else{
- return 54;
- }
-
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- if (indexPath.row == MINEINFOEDIT_PROGRESS){
-
- }
- else if(indexPath.row ==MINEINFOEDIT_HEAD){ // 头像
- [self youpaifSelectAvatar];
- }
- else if(indexPath.row ==MINEINFOEDIT_NICKNAME){ // 昵称
- YOUPAILCUpdateNickVC* nickVC = [[YOUPAILCUpdateNickVC alloc]init];
- nickVC.youpaipnickName = [LCSaveModel getUserModel].youpaipuserinfo.youpaipnickname;
- @weakify(self);
- nickVC.youpaipblock = ^(NSString *nickname) {
- @strongify(self);
- self.youpaipRequestData.youpaipnickname = nickname;
- [self.tableView reloadData];
- };
- [self.navigationController pushViewController:nickVC animated:YES];
- }
- else if(indexPath.row ==MINEINFOEDIT_VOICE){ // 声音展示
- YOUPAILZBigCastAudioSetVC *vc = [[YOUPAILZBigCastAudioSetVC alloc] init];
-
- @weakify(self);
- [vc setSuccessBlock:^(NSString * _Nonnull mp3, NSInteger mp3_second) {
- @strongify(self);
- self.youpaipRequestData.youpaipvoice = mp3;
- self.youpaipRequestData.youpaipvoice_time = mp3_second;
- [self.tableView reloadData];
- }];
- [self.navigationController pushViewController:vc animated:YES];
- }
- else if(indexPath.row ==MINEINFOEDIT_BRIIRTHDAY){ // 生日
- [self youpaifSelectBirthday];
- }
- else if(indexPath.row ==MINEINFOEDIT_ADDRESS){ // 所在地
- YOUPAILCUpdateCityVC* cityVC = [[YOUPAILCUpdateCityVC alloc]init];
- cityVC.youpaipcityName = [LCSaveModel getUserModel].youpaipuserinfo.youpaipcity;
- @weakify(self);
- cityVC.youpaipblock = ^(NSString *cityName) {
- @strongify(self);
- self.youpaipRequestData.youpaipcityId = cityName;
- [self.tableView reloadData];
- };
- [self.navigationController pushViewController:cityVC animated:YES];
- }
- else if(indexPath.row ==MINEINFOEDIT_HEIGHT){ // 身高
- YOUPAIPickerSelectValueVC *vc = [YOUPAIPickerSelectValueVC new];
- vc.dataSouce = [self.selectData objectForKey:@"height"];
- @weakify(self);
- [vc setDidFinishSelectBlock:^(NSString * _Nonnull value) {
- @strongify(self);
- self.youpaipRequestData.youpaipheight = value;
- [self.tableView reloadData];
- }];
- [self TFPresentVC:vc completion:nil];
- }
- else if(indexPath.row == MINEINFOEDIT_WEIGHT){ // 身高
- YOUPAIPickerSelectValueVC *vc = [YOUPAIPickerSelectValueVC new];
- vc.dataSouce = [self.selectData objectForKey:@"weight"];
- @weakify(self);
- [vc setDidFinishSelectBlock:^(NSString * _Nonnull value) {
- @strongify(self);
- self.youpaipRequestData.youpaipweight = value;
- [self.tableView reloadData];
- }];
- [self TFPresentVC:vc completion:nil];
- }
-
- else if(indexPath.row ==MINEINFOEDIT_PROFESSINON){ // 职业
- [self youpaifSelectOccupation];
-
- }
- // else if(indexPath.row ==MINEINFOEDIT_INCOME){ // 年收入
- //
- // YOUPAIPickerSelectValueVC *vc = [YOUPAIPickerSelectValueVC new];
- // vc.dataSouce = [_selectData objectForKey:@"annual_income"];
- // @weakify(self);
- // [vc setDidFinishSelectBlock:^(NSString * _Nonnull value) {
- // @strongify(self);
- // self.youpaipRequestData.youpaipannual_income = value;
- // [self.tableView reloadData];
- // }];
- // [self TFPresentVC:vc completion:nil];
- //
- // }
- // else if(indexPath.row ==MINEINFOEDIT_EDUCATION){ // 学历
- // YOUPAIPickerSelectValueVC *vc = [YOUPAIPickerSelectValueVC new];
- // vc.dataSouce = [_selectData objectForKey:@"education"];
- // @weakify(self);
- // [vc setDidFinishSelectBlock:^(NSString * _Nonnull value) {
- // @strongify(self);
- // self.youpaipRequestData.youpaipeducation = value;
- // [self.tableView reloadData];
- // }];
- // [self TFPresentVC:vc completion:nil];
- //
- //
- // }
- // else if(indexPath.row ==MINEINFOEDIT_MARITAL){ // 婚姻
- // YOUPAIPickerSelectValueVC *vc = [YOUPAIPickerSelectValueVC new];
- // vc.dataSouce = [_selectData objectForKey:@"is_marriage"];
- // @weakify(self);
- // [vc setDidFinishSelectBlock:^(NSString * _Nonnull value) {
- // @strongify(self);
- // self.youpaipRequestData.youpaipis_marriage = value;
- // [self.tableView reloadData];
- // }];
- // [self TFPresentVC:vc completion:nil];
- //
- // }
- else if(indexPath.row ==MINEINFOEDIT_INTRODUCE){ // 自我介绍
- YOUPAILZUpdateSignVC* signVC = [[YOUPAILZUpdateSignVC alloc]init];
- signVC.youpaipsign = self.youpaipRequestData.youpaipsignature;
- signVC.youpaipblock = ^(NSString *sign) {
- self.youpaipRequestData.youpaipsignature= sign;
- [self.tableView reloadData];
- };
- [self.navigationController pushViewController:signVC animated:YES];
- }
- else if(indexPath.row ==MINEINFOEDIT_LABEL){ // 个人标签
- YOUPAIMineLabelEditVC *vc = [YOUPAIMineLabelEditVC new];
- [vc setDidFinishSaveBlock:^(NSArray * _Nonnull value) {
- self.youpaipRequestData.youpaiplabel = value;
- [self.tableView reloadData];
- }];
- [self.navigationController pushViewController:vc animated:YES];
- }else{
-
- }
- }
- @end
- @implementation MSYMineinfoEditVC(MineInfoPhoto)
- -(void)youpaifupdateImage:(NSInteger)row{
- @weakify(self);
- [self youpaifUploadImgType:@"album"
- configTZ:nil
- uploadBlock:nil
- fineshBlock:^(NSArray * _Nonnull imgurls, NSError * _Nonnull error) {
- @strongify(self);
-
- if (row < self.youpaipRequestData.youpaipalbums.count){
- // 替换
- [self.youpaipRequestData.youpaipalbums replaceObjectAtIndex:row withObject:imgurls.firstObject];
- }else{
- // 新增
- [self.youpaipRequestData.youpaipalbums addObjectsFromArray:imgurls];
- }
- [self.tableView reloadData];
-
- }];
- }
- // MARK: YOUPAIMineInfoPhotoCellDelegate
- -(void)mineInfoPhotoCellhandle:(YOUPAIMineInfoPhotoCell *)cell indexpath:(NSIndexPath *)indexPath{
-
- if (indexPath.row < self.youpaipRequestData.youpaipalbums.count){
- [self youapifScanAlbums:indexPath.row];
- }else{
- [self youpaifupdateImage:indexPath.row];
- }
- }
- @end
- // MARK: 头像
- @implementation MSYMineinfoEditVC(avatar)
- -(void)youpaifSelectAvatar{
-
- // if (![LCTools isRealNameAuthentication]){
- // return;
- // }
- @weakify(self);
- [self youpaifUploadImgType:@"album"
- configTZ:nil
- uploadBlock:nil
- fineshBlock:^(NSArray * _Nonnull imgurls, NSError * _Nonnull error) {
- @strongify(self);
-
- [self youpaifcompareFacesAvatar:imgurls.firstObject];
-
-
-
- }];
- }
- // 头像验证
- -(void)youpaifcompareFacesAvatar:(NSString*)url{
- @weakify(self);
- self.youpaipCompareAvatar = -1;
- // 如果是男用户,无需比对
- if (self.youpaipshowModel.youpaipgender != 1){
- self.youpaipRequestData.youpaipavatar = url;
- [self.tableView reloadData];
- return;
- }
- [LCHttpHelper requestWithURLString:api_compareFacesAvatar parameters:@{@"avatar":url} needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- NSString* msg = [dict objectForKey:@"message"];
- self.youpaipCompareAvatar = code;
- switch (code) {
- case 0: // 认证通过
-
- self.youpaipRequestData.youpaipavatar = url;
- [self.tableView reloadData];
- break;
- case 1006: // 识别失败
- self.youpaipRequestData.youpaipavatar = url;
- [self.tableView reloadData];
- [self youpaifAlertCompareFacesAvatar];
- break;
- case 1007: // 请先认证
-
- [self youpaifAlertGoCompareAvatar];
- break;
-
- default:
- [ZCHUDHelper showTitle:msg];
- break;
- }
-
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:@"头像识别失败"];
- }];
- }
- // 去认证 提示框
- -(void)youpaifAlertGoCompareAvatar{
- @weakify(self);
- LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
- @strongify(self);
- self.youpaipCompareAvatar = -1;//
- self.youpaipRequestData.youpaipavatar = self.youpaipshowModel.youpaipavatar;
- [self.tableView reloadData];
- }];
- cancelAction.cornerRadius = 24;
- cancelAction.bgColor = LZF5F4F7Color;
- cancelAction.color = LZ273145Color;
-
- LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"去认证" handler:^(LZAlertAction *action) {
- @strongify(self);
- // 将头像重置到原来url
- self.youpaipRequestData.youpaipavatar = self.youpaipshowModel.youpaipavatar;
- [self.tableView reloadData];
- [LCTools youpaifrealNameAuthentication];
-
-
- }];
-
- confimAction.cornerRadius = 24.0f;
- confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 108.0f)/2, 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
-
- LZAlertWindow *alert = [LZAlertWindow alertWithTitle:nil content:@"为保证头像真实性,需要认证后才可以上传头像(认证还有新手奖励哦)" action:@[cancelAction,confimAction]];
- alert.contentTextAlignment = NSTextAlignmentCenter;
- [self TFPresentVC:alert completion:^{}];
- }
- // 人工认证提示框
- -(void)youpaifAlertCompareFacesAvatar{
- @weakify(self);
- LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
- @strongify(self);
- self.youpaipCompareAvatar = -1;//
- self.youpaipRequestData.youpaipavatar = self.youpaipshowModel.youpaipavatar;
- [self.tableView reloadData];
- }];
- cancelAction.cornerRadius = 24;
- cancelAction.bgColor = LZF5F4F7Color;
- cancelAction.color = LZ273145Color;
-
- LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"重新上传" handler:^(LZAlertAction *action) {
- @strongify(self);
- // 将头像重置到原来url
- self.youpaipRequestData.youpaipavatar = self.youpaipshowModel.youpaipavatar;
- [self.tableView reloadData];
- [self youpaifSelectAvatar];
- }];
-
- confimAction.cornerRadius = 24.0f;
- confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 130.0f), 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
- LZAlertAction *compare = [LZAlertAction actionWithTitle:@"提交人工审核" handler:^(LZAlertAction *action) {
- self.youpaipCompareAvatar = 2;// 人工审核
- }];
- compare.cornerRadius = 24.0f;
- compare.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 130.0f), 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
-
- LZAlertWindow *alert = [LZAlertWindow alertWithTitle:nil content:@"上次的头像与你的认证面容对比不通过,你可以重新上传或提交人工审核" action:@[compare,confimAction,cancelAction]];
- alert.contentTextAlignment = NSTextAlignmentCenter;
- [self TFPresentVC:alert completion:^{}];
- }
- @end
- // MARK: 生日
- @implementation MSYMineinfoEditVC(Birthday)
- -(void)youpaifSelectBirthday{
-
- YOUPAISelectBirthdayPickVC *vc = [YOUPAISelectBirthdayPickVC new];
- vc.delegate = self;
- [self TFPresentVC:vc completion:nil];
- }
- - (void)didSelectBirthday:(nonnull YOUPAISelectBirthdayPickVC *)vc birthday:(nonnull NSDateComponents *)birthday {
- NSInteger year=[birthday year];
- NSInteger month=[birthday month];
- NSInteger day=[birthday day];
- NSString *birthdayStr = [NSString stringWithFormat:@"%ld-%ld-%ld",year,month,day];
- _youpaipRequestData.youpaipbirthday = birthdayStr;
- [_tableView reloadData];
- }
- @end
- // MARK: 年收入
- @implementation MSYMineinfoEditVC(incom)
- @end
- // MARK: 职业
- @implementation MSYMineinfoEditVC(Occupation)
- -(void)youpaifSelectOccupation{
- YOUPAISelectOccupationVC *vc = [YOUPAISelectOccupationVC new];
- vc.dataSouce = [_selectData objectForKey:@"occupation"];
- vc.delegate = self;
- [self TFPresentVC:vc completion:nil];
- }
- - (void)didSelectOccupation:(YOUPAISelectOccupationVC *)vc occupation:(NSString *)occupation{
- _youpaipRequestData.youpaipoccupation = occupation;
- [_tableView reloadData];
- }
- @end
- //MARK: 视频
- @implementation MSYMineinfoEditVC(Video)
- -(void)mineInfoVideoCellhandle:(YOUPAIMineInfoVideoCell *)cell{
-
- if (_youpaipRequestData.youpaipvideo.length>0){
- [self youapifScanVideo];
- return;
-
- }else{
- [self youpaifselectVideo];
- }
-
- }
- -(void)youpaifselectVideo{
- @weakify(self);
- [self youpaifTZSelectVideo:nil didSelect:^(UIImage * _Nullable coverImage, AVURLAsset * _Nullable asset, NSError * _Nullable error) {
- @strongify(self);
- if(error){
- [ZCHUDHelper showTitle:error.localizedDescription];
- return;
- }
- // 视频时长
- CMTime time = [asset duration];
- int seconds = ceil(time.value/time.timescale);
- seconds = MIN(seconds, 15);
-
- [ZCHUDHelper showWithStatus:@"正在裁剪..."];
- [self youpaifCutVideo:asset start:0 end:seconds completion:^(NSURL * outputURL, Float64 videoDuration, NSError * error) {
- @strongify(self);
- if(error){
- [ZCHUDHelper showTitle:error.localizedDescription];
- return;
- }
- [ZCHUDHelper showTitle:@"裁剪完成"];
-
- [self updateVideo:outputURL coverImage:coverImage];
-
- }];
-
-
-
- }];
- }
- -(void)updateVideo:(NSURL*)path coverImage:(UIImage*) coverImage{
- NSString *urlstr = path.resourceSpecifier;
- [ZCHUDHelper showWithStatus:@"正在上传..."];
- @weakify(self);
- [LCCommonHttp uploadWithVideoPath:urlstr Type:@"album" successBlock:^(NSString *ossFilePath) {
-
- @strongify(self);
- self.youpaipRequestData.youpaipvideo = ossFilePath;
- [ZCHUDHelper showTitle:@"上传完成"];
- [self.tableView reloadData];
- }];
- }
- @end
- // 查看视频/图片
- @implementation MSYMineinfoEditVC(ScanImagevideo)
- -(void)youapifScanAlbums:(NSInteger)index{
- YBImageBrowser *browser = [YBImageBrowser new];
- browser.shouldHideStatusBar = false;
- browser.tag = 0;
- browser.dataSource = self;
- browser.currentPage = index;
- [browser.defaultToolViewHandler.topView.operationButton setHidden:false];
- [browser.defaultToolViewHandler.topView.operationButton setTitle:@"删除" forState:UIControlStateNormal];
- [browser.defaultToolViewHandler.topView.operationButton setImage:NULL forState:UIControlStateNormal];
- @weakify(self);
- [browser.defaultToolViewHandler.topView setClickOperation:^(YBIBTopViewOperationType type) {
- @strongify(self);
- NSInteger row = browser.currentPage;
- [self.youpaipRequestData.youpaipalbums removeObjectAtIndex:row];
- [self.tableView reloadData];
- [browser hide];
- }];
-
- [browser show];
- }
- -(void)youapifScanVideo{
- YBImageBrowser *browser = [YBImageBrowser new];
- browser.tag = 1;
- browser.dataSource = self;
- browser.currentPage = 0;
- [browser.defaultToolViewHandler.topView.operationButton setHidden:false];
- [browser show];
- [browser.defaultToolViewHandler.topView.operationButton setHidden:false];
- [browser.defaultToolViewHandler.topView.operationButton setTitle:@"删除" forState:UIControlStateNormal];
- [browser.defaultToolViewHandler.topView.operationButton setImage:NULL forState:UIControlStateNormal];
- @weakify(self);
- [browser.defaultToolViewHandler.topView setClickOperation:^(YBIBTopViewOperationType type) {
- @strongify(self);
- self.youpaipRequestData.youpaipvideo = @"";
- [self.tableView reloadData];
- [browser hide];
- }];
- }
- // 实现 <YBImageBrowserDataSource> 协议方法配置数据源
- - (NSInteger)yb_numberOfCellsInImageBrowser:(YBImageBrowser *)imageBrowser{
- NSInteger tag = imageBrowser.tag;
- if (tag == 0){
- return self.youpaipRequestData.youpaipalbums.count;
- }else{
- return 1;
- }
- }
- - (id<YBIBDataProtocol>)yb_imageBrowser:(YBImageBrowser *)imageBrowser dataForCellAtIndex:(NSInteger)index{
- NSInteger tag = imageBrowser.tag;
- if (tag == 0){
- YOUPAIMineInfoScanImageData *data = [YOUPAIMineInfoScanImageData new];
- NSURL *url = [LCTools getImageUrlWithAddress:self.youpaipRequestData.youpaipalbums[index]];
- data.imageURL = url;
- // data.sourceObject = ...;
- return data;
- }else{
- YBIBVideoData *data = [YBIBVideoData new];
- data.videoURL = [LCTools getImageUrlWithAddress:self.youpaipRequestData.youpaipvideo];
- return data;
- }
-
- }
- @end
- @implementation MSYMineinfoEditVC (API)
- -(void)youpaifreloadRequestData{
- if (self.youpaipshowModel == nil){
- return;
- }
- // birthday:生日
- _youpaipRequestData.youpaipbirthday = _youpaipshowModel.youpaipBasicInfoDetail.youpaipbirthday;
- // height:升高
- _youpaipRequestData.youpaipheight = _youpaipshowModel.youpaipBasicInfoDetail.youpaipheight;
- // weight:体重
- _youpaipRequestData.youpaipweight = _youpaipshowModel.youpaipBasicInfoDetail.youpaipweight;
- // occupation:职业
- _youpaipRequestData.youpaipoccupation = _youpaipshowModel.youpaipBasicInfoDetail.youpaipoccupation;
- // cityId:城市id
- _youpaipRequestData.youpaipcityId = _youpaipshowModel.youpaipBasicInfoDetail.youpaipcity;
- // annual_income:收入
- _youpaipRequestData.youpaipannual_income = _youpaipshowModel.youpaipBasicInfoDetail.youpaipannual_income;
- // education:教育
- _youpaipRequestData.youpaipeducation = _youpaipshowModel.youpaipBasicInfoDetail.youpaipeducation;
- // is_marriage:婚姻状态
- _youpaipRequestData.youpaipis_marriage = _youpaipshowModel.youpaipBasicInfoDetail.youpaipis_marriage;
- // label:标签
- _youpaipRequestData.youpaiplabel = _youpaipshowModel.youpaiplabel_list;
-
- // avatar:头像
- _youpaipRequestData.youpaipavatar = _youpaipshowModel.youpaipavatar;
- // nickname:昵称
- _youpaipRequestData.youpaipnickname = _youpaipshowModel.youpaipnickname;
- // albums:视频
- _youpaipRequestData.youpaipvideo = _youpaipshowModel.youpaipvideo;
- // albums:相册
- [_youpaipRequestData.youpaipalbums removeAllObjects];
- for (YOUPAIAlbumModel *item in _youpaipshowModel.youpaipalbums_list) {
- if (item.youpaipis_video){
-
- }else{
- [_youpaipRequestData.youpaipalbums addObject:item.youpaipurl];
- }
- }
- // sign 签名
- if ([_youpaipshowModel.youpaipsign isEqualToString:@"这个人很懒,什么都没有留下…"]){
- _youpaipRequestData.youpaipsignature = @"";
- }else{
- _youpaipRequestData.youpaipsignature = _youpaipshowModel.youpaipsign;
- }
-
- // voice 语音
- _youpaipRequestData.youpaipvoice = _youpaipshowModel.youpaipvoice.youpaipvoice;
- // voice_time:语音时长
- _youpaipRequestData.youpaipvoice_time = _youpaipshowModel.youpaipvoice.youpaipvoice_time;
- // 视频
- // _youpaipRequestData.youpaipvideo = _youpaipshowModel.youpaipvideo_status;
-
-
- [self.tableView reloadData];
- }
- -(void)youpaifAPIloadUserInfo{
- NSDictionary *params = @{
- @"user_id":[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id
- };
- @weakify(self);
- [self.tableView setHidden:true];
- [LCHttpHelper requestWithURLString:GetUserInfo
- parameters:params
- needToken:YES
- type:(HttpRequestTypePost)
- success:^(id responseObject) {
-
- @strongify(self);
- [self.tableView setHidden:false];
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- self.youpaipshowModel = [YOUPAILCUserShowModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
- [self youpaifreloadRequestData];
- }
- } failure:^(NSError *error) {
- [self.view setAlpha:1];
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
- }
- -(void)youpaifAPIEditUserInfo{
-
-
- NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithDictionary: @{}];
- // 如果已经认证通过,无需提交头像
- if (self.youpaipCompareAvatar == 0
- ){
- [params removeObjectForKey:@"avatar"];
- }
- // 生日
- if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipbirthday isEqualToString:_youpaipRequestData.youpaipbirthday]){
- params[@"birthday"] = _youpaipRequestData.youpaipbirthday;
- }
- // 身高
- if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipheight isEqualToString:_youpaipRequestData.youpaipheight]){
- params[@"height"] = _youpaipRequestData.youpaipheight;
- }
- // 体重
- if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipweight isEqualToString:_youpaipRequestData.youpaipweight]){
- params[@"weight"] = _youpaipRequestData.youpaipweight;
- }
- // 城市
- if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipcity isEqualToString:_youpaipRequestData.youpaipcityId]){
- params[@"cityId"] = _youpaipRequestData.youpaipcityId;
- }
- // 职业
- if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipoccupation isEqualToString:_youpaipRequestData.youpaipoccupation]){
- params[@"occupation"] = _youpaipRequestData.youpaipoccupation;
- }
- // 收入
- if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipannual_income isEqualToString:_youpaipRequestData.youpaipannual_income]){
- params[@"annual_income"] = _youpaipRequestData.youpaipannual_income;
- }
- // 学历
- if (![ _youpaipshowModel.youpaipBasicInfoDetail.youpaipeducation isEqualToString:_youpaipRequestData.youpaipeducation]){
- params[@"education"] = _youpaipRequestData.youpaipeducation;
- }
- // 婚姻
- if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipis_marriage isEqualToString:_youpaipRequestData.youpaipis_marriage]){
- params[@"is_marriage"] = _youpaipRequestData.youpaipis_marriage;
- }
- // 标签
- NSMutableArray *names = [NSMutableArray new];
- for (YOUPAIZYLabelModel *item in _youpaipRequestData.youpaiplabel) {
- [names addObject:item.youpaiptag_id];
- }
- NSString *newname = [names componentsJoinedByString:@","];
-
- NSMutableArray *names2 = [NSMutableArray new];
- for (YOUPAIZYLabelModel *item in _youpaipshowModel.youpaiplabel_list) {
- [names2 addObject:item.youpaiptag_id];
- }
- NSString *oldnames = [names2 componentsJoinedByString:@","];
- if (![newname isEqualToString:oldnames]){
-
- params[@"label"] = newname;
-
- }
- // 头像
- if (![_youpaipshowModel.youpaipavatar isEqualToString:_youpaipRequestData.youpaipavatar]){
- params[@"avatar"] = _youpaipRequestData.youpaipavatar;
- }
- // 昵称
- if (![_youpaipshowModel.youpaipnickname isEqualToString:_youpaipRequestData.youpaipnickname]){
- params[@"nickname"] = _youpaipRequestData.youpaipnickname;
- }
- // 签名
- if (![_youpaipshowModel.youpaipsign isEqualToString:_youpaipRequestData.youpaipsignature] &&
- ![_youpaipRequestData.youpaipsignature isEqualToString:@""]){
- params[@"signature"] = _youpaipRequestData.youpaipsignature;
- }
- // 语音
- if (![_youpaipshowModel.youpaipvoice.youpaipvoice isEqualToString:_youpaipRequestData.youpaipvoice] &&
- _youpaipRequestData.youpaipvoice != nil){
- params[@"voice"] = _youpaipRequestData.youpaipvoice;
- params[@"voice_time"] = @([_youpaipRequestData youpaipvoice_time]);
-
- }
- // 视频
- if (![_youpaipshowModel.youpaipvideo isEqualToString:_youpaipRequestData.youpaipvideo]){
- params[@"video"] = _youpaipRequestData.youpaipvideo;
- }
-
- // 相册
-
- NSString *newal = [_youpaipRequestData.youpaipalbums componentsJoinedByString:@","];
- NSMutableArray *olds = [NSMutableArray new];
- for (YOUPAIAlbumModel *item in _youpaipshowModel.youpaipalbums_list) {
- if (item.youpaipis_video){
-
- }else{
- [olds addObject:item.youpaipurl];
- }
- }
- NSString *oldalbums = [olds componentsJoinedByString:@","];
- if (![newal isEqualToString:oldalbums]){
- params[@"albums"] = newal;
- }
-
- @weakify(self);
- [LCHttpHelper requestWithURLString:api_Improve_data
- parameters:params
- needToken:YES
- type:(HttpRequestTypePost)
- success:^(id responseObject) {
-
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
-
- [ZCHUDHelper showTitle:@"提交成功"];
- [self.navigationController popViewControllerAnimated:false];
-
- }
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
-
- }
- -(void)youpaifgetSelectData{
- @weakify(self);
- NSDictionary *params = @{};
- [LCHttpHelper requestWithURLString:api_getSelectData
- parameters:params
- needToken:YES
- type:(HttpRequestTypePost)
- success:^(id responseObject) {
-
- @strongify(self);
- [self.view setAlpha:1];
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- self.selectData = [dict objectForKey:@"data"] ;
- }
- } failure:^(NSError *error) {
-
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
- }
- @end
|