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

// 人脉

parent e5c35982
......@@ -195,6 +195,7 @@ extension YHPeopleViewController: JXSegmentedListContainerViewListDelegate {
extension YHPeopleViewController: YHMatchProtocol {
func startMatchUsers() {
self.headLottieView.isHidden = true
self.launchLottieView.isHidden = false
self.launchLottieView.loopMode = .playOnce
self.launchLottieView.play {
[weak self] completed in
......@@ -213,8 +214,6 @@ extension YHPeopleViewController {
self.viewModel.getMatchUserlist {
success, error in
self.rotateLottieView.stop()
if success, self.viewModel.matchUserArr.count > 0 {
let vc = YHMatchPeopleViewController()
vc.delegate = self
......
......@@ -10,6 +10,7 @@ import UIKit
class YHExperienceItemView: UIView {
static let detailFont = UIFont.PFSC_R(ofSize:14)
lazy var titleLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor50
......@@ -22,8 +23,9 @@ class YHExperienceItemView: UIView {
let label = UILabel()
label.textColor = UIColor.mainTextColor70
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.font = Self.detailFont
label.text = "填写最近一份工作经验"
label.numberOfLines = 0
return label
}()
......@@ -43,12 +45,12 @@ class YHExperienceItemView: UIView {
make.left.equalTo(0)
make.width.equalTo(56)
make.height.equalTo(20)
make.centerY.equalToSuperview()
make.top.equalToSuperview()
}
self.detailLabel.snp.makeConstraints { make in
make.left.equalTo(self.titleLabel.snp.right).offset(56)
make.right.equalToSuperview()
make.centerY.equalToSuperview()
make.top.bottom.equalToSuperview()
}
}
}
......@@ -67,36 +69,80 @@ class YHMyWorkExperienceCell: UITableViewCell {
self.companyView.detailLabel.textColor = UIColor.mainTextColor70
self.professionView.detailLabel.textColor = UIColor.mainTextColor70
self.industryView.detailLabel.textColor = UIColor.mainTextColor70
/* 公司文字处理 */
var text1 = ""
if !self.userModel.companyName.isEmpty {
self.companyView.detailLabel.text = self.userModel.companyName
text1 = self.userModel.companyName
self.companyView.isHidden = false
} else {
self.companyView.detailLabel.text = ""
if self.userModel.isCurrentUser {
text1 = ""
if self.userModel.isCurrentUser { // 当前用户要展示默认文案
self.companyView.detailLabel.textColor = UIColor.mainTextColor30
self.companyView.detailLabel.text = "请填写最近一份工作经历"
text1 = "请填写最近一份工作经历"
}
}
self.companyView.detailLabel.text = text1
self.companyView.isHidden = text1.isEmpty
var itemView1Height = 0.0
var top1Margin = 0.0
if !text1.isEmpty {
itemView1Height = self.getHeight(text: text1, font: YHExperienceItemView.detailFont, width: KScreenWidth-16.0*4-56.0*2)
top1Margin = 12
}
companyView.snp.updateConstraints { make in
make.height.equalTo(itemView1Height)
make.top.equalTo(self.titleLabel.snp.bottom).offset(top1Margin)
}
/* 职位文字处理 */
var text2 = ""
if !self.userModel.position.isEmpty {
self.professionView.detailLabel.text = self.userModel.position
text2 = self.userModel.position
self.professionView.isHidden = false
} else {
self.professionView.detailLabel.text = ""
if self.userModel.isCurrentUser {
if self.userModel.isCurrentUser { // 当前用户要展示默认文案
self.professionView.detailLabel.textColor = UIColor.mainTextColor30
self.professionView.detailLabel.text = "请填写最近一份工作经历"
text2 = "请填写最近一份工作经历"
}
}
self.professionView.detailLabel.text = text2
self.professionView.isHidden = text2.isEmpty
var itemView2Height = 0.0
var top2Margin = 0.0
if !text2.isEmpty {
itemView2Height = self.getHeight(text: text2, font: YHExperienceItemView.detailFont, width: KScreenWidth-16.0*4-56.0*2)
top2Margin = 14
}
professionView.snp.updateConstraints { make in
make.height.equalTo(itemView2Height)
make.top.equalTo(self.companyView.snp.bottom).offset(top2Margin)
}
/* 行业文字处理 */
var text3 = ""
if !self.userModel.industry.isEmpty {
self.industryView.detailLabel.text = self.userModel.industry
text3 = self.userModel.industry
self.industryView.isHidden = false
} else {
self.industryView.detailLabel.text = ""
if self.userModel.isCurrentUser {
if self.userModel.isCurrentUser { // 当前用户要展示默认文案
self.industryView.detailLabel.textColor = UIColor.mainTextColor30
self.industryView.detailLabel.text = "请填写最近一份工作经历"
text3 = "请填写最近一份工作经历"
}
}
self.industryView.detailLabel.text = text3
self.industryView.isHidden = text3.isEmpty
var itemView3Height = 0.0
var top3Margin = 0.0
if !text3.isEmpty {
itemView3Height = self.getHeight(text: text3, font: YHExperienceItemView.detailFont, width: KScreenWidth-16.0*4-56.0*2)
top3Margin = 14
}
industryView.snp.updateConstraints { make in
make.height.equalTo(itemView3Height)
make.top.equalTo(self.professionView.snp.bottom).offset(top3Margin)
}
if self.userModel.isCurrentUser {
self.hiddenBtn.isHidden = self.userModel.isHiddenWorkExperience
......@@ -104,6 +150,8 @@ class YHMyWorkExperienceCell: UITableViewCell {
} else {
self.hiddenBtn.isHidden = true
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
......@@ -236,6 +284,13 @@ class YHMyWorkExperienceCell: UITableViewCell {
}
}
func getHeight(text:String, font:UIFont, width:CGFloat)->CGFloat {
let size = CGSize.init(width:width , height: CGFloat(MAXFLOAT))
let dic = [NSAttributedString.Key.font: font]
let strSize = text.boundingRect(with: size, options: [.usesLineFragmentOrigin], attributes: dic, context:nil).size
return CGSizeMake(strSize.width, ceil(strSize.height)).height
}
@objc func edit() {
if let block = editBlock {
......
......@@ -50,7 +50,7 @@ class YHNameCardInfoView: DragCardView {
let detail = self.userModel.signature
self.detailLabel.text = detail
self.grayContentView.isHidden = detail.isEmpty
var detailHeight = self.getHeight(text: detail, font: self.detailLabel.font!, width: Self.width-18.0*2-16.0*2)
var detailHeight = self.getHeight(text: detail, font: UIFont.PFSC_R(ofSize:13), width: Self.width-18.0*2-16.0*2)
if detailHeight < 20.0 {
detailHeight = 20.0
} else if detailHeight > 40.0 {
......@@ -70,6 +70,8 @@ class YHNameCardInfoView: DragCardView {
self.bottomBtn.backgroundColor = .brandMainColor
self.bottomBtn.isUserInteractionEnabled = true
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
......@@ -250,19 +252,13 @@ class YHNameCardInfoView: DragCardView {
make.right.equalTo(-18)
make.height.equalTo(46)
make.bottom.equalToSuperview().offset(-30)
}
}
func getHeight(text:String, font:UIFont, width:CGFloat)->CGFloat {
let attributes = [NSAttributedString.Key.font: font] as [NSAttributedString.Key : Any]
let boundingSize = (text as NSString).boundingRect(
with: CGSize(width: width, height: .greatestFiniteMagnitude),
options: .usesLineFragmentOrigin,
attributes: attributes,
context: nil
).size
let textHeight = ceill(boundingSize.height)
return textHeight
let size = CGSize.init(width:width , height: CGFloat(MAXFLOAT))
let dic = [NSAttributedString.Key.font: font]
let strSize = text.boundingRect(with: size, options: [.usesLineFragmentOrigin], attributes: dic, context:nil).size
return CGSizeMake(strSize.width, ceil(strSize.height)).height
}
}
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