Commit 29115e3d authored by pete谢兆麟's avatar pete谢兆麟

除香港办事外 4大金刚滑动安排

parent efdc7465
......@@ -303,6 +303,8 @@
04F5F8642C19460D004A463C /* YHHKLifeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F8632C19460D004A463C /* YHHKLifeViewController.swift */; };
04F5F8662C197FFF004A463C /* YHHKControllerHoldViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F8652C197FFF004A463C /* YHHKControllerHoldViewController.swift */; };
04F5F8682C198372004A463C /* YHHKClassListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F8672C198372004A463C /* YHHKClassListViewController.swift */; };
04F5F86A2C1A95BB004A463C /* YHOtherServiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */; };
04F5F86C2C1A9B52004A463C /* YHOtherServiceListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F86B2C1A9B52004A463C /* YHOtherServiceListViewController.swift */; };
04FA8B2B2C06F59D00ABE43F /* YHAppleLoginManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FA8B2A2C06F59D00ABE43F /* YHAppleLoginManager.swift */; };
04FA8B2E2C084C7E00ABE43F /* ATAuthSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 04FA8B2D2C084C7E00ABE43F /* ATAuthSDK.bundle */; };
04FA8B302C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FA8B2F2C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift */; };
......@@ -786,6 +788,8 @@
04F5F8632C19460D004A463C /* YHHKLifeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKLifeViewController.swift; sourceTree = "<group>"; };
04F5F8652C197FFF004A463C /* YHHKControllerHoldViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKControllerHoldViewController.swift; sourceTree = "<group>"; };
04F5F8672C198372004A463C /* YHHKClassListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKClassListViewController.swift; sourceTree = "<group>"; };
04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherServiceViewController.swift; sourceTree = "<group>"; };
04F5F86B2C1A9B52004A463C /* YHOtherServiceListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherServiceListViewController.swift; sourceTree = "<group>"; };
04FA8B2A2C06F59D00ABE43F /* YHAppleLoginManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAppleLoginManager.swift; sourceTree = "<group>"; };
04FA8B2D2C084C7E00ABE43F /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = ATAuthSDK.bundle; path = "galaxy/Classes/Modules/AutoLogin(一键登录)/framework/ATAuthSDK_D.framework/ATAuthSDK.bundle"; sourceTree = "<group>"; };
04FA8B2F2C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOneKeyLoginViewModel.swift; sourceTree = "<group>"; };
......@@ -2098,6 +2102,8 @@
children = (
A567E5742BD7643D00D5D5A0 /* YHSearchInfomationVC.swift */,
A567E5752BD7643D00D5D5A0 /* YHFourKingViewController.swift */,
04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */,
04F5F86B2C1A9B52004A463C /* YHOtherServiceListViewController.swift */,
A567E5762BD7643D00D5D5A0 /* YHHomePageViewController.swift */,
A567E5772BD7643D00D5D5A0 /* YHStartPageViewController.swift */,
A567E5782BD7643D00D5D5A0 /* YHHomeWebViewController.swift */,
......@@ -2766,6 +2772,7 @@
04B9EE5B2C06CC3100A4018D /* YHOtherLoginViewController.swift in Sources */,
045EEF0C2B9F171A0022A143 /* YHBasicInfoFillBottomView.swift in Sources */,
A5ACE93D2B4564F7002C94D2 /* UIButton+Extension.swift in Sources */,
04F5F86C2C1A9B52004A463C /* YHOtherServiceListViewController.swift in Sources */,
04CC2EF02BC3DDB2000305DD /* YHServiceBannerView.swift in Sources */,
045EEEA32B9F171A0022A143 /* YHCompanyModel.swift in Sources */,
045EEEC62B9F171A0022A143 /* YHOtherTextViewItemView.swift in Sources */,
......@@ -2930,6 +2937,7 @@
0493B3DC2BA7EFE600AF9393 /* YHCertificateSearchViewController.swift in Sources */,
A5FD63BF2B6250BC00D1D9DA /* YHInformationPerfectCell.swift in Sources */,
045EEE942B9F171A0022A143 /* YHPreviewInfoQuestionAndAnswerItemView.swift in Sources */,
04F5F86A2C1A95BB004A463C /* YHOtherServiceViewController.swift in Sources */,
045EEED32B9F171A0022A143 /* YHScoreItemCell.swift in Sources */,
045EEEEE2B9F171A0022A143 /* YHCertificateUploadVC.swift in Sources */,
04EA37742BEA0A3400DBAF64 /* YHShareManager.swift in Sources */,
......
//
// YHOtherServiceListView.swift
// galaxy
//
// Created by EDY on 2024/6/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import JXSegmentedView
class YHOtherServiceListViewController: YHBaseViewController {
let homeViewModel: YHHomePageViewModel = YHHomePageViewModel()
var items:[YHHomeListModel?] = [] {
didSet {
self.myCollectView.reloadData()
}
}
lazy var myCollectView = {
// 设置布局方向
let flowLayout = YHHomeCollectionLayout()
flowLayout.minimumInteritemSpacing = 7.0
flowLayout.minimumColumnSpacing = 7.0
flowLayout.sectionInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
let collectinoView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectinoView.backgroundColor = .white
collectinoView.register(YHHomeCollectionViewCell.self, forCellWithReuseIdentifier:YHHomeCollectionViewCell.cellReuseIdentifier)
collectinoView.delegate = self
collectinoView.dataSource = self
// collectinoView.bounces = false
collectinoView.translatesAutoresizingMaskIntoConstraints = false
collectinoView.alwaysBounceVertical = true
collectinoView.showsVerticalScrollIndicator = false
collectinoView.showsHorizontalScrollIndicator = false
return collectinoView
}()
var classId: Int = 0
public var vcCanScroll : Bool = true
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadData()
}
}
extension YHOtherServiceListViewController {
func loadData() {
self.homeViewModel.getList(true, classId) {[weak self] success, error in
guard let self = self else { return }
self.items = self.homeViewModel.arrHomeNewsData ?? []
if self.homeViewModel.hasMoreForHomeNews == false {
self.myCollectView.es.noticeNoMoreData()
self.myCollectView.footer?.alpha = 1
}
}
}
func setupUI() {
gk_navBarAlpha = 1
gk_navigationBar.isHidden = true
view.addSubview(myCollectView)
myCollectView.snp.makeConstraints { make in
make.top.left.right.bottom.equalToSuperview()
}
myCollectView.es.addInfiniteScrolling {[weak self] in
guard let self = self else { return }
self.homeViewModel.getList(false, self.classId) {[weak self] success, error in
guard let self = self else { return }
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 0.35, execute: {
CATransaction.setDisableActions(true)
self.items = self.homeViewModel.arrHomeNewsData ?? []
CATransaction.commit()
self.myCollectView.es.stopLoadingMore()
if self.homeViewModel.hasMoreForHomeNews == false {
self.myCollectView.es.noticeNoMoreData()
}
})
}
}
}
}
extension YHOtherServiceListViewController: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView {
return view
}
}
extension YHOtherServiceListViewController: 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: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHHomeCollectionViewCell
cell.listModel = items[indexPath.row]
return cell
}
private func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
print("index is \(indexPath.row)")
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let model = items[indexPath.row] else { return }
if model.type == 2 {
let vc = YHHomeWebViewController()
vc.url = YHBaseUrlManager.shared.curH5URL() + "articleDetail.html" + "?id=\(model.id)"
vc.id = model.id
vc.block = {[weak self] model in
guard let self = self else { return }
let arr = self.items
for (index, targetItem) in arr.enumerated() {
guard let target = targetItem else { return }
if target.id == model.id {
target.is_like = model.is_like
target.like_count = model.like_count
self.myCollectView.reloadItems(at: [IndexPath.SubSequence(item: index, section: 0)])
}
}
}
UIViewController.current?.navigationController?.pushViewController(vc)
} else if model.type == 1 {
printLog("直接播放视频")
}
}
}
extension YHOtherServiceListViewController: CollectionViewWaterfallLayoutDelegate {
func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
guard let model = items[indexPath.row] else { return CGSize.zero }
return CGSize(width: model.img_width_cell, height: model.img_height_cell)
}
}
//
// YHOtherServiceViewController.swift
// galaxy
//
// Created by EDY on 2024/6/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import JXSegmentedView
class YHOtherServiceViewController: YHBaseViewController {
let homeViewModel: YHHomePageViewModel = YHHomePageViewModel()
var canScroll : Bool = true {
didSet {
for vc in arrItemVCs {
vc.vcCanScroll = canScroll
}
}
}
var items: [YHClassifyModel] = []
var classID = 0
var myDefaultNavItemIndex : Int = 0 {
didSet {
self.segmentedView.selectItemAt(index: self.myDefaultNavItemIndex)
}
}
var arrItemTitles: [String] = []
var arrItemVCs : [YHOtherServiceListViewController] = []
var segmentedView : JXSegmentedView = JXSegmentedView(frame: CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: KScreenWidth, height: 55))
lazy var segmentedDataSource: JXSegmentedTitleDataSource = {
let dataSource = JXSegmentedTitleDataSource()
dataSource.titles = arrItemTitles
dataSource.titleNormalFont = UIFont.PFSC_R(ofSize: 14)
dataSource.titleSelectedColor = UIColor.labelTextColor2
dataSource.titleSelectedFont = UIFont.PFSC_M(ofSize: 14)
dataSource.titleSelectedColor = UIColor.white
dataSource.isTitleMaskEnabled = true
dataSource.isItemSpacingAverageEnabled = false
dataSource.itemWidth = JXSegmentedViewAutomaticDimension
dataSource.itemSpacing = 24
return dataSource
}()
//分类title 所对应的VC
lazy var listContainerView: JXSegmentedListContainerView! = {
return JXSegmentedListContainerView(dataSource: self, type: .collectionView)
}()
override func viewDidLoad() {
super.viewDidLoad()
//segmentedViewDataSource一定要通过属性强持有!!!!!!!!!
segmentedView.dataSource = segmentedDataSource
segmentedView.delegate = self
view.addSubview(segmentedView)
segmentedView.listContainer = listContainerView
view.addSubview(listContainerView)
//分类Title
segmentedView.dataSource = segmentedDataSource
segmentedView.delegate = self
//配置指示器
let indicator = JXSegmentedIndicatorBackgroundView()
indicator.indicatorColor = UIColor.brandMainColor
indicator.indicatorHeight = 32
segmentedView.indicators = [indicator]
segmentedView.defaultSelectedIndex = self.myDefaultNavItemIndex
getData()
}
func getData() {
if classID == 3 {
gk_navTitle = "身份福利"
} else if classID == 4 {
gk_navTitle = "办理攻略"
} else if classID == 5 {
gk_navTitle = "客户心声"
}
homeViewModel.getHomeClassify{[weak self] success, error in
guard let self = self, let classify = self.homeViewModel.classify else { return }
for item in classify {
let model = item as YHHomeClassifyModel
if model.id == self.classID {
self.items = model.children
self.arrItemTitles.removeAll()
for item in model.children {
self.arrItemTitles.append(item.name)
let vc = YHOtherServiceListViewController()
vc.classId = item.id
arrItemVCs.append(vc)
}
}
self.segmentedDataSource.titles = arrItemTitles
self.segmentedView.dataSource = segmentedDataSource
self.segmentedView.reloadData()
self.updateViews()
}
}
}
func updateViews() {
if arrItemTitles.count != 1 {
segmentedView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: view.bounds.size.width, height: 55)
listContainerView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar + 55, width: view.bounds.size.width, height: view.bounds.size.height - 55 - k_Height_NavigationtBarAndStatuBar)
} else {
segmentedView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: view.bounds.size.width, height: 0)
listContainerView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: view.bounds.size.width, height: view.bounds.size.height - k_Height_NavigationtBarAndStatuBar)
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
//处于第一个item的时候,才允许屏幕边缘手势返回
navigationController?.interactivePopGestureRecognizer?.isEnabled = (segmentedView.selectedIndex == 0)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
//离开页面的时候,需要恢复屏幕边缘手势,不能影响其他页面
navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if arrItemTitles.count != 1 {
segmentedView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: view.bounds.size.width, height: 55)
listContainerView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar + 55, width: view.bounds.size.width, height: view.bounds.size.height - 55 - k_Height_NavigationtBarAndStatuBar)
} else {
segmentedView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: view.bounds.size.width, height: 0)
listContainerView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: view.bounds.size.width, height: view.bounds.size.height - k_Height_NavigationtBarAndStatuBar)
}
segmentedView.backgroundColor = .white
}
}
extension YHOtherServiceViewController: JXSegmentedViewDelegate {
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
}
func segmentedView(_ segmentedView: JXSegmentedView, scrollingFrom leftIndex: Int, to rightIndex: Int, percent: CGFloat) {
}
}
extension YHOtherServiceViewController: JXSegmentedListContainerViewDataSource {
func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int {
if let titleDataSource = segmentedView.dataSource as? JXSegmentedBaseDataSource {
return titleDataSource.dataSource.count
}
return 0
}
func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate {
return arrItemVCs[index] as JXSegmentedListContainerViewListDelegate
}
}
......@@ -52,16 +52,16 @@ private extension YHHomeKingKongBlockView {
if let tag = gestureRecognizer.view?.tag {
switch tag {
case 0:
let vc = YHFourKingViewController()
vc.id = 3
let vc = YHOtherServiceViewController()
vc.classID = 3
UIViewController.current?.navigationController?.pushViewController(vc)
case 1:
let vc = YHFourKingViewController()
vc.id = 4
let vc = YHOtherServiceViewController()
vc.classID = 4
UIViewController.current?.navigationController?.pushViewController(vc)
case 2:
let vc = YHFourKingViewController()
vc.id = 5
let vc = YHOtherServiceViewController()
vc.classID = 5
UIViewController.current?.navigationController?.pushViewController(vc)
case 3:
let vc = YHHKEventViewController()
......
......@@ -69,6 +69,7 @@ extension YHHKClassListViewController {
func setupUI() {
gk_navBarAlpha = 1
gk_navigationBar.isHidden = true
view.addSubview(myCollectView)
myCollectView.snp.makeConstraints { make in
make.top.left.right.bottom.equalToSuperview()
......
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