Commit 477858d0 authored by David黄金龙's avatar David黄金龙

1、添加一个测试界面

2、首页添加部分逻辑
parent 00386496
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; }; 6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; }; A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; };
A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51044192B495DD0006B60BB /* UIView+Extension.swift */; }; A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51044192B495DD0006B60BB /* UIView+Extension.swift */; };
A53026902B4E6F2700F35102 /* YHHomeCustomCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A530268F2B4E6F2700F35102 /* YHHomeCustomCell.swift */; };
A5551FFE2B4C26CE00510980 /* YHBaseViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5551FFD2B4C26CE00510980 /* YHBaseViewModel.swift */; }; A5551FFE2B4C26CE00510980 /* YHBaseViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5551FFD2B4C26CE00510980 /* YHBaseViewModel.swift */; };
A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5573ED12B317BFF00D98EC0 /* AppDelegate.swift */; }; A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5573ED12B317BFF00D98EC0 /* AppDelegate.swift */; };
A5573EDB2B317C0000D98EC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A5573EDA2B317C0000D98EC0 /* Assets.xcassets */; }; A5573EDB2B317C0000D98EC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A5573EDA2B317C0000D98EC0 /* Assets.xcassets */; };
...@@ -74,6 +75,9 @@ ...@@ -74,6 +75,9 @@
A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE9252B4564F7002C94D2 /* YHBasicContentView.swift */; }; A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE9252B4564F7002C94D2 /* YHBasicContentView.swift */; };
A5ACE9582B4564F7002C94D2 /* YHNoDataTipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE9262B4564F7002C94D2 /* YHNoDataTipView.swift */; }; A5ACE9582B4564F7002C94D2 /* YHNoDataTipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE9262B4564F7002C94D2 /* YHNoDataTipView.swift */; };
A5ACE95E2B4571BF002C94D2 /* YHHomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE95D2B4571BF002C94D2 /* YHHomeViewController.swift */; }; A5ACE95E2B4571BF002C94D2 /* YHHomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE95D2B4571BF002C94D2 /* YHHomeViewController.swift */; };
A5C5B2E62B4EC0BF00A7C5D1 /* YHDavidTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C5B2E52B4EC0BF00A7C5D1 /* YHDavidTestViewController.swift */; };
A5C5B2E82B4EC95600A7C5D1 /* YHDavidTestCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C5B2E72B4EC95600A7C5D1 /* YHDavidTestCollectionViewCell.swift */; };
A5C5B2EA2B4ECA4D00A7C5D1 /* YHDavidModel0.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5C5B2E92B4ECA4D00A7C5D1 /* YHDavidModel0.swift */; };
A5D6AB1B2B46A1CC001C10A5 /* YHHomeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */; }; A5D6AB1B2B46A1CC001C10A5 /* YHHomeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */; };
A5D6AB1D2B46AAFB001C10A5 /* YHHomePageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D6AB1C2B46AAFB001C10A5 /* YHHomePageViewModel.swift */; }; A5D6AB1D2B46AAFB001C10A5 /* YHHomePageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D6AB1C2B46AAFB001C10A5 /* YHHomePageViewModel.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -123,6 +127,7 @@ ...@@ -123,6 +127,7 @@
987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_galaxy.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_galaxy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A51044172B493675006B60BB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; }; A51044172B493675006B60BB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
A51044192B495DD0006B60BB /* UIView+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = "<group>"; }; A51044192B495DD0006B60BB /* UIView+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = "<group>"; };
A530268F2B4E6F2700F35102 /* YHHomeCustomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeCustomCell.swift; sourceTree = "<group>"; };
A5551FFD2B4C26CE00510980 /* YHBaseViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBaseViewModel.swift; sourceTree = "<group>"; }; A5551FFD2B4C26CE00510980 /* YHBaseViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBaseViewModel.swift; sourceTree = "<group>"; };
A5573ECE2B317BFF00D98EC0 /* galaxy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = galaxy.app; sourceTree = BUILT_PRODUCTS_DIR; }; A5573ECE2B317BFF00D98EC0 /* galaxy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = galaxy.app; sourceTree = BUILT_PRODUCTS_DIR; };
A5573ED12B317BFF00D98EC0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; A5573ED12B317BFF00D98EC0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
...@@ -182,6 +187,9 @@ ...@@ -182,6 +187,9 @@
A5ACE9252B4564F7002C94D2 /* YHBasicContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHBasicContentView.swift; sourceTree = "<group>"; }; A5ACE9252B4564F7002C94D2 /* YHBasicContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHBasicContentView.swift; sourceTree = "<group>"; };
A5ACE9262B4564F7002C94D2 /* YHNoDataTipView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHNoDataTipView.swift; sourceTree = "<group>"; }; A5ACE9262B4564F7002C94D2 /* YHNoDataTipView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHNoDataTipView.swift; sourceTree = "<group>"; };
A5ACE95D2B4571BF002C94D2 /* YHHomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeViewController.swift; sourceTree = "<group>"; }; A5ACE95D2B4571BF002C94D2 /* YHHomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeViewController.swift; sourceTree = "<group>"; };
A5C5B2E52B4EC0BF00A7C5D1 /* YHDavidTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDavidTestViewController.swift; sourceTree = "<group>"; };
A5C5B2E72B4EC95600A7C5D1 /* YHDavidTestCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDavidTestCollectionViewCell.swift; sourceTree = "<group>"; };
A5C5B2E92B4ECA4D00A7C5D1 /* YHDavidModel0.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDavidModel0.swift; sourceTree = "<group>"; };
A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeModel.swift; sourceTree = "<group>"; }; A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeModel.swift; sourceTree = "<group>"; };
A5D6AB1C2B46AAFB001C10A5 /* YHHomePageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomePageViewModel.swift; sourceTree = "<group>"; }; A5D6AB1C2B46AAFB001C10A5 /* YHHomePageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomePageViewModel.swift; sourceTree = "<group>"; };
B6BB01E4C5DB87B66F0ECE84 /* Pods-galaxy.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.release.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.release.xcconfig"; sourceTree = "<group>"; }; B6BB01E4C5DB87B66F0ECE84 /* Pods-galaxy.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.release.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.release.xcconfig"; sourceTree = "<group>"; };
...@@ -564,6 +572,7 @@ ...@@ -564,6 +572,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */, A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */,
A5C5B2E92B4ECA4D00A7C5D1 /* YHDavidModel0.swift */,
); );
path = M; path = M;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -571,6 +580,8 @@ ...@@ -571,6 +580,8 @@
A5ACE95B2B45712D002C94D2 /* V */ = { A5ACE95B2B45712D002C94D2 /* V */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A530268F2B4E6F2700F35102 /* YHHomeCustomCell.swift */,
A5C5B2E72B4EC95600A7C5D1 /* YHDavidTestCollectionViewCell.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -579,6 +590,7 @@ ...@@ -579,6 +590,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A5ACE95D2B4571BF002C94D2 /* YHHomeViewController.swift */, A5ACE95D2B4571BF002C94D2 /* YHHomeViewController.swift */,
A5C5B2E52B4EC0BF00A7C5D1 /* YHDavidTestViewController.swift */,
); );
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -774,6 +786,7 @@ ...@@ -774,6 +786,7 @@
A5ACE9362B4564F7002C94D2 /* YHNetworkStatusManager.swift in Sources */, A5ACE9362B4564F7002C94D2 /* YHNetworkStatusManager.swift in Sources */,
A5ACE92C2B4564F7002C94D2 /* YHLoginStyleButton.swift in Sources */, A5ACE92C2B4564F7002C94D2 /* YHLoginStyleButton.swift in Sources */,
A5ACE92F2B4564F7002C94D2 /* YHMyViewController.swift in Sources */, A5ACE92F2B4564F7002C94D2 /* YHMyViewController.swift in Sources */,
A5C5B2E62B4EC0BF00A7C5D1 /* YHDavidTestViewController.swift in Sources */,
A5ACE9332B4564F7002C94D2 /* NetBaseModel.swift in Sources */, A5ACE9332B4564F7002C94D2 /* NetBaseModel.swift in Sources */,
049A48AA2B49536000D0C641 /* YHAboutUsAdvantageCell.swift in Sources */, 049A48AA2B49536000D0C641 /* YHAboutUsAdvantageCell.swift in Sources */,
A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */, A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */,
...@@ -783,6 +796,7 @@ ...@@ -783,6 +796,7 @@
A5ACE9292B4564F7002C94D2 /* YHSmsCodeInputView.swift in Sources */, A5ACE9292B4564F7002C94D2 /* YHSmsCodeInputView.swift in Sources */,
A5ACE9452B4564F7002C94D2 /* BsHUDContainerView.swift in Sources */, A5ACE9452B4564F7002C94D2 /* BsHUDContainerView.swift in Sources */,
A5ACE93A2B4564F7002C94D2 /* NSAttributedString+Extension.swift in Sources */, A5ACE93A2B4564F7002C94D2 /* NSAttributedString+Extension.swift in Sources */,
A5C5B2E82B4EC95600A7C5D1 /* YHDavidTestCollectionViewCell.swift in Sources */,
0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */, 0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */,
A5ACE9512B4564F7002C94D2 /* YhConstant.swift in Sources */, A5ACE9512B4564F7002C94D2 /* YhConstant.swift in Sources */,
A5ACE94A2B4564F7002C94D2 /* BsHUDProgressView.swift in Sources */, A5ACE94A2B4564F7002C94D2 /* BsHUDProgressView.swift in Sources */,
...@@ -792,6 +806,7 @@ ...@@ -792,6 +806,7 @@
A5551FFE2B4C26CE00510980 /* YHBaseViewModel.swift in Sources */, A5551FFE2B4C26CE00510980 /* YHBaseViewModel.swift in Sources */,
A5ACE94B2B4564F7002C94D2 /* BsHUDRotatingImageView.swift in Sources */, A5ACE94B2B4564F7002C94D2 /* BsHUDRotatingImageView.swift in Sources */,
A5ACE94F2B4564F7002C94D2 /* YhOverlayView.swift in Sources */, A5ACE94F2B4564F7002C94D2 /* YhOverlayView.swift in Sources */,
A53026902B4E6F2700F35102 /* YHHomeCustomCell.swift in Sources */,
A5ACE92E2B4564F7002C94D2 /* YHValidateCodeInputView.swift in Sources */, A5ACE92E2B4564F7002C94D2 /* YHValidateCodeInputView.swift in Sources */,
A5ACE94E2B4564F7002C94D2 /* AlignedCollectionViewFlowLayout.swift in Sources */, A5ACE94E2B4564F7002C94D2 /* AlignedCollectionViewFlowLayout.swift in Sources */,
A5ACE93B2B4564F7002C94D2 /* UIFont+Extension.swift in Sources */, A5ACE93B2B4564F7002C94D2 /* UIFont+Extension.swift in Sources */,
...@@ -820,6 +835,7 @@ ...@@ -820,6 +835,7 @@
A5ACE9432B4564F7002C94D2 /* UILable+Extension.swift in Sources */, A5ACE9432B4564F7002C94D2 /* UILable+Extension.swift in Sources */,
A5ACE9382B4564F7002C94D2 /* UIApplication+Extension.swift in Sources */, A5ACE9382B4564F7002C94D2 /* UIApplication+Extension.swift in Sources */,
A5ACE93C2B4564F7002C94D2 /* UIColor+Extension.swift in Sources */, A5ACE93C2B4564F7002C94D2 /* UIColor+Extension.swift in Sources */,
A5C5B2EA2B4ECA4D00A7C5D1 /* YHDavidModel0.swift in Sources */,
A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */, A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */,
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */, 049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */,
A5ACE9582B4564F7002C94D2 /* YHNoDataTipView.swift in Sources */, A5ACE9582B4564F7002C94D2 /* YHNoDataTipView.swift in Sources */,
......
//
// YHDavidTestViewController.swift
// galaxy
//
// Created by davidhuangA on 2024/1/10.
// Copyright © 2024 www.davidhuang.com. All rights reserved.
//
import UIKit
class YHDavidTestViewController: YHBaseViewController {
lazy var items = {
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高")]
}()
lazy var collectView = {
// 设置布局方向
let flowLayout = UICollectionViewFlowLayout()
let margin = 20.0
let gap = 20.0
let itemWidth = floor((KScreenWidth-2*margin-gap)/2.0)
flowLayout.itemSize = CGSize(width: itemWidth, height: 306.0)
flowLayout.minimumInteritemSpacing = 20.0
flowLayout.minimumLineSpacing = 20.0
flowLayout.scrollDirection = .vertical
let collectinoView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectinoView.contentInset = UIEdgeInsets(top: 0, left: margin, bottom: 0, right: margin)
collectinoView.backgroundColor = UIColor.white
collectinoView.register(YHAboutUsAdvantageCell.self, forCellWithReuseIdentifier:YHAboutUsAdvantageCell.cellReuseIdentifier)
collectinoView.register(YHDavidTestCollectionViewCell.self, forCellWithReuseIdentifier:YHDavidTestCollectionViewCell.cellReuseIdentifier)
collectinoView.delegate = self
collectinoView.dataSource = self
return collectinoView
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
}
extension YHDavidTestViewController {
func setupUI() {
gk_navTitle = "David的测试UI"
view.backgroundColor = .white
view.addSubview(collectView)
collectView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
}
}
}
extension YHDavidTestViewController: UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return items.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHDavidTestCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHDavidTestCollectionViewCell
return cell
}
private func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
print("index is \(indexPath.row)")
}
}
...@@ -65,6 +65,23 @@ class YHHomeViewController: YHBaseViewController { ...@@ -65,6 +65,23 @@ class YHHomeViewController: YHBaseViewController {
}() }()
var homeTableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .plain)
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.showsHorizontalScrollIndicator = false
tableView.showsVerticalScrollIndicator = false
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 100
tableView.register(YHHomeCustomCell.self, forCellReuseIdentifier: YHHomeCustomCell.cellReuseIdentifier)
return tableView
}()
// MARK: - 生命周期方法
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -80,7 +97,10 @@ class YHHomeViewController: YHBaseViewController { ...@@ -80,7 +97,10 @@ class YHHomeViewController: YHBaseViewController {
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
} }
}
// MARK: - 私有方法
extension YHHomeViewController {
private func requestData() { private func requestData() {
self.homeReqVM.getHomeConfig { flag, error in self.homeReqVM.getHomeConfig { flag, error in
if flag == true { if flag == true {
...@@ -107,17 +127,56 @@ class YHHomeViewController: YHBaseViewController { ...@@ -107,17 +127,56 @@ class YHHomeViewController: YHBaseViewController {
view.addSubview(homeNavBarView) view.addSubview(homeNavBarView)
homeNavBarView.layer.zPosition = 1
homeNavBarView.snp.makeConstraints { make in homeNavBarView.snp.makeConstraints { make in
make.top.equalTo(k_Height_safeAreaInsetsTop()) make.top.equalTo(k_Height_safeAreaInsetsTop())
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
make.height.equalTo(48) make.height.equalTo(48)
} }
homeTableView.delegate = self
homeTableView.dataSource = self
view.addSubview(homeTableView)
homeTableView.snp.makeConstraints { make in
make.top.equalTo(homeNavBarView.snp.bottom).offset(5)
make.left.right.bottom.equalToSuperview()
}
} }
}
extension YHHomeViewController {
@objc func tapSearch() { @objc func tapSearch() {
printLog("*") printLog("*")
navigationController?.pushViewController(YHDavidTestViewController())
}
}
// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// let cell0 = tableView.dequeueReusableCell(withIdentifier: YHHomeCustomCell.cellReuseIdentifier, for: indexPath) as! YHHomeCustomCell
//
// cell0.setData(["A","B","B","B","B","B","B","B","B","B","B","B","B","B","B"])
//
// return cell0
return UITableViewCell()
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
printLog("点击了 tableView Cell \(indexPath.row)")
}
} }
//
// YHDavidModel0.swift
// galaxy
//
// Created by davidhuangA on 2024/1/10.
// Copyright © 2024 www.davidhuang.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHDavidModel0: SmartCodable {
var imageUrl : String = ""
var titleDes : String = ""
var uImageUrl : String = ""
var uName : String = ""
var date : String = "12-11"
var heartNum : Int32 = 0
required init() {
}
}
//
// YHDavidTestCollectionViewCell.swift
// galaxy
//
// Created by davidhuangA on 2024/1/10.
// Copyright © 2024 www.davidhuang.com. All rights reserved.
//
import UIKit
class YHDavidTestCollectionViewCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHDavidTestCollectionViewCell"
var advantateItem : AboutAdvantageItem? {
didSet {
// if let advantateItem = advantateItem {
// iconImgView.image = UIImage(named: advantateItem.iconName)
// titleLabel.text = advantateItem.title
// detailLabel.text = advantateItem.detail
// }
}
}
lazy var titleImageView:UIImageView = {
let imageV = UIImageView(image: UIImage(named: "home_title_image"))
imageV.contentMode = .scaleAspectFill
imageV.roundCorners(UIRectCorner.topLeft, radius: 8)
imageV.roundCorners(UIRectCorner.topRight, radius: 8)
return imageV
}()
lazy var descripeLable:UILabel = {
let label = UILabel()
label.text = "赴港攻略,当日往返无忧,这个季节风景..赴港攻略,当日往返无忧,这个季节风景"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 10)
label.numberOfLines = 2
label.lineBreakMode = .byTruncatingTail
return label
}()
lazy var headImageView:UIImageView = {
let imageV = UIImageView(image: UIImage(named: "mine_manager"))
imageV.contentMode = .scaleAspectFill
return imageV
}()
lazy var nameLable:UILabel = {
let label = UILabel()
label.text = "Fiona"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 10)
return label
}()
lazy var dateLable:UILabel = {
let label = UILabel()
label.text = "12-12"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 10)
return label
}()
lazy var heartImageView:UIImageView = {
let imageV = UIImageView(image: UIImage(named: "home_red_heart"))
imageV.contentMode = .scaleAspectFill
return imageV
}()
lazy var numLable:UILabel = {
let label = UILabel()
label.text = "2000"
label.textColor = UIColor(hexString:"#333333")
label.font = UIFont.systemFont(ofSize: 14)
return label
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
private func setupUI() {
contentView.backgroundColor = UIColor(hexString: "#F8F9FB")
contentView.layer.cornerRadius = 4
contentView.clipsToBounds = true
contentView.addSubview(titleImageView)
titleImageView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(210)
}
let subHoldView = UIView()
subHoldView.layer.backgroundColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1).cgColor
subHoldView.layer.borderWidth = 0.5
subHoldView.layer.borderColor = UIColor(red: 0.798, green: 0.798, blue: 0.798, alpha: 1).cgColor
contentView.addSubview(subHoldView)
subHoldView.snp.makeConstraints { make in
make.top.equalTo(titleImageView.snp.bottom).offset(10)
make.left.right.equalToSuperview()
make.height.equalTo(86)
}
subHoldView.addSubview(descripeLable)
descripeLable.snp.makeConstraints { make in
make.top.equalToSuperview().offset(8)
make.left.equalToSuperview().offset(8)
make.right.equalToSuperview().offset(-8)
make.height.equalTo(30)
}
subHoldView.addSubview(headImageView)
headImageView.snp.makeConstraints { make in
make.top.equalTo(descripeLable.snp.bottom).offset(10)
make.left.equalTo(descripeLable.snp.left)
make.height.width.equalTo(25)
}
subHoldView.addSubview(nameLable)
nameLable.snp.makeConstraints { make in
make.top.equalTo(headImageView.snp.top)
make.left.equalTo(headImageView.snp.right).offset(5)
make.height.equalTo(12)
make.width.equalTo(50)
}
subHoldView.addSubview(dateLable)
dateLable.snp.makeConstraints { make in
make.top.equalTo(nameLable.snp.bottom).offset(2)
make.left.equalTo(nameLable.snp.left)
make.height.equalTo(12)
make.right.equalTo(nameLable.snp.right)
}
subHoldView.addSubview(numLable)
numLable.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-8)
make.height.equalTo(12)
make.centerY.equalTo(headImageView.snp.centerY)
}
subHoldView.addSubview(heartImageView)
heartImageView.snp.makeConstraints { make in
make.right.equalTo(numLable.snp.left).offset(-6)
make.height.width.equalTo(12)
make.centerY.equalTo(headImageView.snp.centerY)
}
}
}
//
// YHHomeCustomCell.swift
// galaxy
//
// Created by davidhuangA on 2024/1/10.
// Copyright © 2024 www.davidhuang.com. All rights reserved.
//
import UIKit
class YHHomeCustomCell: UITableViewCell {
static let cellReuseIdentifier = "YHHomeCustomCell"
lazy var items = {
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),
AboutAdvantageItem(iconName: "about_response", title: "快速响应", detail: "身份规划师一对一专业服务,第一时间响应您的需求"),
AboutAdvantageItem(iconName: "about_service", title: "专业服务", detail: "5年经验+英语专8级文案导师团队倾力支持"),
AboutAdvantageItem(iconName: "about_service2", title: "精准匹配", detail: "香港专才、香港留学获批常年保持90%以上")]
}()
var dataArray: [String] = [] // 假定我们的数据结构就是一个String数组
var collectionView: UICollectionView!
var collectionContainer: UIView!
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
// 设置布局方向
let flowLayout = UICollectionViewFlowLayout()
let margin = 18.0
let gap = 12.0
let itemWidth = floor((KScreenWidth-2*margin-gap)/2.0)
flowLayout.itemSize = CGSize(width: itemWidth, height: itemWidth)
flowLayout.minimumInteritemSpacing = 12.0
flowLayout.minimumLineSpacing = 12.0
flowLayout.scrollDirection = .vertical
collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectionView.contentInset = UIEdgeInsets(top: 0, left: margin, bottom: 0, right: margin)
collectionView.backgroundColor = UIColor.white
collectionView.register(YHAboutUsAdvantageCell.self, forCellWithReuseIdentifier:YHAboutUsAdvantageCell.cellReuseIdentifier)
collectionView.delegate = self
collectionView.dataSource = self
collectionView.backgroundColor = .yellow //for test hjl
collectionContainer = UIView(frame: .zero)
contentView.addSubview(collectionContainer)
collectionContainer.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(0)
}
collectionContainer.addSubview(collectionView)
collectionView.snp.makeConstraints({ make in
make.edges.equalToSuperview()
})
// collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "test")
// collectionView.delegate = self // 这里根据具体业务写吧,demo中我就把代理直接设置成cell了..
// collectionView.dataSource = self // 根据业务,demo直接先cell持有数据来控制collectionView的显示了..
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// 外部调用,用来设置collectionView的数据源
func setData(_ data: [String]) {
self.dataArray = data
collectionView.reloadData()
// 这里需要 layoutIfNeeded 一下,否则我们不能同步拿到contentSize
// 注意,如果上面collectionContainer的布局没有指明宽度,这个时候cell的宽度是estimate状态,所以下面就算layout也拿不到正确的contentSize
collectionView.layoutIfNeeded()
let height = collectionView.contentSize.height
printLog(height)
collectionContainer.snp.updateConstraints { make in
make.height.equalTo(height)
}
}
}
extension YHHomeCustomCell: UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return items.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHAboutUsAdvantageCell.cellReuseIdentifier, for: indexPath) as! YHAboutUsAdvantageCell
cell.advantateItem = items[indexPath.row]
return cell
}
private func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
print("index is \(indexPath.row)")
}
}
...@@ -26,7 +26,7 @@ extension YHHomePageViewModel { ...@@ -26,7 +26,7 @@ extension YHHomePageViewModel {
callBackBlock(false,error) callBackBlock(false,error)
return return
} }
printLog("model 是 ==> \(model)") // printLog("model 是 ==> \(model)")
self.configModel = model.data self.configModel = model.data
callBackBlock(true,nil) callBackBlock(true,nil)
......
...@@ -22,6 +22,8 @@ class YHAboutUsViewController: YHBaseViewController { ...@@ -22,6 +22,8 @@ class YHAboutUsViewController: YHBaseViewController {
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"), return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),
AboutAdvantageItem(iconName: "about_response", title: "快速响应", detail: "身份规划师一对一专业服务,第一时间响应您的需求"), AboutAdvantageItem(iconName: "about_response", title: "快速响应", detail: "身份规划师一对一专业服务,第一时间响应您的需求"),
AboutAdvantageItem(iconName: "about_service", title: "专业服务", detail: "5年经验+英语专8级文案导师团队倾力支持"), AboutAdvantageItem(iconName: "about_service", title: "专业服务", detail: "5年经验+英语专8级文案导师团队倾力支持"),
AboutAdvantageItem(iconName: "about_service2", title: "精准匹配", detail: "香港专才、香港留学获批常年保持90%以上"),
AboutAdvantageItem(iconName: "about_service2", title: "精准匹配", detail: "香港专才、香港留学获批常年保持90%以上"),
AboutAdvantageItem(iconName: "about_service2", title: "精准匹配", detail: "香港专才、香港留学获批常年保持90%以上")] AboutAdvantageItem(iconName: "about_service2", title: "精准匹配", detail: "香港专才、香港留学获批常年保持90%以上")]
}() }()
...@@ -43,6 +45,7 @@ class YHAboutUsViewController: YHBaseViewController { ...@@ -43,6 +45,7 @@ class YHAboutUsViewController: YHBaseViewController {
collectinoView.register(YHAboutUsAdvantageCell.self, forCellWithReuseIdentifier:YHAboutUsAdvantageCell.cellReuseIdentifier) collectinoView.register(YHAboutUsAdvantageCell.self, forCellWithReuseIdentifier:YHAboutUsAdvantageCell.cellReuseIdentifier)
collectinoView.delegate = self collectinoView.delegate = self
collectinoView.dataSource = self collectinoView.dataSource = self
collectinoView.backgroundColor = .purple //for test hjl
return collectinoView return collectinoView
}() }()
...@@ -89,6 +92,11 @@ class YHAboutUsViewController: YHBaseViewController { ...@@ -89,6 +92,11 @@ class YHAboutUsViewController: YHBaseViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
setupUI() setupUI()
self.collectView.reloadData()
self.collectView.layoutIfNeeded()
let height = self.collectView.contentSize.height
printLog("self.collectView.contentSize.height = \(height)")
} }
func setupUI() { func setupUI() {
...@@ -134,7 +142,7 @@ class YHAboutUsViewController: YHBaseViewController { ...@@ -134,7 +142,7 @@ class YHAboutUsViewController: YHBaseViewController {
} }
collectView.snp.makeConstraints { make in collectView.snp.makeConstraints { make in
make.left.right.bottom.equalTo(view) make.left.right.bottom.equalToSuperview()
make.top.equalTo(advantageLabel.snp.bottom).offset(22) make.top.equalTo(advantageLabel.snp.bottom).offset(22)
} }
......
...@@ -86,6 +86,5 @@ class YHAboutUsAdvantageCell: UICollectionViewCell { ...@@ -86,6 +86,5 @@ class YHAboutUsAdvantageCell: UICollectionViewCell {
make.top.equalTo(titleLabel.snp.bottom).offset(8) make.top.equalTo(titleLabel.snp.bottom).offset(8)
make.bottom.equalTo(contentView).offset(-5) make.bottom.equalTo(contentView).offset(-5)
} }
} }
} }
...@@ -144,7 +144,7 @@ class YHNetRequest: NSObject { ...@@ -144,7 +144,7 @@ class YHNetRequest: NSObject {
httpRequest?.responseString(completionHandler: { string in httpRequest?.responseString(completionHandler: { string in
#if DEBUG #if DEBUG
printLog("\n网络请求已返回 string=\(string)") // printLog("\n网络请求已返回 string=\(string)")
#endif #endif
self.completeHandle(string: string) self.completeHandle(string: string)
}) })
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "Vector.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Vector@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Vector@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "fa969293-cb4c-490e-b597-3345266ff912 54.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fa969293-cb4c-490e-b597-3345266ff912 54@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fa969293-cb4c-490e-b597-3345266ff912 54@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