Commit 9cf30beb authored by Steven杜宇's avatar Steven杜宇

// 人脉

parent 417a6256
...@@ -256,6 +256,7 @@ ...@@ -256,6 +256,7 @@
0477E17A2BA41C7E00436346 /* YHCertificateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E1792BA41C7E00436346 /* YHCertificateModel.swift */; }; 0477E17A2BA41C7E00436346 /* YHCertificateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E1792BA41C7E00436346 /* YHCertificateModel.swift */; };
0477E17C2BA4238400436346 /* YHCertificateListContainerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17B2BA4238400436346 /* YHCertificateListContainerVC.swift */; }; 0477E17C2BA4238400436346 /* YHCertificateListContainerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17B2BA4238400436346 /* YHCertificateListContainerVC.swift */; };
0477E17E2BA4362A00436346 /* YHCustomNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */; }; 0477E17E2BA4362A00436346 /* YHCustomNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */; };
047A3DF52C295AFF0048937B /* YHFriendListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047A3DF42C295AFF0048937B /* YHFriendListModel.swift */; };
0480976B2BA15269000B9DCA /* YHCertificateInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */; }; 0480976B2BA15269000B9DCA /* YHCertificateInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */; };
0480976D2BA158A1000B9DCA /* YHCertificateListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */; }; 0480976D2BA158A1000B9DCA /* YHCertificateListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */; };
048097712BA18D66000B9DCA /* YHCertificateSearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */; }; 048097712BA18D66000B9DCA /* YHCertificateSearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */; };
...@@ -814,6 +815,7 @@ ...@@ -814,6 +815,7 @@
0477E1792BA41C7E00436346 /* YHCertificateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateModel.swift; sourceTree = "<group>"; }; 0477E1792BA41C7E00436346 /* YHCertificateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateModel.swift; sourceTree = "<group>"; };
0477E17B2BA4238400436346 /* YHCertificateListContainerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListContainerVC.swift; sourceTree = "<group>"; }; 0477E17B2BA4238400436346 /* YHCertificateListContainerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListContainerVC.swift; sourceTree = "<group>"; };
0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCustomNavigationBar.swift; sourceTree = "<group>"; }; 0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCustomNavigationBar.swift; sourceTree = "<group>"; };
047A3DF42C295AFF0048937B /* YHFriendListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFriendListModel.swift; sourceTree = "<group>"; };
0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateInfoCell.swift; sourceTree = "<group>"; }; 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateInfoCell.swift; sourceTree = "<group>"; };
0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListVC.swift; sourceTree = "<group>"; }; 0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListVC.swift; sourceTree = "<group>"; };
048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateSearchBar.swift; sourceTree = "<group>"; }; 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateSearchBar.swift; sourceTree = "<group>"; };
...@@ -1287,6 +1289,7 @@ ...@@ -1287,6 +1289,7 @@
children = ( children = (
044D0BFD2C21649A00C5CF5E /* YHUserInformationModel.swift */, 044D0BFD2C21649A00C5CF5E /* YHUserInformationModel.swift */,
04FB01CF2C23FA420040115D /* YHMatchUserInfo.swift */, 04FB01CF2C23FA420040115D /* YHMatchUserInfo.swift */,
047A3DF42C295AFF0048937B /* YHFriendListModel.swift */,
); );
path = M; path = M;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3367,6 +3370,7 @@ ...@@ -3367,6 +3370,7 @@
0445E6AF2BE9CFF6003C52F9 /* YHAppVersionForceUpdateView.swift in Sources */, 0445E6AF2BE9CFF6003C52F9 /* YHAppVersionForceUpdateView.swift in Sources */,
04B9EE5A2C06CC3100A4018D /* YHCodeSueecssViewController.swift in Sources */, 04B9EE5A2C06CC3100A4018D /* YHCodeSueecssViewController.swift in Sources */,
045EEEC12B9F171A0022A143 /* YHOtherInfoFillModel.swift in Sources */, 045EEEC12B9F171A0022A143 /* YHOtherInfoFillModel.swift in Sources */,
047A3DF52C295AFF0048937B /* YHFriendListModel.swift in Sources */,
0468D43A2B579EAC00CFB916 /* YHLoginViewModel.swift in Sources */, 0468D43A2B579EAC00CFB916 /* YHLoginViewModel.swift in Sources */,
045EEE9E2B9F171A0022A143 /* YHWorkExampleModel.swift in Sources */, 045EEE9E2B9F171A0022A143 /* YHWorkExampleModel.swift in Sources */,
045EEE8A2B9F171A0022A143 /* YHPreviewOtherInformationViewController.swift in Sources */, 045EEE8A2B9F171A0022A143 /* YHPreviewOtherInformationViewController.swift in Sources */,
......
...@@ -256,23 +256,46 @@ class YHMatchPeopleViewController: YHBaseViewController { ...@@ -256,23 +256,46 @@ class YHMatchPeopleViewController: YHBaseViewController {
func animaiton() { func animaiton() {
let view1 = YHNameCardInfoView.createCardView() if self.matchUsersArr.count <= 0 {
view1.y = -YHNameCardInfoView.height
view1.x = 36 return
let view2 = YHNameCardInfoView.createCardView() }
view2.backgroundColor = UIColor.init(hex: 0xE7EBF3)
view2.y = -YHNameCardInfoView.height
view2.x = 36+5
view2.width = YHNameCardInfoView.width-5*2
let view3 = YHNameCardInfoView.createCardView() let view3 = YHNameCardInfoView.createCardView()
view3.backgroundColor = UIColor.init(hex: 0xC4CEE3) view3.backgroundColor = UIColor.init(hex: 0xC4CEE3)
view3.y = -YHNameCardInfoView.height view3.y = -YHNameCardInfoView.height
view3.x = 36+10 view3.x = 36+10
view3.width = YHNameCardInfoView.width-5*4 view3.width = YHNameCardInfoView.width-5*4
view3.isHidden = self.matchUsersArr.count >= 3
if self.matchUsersArr.count >= 3 {
if let user = self.matchUsersArr[2] {
view3.userModel = user
}
}
self.view.addSubview(view3) self.view.addSubview(view3)
let view2 = YHNameCardInfoView.createCardView()
view2.backgroundColor = UIColor.init(hex: 0xE7EBF3)
view2.y = -YHNameCardInfoView.height
view2.x = 36+5
view2.width = YHNameCardInfoView.width-5*2
view2.isHidden = self.matchUsersArr.count >= 2
self.view.addSubview(view2) self.view.addSubview(view2)
if self.matchUsersArr.count >= 2 {
if let user = self.matchUsersArr[1] {
view2.userModel = user
}
}
let view1 = YHNameCardInfoView.createCardView()
view1.y = -YHNameCardInfoView.height
view1.x = 36
self.view.addSubview(view1) self.view.addSubview(view1)
if self.matchUsersArr.count >= 0 {
if let user = self.matchUsersArr[0] {
view1.userModel = user
}
}
UIView.animate(withDuration: 0.5, delay: 0, options: [.curveEaseInOut]) { UIView.animate(withDuration: 0.5, delay: 0, options: [.curveEaseInOut]) {
view3.y = 102+k_Height_NavigationtBarAndStatuBar+5*2 view3.y = 102+k_Height_NavigationtBarAndStatuBar+5*2
......
...@@ -10,6 +10,8 @@ import UIKit ...@@ -10,6 +10,8 @@ import UIKit
class YHMyGoodFriendsVC: YHBaseViewController { class YHMyGoodFriendsVC: YHBaseViewController {
let viewModel = YHMatchUserViewModel()
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped) let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionHeaderHeight = 100 tableView.estimatedSectionHeaderHeight = 100
...@@ -46,8 +48,8 @@ class YHMyGoodFriendsVC: YHBaseViewController { ...@@ -46,8 +48,8 @@ class YHMyGoodFriendsVC: YHBaseViewController {
return view return view
}() }()
var friendsArr:[String] = ["","","",""] var friendsArr:[YHFriendModel] = []
var friendRequestArr:[String] = ["","","",""] var friendRequestArr:[YHFriendModel] = []
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -64,6 +66,11 @@ class YHMyGoodFriendsVC: YHBaseViewController { ...@@ -64,6 +66,11 @@ class YHMyGoodFriendsVC: YHBaseViewController {
} }
} }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.requestFriendList()
}
func createCorner(cell:UITableViewCell, isLastCell:Bool) { func createCorner(cell:UITableViewCell, isLastCell:Bool) {
if (isLastCell) { if (isLastCell) {
let corner = UIRectCorner(rawValue: UIRectCorner.bottomLeft.rawValue | UIRectCorner.bottomRight.rawValue) let corner = UIRectCorner(rawValue: UIRectCorner.bottomLeft.rawValue | UIRectCorner.bottomRight.rawValue)
...@@ -106,6 +113,8 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource { ...@@ -106,6 +113,8 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyFriendsCell.cellReuseIdentifier, for: indexPath) as! YHMyFriendsCell let cell = tableView.dequeueReusableCell(withIdentifier: YHMyFriendsCell.cellReuseIdentifier, for: indexPath) as! YHMyFriendsCell
self.createCorner(cell: cell, isLastCell: indexPath.row == self.friendsArr.count-1) self.createCorner(cell: cell, isLastCell: indexPath.row == self.friendsArr.count-1)
if 0 <= indexPath.row && indexPath.row < friendsArr.count { if 0 <= indexPath.row && indexPath.row < friendsArr.count {
let friend = self.friendsArr[indexPath.row]
cell.friendModel = friend
} }
return cell return cell
} }
...@@ -207,5 +216,26 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource { ...@@ -207,5 +216,26 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
} }
return view return view
} }
}
extension YHMyGoodFriendsVC {
func requestFriendList() {
self.viewModel.getMyFriendList {
[weak self] success, error in
guard let self = self else { return }
self.friendsArr.removeAll()
self.friendRequestArr.removeAll()
if self.viewModel.friendListModel.friends.count > 0 {
self.friendsArr.append(contentsOf: self.viewModel.friendListModel.friends)
self.friendRequestArr.append(contentsOf: self.viewModel.friendListModel.applyFriends)
}
self.tableView.reloadData()
if self.friendsArr.count <= 0 && self.friendRequestArr.count <= 0 {
self.emptyDataTipsView.isHidden = false
} else {
self.emptyDataTipsView.isHidden = true
}
}
}
} }
//
// YHFriendListModel.swift
// galaxy
//
// Created by edy on 2024/6/24.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHFriendListModel: SmartCodable {
var friends: [YHFriendModel] = []
var applyFriends: [YHFriendModel] = []
required init() {
}
enum CodingKeys: String, CodingKey {
case friends
case applyFriends = "apply_friends"
}
}
class YHFriendModel: SmartCodable {
var id: Int = 0
var yhId: String = ""
var username: String = ""
var avatar: String = ""
var position: String = ""
var industry: String = ""
var bio: String = ""
var isSign: Bool = false
var verifyInfo: String = ""
required init() {
}
enum CodingKeys: String, CodingKey {
case id
case yhId = "yh_id"
case username, avatar, position, industry, bio
case isSign = "is_sign"
case verifyInfo = "verify_info"
}
}
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
import UIKit import UIKit
import SmartCodable import SmartCodable
class YHPeopleCardModel: NSObject {
var isSend:Bool = false
}
class YHMatchUserInfo: SmartCodable { class YHMatchUserInfo: SmartCodable {
var id: String = "" var id: String = ""
var yhId: String = "" var yhId: String = ""
var username: String = ""
var avatar: String = ""
var position: String = "" var position: String = ""
var industry: String = "" var industry: String = ""
var isSign = false
var address: YHMatchUserAddress = YHMatchUserAddress() var address: YHMatchUserAddress = YHMatchUserAddress()
var signature: String = "" var signature: String = ""
...@@ -32,7 +32,8 @@ class YHMatchUserInfo: SmartCodable { ...@@ -32,7 +32,8 @@ class YHMatchUserInfo: SmartCodable {
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id case id
case yhId = "yh_id" case yhId = "yh_id"
case position, industry, address, signature case isSign = "is_sign"
case username, avatar, position, industry, address, signature
} }
} }
......
...@@ -39,6 +39,18 @@ class YHAddFriendCardCell: UITableViewCell { ...@@ -39,6 +39,18 @@ class YHAddFriendCardCell: UITableViewCell {
} }
} }
var friendModel: YHFriendModel = YHFriendModel() {
didSet {
if let url = URL(string: self.friendModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: ""))
}
self.nameLabel.text = self.friendModel.username
self.professionalLabel.text = self.friendModel.position
self.msgLabel.text = self.friendModel.verifyInfo
self.signImgV.isHidden = !self.friendModel.isSign
}
}
static let height = 218.0 static let height = 218.0
lazy var cardView: UIView = { lazy var cardView: UIView = {
......
...@@ -141,11 +141,6 @@ class YHFriendsResponseView: UIView { ...@@ -141,11 +141,6 @@ class YHFriendsResponseView: UIView {
cardView.addSubview(ignoreBtn) cardView.addSubview(ignoreBtn)
cardView.addSubview(acceptBtn) cardView.addSubview(acceptBtn)
self.headImgV.backgroundColor = .red
self.nameLabel.text = "XASAFSDFASDXASAFSDFASDXASAFSDFASDXASAFSDFASD"
self.professionalLabel.text = "咨询副总监 | 资讯科技及电讯"
self.msgLabel.text = "资讯科技及电讯资讯科技及电讯资讯科技及电讯资讯科技及电讯资讯科技及电讯资讯科技及电讯资讯科技及电讯资讯科技及电讯"
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.left.top.right.equalToSuperview() make.left.top.right.equalToSuperview()
make.height.equalTo(22.0) make.height.equalTo(22.0)
......
...@@ -7,10 +7,22 @@ ...@@ -7,10 +7,22 @@
// //
import UIKit import UIKit
import Kingfisher
class YHMyFriendsCell: UITableViewCell { class YHMyFriendsCell: UITableViewCell {
static let cellReuseIdentifier = "YHMyFriendsCell" static let cellReuseIdentifier = "YHMyFriendsCell"
var friendModel: YHFriendModel = YHFriendModel() {
didSet {
if let url = URL(string: self.friendModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "mine_head_logout"))
}
self.nameLabel.text = self.friendModel.username
self.professionalLabel.text = self.friendModel.position
self.detailLabel.text = self.friendModel.bio
self.signImgV.isHidden = !self.friendModel.isSign
}
}
lazy var headImgV:UIImageView = { lazy var headImgV:UIImageView = {
let view = UIImageView() let view = UIImageView()
...@@ -75,12 +87,6 @@ class YHMyFriendsCell: UITableViewCell { ...@@ -75,12 +87,6 @@ class YHMyFriendsCell: UITableViewCell {
self.contentView.addSubview(self.detailLabel) self.contentView.addSubview(self.detailLabel)
self.contentView.addSubview(self.lineView) self.contentView.addSubview(self.lineView)
self.headImgV.backgroundColor = .red
self.nameLabel.text = "XASAFSDFASDXASAFSDFASDXASAFSDFASDXASAFSDFASD"
self.professionalLabel.text = "咨询副总监 | 资讯科技及电讯"
self.detailLabel.text = "极致服务|创新突破|长期主义|合作共赢|求真务实"
self.lineView.snp.makeConstraints { make in self.lineView.snp.makeConstraints { make in
make.left.equalTo(15) make.left.equalTo(15)
make.right.equalTo(-15) make.right.equalTo(-15)
......
...@@ -18,10 +18,14 @@ class YHNameCardInfoView: DragCardView { ...@@ -18,10 +18,14 @@ class YHNameCardInfoView: DragCardView {
var userModel:YHMatchUserInfo = YHMatchUserInfo() { var userModel:YHMatchUserInfo = YHMatchUserInfo() {
didSet { didSet {
self.nameLabel.text = self.userModel.id if let url = URL(string: self.userModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "mine_head_logout"))
}
self.nameLabel.text = self.userModel.username
self.professionalLabel.text = self.userModel.position self.professionalLabel.text = self.userModel.position
self.detailLabel.text = self.userModel.signature self.detailLabel.text = self.userModel.signature
self.signImgV.isHidden = !self.userModel.isSign
if self.userModel.isSendRequest { if self.userModel.isSendRequest {
self.bottomBtn.setTitle("已发送好友申请", for: .normal) self.bottomBtn.setTitle("已发送好友申请", for: .normal)
self.bottomBtn.backgroundColor = .brandMainColor30 self.bottomBtn.backgroundColor = .brandMainColor30
......
...@@ -11,6 +11,7 @@ import UIKit ...@@ -11,6 +11,7 @@ import UIKit
class YHMatchUserViewModel: NSObject { class YHMatchUserViewModel: NSObject {
var matchUserArr:[YHMatchUserInfo?] = [] var matchUserArr:[YHMatchUserInfo?] = []
var friendListModel:YHFriendListModel = YHFriendListModel()
func getMatchUserlist(_ callBack: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) { func getMatchUserlist(_ callBack: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
let params = ["page_size" : 5] let params = ["page_size" : 5]
...@@ -65,4 +66,34 @@ class YHMatchUserViewModel: NSObject { ...@@ -65,4 +66,34 @@ class YHMatchUserViewModel: NSObject {
callBack(false, err) callBack(false, err)
} }
} }
func getMyFriendList(callBack: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.friendListApi
let _ = YHNetRequest.getRequest(url: strUrl) {
[weak self] json, code in
guard let self = self else { return }
let dic = json.data
printLog("model 是 ==> \(json)")
if json.code == 200 {
guard let result = YHFriendListModel.deserialize(dict: dic as? Dictionary ) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
self.friendListModel = YHFriendListModel()
callBack(false, error)
return
}
self.friendListModel = result
callBack(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
self.friendListModel = YHFriendListModel()
callBack(false, error)
}
} failBlock: { error in
self.friendListModel = YHFriendListModel()
callBack(false, error)
}
}
} }
...@@ -314,5 +314,7 @@ class YHAllApiName { ...@@ -314,5 +314,7 @@ class YHAllApiName {
static let addFriendApi = "super-app/community/friend-application" static let addFriendApi = "super-app/community/friend-application"
// 接收好友请求 // 接收好友请求
static let receiveFriendRequestApi = "super-app/community/process-friend-requests" static let receiveFriendRequestApi = "super-app/community/process-friend-requests"
// 好友列表
static let friendListApi = "super-app/community/my-friends"
} }
} }
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