Commit bbffdffa authored by Steven杜宇's avatar Steven杜宇

// 人脉

parent dedb5ec0
......@@ -121,9 +121,21 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
if 0 <= indexPath.section && indexPath.section < self.cardInfoArr.count {
let cardInfo = self.cardInfoArr[indexPath.section]
if cardInfo.type == .avatar {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyNameCardAvatarInfoCell.cellReuseIdentifier, for: indexPath) as! YHMyNameCardAvatarInfoCell
cell.userModel = cardInfo
cell.editBlock = { [weak self] in
guard let self = self else { return }
let vc = YHEditBaseUserInfoViewController()
vc.model = self.viewModel.nameCardInfo
self.navigationController?.pushViewController(vc)
}
return cell
}
if cardInfo.type == .honor || cardInfo.type == .introduce {
let introCell = tableView.dequeueReusableCell(withIdentifier: YHMyIntroductionCell.cellReuseIdentifier, for: indexPath) as! YHMyIntroductionCell
introCell.userModel = self.viewModel.nameCardInfo
introCell.userModel = cardInfo
introCell.editBlock = { [weak self] in
guard let self = self else { return }
if cardInfo.type == .honor {
......@@ -141,7 +153,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
if cardInfo.type == .education {
let eduCell = tableView.dequeueReusableCell(withIdentifier: YHMyEducationCell.cellReuseIdentifier, for: indexPath) as! YHMyEducationCell
eduCell.userModel = self.viewModel.nameCardInfo
eduCell.userModel = cardInfo
eduCell.editBlock = { [weak self] in
guard let self = self else { return }
let vc = YHEditSchoolViewController()
......@@ -153,7 +165,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
if cardInfo.type == .workExperience {
let workCell = tableView.dequeueReusableCell(withIdentifier: YHMyWorkExperienceCell.cellReuseIdentifier, for: indexPath) as! YHMyWorkExperienceCell
workCell.userModel = self.viewModel.nameCardInfo
workCell.userModel = cardInfo
workCell.editBlock = { [weak self] in
guard let self = self else { return }
let vc = YHEditWorkViewController()
......@@ -165,7 +177,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
if cardInfo.type == .topics {
let topicCell = tableView.dequeueReusableCell(withIdentifier: YHMyInterestTopicCell.cellReuseIdentifier, for: indexPath) as! YHMyInterestTopicCell
topicCell.userModel = self.viewModel.nameCardInfo
topicCell.userModel = cardInfo
topicCell.editBlock = { [weak self] in
guard let self = self else { return }
let vc = YHEditInterestViewController()
......@@ -176,15 +188,8 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
}
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyNameCardAvatarInfoCell.cellReuseIdentifier, for: indexPath) as! YHMyNameCardAvatarInfoCell
cell.userModel = self.viewModel.nameCardInfo
cell.editBlock = { [weak self] in
guard let self = self else { return }
let vc = YHEditBaseUserInfoViewController()
vc.model = self.viewModel.nameCardInfo
self.navigationController?.pushViewController(vc)
}
return cell
let defaultCell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
return defaultCell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
......
......@@ -15,6 +15,8 @@ class YHMyEducationCell: UITableViewCell {
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet {
self.editBtn.isHidden = !self.userModel.isCurrentUser
self.collegeLabel.textColor = UIColor.mainTextColor
self.detailLabel.textColor = UIColor.mainTextColor70
......
......@@ -55,6 +55,8 @@ class YHMyInterestTopicCell: UITableViewCell {
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet {
self.editBtn.isHidden = !self.userModel.isCurrentUser
var isShowList = true
if self.userModel.isCurrentUser {
if self.topicArr.count <= 0 {
......@@ -149,7 +151,7 @@ class YHMyInterestTopicCell: UITableViewCell {
lazy var detailLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor70
label.textColor = UIColor.mainTextColor30
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0
......
......@@ -15,6 +15,9 @@ class YHMyIntroductionCell: UITableViewCell {
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet {
self.editBtn.isHidden = !self.userModel.isCurrentUser
if userModel.type == .introduce {
self.titleLabel.text = "个人简介"
self.detailLabel.textColor = UIColor.mainTextColor70
......@@ -93,8 +96,6 @@ class YHMyIntroductionCell: UITableViewCell {
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
detailLabel.text = "拥有超过十年的互联网行业经验,目前担任某知名科技公司的高级产品经理。成功领导并推动了多个产品的上线与迭代,赢得了业界和用户的广泛认可。"
self.contentView.addSubview(self.cardView)
cardView.addSubview(self.titleLabel)
cardView.addSubview(self.detailLabel)
......
......@@ -17,6 +17,9 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
let headWidth = 74.0
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet {
self.editBtn.isHidden = !self.userModel.isCurrentUser
if let url = URL(string: self.userModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
}
......
......@@ -61,27 +61,40 @@ class YHMyWorkExperienceCell: UITableViewCell {
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet {
self.companyView.detailLabel.text = self.userModel.companyName
self.professionView.detailLabel.text = self.userModel.position
self.industryView.detailLabel.text = self.userModel.industry
self.editBtn.isHidden = !self.userModel.isCurrentUser
self.companyView.isHidden = self.userModel.companyName.isEmpty
self.professionView.isHidden = self.userModel.position.isEmpty
self.industryView.isHidden = self.userModel.industry.isEmpty
let companyHeight = self.userModel.companyName.isEmpty ? 0.0 : 20
self.companyView.snp.updateConstraints { make in
make.height.equalTo(companyHeight)
self.companyView.detailLabel.textColor = UIColor.mainTextColor70
self.professionView.detailLabel.textColor = UIColor.mainTextColor70
self.industryView.detailLabel.textColor = UIColor.mainTextColor70
if !self.userModel.companyName.isEmpty {
self.companyView.detailLabel.text = self.userModel.companyName
} else {
self.companyView.detailLabel.text = ""
if self.userModel.isCurrentUser {
self.companyView.detailLabel.textColor = UIColor.mainTextColor30
self.companyView.detailLabel.text = "请填写最近一份工作经历"
}
}
let positionHeight = self.userModel.position.isEmpty ? 0.0 : 20
self.professionView.snp.updateConstraints { make in
make.height.equalTo(positionHeight)
if !self.userModel.position.isEmpty {
self.professionView.detailLabel.text = self.userModel.position
} else {
self.professionView.detailLabel.text = ""
if self.userModel.isCurrentUser {
self.professionView.detailLabel.textColor = UIColor.mainTextColor30
self.professionView.detailLabel.text = "请填写最近一份工作经历"
}
}
let industryHeight = self.userModel.industry.isEmpty ? 0.0 : 20
self.industryView.snp.updateConstraints { make in
make.height.equalTo(industryHeight)
if !self.userModel.industry.isEmpty {
self.industryView.detailLabel.text = self.userModel.industry
} else {
self.industryView.detailLabel.text = ""
if self.userModel.isCurrentUser {
self.industryView.detailLabel.textColor = UIColor.mainTextColor30
self.industryView.detailLabel.text = "请填写最近一份工作经历"
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment