Commit 490ef8f1a1fd9f99b178be9a2f3f333b3669074b

Authored by “张旭”
1 parent 93a65866

数字简历页-显示全部工作记录 数字简历页-一个工作记录区块

metaCode.xcodeproj/project.pbxproj
@@ -167,6 +167,7 @@ @@ -167,6 +167,7 @@
167 19B153CF2BC540FF0018906C /* CNLivePayOrderInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153CE2BC540FF0018906C /* CNLivePayOrderInfoModel.swift */; }; 167 19B153CF2BC540FF0018906C /* CNLivePayOrderInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153CE2BC540FF0018906C /* CNLivePayOrderInfoModel.swift */; };
168 19B153D22BC623980018906C /* CNLiveShopPayNeedPaymentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153D12BC623980018906C /* CNLiveShopPayNeedPaymentCell.swift */; }; 168 19B153D22BC623980018906C /* CNLiveShopPayNeedPaymentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153D12BC623980018906C /* CNLiveShopPayNeedPaymentCell.swift */; };
169 19B153D42BC623BE0018906C /* CNLiveShopPayWeChatAlipayCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153D32BC623BE0018906C /* CNLiveShopPayWeChatAlipayCell.swift */; }; 169 19B153D42BC623BE0018906C /* CNLiveShopPayWeChatAlipayCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153D32BC623BE0018906C /* CNLiveShopPayWeChatAlipayCell.swift */; };
  170 + 19BAF0342C7831DB00BD7CC0 /* CNLiveDigitalResumePreviewFourWorkAwardCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BAF0332C7831DB00BD7CC0 /* CNLiveDigitalResumePreviewFourWorkAwardCell.swift */; };
170 19BB1FDF2AEA3A450094D962 /* CNSlideBaseNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */; }; 171 19BB1FDF2AEA3A450094D962 /* CNSlideBaseNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */; };
171 19BB1FE12AEB5C220094D962 /* CNLiveShopConsoleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */; }; 172 19BB1FE12AEB5C220094D962 /* CNLiveShopConsoleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */; };
172 19BB1FE32AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */; }; 173 19BB1FE32AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */; };
@@ -518,6 +519,7 @@ @@ -518,6 +519,7 @@
518 19B153CE2BC540FF0018906C /* CNLivePayOrderInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLivePayOrderInfoModel.swift; sourceTree = "<group>"; }; 519 19B153CE2BC540FF0018906C /* CNLivePayOrderInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLivePayOrderInfoModel.swift; sourceTree = "<group>"; };
519 19B153D12BC623980018906C /* CNLiveShopPayNeedPaymentCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopPayNeedPaymentCell.swift; sourceTree = "<group>"; }; 520 19B153D12BC623980018906C /* CNLiveShopPayNeedPaymentCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopPayNeedPaymentCell.swift; sourceTree = "<group>"; };
520 19B153D32BC623BE0018906C /* CNLiveShopPayWeChatAlipayCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopPayWeChatAlipayCell.swift; sourceTree = "<group>"; }; 521 19B153D32BC623BE0018906C /* CNLiveShopPayWeChatAlipayCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopPayWeChatAlipayCell.swift; sourceTree = "<group>"; };
  522 + 19BAF0332C7831DB00BD7CC0 /* CNLiveDigitalResumePreviewFourWorkAwardCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDigitalResumePreviewFourWorkAwardCell.swift; sourceTree = "<group>"; };
521 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNSlideBaseNavigationController.swift; sourceTree = "<group>"; }; 523 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNSlideBaseNavigationController.swift; sourceTree = "<group>"; };
522 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleController.swift; sourceTree = "<group>"; }; 524 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleController.swift; sourceTree = "<group>"; };
523 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleViewModel.swift; sourceTree = "<group>"; }; 525 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleViewModel.swift; sourceTree = "<group>"; };
@@ -787,6 +789,7 @@ @@ -787,6 +789,7 @@
787 1909DCAA2C649C10001E7986 /* CNLiveDigitalResumePreViewSecCollectionCell.swift */, 789 1909DCAA2C649C10001E7986 /* CNLiveDigitalResumePreViewSecCollectionCell.swift */,
788 1909DCA12C637353001E7986 /* CNLiveDigitalResumePreviewThreeCell.swift */, 790 1909DCA12C637353001E7986 /* CNLiveDigitalResumePreviewThreeCell.swift */,
789 1909DCA42C63736C001E7986 /* CNLiveDigitalResumePreviewFourCell.swift */, 791 1909DCA42C63736C001E7986 /* CNLiveDigitalResumePreviewFourCell.swift */,
  792 + 19BAF0332C7831DB00BD7CC0 /* CNLiveDigitalResumePreviewFourWorkAwardCell.swift */,
790 1909DCA62C637378001E7986 /* CNLiveDigitalResumePreviewFiveCell.swift */, 793 1909DCA62C637378001E7986 /* CNLiveDigitalResumePreviewFiveCell.swift */,
791 1909DCA82C63738C001E7986 /* CNLiveDigitalResumePreviewSixCell.swift */, 794 1909DCA82C63738C001E7986 /* CNLiveDigitalResumePreviewSixCell.swift */,
792 ); 795 );
@@ -2188,6 +2191,7 @@ @@ -2188,6 +2191,7 @@
2188 191732EF2B075C3A007BCC04 /* CNLiveCreateShopClassifyViewController.swift in Sources */, 2191 191732EF2B075C3A007BCC04 /* CNLiveCreateShopClassifyViewController.swift in Sources */,
2189 1938BD302B4B8A3500390A34 /* CNLiveHomePageViewModel.swift in Sources */, 2192 1938BD302B4B8A3500390A34 /* CNLiveHomePageViewModel.swift in Sources */,
2190 19C735CC2C11A1F400CACF4E /* CNLiveDigitalThreeCollectCell.swift in Sources */, 2193 19C735CC2C11A1F400CACF4E /* CNLiveDigitalThreeCollectCell.swift in Sources */,
  2194 + 19BAF0342C7831DB00BD7CC0 /* CNLiveDigitalResumePreviewFourWorkAwardCell.swift in Sources */,
