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

// 人脉

parent 1f3c55c6
This diff is collapsed.
......@@ -164,7 +164,8 @@ class YHCommunityViewController: YHBaseViewController {
arrItemVCs.append(vc)
} else if i == 3 { // 人脉
let vc = YHMatchUserViewController()
// let vc = YHMatchUserViewController()
let vc = YHConnectListViewController()
arrItemVCs.append(vc)
} else if i == 4 { // 活动
......
//
// YHConnectListViewController.swift
// galaxy
//
// Created by Dufet on 2025/9/25.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import JXSegmentedView
class YHConnectListViewController: YHBaseViewController {
let viewModel = YHMatchUserViewModel()
var arr: [String] = ["", "", ""]
lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(YHConnectListCell.self, forCellReuseIdentifier: YHConnectListCell.cellReuseIdentifier)
return tableView
}()
lazy var emptyDataTipsView: YHMyFriendsNoDataView = {
let view = YHMyFriendsNoDataView(frame: CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: KScreenWidth, height: KScreenHeight-k_Height_NavigationtBarAndStatuBar))
view.bottomBtnClick = {
[weak self] in
guard let self = self else { return }
self.navigationController?.popViewController(animated: true)
}
view.isHidden = true
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
gk_navigationBar.isHidden = true
self.view.backgroundColor = UIColor.white
self.view.addSubview(self.tableView)
self.view.addSubview(self.emptyDataTipsView)
self.tableView.snp.makeConstraints { make in
make.left.equalTo(0)
make.right.equalTo(0)
make.bottom.equalToSuperview()
make.top.equalToSuperview().offset(0)
}
}
}
extension YHConnectListViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: YHConnectListCell.cellReuseIdentifier, for: indexPath) as? YHConnectListCell else { return UITableViewCell() }
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.row && indexPath.row < self.arr.count {
}
}
}
extension YHConnectListViewController: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView {
return view
}
}
//
// YHContact.swift
// galaxy
//
// Created by Dufet on 2025/9/25.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
// 联系人数据模型
class YHContact: SmartCodable {
var name: String = ""
var title: String = ""
var industry: String = ""
var description: String = ""
var isVIP: Bool = false
// var relationship: ContactRelationship = ContactRelationship.none
required init() {
}
}
enum ContactRelationship {
case none
case friend
case sentRequest
var buttonText: String {
switch self {
case .none:
return "添加好友"
case .friend:
return "对方已是您的好友"
case .sentRequest:
return "已发送好友申请"
}
}
var isInteractable: Bool {
switch self {
case .none:
return true
case .friend, .sentRequest:
return false
}
}
var buttonColor: UIColor {
switch self {
case .none:
return .systemBlue
case .friend, .sentRequest:
return .systemGray3
}
}
}
//
// YHConnectListCellTableViewCell.swift
// galaxy
//
// Created by Dufet on 2025/9/25.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHConnectListCell: UITableViewCell {
static let cellReuseIdentifier = "YHConnectListCell"
private lazy var avatarImageView: UIImageView = {
let imageView = UIImageView()
imageView.layer.cornerRadius = 22
imageView.clipsToBounds = true
imageView.contentMode = .scaleAspectFill
imageView.backgroundColor = UIColor.brandGrayColor3
return imageView
}()
private lazy var nameLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_B(ofSize: 15)
label.textColor = UIColor.brandGrayColor8
label.text = "XXXXXXXXXXXX"
return label
}()
private lazy var vipImgView: UIImageView = {
let imageView = UIImageView()
return imageView
}()
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 13)
label.textColor = UIColor.brandGrayColor8
label.text = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
return label
}()
private lazy var descriptionLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 11)
label.textColor = UIColor.brandGrayColor6
label.numberOfLines = 2
label.text = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
return label
}()
lazy var addFriendButton: UIButton = {
let button = UIButton(type: .custom)
button.setTitle("添加好友", for: .normal)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 11)
button.setTitleColor(UIColor.brandGrayColor8, for: .normal)
button.layer.borderWidth = 1
button.layer.borderColor = UIColor.brandGrayColor5.cgColor
return button
}()
private lazy var statusLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 11)
label.textColor = UIColor.brandGrayColor6
label.text = "已发送好友申请"
return label
}()
private lazy var separatorLine: UIView = {
let view = UIView()
view.backgroundColor = UIColor.brandGrayColor3
return view
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
private func setupUI() {
selectionStyle = .none
// 添加所有子视图
contentView.addSubview(avatarImageView)
contentView.addSubview(nameLabel)
contentView.addSubview(vipImgView)
contentView.addSubview(titleLabel)
contentView.addSubview(descriptionLabel)
contentView.addSubview(statusLabel)
contentView.addSubview(addFriendButton)
contentView.addSubview(separatorLine)
// SnapKit 约束设置
avatarImageView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.top.equalToSuperview().offset(20)
make.width.height.equalTo(44)
}
nameLabel.snp.makeConstraints { make in
make.top.equalTo(avatarImageView.snp.top)
make.left.equalTo(avatarImageView.snp.right).offset(10)
make.height.equalTo(20)
}
vipImgView.snp.makeConstraints { make in
make.left.equalTo(nameLabel.snp.right).offset(4)
make.centerY.equalTo(nameLabel)
make.width.equalTo(43)
make.height.equalTo(16)
}
statusLabel.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-20)
make.centerY.equalTo(nameLabel)
make.height.equalTo(15)
}
addFriendButton.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-20)
make.bottom.equalTo(nameLabel.snp.bottom)
make.width.equalTo(68)
make.height.equalTo(25)
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(avatarImageView.snp.right).offset(10)
make.top.equalTo(nameLabel.snp.bottom).offset(3)
make.right.equalToSuperview().offset(-20)
}
descriptionLabel.snp.makeConstraints { make in
make.left.equalTo(avatarImageView.snp.right).offset(10)
make.top.equalTo(titleLabel.snp.bottom).offset(4)
make.right.equalToSuperview().offset(-20)
make.bottom.equalTo(-20)
}
separatorLine.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.bottom.equalToSuperview()
make.height.equalTo(1)
}
}
func updateModel(_ contact: YHContact) {
nameLabel.text = contact.name
titleLabel.text = "\(contact.title)\(contact.industry)"
descriptionLabel.text = contact.description
// VIP标签显示
vipImgView.isHidden = !contact.isVIP
// 按钮配置
// addFriendButton.setTitle(contact.relationship.buttonText, for: .normal)
// addFriendButton.isEnabled = contact.relationship.isInteractable
// addFriendButton.setTitleColor(contact.relationship.buttonColor, for: .normal)
// addFriendButton.layer.borderColor = contact.relationship.buttonColor.cgColor
// 头像占位符
}
}
......@@ -32,14 +32,18 @@ extension UIColor {
// 品牌主色 6
static let brandMainColor6: UIColor = UIColor(hexString: "#0046B4", transparency: 0.06)!
// 品牌新主色
static let brandColor4: UIColor = UIColor(hexString: "#0046B4")!
static let brandColor3: UIColor = UIColor(hexString: "#B3C8E9")!
static let brandColor2: UIColor = UIColor(hexString: "#D6E1F3")!
static let brandColor1: UIColor = UIColor(hexString: "#EBF0F9")!
static let brandGrayColor8: UIColor = UIColor(hexString: "#121A26")!
static let brandGrayColor7: UIColor = UIColor(hexString: "#6A7586")!
static let brandGrayColor6: UIColor = UIColor(hexString: "#8993A2")!
static let brandGrayColor5: UIColor = UIColor(hexString: "#B9C1CC")!
static let brandGrayColor4: UIColor = UIColor(hexString: "#D5DAE1")!
static let brandGrayColor3: UIColor = UIColor(hexString: "#E9ECFO")!
static let brandGrayColor3: UIColor = UIColor(hexString: "#E9ECF0")!
static let brandGrayColor2: UIColor = UIColor(hexString: "#F5F6F8")!
static let brandGrayColor1: UIColor = UIColor(hexString: "#F9FAFC")!
static let brandGrayColor0: UIColor = UIColor(hexString: "#FFFFFF")!
......
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