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