Commit b0d19ba9 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:
  //  人脉
  //  人脉
  //  model 找不到
  // 人脉
parents 21333ce7 cdffd9d4
This diff is collapsed.
......@@ -16,6 +16,7 @@ protocol YHMatchProtocol: NSObjectProtocol {
class YHMatchPeopleViewController: YHBaseViewController {
let viewModel = YHMatchUserViewModel()
let loginViewModel = YHLoginViewModel()
var matchUsersArr:[YHMatchUserInfo?] = []
weak var delegate: YHMatchProtocol?
lazy var bgImgV:UIImageView = {
......@@ -151,12 +152,30 @@ class YHMatchPeopleViewController: YHBaseViewController {
}
@objc func didMyCardBtnClicked() {
let vc = YHMyNameCardViewController()
if !YHLoginManager.shared.isLogin() {
YHOneKeyLoginManager.shared.oneKeyLogin()
return
}
if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty {
let vc = YHMyNameCardViewController()
vc.userId = userId
self.navigationController?.pushViewController(vc)
} else {
YHHUD.show(.progress(message: "加载中..."))
self.loginViewModel.getUserId {
[weak self] uid in
YHHUD.hide()
guard let self = self else { return }
if !uid.isEmpty {
YHLoginManager.shared.userModel?.id = uid
let vc = YHMyNameCardViewController()
vc.userId = uid
self.navigationController?.pushViewController(vc)
}
}
}
self.navigationController?.pushViewController(vc)
}
@objc func didRematchBtnClicked() {
......
......@@ -115,8 +115,7 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
YHHUD.hide()
guard let self = self else { return }
if success {
self.friendRequestArr.removeFirst()
self.tableView.reloadData()
self.requestFriendList()
} else {
var msg = "处理失败"
if let errMsg = error?.errorMsg, !errMsg.isEmpty {
......
......@@ -69,6 +69,7 @@ class YHMyNameCardViewController: YHBaseViewController {
vc.stepFlag = false
self.navigationController?.pushViewController(vc)
}
bar.rightButton.isHidden = !self.isCurrentUser
return bar
}()
......
......@@ -219,10 +219,21 @@ extension YHPeopleViewController {
success, error in
self.rotateLottieView.stop()
let vc = YHMatchPeopleViewController()
vc.delegate = self
vc.matchUsersArr = self.viewModel.matchUserArr
self.navigationController?.pushViewController(vc)
if success, self.viewModel.matchUserArr.count > 0 {
let vc = YHMatchPeopleViewController()
vc.delegate = self
vc.matchUsersArr = self.viewModel.matchUserArr
self.navigationController?.pushViewController(vc)
} else {
var msg = "匹配失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
self.resetAnimation()
}
}
}
......
......@@ -45,6 +45,7 @@ class YHFriendRequestView: UIView {
lazy var headImgV:UIImageView = {
let view = UIImageView()
view.layer.cornerRadius = 23.0
view.clipsToBounds = true
return view
}()
......@@ -266,7 +267,7 @@ class YHFriendRequestView: UIView {
guard let keyboardFrame = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as AnyObject).cgRectValue else {return }
let isKeyboardShow = notification.name == UIResponder.keyboardWillShowNotification
let bottomMargin = (isKeyboardShow ? keyboardFrame.height : (KScreenHeight-YHFriendRequestView.cardHeight)/2.0)
let bottomMargin = (isKeyboardShow ? keyboardFrame.height+10 : (KScreenHeight-YHFriendRequestView.cardHeight)/2.0)
self.cardView.snp.updateConstraints { make in
make.bottom.equalToSuperview().offset(-bottomMargin)
}
......
......@@ -12,7 +12,6 @@ import UIKit
class YHTopicItemCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHTopicItemCell"
lazy var titleLabel: UILabel = {
var label = UILabel()
label.font = .PFSC_R(ofSize: 12)
......@@ -50,7 +49,7 @@ class YHMyInterestTopicCell: UITableViewCell {
typealias EditBlock = () -> ()
var editBlock: EditBlock?
static let cellReuseIdentifier = "YHMyInterestTopicCell"
weak var tableView: UITableView?
var topicArr:[String] = []
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet {
......@@ -72,24 +71,23 @@ class YHMyInterestTopicCell: UITableViewCell {
if self.userModel.topics.count > 0 {
self.topicArr.append(contentsOf: self.userModel.topics)
}
self.collectionView.snp.remakeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-16)
make.height.equalTo(24)
make.top.equalTo(titleLabel.snp.bottom).offset(12)
}
self.detailLabel.snp.remakeConstraints { make in
make.edges.equalTo(self.collectionView)
}
self.collectionView.reloadData {
let height = self.collectionView.contentSize.height
self.collectionView.snp.updateConstraints { make in
make.height.equalTo(height)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
let height = self.collectionView.contentSize.height
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.detailLabel.snp.removeConstraints()
self.superview?.setNeedsLayout()
self.superview?.layoutIfNeeded()
})
}
} else {
self.detailLabel.snp.remakeConstraints { make in
......@@ -98,10 +96,10 @@ class YHMyInterestTopicCell: UITableViewCell {
make.bottom.equalTo(-16)
make.top.equalTo(titleLabel.snp.bottom).offset(12)
}
self.collectionView.snp.remakeConstraints { make in
make.edges.equalTo(self.detailLabel)
}
self.collectionView.snp.removeConstraints()
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
......
......@@ -71,7 +71,7 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
lazy var headImgV:UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "people_head_default")
view.layer.cornerRadius = 74.0/2.0
view.layer.cornerRadius = headWidth/2.0
view.clipsToBounds = true
return view
}()
......
......@@ -21,7 +21,32 @@ class YHNameCardInfoView: DragCardView {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
}
self.nameLabel.text = self.userModel.username
self.professionalLabel.text = self.userModel.position
var result = ""
var isFirst = true
if !self.userModel.address.city.isEmpty {
if isFirst {
result += self.userModel.address.city
isFirst = false
}
}
if !self.userModel.position.isEmpty {
if isFirst {
result += self.userModel.position
isFirst = false
} else {
result += " | " + self.userModel.position
}
}
if !self.userModel.industry.isEmpty {
if isFirst {
result += self.userModel.industry
isFirst = false
} else {
result += " | " + self.userModel.industry
}
}
self.professionalLabel.text = result
self.detailLabel.text = self.userModel.signature
self.signImgV.isHidden = (self.userModel.isSign != 1)
......@@ -51,6 +76,15 @@ class YHNameCardInfoView: DragCardView {
return view
}()
lazy var headBgImgV:UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "people_user_head_bg")
view.layer.cornerRadius = (98.0+10)/2.0
return view
}()
lazy var signImgV:UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "people_sign")
......@@ -142,6 +176,7 @@ class YHNameCardInfoView: DragCardView {
private func setupUI() {
self.contentView.addSubview(self.bgImgV)
self.contentView.addSubview(self.headBgImgV)
self.contentView.addSubview(self.headImgV)
self.contentView.addSubview(self.signImgV)
self.contentView.addSubview(self.nameLabel)
......@@ -160,6 +195,10 @@ class YHNameCardInfoView: DragCardView {
make.centerX.equalToSuperview()
make.bottom.equalTo(self.bgImgV).offset(20)
}
self.headBgImgV.snp.makeConstraints { make in
make.width.height.equalTo(98+6)
make.center.equalTo(self.headImgV)
}
self.signImgV.snp.makeConstraints { make in
make.centerX.equalTo(self.headImgV)
......
......@@ -185,4 +185,23 @@ extension YHLoginViewModel {
callBackBlock(false,err)
}
}
func getUserId(callBack: ((String)->())?) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Auth.getUidApi
let _ = YHNetRequest.getRequest(url: strUrl) {
[weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog(json)
if let dic = json.data as? [AnyHashable : Any] {
if let uid = dic["id"] as? String {
callBack?(uid)
return
}
}
callBack?("")
} failBlock: { err in
callBack?("")
}
}
}
......@@ -53,7 +53,8 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
let likeViewModel: YHMyLikeViewModel = YHMyLikeViewModel()
let msgViewModel: YHMsgViewModel = YHMsgViewModel()
let loginViewModel = YHLoginViewModel()
lazy var tableView: UITableView = {
let tableView = UITableView(frame: CGRect.zero, style:.grouped)
tableView.contentInsetAdjustmentBehavior = .never
......@@ -287,11 +288,24 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
let item: PersonalModuleItem = items[indexPath.row]
switch item.type {
case .myCard://我的名片
let vc = YHMyNameCardViewController()
if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty {
let vc = YHMyNameCardViewController()
vc.userId = userId
self.navigationController?.pushViewController(vc)
} else {
YHHUD.show(.progress(message: "加载中..."))
self.loginViewModel.getUserId {
[weak self] uid in
YHHUD.hide()
guard let self = self else { return }
if !uid.isEmpty {
YHLoginManager.shared.userModel?.id = uid
let vc = YHMyNameCardViewController()
vc.userId = uid
self.navigationController?.pushViewController(vc)
}
}
}
self.navigationController?.pushViewController(vc)
case .myMessage://我的消息
printLog("我的消息")
let vc = YHMessageListVC()
......
......@@ -204,6 +204,7 @@ class YHAllApiName {
static let appleLogin = "infoflow/auth/apple-login"
static let oneKeySecretKeyInfo = "infoflow/auth/sdk-info"
static let logout = "infoflow/auth/logout"
static let getUidApi = "super-app/get-uid"
//注销app
static let unregisterApi = "infoflow/auth/cancellation"
}
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "image 1760@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "image 1760@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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