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

资源相关

parent 52c318e9
......@@ -1181,6 +1181,11 @@
047A96932D16C0900033BB4E /* YHInfoQuestionSelectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047A96922D16C0900033BB4E /* YHInfoQuestionSelectionCell.swift */; };
0487C1C72E8940D000CE6472 /* YHCustomSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0487C1C62E8940D000CE6472 /* YHCustomSearchView.swift */; };
0487C1D82E8B78B600CE6472 /* YHTXIMMessageHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0487C1D72E8B78B600CE6472 /* YHTXIMMessageHandler.swift */; };
0487C1DA2E8BB58300CE6472 /* YHResourceDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0487C1D92E8BB58300CE6472 /* YHResourceDetailViewController.swift */; };
0487C1DC2E8BCC8200CE6472 /* YHResourceDetailHeaderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0487C1DB2E8BCC8200CE6472 /* YHResourceDetailHeaderCell.swift */; };
0487C1DE2E8BCCA900CE6472 /* YHResourceDetailBaseInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0487C1DD2E8BCCA900CE6472 /* YHResourceDetailBaseInfoCell.swift */; };
0487C1E02E8BCCDD00CE6472 /* YHResourceDetailDemandCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0487C1DF2E8BCCDD00CE6472 /* YHResourceDetailDemandCell.swift */; };
0487C1E22E8BCD0200CE6472 /* YHResourceDetailDocumentsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0487C1E12E8BCD0200CE6472 /* YHResourceDetailDocumentsCell.swift */; };
048D6ADB2D5E00DE00BC6F4C /* YHMemberCenterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048D6ADA2D5E00DE00BC6F4C /* YHMemberCenterViewController.swift */; };
048D6ADD2D5EF0A900BC6F4C /* YHMemberCenterHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048D6ADC2D5EF0A900BC6F4C /* YHMemberCenterHeaderView.swift */; };
048D6ADF2D5F0FBE00BC6F4C /* YHMemberCenterHeaderBannerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048D6ADE2D5F0FBE00BC6F4C /* YHMemberCenterHeaderBannerCell.swift */; };
......@@ -1273,7 +1278,6 @@
04D4EC462E83D11500B0329B /* YHCircleCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D4EC452E83D11500B0329B /* YHCircleCollectionViewCell.swift */; };
04D4EC482E83D17500B0329B /* YHCircleListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D4EC472E83D17500B0329B /* YHCircleListModel.swift */; };
04D4EC4A2E83D21000B0329B /* YHCirclePublishViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D4EC492E83D21000B0329B /* YHCirclePublishViewController.swift */; };
04D4EC4C2E83D27200B0329B /* YHCircleDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D4EC4B2E83D27200B0329B /* YHCircleDetailViewController.swift */; };
04D4EC4E2E84F22500B0329B /* YHCircleHeaderReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D4EC4D2E84F22500B0329B /* YHCircleHeaderReusableView.swift */; };
04D6405A2E84DF07000162AF /* YHConnectListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D640592E84DF07000162AF /* YHConnectListViewController.swift */; };
04D6405E2E84E3B4000162AF /* YHConnectListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D6405D2E84E3B4000162AF /* YHConnectListCell.swift */; };
......@@ -2556,6 +2560,11 @@
047A96922D16C0900033BB4E /* YHInfoQuestionSelectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInfoQuestionSelectionCell.swift; sourceTree = "<group>"; };
0487C1C62E8940D000CE6472 /* YHCustomSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCustomSearchView.swift; sourceTree = "<group>"; };
0487C1D72E8B78B600CE6472 /* YHTXIMMessageHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTXIMMessageHandler.swift; sourceTree = "<group>"; };
0487C1D92E8BB58300CE6472 /* YHResourceDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResourceDetailViewController.swift; sourceTree = "<group>"; };
0487C1DB2E8BCC8200CE6472 /* YHResourceDetailHeaderCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResourceDetailHeaderCell.swift; sourceTree = "<group>"; };
0487C1DD2E8BCCA900CE6472 /* YHResourceDetailBaseInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResourceDetailBaseInfoCell.swift; sourceTree = "<group>"; };
0487C1DF2E8BCCDD00CE6472 /* YHResourceDetailDemandCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResourceDetailDemandCell.swift; sourceTree = "<group>"; };
0487C1E12E8BCD0200CE6472 /* YHResourceDetailDocumentsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResourceDetailDocumentsCell.swift; sourceTree = "<group>"; };
048D6ADA2D5E00DE00BC6F4C /* YHMemberCenterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMemberCenterViewController.swift; sourceTree = "<group>"; };
048D6ADC2D5EF0A900BC6F4C /* YHMemberCenterHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMemberCenterHeaderView.swift; sourceTree = "<group>"; };
048D6ADE2D5F0FBE00BC6F4C /* YHMemberCenterHeaderBannerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMemberCenterHeaderBannerCell.swift; sourceTree = "<group>"; };
......@@ -2649,7 +2658,6 @@
04D4EC452E83D11500B0329B /* YHCircleCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCircleCollectionViewCell.swift; sourceTree = "<group>"; };
04D4EC472E83D17500B0329B /* YHCircleListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCircleListModel.swift; sourceTree = "<group>"; };
04D4EC492E83D21000B0329B /* YHCirclePublishViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCirclePublishViewController.swift; sourceTree = "<group>"; };
04D4EC4B2E83D27200B0329B /* YHCircleDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCircleDetailViewController.swift; sourceTree = "<group>"; };
04D4EC4D2E84F22500B0329B /* YHCircleHeaderReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCircleHeaderReusableView.swift; sourceTree = "<group>"; };
04D640592E84DF07000162AF /* YHConnectListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHConnectListViewController.swift; sourceTree = "<group>"; };
04D6405D2E84E3B4000162AF /* YHConnectListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHConnectListCell.swift; sourceTree = "<group>"; };
......@@ -7011,7 +7019,6 @@
children = (
04D4EC302E839C1000B0329B /* YHCircleViewController.swift */,
04D4EC492E83D21000B0329B /* YHCirclePublishViewController.swift */,
04D4EC4B2E83D27200B0329B /* YHCircleDetailViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -7049,6 +7056,7 @@
isa = PBXGroup;
children = (
04D4EC322E839C2B00B0329B /* YHResourceViewController.swift */,
0487C1D92E8BB58300CE6472 /* YHResourceDetailViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -7065,6 +7073,10 @@
isa = PBXGroup;
children = (
0487C1C62E8940D000CE6472 /* YHCustomSearchView.swift */,
0487C1E12E8BCD0200CE6472 /* YHResourceDetailDocumentsCell.swift */,
0487C1DF2E8BCCDD00CE6472 /* YHResourceDetailDemandCell.swift */,
0487C1DD2E8BCCA900CE6472 /* YHResourceDetailBaseInfoCell.swift */,
0487C1DB2E8BCC8200CE6472 /* YHResourceDetailHeaderCell.swift */,
04355C922E8912490083BE91 /* YHResourceTableViewCell.swift */,
04355C8F2E890E020083BE91 /* YHResourceCategoryView.swift */,
);
......@@ -7677,6 +7689,7 @@
047A96862D1698150033BB4E /* YHGCMySchemeViewModel.swift in Sources */,
04AE20312D13B6E500891D24 /* YHGCChildBasicInfoVC.swift in Sources */,
045C0FDC2D12CA5F00BD2DC0 /* YHMyNotifySettingVC.swift in Sources */,
0487C1DA2E8BB58300CE6472 /* YHResourceDetailViewController.swift in Sources */,
045C0FDD2D12CA5F00BD2DC0 /* YHIncomeRecordCompleteModel.swift in Sources */,
045C0FDE2D12CA5F00BD2DC0 /* YHMainInformationModel.swift in Sources */,
045C0FDF2D12CA5F00BD2DC0 /* YHCertificateFilterButton.swift in Sources */,
......@@ -7962,6 +7975,7 @@
045C10C52D12CA5F00BD2DC0 /* YHResignScheduleMultipleInfoCell.swift in Sources */,
045C10C62D12CA5F00BD2DC0 /* YHHomeIdentityCell.swift in Sources */,
045C10C72D12CA5F00BD2DC0 /* YHServiceNoOrderView.swift in Sources */,
0487C1E02E8BCCDD00CE6472 /* YHResourceDetailDemandCell.swift in Sources */,
045C10C82D12CA5F00BD2DC0 /* YHMyDocumentsDetailViewModel.swift in Sources */,
045C10C92D12CA5F00BD2DC0 /* YHResignUploadTravelCardListModel.swift in Sources */,
045C10CA2D12CA5F00BD2DC0 /* YHDocListBottomView.swift in Sources */,
......@@ -8169,6 +8183,7 @@
045C116F2D12CA5F00BD2DC0 /* YHPreviewInfoNameAndSubNameItemView.swift in Sources */,
045C11702D12CA5F00BD2DC0 /* YHCertificateListVC.swift in Sources */,
045C11712D12CA5F00BD2DC0 /* YHPayMemberContentItems.swift in Sources */,
0487C1E22E8BCD0200CE6472 /* YHResourceDetailDocumentsCell.swift in Sources */,
045C11722D12CA5F00BD2DC0 /* YHResignUploadTravelCardListTableViewCell.swift in Sources */,
045C11742D12CA5F00BD2DC0 /* YHSimpleAudienceVC.swift in Sources */,
045C11752D12CA5F00BD2DC0 /* YHAIProductCell.swift in Sources */,
......@@ -8379,7 +8394,6 @@
045C12202D12CA5F00BD2DC0 /* YHResignMaterialListVC.swift in Sources */,
045C12212D12CA5F00BD2DC0 /* YHResignUploadTravelPassportTableViewCell.swift in Sources */,
04F1924D2DE0125B004BDAAC /* YHNewsModel.swift in Sources */,
04D4EC4C2E83D27200B0329B /* YHCircleDetailViewController.swift in Sources */,
045C12222D12CA5F00BD2DC0 /* YHResignCertificatePassportTableViewCell.swift in Sources */,
045C12232D12CA5F00BD2DC0 /* YHIncomeRecordItemCell.swift in Sources */,
045C12242D12CA5F00BD2DC0 /* YHAdopterResidentViewController.swift in Sources */,
......@@ -8600,6 +8614,7 @@
045C12CF2D12CA5F00BD2DC0 /* YHResignGuidelinesExampleShareViewController.swift in Sources */,
045C12D02D12CA5F00BD2DC0 /* YHAdopterNewPeopleViewController.swift in Sources */,
045C12D12D12CA5F00BD2DC0 /* YHOtherServiceListViewController.swift in Sources */,
0487C1DC2E8BCC8200CE6472 /* YHResourceDetailHeaderCell.swift in Sources */,
045C12D22D12CA5F00BD2DC0 /* YHResignAppointTimeSettingModel.swift in Sources */,
045C12D32D12CA5F00BD2DC0 /* YHVisaRenewalPayTipsCell.swift in Sources */,
0426E09A2E84E962005C9F5D /* YHContact.swift in Sources */,
......@@ -8701,6 +8716,7 @@
045C131F2D12CA5F00BD2DC0 /* YHAIRobotChatViewController.swift in Sources */,
045C13202D12CA5F00BD2DC0 /* YHUserInfoHeaderView.swift in Sources */,
045C13212D12CA5F00BD2DC0 /* YHGestureTableView.swift in Sources */,
0487C1DE2E8BCCA900CE6472 /* YHResourceDetailBaseInfoCell.swift in Sources */,
045C13222D12CA5F00BD2DC0 /* YHEvaluationView.swift in Sources */,
045C13232D12CA5F00BD2DC0 /* YHHKVisaRenewalPersonType.swift in Sources */,
045C13242D12CA5F00BD2DC0 /* YHMatchUserViewModel.swift in Sources */,
......
......@@ -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)
//
}
}
......
//
// YHResourceDetailViewController.swift
// galaxy
//
// Created by alexzzw on 2025/9/24.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SnapKit
class YHResourceDetailViewController: YHBaseViewController {
// MARK: - Properties
var resourceModel: YHResourceListModel?
var isMyCompany: Bool = false {
didSet {
updateViewIsMine()
}
}
private lazy var messageHandler: YHIMMessageHandler = {
return YHIMMessageHandler(
viewController: self,
navigationController: navigationController
)
}()
// MARK: - UI Components
// 背景图 - 改为在tableView后面
private lazy var bgIcon: UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "resource_detail_bg")
view.contentMode = .scaleAspectFill
view.clipsToBounds = true
return view
}()
private lazy var tableView: UITableView = {
let view = UITableView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight), style: .grouped)
view.estimatedSectionHeaderHeight = 0.01
view.estimatedSectionFooterHeight = 0.01
view.contentInsetAdjustmentBehavior = .never
view.backgroundColor = .clear
view.separatorStyle = .none
view.dataSource = self
view.delegate = self
view.showsVerticalScrollIndicator = false
view.register(YHResourceDetailHeaderCell.self, forCellReuseIdentifier: "HeaderCell")
view.register(YHResourceDetailBaseInfoCell.self, forCellReuseIdentifier: "BaseInfoCell")
view.register(YHResourceDetailDemandCell.self, forCellReuseIdentifier: "DemandCell")
view.register(YHResourceDetailDocumentsCell.self, forCellReuseIdentifier: "DocumentsCell")
return view
}()
private lazy var bottomActionView: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
private lazy var contactButton: UIButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.setTitle("联系合作", for: .normal)
button.setTitleColor(UIColor.white, for: .normal)
button.backgroundColor = UIColor.brandGrayColor8
button.addTarget(self, action: #selector(contactButtonClicked), for: .touchUpInside)
return button
}()
// MARK: - Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
loadData()
}
// MARK: - Setup
private func setupUI() {
gk_navBarAlpha = 0
gk_navBackgroundColor = .clear
gk_backImage = UIImage(named: "nav_black_24")
view.addSubview(bgIcon)
view.addSubview(tableView)
// 添加底部操作栏
view.addSubview(bottomActionView)
bottomActionView.addSubview(contactButton)
setupConstraints()
updateViewIsMine()
}
private func updateViewIsMine() {
gk_navTitle = isMyCompany ? "我的企业" : "企业详情"
if isMyCompany {
bottomActionView.isHidden = true
} else {
bottomActionView.isHidden = false
}
updateRightBarButtonItem()
}
private func setupConstraints() {
// 背景图约束 - 参照YHMemberCenterViewController
bgIcon.snp.makeConstraints { make in
make.top.left.right.bottom.equalToSuperview()
}
// tableView约束
tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(bottomActionView.snp.top)
}
bottomActionView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview()
make.top.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-64)
}
contactButton.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.top.equalToSuperview().offset(8)
make.height.equalTo(46)
}
// 不需要设置contentInset,让内容从导航栏下方开始
tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 0.01))
}
private func updateRightBarButtonItem() {
if isMyCompany {
let rightButtonItem = UIBarButtonItem(
image: UIImage(named: "service_center_more")?.withRenderingMode(.alwaysOriginal),
style: .plain,
target: self,
action: #selector(moreButtonClicked)
)
gk_navRightBarButtonItem = rightButtonItem
gk_navItemRightSpace = 16
} else {
let rightButtonItem = UIBarButtonItem(
image: UIImage(named: "share_item")?.withRenderingMode(.alwaysOriginal),
style: .plain,
target: self,
action: #selector(shareButtonClicked)
)
gk_navRightBarButtonItem = rightButtonItem
gk_navItemRightSpace = 16
}
}
// MARK: - Data
private func loadData() {
guard let _ = resourceModel else { return }
tableView.reloadData()
incrementViewCount()
}
private func incrementViewCount() {
resourceModel?.incrementViewCount()
}
// MARK: - Actions
@objc private func shareButtonClicked() {
//
}
@objc private func moreButtonClicked() {
//
}
@objc private func contactButtonClicked() {
if !YHLoginManager.shared.isLogin() {
YHOneKeyLoginManager.shared.oneKeyLogin()
return
}
messageHandler.gotoChatVC(senderID: "")
}
}
// MARK: - UITableViewDataSource & UITableViewDelegate
extension YHResourceDetailViewController: UITableViewDataSource, UITableViewDelegate {
func numberOfSections(in tableView: UITableView) -> Int {
return 4
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let model = resourceModel else {
return UITableViewCell()
}
let hasDocuments = !model.images.isEmpty
switch indexPath.section {
case 0:
guard let cell = tableView.dequeueReusableCell(withIdentifier: "HeaderCell", for: indexPath) as? YHResourceDetailHeaderCell else {
return UITableViewCell()
}
cell.configure(with: model)
return cell
case 1:
guard let cell = tableView.dequeueReusableCell(withIdentifier: "BaseInfoCell", for: indexPath) as? YHResourceDetailBaseInfoCell else {
return UITableViewCell()
}
cell.configure(with: model)
return cell
case 2:
if hasDocuments {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "DemandCell", for: indexPath) as? YHResourceDetailDemandCell else {
return UITableViewCell()
}
cell.configure(with: model)
return cell
} else {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "DemandCell", for: indexPath) as? YHResourceDetailDemandCell else {
return UITableViewCell()
}
cell.configure(with: model)
return cell
}
case 3:
guard let cell = tableView.dequeueReusableCell(withIdentifier: "DocumentsCell", for: indexPath) as? YHResourceDetailDocumentsCell else {
return UITableViewCell()
}
cell.configure(with: model.images)
cell.onImageTapped = { [weak self] index in
self?.showImageBrowser(at: index)
}
return cell
default:
return UITableViewCell()
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
// 关键改动:参照YHMemberCenterViewController的scrollViewDidScroll实现
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView.contentOffset.y > 0 {
// 向上滚动
var alpha = scrollView.contentOffset.y / k_Height_NavigationtBarAndStatuBar
if alpha > 1.0 {
alpha = 1.0
}
gk_navBarAlpha = alpha
gk_navBackgroundColor = .white
gk_navTitle = isMyCompany ? "我的企业" : "企业详情"
} else {
gk_navBarAlpha = 0.0
gk_navBackgroundColor = .clear
gk_navTitle = nil
}
}
private func showImageBrowser(at index: Int) {
guard let images = resourceModel?.images else { return }
print("显示图片浏览器,索引:\(index),共\(images.count)张")
}
}
......@@ -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