Commit 0aa6837723df359fbe29269c1432c914a27d3028
1 parent
50490bba
工作和获奖,自我介绍 展开收起变换高度
Showing
8 changed files
with
113 additions
and
46 deletions
metaCode/Classes/Main/HomePage/Controller/DigitalAuth/工作相关页面/CNLiveVitaeWorkDetailController.swift
| ... | ... | @@ -150,18 +150,18 @@ class CNLiveVitaeWorkDetailController:CNLiveBaseViewController,UITableViewDataSo |
| 150 | 150 | let model = workListArr[indexPath.row] as! CNLiveVitaeAwardsModel |
| 151 | 151 | cell.awardModel = model |
| 152 | 152 | } |
| 153 | - cell.vitaeWorkCellChangedBlock = { workCell,jianjieHeight in | |
| 153 | + cell.vitaeWorkCellChangedBlock = { workCell,jianjieHeight,isExpand in | |
| 154 | 154 | let res = self.workListArr |
| 155 | 155 | var tempArr = Array<Any>() |
| 156 | 156 | let idxPath = tableView.indexPath(for: workCell) |
| 157 | 157 | for (idx,mdl) in res.enumerated() { |
| 158 | 158 | if idx == idxPath?.row{ |
| 159 | 159 | if self.workAwardType == .work{ |
| 160 | - let layout = CNLiveViateWorkModelLayout(model: mdl as! CNLiveVitaeWorksModel,descH: Float(jianjieHeight),isPreview: false) | |
| 160 | + let layout = CNLiveViateWorkModelLayout(model: mdl as! CNLiveVitaeWorksModel,descH: Float(jianjieHeight),isPreview: false, isExpand: isExpand) | |
| 161 | 161 | let newWorkModel = layout.getCellHModel() |
| 162 | 162 | tempArr.append(newWorkModel) |
| 163 | 163 | }else{ |
| 164 | - let layout = CNLiveViateAwardModelLayout(model: mdl as! CNLiveVitaeAwardsModel,descH: Float(jianjieHeight), isPreview: false) | |
| 164 | + let layout = CNLiveViateAwardModelLayout(model: mdl as! CNLiveVitaeAwardsModel,descH: Float(jianjieHeight), isPreview: false, isExpand: isExpand) | |
| 165 | 165 | let newWorkModel = layout.getCellHModel() |
| 166 | 166 | tempArr.append(newWorkModel) |
| 167 | 167 | } |
| ... | ... | @@ -217,7 +217,7 @@ class CNLiveVitaeWorkDetailController:CNLiveBaseViewController,UITableViewDataSo |
| 217 | 217 | if let res = result as? [CNLiveVitaeWorksModel]{ |
| 218 | 218 | self.workListArr = Array() |
| 219 | 219 | for mdl in res { |
| 220 | - let layout = CNLiveViateWorkModelLayout(model: mdl,descH: 40.0,isPreview: false) | |
| 220 | + let layout = CNLiveViateWorkModelLayout(model: mdl,descH: 40.0,isPreview: false, isExpand: false) | |
| 221 | 221 | let newWorkModel = layout.getCellHModel() |
| 222 | 222 | self.workListArr.append(newWorkModel) |
| 223 | 223 | } |
| ... | ... | @@ -235,7 +235,7 @@ class CNLiveVitaeWorkDetailController:CNLiveBaseViewController,UITableViewDataSo |
| 235 | 235 | if let res = result as? [CNLiveVitaeAwardsModel]{ |
| 236 | 236 | self.workListArr = Array() |
| 237 | 237 | for mdl in res { |
| 238 | - let layout = CNLiveViateAwardModelLayout(model: mdl,descH: 40.0, isPreview: false) | |
| 238 | + let layout = CNLiveViateAwardModelLayout(model: mdl,descH: 40.0, isPreview: false, isExpand: false) | |
| 239 | 239 | let newWorkModel = layout.getCellHModel() |
| 240 | 240 | self.workListArr.append(newWorkModel) |
| 241 | 241 | } | ... | ... |
metaCode/Classes/Main/HomePage/Controller/DigitalAuth/数字简历相关页面/CNLiveDigitalResumePreViewController.swift
| ... | ... | @@ -222,13 +222,13 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD |
| 222 | 222 | } |
| 223 | 223 | if let workMdl = self.workDataArray[indexPath.row] as? CNLiveVitaeWorksModel{ |
| 224 | 224 | cell.workMdl = workMdl |
| 225 | - cell.vitaePreviewWorkCellChangedBlock = { workCell,jianjieHeight in | |
| 225 | + cell.vitaePreviewWorkCellChangedBlock = { workCell,jianjieHeight,isExpand in | |
| 226 | 226 | let res = self.workDataArray |
| 227 | 227 | var tempArr = Array<Any>() |
| 228 | 228 | let idxPath = tableView.indexPath(for: workCell) |
| 229 | 229 | for (idx,mdl) in res.enumerated() { |
| 230 | 230 | if idx == idxPath?.row{ |
| 231 | - let layout = CNLiveViateWorkModelLayout(model: mdl as! CNLiveVitaeWorksModel,descH: Float(jianjieHeight),isPreview: true) | |
| 231 | + let layout = CNLiveViateWorkModelLayout(model: mdl as! CNLiveVitaeWorksModel,descH: Float(jianjieHeight),isPreview: true, isExpand: isExpand) | |
| 232 | 232 | let newWorkModel = layout.getCellHModel() |
| 233 | 233 | tempArr.append(newWorkModel) |
| 234 | 234 | }else{ |
| ... | ... | @@ -260,13 +260,13 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD |
| 260 | 260 | } |
| 261 | 261 | if let awardMdl = self.awardDataArray[indexPath.row] as? CNLiveVitaeAwardsModel{ |
| 262 | 262 | cell.awardModel = awardMdl |
| 263 | - cell.vitaePreviewWorkCellChangedBlock = { workCell,jianjieHeight in | |
| 263 | + cell.vitaePreviewWorkCellChangedBlock = { workCell,jianjieHeight ,isExpand in | |
| 264 | 264 | let res = self.awardDataArray |
| 265 | 265 | var tempArr = Array<Any>() |
| 266 | 266 | let idxPath = tableView.indexPath(for: workCell) |
| 267 | 267 | for (idx,mdl) in res.enumerated() { |
| 268 | 268 | if idx == idxPath?.row{ |
| 269 | - let layout = CNLiveViateAwardModelLayout(model: mdl as! CNLiveVitaeAwardsModel,descH: Float(jianjieHeight),isPreview: true) | |
| 269 | + let layout = CNLiveViateAwardModelLayout(model: mdl as! CNLiveVitaeAwardsModel,descH: Float(jianjieHeight),isPreview: true, isExpand: isExpand) | |
| 270 | 270 | let newWorkModel = layout.getCellHModel() |
| 271 | 271 | tempArr.append(newWorkModel) |
| 272 | 272 | }else{ |
| ... | ... | @@ -297,10 +297,10 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD |
| 297 | 297 | return cell |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - cell.vitaePreviewSixCellChangedBlock = { sixCell,jianjieHeight in | |
| 300 | + cell.vitaePreviewSixCellChangedBlock = { sixCell,jianjieHeight,isExpand in | |
| 301 | + self.vitaeModel?.vitae?.isExpand = isExpand | |
| 301 | 302 | self.sixCellHeight = jianjieHeight+69 |
| 302 | 303 | self.tableView.reloadData() |
| 303 | - | |
| 304 | 304 | } |
| 305 | 305 | if self.vitaeModel?.vitae?.selfIntroduction.count ?? 0 > 0{ |
| 306 | 306 | cell.vitaeMdl = self.vitaeModel |
| ... | ... | @@ -383,6 +383,8 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD |
| 383 | 383 | }else{ |
| 384 | 384 | //有简历-刷新页面 |
| 385 | 385 | self.vitaeModel = nil |
| 386 | + model.vitae?.selfIntroduction = "哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈" | |
| 387 | + self.sixCellHeight = DefaultPreViewCellHeight+15 | |
| 386 | 388 | self.vitaeModel = model |
| 387 | 389 | self.saveViateModel() |
| 388 | 390 | self.totalDataArray.removeAllObjects() |
| ... | ... | @@ -394,14 +396,14 @@ class CNLiveDigitalResumePreViewController:CNLiveBaseViewController,UITableViewD |
| 394 | 396 | for (_,mdl) in self.vitaeModel!.works.enumerated() { |
| 395 | 397 | self.totalDataArray.add(CNLiveViatePreviewCellType.work) |
| 396 | 398 | |
| 397 | - let layout = CNLiveViateWorkModelLayout(model: mdl ,descH: Float(40.0),isPreview: true) | |
| 399 | + let layout = CNLiveViateWorkModelLayout(model: mdl ,descH: Float(40.0),isPreview: true, isExpand: false) | |
| 398 | 400 | let newWorkModel = layout.getCellHModel() |
| 399 | 401 | self.workDataArray.add(newWorkModel) |
| 400 | 402 | self.awardDataArray.add(CNLiveViatePreviewCellType.work) |
| 401 | 403 | } |
| 402 | 404 | for (_,mdl) in self.vitaeModel!.awards.enumerated() { |
| 403 | 405 | self.totalDataArray.add(CNLiveViatePreviewCellType.award) |
| 404 | - let layout = CNLiveViateAwardModelLayout(model: mdl ,descH: Float(40.0),isPreview: true) | |
| 406 | + let layout = CNLiveViateAwardModelLayout(model: mdl ,descH: Float(40.0),isPreview: true, isExpand: false) | |
| 405 | 407 | let newWorkModel = layout.getCellHModel() |
| 406 | 408 | self.awardDataArray.add(newWorkModel) |
| 407 | 409 | self.workDataArray.add(CNLiveViatePreviewCellType.award) | ... | ... |
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/Vitae/Work/CNLiveVitaeWorkCell.swift
| ... | ... | @@ -13,7 +13,7 @@ import Kingfisher |
| 13 | 13 | import JFHeroBrowser |
| 14 | 14 | |
| 15 | 15 | //cell高度变化 |
| 16 | -typealias vitaeWorkCellChangedBlockActionBlock = (_ cell: CNLiveVitaeWorkCell ,_ cellHeight:CGFloat) -> Void | |
| 16 | +typealias vitaeWorkCellChangedBlockActionBlock = (_ cell: CNLiveVitaeWorkCell ,_ cellHeight:CGFloat,_ isExpand:Bool) -> Void | |
| 17 | 17 | typealias VitaeWorkPreviewVideoPhotoBlock = (_ images: [HeroBrowserViewModuleBaseProtocol] ,_ index:Int) -> Void |
| 18 | 18 | //刷新tableView |
| 19 | 19 | typealias VitaeWorkListBlock = () -> Void |
| ... | ... | @@ -482,7 +482,7 @@ class CNLiveVitaeWorkCell: UITableViewCell{ |
| 482 | 482 | //文本展开状态,点击收起 |
| 483 | 483 | self.jianjieLabel.height = 2*height |
| 484 | 484 | } |
| 485 | - self.vitaeWorkCellChangedBlock!(self, self.jianjieLabel.height) | |
| 485 | + self.vitaeWorkCellChangedBlock!(self, self.jianjieLabel.height, button.isSelected) | |
| 486 | 486 | |
| 487 | 487 | self.expandBtn.top = self.jianjieLabel.bottom |
| 488 | 488 | ... | ... |
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/我的简历cell/CNLiveDigitalResumePreViewSecCell.swift
| ... | ... | @@ -47,7 +47,7 @@ class CNLiveDigitalResumePreViewSecCell: UITableViewCell, UICollectionViewDelega |
| 47 | 47 | |
| 48 | 48 | lazy var zhengshuBtn: UIButton = { |
| 49 | 49 | let closeBtn = UIButton(type: .custom) |
| 50 | - closeBtn.setTitle("关联验证", for: .normal) | |
| 50 | + closeBtn.setTitle("关联认证", for: .normal) | |
| 51 | 51 | closeBtn.setTitleColor(HexColor("#1961FE"), for: .normal) |
| 52 | 52 | closeBtn.titleLabel?.font = BoldFont_14 |
| 53 | 53 | closeBtn.layer.borderColor = HexColor("#1961FE")?.cgColor | ... | ... |
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/我的简历cell/CNLiveDigitalResumePreviewFourCell.swift
| ... | ... | @@ -11,7 +11,7 @@ import SnapKit |
| 11 | 11 | import JFHeroBrowser |
| 12 | 12 | |
| 13 | 13 | //cell高度变化 |
| 14 | -typealias vitaePreviewWorkCellChangedBlockActionBlock = (_ cell: CNLiveDigitalResumePreviewFourCell ,_ cellHeight:CGFloat) -> Void | |
| 14 | +typealias vitaePreviewWorkCellChangedBlockActionBlock = (_ cell: CNLiveDigitalResumePreviewFourCell ,_ cellHeight:CGFloat ,_ isExpand:Bool) -> Void | |
| 15 | 15 | |
| 16 | 16 | class CNLiveDigitalResumePreviewFourCell: UITableViewCell { |
| 17 | 17 | |
| ... | ... | @@ -253,8 +253,15 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell { |
| 253 | 253 | make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10) |
| 254 | 254 | make.left.equalTo(self.workTimeTitleLabel.snp.left) |
| 255 | 255 | make.right.equalToSuperview().offset(-20) |
| 256 | + make.height.equalTo(40) | |
| 256 | 257 | } |
| 257 | 258 | self.whiteView.addSubview(self.expandBtn) |
| 259 | + self.expandBtn.snp.makeConstraints { make in | |
| 260 | + make.top.equalTo(self.jianjieLabel.snp.bottom) | |
| 261 | + make.right.equalTo(self.jianjieLabel.snp.right) | |
| 262 | + make.width.equalTo(60) | |
| 263 | + make.height.equalTo(30) | |
| 264 | + } | |
| 258 | 265 | |
| 259 | 266 | let lines = jianjieLabel.getRealLabelTextLines() |
| 260 | 267 | if lines <= 2{ |
| ... | ... | @@ -337,20 +344,30 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell { |
| 337 | 344 | self.expandBtn.isHidden = false |
| 338 | 345 | } |
| 339 | 346 | |
| 340 | - if self.expandBtn.isSelected{ | |
| 347 | + var jienjieH:CGFloat = 0 | |
| 348 | + if model.isExpand{ | |
| 341 | 349 | //展开状态 |
| 342 | - self.jianjieLabel.height = height*CGFloat(lines) | |
| 343 | - | |
| 350 | + jienjieH = height*CGFloat(lines) | |
| 351 | + self.jianjieLabel.numberOfLines = 0 | |
| 344 | 352 | }else{ |
| 345 | 353 | //收起状态 |
| 346 | 354 | if lines <= 2{ |
| 347 | 355 | //小于2行,按实际行数 |
| 348 | - self.jianjieLabel.height = CGFloat(lines)*height | |
| 356 | + jienjieH = CGFloat(lines)*height | |
| 349 | 357 | }else{ |
| 350 | 358 | //大于2行, 显示2行 |
| 351 | - self.jianjieLabel.height = 2*height | |
| 359 | + jienjieH = 2*height | |
| 352 | 360 | } |
| 361 | + self.jianjieLabel.numberOfLines = 2 | |
| 353 | 362 | } |
| 363 | + self.expandBtn.isSelected = model.isExpand | |
| 364 | + self.jianjieLabel.snp.remakeConstraints { make in | |
| 365 | + make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10) | |
| 366 | + make.left.equalTo(self.workTimeTitleLabel.snp.left) | |
| 367 | + make.right.equalToSuperview().offset(-20) | |
| 368 | + make.height.equalTo(jienjieH) | |
| 369 | + } | |
| 370 | + self.expandBtn.top = self.jianjieLabel.top+jienjieH | |
| 354 | 371 | |
| 355 | 372 | let imgArr = model.imgs.components(separatedBy: ",") |
| 356 | 373 | if imgArr.count > 0{ |
| ... | ... | @@ -360,7 +377,7 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell { |
| 360 | 377 | let lie = i%3 |
| 361 | 378 | let hang = i/3 |
| 362 | 379 | let imgWH:Float = Float((Float(KSreenWidth)-30-40-imgLeftGap)/3.0) |
| 363 | - 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))) | |
| 380 | + 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))) | |
| 364 | 381 | imgView.isUserInteractionEnabled = true |
| 365 | 382 | imgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(imgViewTapAciton))) |
| 366 | 383 | imgView.tag = 1000+i |
| ... | ... | @@ -441,20 +458,30 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell { |
| 441 | 458 | self.expandBtn.isHidden = false |
| 442 | 459 | } |
| 443 | 460 | |
| 444 | - if self.expandBtn.isSelected{ | |
| 461 | + var jienjieH:CGFloat = 0 | |
| 462 | + if model.isExpand{ | |
| 445 | 463 | //展开状态 |
| 446 | - self.jianjieLabel.height = height*CGFloat(lines) | |
| 447 | - | |
| 464 | + jienjieH = height*CGFloat(lines) | |
| 465 | + self.jianjieLabel.numberOfLines = 0 | |
| 448 | 466 | }else{ |
| 449 | 467 | //收起状态 |
| 450 | 468 | if lines <= 2{ |
| 451 | 469 | //小于2行,按实际行数 |
| 452 | - self.jianjieLabel.height = CGFloat(lines)*height | |
| 470 | + jienjieH = CGFloat(lines)*height | |
| 453 | 471 | }else{ |
| 454 | 472 | //大于2行, 显示2行 |
| 455 | - self.jianjieLabel.height = 2*height | |
| 473 | + jienjieH = 2*height | |
| 456 | 474 | } |
| 475 | + self.jianjieLabel.numberOfLines = 2 | |
| 457 | 476 | } |
| 477 | + self.expandBtn.isSelected = model.isExpand | |
| 478 | + self.jianjieLabel.snp.remakeConstraints { make in | |
| 479 | + make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10) | |
| 480 | + make.left.equalTo(self.workTimeTitleLabel.snp.left) | |
| 481 | + make.right.equalToSuperview().offset(-20) | |
| 482 | + make.height.equalTo(jienjieH) | |
| 483 | + } | |
| 484 | + self.expandBtn.top = self.jianjieLabel.top+jienjieH | |
| 458 | 485 | |
| 459 | 486 | let imgArr = model.imgs.components(separatedBy: ",") |
| 460 | 487 | if imgArr.count > 0{ |
| ... | ... | @@ -464,7 +491,7 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell { |
| 464 | 491 | let lie = i%3 |
| 465 | 492 | let hang = i/3 |
| 466 | 493 | let imgWH:Float = Float((Float(KSreenWidth)-30-40-imgLeftGap)/3.0) |
| 467 | - 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))) | |
| 494 | + 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))) | |
| 468 | 495 | imgView.isUserInteractionEnabled = true |
| 469 | 496 | imgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(imgViewTapAciton))) |
| 470 | 497 | imgView.tag = 1000+i |
| ... | ... | @@ -533,16 +560,24 @@ class CNLiveDigitalResumePreviewFourCell: UITableViewCell { |
| 533 | 560 | let lines = jianjieLabel.getRealLabelTextLines() |
| 534 | 561 | let height = jianjieLabel.qmui_lineHeight |
| 535 | 562 | |
| 563 | + var jienjieH:CGFloat = 0 | |
| 536 | 564 | if button.isSelected{ |
| 537 | 565 | //文本收起状态,点击展开 |
| 538 | - self.jianjieLabel.height = CGFloat(lines)*height | |
| 566 | + jienjieH = CGFloat(lines)*height | |
| 539 | 567 | }else{ |
| 540 | 568 | //文本展开状态,点击收起 |
| 541 | - self.jianjieLabel.height = 2*height | |
| 569 | + jienjieH = 2*height | |
| 570 | + } | |
| 571 | + self.jianjieLabel.snp.remakeConstraints { make in | |
| 572 | + make.top.equalTo(self.workTimeTitleLabel.snp.bottom).offset(10) | |
| 573 | + make.left.equalTo(self.workTimeTitleLabel.snp.left) | |
| 574 | + make.right.equalToSuperview().offset(-20) | |
| 575 | + make.height.equalTo(jienjieH) | |
| 542 | 576 | } |
| 543 | - self.vitaePreviewWorkCellChangedBlock!(self, self.jianjieLabel.height) | |
| 544 | 577 | |
| 545 | - self.expandBtn.top = self.jianjieLabel.bottom | |
| 578 | + self.vitaePreviewWorkCellChangedBlock!(self, jienjieH, button.isSelected) | |
| 579 | + | |
| 580 | + self.expandBtn.top = self.jianjieLabel.top + jienjieH | |
| 546 | 581 | |
| 547 | 582 | } |
| 548 | 583 | @objc func zhengshuBtnAction(){ | ... | ... |
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/我的简历cell/CNLiveDigitalResumePreviewSixCell.swift
| ... | ... | @@ -10,7 +10,7 @@ import Kingfisher |
| 10 | 10 | import SnapKit |
| 11 | 11 | |
| 12 | 12 | //cell高度变化 |
| 13 | -typealias vitaePreviewSixCellChangedBlockActionBlock = (_ cell: CNLiveDigitalResumePreviewSixCell ,_ cellHeight:CGFloat) -> Void | |
| 13 | +typealias vitaePreviewSixCellChangedBlockActionBlock = (_ cell: CNLiveDigitalResumePreviewSixCell ,_ cellHeight:CGFloat, _ isExpand:Bool) -> Void | |
| 14 | 14 | |
| 15 | 15 | class CNLiveDigitalResumePreviewSixCell: UITableViewCell { |
| 16 | 16 | var vitaePreviewSixCellChangedBlock:vitaePreviewSixCellChangedBlockActionBlock? |
| ... | ... | @@ -142,6 +142,13 @@ class CNLiveDigitalResumePreviewSixCell: UITableViewCell { |
| 142 | 142 | make.right.equalToSuperview().offset(-20) |
| 143 | 143 | } |
| 144 | 144 | self.whiteView.addSubview(self.expandBtn) |
| 145 | + self.expandBtn.snp.makeConstraints { make in | |
| 146 | + make.top.equalTo(self.jianjieLabel.snp.bottom) | |
| 147 | + make.right.equalTo(self.jianjieLabel.snp.right) | |
| 148 | + make.width.equalTo(60) | |
| 149 | + make.height.equalTo(30) | |
| 150 | + } | |
| 151 | + | |
| 145 | 152 | |
| 146 | 153 | let lines = jianjieLabel.getRealLabelTextLines() |
| 147 | 154 | if lines <= 2{ |
| ... | ... | @@ -191,20 +198,31 @@ class CNLiveDigitalResumePreviewSixCell: UITableViewCell { |
| 191 | 198 | self.expandBtn.isHidden = false |
| 192 | 199 | } |
| 193 | 200 | |
| 194 | - if self.expandBtn.isSelected{ | |
| 201 | + var jienjieH:CGFloat = 0 | |
| 202 | + if model.vitae!.isExpand{ | |
| 195 | 203 | //展开状态 |
| 196 | - self.jianjieLabel.height = height*CGFloat(lines) | |
| 197 | - | |
| 204 | + jienjieH = height*CGFloat(lines) | |
| 205 | + self.jianjieLabel.numberOfLines = 0 | |
| 198 | 206 | }else{ |
| 199 | 207 | //收起状态 |
| 200 | 208 | if lines <= 2{ |
| 201 | 209 | //小于2行,按实际行数 |
| 202 | - self.jianjieLabel.height = CGFloat(lines)*height | |
| 210 | + jienjieH = CGFloat(lines)*height+2 | |
| 203 | 211 | }else{ |
| 204 | 212 | //大于2行, 显示2行 |
| 205 | - self.jianjieLabel.height = 2*height | |
| 213 | + jienjieH = 2*height+2 | |
| 206 | 214 | } |
| 215 | + self.jianjieLabel.numberOfLines = 2 | |
| 216 | + } | |
| 217 | + self.expandBtn.isSelected = model.vitae!.isExpand | |
| 218 | + self.jianjieLabel.snp.remakeConstraints { make in | |
| 219 | + make.top.equalTo(self.myIdentityTitleLabel.snp.bottom).offset(10) | |
| 220 | + make.left.equalTo(self.nameIconImgView.snp.right).offset(10) | |
| 221 | + make.right.equalToSuperview().offset(-20) | |
| 222 | + make.height.equalTo(jienjieH) | |
| 207 | 223 | } |
| 224 | + self.expandBtn.top = self.jianjieLabel.top+jienjieH | |
| 225 | + | |
| 208 | 226 | } |
| 209 | 227 | |
| 210 | 228 | |
| ... | ... | @@ -213,17 +231,24 @@ class CNLiveDigitalResumePreviewSixCell: UITableViewCell { |
| 213 | 231 | button.isSelected = !button.isSelected |
| 214 | 232 | let lines = jianjieLabel.getRealLabelTextLines() |
| 215 | 233 | let height = jianjieLabel.qmui_lineHeight |
| 216 | - | |
| 234 | + | |
| 235 | + var jienjieH:CGFloat = 0 | |
| 217 | 236 | if button.isSelected{ |
| 218 | 237 | //文本收起状态,点击展开 |
| 219 | - self.jianjieLabel.height = CGFloat(lines)*height | |
| 238 | + jienjieH = CGFloat(lines)*height | |
| 220 | 239 | }else{ |
| 221 | 240 | //文本展开状态,点击收起 |
| 222 | - self.jianjieLabel.height = 2*height | |
| 241 | + jienjieH = 2*height+2 | |
| 242 | + } | |
| 243 | + self.jianjieLabel.snp.remakeConstraints { make in | |
| 244 | + make.top.equalTo(self.myIdentityTitleLabel.snp.bottom).offset(10) | |
| 245 | + make.left.equalTo(self.nameIconImgView.snp.right).offset(10) | |
| 246 | + make.right.equalToSuperview().offset(-20) | |
| 247 | + make.height.equalTo(jienjieH) | |
| 223 | 248 | } |
| 224 | - self.vitaePreviewSixCellChangedBlock!(self, self.jianjieLabel.bottom) | |
| 249 | + self.vitaePreviewSixCellChangedBlock!(self, self.jianjieLabel.top + jienjieH, button.isSelected) | |
| 225 | 250 | |
| 226 | - self.expandBtn.top = self.jianjieLabel.bottom | |
| 251 | + self.expandBtn.top = self.jianjieLabel.top + jienjieH | |
| 227 | 252 | |
| 228 | 253 | } |
| 229 | 254 | @objc func zhengshuBtnAction(){ | ... | ... |
metaCode/Classes/Main/Model/Vitae/CNLiveViateWorkModelLayout.swift
| ... | ... | @@ -24,8 +24,9 @@ class CNLiveViateWorkModelLayout:NSObject{ |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - init(model:CNLiveVitaeWorksModel,descH:Float,isPreview:Bool){ | |
| 27 | + init(model:CNLiveVitaeWorksModel,descH:Float,isPreview:Bool,isExpand:Bool){ | |
| 28 | 28 | super.init() |
| 29 | + model.isExpand = isExpand | |
| 29 | 30 | self.workModel = model |
| 30 | 31 | let imgArr = model.imgs.components(separatedBy: ",") |
| 31 | 32 | var hang:Float = 1 |
| ... | ... | @@ -81,8 +82,9 @@ class CNLiveViateAwardModelLayout:NSObject{ |
| 81 | 82 | } |
| 82 | 83 | } |
| 83 | 84 | |
| 84 | - init(model:CNLiveVitaeAwardsModel,descH:Float,isPreview:Bool){ | |
| 85 | + init(model:CNLiveVitaeAwardsModel,descH:Float,isPreview:Bool,isExpand:Bool){ | |
| 85 | 86 | super.init() |
| 87 | + model.isExpand = isExpand | |
| 86 | 88 | self.awardModel = model |
| 87 | 89 | let imgArr = model.imgs.components(separatedBy: ",") |
| 88 | 90 | var hang:Float = 1 | ... | ... |
metaCode/Classes/Main/Model/Vitae/CNLiveVitaeModel.swift
| ... | ... | @@ -47,6 +47,7 @@ class CNLiveVitaeVitaeModel:BaseModel{ |
| 47 | 47 | var showAwards:Bool = false |
| 48 | 48 | /// |
| 49 | 49 | var updateTime:String = "" |
| 50 | + var isExpand:Bool = false//自我介绍是否展开 | |
| 50 | 51 | } |
| 51 | 52 | //简历身份模块 |
| 52 | 53 | class CNLiveVitaeIdentitiesModel:BaseModel{ |
| ... | ... | @@ -106,6 +107,7 @@ class CNLiveVitaeWorksModel:BaseModel{ |
| 106 | 107 | |
| 107 | 108 | ///cell高度 |
| 108 | 109 | var cellH: Float = 0 |
| 110 | + var isExpand:Bool = false//是否展开 | |
| 109 | 111 | |
| 110 | 112 | } |
| 111 | 113 | |
| ... | ... | @@ -156,6 +158,7 @@ class CNLiveVitaeAwardsModel:BaseModel{ |
| 156 | 158 | |
| 157 | 159 | ///cell高度 |
| 158 | 160 | var cellH: Float = 0 |
| 161 | + var isExpand:Bool = false//是否展开 | |
| 159 | 162 | } |
| 160 | 163 | /** |
| 161 | 164 | "data": { | ... | ... |