2191 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */, 2195 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */,
2192 799172382AF090CD00DC01A8 /* CNLiveShopBodyListView.swift in Sources */, 2196 799172382AF090CD00DC01A8 /* CNLiveShopBodyListView.swift in Sources */,
2193 19565ED42AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift in Sources */, 2197 19565ED42AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift in Sources */,
metaCode/Classes/Main/HomePage/Controller/DigitalAuth/数字简历相关页面/CNLiveDigitalResumePreViewController.swift
@@ -278,15 +278,15 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD @@ -278,15 +278,15 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD
278 }else{ 278 }else{
279 cell.zhengshuBtn.isHidden = true 279 cell.zhengshuBtn.isHidden = true
280 } 280 }
281 - var workModel:CNLiveVitaeWorksModel? = nil 281 + var workModel:[CNLiveVitaeWorksModel]? = nil
282 if self.resumeType == .normal{ 282 if self.resumeType == .normal{
283 - workModel = self.workDataArray[indexPath.row] as? CNLiveVitaeWorksModel 283 + workModel = self.workDataArray as? [CNLiveVitaeWorksModel]
284 }else{ 284 }else{
285 - workModel = self.workPreViewDataArray[indexPath.row] as? CNLiveVitaeWorksModel 285 + workModel = self.workPreViewDataArray as? [CNLiveVitaeWorksModel]
286 } 286 }
287 if let workMdl = workModel{ 287 if let workMdl = workModel{
288 - cell.workMdl = workMdl  
289 - cell.vitaePreviewWorkCellChangedBlock = { workCell,jianjieHeight,isExpand in 288 + cell.workMdls = workMdl
  289 + cell.vitaePreviewWorkCellChangedBlock = { index ,jianjieHeight,isExpand in
290 var res = self.workDataArray 290 var res = self.workDataArray
291 if self.resumeType == .normal{ 291 if self.resumeType == .normal{
292 res = self.workDataArray 292 res = self.workDataArray
@@ -294,9 +294,9 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD @@ -294,9 +294,9 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD
294 res = self.workPreViewDataArray 294 res = self.workPreViewDataArray
295 } 295 }
296 var tempArr = Array<Any>() 296 var tempArr = Array<Any>()
297 - let idxPath = tableView.indexPath(for: workCell) 297 +// let idxPath = tableView.indexPath(for: workCell)
298 for (idx,mdl) in res.enumerated() { 298 for (idx,mdl) in res.enumerated() {
299 - if idx == idxPath?.row{ 299 + if idx == index{
300 let layout = CNLiveViateWorkModelLayout(model: mdl as! CNLiveVitaeWorksModel,descH: Float(jianjieHeight),isPreview: true, isExpand: isExpand) 300 let layout = CNLiveViateWorkModelLayout(model: mdl as! CNLiveVitaeWorksModel,descH: Float(jianjieHeight),isPreview: true, isExpand: isExpand)
301 let newWorkModel = layout.getCellHModel() 301 let newWorkModel = layout.getCellHModel()
302 tempArr.append(newWorkModel) 302 tempArr.append(newWorkModel)
@@ -337,15 +337,15 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD @@ -337,15 +337,15 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD
337 }else{ 337 }else{
338 cell.zhengshuBtn.isHidden = true 338 cell.zhengshuBtn.isHidden = true
339 } 339 }
340 - var awardModel:CNLiveVitaeAwardsModel? 340 + var awardModels:[CNLiveVitaeAwardsModel]?
341 if self.resumeType == .normal{ 341 if self.resumeType == .normal{
342 - awardModel = self.awardDataArray[indexPath.row] as? CNLiveVitaeAwardsModel 342 + awardModels = self.awardDataArray as? [CNLiveVitaeAwardsModel]
343 }else{ 343 }else{
344 - awardModel = self.awardPreViewDataArray[indexPath.row] as? CNLiveVitaeAwardsModel 344 + awardModels = self.awardPreViewDataArray as? [CNLiveVitaeAwardsModel]
345 } 345 }
346 - if let awardMdl = awardModel{  
347 - cell.awardModel = awardMdl  
348 - cell.vitaePreviewWorkCellChangedBlock = { workCell,jianjieHeight ,isExpand in 346 + if let awardMdls = awardModels{
  347 + cell.awardModels = awardMdls
  348 + cell.vitaePreviewWorkCellChangedBlock = { index ,jianjieHeight,isExpand in
349 var res = self.awardDataArray 349 var res = self.awardDataArray
350 if self.resumeType == .normal{ 350 if self.resumeType == .normal{
351 res = self.awardDataArray 351 res = self.awardDataArray
@@ -353,9 +353,9 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD @@ -353,9 +353,9 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD
353 res = self.awardPreViewDataArray 353 res = self.awardPreViewDataArray
354 } 354 }
355 var tempArr = Array<Any>() 355 var tempArr = Array<Any>()
356 - let idxPath = tableView.indexPath(for: workCell) 356 +// let idxPath = tableView.indexPath(for: workCell)
357 for (idx,mdl) in res.enumerated() { 357 for (idx,mdl) in res.enumerated() {
358 - if idx == idxPath?.row{ 358 + if idx == index{
359 let layout = CNLiveViateAwardModelLayout(model: mdl as! CNLiveVitaeAwardsModel,descH: Float(jianjieHeight),isPreview: true, isExpand: isExpand) 359 let layout = CNLiveViateAwardModelLayout(model: mdl as! CNLiveVitaeAwardsModel,descH: Float(jianjieHeight),isPreview: true, isExpand: isExpand)
360 let newWorkModel = layout.getCellHModel() 360 let newWorkModel = layout.getCellHModel()
361 tempArr.append(newWorkModel) 361 tempArr.append(newWorkModel)
@@ -429,11 +429,23 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD @@ -429,11 +429,23 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD
429 if self.vitaeModel?.works.count ?? 0 > 0{ 429 if self.vitaeModel?.works.count ?? 0 > 0{
430 //有多个workcell 430 //有多个workcell
431 if self.resumeType == .normal{ 431 if self.resumeType == .normal{
432 - let model = self.workDataArray[indexPath.row] as! CNLiveVitaeWorksModel  
433 - return CGFloat(model.cellH) 432 + //计算cellheight
  433 + var cellH:Float = 58+54//顶部和底部
  434 + self.workDataArray.forEach { model in
  435 + let mdl = model as! CNLiveVitaeWorksModel
  436 + cellH = cellH + mdl.cellH
  437 + }
  438 + return CGFloat(cellH)+15
434 }else{ 439 }else{
435 - let model = self.workPreViewDataArray[indexPath.row] as! CNLiveVitaeWorksModel  
436 - return CGFloat(model.cellH) 440 + //计算cellheight
  441 + var cellH:Float = 58+54//顶部和底部
  442 + self.workPreViewDataArray.forEach { model in
  443 + let mdl = model as! CNLiveVitaeWorksModel
  444 + cellH = cellH + mdl.cellH
  445 + }
  446 + return CGFloat(cellH)+15
  447 +// let model = self.workPreViewDataArray[indexPath.row] as! CNLiveVitaeWorksModel
  448 +// return CGFloat(model.cellH)
437 } 449 }
438 }else{ 450 }else{
439 return DefaultPreViewCellHeight+15//396+15 451 return DefaultPreViewCellHeight+15//396+15
@@ -442,11 +454,25 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD @@ -442,11 +454,25 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD
442 if self.vitaeModel?.awards.count ?? 0 > 0{ 454 if self.vitaeModel?.awards.count ?? 0 > 0{
443 //有多个awardcell 455 //有多个awardcell
444 if self.resumeType == .normal{ 456 if self.resumeType == .normal{
445 - let model = self.awardDataArray[indexPath.row] as! CNLiveVitaeAwardsModel  
446 - return CGFloat(model.cellH) 457 +// let model = self.awardDataArray[indexPath.row] as! CNLiveVitaeAwardsModel
  458 +// return CGFloat(model.cellH)
  459 + //计算cellheight
  460 + var cellH:Float = 58+54//顶部和底部
  461 + self.awardDataArray.forEach { model in
  462 + let mdl = model as! CNLiveVitaeAwardsModel
  463 + cellH = cellH + mdl.cellH
  464 + }
  465 + return CGFloat(cellH)+15
447 }else{ 466 }else{
448 - let model = self.awardPreViewDataArray[indexPath.row] as! CNLiveVitaeAwardsModel  
449 - return CGFloat(model.cellH) 467 +// let model = self.awardPreViewDataArray[indexPath.row] as! CNLiveVitaeAwardsModel
  468 +// return CGFloat(model.cellH)
  469 + //计算cellheight
  470 + var cellH:Float = 58+54//顶部和底部
  471 + self.awardPreViewDataArray.forEach { model in
  472 + let mdl = model as! CNLiveVitaeAwardsModel
  473 + cellH = cellH + mdl.cellH
  474 + }
  475 + return CGFloat(cellH)+15
450 } 476 }
451 }else{ 477 }else{
452 return DefaultPreViewCellHeight+15//396+15 478 return DefaultPreViewCellHeight+15//396+15
@@ -531,53 +557,55 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD @@ -531,53 +557,55 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD
531 self.awardPreViewDataArray.removeAllObjects() 557 self.awardPreViewDataArray.removeAllObjects()
532 self.totalDataArray.addObjects(from: [CNLiveViatePreviewCellType.realName,CNLiveViatePreviewCellType.guanFang,CNLiveViatePreviewCellType.cer]) 558 self.totalDataArray.addObjects(from: [CNLiveViatePreviewCellType.realName,CNLiveViatePreviewCellType.guanFang,CNLiveViatePreviewCellType.cer])
533 self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.realName) 559 self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.realName)
534 - self.workPreViewDataArray.add(CNLiveViatePreviewCellType.realName)  
535 - self.awardPreViewDataArray.add(CNLiveViatePreviewCellType.realName) 560 +// self.workPreViewDataArray.add(CNLiveViatePreviewCellType.realName)
  561 +// self.awardPreViewDataArray.add(CNLiveViatePreviewCellType.realName)
536 562
537 if self.succDataArray.count > 0{ 563 if self.succDataArray.count > 0{
538 self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.guanFang) 564 self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.guanFang)
539 - self.workPreViewDataArray.add(CNLiveViatePreviewCellType.guanFang)  
540 - self.awardPreViewDataArray.add(CNLiveViatePreviewCellType.guanFang) 565 +// self.workPreViewDataArray.add(CNLiveViatePreviewCellType.guanFang)
  566 +// self.awardPreViewDataArray.add(CNLiveViatePreviewCellType.guanFang)
541 } 567 }
542 if self.threeCerDataArray.count > 0{ 568 if self.threeCerDataArray.count > 0{
543 self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.cer) 569 self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.cer)
544 - self.workPreViewDataArray.add(CNLiveViatePreviewCellType.cer)  
545 - self.awardPreViewDataArray.add(CNLiveViatePreviewCellType.cer) 570 +// self.workPreViewDataArray.add(CNLiveViatePreviewCellType.cer)
  571 +// self.awardPreViewDataArray.add(CNLiveViatePreviewCellType.cer)
546 } 572 }
547 - self.workDataArray.addObjects(from: [CNLiveViatePreviewCellType.realName,CNLiveViatePreviewCellType.guanFang,CNLiveViatePreviewCellType.cer])  
548 - self.awardDataArray.addObjects(from: [CNLiveViatePreviewCellType.realName,CNLiveViatePreviewCellType.guanFang,CNLiveViatePreviewCellType.cer])  
549 - for (_,mdl) in self.vitaeModel!.works.enumerated() {  
550 - self.totalDataArray.add(CNLiveViatePreviewCellType.work)  
551 - self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.work) 573 +// self.workDataArray.addObjects(from: [CNLiveViatePreviewCellType.realName,CNLiveViatePreviewCellType.guanFang,CNLiveViatePreviewCellType.cer])
  574 +// self.awardDataArray.addObjects(from: [CNLiveViatePreviewCellType.realName,CNLiveViatePreviewCellType.guanFang,CNLiveViatePreviewCellType.cer])
  575 + self.totalDataArray.add(CNLiveViatePreviewCellType.work)
  576 + self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.work)
552 577
  578 + for (_,mdl) in self.vitaeModel!.works.enumerated() {
  579 +// self.totalDataArray.add(CNLiveViatePreviewCellType.work)
  580 +// self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.work)
553 let layout = CNLiveViateWorkModelLayout(model: mdl ,descH: Float(40.0),isPreview: true, isExpand: false) 581 let layout = CNLiveViateWorkModelLayout(model: mdl ,descH: Float(40.0),isPreview: true, isExpand: false)
554 let newWorkModel = layout.getCellHModel() 582 let newWorkModel = layout.getCellHModel()
555 self.workDataArray.add(newWorkModel) 583 self.workDataArray.add(newWorkModel)
556 - self.awardDataArray.add(CNLiveViatePreviewCellType.work) 584 +// self.awardDataArray.add(CNLiveViatePreviewCellType.work)
557 self.workPreViewDataArray.add(newWorkModel) 585 self.workPreViewDataArray.add(newWorkModel)
558 - self.awardPreViewDataArray.add(CNLiveViatePreviewCellType.work) 586 +// self.awardPreViewDataArray.add(CNLiveViatePreviewCellType.work)
559 } 587 }
560 if self.vitaeModel!.vitae!.showAwards == true{ 588 if self.vitaeModel!.vitae!.showAwards == true{
  589 + self.totalDataArray.add(CNLiveViatePreviewCellType.award)
  590 + self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.award)
561 for (_,mdl) in self.vitaeModel!.awards.enumerated() { 591 for (_,mdl) in self.vitaeModel!.awards.enumerated() {
562 - self.totalDataArray.add(CNLiveViatePreviewCellType.award)  
563 - self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.award)  
564 let layout = CNLiveViateAwardModelLayout(model: mdl ,descH: Float(40.0),isPreview: true, isExpand: false) 592 let layout = CNLiveViateAwardModelLayout(model: mdl ,descH: Float(40.0),isPreview: true, isExpand: false)
565 let newWorkModel = layout.getCellHModel() 593 let newWorkModel = layout.getCellHModel()
566 self.awardDataArray.add(newWorkModel) 594 self.awardDataArray.add(newWorkModel)
567 - self.workDataArray.add(CNLiveViatePreviewCellType.award) 595 +// self.workDataArray.add(CNLiveViatePreviewCellType.award)
568 self.awardPreViewDataArray.add(newWorkModel) 596 self.awardPreViewDataArray.add(newWorkModel)
569 - self.workPreViewDataArray.add(CNLiveViatePreviewCellType.award) 597 +// self.workPreViewDataArray.add(CNLiveViatePreviewCellType.award)
570 } 598 }
571 }else{ 599 }else{
572 print("false") 600 print("false")
573 } 601 }
574 self.totalDataArray.add(CNLiveViatePreviewCellType.mineJieShao) 602 self.totalDataArray.add(CNLiveViatePreviewCellType.mineJieShao)
575 - self.workDataArray.add(CNLiveViatePreviewCellType.mineJieShao)  
576 - self.awardDataArray.add(CNLiveViatePreviewCellType.mineJieShao) 603 +// self.workDataArray.add(CNLiveViatePreviewCellType.mineJieShao)
  604 +// self.awardDataArray.add(CNLiveViatePreviewCellType.mineJieShao)
577 if model.vitae?.selfIntroduction.count ?? 0 > 0{ 605 if model.vitae?.selfIntroduction.count ?? 0 > 0{
578 self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.mineJieShao) 606 self.totalPreViewDataArray.add(CNLiveViatePreviewCellType.mineJieShao)
579 - self.workPreViewDataArray.add(CNLiveViatePreviewCellType.mineJieShao)  
580 - self.awardPreViewDataArray.add(CNLiveViatePreviewCellType.mineJieShao) 607 +// self.workPreViewDataArray.add(CNLiveViatePreviewCellType.mineJieShao)
  608 +// self.awardPreViewDataArray.add(CNLiveViatePreviewCellType.mineJieShao)
581 } 609 }
582 self.tableView.reloadData() 610 self.tableView.reloadData()
583 } 611 }
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/我的简历cell/CNLiveDigitalResumePreviewFourCell.swift
@@ -10,44 +10,55 @@ import Kingfisher @@ -10,44 +10,55 @@ import Kingfisher
10 import SnapKit 10 import SnapKit
11 import JFHeroBrowser 11 import JFHeroBrowser
12 12
13 -//cell高度变化  
14 -typealias vitaePreviewWorkCellChangedBlockActionBlock = (_ cell: CNLiveDigitalResumePreviewFourCell ,_ cellHeight:CGFloat ,_ isExpand:Bool) -> Void  
15 13
16 -class CNLiveDigitalResumePreviewFourCell: UITableViewCell { 14 +class CNLiveDigitalResumePreviewFourCell: UITableViewCell,UITableViewDelegate,UITableViewDataSource {
17 15
18 var cellType:CNLiveViateWorkAwardType = .work 16 var cellType:CNLiveViateWorkAwardType = .work
  17 + var cellH:Float = 58+45+37+54//默认顶部,空视图,底部高度
19 18
20 //workModel 19 //workModel
21 - var _workMdl : CNLiveVitaeWorksModel?  
22 - var workMdl : CNLiveVitaeWorksModel? { 20 + var _workMdls : [CNLiveVitaeWorksModel]?
  21 + var workMdls : [CNLiveVitaeWorksModel]? {
23 get{ 22 get{
24 - _workMdl 23 + _workMdls
25 } 24 }
26 set{ 25 set{
27 - _workMdl = newValue!  
28 - setupNewUI(model: _workMdl!) 26 + _workMdls = newValue!
  27 + setupNewUI(models: _workMdls!)
29 } 28 }
30 } 29 }
31 30
32 //awardModel 31 //awardModel
33 - var _awardModel : CNLiveVitaeAwardsModel?  
34 - var awardModel : CNLiveVitaeAwardsModel? { 32 + var _awardModels : [CNLiveVitaeAwardsModel]?
  33 + var awardModels : [CNLiveVitaeAwardsModel]? {
35 get{ 34 get{
36 - _awardModel 35 + _awardModels
37 } 36 }
38 set{ 37 set{
39 - _awardModel = newValue!  
40 - setupAwardNewUI(model: _awardModel!) 38 + _awardModels = newValue!
  39 + setupAwardNewUI(models: _awardModels!)
41 } 40 }
42 } 41 }
43 - 42 +
44 lazy var images: [HeroBrowserViewModuleBaseProtocol] = { 43 lazy var images: [HeroBrowserViewModuleBaseProtocol] = {
45 var list: [HeroBrowserViewModuleBaseProtocol] = [] 44 var list: [HeroBrowserViewModuleBaseProtocol] = []
46 return list 45 return list
47 }() 46 }()
48 - 47 +
49 var vitaeWorkPreviewVideoPhotoBlock:VitaeWorkPreviewVideoPhotoBlock? 48 var vitaeWorkPreviewVideoPhotoBlock:VitaeWorkPreviewVideoPhotoBlock?
50 var vitaePreviewWorkCellChangedBlock:vitaePreviewWorkCellChangedBlockActionBlock? 49 var vitaePreviewWorkCellChangedBlock:vitaePreviewWorkCellChangedBlockActionBlock?
  50 +
  51 + let kCNLiveDigitalResumePreviewFourWorkAwardCellIdentifier = "kCNLiveDigitalResumePreviewFourWorkAwardCellIdentifier"
  52 + lazy var tableView : UITableView = {
  53 + let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: KSreenWidth-30, height: 50), style: .plain)
  54 + tableView.dataSource = self
  55 + tableView.delegate = self
  56 + tableView.separatorStyle = .none
  57 + tableView.tableFooterView = UIView.init()
  58 + tableView.backgroundColor = .clear
  59 + tableView.register(CNLiveDigitalResumePreviewFourWorkAwardCell.self, forCellReuseIdentifier: kCNLiveDigitalResumePreviewFourWorkAwardCellIdentifier)
  60 + return tableView
  61 + }()
51 62
52 lazy var whiteView :UIView = { 63 lazy var whiteView :UIView = {
53 let whiteView = UIView(frame: CGRect(x: 15, y:15, width: KSreenWidth-30, height: DefaultPreViewCellHeight)) 64 let whiteView = UIView(frame: CGRect(x: 15, y:15, width: KSreenWidth-30, height: DefaultPreViewCellHeight))
@@ -79,104 +90,6 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell { @@ -79,104 +90,6 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell {
79 iconImgView.image = UIImage(named: "mine_jianli_preview_workNoData") 90 iconImgView.image = UIImage(named: "mine_jianli_preview_workNoData")
80 return iconImgView 91 return iconImgView
81 }() 92 }()
82 - //有内容  
83 - lazy var nameIconImgView :UIImageView = {  
84 - let iconImgView = UIImageView(frame: CGRect(x: 15, y: 0, width: 25, height: 25))  
85 - iconImgView.contentMode = .scaleAspectFit  
86 - iconImgView.image = UIImage(named: "mine_jianli_preview_work")  
87 - return iconImgView  
88 - }()  
89 - lazy var workProfessionTitleLabel: UILabel = {  
90 - let titleLabel = UILabel()  
91 - titleLabel.textColor = HexColor("#333333")  
92 - titleLabel.textAlignment = .left  
93 - titleLabel.text = "行业"  
94 - titleLabel.font = BoldFont_16  
95 - titleLabel.adjustsFontSizeToFitWidth = true  
96 - return titleLabel  
97 - }()  
98 - lazy var realImgView :UIImageView = {  
99 - let iconImgView = UIImageView()  
100 - iconImgView.image = UIImage(named: "mine_jianli_zhenshi")  
101 - return iconImgView  
102 - }()  
103 - lazy var workNameTitleLabel: UILabel = {  
104 - let titleLabel = UILabel()  
105 - titleLabel.textColor = HexColor("#333333")  
106 - titleLabel.textAlignment = .left  
107 - titleLabel.text = "工作岗位"  
108 - titleLabel.font = Font_14  
109 - titleLabel.adjustsFontSizeToFitWidth = true  
110 - return titleLabel  
111 - }()  
112 - lazy var workPositionTitleLabel: UILabel = {  
113 - let titleLabel = UILabel()  
114 - titleLabel.textColor = HexColor("#333333")  
115 - titleLabel.textAlignment = .left  
116 - titleLabel.text = "公司名称"  
117 - titleLabel.font = Font_14  
118 - titleLabel.adjustsFontSizeToFitWidth = true  
119 - return titleLabel  
120 - }()  
121 - lazy var workTimeTitleLabel: UILabel = {  
122 - let titleLabel = UILabel()  
123 - titleLabel.textColor = HexColor("#333333")  
124 - titleLabel.textAlignment = .left  
125 - titleLabel.text = "工作时间"  
126 - titleLabel.font = Font_14  
127 - titleLabel.adjustsFontSizeToFitWidth = true  
128 - return titleLabel  
129 - }()  
130 - ///工作内容描述  
131 - lazy var jianjieLabel: UILabel = {  
132 - let titleLabel = UILabel.init(frame: CGRectMake(50, 162, KSreenWidth-60, 40))  
133 - titleLabel.textColor = HexColor("#999999")  
134 - titleLabel.textAlignment = .left  
135 - titleLabel.font = Font_14  
136 - titleLabel.backgroundColor = .clear// UIColor(red:0.98, green:0.98, blue:0.98, alpha:1.00)  
137 - titleLabel.text = "描述"  
138 - titleLabel.numberOfLines = 0  
139 - var lines = titleLabel.getRealLabelTextLines()  
140 - let height = titleLabel.qmui_lineHeight  
141 - if lines > 2 {  
142 - lines = 2  
143 - }  
144 - titleLabel.height = height*CGFloat(lines)  
145 - return titleLabel  
146 - }()  
147 - //展开,收起  
148 - lazy var expandBtn: UIButton = {  
149 - let expandBtn = UIButton.init(type: .custom)  
150 - expandBtn.backgroundColor = .clear  
151 -  
152 - expandBtn.frame = CGRect(x: self.jianjieLabel.right-60, y: self.jianjieLabel.bottom+10, width: 60, height: 30)  
153 - expandBtn.setTitle("更多", for: .normal)  
154 - expandBtn.setTitle("收起", for: .selected)  
155 -  
156 - expandBtn.setTitleColor(HexColor("#1B64FE"), for: .normal)  
157 - expandBtn.setImage(UIImage(named: "homepage_unfold"), for: .normal)  
158 - expandBtn.setImage(UIImage(named: "homepage_fold"), for: .selected)  
159 - expandBtn.titleLabel?.font = Font_14  
160 - expandBtn.setupButtonImageAndTitlePossitionWith(padding: 5, style: .right)  
161 - expandBtn.addTarget(self, action: #selector(expandBtnAction), for: .touchUpInside)  
162 - return expandBtn  
163 - }()  
164 -  
165 - lazy var dingweiImgView :UIImageView = {  
166 - let iconImgView = UIImageView()  
167 - iconImgView.image = UIImage(named: "mine_jinali_workdingwei")  
168 - return iconImgView  
169 - }()  
170 - lazy var workDingWeiTitleLabel: UILabel = {  
171 - let titleLabel = UILabel()  
172 - titleLabel.textColor = HexColor("#999999")  
173 - titleLabel.textAlignment = .left  
174 - titleLabel.text = ""  
175 - titleLabel.font = Font_11  
176 - titleLabel.adjustsFontSizeToFitWidth = true  
177 - return titleLabel  
178 - }()  
179 -  
180 93
181 lazy var zhengshuBtn: UIButton = { 94 lazy var zhengshuBtn: UIButton = {
182 let closeBtn = UIButton(type: .custom) 95 let closeBtn = UIButton(type: .custom)
@@ -210,81 +123,6 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell { @@ -210,81 +123,6 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell {
210 make.top.equalToSuperview().offset(adapt_length(length: 15)) 123 make.top.equalToSuperview().offset(adapt_length(length: 15))
211 make.left.equalTo(adapt_length(length: 15)) 124 make.left.equalTo(adapt_length(length: 15))
212 } 125 }
213 - self.whiteView.addSubview(self.nameIconImgView)  
214 - self.nameIconImgView.snp.makeConstraints { make in  
215 - make.top.equalTo(self.myIdentityTitleLabel.snp.bottom).offset(15)  
216 - make.left.equalTo(15)  
217 - make.width.height.equalTo(25)  
218 - }  
219 - self.whiteView.addSubview(self.workProfessionTitleLabel)  
220 - self.workProfessionTitleLabel.snp.makeConstraints { make in  
221 - make.top.equalTo(self.myIdentityTitleLabel.snp.bottom).offset(15)  
222 - make.left.equalTo(50)  
223 - }  
224 -  
225 - self.whiteView.addSubview(self.realImgView)  
226 - self.realImgView.snp.makeConstraints { make in  
227 - make.right.equalToSuperview().offset(-15)  
228 - make.centerY.equalTo(self.workProfessionTitleLabel.snp.centerY)  
229 - make.width.equalTo(80)  
230 - make.height.equalTo(80.0*78/403)  
231 - make.left.greaterThanOrEqualTo(self.workProfessionTitleLabel.snp.right).offset(5)  
232 - }  
233 - self.whiteView.addSubview(self.workNameTitleLabel)  
234 - self.workNameTitleLabel.snp.makeConstraints { make in  
235 - make.top.equalTo(self.workProfessionTitleLabel.snp.bottom).offset(6)  
236 - make.left.equalTo(50)  
237 - make.right.equalToSuperview().offset(-15)  
238 - }  
239 -  
240 - self.whiteView.addSubview(self.workPositionTitleLabel)  
241 - self.workPositionTitleLabel.snp.makeConstraints { make in  
242 - make.top.equalTo(self.workNameTitleLabel.snp.bottom).offset(5)  
243 - make.left.equalTo(self.workNameTitleLabel.snp.left)  
244 - make.right.equalToSuperview().offset(-15)  
245 - }  
246 -  
247 - self.whiteView.addSubview(self.workTimeTitleLabel)  
248 - self.workTimeTitleLabel.snp.makeConstraints { make in  
249 - make.top.equalTo(self.workPositionTitleLabel.snp.bottom).offset(5)  
250 - make.left.equalTo(self.workPositionTitleLabel.snp.left)  
251 - make.right.equalToSuperview().offset(-15)  
252 - }  
253 - self.whiteView.addSubview(self.jianjieLabel)  
254 - self.jianjieLabel.snp.makeConstraints { make in  
255 - make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10)  
256 - make.left.equalTo(self.workTimeTitleLabel.snp.left)  
257 - make.right.equalToSuperview().offset(-20)  
258 - make.height.equalTo(40)  
259 - }  
260 - self.whiteView.addSubview(self.expandBtn)  
261 - self.expandBtn.snp.makeConstraints { make in  
262 - make.top.equalTo(self.jianjieLabel.snp.bottom)  
263 - make.right.equalTo(self.jianjieLabel.snp.right)  
264 - make.width.equalTo(60)  
265 - make.height.equalTo(30)  
266 - }  
267 -  
268 - let lines = jianjieLabel.getRealLabelTextLines()  
269 - if lines <= 2{  
270 - self.expandBtn.isHidden = true  
271 - }else{  
272 - self.expandBtn.isHidden = false  
273 - }  
274 -  
275 - self.whiteView.addSubview(self.dingweiImgView)  
276 - self.dingweiImgView.snp.makeConstraints { make in  
277 - make.left.equalTo(self.workNameTitleLabel.snp.left)  
278 - make.bottom.equalToSuperview().offset(-72)  
279 - make.width.equalTo(10)  
280 - make.height.equalTo(10)  
281 - }  
282 - self.whiteView.addSubview(self.workDingWeiTitleLabel)  
283 - self.workDingWeiTitleLabel.snp.makeConstraints { make in  
284 - make.left.equalTo(self.dingweiImgView.snp.right).offset(3)  
285 - make.centerY.equalTo(self.dingweiImgView.snp.centerY)  
286 - }  
287 -  
288 self.whiteView.addSubview(self.zhengshuBtn) 126 self.whiteView.addSubview(self.zhengshuBtn)
289 self.zhengshuBtn.snp.makeConstraints { make in 127 self.zhengshuBtn.snp.makeConstraints { make in
290 make.centerX.equalToSuperview() 128 make.centerX.equalToSuperview()
@@ -293,6 +131,13 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell { @@ -293,6 +131,13 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell {
293 make.height.equalTo(34) 131 make.height.equalTo(34)
294 } 132 }
295 133
  134 + self.whiteView.addSubview(self.tableView)
  135 + self.tableView.snp.makeConstraints { make in
  136 + make.top.equalTo(self.myIdentityTitleLabel.snp.bottom)
  137 + make.left.right.equalToSuperview()
  138 + make.bottom.equalTo(self.zhengshuBtn.snp.top)
  139 + }
  140 +
296 self.whiteView.addSubview(self.zhengshuNoDescTitleLabel) 141 self.whiteView.addSubview(self.zhengshuNoDescTitleLabel)
297 self.zhengshuNoDescTitleLabel.snp.makeConstraints { make in 142 self.zhengshuNoDescTitleLabel.snp.makeConstraints { make in
298 make.centerX.equalToSuperview() 143 make.centerX.equalToSuperview()
@@ -311,283 +156,74 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell { @@ -311,283 +156,74 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell {
311 fatalError("init(coder:) has not been implemented") 156 fatalError("init(coder:) has not been implemented")
312 } 157 }
313 158
314 - func setupAwardNewUI(model:CNLiveVitaeAwardsModel){ 159 + func setupAwardNewUI(models:[CNLiveVitaeAwardsModel]){
315 self.myIdentityTitleLabel.text = "获奖情况" 160 self.myIdentityTitleLabel.text = "获奖情况"
316 - self.realImgView.isHidden = true  
317 -  
318 - self.zhengshuNoIconImgView.isHidden = true  
319 - self.zhengshuNoDescTitleLabel.isHidden = true  
320 -  
321 - self.whiteView.subviews.forEach { view in  
322 - if view.tag >= 1000{  
323 - view.removeFromSuperview()  
324 - } 161 + self.zhengshuBtn.setTitle("管理获奖情况", for: .normal)
  162 + if models.count > 0{
  163 + self.zhengshuNoIconImgView.isHidden = true
  164 + self.zhengshuNoDescTitleLabel.isHidden = true
325 } 165 }
326 - self.workProfessionTitleLabel.text = model.title.count > 0 ? model.title : "获奖名称"  
327 - self.workNameTitleLabel.isHidden = true  
328 - self.workPositionTitleLabel.text = model.company  
329 166
330 - let startDateString = convertTimestampStringToDateString(timestampString: model.time)  
331 - if startDateString == nil || startDateString?.count == 0{  
332 - self.workTimeTitleLabel.text = ""  
333 - self.workTimeTitleLabel.isHidden = true  
334 - }else{  
335 - self.workTimeTitleLabel.text = startDateString!  
336 - self.workTimeTitleLabel.isHidden = false  
337 -  
338 - }  
339 -  
340 - self.jianjieLabel.text = model.description//"描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述"  
341 - let lines = jianjieLabel.getRealLabelTextLines()  
342 - let height = jianjieLabel.qmui_lineHeight  
343 - if lines <= 2{  
344 - self.expandBtn.isHidden = true  
345 - }else{  
346 - self.expandBtn.isHidden = false  
347 - }  
348 -  
349 - var jienjieH:CGFloat = 0  
350 - if model.isExpand{  
351 - //展开状态  
352 - jienjieH = height*CGFloat(lines)  
353 - self.jianjieLabel.numberOfLines = 0  
354 - }else{  
355 - //收起状态  
356 - if lines <= 2{  
357 - //小于2行,按实际行数  
358 - jienjieH = CGFloat(lines)*height  
359 - }else{  
360 - //大于2行, 显示2行  
361 - jienjieH = 2*height  
362 - }  
363 - self.jianjieLabel.numberOfLines = 2  
364 - }  
365 - self.expandBtn.isSelected = model.isExpand  
366 - self.jianjieLabel.snp.remakeConstraints { make in  
367 - make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10)  
368 - make.left.equalTo(self.workTimeTitleLabel.snp.left)  
369 - make.right.equalToSuperview().offset(-20)  
370 - make.height.equalTo(jienjieH)  
371 - }  
372 - self.expandBtn.top = self.jianjieLabel.top+jienjieH  
373 -  
374 - let imgArr = model.imgs.components(separatedBy: ",")  
375 - if imgArr.count > 0{  
376 - for i in 0..<imgArr.count {  
377 - let imgGap:Float = 10  
378 - let imgLeftGap:Float = 50  
379 - let lie = i%3  
380 - let hang = i/3  
381 - let imgWH:Float = Float((Float(KSreenWidth)-30-40-imgLeftGap)/3.0)  
382 - let imgView = UIImageView(frame: CGRect(x: CGFloat(imgLeftGap+(imgGap+imgWH)*Float(lie)), y: CGFloat((imgWH+10)*Float(hang))+self.jianjieLabel.top+jienjieH+10, width: CGFloat(imgWH), height: CGFloat(imgWH)))  
383 - imgView.isUserInteractionEnabled = true  
384 - imgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(imgViewTapAciton)))  
385 - imgView.tag = 1000+i  
386 - imgView.contentMode = .scaleAspectFit  
387 - let imgUrl = imgArr[i]  
388 - imgView.clipsToBounds = true  
389 - imgView.layer.cornerRadius = 5  
390 - self.whiteView.addSubview(imgView)  
391 -  
392 - if imgUrl.contains("vitae_video_"){  
393 - //是视频  
394 - let thumbailImgUrl = "http://wjjtest.ys2.cnliveimg.com/802/mateCode/img/vitae_photo_0/2024/08/02/3977195366.jpg"  
395 - let vm = HeroBrowserVideoViewModule(thumbailImgUrl: thumbailImgUrl, videoUrl: imgUrl, provider: HeroNetworkImageProvider.shared, autoPlay: true)  
396 - self.images.append(vm)  
397 - imgView.kf.setImage(with: URL(string: thumbailImgUrl),placeholder: UIImage(color: UIColor.lightGray, size: imgView.size))  
398 -  
399 - let playBtn = UIButton(type: .custom)  
400 - playBtn.frame = imgView.bounds  
401 - playBtn.setImage(UIImage(named: "short_video_play"), for: .normal)  
402 - playBtn.addTarget(self, action: #selector(playBtnAction(btn:)), for: .touchUpInside)  
403 - playBtn.clipsToBounds = true  
404 - playBtn.layer.cornerRadius = 5  
405 - playBtn.tag = 1000+i  
406 - imgView.addSubview(playBtn)  
407 - }else if imgUrl.contains("vitae_photo_"){  
408 - //是图片  
409 - self.images.append(HeroBrowserNetworkImageViewModule(thumbailImgUrl: nil, originImgUrl: imgUrl))  
410 - imgView.kf.setImage(with: URL(string: imgUrl))  
411 - }else{  
412 - //默认图片  
413 - self.images.append(HeroBrowserNetworkImageViewModule(thumbailImgUrl: nil, originImgUrl: imgUrl))  
414 - imgView.kf.setImage(with: URL(string: imgUrl))  
415 - }  
416 - }  
417 - }  
418 -  
419 - self.workDingWeiTitleLabel.isHidden = true  
420 - self.dingweiImgView.isHidden = true  
421 - self.zhengshuBtn.setTitle("管理获奖情况", for: .normal)  
422 - self.nameIconImgView.image = UIImage(named: "mine_jianli_preview_award") 167 + self.tableView.reloadData()
423 } 168 }
424 - func setupNewUI(model:CNLiveVitaeWorksModel){ 169 + func setupNewUI(models:[CNLiveVitaeWorksModel]){
425 self.myIdentityTitleLabel.text = "工作记录" 170 self.myIdentityTitleLabel.text = "工作记录"
426 - self.realImgView.isHidden = false 171 + self.zhengshuBtn.setTitle("管理工作记录", for: .normal)
427 172
428 - self.zhengshuNoIconImgView.isHidden = true  
429 - self.zhengshuNoDescTitleLabel.isHidden = true  
430 -  
431 - self.whiteView.subviews.forEach { view in  
432 - if view.tag >= 1000{  
433 - view.removeFromSuperview()  
434 - } 173 + if models.count > 0{
  174 + self.zhengshuNoIconImgView.isHidden = true
  175 + self.zhengshuNoDescTitleLabel.isHidden = true
435 } 176 }
436 - self.workProfessionTitleLabel.text = model.profession.count > 0 ? model.profession : "行业"  
437 - self.workNameTitleLabel.text = model.position.count > 0 ? model.position : "职位"  
438 - self.workPositionTitleLabel.text = model.companyName  
439 -  
440 - let startDateString = convertTimestampStringToDateString(timestampString: model.startWorkingDate)  
441 - let endDateString = convertTimestampStringToDateString(timestampString: model.endWorkingDate)  
442 - if endDateString == nil || endDateString?.count == 0{  
443 - if startDateString == nil || startDateString?.count == 0{  
444 - self.workTimeTitleLabel.text = ""  
445 - }else{  
446 - self.workTimeTitleLabel.text = startDateString!  
447 - } 177 + self.tableView.reloadData()
  178 + }
  179 +
  180 +
  181 + // MARK: - UITableViewDelegate
  182 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  183 + if self.cellType == .work{
  184 + return self.workMdls?.count ?? 0
448 }else{ 185 }else{
449 - if startDateString == nil || startDateString?.count == 0{  
450 - self.workTimeTitleLabel.text = ""  
451 - }else{  
452 - self.workTimeTitleLabel.text = startDateString!+"~"+endDateString!  
453 - } 186 + return self.awardModels?.count ?? 0
454 } 187 }
455 -  
456 - self.jianjieLabel.text = model.jobDuties//"描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述"  
457 - let lines = jianjieLabel.getRealLabelTextLines()  
458 - let height = jianjieLabel.qmui_lineHeight  
459 - if lines <= 2{  
460 - self.expandBtn.isHidden = true  
461 - }else{  
462 - self.expandBtn.isHidden = false 188 + }
  189 +
  190 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  191 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDigitalResumePreviewFourWorkAwardCellIdentifier) as? CNLiveDigitalResumePreviewFourWorkAwardCell
  192 + else {
  193 + let cell = CNLiveDigitalResumePreviewFourWorkAwardCell()
  194 + return cell
463 } 195 }
464 -  
465 - var jienjieH:CGFloat = 0  
466 - if model.isExpand{  
467 - //展开状态  
468 - jienjieH = height*CGFloat(lines)  
469 - self.jianjieLabel.numberOfLines = 0 196 + if self.cellType == .work{
  197 + //工作记录
  198 + let workMdl = self.workMdls?[indexPath.row]
  199 + cell.workMdl = workMdl
470 }else{ 200 }else{
471 - //收起状态  
472 - if lines <= 2{  
473 - //小于2行,按实际行数  
474 - jienjieH = CGFloat(lines)*height  
475 - }else{  
476 - //大于2行, 显示2行  
477 - jienjieH = 2*height  
478 - }  
479 - self.jianjieLabel.numberOfLines = 2  
480 - }  
481 - self.expandBtn.isSelected = model.isExpand  
482 - self.jianjieLabel.snp.remakeConstraints { make in  
483 - make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10)  
484 - make.left.equalTo(self.workTimeTitleLabel.snp.left)  
485 - make.right.equalToSuperview().offset(-20)  
486 - make.height.equalTo(jienjieH) 201 + //获奖情况
  202 + let awardMdl = self.awardModels?[indexPath.row]
  203 + cell.awardModel = awardMdl
487 } 204 }
488 - self.expandBtn.top = self.jianjieLabel.top+jienjieH  
489 -  
490 - let imgArr = model.imgs.components(separatedBy: ",")  
491 - if imgArr.count > 0{  
492 - for i in 0..<imgArr.count {  
493 - let imgGap:Float = 10  
494 - let imgLeftGap:Float = 50  
495 - let lie = i%3  
496 - let hang = i/3  
497 - let imgWH:Float = Float((Float(KSreenWidth)-30-40-imgLeftGap)/3.0)  
498 - let imgView = UIImageView(frame: CGRect(x: CGFloat(imgLeftGap+(imgGap+imgWH)*Float(lie)), y: CGFloat((imgWH+10)*Float(hang))+self.jianjieLabel.top+jienjieH+10, width: CGFloat(imgWH), height: CGFloat(imgWH)))  
499 - imgView.isUserInteractionEnabled = true  
500 - imgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(imgViewTapAciton)))  
501 - imgView.tag = 1000+i  
502 - imgView.contentMode = .scaleAspectFit  
503 - let imgUrl = imgArr[i]  
504 - imgView.clipsToBounds = true  
505 - imgView.layer.cornerRadius = 5  
506 - self.whiteView.addSubview(imgView)  
507 -  
508 - if imgUrl.contains("vitae_video_"){  
509 - //是视频  
510 - let thumbailImgUrl = "http://wjjtest.ys2.cnliveimg.com/802/mateCode/img/vitae_photo_0/2024/08/02/3977195366.jpg"  
511 - let vm = HeroBrowserVideoViewModule(thumbailImgUrl: thumbailImgUrl, videoUrl: imgUrl, provider: HeroNetworkImageProvider.shared, autoPlay: true)  
512 - self.images.append(vm)  
513 - imgView.kf.setImage(with: URL(string: thumbailImgUrl),placeholder: UIImage(color: UIColor.lightGray, size: imgView.size))  
514 -  
515 - let playBtn = UIButton(type: .custom)  
516 - playBtn.frame = imgView.bounds  
517 - playBtn.setImage(UIImage(named: "short_video_play"), for: .normal)  
518 - playBtn.addTarget(self, action: #selector(playBtnAction(btn:)), for: .touchUpInside)  
519 - playBtn.clipsToBounds = true  
520 - playBtn.layer.cornerRadius = 5  
521 - playBtn.tag = 1000+i  
522 - imgView.addSubview(playBtn)  
523 - }else if imgUrl.contains("vitae_photo_"){  
524 - //是图片  
525 - self.images.append(HeroBrowserNetworkImageViewModule(thumbailImgUrl: nil, originImgUrl: imgUrl))  
526 - imgView.kf.setImage(with: URL(string: imgUrl))  
527 - }else{  
528 - //默认图片  
529 - self.images.append(HeroBrowserNetworkImageViewModule(thumbailImgUrl: nil, originImgUrl: imgUrl))  
530 - imgView.kf.setImage(with: URL(string: imgUrl))  
531 - }  
532 - } 205 + cell.vitaeWorkPreviewVideoPhotoBlock = { images , index in
  206 + self.vitaeWorkPreviewVideoPhotoBlock?(self.images, index)
533 } 207 }
534 -  
535 - let cityStr = model.city  
536 - if cityStr.count == 0 || cityStr == "请选择"{  
537 - self.workDingWeiTitleLabel.isHidden = true  
538 - self.dingweiImgView.isHidden = true  
539 - }else{  
540 - self.dingweiImgView.isHidden = false  
541 - self.workDingWeiTitleLabel.isHidden = false  
542 - self.workDingWeiTitleLabel.text = model.city 208 + cell.vitaePreviewWorkCellChangedBlock = {index ,jianjieHeight,isExpand in
  209 + self.vitaePreviewWorkCellChangedBlock?(index ,jianjieHeight,isExpand)
  210 +
543 } 211 }
544 -  
545 - self.zhengshuBtn.setTitle("管理工作记录", for: .normal)  
546 - self.nameIconImgView.image = UIImage(named: "mine_jianli_preview_work")  
547 - 212 + return cell
548 } 213 }
549 -  
550 - func convertTimestampStringToDateString(timestampString: String) -> String? {  
551 - // 首先,将毫秒时间戳字符串转换为TimeInterval(秒)  
552 - guard let timestampMilliseconds = Double(timestampString) else {  
553 - return nil 214 + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  215 + if self.cellType == .work{
  216 + //工作记录
  217 + let workMdl = self.workMdls?[indexPath.row]
  218 + return CGFloat(workMdl?.cellH ?? 0)
  219 + }else{
  220 + //获奖情况
  221 + let awardMdl = self.awardModels?[indexPath.row]
  222 + return CGFloat(awardMdl?.cellH ?? 0)
554 } 223 }
555 - let timestampSeconds = timestampMilliseconds / 1000.0  
556 - // 然后,将TimeInterval转换为Date对象  
557 - let date = Date(timeIntervalSince1970: timestampSeconds)  
558 - // 接着,设置DateFormatter的格式  
559 - let formatter = DateFormatter()  
560 - formatter.dateFormat = "yyyy.MM.dd" // 设置为你想要的日期格式  
561 - // 最后,使用DateFormatter将Date对象格式化为字符串  
562 - return formatter.string(from: date)  
563 } 224 }
564 225
565 // MARK: - Action 226 // MARK: - Action
566 - @objc func expandBtnAction(button:UIButton){  
567 - button.isSelected = !button.isSelected  
568 - let lines = jianjieLabel.getRealLabelTextLines()  
569 - let height = jianjieLabel.qmui_lineHeight  
570 -  
571 - var jienjieH:CGFloat = 0  
572 - if button.isSelected{  
573 - //文本收起状态,点击展开  
574 - jienjieH = CGFloat(lines)*height  
575 - }else{  
576 - //文本展开状态,点击收起  
577 - jienjieH = 2*height  
578 - }  
579 - self.jianjieLabel.snp.remakeConstraints { make in  
580 - make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10)  
581 - make.left.equalTo(self.workTimeTitleLabel.snp.left)  
582 - make.right.equalToSuperview().offset(-20)  
583 - make.height.equalTo(jienjieH)  
584 - }  
585 -  
586 - self.vitaePreviewWorkCellChangedBlock!(self, jienjieH, button.isSelected)  
587 -  
588 - self.expandBtn.top = self.jianjieLabel.top + jienjieH  
589 -  
590 - }  
591 @objc func zhengshuBtnAction(){ 227 @objc func zhengshuBtnAction(){
592 if self.cellType == .work{ 228 if self.cellType == .work{
593 //跳转 选择工作记录页面 229 //跳转 选择工作记录页面
@@ -603,15 +239,5 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell { @@ -603,15 +239,5 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell {
603 } 239 }
604 240
605 } 241 }
606 - @objc func playBtnAction(btn:UIButton){  
607 - let index = btn.tag-1000  
608 - self.vitaeWorkPreviewVideoPhotoBlock?(self.images, index)  
609 - }  
610 - @objc func imgViewTapAciton(ges: UITapGestureRecognizer){  
611 - let imgView = ges.view as! UIImageView  
612 - let index = imgView.tag-1000  
613 -  
614 - self.vitaeWorkPreviewVideoPhotoBlock?(self.images, index)  
615 - }  
616 - 242 +
617 } 243 }
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/我的简历cell/CNLiveDigitalResumePreviewFourWorkAwardCell.swift 0 → 100644
  1 +//
  2 +// CNLiveDigitalResumePreviewFourWorkAwardCell.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2024/8/23.
  6 +//
  7 +
  8 +import Foundation
  9 +import JFHeroBrowser
  10 +
  11 +//cell高度变化
  12 +typealias vitaePreviewWorkCellChangedBlockActionBlock = (_ index:Int ,_ cellHeight:CGFloat ,_ isExpand:Bool) -> Void
  13 +
  14 +class CNLiveDigitalResumePreviewFourWorkAwardCell:UITableViewCell{
  15 +
  16 + var cellType:CNLiveViateWorkAwardType = .work
  17 +
  18 + //workModel
  19 + var _workMdl : CNLiveVitaeWorksModel?
  20 + var workMdl : CNLiveVitaeWorksModel? {
  21 + get{
  22 + _workMdl
  23 + }
  24 + set{
  25 + _workMdl = newValue!
  26 + setupNewUI(model: _workMdl!)
  27 + }
  28 + }
  29 +
  30 + //awardModel
  31 + var _awardModel : CNLiveVitaeAwardsModel?
  32 + var awardModel : CNLiveVitaeAwardsModel? {
  33 + get{
  34 + _awardModel
  35 + }
  36 + set{
  37 + _awardModel = newValue!
  38 + setupAwardNewUI(model: _awardModel!)
  39 + }
  40 + }
  41 +
  42 + lazy var images: [HeroBrowserViewModuleBaseProtocol] = {
  43 + var list: [HeroBrowserViewModuleBaseProtocol] = []
  44 + return list
  45 + }()
  46 +
  47 + var vitaeWorkPreviewVideoPhotoBlock:VitaeWorkPreviewVideoPhotoBlock?
  48 + var vitaePreviewWorkCellChangedBlock:vitaePreviewWorkCellChangedBlockActionBlock?
  49 +
  50 + //有内容
  51 + lazy var nameIconImgView :UIImageView = {
  52 + let iconImgView = UIImageView(frame: CGRect(x: 15, y: 0, width: 25, height: 25))
  53 + iconImgView.contentMode = .scaleAspectFit
  54 + iconImgView.image = UIImage(named: "mine_jianli_preview_work")
  55 + return iconImgView
  56 + }()
  57 + lazy var workProfessionTitleLabel: UILabel = {
  58 + let titleLabel = UILabel()
  59 + titleLabel.textColor = HexColor("#333333")
  60 + titleLabel.textAlignment = .left
  61 + titleLabel.text = "行业"
  62 + titleLabel.font = BoldFont_16
  63 + titleLabel.adjustsFontSizeToFitWidth = true
  64 + return titleLabel
  65 + }()
  66 + lazy var realImgView :UIImageView = {
  67 + let iconImgView = UIImageView()
  68 + iconImgView.image = UIImage(named: "mine_jianli_zhenshi")
  69 + return iconImgView
  70 + }()
  71 + lazy var workNameTitleLabel: UILabel = {
  72 + let titleLabel = UILabel()
  73 + titleLabel.textColor = HexColor("#333333")
  74 + titleLabel.textAlignment = .left
  75 + titleLabel.text = "工作岗位"
  76 + titleLabel.font = Font_14
  77 + titleLabel.adjustsFontSizeToFitWidth = true
  78 + return titleLabel
  79 + }()
  80 + lazy var workPositionTitleLabel: UILabel = {
  81 + let titleLabel = UILabel()
  82 + titleLabel.textColor = HexColor("#333333")
  83 + titleLabel.textAlignment = .left
  84 + titleLabel.text = "公司名称"
  85 + titleLabel.font = Font_14
  86 + titleLabel.adjustsFontSizeToFitWidth = true
  87 + return titleLabel
  88 + }()
  89 + lazy var workTimeTitleLabel: UILabel = {
  90 + let titleLabel = UILabel()
  91 + titleLabel.textColor = HexColor("#333333")
  92 + titleLabel.textAlignment = .left
  93 + titleLabel.text = "工作时间"
  94 + titleLabel.font = Font_14
  95 + titleLabel.adjustsFontSizeToFitWidth = true
  96 + return titleLabel
  97 + }()
  98 + ///工作内容描述
  99 + lazy var jianjieLabel: UILabel = {
  100 + let titleLabel = UILabel.init(frame: CGRectMake(50, 162, KSreenWidth-60, 40))
  101 + titleLabel.textColor = HexColor("#999999")
  102 + titleLabel.textAlignment = .left
  103 + titleLabel.font = Font_14
  104 + titleLabel.backgroundColor = .clear// UIColor(red:0.98, green:0.98, blue:0.98, alpha:1.00)
  105 + titleLabel.text = "描述"
  106 + titleLabel.numberOfLines = 0
  107 + var lines = titleLabel.getRealLabelTextLines()
  108 + let height = titleLabel.qmui_lineHeight
  109 + if lines > 2 {
  110 + lines = 2
  111 + }
  112 + titleLabel.height = height*CGFloat(lines)
  113 + return titleLabel
  114 + }()
  115 + //展开,收起
  116 + lazy var expandBtn: UIButton = {
  117 + let expandBtn = UIButton.init(type: .custom)
  118 + expandBtn.backgroundColor = .clear
  119 +
  120 + expandBtn.frame = CGRect(x: self.jianjieLabel.right-60, y: self.jianjieLabel.bottom+10, width: 60, height: 30)
  121 + expandBtn.setTitle("更多", for: .normal)
  122 + expandBtn.setTitle("收起", for: .selected)
  123 +
  124 + expandBtn.setTitleColor(HexColor("#1B64FE"), for: .normal)
  125 + expandBtn.setImage(UIImage(named: "homepage_unfold"), for: .normal)
  126 + expandBtn.setImage(UIImage(named: "homepage_fold"), for: .selected)
  127 + expandBtn.titleLabel?.font = Font_14
  128 + expandBtn.setupButtonImageAndTitlePossitionWith(padding: 5, style: .right)
  129 + expandBtn.addTarget(self, action: #selector(expandBtnAction), for: .touchUpInside)
  130 + return expandBtn
  131 + }()
  132 + lazy var imagesTotalView :UIView = {
  133 + let whiteBgView = UIView()
  134 + whiteBgView.tag = 1100
  135 + return whiteBgView
  136 + }()
  137 + lazy var dingweiImgView :UIImageView = {
  138 + let iconImgView = UIImageView()
  139 + iconImgView.image = UIImage(named: "mine_jinali_workdingwei")
  140 + return iconImgView
  141 + }()
  142 + lazy var workDingWeiTitleLabel: UILabel = {
  143 + let titleLabel = UILabel()
  144 + titleLabel.textColor = HexColor("#999999")
  145 + titleLabel.textAlignment = .left
  146 + titleLabel.text = ""
  147 + titleLabel.font = Font_11
  148 + titleLabel.adjustsFontSizeToFitWidth = true
  149 + return titleLabel
  150 + }()
  151 +
  152 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  153 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  154 + self.contentView.backgroundColor = .clear
  155 + self.backgroundColor = .clear
  156 + self.selectionStyle = .none
  157 + self.initUI()
  158 + }
  159 +
  160 + required init?(coder: NSCoder) {
  161 + fatalError("init(coder:) has not been implemented")
  162 + }
  163 +
  164 + func initUI(){
  165 + self.contentView.addSubview(self.nameIconImgView)
  166 + self.nameIconImgView.snp.makeConstraints { make in
  167 + make.top.equalTo(10)
  168 + make.left.equalTo(15)
  169 + make.width.height.equalTo(25)
  170 + }
  171 + self.contentView.addSubview(self.workProfessionTitleLabel)
  172 + self.workProfessionTitleLabel.snp.makeConstraints { make in
  173 + make.centerY.equalTo(self.nameIconImgView.snp.centerY)
  174 + make.left.equalTo(50)
  175 + }
  176 +
  177 + self.contentView.addSubview(self.realImgView)
  178 + self.realImgView.snp.makeConstraints { make in
  179 + make.right.equalToSuperview().offset(-15)
  180 + make.centerY.equalTo(self.workProfessionTitleLabel.snp.centerY)
  181 + make.width.equalTo(80)
  182 + make.height.equalTo(80.0*78/403)
  183 + make.left.greaterThanOrEqualTo(self.workProfessionTitleLabel.snp.right).offset(5)
  184 + }
  185 + self.contentView.addSubview(self.workNameTitleLabel)
  186 + self.workNameTitleLabel.snp.makeConstraints { make in
  187 + make.top.equalTo(self.workProfessionTitleLabel.snp.bottom).offset(6)
  188 + make.left.equalTo(50)
  189 + make.right.equalToSuperview().offset(-15)
  190 + }
  191 +
  192 + self.contentView.addSubview(self.workPositionTitleLabel)
  193 + self.workPositionTitleLabel.snp.makeConstraints { make in
  194 + make.top.equalTo(self.workNameTitleLabel.snp.bottom).offset(5)
  195 + make.left.equalTo(self.workNameTitleLabel.snp.left)
  196 + make.right.equalToSuperview().offset(-15)
  197 + }
  198 +
  199 + self.contentView.addSubview(self.workTimeTitleLabel)
  200 + self.workTimeTitleLabel.snp.makeConstraints { make in
  201 + make.top.equalTo(self.workPositionTitleLabel.snp.bottom).offset(5)
  202 + make.left.equalTo(self.workPositionTitleLabel.snp.left)
  203 + make.right.equalToSuperview().offset(-15)
  204 + }
  205 + self.contentView.addSubview(self.jianjieLabel)
  206 + self.jianjieLabel.snp.makeConstraints { make in
  207 + make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10)
  208 + make.left.equalTo(self.workTimeTitleLabel.snp.left)
  209 + make.right.equalToSuperview().offset(-20)
  210 + make.height.equalTo(40)
  211 + }
  212 + self.contentView.addSubview(self.expandBtn)
  213 + self.expandBtn.snp.makeConstraints { make in
  214 + make.top.equalTo(self.jianjieLabel.snp.bottom)
  215 + make.right.equalTo(self.jianjieLabel.snp.right)
  216 + make.width.equalTo(60)
  217 + make.height.equalTo(30)
  218 + }
  219 +
  220 + let lines = jianjieLabel.getRealLabelTextLines()
  221 + if lines <= 2{
  222 + self.expandBtn.isHidden = true
  223 + }else{
  224 + self.expandBtn.isHidden = false
  225 + }
  226 +
  227 + self.contentView.addSubview(self.imagesTotalView)
  228 + self.imagesTotalView.snp.makeConstraints { make in
  229 + make.left.equalToSuperview()
  230 + make.bottom.equalToSuperview()
  231 + make.width.equalToSuperview()
  232 + make.top.equalTo(self.jianjieLabel.snp.bottom).offset(10)
  233 + }
  234 + self.contentView.addSubview(self.dingweiImgView)
  235 + self.dingweiImgView.snp.makeConstraints { make in
  236 + make.left.equalTo(self.workNameTitleLabel.snp.left)
  237 + make.bottom.equalToSuperview().offset(-15)
  238 + make.width.equalTo(10)
  239 + make.height.equalTo(10)
  240 + }
  241 + self.contentView.addSubview(self.workDingWeiTitleLabel)
  242 + self.workDingWeiTitleLabel.snp.makeConstraints { make in
  243 + make.left.equalTo(self.dingweiImgView.snp.right).offset(3)
  244 + make.centerY.equalTo(self.dingweiImgView.snp.centerY)
  245 + }
  246 +
  247 +
  248 + }
  249 +
  250 + func setupNewUI(model:CNLiveVitaeWorksModel){
  251 + self.realImgView.isHidden = false
  252 + self.imagesTotalView.subviews.forEach { view in
  253 + if view.tag >= 1000{
  254 + view.removeFromSuperview()
  255 + }
  256 + }
  257 + self.workProfessionTitleLabel.text = model.profession.count > 0 ? model.profession : "行业"
  258 + self.workNameTitleLabel.text = model.position.count > 0 ? model.position : "职位"
  259 + if model.companyName.count > 0{
  260 + self.workPositionTitleLabel.text = model.companyName
  261 + self.workPositionTitleLabel.isHidden = false
  262 + }else{
  263 + self.workPositionTitleLabel.isHidden = true
  264 + self.workTimeTitleLabel.snp.remakeConstraints { make in
  265 + make.top.equalTo(self.workNameTitleLabel.snp.bottom).offset(5)
  266 + make.left.equalTo(self.workPositionTitleLabel.snp.left)
  267 + make.right.equalToSuperview().offset(-15)
  268 + }
  269 + }
  270 +
  271 + let startDateString = convertTimestampStringToDateString(timestampString: model.startWorkingDate)
  272 + let endDateString = convertTimestampStringToDateString(timestampString: model.endWorkingDate)
  273 + if endDateString == nil || endDateString?.count == 0{
  274 + if startDateString == nil || startDateString?.count == 0{
  275 + self.workTimeTitleLabel.text = ""
  276 + }else{
  277 + self.workTimeTitleLabel.text = startDateString!
  278 + }
  279 + }else{
  280 + if startDateString == nil || startDateString?.count == 0{
  281 + self.workTimeTitleLabel.text = ""
  282 + }else{
  283 + self.workTimeTitleLabel.text = startDateString!+"~"+endDateString!
  284 + }
  285 + }
  286 +
  287 + self.jianjieLabel.text = model.jobDuties//"描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述"
  288 + self.jianjieLabel.sizeToFit()
  289 + let lines = jianjieLabel.getRealLabelTextLines()
  290 + let height = jianjieLabel.qmui_lineHeight
  291 + if lines <= 2{
  292 + self.expandBtn.isHidden = true
  293 + }else{
  294 + self.expandBtn.isHidden = false
  295 + }
  296 +
  297 + var jienjieH:CGFloat = 0
  298 + if model.isExpand{
  299 + //展开状态
  300 + jienjieH = height*CGFloat(lines)
  301 + self.jianjieLabel.numberOfLines = 0
  302 + }else{
  303 + //收起状态
  304 + if lines <= 2{
  305 + //小于2行,按实际行数
  306 + jienjieH = CGFloat(lines)*height
  307 + self.jianjieLabel.numberOfLines = 1
  308 + }else{
  309 + //大于2行, 显示2行
  310 + jienjieH = 2*height+2
  311 + self.jianjieLabel.numberOfLines = 2
  312 + }
  313 + }
  314 + self.expandBtn.isSelected = model.isExpand
  315 + self.jianjieLabel.snp.remakeConstraints { make in
  316 + make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10)
  317 + make.left.equalTo(self.workTimeTitleLabel.snp.left)
  318 + make.right.equalToSuperview().offset(-20)
  319 + make.height.equalTo(jienjieH)
  320 + }
  321 + self.expandBtn.top = self.jianjieLabel.top+jienjieH
  322 +
  323 + let imgArr = model.imgs.components(separatedBy: ",")
  324 + if imgArr.count > 0{
  325 + for i in 0..<imgArr.count {
  326 + let imgGap:Float = 10
  327 + let imgLeftGap:Float = 50
  328 + let lie = i%3
  329 + let hang = i/3
  330 + let imgWH:Float = Float((Float(KSreenWidth)-30-40-imgLeftGap)/3.0)
  331 + let imgView = UIImageView(frame: CGRect(x: CGFloat(imgLeftGap+(imgGap+imgWH)*Float(lie)), y: CGFloat((imgWH+10)*Float(hang)), width: CGFloat(imgWH), height: CGFloat(imgWH)))// let imgView = UIImageView(frame: CGRect(x: CGFloat(imgLeftGap+(imgGap+imgWH)*Float(lie)), y: CGFloat((imgWH+10)*Float(hang))+self.jianjieLabel.bottom+10, width: CGFloat(imgWH), height: CGFloat(imgWH)))
  332 + imgView.isUserInteractionEnabled = true
  333 + imgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(imgViewTapAciton)))
  334 + imgView.tag = 1000+i
  335 + imgView.contentMode = .scaleAspectFit
  336 + let imgUrl = imgArr[i]
  337 + imgView.clipsToBounds = true
  338 + imgView.layer.cornerRadius = 5
  339 + self.imagesTotalView.addSubview(imgView)
  340 +
  341 + if imgUrl.contains("vitae_video_"){
  342 + //是视频
  343 + let thumbailImgUrl = "http://wjjtest.ys2.cnliveimg.com/802/mateCode/img/vitae_photo_0/2024/08/02/3977195366.jpg"
  344 + let vm = HeroBrowserVideoViewModule(thumbailImgUrl: thumbailImgUrl, videoUrl: imgUrl, provider: HeroNetworkImageProvider.shared, autoPlay: true)
  345 + self.images.append(vm)
  346 + imgView.kf.setImage(with: URL(string: thumbailImgUrl),placeholder: UIImage(color: UIColor.lightGray, size: imgView.size))
  347 +
  348 + let playBtn = UIButton(type: .custom)
  349 + playBtn.frame = imgView.bounds
  350 + playBtn.setImage(UIImage(named: "short_video_play"), for: .normal)
  351 + playBtn.addTarget(self, action: #selector(playBtnAction(btn:)), for: .touchUpInside)
  352 + playBtn.clipsToBounds = true
  353 + playBtn.layer.cornerRadius = 5
  354 + playBtn.tag = 1000+i
  355 + imgView.addSubview(playBtn)
  356 + }else if imgUrl.contains("vitae_photo_"){
  357 + //是图片
  358 + self.images.append(HeroBrowserNetworkImageViewModule(thumbailImgUrl: nil, originImgUrl: imgUrl))
  359 + imgView.kf.setImage(with: URL(string: imgUrl))
  360 + }else{
  361 + //默认图片
  362 + self.images.append(HeroBrowserNetworkImageViewModule(thumbailImgUrl: nil, originImgUrl: imgUrl))
  363 + imgView.kf.setImage(with: URL(string: imgUrl))
  364 + }
  365 + }
  366 + }
  367 +
  368 + let cityStr = model.city
  369 + if cityStr.count == 0 || cityStr == "请选择"{
  370 + self.workDingWeiTitleLabel.isHidden = true
  371 + self.dingweiImgView.isHidden = true
  372 + self.imagesTotalView.snp.remakeConstraints { make in
  373 + make.left.equalToSuperview()
  374 + make.bottom.equalToSuperview()
  375 + make.width.equalToSuperview()
  376 + make.top.equalTo(self.jianjieLabel.snp.bottom).offset(10)
  377 + }
  378 +
  379 + }else{
  380 + self.dingweiImgView.isHidden = false
  381 + self.workDingWeiTitleLabel.isHidden = false
  382 + self.workDingWeiTitleLabel.text = model.city
  383 + self.imagesTotalView.snp.remakeConstraints { make in
  384 + make.left.equalToSuperview()
  385 + make.bottom.equalTo(self.dingweiImgView.snp.top).offset(-5)
  386 + make.width.equalToSuperview()
  387 + make.top.equalTo(self.jianjieLabel.snp.bottom).offset(10)
  388 + }
  389 + }
  390 + self.nameIconImgView.image = UIImage(named: "mine_jianli_preview_work")
  391 +
  392 + }
  393 + func setupAwardNewUI(model:CNLiveVitaeAwardsModel){
  394 + self.realImgView.isHidden = true
  395 + self.imagesTotalView.subviews.forEach { view in
  396 + if view.tag >= 1000{
  397 + view.removeFromSuperview()
  398 + }
  399 + }
  400 +
  401 + self.workProfessionTitleLabel.text = model.title.count > 0 ? model.title : "获奖名称"
  402 + self.workNameTitleLabel.isHidden = true
  403 + if model.company.count > 0{
  404 + self.workPositionTitleLabel.text = model.company
  405 + self.workPositionTitleLabel.isHidden = false
  406 + }else{
  407 + self.workPositionTitleLabel.isHidden = true
  408 + self.workTimeTitleLabel.snp.remakeConstraints { make in
  409 + make.top.equalTo(self.workNameTitleLabel.snp.bottom).offset(5)
  410 + make.left.equalTo(self.workPositionTitleLabel.snp.left)
  411 + make.right.equalToSuperview().offset(-15)
  412 + }
  413 + }
  414 +
  415 + let startDateString = convertTimestampStringToDateString(timestampString: model.time)
  416 + if startDateString == nil || startDateString?.count == 0{
  417 + self.workTimeTitleLabel.text = ""
  418 + self.workTimeTitleLabel.isHidden = true
  419 + }else{
  420 + self.workTimeTitleLabel.text = startDateString!
  421 + self.workTimeTitleLabel.isHidden = false
  422 +
  423 + }
  424 +
  425 + self.jianjieLabel.text = model.description//"描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述"
  426 + self.jianjieLabel.sizeToFit()
  427 + let lines = jianjieLabel.getRealLabelTextLines()
  428 + let height = jianjieLabel.qmui_lineHeight
  429 + if lines <= 2{
  430 + self.expandBtn.isHidden = true
  431 + }else{
  432 + self.expandBtn.isHidden = false
  433 + }
  434 +
  435 + var jienjieH:CGFloat = 0
  436 + if model.isExpand{
  437 + //展开状态
  438 + jienjieH = height*CGFloat(lines)
  439 + self.jianjieLabel.numberOfLines = 0
  440 + }else{
  441 + //收起状态
  442 + if lines <= 2{
  443 + //小于2行,按实际行数
  444 + jienjieH = CGFloat(lines)*height
  445 + self.jianjieLabel.numberOfLines = 1
  446 + }else{
  447 + //大于2行, 显示2行
  448 + jienjieH = 2*height+2
  449 + self.jianjieLabel.numberOfLines = 2
  450 + }
  451 + }
  452 + self.expandBtn.isSelected = model.isExpand
  453 + self.jianjieLabel.snp.remakeConstraints { make in
  454 + make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10)
  455 + make.left.equalTo(self.workTimeTitleLabel.snp.left)
  456 + make.right.equalToSuperview().offset(-20)
  457 + make.height.equalTo(jienjieH)
  458 + }
  459 +
  460 + self.expandBtn.top = self.jianjieLabel.top+jienjieH
  461 +
  462 + let imgArr = model.imgs.components(separatedBy: ",")
  463 + if imgArr.count > 0{
  464 + for i in 0..<imgArr.count {
  465 + let imgGap:Float = 10
  466 + let imgLeftGap:Float = 50
  467 + let lie = i%3
  468 + let hang = i/3
  469 + let imgWH:Float = Float((Float(KSreenWidth)-30-40-imgLeftGap)/3.0)
  470 + let imgView = UIImageView(frame: CGRect(x: CGFloat(imgLeftGap+(imgGap+imgWH)*Float(lie)), y: CGFloat((imgWH+10)*Float(hang)), width: CGFloat(imgWH), height: CGFloat(imgWH)))// let imgView = UIImageView(frame: CGRect(x: CGFloat(imgLeftGap+(imgGap+imgWH)*Float(lie)), y: CGFloat((imgWH+10)*Float(hang))+self.jianjieLabel.bottom+10, width: CGFloat(imgWH), height: CGFloat(imgWH)))
  471 + imgView.isUserInteractionEnabled = true
  472 + imgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(imgViewTapAciton)))
  473 + imgView.tag = 1000+i
  474 + imgView.contentMode = .scaleAspectFit
  475 + let imgUrl = imgArr[i]
  476 + imgView.clipsToBounds = true
  477 + imgView.layer.cornerRadius = 5
  478 + self.imagesTotalView.addSubview(imgView)
  479 +
  480 + if imgUrl.contains("vitae_video_"){
  481 + //是视频
  482 + let thumbailImgUrl = "http://wjjtest.ys2.cnliveimg.com/802/mateCode/img/vitae_photo_0/2024/08/02/3977195366.jpg"
  483 + let vm = HeroBrowserVideoViewModule(thumbailImgUrl: thumbailImgUrl, videoUrl: imgUrl, provider: HeroNetworkImageProvider.shared, autoPlay: true)
  484 + self.images.append(vm)
  485 + imgView.kf.setImage(with: URL(string: thumbailImgUrl),placeholder: UIImage(color: UIColor.lightGray, size: imgView.size))
  486 +
  487 + let playBtn = UIButton(type: .custom)
  488 + playBtn.frame = imgView.bounds
  489 + playBtn.setImage(UIImage(named: "short_video_play"), for: .normal)
  490 + playBtn.addTarget(self, action: #selector(playBtnAction(btn:)), for: .touchUpInside)
  491 + playBtn.clipsToBounds = true
  492 + playBtn.layer.cornerRadius = 5
  493 + playBtn.tag = 1000+i
  494 + imgView.addSubview(playBtn)
  495 + }else if imgUrl.contains("vitae_photo_"){
  496 + //是图片
  497 + self.images.append(HeroBrowserNetworkImageViewModule(thumbailImgUrl: nil, originImgUrl: imgUrl))
  498 + imgView.kf.setImage(with: URL(string: imgUrl))
  499 + }else{
  500 + //默认图片
  501 + self.images.append(HeroBrowserNetworkImageViewModule(thumbailImgUrl: nil, originImgUrl: imgUrl))
  502 + imgView.kf.setImage(with: URL(string: imgUrl))
  503 + }
  504 + }
  505 + }
  506 +
  507 + self.workDingWeiTitleLabel.isHidden = true
  508 + self.dingweiImgView.isHidden = true
  509 + self.nameIconImgView.image = UIImage(named: "mine_jianli_preview_award")
  510 + self.imagesTotalView.snp.remakeConstraints { make in
  511 + make.left.equalToSuperview()
  512 + make.bottom.equalToSuperview()
  513 + make.width.equalToSuperview()
  514 + make.top.equalTo(self.jianjieLabel.snp.bottom).offset(10)
  515 + }
  516 + }
  517 +
  518 + func convertTimestampStringToDateString(timestampString: String) -> String? {
  519 + // 首先,将毫秒时间戳字符串转换为TimeInterval(秒)
  520 + guard let timestampMilliseconds = Double(timestampString) else {
  521 + return nil
  522 + }
  523 + let timestampSeconds = timestampMilliseconds / 1000.0
  524 + // 然后,将TimeInterval转换为Date对象
  525 + let date = Date(timeIntervalSince1970: timestampSeconds)
  526 + // 接着,设置DateFormatter的格式
  527 + let formatter = DateFormatter()
  528 + formatter.dateFormat = "yyyy.MM.dd" // 设置为你想要的日期格式
  529 + // 最后,使用DateFormatter将Date对象格式化为字符串
  530 + return formatter.string(from: date)
  531 + }
  532 +
  533 + // MARK: - Action
  534 + @objc func expandBtnAction(button:UIButton){
  535 + button.isSelected = !button.isSelected
  536 + let lines = jianjieLabel.getRealLabelTextLines()
  537 + let height = jianjieLabel.qmui_lineHeight
  538 +
  539 + var jienjieH:CGFloat = 0
  540 + if button.isSelected{
  541 + //文本收起状态,点击展开
  542 + jienjieH = CGFloat(lines)*height
  543 + }else{
  544 + //文本展开状态,点击收起
  545 + jienjieH = 2*height
  546 + }
  547 + self.jianjieLabel.snp.remakeConstraints { make in
  548 + make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10)
  549 + make.left.equalTo(self.workTimeTitleLabel.snp.left)
  550 + make.right.equalToSuperview().offset(-20)
  551 + make.height.equalTo(jienjieH)
  552 + }
  553 +
  554 + self.vitaePreviewWorkCellChangedBlock!(button.tag, jienjieH, button.isSelected)
  555 +
  556 + self.expandBtn.top = self.jianjieLabel.top + jienjieH
  557 +
  558 + }
  559 +
  560 + @objc func playBtnAction(btn:UIButton){
  561 + let index = btn.tag-1000
  562 + self.vitaeWorkPreviewVideoPhotoBlock?(self.images, index)
  563 + }
  564 + @objc func imgViewTapAciton(ges: UITapGestureRecognizer){
  565 + let imgView = ges.view as! UIImageView
  566 + let index = imgView.tag-1000
  567 +
  568 + self.vitaeWorkPreviewVideoPhotoBlock?(self.images, index)
  569 + }
  570 +
  571 +}
