Commit 38ea9c10 authored by Steven杜宇's avatar Steven杜宇

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

# Conflicts:
#	galaxy/galaxy.xcodeproj/project.pbxproj
parents 7d6a542b d638dbad
This diff is collapsed.
......@@ -66,7 +66,7 @@ class YHDavidTestViewController: YHBaseViewController {
lazy var items = {
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高")]
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")]
}()
......@@ -105,7 +105,7 @@ class YHDavidTestViewController: YHBaseViewController {
view.backgroundColor = .white
gk_navigationBar.isHidden = true
self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高")]
self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")]
self.myCollectView.reloadData()
}
}
......@@ -115,7 +115,7 @@ extension YHDavidTestViewController {
private func loadFirstItem() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高")]
self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")]
self.myCollectView.es.stopPullToRefresh(ignoreDate: true,ignoreFooter: false)
self.myCollectView.reloadData()
}
......@@ -124,11 +124,11 @@ extension YHDavidTestViewController {
private func loadFakeData() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.myCollectView.es.stopLoadingMore()
self.myCollectView.reloadData()
......
......@@ -12,12 +12,7 @@ import GKNavigationBarSwift
class YHHomePageViewController: YHBaseViewController {
lazy var items = {
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高")]
}()
private lazy var homeBannerView: YHHomeBannerView = {
let view = YHHomeBannerView()
return view
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")]
}()
lazy var homeCollectView = {
......@@ -32,12 +27,11 @@ class YHHomePageViewController: YHBaseViewController {
flowLayout.scrollDirection = .vertical
let collectinoView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectinoView.contentInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
collectinoView.backgroundColor = .white
collectinoView.register(YHAboutUsAdvantageCell.self, forCellWithReuseIdentifier:YHAboutUsAdvantageCell.cellReuseIdentifier)
collectinoView.register(YHDavidTestCollectionViewCell.self, forCellWithReuseIdentifier:YHDavidTestCollectionViewCell.cellReuseIdentifier)
collectinoView.delegate = self
collectinoView.dataSource = self
collectinoView.showsVerticalScrollIndicator = false
collectinoView.translatesAutoresizingMaskIntoConstraints = false
collectinoView.alwaysBounceVertical = true
......@@ -49,12 +43,16 @@ class YHHomePageViewController: YHBaseViewController {
setupUI()
}
lazy var searchView: YHHomeSearchView = {
let view = YHHomeSearchView()
return view
}()
lazy var homeHeaderView: YHHomeHeadView = {
let view = YHHomeHeadView()
return view
}()
}
private extension YHHomePageViewController {
......@@ -73,18 +71,24 @@ private extension YHHomePageViewController {
view.addSubview(homeCollectView)
homeCollectView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(searchView.snp.bottom).offset(20)
make.top.equalTo(searchView.snp.bottom)
}
homeHeaderView.frame = CGRect(x: 0, y: -YHHomeHeadView.viewH, width: KScreenWidth - 40, height: YHHomeHeadView.viewH)
homeCollectView.addSubview(homeHeaderView)
homeCollectView.contentInset = UIEdgeInsets(top: YHHomeHeadView.viewH, left: 20, bottom: 20, right: 20)
homeCollectView.es.addInfiniteScrolling {
self.loadFakeData()
}
homeCollectView.reloadData()
}
func loadFirstItem() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高")]
self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")]
self.homeCollectView.es.stopPullToRefresh(ignoreDate: true,ignoreFooter: false)
self.homeCollectView.reloadData()
}
......@@ -93,11 +97,11 @@ private extension YHHomePageViewController {
func loadFakeData() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""))
self.homeCollectView.es.stopLoadingMore()
self.homeCollectView.reloadData()
......
......@@ -14,7 +14,7 @@ import ESTabBarController_swift
class YHStartPageViewController: UIViewController {
private var MaxTime : Int = 50 //for test hjl
private var MaxTime : Int = 3
private var timer : Timer?
lazy var imagV: UIImageView = {
......
//
// YHHkLifeAndIdItemView.swift
// galaxy
//
// Created by davidhuangA on 2024/4/8.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum HkLifeItemType : Int {
case unknow = -1 //未知
case hkID = 0 //香港身份
case hklife = 1 //香港生活
}
class YHHkLifeAndIdItemView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
initView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
lazy var bkgImagV: UIImageView = {
let imageV = UIImageView()
imageV.contentMode = .scaleAspectFill
return imageV
}()
lazy var iconV: UIImageView = {
let imageV = UIImageView()
imageV.contentMode = .scaleAspectFill
return imageV
}()
lazy var titleLable : UILabel = {
let label = UILabel()
label.text = "香港身份"
label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_M(ofSize: 17)
label.lineBreakMode = .byTruncatingMiddle
return label
}()
lazy var subtitleLable:UILabel = {
let label = UILabel()
label.text = "去香港"
label.textColor = UIColor(hex: 0x94A3B8, alpha: 1.0)
label.font = UIFont.PFSC_R(ofSize: 11)
label.lineBreakMode = .byTruncatingMiddle
return label
}()
var itemType : HkLifeItemType = .unknow {
didSet {
updateUI()
}
}
}
private extension YHHkLifeAndIdItemView {
func initView() {
addSubview(bkgImagV)
bkgImagV.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
addSubview(iconV)
iconV.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(kMargin)
make.width.height.equalTo(34)
}
addSubview(titleLable)
titleLable.snp.makeConstraints { make in
make.top.equalTo(iconV.snp.top).offset(-3)
make.left.equalTo(iconV.snp.right).offset(kMargin)
make.height.equalTo(24)
make.right.equalTo(-10)
}
addSubview(subtitleLable)
subtitleLable.snp.makeConstraints { make in
make.top.equalTo(titleLable.snp.bottom).offset(2)
make.left.equalTo(titleLable.snp.left)
make.height.equalTo(16)
make.right.equalTo(titleLable.snp.right)
}
}
func updateUI() {
if itemType == .hkID {
bkgImagV.image = UIImage(named: "hklife_bkg_0")
iconV.image = UIImage(named: "hklife_icon_0")
titleLable.text = "香港身份"
subtitleLable.text = "去香港"
} else if itemType == .hklife {
bkgImagV.image = UIImage(named: "hklife_bkg_1")
iconV.image = UIImage(named: "hklife_icon_1")
titleLable.text = "香港生活"
subtitleLable.text = "在香港"
} else {
printLog("errorr:未处理")
}
}
}
//
// YHHkLifeAndIdView.swift
// galaxy
//
// Created by davidhuangA on 2024/4/8.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
/*
香港身份 香港生活
*/
class YHHkLifeAndIdView: UIView {
static let viewH : CGFloat = 74.0
override init(frame: CGRect) {
super.init(frame: frame)
initView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
private extension YHHkLifeAndIdView {
func initView() {
let itemW : CGFloat = (KScreenWidth - 20 * 2 - 12) / 2.0
let item0 = YHHkLifeAndIdItemView()
item0.itemType = .hkID
addSubview(item0)
item0.snp.makeConstraints { make in
make.top.left.equalToSuperview()
make.height.equalTo(YHHkLifeAndIdView.viewH)
make.width.equalTo(itemW)
}
let item1 = YHHkLifeAndIdItemView()
item1.itemType = .hklife
addSubview(item1)
item1.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalTo(item0.snp.right).offset(12)
make.height.equalTo(YHHkLifeAndIdView.viewH)
make.width.equalTo(itemW)
}
}
}
......@@ -9,18 +9,15 @@
import Foundation
import FSPagerView
import Kingfisher
//import SwifterSwift
class YHHomeBannerView: UIView {
// MARK: - constant 常量
// 位置、大小、图片、文本
fileprivate var dataArr: [YHBannerModel] = [YHBannerModel(),YHBannerModel(),YHBannerModel(),YHBannerModel(),YHBannerModel()]
static let viewH : CGFloat = KScreenWidth - 20 * 2
// MARK: - life cycle 生命周期
//工程的viewDidLoad、viewWillAppear、init、didReceiveMemoryWarning等方法都放在这里
// 位置、大小、图片、文本
fileprivate var dataArr: [YHBannerModel] = [YHBannerModel(),YHBannerModel(),YHBannerModel(),YHBannerModel(),YHBannerModel()]
override init(frame: CGRect) {
super.init(frame: frame)
......@@ -31,17 +28,34 @@ class YHHomeBannerView: UIView {
fatalError("init(coder:) has not been implemented")
}
private lazy var bannerView: FSPagerView = {
let view = FSPagerView()
view.delegate = self
view.dataSource = self
view.automaticSlidingInterval = 3
view.register(FSPagerViewCell.self, forCellWithReuseIdentifier: "cell")
view.itemSize = FSPagerView.automaticSize
view.interitemSpacing = 10
return view
}()
// MARK: - view layout 子视图的布局
//界面布局
lazy var pageControl: FSPageControl = {
let view = FSPageControl()
return view
}()
}
private extension YHHomeBannerView {
func initView() {
addSubview(bannerView)
bannerView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(10)
make.bottom.equalToSuperview()
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.top.equalToSuperview()
make.left.equalToSuperview()
make.right.equalToSuperview()
make.height.equalTo(YHHomeBannerView.viewH)
}
bannerView.addSubview(pageControl)
......@@ -49,7 +63,6 @@ class YHHomeBannerView: UIView {
make.left.bottom.right.equalToSuperview()
make.height.equalTo(25)
}
setupPageControl()
bannerView.reloadData()
}
......@@ -60,53 +73,15 @@ class YHHomeBannerView: UIView {
self.pageControl.contentInsets = UIEdgeInsets(top: 0, left: 12, bottom: 10, right: 12)
let normalImage = UIImage(color: UIColor(hex: 0xff0000, alpha: 1.0), size: CGSize(width: 5, height: 5))//UIImage(color: UIColor(white: 1, alpha: 0.5), size: CGSize(width: 5, height: 5))
let normalImage = UIImage(color: UIColor(hex: 0xff0000, alpha: 1.0), size: CGSize(width: 5, height: 5))
let selectImage = UIImage(color: .white, size: CGSize(width: 8, height: 5))
self.pageControl.setImage(normalImage, for: .normal)
self.pageControl.setImage(selectImage, for: .selected)
self.pageControl.interitemSpacing = 3
}
// public func refreshUI(_ arr: [YHBannerModel]) {
//
// let model : YHBannerModel = YHBannerModel()
// model.img_url = "https://upload-cdn.galaxy-immi.com/sell/test/1668772072522.jpg"
//
// model.link_type = 0
// model.title = "我是测试数据"
//
// let arr = [model,model,model,model,model]
//
// self.dataArr = arr
// setupPageControl()
// bannerView.reloadData()
// }
private lazy var bannerView: FSPagerView = {
let view = FSPagerView()
view.delegate = self
view.dataSource = self
view.automaticSlidingInterval = 3
view.register(FSPagerViewCell.self, forCellWithReuseIdentifier: "cell")
view.itemSize = FSPagerView.automaticSize
view.interitemSpacing = 10
return view
}()
lazy var pageControl: FSPageControl = {
let view = FSPageControl()
return view
}()
}
// MARK: - delegate 具体到某个delegate,比如UITableViewDelegate
//代理或者数据源
// MARK: - FSPagerViewDelegate
extension YHHomeBannerView: FSPagerViewDataSource, FSPagerViewDelegate {
public func numberOfItems(in pagerView: FSPagerView) -> Int {
......
......@@ -13,10 +13,10 @@ class YHHomeCustomCell: UITableViewCell {
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%以上")]
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),
AboutAdvantageItem(iconName: "about_response", title: "快速响应", detail: "身份规划师一对一专业服务,第一时间响应您的需求", url: ""),
AboutAdvantageItem(iconName: "about_service", title: "专业服务", detail: "5年经验+英语专8级文案导师团队倾力支持", url: ""),
AboutAdvantageItem(iconName: "about_service2", title: "精准匹配", detail: "香港专才、香港留学获批常年保持90%以上", url: "")]
}()
......
......@@ -7,7 +7,64 @@
//
import UIKit
class YHHomeHeadView: UIView {
static let viewH : CGFloat = (20 + YHHomeBannerView.viewH) + (20 + YHHkLifeAndIdView.viewH) + (20 + YHHomeKingKongBlockView.viewH) + 31
override init(frame: CGRect) {
super.init(frame: frame)
initView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
//1.bannner
lazy var homeBannerView : YHHomeBannerView = {
let view = YHHomeBannerView()
return view
}()
//2.香港身份 香港生活
lazy var homeHkLife : YHHkLifeAndIdView = {
let view = YHHkLifeAndIdView()
return view
}()
//3. 四大金刚区
lazy var homeKingKongBlock : YHHomeKingKongBlockView = {
let view = YHHomeKingKongBlockView()
return view
}()
}
private extension YHHomeHeadView {
func initView() {
backgroundColor = .clear
addSubview(homeBannerView)
homeBannerView.snp.makeConstraints { make in
make.top.equalTo(20)
make.left.right.equalToSuperview()
make.height.equalTo(YHHomeBannerView.viewH)
}
// homeBannerView.backgroundColor = .red
addSubview(homeHkLife)
homeHkLife.snp.makeConstraints { make in
make.top.equalTo(homeBannerView.snp.bottom).offset(20)
make.left.right.equalToSuperview()
make.height.equalTo(YHHkLifeAndIdView.viewH)
}
// homeHkLife.backgroundColor = .yellow
addSubview(homeKingKongBlock)
homeKingKongBlock.snp.makeConstraints { make in
make.top.equalTo(homeHkLife.snp.bottom).offset(20)
make.left.right.equalToSuperview()
make.height.equalTo(YHHomeKingKongBlockView.viewH)
}
homeKingKongBlock.backgroundColor = .purple
}
}
//
// YHHomeKingKongBlockView.swift
// galaxy
//
// Created by davidhuangA on 2024/4/8.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHomeKingKongBlockView: UIView {
static let viewH : CGFloat = 71.0
override init(frame: CGRect) {
super.init(frame: frame)
initView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
private extension YHHomeKingKongBlockView {
func initView() {
}
}
//
// BsPageContentView.swift
// GDKit
//
// Created by GDKit on 01/11/2022.
// Copyright (c) 2022 GDKit. All rights reserved.
//
import UIKit
@objc public protocol YHPageContentViewDelegate : AnyObject {
func pageContentView(_ contentView : YHPageContentView, progress : CGFloat, sourceIndex : Int, targetIndex : Int)
}
private let ContentCellID = "BsContentCellID"
open class YHPageContentView: UIView {
// MARK: - 定义属性
fileprivate var childVcs : [UIViewController]
fileprivate weak var parentVC : UIViewController?
fileprivate var startOffsetX : CGFloat = 0
fileprivate var isForbidScrollDelegate : Bool = false
@objc public weak var delegate : YHPageContentViewDelegate?
public var isScrollEnabled: Bool? {
didSet {
if let isScrollEnabled = isScrollEnabled {
collectionView.isScrollEnabled = isScrollEnabled
}
}
}
@objc public func banScrollEnabled() {
// collectionView.isScrollEnabled = false
collectionView.isScrollEnabled = true
}
fileprivate func getLayout() -> UICollectionViewFlowLayout {
let layout = UICollectionViewFlowLayout()
layout.itemSize = self.bounds.size
layout.minimumLineSpacing = 0
layout.minimumInteritemSpacing = 0
layout.scrollDirection = .horizontal
return layout
}
// MARK: - 懒加载属性
fileprivate lazy var collectionView : UICollectionView = {[weak self] in
// 1.创建layout
let layout = self?.getLayout() ?? UICollectionViewFlowLayout()
// 2.创建UICollectionView
let collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
collectionView.backgroundColor = .clear//groupTableViewBackground
collectionView.showsHorizontalScrollIndicator = false
collectionView.isPagingEnabled = true
collectionView.bounces = false
collectionView.dataSource = self
collectionView.delegate = self
collectionView.scrollsToTop = false
collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: ContentCellID)
return collectionView
}()
// MARK: - 自定义构造函数
@objc public init(frame: CGRect, childVcs : [UIViewController], parentViewController : UIViewController?) {
self.childVcs = childVcs
self.parentVC = parentViewController
super.init(frame: frame)
// 设置UI
setupUI()
}
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
// MARK: - 设置UI界面
extension YHPageContentView {
fileprivate func setupUI() {
// 1.将所有的子控制器添加父控制器中
// for childVc in childVcs {
// parentVC?.addChild(childVc)
// }
// 2.添加UICollectionView,用于在Cell中存放控制器的View
addSubview(collectionView)
collectionView.frame = bounds
}
public func refreshRect() {
collectionView.frame = bounds
collectionView.collectionViewLayout = self.getLayout()
}
}
// MARK: - 遵守UICollectionViewDataSource
extension YHPageContentView : UICollectionViewDataSource {
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return childVcs.count
}
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
// 1.创建Cell
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ContentCellID, for: indexPath)
// 2.给Cell设置内容
for view in cell.contentView.subviews {
view.removeFromSuperview()
}
let childVc = childVcs[(indexPath as NSIndexPath).item]
childVc.view.frame = cell.contentView.bounds
cell.contentView.addSubview(childVc.view)
return cell
}
}
// MARK: - 遵守UICollectionViewDelegate
extension YHPageContentView : UICollectionViewDelegate {
public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
isForbidScrollDelegate = false
startOffsetX = scrollView.contentOffset.x
}
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
// 0.判断是否是点击事件
if isForbidScrollDelegate { return }
// 1.定义获取需要的数据
var progress : CGFloat = 0
var sourceIndex : Int = 0
var targetIndex : Int = 0
// 2.判断是左滑还是右滑
let currentOffsetX = scrollView.contentOffset.x
let scrollViewW = scrollView.bounds.width
if currentOffsetX > startOffsetX { // 左滑
// 1.计算progress
progress = currentOffsetX / scrollViewW - floor(currentOffsetX / scrollViewW)
// 2.计算sourceIndex
sourceIndex = Int(currentOffsetX / scrollViewW)
// 3.计算targetIndex
targetIndex = sourceIndex + 1
if targetIndex >= childVcs.count {
targetIndex = childVcs.count - 1
}
// 4.如果完全划过去
if currentOffsetX - startOffsetX == scrollViewW {
progress = 1
targetIndex = sourceIndex
}
} else { // 右滑
// 1.计算progress
progress = 1 - (currentOffsetX / scrollViewW - floor(currentOffsetX / scrollViewW))
// 2.计算targetIndex
targetIndex = Int(currentOffsetX / scrollViewW)
// 3.计算sourceIndex
sourceIndex = targetIndex + 1
if sourceIndex >= childVcs.count {
sourceIndex = childVcs.count - 1
}
}
// 3.将progress/sourceIndex/targetIndex传递给titleView
delegate?.pageContentView(self, progress: progress, sourceIndex: sourceIndex, targetIndex: targetIndex)
}
}
// MARK: - 对外暴露的方法
extension YHPageContentView {
@objc public func setCurrentIndex(_ currentIndex : Int) {
// 1.记录需要进制执行代理方法
isForbidScrollDelegate = true
// 2.滚动正确的位置
let offsetX = CGFloat(currentIndex) * collectionView.frame.width
collectionView.setContentOffset(CGPoint(x: offsetX, y: 0), animated: false)
}
}
......@@ -13,6 +13,7 @@ class YHServerHKLifeViewController: YHBaseViewController {
private let serviceCenterMainReqVM : YHServiceCenterMainViewModel = YHServiceCenterMainViewModel()
var tableHeadView: YHServerTableHeadView!
var tableFootView: YHServiceTableFootView!
var homeTableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
......@@ -61,9 +62,11 @@ extension YHServerHKLifeViewController {
tableHeadView = YHServerTableHeadView()
tableHeadView.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: 365)
tableFootView = YHServiceTableFootView()
tableFootView.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight - k_Height_safeAreaInsetsTop() - 48 - k_Height_TabBar)
view.addSubview(homeTableView)
homeTableView.tableHeaderView = tableHeadView
homeTableView.tableFooterView = tableFootView
homeTableView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_TabBar)
......@@ -83,7 +86,7 @@ extension YHServerHKLifeViewController {
// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHServerHKLifeViewController : UITableViewDelegate,UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return self.serviceCenterMainReqVM.arrContactList.count
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
......
......@@ -211,48 +211,67 @@ class YHDocumentMessageTableViewCell: UITableViewCell {
func updateAllViews() {
guard let dataSource = dataSource else { return }
if dataSource.prospectus.id == 0 {
//state 1待提交 2待客户确认 3待核对 4待审核 5驳回 6已定稿
var color = UIColor.red
var title = " 待提交 "
if dataSource.writing_document.status == 1 {
title = " 待提交 "
/*
docOpt: {
1: '待确认',
2: '待签章',
3: '已驳回',
4: '待核对',
5: '已签章',
6: '已定稿',
7: '已完成'
},
*/
var statusTxt = ""
var color : UIColor = .brandMainColor
let status = dataSource.writing_document.status
if status == 1 {
statusTxt = "待确认"
color = UIColor.brandMainColor
lookButton.isHidden = true
}
if dataSource.writing_document.status == 2 {
title = " 待确认 "
} else if status == 2 {
statusTxt = "待签章"
color = UIColor.brandMainColor
lookButton.isHidden = true
}
if dataSource.writing_document.status == 3 {
title = "核对中"
color = UIColor.warnColor
} else if status == 3 {
statusTxt = "已驳回"
color = UIColor.failColor
editButton.isHidden = true
submitButton.isHidden = true
bottomCenterLineView.isHidden = true
}
if dataSource.writing_document.status == 4 {
title = " 待审核 "
} else if status == 4 {
statusTxt = "核对中"
color = UIColor.warnColor
editButton.isHidden = true
submitButton.isHidden = true
bottomCenterLineView.isHidden = true
}
if dataSource.writing_document.status == 5 {
title = " 已驳回 "
color = UIColor.failColor
} else if status == 5 {
statusTxt = "已签章"
color = UIColor.successColor
editButton.isHidden = true
submitButton.isHidden = true
bottomCenterLineView.isHidden = true
}
if dataSource.writing_document.status == 6 {
title = " 已定稿 "
} else if status == 6 {
statusTxt = "已定稿"
color = UIColor.labelTextColor2
editButton.isHidden = true
submitButton.isHidden = true
bottomCenterLineView.isHidden = true
} else if status == 7 {
statusTxt = "已完成"
color = UIColor.labelTextColor2
editButton.isHidden = true
submitButton.isHidden = true
bottomCenterLineView.isHidden = true
} else {
statusTxt = "--"
color = UIColor.failColor
editButton.isHidden = true
submitButton.isHidden = true
bottomCenterLineView.isHidden = true
}
subTitleLabel.text = title
subTitleLabel.text = statusTxt
subTitleLabel.textColor = color
subTitleLabel.backgroundColor = color.withAlphaComponent(0.08)
fileNameLabel.text = dataSource.writing_document.name
......
......@@ -168,7 +168,7 @@ class YHSchemeTableViewCell: UITableViewCell {
mainMessageLabel.attributedText = newString
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 10 // 设置行间距
paragraphStyle.lineSpacing = 4 // 设置行间距
let attributes: [NSAttributedString.Key: Any] = [
.paragraphStyle: paragraphStyle,
.font: UIFont.PFSC_R(ofSize: 14)
......
//
// YHHomeCollectionViewCell.swift
// galaxy
//
// Created by EDY on 2024/4/8.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import Kingfisher
class YHHomeCollectionViewCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHHomeCollectionViewCell"
var dataSource: AboutAdvantageItem? {
didSet {
updataAllSubViews()
}
}
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: "home_person_icon"))
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.roundCorners([.topLeft,.topRight], radius: 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)
make.bottom.left.right.equalToSuperview()
}
subHoldView.addSubview(descripeLable)
descripeLable.snp.makeConstraints { make in
make.top.equalToSuperview().offset(10)
make.left.equalToSuperview().offset(8)
make.right.equalToSuperview().offset(-8)
make.bottom.equalTo(-36)
}
subHoldView.addSubview(numLable)
numLable.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-8)
make.height.equalTo(12)
make.bottom.equalTo(-10)
}
subHoldView.addSubview(heartImageView)
heartImageView.snp.makeConstraints { make in
make.right.equalTo(numLable.snp.left).offset(-6)
make.height.width.equalTo(12)
make.bottom.equalTo(-10)
}
}
func updataAllSubViews() {
guard let dataSource = dataSource else { return }
let imageSize = getImageSize(dataSource.url)
var imageHeight = 0.0
if imageSize.width == 0 {
imageHeight = width
} else {
imageHeight = width * imageSize.height/imageSize.width
if imageHeight > 280 {
imageHeight = 280
}
}
titleImageView.snp.remakeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(imageHeight)
}
if let url = URL(string: dataSource.url) {
titleImageView.kf.setImage(with: url)
}
descripeLable.text = dataSource.title
}
func getImageSize(_ url: String?) -> CGSize {
guard let urlStr = url, urlStr.count != 0 else {
return CGSize.zero
}
let tempUrl = URL(string: urlStr)
let imageSourceRef = CGImageSourceCreateWithURL(tempUrl! as CFURL, nil)
var width: CGFloat = 0
var height: CGFloat = 0
if let imageSRef = imageSourceRef {
let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSRef, 0, nil)
if let imageP = imageProperties {
let imageDict = imageP as Dictionary
width = imageDict[kCGImagePropertyPixelWidth] as! CGFloat
height = imageDict[kCGImagePropertyPixelHeight] as! CGFloat
}
}
return CGSize(width: width, height: height)
}
}
//
// YHServiceTableFootView.swift
// galaxy
//
// Created by EDY on 2024/4/8.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHServiceTableFootView: UIView {
lazy var items = {
return [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")]
}()
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 = YHGestureCollectionView(frame: .zero, collectionViewLayout: flowLayout)
// collectinoView.contentInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
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
return collectinoView
}()
var dataSource: YHScemeHeadModel? {
didSet {
updateAllViews()
}
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
setUpView()
self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://copyright.bdstatic.com/vcg/creative/cc9c744cf9f7c864889c563cbdeddce6.jpg@h_1280"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://inews.gtimg.com/om_bt/OjPq2cnMN_-ivDKjxpCZ2kk_ab8YC5VMnL-0pQ21fUvd4AA/1000"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://img.pconline.com.cn/images/upload/upc/tx/itbbs/2101/25/c1/251135935_1611532823091_mthumb.jpg"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://photo.16pic.com/00/47/86/16pic_4786353_b.jpg"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://inews.gtimg.com/om_bt/OMvPDmiuH_X5Vq1YLNgbFEzD2h_-2dCfWQ7xZFcKFSEsAAA/641")]
self.myCollectView.reloadData()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
backgroundColor = .white
addSubview(myCollectView)
myCollectView.snp.makeConstraints { make in
make.top.left.right.bottom.equalToSuperview()
}
// self.myCollectView.es.addInfiniteScrolling {
// self.loadFakeData()
// }
}
func updateAllViews() {
guard let model = dataSource else { return }
}
func getImageSize(_ url: String?) -> CGSize {
guard let urlStr = url, urlStr.count != 0 else {
return CGSize.zero
}
let tempUrl = URL(string: urlStr)
let imageSourceRef = CGImageSourceCreateWithURL(tempUrl! as CFURL, nil)
var width: CGFloat = 0
var height: CGFloat = 0
if let imageSRef = imageSourceRef {
let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSRef, 0, nil)
if let imageP = imageProperties {
let imageDict = imageP as Dictionary
width = imageDict[kCGImagePropertyPixelWidth] as! CGFloat
height = imageDict[kCGImagePropertyPixelHeight] as! CGFloat
}
}
return CGSize(width: width, height: height)
}
}
extension YHServiceTableFootView: 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.dataSource = items[indexPath.row]
return cell
}
private func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
print("index is \(indexPath.row)")
}
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
//
// }
}
extension YHServiceTableFootView: CollectionViewWaterfallLayoutDelegate {
func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
let model = items[indexPath.row]
let text = model.title
let width = (KScreenWidth - 47) / 2
let font = UIFont.PFSC_R(ofSize: 14) // 字体大小
let maxWidth = width - 16 // 最大宽度限制
// 创建NSAttributedString对象并设置属性
let attributes = [NSAttributedString.Key.font : font] as [NSAttributedString.Key : Any]
_ = NSMutableAttributedString(string: text, attributes: attributes)
// 根据指定的最大宽度和字体大小计算文本的高度
let size = (text as NSString).boundingRect(with: CGSize(width: maxWidth, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size
var textHeight = size.height
if textHeight > 40 {
textHeight = 40
}
let imageSize = getImageSize(model.url)
var imageHeight = 0.0
if imageSize.width == 0 {
imageHeight = width
} else {
imageHeight = width * imageSize.height/imageSize.width
if imageHeight > 280 {
imageHeight = 280
}
}
let totalHeight = imageHeight + textHeight + 46
return CGSize(width: width, height: totalHeight)
}
}
......@@ -13,16 +13,16 @@ struct AboutAdvantageItem {
var iconName : String
var title : String
var detail : String
var url: String
}
class YHAboutUsViewController: YHBaseViewController {
lazy var items = {
return [AboutAdvantageItem(iconName: "about_match", title: "ABC".local, detail: "大数据精准匹配,专属方案获批率更高"),
AboutAdvantageItem(iconName: "about_response", title: "快速响应", detail: "身份规划师一对一专业服务,第一时间响应您的需求"),
AboutAdvantageItem(iconName: "about_service", title: "专业服务", detail: "5年经验+英语专8级文案导师团队倾力支持"),
AboutAdvantageItem(iconName: "about_service2", title: "精准匹配", detail: "香港专才、香港留学获批常年保持90%以上")]
return [AboutAdvantageItem(iconName: "about_match", title: "ABC".local, detail: "大数据精准匹配,专属方案获批率更高", url: ""),
AboutAdvantageItem(iconName: "about_response", title: "快速响应", detail: "身份规划师一对一专业服务,第一时间响应您的需求", url: ""),
AboutAdvantageItem(iconName: "about_service", title: "专业服务", detail: "5年经验+英语专8级文案导师团队倾力支持", url: ""),
AboutAdvantageItem(iconName: "about_service2", title: "精准匹配", detail: "香港专才、香港留学获批常年保持90%以上", url: "")]
}()
lazy var collectView = {
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Rectangle 346240964@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Rectangle 346240964@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Rectangle 346240965@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Rectangle 346240965@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "激活身份@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "激活身份@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 2033194154@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 2033194154@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