Commit 5b0ffb9f authored by Alex朱枝文's avatar Alex朱枝文

资源相关

parent 52c318e9
This diff is collapsed.
......@@ -153,6 +153,10 @@ class YHCommunityViewController: YHBaseViewController {
NotificationCenter.default.addObserver(self, selector: #selector(goConnectionVC), name: YhConstant.YhNotification.goConnectionVCNotifiction, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(goConnectionVC), name: YhConstant.YhNotification.goConnectionVCNotifiction, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(goResourceVC(_:)), name: YhConstant.YhNotification.goResourceVCNotifiction, object: nil)
for i in 0..<arrItemTitles.count {
if i == 0 { // 消息
let vc = YHMessageListVC()
......@@ -280,6 +284,9 @@ class YHCommunityViewController: YHBaseViewController {
}
@objc func goMessageListVC(_ notification: Notification) {
guard arrItemVCs.count > 0 else {
return
}
segmentedView.selectItemAt(index: 0)
guard let userInfo = notification.userInfo else {
return
......@@ -293,12 +300,34 @@ class YHCommunityViewController: YHBaseViewController {
}
@objc func goActivityVC() {
guard arrItemVCs.count > 4 else {
return
}
segmentedView.selectItemAt(index: 4)
}
@objc func goConnectionVC() {
guard arrItemVCs.count > 3 else {
return
}
segmentedView.selectItemAt(index: 3)
}
@objc func goResourceVC(_ notification: Notification) {
guard arrItemVCs.count > 2 else {
return
}
segmentedView.selectItemAt(index: 2)
guard let userInfo = notification.userInfo else {
return
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) {
guard let resourceVC = self.arrItemVCs[2] as? YHResourceViewController else {
return
}
resourceVC.handleTypeChangeNotification(userInfo)
}
}
}
extension YHCommunityViewController: JXSegmentedViewDelegate {
......
//
// YHCircleDetailViewController.swift
// galaxy
//
// Created by alexzzw on 2025/9/24.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCircleDetailViewController: YHBaseViewController {
var circleModel: YHCircleListModel?
var block: ((YHCircleListModel) -> Void)?
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
title = "动态详情"
let label = UILabel()
label.text = "详情页面"
label.textAlignment = .center
label.textColor = .gray
view.addSubview(label)
label.snp.makeConstraints { make in
make.center.equalToSuperview()
}
}
}
......@@ -203,31 +203,21 @@ private extension YHCircleViewController {
}
private func handleFindCustomerAction() {
print("找客户按钮被点击")
// TODO: 跳转到找客户页面
// let findCustomerVC = YHFindCustomerViewController()
// navigationController?.pushViewController(findCustomerVC, animated: true)
let dict = [YHResourceViewController.selectTypeKey: YHResourceFilterType.demand.rawValue]
NotificationCenter.default.post(name: YhConstant.YhNotification.goResourceVCNotifiction, object: nil, userInfo: dict)
}
private func handleFindServiceAction() {
print("找服务按钮被点击")
// TODO: 跳转到找服务页面
// let findServiceVC = YHFindServiceViewController()
// navigationController?.pushViewController(findServiceVC, animated: true)
let dict = [YHResourceViewController.selectTypeKey: YHResourceFilterType.service.rawValue]
NotificationCenter.default.post(name: YhConstant.YhNotification.goResourceVCNotifiction, object: nil, userInfo: dict)
}
private func handleExpandNetworkAction() {
print("拓人脉按钮被点击")
// TODO: 跳转到拓人脉页面
// let expandNetworkVC = YHExpandNetworkViewController()
// navigationController?.pushViewController(expandNetworkVC, animated: true)
NotificationCenter.default.post(name: YhConstant.YhNotification.goConnectionVCNotifiction, object: nil)
}
private func handleOrganizeEventAction() {
print("办活动按钮被点击")
// TODO: 跳转到办活动页面
// let organizeEventVC = YHOrganizeEventViewController()
// navigationController?.pushViewController(organizeEventVC, animated: true)
NotificationCenter.default.post(name: YhConstant.YhNotification.goActivityVCNotifiction, object: nil)
}
}
......@@ -276,21 +266,7 @@ extension YHCircleViewController: UICollectionViewDelegate, UICollectionViewData
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let model = self.viewModel.arrCircleData?[indexPath.row] else { return }
let detailVC = YHCircleDetailViewController()
// detailVC.circleModel = model
// detailVC.block = { item in
// if let arr = self.viewModel.arrCircleData {
// for (index, targetItem) in arr.enumerated() {
// if targetItem.id == item.id {
// targetItem.is_like = item.is_like
// targetItem.like_count = item.like_count
// self.circleCollectView.reloadItems(at: [IndexPath(item: index, section: 0)])
// }
// }
// }
// }
self.navigationController?.pushViewController(detailVC, animated: true)
//
}
}
......
......@@ -12,6 +12,8 @@ import JXSegmentedView
import SnapKit
class YHResourceViewController: YHBaseViewController {
static let selectTypeKey = "selectTypeKey"
// 添加高度约束属性
private var categoryViewHeightConstraint: Constraint?
......@@ -114,13 +116,14 @@ class YHResourceViewController: YHBaseViewController {
tableView.register(YHResourceTableViewCell.self, forCellReuseIdentifier: YHResourceTableViewCell.cellReuseIdentifier)
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.showsVerticalScrollIndicator = false
tableView.keyboardDismissMode = .onDrag
return tableView
}()
// 空状态视图
private lazy var noDataView: YHEmptyDataView = {
let view = YHEmptyDataView.createView("暂无内容", kEmptyCommonBgName)
let view = YHEmptyDataView.createView("暂无内容", kEmptyOrderBgName)
view.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: 164)
view.backgroundColor = .clear
view.isHidden = true
......@@ -157,6 +160,13 @@ class YHResourceViewController: YHBaseViewController {
deinit {
NotificationCenter.default.removeObserver(self)
}
func handleTypeChangeNotification(_ userInfo: [AnyHashable: Any]) {
guard let selectTypeKey = userInfo[YHResourceViewController.selectTypeKey] as? String, let type = YHResourceFilterType(rawValue: selectTypeKey) else {
return
}
setResourceType(type)
}
}
// MARK: - 私有方法
......@@ -390,22 +400,22 @@ private extension YHResourceViewController {
getData()
}
// MARK: - 按钮事件处理
@objc func serviceButtonClicked() {
selectFilterType(.service)
viewModel.currentType = .service
func setResourceType(_ type: YHResourceFilterType) {
selectFilterType(type)
viewModel.currentType = type
// 重置分类选择
resetCategorySelection()
getData()
}
// MARK: - 按钮事件处理
@objc func serviceButtonClicked() {
setResourceType(.service)
}
@objc func demandButtonClicked() {
selectFilterType(.demand)
viewModel.currentType = .demand
// 重置分类选择
resetCategorySelection()
getData()
setResourceType(.demand)
}
@objc func industryButtonClicked() {
......@@ -543,7 +553,9 @@ extension YHResourceViewController: UITableViewDelegate, UITableViewDataSource {
tableView.deselectRow(at: indexPath, animated: true)
guard let model = viewModel.arrResourceData?[indexPath.row] else { return }
//
let vc = YHResourceDetailViewController()
vc.resourceModel = model
navigationController?.pushViewController(vc, animated: true)
}
}
......@@ -587,7 +599,7 @@ extension YHResourceViewController: YHResourceCategoryViewDelegate {
}
// MARK: - 枚举定义
enum YHResourceFilterType {
enum YHResourceFilterType: String {
case service
case demand
}
//
// YHResourceDetailBaseInfoCell.swift
// galaxy
//
// Created by alexzzw on 2025/9/30.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResourceDetailBaseInfoCell: UITableViewCell {
private lazy var dividerView: UIView = {
let view = UIView()
view.backgroundColor = UIColor.brandGrayColor3
return view
}()
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_B(ofSize: 17)
label.textColor = UIColor.brandGrayColor8
label.text = "基础信息"
return label
}()
private lazy var stackView: UIStackView = {
let stack = UIStackView()
stack.axis = .vertical
stack.spacing = 16
stack.distribution = .fill
return stack
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupUI() {
selectionStyle = .none
backgroundColor = .white
contentView.backgroundColor = .white
contentView.addSubview(titleLabel)
contentView.addSubview(dividerView)
contentView.addSubview(stackView)
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalToSuperview().offset(24)
}
stackView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(titleLabel.snp.bottom).offset(16)
}
dividerView.snp.makeConstraints { make in
make.left.right.equalToSuperview().inset(20)
make.top.equalTo(stackView.snp.bottom).offset(24)
make.height.equalTo(1)
make.bottom.equalToSuperview()
}
}
func configure(with model: YHResourceListModel) {
stackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
addInfoRow(title: "企业介绍", content: model.content.isEmpty ? "未填写" : model.content)
addInfoRow(title: "主营业务", content: model.category_name.isEmpty ? "未填写" : model.category_name)
addInfoRow(title: "提供服务", content: model.service_duration.isEmpty ? "未填写" : model.service_duration)
addInfoRow(title: "行业类型", content: model.category_name.isEmpty ? "未填写" : model.category_name)
}
private func addInfoRow(title: String, content: String) {
let rowView = createInfoRowView(title: title, content: content)
stackView.addArrangedSubview(rowView)
}
private func createInfoRowView(title: String, content: String) -> UIView {
let container = UIView()
let titleLabel = UILabel()
titleLabel.font = UIFont.PFSC_R(ofSize: 13)
titleLabel.textColor = UIColor.brandGrayColor6
titleLabel.text = title
titleLabel.setContentHuggingPriority(.required, for: .horizontal)
titleLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
let contentLabel = UILabel()
contentLabel.font = UIFont.PFSC_R(ofSize: 13)
contentLabel.textColor = UIColor.brandGrayColor8
contentLabel.text = content
contentLabel.numberOfLines = 4
contentLabel.textAlignment = .left
container.addSubview(titleLabel)
container.addSubview(contentLabel)
contentLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
contentLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview()
make.top.equalToSuperview()
make.bottom.lessThanOrEqualToSuperview()
}
contentLabel.snp.makeConstraints { make in
make.left.equalTo(titleLabel.snp.right).offset(12)
make.right.equalToSuperview()
make.top.equalToSuperview()
make.bottom.equalToSuperview()
}
return container
}
}
//
// YHResourceDetailDemandCell.swift
// galaxy
//
// Created by alexzzw on 2025/9/30.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResourceDetailDemandCell: UITableViewCell {
private lazy var dividerView: UIView = {
let view = UIView()
view.backgroundColor = UIColor.brandGrayColor3
return view
}()
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_B(ofSize: 17)
label.textColor = UIColor.brandGrayColor8
label.text = "企业需求"
return label
}()
private lazy var demandTitleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 13)
label.textColor = UIColor.brandGrayColor6
label.text = "近期需求"
return label
}()
private lazy var demandContentLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 13)
label.textColor = UIColor.brandGrayColor8
label.numberOfLines = 4
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupUI() {
selectionStyle = .none
backgroundColor = .white
contentView.backgroundColor = .white
contentView.addSubview(titleLabel)
contentView.addSubview(dividerView)
contentView.addSubview(demandTitleLabel)
contentView.addSubview(demandContentLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalToSuperview().offset(24)
}
demandTitleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.top.equalTo(titleLabel.snp.bottom).offset(16)
}
demandContentLabel.snp.makeConstraints { make in
make.left.equalTo(demandTitleLabel.snp.right).offset(12)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(demandTitleLabel)
}
dividerView.snp.makeConstraints { make in
make.left.right.equalToSuperview().inset(20)
make.top.equalTo(demandContentLabel.snp.bottom).offset(24)
make.height.equalTo(1)
make.bottom.equalToSuperview()
}
}
func configure(with model: YHResourceListModel) {
demandContentLabel.text = model.title.isEmpty ? "未填写" : model.title
}
}
//
// YHResourceDetailDocumentsCell.swift
// galaxy
//
// Created by alexzzw on 2025/9/30.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResourceDetailDocumentsCell: UITableViewCell {
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_B(ofSize: 17)
label.textColor = UIColor.brandGrayColor8
label.text = "企业相关资料"
return label
}()
private lazy var noDataView: UIView = {
let view = UIView()
view.backgroundColor = .clear
view.clipsToBounds = true
view.isHidden = true
let imageView = UIImageView(image: UIImage(named: "no_data_bg_common"))
let label = UILabel()
label.text = "暂无企业相关资料"
label.textColor = UIColor.brandGrayColor6
label.font = UIFont.PFSC_R(ofSize: 14)
label.textAlignment = .center
view.addSubview(imageView)
view.addSubview(label)
imageView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalToSuperview()
make.width.height.equalTo(128)
}
label.snp.makeConstraints { make in
make.top.equalTo(imageView.snp.bottom).offset(16)
make.left.right.bottom.equalToSuperview()
}
return view
}()
private lazy var imagesStackView: UIStackView = {
let stack = UIStackView()
stack.axis = .vertical
stack.spacing = 12
stack.distribution = .fill
return stack
}()
private var images: [String] = []
var onImageTapped: ((Int) -> Void)?
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupUI() {
selectionStyle = .none
backgroundColor = .white
contentView.backgroundColor = .white
contentView.addSubview(titleLabel)
contentView.addSubview(noDataView)
contentView.addSubview(imagesStackView)
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalToSuperview().offset(24)
}
noDataView.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(24)
make.left.right.equalToSuperview()
make.height.equalTo(0)
// make.bottom.equalToSuperview().offset(-24)
}
imagesStackView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(titleLabel.snp.bottom).offset(16)
make.bottom.equalToSuperview().offset(-24)
}
}
func configure(with images: [String]) {
self.images = images
// 清空之前的图片
imagesStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
guard images.count > 0 else {
noDataView.isHidden = false
imagesStackView.isHidden = true
noDataView.snp.remakeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(24)
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-24)
}
imagesStackView.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(titleLabel.snp.bottom).offset(16)
make.height.equalTo(0)
}
return
}
imagesStackView.isHidden = false
noDataView.snp.remakeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(24)
make.left.right.equalToSuperview()
make.height.equalTo(0)
}
imagesStackView.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(titleLabel.snp.bottom).offset(16)
make.bottom.equalToSuperview().offset(-24)
}
let imageWidth = KScreenWidth - 20 * 2 // 左右各16的padding
let imageHeight = imageWidth * 1.4 // A4纸张比例
for (index, imageUrl) in images.enumerated() {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
imageView.backgroundColor = UIColor.systemGray6
imageView.isUserInteractionEnabled = true
if let url = URL(string: imageUrl) {
imageView.sd_setImage(with: url, placeholderImage: UIImage(named: "people_head_default"))
}
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(imageTapped(_:)))
imageView.addGestureRecognizer(tapGesture)
imageView.tag = index
// 设置图片视图的高度
imageView.snp.makeConstraints { make in
make.height.equalTo(imageHeight)
}
imagesStackView.addArrangedSubview(imageView)
}
}
@objc private func imageTapped(_ gesture: UITapGestureRecognizer) {
if let imageView = gesture.view {
onImageTapped?(imageView.tag)
}
}
}
//
// YHResourceDetailHeaderCell.swift
// galaxy
//
// Created by alexzzw on 2025/9/30.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResourceDetailHeaderCell: UITableViewCell {
private lazy var logoImageView: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
imageView.clipsToBounds = true
imageView.layer.cornerRadius = 4
imageView.backgroundColor = .white
return imageView
}()
private lazy var companyNameLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 21)
label.textColor = UIColor.brandGrayColor8
label.numberOfLines = 2
return label
}()
private lazy var companyEnglishNameLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.brandGrayColor6
label.numberOfLines = 2
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupUI() {
selectionStyle = .none
backgroundColor = .clear
contentView.backgroundColor = .clear
contentView.addSubview(logoImageView)
contentView.addSubview(companyNameLabel)
contentView.addSubview(companyEnglishNameLabel)
logoImageView.snp.makeConstraints { make in
make.top.left.equalToSuperview().inset(20)
make.width.height.equalTo(60)
}
companyNameLabel.snp.makeConstraints { make in
make.top.equalTo(logoImageView.snp.bottom).offset(12)
make.right.lessThanOrEqualToSuperview().offset(-20)
make.left.equalTo(logoImageView)
}
companyEnglishNameLabel.snp.makeConstraints { make in
make.left.equalTo(logoImageView)
make.right.lessThanOrEqualToSuperview().offset(-20)
make.top.equalTo(companyNameLabel.snp.bottom).offset(4)
make.bottom.equalToSuperview().offset(-32)
}
}
func configure(with model: YHResourceListModel) {
if let url = URL(string: model.company_logo) {
logoImageView.sd_setImage(with: url, placeholderImage: UIImage(named: "people_head_default"))
}
companyNameLabel.text = model.company_name
companyEnglishNameLabel.text = "JUXIN CERTIFIED PUBLIC ACCOUNTANTS FIRM"
}
}
......@@ -372,6 +372,9 @@ extension YhConstant {
// 跳转 社区的人脉页
public static let goConnectionVCNotifiction = Notification.Name(rawValue: "com.yinhe.goConnectionVCNotifiction")
// 跳转 社区的资源页
public static let goResourceVCNotifiction = Notification.Name(rawValue: "com.yinhe.goResourceVCNotifiction")
// 点击了 首页的消息
public static let clickHomeMsgNotifiction = Notification.Name(rawValue: "com.yinhe.clickHomeMsgNotifiction")
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resource_detail_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resource_detail_bg@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