Commit eadc6cf0 authored by Steven杜宇's avatar Steven杜宇

// 首页订单提示视图

parent f283f018
...@@ -249,6 +249,7 @@ ...@@ -249,6 +249,7 @@
0499E3002C056EE30037E646 /* YHOneKeyLoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0499E2FF2C056EE30037E646 /* YHOneKeyLoginView.swift */; }; 0499E3002C056EE30037E646 /* YHOneKeyLoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0499E2FF2C056EE30037E646 /* YHOneKeyLoginView.swift */; };
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; }; 049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; };
049A48AA2B49536000D0C641 /* YHAboutUsAdvantageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */; }; 049A48AA2B49536000D0C641 /* YHAboutUsAdvantageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */; };
049AB5EE2C0EF68700155DDF /* YHOrderTipsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AB5ED2C0EF68700155DDF /* YHOrderTipsView.swift */; };
049AC4C62BC3E55300F857F4 /* YHServiceSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AC4C52BC3E55300F857F4 /* YHServiceSectionView.swift */; }; 049AC4C62BC3E55300F857F4 /* YHServiceSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AC4C52BC3E55300F857F4 /* YHServiceSectionView.swift */; };
04A271232BABFF3200652B1B /* YHCertificateUploadTypeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A271222BABFF3200652B1B /* YHCertificateUploadTypeCell.swift */; }; 04A271232BABFF3200652B1B /* YHCertificateUploadTypeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A271222BABFF3200652B1B /* YHCertificateUploadTypeCell.swift */; };
04A271252BAC33BB00652B1B /* YHFilePreviewTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A271242BAC33BB00652B1B /* YHFilePreviewTool.swift */; }; 04A271252BAC33BB00652B1B /* YHFilePreviewTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A271242BAC33BB00652B1B /* YHFilePreviewTool.swift */; };
...@@ -722,6 +723,7 @@ ...@@ -722,6 +723,7 @@
0499E2FF2C056EE30037E646 /* YHOneKeyLoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOneKeyLoginView.swift; sourceTree = "<group>"; }; 0499E2FF2C056EE30037E646 /* YHOneKeyLoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOneKeyLoginView.swift; sourceTree = "<group>"; };
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; }; 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; };
049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsAdvantageCell.swift; sourceTree = "<group>"; }; 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsAdvantageCell.swift; sourceTree = "<group>"; };
049AB5ED2C0EF68700155DDF /* YHOrderTipsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOrderTipsView.swift; sourceTree = "<group>"; };
049AC4C52BC3E55300F857F4 /* YHServiceSectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceSectionView.swift; sourceTree = "<group>"; }; 049AC4C52BC3E55300F857F4 /* YHServiceSectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceSectionView.swift; sourceTree = "<group>"; };
04A271222BABFF3200652B1B /* YHCertificateUploadTypeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadTypeCell.swift; sourceTree = "<group>"; }; 04A271222BABFF3200652B1B /* YHCertificateUploadTypeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadTypeCell.swift; sourceTree = "<group>"; };
04A271242BAC33BB00652B1B /* YHFilePreviewTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFilePreviewTool.swift; sourceTree = "<group>"; }; 04A271242BAC33BB00652B1B /* YHFilePreviewTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFilePreviewTool.swift; sourceTree = "<group>"; };
...@@ -2108,6 +2110,7 @@ ...@@ -2108,6 +2110,7 @@
A567E58E2BD7643D00D5D5A0 /* YHSearchInfoBar.swift */, A567E58E2BD7643D00D5D5A0 /* YHSearchInfoBar.swift */,
A567E58F2BD7643D00D5D5A0 /* YHHomeBannerIndicatorView.swift */, A567E58F2BD7643D00D5D5A0 /* YHHomeBannerIndicatorView.swift */,
A567E5902BD7643D00D5D5A0 /* YHHkLifeAndIdItemView.swift */, A567E5902BD7643D00D5D5A0 /* YHHkLifeAndIdItemView.swift */,
049AB5ED2C0EF68700155DDF /* YHOrderTipsView.swift */,
A567E5912BD7643D00D5D5A0 /* YHSearchItemLayout.swift */, A567E5912BD7643D00D5D5A0 /* YHSearchItemLayout.swift */,
); );
path = V; path = V;
...@@ -2685,6 +2688,7 @@ ...@@ -2685,6 +2688,7 @@
0425E6422BA95B1B00A5E763 /* YHSchemeTableFooterView.swift in Sources */, 0425E6422BA95B1B00A5E763 /* YHSchemeTableFooterView.swift in Sources */,
A567E5B42BD7643D00D5D5A0 /* YHHkLifeAndIdView.swift in Sources */, A567E5B42BD7643D00D5D5A0 /* YHHkLifeAndIdView.swift in Sources */,
045EEEBD2B9F171A0022A143 /* YHWorkExampleTypeView.swift in Sources */, 045EEEBD2B9F171A0022A143 /* YHWorkExampleTypeView.swift in Sources */,
049AB5EE2C0EF68700155DDF /* YHOrderTipsView.swift in Sources */,
045EEEB12B9F171A0022A143 /* YHClipperView.swift in Sources */, 045EEEB12B9F171A0022A143 /* YHClipperView.swift in Sources */,
A567E5962BD7643D00D5D5A0 /* YHConfigModel.swift in Sources */, A567E5962BD7643D00D5D5A0 /* YHConfigModel.swift in Sources */,
A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */, A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */,
......
...@@ -18,6 +18,9 @@ class YHHomePageViewController: YHBaseViewController { ...@@ -18,6 +18,9 @@ class YHHomePageViewController: YHBaseViewController {
return viewModel return viewModel
}() }()
let serviceCenterMainReqVM : YHServiceCenterMainViewModel = YHServiceCenterMainViewModel()
var homeHeaderViewHeight = YHHomeHeadView.fixViewH
lazy var homeCollectView = { lazy var homeCollectView = {
// 设置布局方向 // 设置布局方向
let flowLayout = YHHomeCollectionLayout() let flowLayout = YHHomeCollectionLayout()
...@@ -47,6 +50,7 @@ class YHHomePageViewController: YHBaseViewController { ...@@ -47,6 +50,7 @@ class YHHomePageViewController: YHBaseViewController {
//获取OSS密钥 //获取OSS密钥
YHOSSManager.share.getOSSID() YHOSSManager.share.getOSSID()
updateDefaultSearchKeyWord() updateDefaultSearchKeyWord()
requestOrder()
} }
lazy var searchView: YHHomeSearchView = { lazy var searchView: YHHomeSearchView = {
...@@ -61,6 +65,8 @@ class YHHomePageViewController: YHBaseViewController { ...@@ -61,6 +65,8 @@ class YHHomePageViewController: YHBaseViewController {
return view return view
}() }()
var tapTimestamp : CFAbsoluteTime = -10.0
func updateDefaultSearchKeyWord() { func updateDefaultSearchKeyWord() {
var placeHolder = "香港生活" var placeHolder = "香港生活"
if isHaveLocalSearchRecords() { if isHaveLocalSearchRecords() {
...@@ -72,7 +78,31 @@ class YHHomePageViewController: YHBaseViewController { ...@@ -72,7 +78,31 @@ class YHHomePageViewController: YHBaseViewController {
searchView.placeHolder = placeHolder searchView.placeHolder = placeHolder
} }
var tapTimestamp : CFAbsoluteTime = -10.0 // 请求订单数据
func requestOrder() {
serviceCenterMainReqVM.getContactList {
[weak self] success, error in
guard let self = self else { return }
let isShow = self.serviceCenterMainReqVM.arrContactList.count > 0
DispatchQueue.main.async {
self.showOrderTipsView(isShow)
}
}
}
// 是否展示订单提示视图
func showOrderTipsView(_ show:Bool) {
homeHeaderViewHeight = show ? YHHomeHeadView.viewHWithOrderTips : YHHomeHeadView.fixViewH
homeHeaderView.frame = CGRect(x: 20, y: -homeHeaderViewHeight, width: KScreenWidth - 40, height: homeHeaderViewHeight)
homeHeaderView.isNeedHideOrderTipsView = !show
homeCollectView.contentInset = UIEdgeInsets(top: homeHeaderViewHeight, left: 0, bottom: 0, right: 0)
if let tmpHeadView = homeCollectView.header {
var r = tmpHeadView.frame
r.origin.y = r.origin.y - homeHeaderViewHeight
tmpHeadView.frame = r
}
}
} }
private extension YHHomePageViewController { private extension YHHomePageViewController {
...@@ -165,16 +195,16 @@ private extension YHHomePageViewController { ...@@ -165,16 +195,16 @@ private extension YHHomePageViewController {
make.bottom.equalToSuperview().offset(-k_Height_TabBar) make.bottom.equalToSuperview().offset(-k_Height_TabBar)
} }
homeHeaderView.frame = CGRect(x: 20, y: -YHHomeHeadView.viewH, width: KScreenWidth - 40, height: YHHomeHeadView.viewH) homeHeaderView.frame = CGRect(x: 20, y: -YHHomeHeadView.fixViewH, width: KScreenWidth - 40, height: YHHomeHeadView.fixViewH)
homeCollectView.addSubview(homeHeaderView) homeCollectView.addSubview(homeHeaderView)
homeCollectView.contentInset = UIEdgeInsets(top: YHHomeHeadView.viewH, left: 0, bottom: 0, right: 0) homeCollectView.contentInset = UIEdgeInsets(top: YHHomeHeadView.fixViewH, left: 0, bottom: 0, right: 0)
let tmpHeadView = homeCollectView.es.addYHPullToRefresh { let tmpHeadView = homeCollectView.es.addYHPullToRefresh {
self.getData() self.getData()
} }
var r = tmpHeadView.frame var r = tmpHeadView.frame
r.origin.y = r.origin.y - YHHomeHeadView.viewH r.origin.y = r.origin.y - YHHomeHeadView.fixViewH
tmpHeadView.frame = r tmpHeadView.frame = r
homeCollectView.showsHorizontalScrollIndicator = false homeCollectView.showsHorizontalScrollIndicator = false
...@@ -249,7 +279,7 @@ extension YHHomePageViewController : UITabBarControllerDelegate { ...@@ -249,7 +279,7 @@ extension YHHomePageViewController : UITabBarControllerDelegate {
let timestamp = CFAbsoluteTimeGetCurrent() let timestamp = CFAbsoluteTimeGetCurrent()
printLog(timestamp - self.tapTimestamp) printLog(timestamp - self.tapTimestamp)
if timestamp - self.tapTimestamp < doubleTapInterval { if timestamp - self.tapTimestamp < doubleTapInterval {
self.homeCollectView.setContentOffset(CGPoint(x: 0, y: -YHHomeHeadView.viewH), animated: true) self.homeCollectView.setContentOffset(CGPoint(x: 0, y: -homeHeaderViewHeight), animated: true)
} }
self.tapTimestamp = timestamp self.tapTimestamp = timestamp
......
...@@ -8,7 +8,12 @@ ...@@ -8,7 +8,12 @@
import UIKit import UIKit
class YHHomeHeadView: UIView { class YHHomeHeadView: UIView {
static let viewH : CGFloat = (YHHomeBannerView.viewH) + (20 + YHHkLifeAndIdView.viewH) + (20 + YHHomeKingKongBlockView.viewH) + 20 + 20 + 1
// 不包含订单提示视图的总高度
static let fixViewH : CGFloat = (YHHomeBannerView.viewH) + (20 + YHHkLifeAndIdView.viewH) + (20 + YHHomeKingKongBlockView.viewH) + 20 + 20 + 1
// 包含订单提示视图的总高度
static let viewHWithOrderTips: CGFloat = YHHomeHeadView.fixViewH + (20 + YHOrderTipsView.viewH)
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
...@@ -25,6 +30,13 @@ class YHHomeHeadView: UIView { ...@@ -25,6 +30,13 @@ class YHHomeHeadView: UIView {
return view return view
}() }()
// 优才订单提示视图
lazy var orderTipsView: YHOrderTipsView = {
let view = YHOrderTipsView(frame: .zero)
view.isHidden = true
return view
}()
//2.香港身份 香港生活 //2.香港身份 香港生活
lazy var homeHkLife : YHHkLifeAndIdView = { lazy var homeHkLife : YHHkLifeAndIdView = {
let view = YHHkLifeAndIdView() let view = YHHkLifeAndIdView()
...@@ -36,6 +48,19 @@ class YHHomeHeadView: UIView { ...@@ -36,6 +48,19 @@ class YHHomeHeadView: UIView {
let view = YHHomeKingKongBlockView() let view = YHHomeKingKongBlockView()
return view return view
}() }()
// 是否隐藏优才订单提示视图
var isNeedHideOrderTipsView:Bool = true {
didSet {
self.orderTipsView.isHidden = isNeedHideOrderTipsView
self.homeHkLife.snp.updateConstraints { make in
let topMargin = isNeedHideOrderTipsView ? 20.0 : 20.0 + YHOrderTipsView.viewH + 20.0
make.top.equalTo(homeBannerView.snp.bottom).offset(topMargin)
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
} }
private extension YHHomeHeadView { private extension YHHomeHeadView {
...@@ -49,6 +74,13 @@ private extension YHHomeHeadView { ...@@ -49,6 +74,13 @@ private extension YHHomeHeadView {
make.height.equalTo(YHHomeBannerView.viewH) make.height.equalTo(YHHomeBannerView.viewH)
} }
addSubview(orderTipsView)
orderTipsView.snp.makeConstraints { make in
make.top.equalTo(homeBannerView.snp.bottom).offset(20)
make.left.right.equalToSuperview()
make.height.equalTo(YHOrderTipsView.viewH)
}
addSubview(homeHkLife) addSubview(homeHkLife)
homeHkLife.snp.makeConstraints { make in homeHkLife.snp.makeConstraints { make in
make.top.equalTo(homeBannerView.snp.bottom).offset(20) make.top.equalTo(homeBannerView.snp.bottom).offset(20)
......
//
// YHOrderTipsView.swift
// galaxy
//
// Created by edy on 2024/6/4.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHOrderTipsView: UIView {
static let viewH = 65.0
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc func didLookOrderBtnClicked() {
goTabBarBy(tabType: .service)
}
func setupUI() {
self.backgroundColor = UIColor(hex: 0xF8FAFB)
let imgView = UIImageView(image: UIImage(named: "home_tips_order"))
addSubview(imgView)
imgView.snp.makeConstraints { make in
make.width.height.equalTo(31)
make.centerY.equalToSuperview()
make.left.equalTo(14)
}
let label = UILabel()
label.textAlignment = .left
let aa: ASAttributedString = .init("您有", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
let bb: ASAttributedString = .init("1", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.brandMainColor))
let cc: ASAttributedString = .init("个服务中的优才订单", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
label.attributed.text = aa+bb+cc
addSubview(label)
label.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(imgView.snp.right).offset(6)
}
let btn = UIButton()
btn.setTitle("查看进度", for: .normal)
btn.setTitleColor(.white, for: .normal)
btn.backgroundColor = UIColor.brandMainColor
btn.titleLabel?.font = .PFSC_R(ofSize: 12)
btn.addTarget(self, action: #selector(didLookOrderBtnClicked), for: .touchUpInside)
addSubview(btn)
btn.snp.makeConstraints { make in
make.width.equalTo(72)
make.height.equalTo(33)
make.centerY.equalToSuperview()
make.left.equalTo(label.snp.right).offset(16)
make.right.equalTo(-16)
}
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Frame 1@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame 1@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