Commit 0a4de425 authored by David黄金龙's avatar David黄金龙

服务中心 第二个主界面

parent 8405c037
......@@ -33,6 +33,7 @@
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; };
A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51044192B495DD0006B60BB /* UIView+Extension.swift */; };
A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A514E5DB2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift */; };
A53026902B4E6F2700F35102 /* YHHomeCustomCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A530268F2B4E6F2700F35102 /* YHHomeCustomCell.swift */; };
A5551FFE2B4C26CE00510980 /* YHBaseViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5551FFD2B4C26CE00510980 /* YHBaseViewModel.swift */; };
A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5573ED12B317BFF00D98EC0 /* AppDelegate.swift */; };
......@@ -172,6 +173,7 @@
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>"; };
A51044192B495DD0006B60BB /* UIView+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = "<group>"; };
A514E5DB2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceCenterSecondViewController.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>"; };
A5573ECE2B317BFF00D98EC0 /* galaxy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = galaxy.app; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -634,6 +636,7 @@
isa = PBXGroup;
children = (
A5ACE9192B4564F7002C94D2 /* YHServiceCenterMainViewController.swift */,
A514E5DB2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -944,6 +947,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */,
0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */,
A5ACE9362B4564F7002C94D2 /* YHNetworkStatusManager.swift in Sources */,
A5ACE92C2B4564F7002C94D2 /* YHLoginStyleButton.swift in Sources */,
......
......@@ -6,7 +6,6 @@
//
import UIKit
//import SmartCodable
//服务中心
class YHServiceCenterMainViewController: YHBaseViewController {
......@@ -146,6 +145,6 @@ extension YHServiceCenterMainViewController : UITableViewDelegate,UITableViewDat
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
printLog("点击了 tableView Cell \(indexPath.row)")
navigationController?.pushViewController(YHServiceCenterSecondViewController())
}
}
//
// YHServiceCenterSecondViewController.swift
// galaxy
//
// Created by davidhuangA on 2024/1/24.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
//服务中心
class YHServiceCenterSecondViewController: YHBaseViewController {
private let serviceCenterMainReqVM : YHServiceCenterMainViewModel = YHServiceCenterMainViewModel()
private var unfoldFlag : Bool = true //是否展开
private lazy var downArrowImagev : UIImageView = {
let imagV = UIImageView(frame: CGRect(x: KScreenWidth - 16 - 32, y: 16, width: 28, height: 28))
imagV.image = UIImage(named: "service_center_down_arrow")
imagV.contentMode = .scaleAspectFill
// view.addSubview(imagV)
return imagV
}()
private lazy var topBkg : UIView = {
let imagV = UIImageView()
imagV.image = UIImage(named: "service_center_head_bkg")
imagV.contentMode = .scaleAspectFill
return imagV
}()
private let loginTipsView : YHLoginTipsView = {
let view = YHLoginTipsView()
view.viewType = 0
view.isHidden = true
return view
}()
private let noDataView : YHLoginTipsView = {
let view = YHLoginTipsView()
view.viewType = 1
view.isHidden = true
return view
}()
var homeTableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.showsHorizontalScrollIndicator = false
tableView.showsVerticalScrollIndicator = false
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 81.0
tableView.register(YHContractCell.self,forCellReuseIdentifier: YHContractCell.cellReuseIdentifier)
tableView.register(UITableViewCell.self,forCellReuseIdentifier: "cell")
return tableView
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
loadData()
}
}
extension YHServiceCenterSecondViewController {
func loadData() {
self.serviceCenterMainReqVM.getContactList { success, error in
if success == true {
}
self.homeTableView.reloadData()
}
}
func setupUI() {
gk_navTitle = "服务中心"
gk_navBarAlpha = 1.0
gk_navLineHidden = false
view.addSubview(topBkg)
topBkg.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(216)
}
view.addSubview(loginTipsView)
loginTipsView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.centerY.equalToSuperview().offset(-64)
make.width.equalTo(KScreenWidth)
}
view.addSubview(noDataView)
noDataView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.centerY.equalToSuperview().offset(-64)
make.width.equalTo(KScreenWidth)
}
view.addSubview(homeTableView)
homeTableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-k_Height_TabBar)
}
homeTableView.delegate = self
homeTableView.dataSource = self
}
@objc func clickUnfoldView() {
unfoldFlag = !unfoldFlag
if unfoldFlag == true {
UIView.animate(withDuration: 0.25) {
self.downArrowImagev.transform = CGAffineTransform.identity
}
} else {
UIView.animate(withDuration: 0.25) {
self.downArrowImagev.transform = CGAffineTransform(rotationAngle: .pi)
}
}
homeTableView.reloadSections(IndexSet(integer: 0), with: UITableView.RowAnimation.automatic)
}
}
// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHServiceCenterSecondViewController : UITableViewDelegate,UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if unfoldFlag == true {
return 1
}
return 0
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 60
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 60))
view.backgroundColor = .white
let lable = UILabel(frame: CGRect(x: 16, y: 0, width: 200, height: 60))
lable.text = "身份申请"
lable.font = kFont(size: 17)
view.addSubview(lable)
view.addSubview(self.downArrowImagev)
let tap = UITapGestureRecognizer(target: self, action: #selector(clickUnfoldView))
view.addGestureRecognizer(tap)
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHContractCell.cellReuseIdentifier, for: indexPath) as! YHContractCell
cell.selectionStyle = .none
if indexPath.section < self.serviceCenterMainReqVM.arrContactList.count {
cell.dataModel = self.serviceCenterMainReqVM.arrContactList[indexPath.section]
}
return cell
}
return UITableViewCell()
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
if indexPath.row == 0 {
printLog("点击了 0 row")
// unfoldFlag = !unfoldFlag
}
}
}
{
"images" : [
{
"filename" : "down-arrow.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "down-arrow@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "down-arrow@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