metaCode/Classes/Main/Model/Vitae/CNLiveViateWorkModelLayout.swift
@@ -63,7 +63,7 @@ class CNLiveViateWorkModelLayout:NSObject{ @@ -63,7 +63,7 @@ class CNLiveViateWorkModelLayout:NSObject{
63 _workModel?.cellH = Float(123-25)+companyH+descH+Float(hang*imgWH)+cityH+55 63 _workModel?.cellH = Float(123-25)+companyH+descH+Float(hang*imgWH)+cityH+55
64 }else{//预览工作记录 64 }else{//预览工作记录
65 imgWH = Float((Float(KSreenWidth)-30-40-50)/3.0+10) 65 imgWH = Float((Float(KSreenWidth)-30-40-50)/3.0+10)
66 - _workModel?.cellH = Float(162)+descH+Float(hang*imgWH)+cityH+55 66 + _workModel?.cellH = Float(162-58-25)+companyH+descH+Float(hang*imgWH)+cityH//+55
67 } 67 }
68 } 68 }
69 func getCellHModel()->CNLiveVitaeWorksModel{ 69 func getCellHModel()->CNLiveVitaeWorksModel{
@@ -121,7 +121,7 @@ class CNLiveViateAwardModelLayout:NSObject{ @@ -121,7 +121,7 @@ class CNLiveViateAwardModelLayout:NSObject{
121 _awardModel?.cellH = Float(123-25)+companyH+descH+Float(hang*imgWH)+55 121 _awardModel?.cellH = Float(123-25)+companyH+descH+Float(hang*imgWH)+55
122 }else{//预览获奖 122 }else{//预览获奖
123 imgWH = Float((Float(KSreenWidth)-30-40-50)/3.0+10) 123 imgWH = Float((Float(KSreenWidth)-30-40-50)/3.0+10)
124 - _awardModel?.cellH = Float(162)+descH+Float(hang*imgWH)+55 124 + _awardModel?.cellH = Float(162-58-25)+companyH+descH+Float(hang*imgWH)//+55
125 } 125 }
126 } 126 }
127 func getCellHModel()->CNLiveVitaeAwardsModel{ 127 func getCellHModel()->CNLiveVitaeAwardsModel{