Commit ca303a56 authored by David黄金龙's avatar David黄金龙

Merge branch '630-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into 630-dev

* '630-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  //  默认icon
  //  人脉
  //  我的名片
  //  计算collecitonView高度
  提醒更换
parents f47888de 89bf1483
This diff is collapsed.
...@@ -134,7 +134,7 @@ class YHCommunityViewController: YHBaseViewController { ...@@ -134,7 +134,7 @@ class YHCommunityViewController: YHBaseViewController {
let vc = YHActivityListViewController() let vc = YHActivityListViewController()
arrItemVCs.append(vc) arrItemVCs.append(vc)
} else { } else {
let vc = YHPeopleViewController() let vc = YHMatchUserViewController()
arrItemVCs.append(vc) arrItemVCs.append(vc)
} }
} }
......
...@@ -13,7 +13,7 @@ protocol YHMatchProtocol: NSObjectProtocol { ...@@ -13,7 +13,7 @@ protocol YHMatchProtocol: NSObjectProtocol {
func startMatchUsers() func startMatchUsers()
} }
class YHMatchPeopleViewController: YHBaseViewController { class YHMatchResultListViewController: YHBaseViewController {
let viewModel = YHMatchUserViewModel() let viewModel = YHMatchUserViewModel()
let loginViewModel = YHLoginViewModel() let loginViewModel = YHLoginViewModel()
...@@ -159,7 +159,7 @@ class YHMatchPeopleViewController: YHBaseViewController { ...@@ -159,7 +159,7 @@ class YHMatchPeopleViewController: YHBaseViewController {
} }
if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty { if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty {
let vc = YHMyNameCardViewController() let vc = YHNameCardViewController()
vc.userId = userId vc.userId = userId
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} else { } else {
...@@ -170,7 +170,7 @@ class YHMatchPeopleViewController: YHBaseViewController { ...@@ -170,7 +170,7 @@ class YHMatchPeopleViewController: YHBaseViewController {
guard let self = self else { return } guard let self = self else { return }
if !uid.isEmpty { if !uid.isEmpty {
YHLoginManager.shared.userModel?.id = uid YHLoginManager.shared.userModel?.id = uid
let vc = YHMyNameCardViewController() let vc = YHNameCardViewController()
vc.userId = uid vc.userId = uid
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
...@@ -347,7 +347,7 @@ class YHMatchPeopleViewController: YHBaseViewController { ...@@ -347,7 +347,7 @@ class YHMatchPeopleViewController: YHBaseViewController {
} }
} }
extension YHMatchPeopleViewController: DragCardDataSource { extension YHMatchResultListViewController: DragCardDataSource {
public func numberOfCards(_ dragCard: DragCardContainer) -> Int { public func numberOfCards(_ dragCard: DragCardContainer) -> Int {
return matchUsersArr.count return matchUsersArr.count
...@@ -384,7 +384,7 @@ extension YHMatchPeopleViewController: DragCardDataSource { ...@@ -384,7 +384,7 @@ extension YHMatchPeopleViewController: DragCardDataSource {
} }
} }
extension YHMatchPeopleViewController: DragCardDelegate { extension YHMatchResultListViewController: DragCardDelegate {
public func dragCard(_ dragCard: DragCardContainer, displayTopCardAt index: Int, with cardView: DragCardView) { public func dragCard(_ dragCard: DragCardContainer, displayTopCardAt index: Int, with cardView: DragCardView) {
print("displayTopCardAt: \(index)") print("displayTopCardAt: \(index)")
......
...@@ -10,7 +10,7 @@ import UIKit ...@@ -10,7 +10,7 @@ import UIKit
import JXSegmentedView import JXSegmentedView
import Lottie import Lottie
class YHPeopleViewController: YHBaseViewController { class YHMatchUserViewController: YHBaseViewController {
let viewModel = YHMatchUserViewModel() let viewModel = YHMatchUserViewModel()
var informationAuthorizeViewModel: YHInformationAuthorizeViewModel = YHInformationAuthorizeViewModel() var informationAuthorizeViewModel: YHInformationAuthorizeViewModel = YHInformationAuthorizeViewModel()
...@@ -186,13 +186,13 @@ class YHPeopleViewController: YHBaseViewController { ...@@ -186,13 +186,13 @@ class YHPeopleViewController: YHBaseViewController {
} }
} }
extension YHPeopleViewController: JXSegmentedListContainerViewListDelegate { extension YHMatchUserViewController: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView { func listView() -> UIView {
return view return view
} }
} }
extension YHPeopleViewController: YHMatchProtocol { extension YHMatchUserViewController: YHMatchProtocol {
func startMatchUsers() { func startMatchUsers() {
self.headLottieView.isHidden = true self.headLottieView.isHidden = true
self.launchLottieView.isHidden = false self.launchLottieView.isHidden = false
...@@ -209,13 +209,13 @@ extension YHPeopleViewController: YHMatchProtocol { ...@@ -209,13 +209,13 @@ extension YHPeopleViewController: YHMatchProtocol {
} }
} }
extension YHPeopleViewController { extension YHMatchUserViewController {
func requestMatchUserList() { func requestMatchUserList() {
self.viewModel.getMatchUserlist { self.viewModel.getMatchUserlist {
success, error in success, error in
if success, self.viewModel.matchUserArr.count > 0 { if success, self.viewModel.matchUserArr.count > 0 {
let vc = YHMatchPeopleViewController() let vc = YHMatchResultListViewController()
vc.delegate = self vc.delegate = self
vc.matchUsersArr = self.viewModel.matchUserArr vc.matchUsersArr = self.viewModel.matchUserArr
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
......
...@@ -151,7 +151,7 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource { ...@@ -151,7 +151,7 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
if indexPath.section == 1 { if indexPath.section == 1 {
if 0 <= indexPath.row && indexPath.row < friendsArr.count { if 0 <= indexPath.row && indexPath.row < friendsArr.count {
let friend = self.friendsArr[indexPath.row] let friend = self.friendsArr[indexPath.row]
let vc = YHMyNameCardViewController() let vc = YHNameCardViewController()
vc.userId = friend.yhId vc.userId = friend.yhId
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import UIKit import UIKit
class YHMyNameCardViewController: YHBaseViewController { class YHNameCardViewController: YHBaseViewController {
var userId: String = "" var userId: String = ""
var cardInfoArr:[YHUserNameCardInfo] = [] var cardInfoArr:[YHUserNameCardInfo] = []
...@@ -46,7 +46,7 @@ class YHMyNameCardViewController: YHBaseViewController { ...@@ -46,7 +46,7 @@ class YHMyNameCardViewController: YHBaseViewController {
lazy var navBar: YHCustomNavigationBar = { lazy var navBar: YHCustomNavigationBar = {
let bar = YHCustomNavigationBar.navBar() let bar = YHCustomNavigationBar.navBar()
bar.backgroundColor = .clear bar.backgroundColor = .clear
bar.title = "我的名片" bar.title = self.isCurrentUser ? "我的名片" : "好友名片"
bar.titleColor = .white bar.titleColor = .white
bar.rightButton.setImage(UIImage(named: "people_card_authorized"), for: .normal) bar.rightButton.setImage(UIImage(named: "people_card_authorized"), for: .normal)
bar.rightButton.setTitle("授权", for: .normal) bar.rightButton.setTitle("授权", for: .normal)
...@@ -111,7 +111,7 @@ class YHMyNameCardViewController: YHBaseViewController { ...@@ -111,7 +111,7 @@ class YHMyNameCardViewController: YHBaseViewController {
} }
} }
extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource { extension YHNameCardViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
return self.cardInfoArr.count return self.cardInfoArr.count
...@@ -230,7 +230,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource ...@@ -230,7 +230,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
} }
extension YHMyNameCardViewController { extension YHNameCardViewController {
func requestAuthorization() { func requestAuthorization() {
self.authorModel.requestUserAuthorization { success, error in self.authorModel.requestUserAuthorization { success, error in
...@@ -258,18 +258,21 @@ extension YHMyNameCardViewController { ...@@ -258,18 +258,21 @@ extension YHMyNameCardViewController {
self.cardInfoArr.removeAll() self.cardInfoArr.removeAll()
// 姓名头像信息
let model1 = YHUserNameCardInfo() let model1 = YHUserNameCardInfo()
model1.type = .avatar model1.type = .avatar
model1.isCurrentUser = self.isCurrentUser model1.isCurrentUser = self.isCurrentUser
model1.updateModel(self.viewModel.nameCardInfo) model1.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model1) self.cardInfoArr.append(model1)
// 个人简介信息
let model2 = YHUserNameCardInfo() let model2 = YHUserNameCardInfo()
model2.type = .introduce model2.type = .introduce
model2.isCurrentUser = self.isCurrentUser model2.isCurrentUser = self.isCurrentUser
model2.updateModel(self.viewModel.nameCardInfo) model2.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model2) self.cardInfoArr.append(model2)
// 教育经历信息
if !self.isCurrentUser { if !self.isCurrentUser {
if !self.viewModel.nameCardInfo.isHiddenEducation { if !self.viewModel.nameCardInfo.isHiddenEducation {
let model3 = YHUserNameCardInfo() let model3 = YHUserNameCardInfo()
...@@ -286,6 +289,8 @@ extension YHMyNameCardViewController { ...@@ -286,6 +289,8 @@ extension YHMyNameCardViewController {
self.cardInfoArr.append(model3) self.cardInfoArr.append(model3)
} }
// 工作经历信息
if !self.isCurrentUser { if !self.isCurrentUser {
if !self.viewModel.nameCardInfo.isHiddenWorkExperience { if !self.viewModel.nameCardInfo.isHiddenWorkExperience {
let model4 = YHUserNameCardInfo() let model4 = YHUserNameCardInfo()
...@@ -302,12 +307,14 @@ extension YHMyNameCardViewController { ...@@ -302,12 +307,14 @@ extension YHMyNameCardViewController {
self.cardInfoArr.append(model4) self.cardInfoArr.append(model4)
} }
// 荣誉奖项信息
let model5 = YHUserNameCardInfo() let model5 = YHUserNameCardInfo()
model5.type = .honor model5.type = .honor
model5.isCurrentUser = self.isCurrentUser model5.isCurrentUser = self.isCurrentUser
model5.updateModel(self.viewModel.nameCardInfo) model5.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model5) self.cardInfoArr.append(model5)
// 兴趣话题
let model6 = YHUserNameCardInfo() let model6 = YHUserNameCardInfo()
model6.type = .topics model6.type = .topics
model6.isCurrentUser = self.isCurrentUser model6.isCurrentUser = self.isCurrentUser
......
...@@ -43,6 +43,8 @@ class YHAddFriendCardCell: UITableViewCell { ...@@ -43,6 +43,8 @@ class YHAddFriendCardCell: UITableViewCell {
didSet { didSet {
if let url = URL(string: self.friendModel.avatar) { if let url = URL(string: self.friendModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default")) self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
} else {
self.headImgV.image = UIImage(named: "people_head_default")
} }
self.nameLabel.text = self.friendModel.username self.nameLabel.text = self.friendModel.username
self.professionalLabel.text = self.friendModel.position self.professionalLabel.text = self.friendModel.position
......
...@@ -18,6 +18,8 @@ class YHFriendRequestView: UIView { ...@@ -18,6 +18,8 @@ class YHFriendRequestView: UIView {
didSet { didSet {
if let url = URL(string: self.userModel.avatar) { if let url = URL(string: self.userModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default")) self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
} else {
self.headImgV.image = UIImage(named: "people_head_default")
} }
self.nameLabel.text = self.userModel.username self.nameLabel.text = self.userModel.username
self.professionalLabel.text = self.userModel.position self.professionalLabel.text = self.userModel.position
......
...@@ -13,6 +13,7 @@ class YHInterestTopicLayout: UICollectionViewFlowLayout { ...@@ -13,6 +13,7 @@ class YHInterestTopicLayout: UICollectionViewFlowLayout {
var dataSource:[String] = [] var dataSource:[String] = []
weak var layoutDelegate: UICollectionViewDelegateFlowLayout? = nil weak var layoutDelegate: UICollectionViewDelegateFlowLayout? = nil
var interItemSpacing: CGFloat = 12.0 // 相邻单元格之间的水平间距 var interItemSpacing: CGFloat = 12.0 // 相邻单元格之间的水平间距
var collectionViewWidth = KScreenWidth-16.0*4
override func prepare() { override func prepare() {
super.prepare() super.prepare()
self.minimumInteritemSpacing = 12 self.minimumInteritemSpacing = 12
...@@ -35,7 +36,7 @@ class YHInterestTopicLayout: UICollectionViewFlowLayout { ...@@ -35,7 +36,7 @@ class YHInterestTopicLayout: UICollectionViewFlowLayout {
let originX = prevLayout.frame.maxX let originX = prevLayout.frame.maxX
//如果当 (上一个cell的最右边X + 我们想要的间距 + 当前cell的宽度 + 区边距) 依然在contentSize中 (小于屏幕宽度),我们改变当前cell的原点位置 //如果当 (上一个cell的最右边X + 我们想要的间距 + 当前cell的宽度 + 区边距) 依然在contentSize中 (小于屏幕宽度),我们改变当前cell的原点位置
//判断 当前cell的 maxX 是否超出屏幕 //判断 当前cell的 maxX 是否超出屏幕
if((CGFloat(originX) + CGFloat(maximumSpacing) + currentLayout.frame.size.width) + self.sectionInset.right < self.collectionViewContentSize.width) { if((CGFloat(originX) + CGFloat(maximumSpacing) + currentLayout.frame.size.width) + self.sectionInset.right < self.collectionViewWidth) {
var frame = currentLayout.frame var frame = currentLayout.frame
frame.origin.x = CGFloat(originX) + CGFloat(maximumSpacing) frame.origin.x = CGFloat(originX) + CGFloat(maximumSpacing)
currentLayout.frame = frame currentLayout.frame = frame
...@@ -53,9 +54,8 @@ class YHInterestTopicLayout: UICollectionViewFlowLayout { ...@@ -53,9 +54,8 @@ class YHInterestTopicLayout: UICollectionViewFlowLayout {
override var collectionViewContentSize: CGSize { override var collectionViewContentSize: CGSize {
get { get {
let width = self.collectionView?.width ?? 0.0
let height = self.calculateHeight() let height = self.calculateHeight()
return CGSize(width: width, height: height) return CGSize(width: self.collectionViewWidth, height: height)
} }
} }
...@@ -79,13 +79,14 @@ class YHInterestTopicLayout: UICollectionViewFlowLayout { ...@@ -79,13 +79,14 @@ class YHInterestTopicLayout: UICollectionViewFlowLayout {
height = itemHeight height = itemHeight
} else { } else {
let targetX = currentX + self.minimumInteritemSpacing + size.width let targetX = currentX + self.minimumInteritemSpacing + size.width
if targetX <= self.collectionView!.width { if targetX <= self.collectionViewWidth {
currentX = targetX currentX = targetX
} else { } else {
currentX = 0 currentX = size.width
height += self.minimumLineSpacing + itemHeight height += self.minimumLineSpacing + itemHeight
} }
} }
printLog("calcaulte: \(height)")
} }
} }
return height return height
......
...@@ -16,6 +16,8 @@ class YHMyFriendsCell: UITableViewCell { ...@@ -16,6 +16,8 @@ class YHMyFriendsCell: UITableViewCell {
didSet { didSet {
if let url = URL(string: self.friendModel.avatar) { if let url = URL(string: self.friendModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default")) self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
} else {
self.headImgV.image = UIImage(named: "people_head_default")
} }
self.nameLabel.text = self.friendModel.username self.nameLabel.text = self.friendModel.username
self.professionalLabel.text = self.friendModel.position self.professionalLabel.text = self.friendModel.position
......
...@@ -64,26 +64,34 @@ class YHMyInterestTopicCell: UITableViewCell { ...@@ -64,26 +64,34 @@ class YHMyInterestTopicCell: UITableViewCell {
self.collectionView.isHidden = !isShowList self.collectionView.isHidden = !isShowList
self.detailLabel.isHidden = isShowList self.detailLabel.isHidden = isShowList
self.topicArr.removeAll()
if self.userModel.topics.count > 0 {
self.topicArr.append(contentsOf: self.userModel.topics)
}
self.layout.dataSource = self.topicArr
self.layout.invalidateLayout()
self.collectionView.reloadData()
let height = self.layout.collectionViewContentSize.height
printLog("ABC: \(height)")
if isShowList { if isShowList {
self.topicArr.removeAll() self.collectionView.snp.remakeConstraints { make in
if self.userModel.topics.count > 0 { make.height.equalTo(height)
self.topicArr.append(contentsOf: self.userModel.topics) make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-16)
make.top.equalTo(self.titleLabel.snp.bottom).offset(12)
} }
self.layout.dataSource = self.topicArr self.detailLabel.snp.remakeConstraints { make in
self.collectionView.reloadData { make.left.equalTo(16)
let height = self.layout.collectionViewContentSize.height make.right.equalTo(-16)
printLog("ABC: \(height)") make.top.equalTo(titleLabel.snp.bottom).offset(12)
self.collectionView.snp.remakeConstraints { make in
make.height.equalTo(height)
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-16)
make.top.equalTo(self.titleLabel.snp.bottom).offset(12)
}
} }
self.setNeedsLayout()
self.layoutIfNeeded()
self.detailLabel.snp.removeConstraints()
} else { } else {
...@@ -93,7 +101,12 @@ class YHMyInterestTopicCell: UITableViewCell { ...@@ -93,7 +101,12 @@ class YHMyInterestTopicCell: UITableViewCell {
make.bottom.equalTo(-16) make.bottom.equalTo(-16)
make.top.equalTo(titleLabel.snp.bottom).offset(12) make.top.equalTo(titleLabel.snp.bottom).offset(12)
} }
self.collectionView.snp.removeConstraints() self.collectionView.snp.remakeConstraints { make in
make.height.equalTo(height)
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(self.titleLabel.snp.bottom).offset(12)
}
} }
self.setNeedsLayout() self.setNeedsLayout()
self.layoutIfNeeded() self.layoutIfNeeded()
...@@ -130,18 +143,15 @@ class YHMyInterestTopicCell: UITableViewCell { ...@@ -130,18 +143,15 @@ class YHMyInterestTopicCell: UITableViewCell {
layout.scrollDirection = .vertical layout.scrollDirection = .vertical
layout.dataSource = self.topicArr layout.dataSource = self.topicArr
layout.layoutDelegate = self layout.layoutDelegate = self
layout.collectionViewWidth = KScreenWidth-16.0*4
return layout return layout
}() }()
lazy var collectionView: UICollectionView = { lazy var collectionView: UICollectionView = {
// 创建集合视图布局
// 创建集合视图
let collectView = UICollectionView(frame:.zero, collectionViewLayout: self.layout) let collectView = UICollectionView(frame:.zero, collectionViewLayout: self.layout)
collectView.delegate = self collectView.delegate = self
collectView.dataSource = self collectView.dataSource = self
collectView.backgroundColor = .white collectView.backgroundColor = .white
// 注册自定义单元格
collectView.register(YHTopicItemCell.self, forCellWithReuseIdentifier: YHTopicItemCell.cellReuseIdentifier) collectView.register(YHTopicItemCell.self, forCellWithReuseIdentifier: YHTopicItemCell.cellReuseIdentifier)
return collectView return collectView
}() }()
......
...@@ -24,6 +24,8 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -24,6 +24,8 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
if let url = URL(string: self.userModel.avatar) { if let url = URL(string: self.userModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default")) self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
} else {
self.headImgV.image = UIImage(named: "people_head_default")
} }
let city = self.userModel.address.city let city = self.userModel.address.city
...@@ -31,7 +33,8 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -31,7 +33,8 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
let cityWidth = self.getWith(font: self.cityLabel.font, height: 20, string: city) let cityWidth = self.getWith(font: self.cityLabel.font, height: 20, string: city)
self.cityLabel.frame = CGRectMake(0, 0, cityWidth+8, 20) self.cityLabel.frame = CGRectMake(0, 0, cityWidth+8, 20)
self.zodiacLabel.text = self.userModel.zodiac self.zodiacLabel.text = self.userModel.zodiac
self.signImgV.isHidden = !self.userModel.isSigned
var name:ASAttributedString = .init(string:self.userModel.username, .font(UIFont.PFSC_B(ofSize: 18)), .foreground(UIColor.mainTextColor)) var name:ASAttributedString = .init(string:self.userModel.username, .font(UIFont.PFSC_B(ofSize: 18)), .foreground(UIColor.mainTextColor))
let cityTag: ASAttributedString = " \(.view(self.cityLabel, .original(.center)))" let cityTag: ASAttributedString = " \(.view(self.cityLabel, .original(.center)))"
let zodiacTag: ASAttributedString = " \(.view(self.zodiacLabel, .original(.center)))" let zodiacTag: ASAttributedString = " \(.view(self.zodiacLabel, .original(.center)))"
...@@ -44,27 +47,38 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -44,27 +47,38 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
} }
self.nameTextView.attributed.text = name self.nameTextView.attributed.text = name
var text1 = ""
if !self.userModel.position.isEmpty { if !self.userModel.position.isEmpty {
self.professionalLabel.text = self.userModel.position text1 = self.userModel.position
} else { } else {
self.professionalLabel.text = "" if self.userModel.isCurrentUser { // 当前用户默认文案
if self.userModel.isCurrentUser {
self.professionalLabel.textColor = UIColor.mainTextColor30 self.professionalLabel.textColor = UIColor.mainTextColor30
self.professionalLabel.text = "填写职位 | 填写所属行业" text1 = "填写职位 | 填写所属行业"
} }
} }
self.professionalLabel.text = text1
var text2 = ""
if !self.userModel.signature.isEmpty { if !self.userModel.signature.isEmpty {
self.detailLabel.text = self.userModel.signature text2 = self.userModel.signature
} else { } else {
self.detailLabel.text = "" if self.userModel.isCurrentUser { // 当前用户默认文案
if self.userModel.isCurrentUser {
self.detailLabel.textColor = UIColor.mainTextColor30 self.detailLabel.textColor = UIColor.mainTextColor30
self.detailLabel.text = "填写个性签名,展现真我风采,彰显独特身份" text2 = "填写个性签名,展现真我风采,彰显独特身份"
} }
} }
self.detailLabel.text = text2
self.signImgV.isHidden = !self.userModel.isSigned var top2Margin = 8.0
if text2.isEmpty {
top2Margin = 0.0
} else {
top2Margin = text1.isEmpty ? 0.0 : 8.0
}
self.detailLabel.snp.updateConstraints { make in
make.top.equalTo(self.professionalLabel.snp.bottom).offset(top2Margin)
}
self.setNeedsLayout()
self.layoutIfNeeded()
} }
} }
...@@ -227,7 +241,6 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -227,7 +241,6 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
self.professionalLabel.snp.makeConstraints { make in self.professionalLabel.snp.makeConstraints { make in
make.left.equalTo(16) make.left.equalTo(16)
make.right.equalTo(-16) make.right.equalTo(-16)
// make.height.equalTo(20)
make.top.equalTo(self.nameTextView.snp.bottom).offset(0) make.top.equalTo(self.nameTextView.snp.bottom).offset(0)
} }
...@@ -235,7 +248,6 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -235,7 +248,6 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
make.left.equalTo(16) make.left.equalTo(16)
make.right.equalTo(-16) make.right.equalTo(-16)
make.top.equalTo(self.professionalLabel.snp.bottom).offset(8) make.top.equalTo(self.professionalLabel.snp.bottom).offset(8)
// make.height.equalTo(18)
make.bottom.equalTo(-16) make.bottom.equalTo(-16)
} }
......
...@@ -19,6 +19,8 @@ class YHNameCardInfoView: DragCardView { ...@@ -19,6 +19,8 @@ class YHNameCardInfoView: DragCardView {
didSet { didSet {
if let url = URL(string: self.userModel.avatar) { if let url = URL(string: self.userModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default")) self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
} else {
self.headImgV.image = UIImage(named: "people_head_default")
} }
self.nameLabel.text = self.userModel.username self.nameLabel.text = self.userModel.username
var result = "" var result = ""
...@@ -84,7 +86,7 @@ class YHNameCardInfoView: DragCardView { ...@@ -84,7 +86,7 @@ class YHNameCardInfoView: DragCardView {
lazy var headImgV:UIImageView = { lazy var headImgV:UIImageView = {
let view = UIImageView() let view = UIImageView()
view.image = UIImage(named: "") view.image = UIImage(named: "people_head_default")
view.layer.cornerRadius = 98.0/2.0 view.layer.cornerRadius = 98.0/2.0
view.clipsToBounds = true view.clipsToBounds = true
return view return view
......
...@@ -222,7 +222,11 @@ extension YHFileRenameInputView: UITextFieldDelegate { ...@@ -222,7 +222,11 @@ extension YHFileRenameInputView: UITextFieldDelegate {
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string) let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if newText.count > self.maxWordsCount { if newText.count > self.maxWordsCount {
YHHUD.flash(message: "重命名限制最多\(maxWordsCount)个字符") if maxWordsCount == 30 {
YHHUD.flash(message: "重命名限制最多\(maxWordsCount)个字符")
} else {
YHHUD.flash(message: "自定义标签限制最多\(maxWordsCount)个字符")
}
return false return false
} }
return true return true
......
...@@ -289,7 +289,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { ...@@ -289,7 +289,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
switch item.type { switch item.type {
case .myCard://我的名片 case .myCard://我的名片
if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty { if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty {
let vc = YHMyNameCardViewController() let vc = YHNameCardViewController()
vc.userId = userId vc.userId = userId
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} else { } else {
...@@ -300,7 +300,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { ...@@ -300,7 +300,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return } guard let self = self else { return }
if !uid.isEmpty { if !uid.isEmpty {
YHLoginManager.shared.userModel?.id = uid YHLoginManager.shared.userModel?.id = uid
let vc = YHMyNameCardViewController() let vc = YHNameCardViewController()
vc.userId = uid vc.userId = uid
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
......
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