MSYMineinfoEditVC.m 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157
  1. //
  2. // MSYMineinfoEditVC.m
  3. // AliyunOSSiOS
  4. //
  5. // Created by admin on 2022/3/1.
  6. //
  7. #import "MSYMineinfoEditVC.h"
  8. #import "MSYMineInfoProgressCell.h"
  9. #import "YOUPAIMineInfoHeadCell.h"
  10. #import "YOUPAIMineNickNameCell.h"
  11. #import "YOUPAIMineInfoPhotoCell.h"
  12. #import "LZAlertWindow.h"
  13. #import "YOUPAIMineLabelEditVC.h"
  14. #import "YOUPAILCUpdateNickVC.h"
  15. #import "YOUPAILZBigCastAudioSetVC.h"
  16. #import "YOUPAILCUpdateCityVC.h"
  17. #import "YOUPAILZUpdateSignVC.h"
  18. #import "UIViewController+YOUPAIUPImage.h"
  19. #import "UIViewController+TFPresent.h"
  20. #import "UIViewController+YOUPAIYBImageBrowser.h"
  21. #import "UIViewController+TFPresent.h"
  22. #import "YOUPAIMineInfoScanImageCell.h"
  23. #import "YYKit.h"
  24. typedef enum MINEINFOEDIT_TYPE {
  25. MINEINFOEDIT_PROGRESS=0, // 进度
  26. MINEINFOEDIT_HEAD=1, // 头像
  27. MINEINFOEDIT_NICKNAME = 2, // 昵称
  28. MINEINFOEDIT_PHOTO, // 相册
  29. MINEINFOEDIT_VIDEO, // 视频
  30. MINEINFOEDIT_VOICE, // 声音
  31. MINEINFOEDIT_BRIIRTHDAY, // 生日
  32. MINEINFOEDIT_ADDRESS, // 地址
  33. MINEINFOEDIT_HEIGHT,// 身高
  34. MINEINFOEDIT_WEIGHT,// 体重
  35. MINEINFOEDIT_PROFESSINON, // 职业
  36. // MINEINFOEDIT_INCOME, // 收入
  37. // MINEINFOEDIT_EDUCATION, // 学历
  38. // MINEINFOEDIT_MARITAL, // 婚姻
  39. MINEINFOEDIT_INTRODUCE, // 自我介绍
  40. MINEINFOEDIT_LABEL, // 标签
  41. } MINEINFOEDIT_TYPE;
  42. @interface MSYMineinfoEditVC ()
  43. @property(strong, nonatomic) UIBarButtonItem *rightItem;
  44. /**
  45. // 头像认证结果
  46. 1 认证成功 可以提交
  47. 2 人工审核 提交接口无需提交
  48. */
  49. @property(assign, nonatomic) NSInteger youpaipCompareAvatar;
  50. @property(strong, nonatomic) NSDictionary* selectData;
  51. @end
  52. @implementation MSYMineinfoEditVC
  53. -(UITableView *)tableView{
  54. if (_tableView == nil){
  55. _tableView = [UITableView new];
  56. _tableView.dataSource = self;
  57. _tableView.delegate = self;
  58. [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
  59. [_tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
  60. [_tableView registerClass:[MSYMineInfoProgressCell class] forCellReuseIdentifier:@"MSYMineInfoProgressCell"];
  61. [_tableView registerClass:[YOUPAIMineInfoHeadCell class] forCellReuseIdentifier:@"YOUPAIMineInfoHeadCell"];
  62. [_tableView registerClass:[YOUPAIMineNickNameCell class] forCellReuseIdentifier:@"YOUPAIMineNickNameCell"];
  63. [_tableView registerClass:[YOUPAIMineVoiceCell class] forCellReuseIdentifier:@"YOUPAIMineVoiceCell"];
  64. [_tableView registerClass:[YOUPAIMineBirthdayCell class] forCellReuseIdentifier:@"YOUPAIMineBirthdayCell"];
  65. [_tableView registerClass:[YOUPAIMineAddressCell class] forCellReuseIdentifier:@"YOUPAIMineAddressCell"];
  66. [_tableView registerClass:[YOUPAIMineHeightCell class] forCellReuseIdentifier:@"YOUPAIMineHeightCell"];
  67. [_tableView registerClass:[YOUPAIMineProfessionCell class] forCellReuseIdentifier:@"YOUPAIMineProfessionCell"];
  68. [_tableView registerClass:[YOUPAIMineIncomeCell class] forCellReuseIdentifier:@"YOUPAIMineIncomeCell"];
  69. [_tableView registerClass:[YOUPAIMineEducationCell class] forCellReuseIdentifier:@"YOUPAIMineEducationCell"];
  70. [_tableView registerClass:[YOUPAIMineMaritalStatusCell class] forCellReuseIdentifier:@"YOUPAIMineMaritalStatusCell"];
  71. [_tableView registerClass:[YOUPAIMineIntroduceCell class] forCellReuseIdentifier:@"YOUPAIMineIntroduceCell"];
  72. [_tableView registerClass:[YOUPAIMineLabelCell class] forCellReuseIdentifier:@"YOUPAIMineLabelCell"];
  73. [_tableView registerClass:[YOUPAIMineInfoPhotoCell class] forCellReuseIdentifier:@"YOUPAIMineInfoPhotoCell"];
  74. [_tableView registerClass:[YOUPAIMineInfoVideoCell class] forCellReuseIdentifier:@"YOUPAIMineInfoVideoCell"];
  75. }
  76. return _tableView;
  77. }
  78. -(UIBarButtonItem *)rightItem{
  79. if (_rightItem == nil){
  80. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  81. [button addTarget:self action:@selector(youpaifAPIEditUserInfo) forControlEvents:UIControlEventTouchUpInside];
  82. button.frame = CGRectMake(0, 0, 56, 24);
  83. [button setTitle:@"保存" forState:0];
  84. [button setTitleColor:LZ7C69FEColor forState:0];
  85. // [button setBackgroundColor:HexColorFromRGB(0xFF5CA2)];
  86. button.titleLabel.font = LCFont14;
  87. button.layer.cornerRadius = 12;
  88. button.layer.masksToBounds = YES;
  89. [self.view addSubview:button];
  90. // 设置rightBarButtonItem
  91. _rightItem = [[UIBarButtonItem alloc] initWithCustomView:button];
  92. }
  93. return _rightItem;
  94. }
  95. - (void)viewDidLoad {
  96. [super viewDidLoad];
  97. self.title = @"编辑资料";
  98. self.navigationItem.rightBarButtonItem = self.rightItem;
  99. [self.view addSubview:self.tableView];
  100. [self makelayout];
  101. [self youpaifAPIloadUserInfo];
  102. [self youpaifgetSelectData];
  103. }
  104. - (void)viewWillAppear:(BOOL)animated {
  105. [super viewWillAppear:animated];
  106. self.navigationController.navigationBar.hidden = NO;
  107. }
  108. -(void)makelayout{
  109. [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  110. make.top.mas_equalTo(NavBarHeight);
  111. make.bottom.mas_equalTo(0).offset(-SafeHeight);
  112. make.left.mas_equalTo(0);
  113. make.right.mas_equalTo(0);
  114. }];
  115. }
  116. -(YOUPAIUesrInfoEditModel *)youpaipRequestData{
  117. if (_youpaipRequestData == nil){
  118. _youpaipRequestData = [YOUPAIUesrInfoEditModel new];
  119. }
  120. return _youpaipRequestData;
  121. }
  122. @end
  123. // MARK: tablevie delegate
  124. @implementation MSYMineinfoEditVC (tableview)
  125. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  126. return 1;
  127. }
  128. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  129. return 16;
  130. }
  131. - (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
  132. if (indexPath.row == MINEINFOEDIT_PROGRESS) {
  133. MSYMineInfoProgressCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MSYMineInfoProgressCell" forIndexPath:indexPath];
  134. [cell.rightArrow setHidden:true];
  135. CGFloat progress = [_youpaipRequestData youpaifProgress] ;
  136. cell.progressView.progress = progress;
  137. cell.progressLab.text = [NSString stringWithFormat:@"%0.1f%%",progress*100];
  138. NSDictionary *task = self.youpaipshowModel.task;
  139. NSDictionary *headtask = task[@"over_task"];
  140. BOOL isshow = ([[headtask objectForKey:@"is_show"] intValue] == 1);
  141. if (isshow && progress<1){
  142. [cell.bubbleLab setHidden:NO];
  143. cell.bubbleLab.text = headtask[@"des"];
  144. }else{
  145. [cell.bubbleLab setHidden:true];
  146. }
  147. return cell;
  148. }else if (indexPath.row == MINEINFOEDIT_HEAD) {
  149. YOUPAIMineInfoHeadCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineInfoHeadCell" forIndexPath:indexPath];
  150. [cell.rightArrow setHidden:false];
  151. if (self.youpaipRequestData.youpaipavatar.length>0){
  152. NSURL *url = [[LCTools getImageUrlWithAddress:self.youpaipRequestData.youpaipavatar] urlWithImageScale:60];
  153. [cell.headImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@""]];
  154. }
  155. NSDictionary *task = self.youpaipshowModel.task;
  156. NSDictionary *headtask = task[@"avatar_task"];
  157. BOOL isshow = ([[headtask objectForKey:@"is_show"] intValue] == 1);
  158. if (isshow){
  159. [cell.bubbleLab setHidden:NO];
  160. cell.bubbleLab.text = headtask[@"des"];
  161. }else{
  162. [cell.bubbleLab setHidden:YES];
  163. }
  164. return cell;
  165. }
  166. else if (indexPath.row == MINEINFOEDIT_NICKNAME) {
  167. YOUPAIMineNickNameCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineNickNameCell" forIndexPath:indexPath];
  168. [cell.rightArrow setHidden:false];
  169. cell.vlaueLab.text = self.youpaipRequestData.youpaipnickname;
  170. cell.vlaueLab.textColor = LZ273145Color;
  171. return cell;
  172. }
  173. else if (indexPath.row == MINEINFOEDIT_PHOTO) {
  174. YOUPAIMineInfoPhotoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineInfoPhotoCell" forIndexPath:indexPath];
  175. [cell.rightArrow setHidden:true];
  176. cell.delegate = (id)self;
  177. cell.youpaipimages = _youpaipRequestData.youpaipalbums;
  178. [cell.collectionView reloadData];
  179. if (_youpaipRequestData.youpaipalbums.count>0){
  180. [cell.bubbleLab setHidden:YES];
  181. }
  182. cell.titleLab.text =[NSString stringWithFormat:@"展示照片(%zd/6)",_youpaipRequestData.youpaipalbums.count] ;
  183. NSDictionary *task = self.youpaipshowModel.task;
  184. NSDictionary *headtask = task[@"album_task"];
  185. BOOL isshow = ([[headtask objectForKey:@"is_show"] intValue] == 1);
  186. if (isshow){
  187. [cell.bubbleLab setHidden:NO];
  188. cell.bubbleLab.text = headtask[@"des"];
  189. }else{
  190. [cell.bubbleLab setHidden:YES];
  191. }
  192. return cell;
  193. }
  194. else if (indexPath.row == MINEINFOEDIT_VIDEO) {
  195. YOUPAIMineInfoVideoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineInfoVideoCell" forIndexPath:indexPath];
  196. [cell.rightArrow setHidden:true];
  197. cell.delegate = (id)self;
  198. [cell.bubbleLab setHidden:true];
  199. if (_youpaipRequestData.youpaipvideo.length>0){
  200. NSURL *url = [LCTools getImageUrlWithAddress:_youpaipRequestData.youpaipvideo];
  201. cell.youpaipImageView.image = [UIImage imageWithVideo:url];
  202. cell.youpaipImageView.contentMode = UIViewContentModeScaleAspectFill;
  203. [cell.youpaipplayerImageView setHidden:false] ;
  204. }else{
  205. cell.youpaipImageView.image = [UIImage imageNamed:@"icon_180_up_plus"];
  206. [cell.youpaipplayerImageView setHidden:true] ;
  207. cell.youpaipImageView.contentMode = UIViewContentModeCenter;
  208. // 男的删掉,女的保留
  209. if (self.youpaipshowModel.youpaipgender == 1){
  210. NSDictionary *task = self.youpaipshowModel.task;
  211. NSDictionary *headtask = task[@"video_task"];
  212. BOOL isshow = ([[headtask objectForKey:@"is_show"] intValue] == 1);
  213. if (isshow){
  214. [cell.bubbleLab setHidden:NO];
  215. cell.bubbleLab.text = headtask[@"des"];
  216. }else{
  217. [cell.bubbleLab setHidden:YES];
  218. }
  219. }
  220. }
  221. return cell;
  222. }
  223. else if (indexPath.row == MINEINFOEDIT_VOICE) { // 声音展示
  224. YOUPAIMineVoiceCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineVoiceCell" forIndexPath:indexPath];
  225. [cell.rightArrow setHidden:false];
  226. if ([self.youpaipRequestData.youpaipvoice length]>0){
  227. cell.vlaueLab.text = @"重新录制";
  228. cell.vlaueLab.textColor = LZ273145Color;
  229. }else{
  230. cell.vlaueLab.text = @"去录制";
  231. cell.vlaueLab.textColor = LZA3AABEColor;
  232. }
  233. return cell;
  234. }
  235. else if (indexPath.row == MINEINFOEDIT_BRIIRTHDAY) { // 生日
  236. YOUPAIMineBirthdayCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineBirthdayCell" forIndexPath:indexPath];
  237. [cell.rightArrow setHidden:false];
  238. if (self.youpaipRequestData.youpaipbirthday.length>0){
  239. cell.vlaueLab.text = self.youpaipRequestData.youpaipbirthday;
  240. cell.vlaueLab.textColor = LZ273145Color;
  241. }else{
  242. cell.vlaueLab.textColor = LZA3AABEColor;
  243. }
  244. return cell;
  245. }
  246. else if (indexPath.row == MINEINFOEDIT_ADDRESS ) { // 所在地
  247. YOUPAIMineAddressCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineAddressCell" forIndexPath:indexPath];
  248. [cell.rightArrow setHidden:false];
  249. cell.vlaueLab.text = self.youpaipRequestData.youpaipcityId;
  250. cell.vlaueLab.textColor = LZ273145Color;
  251. return cell;
  252. }
  253. else if (indexPath.row == MINEINFOEDIT_HEIGHT) { // 身高
  254. YOUPAIMineHeightCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineHeightCell" forIndexPath:indexPath];
  255. [cell.rightArrow setHidden:false];
  256. cell.titleLab.text = @"身高";
  257. if ([self.youpaipRequestData.youpaipheight intValue]>0){
  258. cell.vlaueLab.text = self.youpaipRequestData.youpaipheight;
  259. cell.vlaueLab.textColor = LZ273145Color;
  260. }else{
  261. cell.vlaueLab.text = @"去完善";
  262. cell.vlaueLab.textColor = LZA3AABEColor;
  263. }
  264. return cell;
  265. }
  266. else if (indexPath.row == MINEINFOEDIT_WEIGHT) { // 体重
  267. YOUPAIMineHeightCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineHeightCell" forIndexPath:indexPath];
  268. [cell.rightArrow setHidden:false];
  269. cell.titleLab.text = @"体重";
  270. if ([self.youpaipRequestData.youpaipweight intValue]>0){
  271. cell.vlaueLab.text = self.youpaipRequestData.youpaipweight;
  272. cell.vlaueLab.textColor = LZ273145Color;
  273. }else{
  274. cell.vlaueLab.text = @"去完善";
  275. cell.vlaueLab.textColor = LZA3AABEColor;
  276. }
  277. return cell;
  278. }
  279. else if (indexPath.row == MINEINFOEDIT_PROFESSINON) { // 职业
  280. YOUPAIMineProfessionCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineProfessionCell" forIndexPath:indexPath];
  281. [cell.rightArrow setHidden:false];
  282. if ([self.youpaipRequestData.youpaipoccupation length]>0){
  283. cell.vlaueLab.text = self.youpaipRequestData.youpaipoccupation;
  284. cell.vlaueLab.textColor = LZ273145Color;
  285. }else{
  286. cell.vlaueLab.text = @"去完善";
  287. cell.vlaueLab.textColor = LZA3AABEColor;
  288. }
  289. return cell;
  290. }
  291. // else if (indexPath.row == MINEINFOEDIT_INCOME ) { // 年收入
  292. // YOUPAIMineIncomeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineIncomeCell" forIndexPath:indexPath];
  293. // [cell.rightArrow setHidden:false];
  294. // if ([self.youpaipRequestData.youpaipannual_income length]>0){
  295. // cell.vlaueLab.text = self.youpaipRequestData.youpaipannual_income;
  296. // cell.vlaueLab.textColor = LZ273145Color;
  297. // }else{
  298. // cell.vlaueLab.text = @"去完善";
  299. // cell.vlaueLab.textColor = LZA3AABEColor;
  300. // }
  301. //
  302. // return cell;
  303. //
  304. // }
  305. // else if (indexPath.row == MINEINFOEDIT_EDUCATION) { // 学历
  306. // YOUPAIMineEducationCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineEducationCell" forIndexPath:indexPath];
  307. // [cell.rightArrow setHidden:false];
  308. // if ([self.youpaipRequestData.youpaipeducation length]>0){
  309. // cell.vlaueLab.text = self.youpaipRequestData.youpaipeducation;
  310. // cell.vlaueLab.textColor = LZ273145Color;
  311. // }else{
  312. // cell.vlaueLab.text = @"去完善";
  313. // cell.vlaueLab.textColor = LZA3AABEColor;
  314. // }
  315. // return cell;
  316. //
  317. // }
  318. // else if (indexPath.row == MINEINFOEDIT_MARITAL) { // 婚姻状态
  319. // YOUPAIMineMaritalStatusCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineMaritalStatusCell" forIndexPath:indexPath];
  320. // [cell.rightArrow setHidden:false];
  321. // if ([self.youpaipRequestData.youpaipis_marriage length]>0){
  322. // cell.vlaueLab.text = self.youpaipRequestData.youpaipis_marriage;
  323. // cell.vlaueLab.textColor = LZ273145Color;
  324. // }else{
  325. // cell.vlaueLab.text = @"去完善";
  326. // cell.vlaueLab.textColor = LZA3AABEColor;
  327. // }
  328. //
  329. // return cell;
  330. //
  331. // }
  332. else if (indexPath.row == MINEINFOEDIT_INTRODUCE) { //自我介绍
  333. YOUPAIMineIntroduceCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineIntroduceCell" forIndexPath:indexPath];
  334. [cell.rightArrow setHidden:false];
  335. if (_youpaipRequestData.youpaipsignature.length>0){
  336. cell.vlaueLab.text = _youpaipRequestData.youpaipsignature;
  337. [cell.statusLab setHidden:true];
  338. [cell.bubbleLab setHidden:true];
  339. cell.vlaueLab.textColor = LZ273145Color;
  340. }else{
  341. cell.vlaueLab.text = @"添加自我介绍,更容易获得别人的关注哦~";
  342. [cell.statusLab setHidden:false];
  343. cell.vlaueLab.textColor = LZA3AABEColor;
  344. }
  345. NSDictionary *task = self.youpaipshowModel.task;
  346. NSDictionary *headtask = task[@"sign_task"];
  347. BOOL isshow = ([[headtask objectForKey:@"is_show"] intValue] == 1);
  348. if (isshow){
  349. [cell.bubbleLab setHidden:NO];
  350. cell.bubbleLab.text = headtask[@"des"];
  351. }else{
  352. [cell.bubbleLab setHidden:YES];
  353. }
  354. return cell;
  355. }
  356. else if (indexPath.row == MINEINFOEDIT_LABEL) { //标签
  357. YOUPAIMineLabelCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIMineLabelCell" forIndexPath:indexPath];
  358. [cell.rightArrow setHidden:false];
  359. if (self.youpaipRequestData.youpaiplabel.count>0){
  360. cell.dataSouce = self.youpaipRequestData.youpaiplabel;
  361. [cell reloadData];
  362. [cell.statusLab setHidden:true];
  363. [cell.stackView setHidden:false];
  364. [cell.vlaueLab setHidden:true];
  365. }else{
  366. [cell.vlaueLab setHidden:false];
  367. [cell.stackView setHidden:true];
  368. [cell.vlaueLab setHidden:false];
  369. [cell.statusLab setHidden:false];
  370. }
  371. return cell;
  372. }
  373. else{
  374. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
  375. return cell;
  376. }
  377. }
  378. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  379. if (indexPath.row == MINEINFOEDIT_PROGRESS){
  380. return 95;
  381. }else if (indexPath.row == MINEINFOEDIT_PHOTO){
  382. return YOUPAIMineInfoPhotoCell.cellheight;
  383. }
  384. else if (indexPath.row == MINEINFOEDIT_VIDEO){
  385. return YOUPAIMineInfoVideoCell.cellheight;
  386. }
  387. else if (indexPath.row == MINEINFOEDIT_INTRODUCE){
  388. return 77.5;
  389. }
  390. else if (indexPath.row == MINEINFOEDIT_LABEL){
  391. return 77.5;
  392. }
  393. else{
  394. return 54;
  395. }
  396. }
  397. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  398. if (indexPath.row == MINEINFOEDIT_PROGRESS){
  399. }
  400. else if(indexPath.row ==MINEINFOEDIT_HEAD){ // 头像
  401. [self youpaifSelectAvatar];
  402. }
  403. else if(indexPath.row ==MINEINFOEDIT_NICKNAME){ // 昵称
  404. YOUPAILCUpdateNickVC* nickVC = [[YOUPAILCUpdateNickVC alloc]init];
  405. nickVC.youpaipnickName = [LCSaveModel getUserModel].youpaipuserinfo.youpaipnickname;
  406. @weakify(self);
  407. nickVC.youpaipblock = ^(NSString *nickname) {
  408. @strongify(self);
  409. self.youpaipRequestData.youpaipnickname = nickname;
  410. [self.tableView reloadData];
  411. };
  412. [self.navigationController pushViewController:nickVC animated:YES];
  413. }
  414. else if(indexPath.row ==MINEINFOEDIT_VOICE){ // 声音展示
  415. YOUPAILZBigCastAudioSetVC *vc = [[YOUPAILZBigCastAudioSetVC alloc] init];
  416. @weakify(self);
  417. [vc setSuccessBlock:^(NSString * _Nonnull mp3, NSInteger mp3_second) {
  418. @strongify(self);
  419. self.youpaipRequestData.youpaipvoice = mp3;
  420. self.youpaipRequestData.youpaipvoice_time = mp3_second;
  421. [self.tableView reloadData];
  422. }];
  423. [self.navigationController pushViewController:vc animated:YES];
  424. }
  425. else if(indexPath.row ==MINEINFOEDIT_BRIIRTHDAY){ // 生日
  426. [self youpaifSelectBirthday];
  427. }
  428. else if(indexPath.row ==MINEINFOEDIT_ADDRESS){ // 所在地
  429. YOUPAILCUpdateCityVC* cityVC = [[YOUPAILCUpdateCityVC alloc]init];
  430. cityVC.youpaipcityName = [LCSaveModel getUserModel].youpaipuserinfo.youpaipcity;
  431. @weakify(self);
  432. cityVC.youpaipblock = ^(NSString *cityName) {
  433. @strongify(self);
  434. self.youpaipRequestData.youpaipcityId = cityName;
  435. [self.tableView reloadData];
  436. };
  437. [self.navigationController pushViewController:cityVC animated:YES];
  438. }
  439. else if(indexPath.row ==MINEINFOEDIT_HEIGHT){ // 身高
  440. YOUPAIPickerSelectValueVC *vc = [YOUPAIPickerSelectValueVC new];
  441. vc.dataSouce = [self.selectData objectForKey:@"height"];
  442. @weakify(self);
  443. [vc setDidFinishSelectBlock:^(NSString * _Nonnull value) {
  444. @strongify(self);
  445. self.youpaipRequestData.youpaipheight = value;
  446. [self.tableView reloadData];
  447. }];
  448. [self TFPresentVC:vc completion:nil];
  449. }
  450. else if(indexPath.row == MINEINFOEDIT_WEIGHT){ // 身高
  451. YOUPAIPickerSelectValueVC *vc = [YOUPAIPickerSelectValueVC new];
  452. vc.dataSouce = [self.selectData objectForKey:@"weight"];
  453. @weakify(self);
  454. [vc setDidFinishSelectBlock:^(NSString * _Nonnull value) {
  455. @strongify(self);
  456. self.youpaipRequestData.youpaipweight = value;
  457. [self.tableView reloadData];
  458. }];
  459. [self TFPresentVC:vc completion:nil];
  460. }
  461. else if(indexPath.row ==MINEINFOEDIT_PROFESSINON){ // 职业
  462. [self youpaifSelectOccupation];
  463. }
  464. // else if(indexPath.row ==MINEINFOEDIT_INCOME){ // 年收入
  465. //
  466. // YOUPAIPickerSelectValueVC *vc = [YOUPAIPickerSelectValueVC new];
  467. // vc.dataSouce = [_selectData objectForKey:@"annual_income"];
  468. // @weakify(self);
  469. // [vc setDidFinishSelectBlock:^(NSString * _Nonnull value) {
  470. // @strongify(self);
  471. // self.youpaipRequestData.youpaipannual_income = value;
  472. // [self.tableView reloadData];
  473. // }];
  474. // [self TFPresentVC:vc completion:nil];
  475. //
  476. // }
  477. // else if(indexPath.row ==MINEINFOEDIT_EDUCATION){ // 学历
  478. // YOUPAIPickerSelectValueVC *vc = [YOUPAIPickerSelectValueVC new];
  479. // vc.dataSouce = [_selectData objectForKey:@"education"];
  480. // @weakify(self);
  481. // [vc setDidFinishSelectBlock:^(NSString * _Nonnull value) {
  482. // @strongify(self);
  483. // self.youpaipRequestData.youpaipeducation = value;
  484. // [self.tableView reloadData];
  485. // }];
  486. // [self TFPresentVC:vc completion:nil];
  487. //
  488. //
  489. // }
  490. // else if(indexPath.row ==MINEINFOEDIT_MARITAL){ // 婚姻
  491. // YOUPAIPickerSelectValueVC *vc = [YOUPAIPickerSelectValueVC new];
  492. // vc.dataSouce = [_selectData objectForKey:@"is_marriage"];
  493. // @weakify(self);
  494. // [vc setDidFinishSelectBlock:^(NSString * _Nonnull value) {
  495. // @strongify(self);
  496. // self.youpaipRequestData.youpaipis_marriage = value;
  497. // [self.tableView reloadData];
  498. // }];
  499. // [self TFPresentVC:vc completion:nil];
  500. //
  501. // }
  502. else if(indexPath.row ==MINEINFOEDIT_INTRODUCE){ // 自我介绍
  503. YOUPAILZUpdateSignVC* signVC = [[YOUPAILZUpdateSignVC alloc]init];
  504. signVC.youpaipsign = self.youpaipRequestData.youpaipsignature;
  505. signVC.youpaipblock = ^(NSString *sign) {
  506. self.youpaipRequestData.youpaipsignature= sign;
  507. [self.tableView reloadData];
  508. };
  509. [self.navigationController pushViewController:signVC animated:YES];
  510. }
  511. else if(indexPath.row ==MINEINFOEDIT_LABEL){ // 个人标签
  512. YOUPAIMineLabelEditVC *vc = [YOUPAIMineLabelEditVC new];
  513. [vc setDidFinishSaveBlock:^(NSArray * _Nonnull value) {
  514. self.youpaipRequestData.youpaiplabel = value;
  515. [self.tableView reloadData];
  516. }];
  517. [self.navigationController pushViewController:vc animated:YES];
  518. }else{
  519. }
  520. }
  521. @end
  522. @implementation MSYMineinfoEditVC(MineInfoPhoto)
  523. -(void)youpaifupdateImage:(NSInteger)row{
  524. @weakify(self);
  525. [self youpaifUploadImgType:@"album"
  526. configTZ:nil
  527. uploadBlock:nil
  528. fineshBlock:^(NSArray * _Nonnull imgurls, NSError * _Nonnull error) {
  529. @strongify(self);
  530. if (row < self.youpaipRequestData.youpaipalbums.count){
  531. // 替换
  532. [self.youpaipRequestData.youpaipalbums replaceObjectAtIndex:row withObject:imgurls.firstObject];
  533. }else{
  534. // 新增
  535. [self.youpaipRequestData.youpaipalbums addObjectsFromArray:imgurls];
  536. }
  537. [self.tableView reloadData];
  538. }];
  539. }
  540. // MARK: YOUPAIMineInfoPhotoCellDelegate
  541. -(void)mineInfoPhotoCellhandle:(YOUPAIMineInfoPhotoCell *)cell indexpath:(NSIndexPath *)indexPath{
  542. if (indexPath.row < self.youpaipRequestData.youpaipalbums.count){
  543. [self youapifScanAlbums:indexPath.row];
  544. }else{
  545. [self youpaifupdateImage:indexPath.row];
  546. }
  547. }
  548. @end
  549. // MARK: 头像
  550. @implementation MSYMineinfoEditVC(avatar)
  551. -(void)youpaifSelectAvatar{
  552. // if (![LCTools isRealNameAuthentication]){
  553. // return;
  554. // }
  555. @weakify(self);
  556. [self youpaifUploadImgType:@"album"
  557. configTZ:nil
  558. uploadBlock:nil
  559. fineshBlock:^(NSArray * _Nonnull imgurls, NSError * _Nonnull error) {
  560. @strongify(self);
  561. [self youpaifcompareFacesAvatar:imgurls.firstObject];
  562. }];
  563. }
  564. // 头像验证
  565. -(void)youpaifcompareFacesAvatar:(NSString*)url{
  566. @weakify(self);
  567. self.youpaipCompareAvatar = -1;
  568. // 如果是男用户,无需比对
  569. if (self.youpaipshowModel.youpaipgender != 1){
  570. self.youpaipRequestData.youpaipavatar = url;
  571. [self.tableView reloadData];
  572. return;
  573. }
  574. [LCHttpHelper requestWithURLString:api_compareFacesAvatar parameters:@{@"avatar":url} needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
  575. @strongify(self);
  576. NSDictionary* dict = (NSDictionary*)responseObject;
  577. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  578. NSString* msg = [dict objectForKey:@"message"];
  579. self.youpaipCompareAvatar = code;
  580. switch (code) {
  581. case 0: // 认证通过
  582. self.youpaipRequestData.youpaipavatar = url;
  583. [self.tableView reloadData];
  584. break;
  585. case 1006: // 识别失败
  586. self.youpaipRequestData.youpaipavatar = url;
  587. [self.tableView reloadData];
  588. [self youpaifAlertCompareFacesAvatar];
  589. break;
  590. case 1007: // 请先认证
  591. [self youpaifAlertGoCompareAvatar];
  592. break;
  593. default:
  594. [ZCHUDHelper showTitle:msg];
  595. break;
  596. }
  597. } failure:^(NSError *error) {
  598. [ZCHUDHelper showTitle:@"头像识别失败"];
  599. }];
  600. }
  601. // 去认证 提示框
  602. -(void)youpaifAlertGoCompareAvatar{
  603. @weakify(self);
  604. LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
  605. @strongify(self);
  606. self.youpaipCompareAvatar = -1;//
  607. self.youpaipRequestData.youpaipavatar = self.youpaipshowModel.youpaipavatar;
  608. [self.tableView reloadData];
  609. }];
  610. cancelAction.cornerRadius = 24;
  611. cancelAction.bgColor = LZF5F4F7Color;
  612. cancelAction.color = LZ273145Color;
  613. LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"去认证" handler:^(LZAlertAction *action) {
  614. @strongify(self);
  615. // 将头像重置到原来url
  616. self.youpaipRequestData.youpaipavatar = self.youpaipshowModel.youpaipavatar;
  617. [self.tableView reloadData];
  618. [LCTools youpaifrealNameAuthentication];
  619. }];
  620. confimAction.cornerRadius = 24.0f;
  621. confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 108.0f)/2, 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
  622. LZAlertWindow *alert = [LZAlertWindow alertWithTitle:nil content:@"为保证头像真实性,需要认证后才可以上传头像(认证还有新手奖励哦)" action:@[cancelAction,confimAction]];
  623. alert.contentTextAlignment = NSTextAlignmentCenter;
  624. [self TFPresentVC:alert completion:^{}];
  625. }
  626. // 人工认证提示框
  627. -(void)youpaifAlertCompareFacesAvatar{
  628. @weakify(self);
  629. LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) {
  630. @strongify(self);
  631. self.youpaipCompareAvatar = -1;//
  632. self.youpaipRequestData.youpaipavatar = self.youpaipshowModel.youpaipavatar;
  633. [self.tableView reloadData];
  634. }];
  635. cancelAction.cornerRadius = 24;
  636. cancelAction.bgColor = LZF5F4F7Color;
  637. cancelAction.color = LZ273145Color;
  638. LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"重新上传" handler:^(LZAlertAction *action) {
  639. @strongify(self);
  640. // 将头像重置到原来url
  641. self.youpaipRequestData.youpaipavatar = self.youpaipshowModel.youpaipavatar;
  642. [self.tableView reloadData];
  643. [self youpaifSelectAvatar];
  644. }];
  645. confimAction.cornerRadius = 24.0f;
  646. confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 130.0f), 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
  647. LZAlertAction *compare = [LZAlertAction actionWithTitle:@"提交人工审核" handler:^(LZAlertAction *action) {
  648. self.youpaipCompareAvatar = 2;// 人工审核
  649. }];
  650. compare.cornerRadius = 24.0f;
  651. compare.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 130.0f), 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
  652. LZAlertWindow *alert = [LZAlertWindow alertWithTitle:nil content:@"上次的头像与你的认证面容对比不通过,你可以重新上传或提交人工审核" action:@[compare,confimAction,cancelAction]];
  653. alert.contentTextAlignment = NSTextAlignmentCenter;
  654. [self TFPresentVC:alert completion:^{}];
  655. }
  656. @end
  657. // MARK: 生日
  658. @implementation MSYMineinfoEditVC(Birthday)
  659. -(void)youpaifSelectBirthday{
  660. YOUPAISelectBirthdayPickVC *vc = [YOUPAISelectBirthdayPickVC new];
  661. vc.delegate = self;
  662. [self TFPresentVC:vc completion:nil];
  663. }
  664. - (void)didSelectBirthday:(nonnull YOUPAISelectBirthdayPickVC *)vc birthday:(nonnull NSDateComponents *)birthday {
  665. NSInteger year=[birthday year];
  666. NSInteger month=[birthday month];
  667. NSInteger day=[birthday day];
  668. NSString *birthdayStr = [NSString stringWithFormat:@"%ld-%ld-%ld",year,month,day];
  669. _youpaipRequestData.youpaipbirthday = birthdayStr;
  670. [_tableView reloadData];
  671. }
  672. @end
  673. // MARK: 年收入
  674. @implementation MSYMineinfoEditVC(incom)
  675. @end
  676. // MARK: 职业
  677. @implementation MSYMineinfoEditVC(Occupation)
  678. -(void)youpaifSelectOccupation{
  679. YOUPAISelectOccupationVC *vc = [YOUPAISelectOccupationVC new];
  680. vc.dataSouce = [_selectData objectForKey:@"occupation"];
  681. vc.delegate = self;
  682. [self TFPresentVC:vc completion:nil];
  683. }
  684. - (void)didSelectOccupation:(YOUPAISelectOccupationVC *)vc occupation:(NSString *)occupation{
  685. _youpaipRequestData.youpaipoccupation = occupation;
  686. [_tableView reloadData];
  687. }
  688. @end
  689. //MARK: 视频
  690. @implementation MSYMineinfoEditVC(Video)
  691. -(void)mineInfoVideoCellhandle:(YOUPAIMineInfoVideoCell *)cell{
  692. if (_youpaipRequestData.youpaipvideo.length>0){
  693. [self youapifScanVideo];
  694. return;
  695. }else{
  696. [self youpaifselectVideo];
  697. }
  698. }
  699. -(void)youpaifselectVideo{
  700. @weakify(self);
  701. [self youpaifTZSelectVideo:nil didSelect:^(UIImage * _Nullable coverImage, AVURLAsset * _Nullable asset, NSError * _Nullable error) {
  702. @strongify(self);
  703. if(error){
  704. [ZCHUDHelper showTitle:error.localizedDescription];
  705. return;
  706. }
  707. // 视频时长
  708. CMTime time = [asset duration];
  709. int seconds = ceil(time.value/time.timescale);
  710. seconds = MIN(seconds, 15);
  711. [ZCHUDHelper showWithStatus:@"正在裁剪..."];
  712. [self youpaifCutVideo:asset start:0 end:seconds completion:^(NSURL * outputURL, Float64 videoDuration, NSError * error) {
  713. @strongify(self);
  714. if(error){
  715. [ZCHUDHelper showTitle:error.localizedDescription];
  716. return;
  717. }
  718. [ZCHUDHelper showTitle:@"裁剪完成"];
  719. [self updateVideo:outputURL coverImage:coverImage];
  720. }];
  721. }];
  722. }
  723. -(void)updateVideo:(NSURL*)path coverImage:(UIImage*) coverImage{
  724. NSString *urlstr = path.resourceSpecifier;
  725. [ZCHUDHelper showWithStatus:@"正在上传..."];
  726. @weakify(self);
  727. [LCCommonHttp uploadWithVideoPath:urlstr Type:@"album" successBlock:^(NSString *ossFilePath) {
  728. @strongify(self);
  729. self.youpaipRequestData.youpaipvideo = ossFilePath;
  730. [ZCHUDHelper showTitle:@"上传完成"];
  731. [self.tableView reloadData];
  732. }];
  733. }
  734. @end
  735. // 查看视频/图片
  736. @implementation MSYMineinfoEditVC(ScanImagevideo)
  737. -(void)youapifScanAlbums:(NSInteger)index{
  738. YBImageBrowser *browser = [YBImageBrowser new];
  739. browser.shouldHideStatusBar = false;
  740. browser.tag = 0;
  741. browser.dataSource = self;
  742. browser.currentPage = index;
  743. [browser.defaultToolViewHandler.topView.operationButton setHidden:false];
  744. [browser.defaultToolViewHandler.topView.operationButton setTitle:@"删除" forState:UIControlStateNormal];
  745. [browser.defaultToolViewHandler.topView.operationButton setImage:NULL forState:UIControlStateNormal];
  746. @weakify(self);
  747. [browser.defaultToolViewHandler.topView setClickOperation:^(YBIBTopViewOperationType type) {
  748. @strongify(self);
  749. NSInteger row = browser.currentPage;
  750. [self.youpaipRequestData.youpaipalbums removeObjectAtIndex:row];
  751. [self.tableView reloadData];
  752. [browser hide];
  753. }];
  754. [browser show];
  755. }
  756. -(void)youapifScanVideo{
  757. YBImageBrowser *browser = [YBImageBrowser new];
  758. browser.tag = 1;
  759. browser.dataSource = self;
  760. browser.currentPage = 0;
  761. [browser.defaultToolViewHandler.topView.operationButton setHidden:false];
  762. [browser show];
  763. [browser.defaultToolViewHandler.topView.operationButton setHidden:false];
  764. [browser.defaultToolViewHandler.topView.operationButton setTitle:@"删除" forState:UIControlStateNormal];
  765. [browser.defaultToolViewHandler.topView.operationButton setImage:NULL forState:UIControlStateNormal];
  766. @weakify(self);
  767. [browser.defaultToolViewHandler.topView setClickOperation:^(YBIBTopViewOperationType type) {
  768. @strongify(self);
  769. self.youpaipRequestData.youpaipvideo = @"";
  770. [self.tableView reloadData];
  771. [browser hide];
  772. }];
  773. }
  774. // 实现 <YBImageBrowserDataSource> 协议方法配置数据源
  775. - (NSInteger)yb_numberOfCellsInImageBrowser:(YBImageBrowser *)imageBrowser{
  776. NSInteger tag = imageBrowser.tag;
  777. if (tag == 0){
  778. return self.youpaipRequestData.youpaipalbums.count;
  779. }else{
  780. return 1;
  781. }
  782. }
  783. - (id<YBIBDataProtocol>)yb_imageBrowser:(YBImageBrowser *)imageBrowser dataForCellAtIndex:(NSInteger)index{
  784. NSInteger tag = imageBrowser.tag;
  785. if (tag == 0){
  786. YOUPAIMineInfoScanImageData *data = [YOUPAIMineInfoScanImageData new];
  787. NSURL *url = [LCTools getImageUrlWithAddress:self.youpaipRequestData.youpaipalbums[index]];
  788. data.imageURL = url;
  789. // data.sourceObject = ...;
  790. return data;
  791. }else{
  792. YBIBVideoData *data = [YBIBVideoData new];
  793. data.videoURL = [LCTools getImageUrlWithAddress:self.youpaipRequestData.youpaipvideo];
  794. return data;
  795. }
  796. }
  797. @end
  798. @implementation MSYMineinfoEditVC (API)
  799. -(void)youpaifreloadRequestData{
  800. if (self.youpaipshowModel == nil){
  801. return;
  802. }
  803. // birthday:生日
  804. _youpaipRequestData.youpaipbirthday = _youpaipshowModel.youpaipBasicInfoDetail.youpaipbirthday;
  805. // height:升高
  806. _youpaipRequestData.youpaipheight = _youpaipshowModel.youpaipBasicInfoDetail.youpaipheight;
  807. // weight:体重
  808. _youpaipRequestData.youpaipweight = _youpaipshowModel.youpaipBasicInfoDetail.youpaipweight;
  809. // occupation:职业
  810. _youpaipRequestData.youpaipoccupation = _youpaipshowModel.youpaipBasicInfoDetail.youpaipoccupation;
  811. // cityId:城市id
  812. _youpaipRequestData.youpaipcityId = _youpaipshowModel.youpaipBasicInfoDetail.youpaipcity;
  813. // annual_income:收入
  814. _youpaipRequestData.youpaipannual_income = _youpaipshowModel.youpaipBasicInfoDetail.youpaipannual_income;
  815. // education:教育
  816. _youpaipRequestData.youpaipeducation = _youpaipshowModel.youpaipBasicInfoDetail.youpaipeducation;
  817. // is_marriage:婚姻状态
  818. _youpaipRequestData.youpaipis_marriage = _youpaipshowModel.youpaipBasicInfoDetail.youpaipis_marriage;
  819. // label:标签
  820. _youpaipRequestData.youpaiplabel = _youpaipshowModel.youpaiplabel_list;
  821. // avatar:头像
  822. _youpaipRequestData.youpaipavatar = _youpaipshowModel.youpaipavatar;
  823. // nickname:昵称
  824. _youpaipRequestData.youpaipnickname = _youpaipshowModel.youpaipnickname;
  825. // albums:视频
  826. _youpaipRequestData.youpaipvideo = _youpaipshowModel.youpaipvideo;
  827. // albums:相册
  828. [_youpaipRequestData.youpaipalbums removeAllObjects];
  829. for (YOUPAIAlbumModel *item in _youpaipshowModel.youpaipalbums_list) {
  830. if (item.youpaipis_video){
  831. }else{
  832. [_youpaipRequestData.youpaipalbums addObject:item.youpaipurl];
  833. }
  834. }
  835. // sign 签名
  836. if ([_youpaipshowModel.youpaipsign isEqualToString:@"这个人很懒,什么都没有留下…"]){
  837. _youpaipRequestData.youpaipsignature = @"";
  838. }else{
  839. _youpaipRequestData.youpaipsignature = _youpaipshowModel.youpaipsign;
  840. }
  841. // voice 语音
  842. _youpaipRequestData.youpaipvoice = _youpaipshowModel.youpaipvoice.youpaipvoice;
  843. // voice_time:语音时长
  844. _youpaipRequestData.youpaipvoice_time = _youpaipshowModel.youpaipvoice.youpaipvoice_time;
  845. // 视频
  846. // _youpaipRequestData.youpaipvideo = _youpaipshowModel.youpaipvideo_status;
  847. [self.tableView reloadData];
  848. }
  849. -(void)youpaifAPIloadUserInfo{
  850. NSDictionary *params = @{
  851. @"user_id":[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id
  852. };
  853. @weakify(self);
  854. [self.tableView setHidden:true];
  855. [LCHttpHelper requestWithURLString:GetUserInfo
  856. parameters:params
  857. needToken:YES
  858. type:(HttpRequestTypePost)
  859. success:^(id responseObject) {
  860. @strongify(self);
  861. [self.tableView setHidden:false];
  862. NSDictionary* dict = (NSDictionary*)responseObject;
  863. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  864. if (code==0) {//成功
  865. self.youpaipshowModel = [YOUPAILCUserShowModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
  866. [self youpaifreloadRequestData];
  867. }
  868. } failure:^(NSError *error) {
  869. [self.view setAlpha:1];
  870. [ZCHUDHelper showTitle:error.localizedDescription];
  871. }];
  872. }
  873. -(void)youpaifAPIEditUserInfo{
  874. NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithDictionary: @{}];
  875. // 如果已经认证通过,无需提交头像
  876. if (self.youpaipCompareAvatar == 0
  877. ){
  878. [params removeObjectForKey:@"avatar"];
  879. }
  880. // 生日
  881. if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipbirthday isEqualToString:_youpaipRequestData.youpaipbirthday]){
  882. params[@"birthday"] = _youpaipRequestData.youpaipbirthday;
  883. }
  884. // 身高
  885. if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipheight isEqualToString:_youpaipRequestData.youpaipheight]){
  886. params[@"height"] = _youpaipRequestData.youpaipheight;
  887. }
  888. // 体重
  889. if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipweight isEqualToString:_youpaipRequestData.youpaipweight]){
  890. params[@"weight"] = _youpaipRequestData.youpaipweight;
  891. }
  892. // 城市
  893. if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipcity isEqualToString:_youpaipRequestData.youpaipcityId]){
  894. params[@"cityId"] = _youpaipRequestData.youpaipcityId;
  895. }
  896. // 职业
  897. if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipoccupation isEqualToString:_youpaipRequestData.youpaipoccupation]){
  898. params[@"occupation"] = _youpaipRequestData.youpaipoccupation;
  899. }
  900. // 收入
  901. if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipannual_income isEqualToString:_youpaipRequestData.youpaipannual_income]){
  902. params[@"annual_income"] = _youpaipRequestData.youpaipannual_income;
  903. }
  904. // 学历
  905. if (![ _youpaipshowModel.youpaipBasicInfoDetail.youpaipeducation isEqualToString:_youpaipRequestData.youpaipeducation]){
  906. params[@"education"] = _youpaipRequestData.youpaipeducation;
  907. }
  908. // 婚姻
  909. if (![_youpaipshowModel.youpaipBasicInfoDetail.youpaipis_marriage isEqualToString:_youpaipRequestData.youpaipis_marriage]){
  910. params[@"is_marriage"] = _youpaipRequestData.youpaipis_marriage;
  911. }
  912. // 标签
  913. NSMutableArray *names = [NSMutableArray new];
  914. for (YOUPAIZYLabelModel *item in _youpaipRequestData.youpaiplabel) {
  915. [names addObject:item.youpaiptag_id];
  916. }
  917. NSString *newname = [names componentsJoinedByString:@","];
  918. NSMutableArray *names2 = [NSMutableArray new];
  919. for (YOUPAIZYLabelModel *item in _youpaipshowModel.youpaiplabel_list) {
  920. [names2 addObject:item.youpaiptag_id];
  921. }
  922. NSString *oldnames = [names2 componentsJoinedByString:@","];
  923. if (![newname isEqualToString:oldnames]){
  924. params[@"label"] = newname;
  925. }
  926. // 头像
  927. if (![_youpaipshowModel.youpaipavatar isEqualToString:_youpaipRequestData.youpaipavatar]){
  928. params[@"avatar"] = _youpaipRequestData.youpaipavatar;
  929. }
  930. // 昵称
  931. if (![_youpaipshowModel.youpaipnickname isEqualToString:_youpaipRequestData.youpaipnickname]){
  932. params[@"nickname"] = _youpaipRequestData.youpaipnickname;
  933. }
  934. // 签名
  935. if (![_youpaipshowModel.youpaipsign isEqualToString:_youpaipRequestData.youpaipsignature] &&
  936. ![_youpaipRequestData.youpaipsignature isEqualToString:@""]){
  937. params[@"signature"] = _youpaipRequestData.youpaipsignature;
  938. }
  939. // 语音
  940. if (![_youpaipshowModel.youpaipvoice.youpaipvoice isEqualToString:_youpaipRequestData.youpaipvoice] &&
  941. _youpaipRequestData.youpaipvoice != nil){
  942. params[@"voice"] = _youpaipRequestData.youpaipvoice;
  943. params[@"voice_time"] = @([_youpaipRequestData youpaipvoice_time]);
  944. }
  945. // 视频
  946. if (![_youpaipshowModel.youpaipvideo isEqualToString:_youpaipRequestData.youpaipvideo]){
  947. params[@"video"] = _youpaipRequestData.youpaipvideo;
  948. }
  949. // 相册
  950. NSString *newal = [_youpaipRequestData.youpaipalbums componentsJoinedByString:@","];
  951. NSMutableArray *olds = [NSMutableArray new];
  952. for (YOUPAIAlbumModel *item in _youpaipshowModel.youpaipalbums_list) {
  953. if (item.youpaipis_video){
  954. }else{
  955. [olds addObject:item.youpaipurl];
  956. }
  957. }
  958. NSString *oldalbums = [olds componentsJoinedByString:@","];
  959. if (![newal isEqualToString:oldalbums]){
  960. params[@"albums"] = newal;
  961. }
  962. @weakify(self);
  963. [LCHttpHelper requestWithURLString:api_Improve_data
  964. parameters:params
  965. needToken:YES
  966. type:(HttpRequestTypePost)
  967. success:^(id responseObject) {
  968. @strongify(self);
  969. NSDictionary* dict = (NSDictionary*)responseObject;
  970. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  971. if (code==0) {//成功
  972. [ZCHUDHelper showTitle:@"提交成功"];
  973. [self.navigationController popViewControllerAnimated:false];
  974. }
  975. } failure:^(NSError *error) {
  976. [ZCHUDHelper showTitle:error.localizedDescription];
  977. }];
  978. }
  979. -(void)youpaifgetSelectData{
  980. @weakify(self);
  981. NSDictionary *params = @{};
  982. [LCHttpHelper requestWithURLString:api_getSelectData
  983. parameters:params
  984. needToken:YES
  985. type:(HttpRequestTypePost)
  986. success:^(id responseObject) {
  987. @strongify(self);
  988. [self.view setAlpha:1];
  989. NSDictionary* dict = (NSDictionary*)responseObject;
  990. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  991. if (code==0) {//成功
  992. self.selectData = [dict objectForKey:@"data"] ;
  993. }
  994. } failure:^(NSError *error) {
  995. [ZCHUDHelper showTitle:error.localizedDescription];
  996. }];
  997. }
  998. @end