Commit 361d97f8 authored by pete谢兆麟's avatar pete谢兆麟

UI相关

parent c18bdf38
This diff is collapsed.
......@@ -11,7 +11,10 @@ import UIKit
class YHMakePlanViewController: YHBaseViewController {
var items: [[Int]] = []
let viewModel = YHSchemeViewModel()
private var lastContentOffset: CGFloat = 0
private let scrollThreshold: CGFloat = 100 // 滑动100点显示导航栏
private var isNavigationBarHidden = false
lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
......@@ -33,6 +36,12 @@ class YHMakePlanViewController: YHBaseViewController {
return view
}()
lazy var topView: YHMakePlanTopView = {
let view = YHMakePlanTopView()
view.isHidden = true
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
......@@ -41,7 +50,7 @@ class YHMakePlanViewController: YHBaseViewController {
gk_navBarAlpha = 1
// gk_navBackgroundImage = UIImage(named: "my_scheme_nav")
gk_backImage = UIImage(named: "back_icon_white")
addRightItems()
// Create and add to your view
view.addSubview(priceView)
priceView.snp.makeConstraints { make in
......@@ -52,7 +61,7 @@ class YHMakePlanViewController: YHBaseViewController {
// Configure with data
priceView.configure(price: "489800") {
print("Action button tapped!")
YHMakePlanShareAlertView.show { _ in
YHMakePlanPriceAlertView.show { _ in
}
}
......@@ -62,9 +71,27 @@ class YHMakePlanViewController: YHBaseViewController {
make.top.left.right.equalToSuperview()
make.bottom.equalTo(-98)
}
view.addSubview(topView)
topView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(104)
}
requestData()
}
func addRightItems() {
let rightButtonItem = UIBarButtonItem(image: UIImage(named: "share_item")?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(share))
gk_navRightBarButtonItem = rightButtonItem
gk_navItemRightSpace = 16
}
@objc func share() {
}
func requestData() {
tableView.reloadData()
}
......@@ -115,4 +142,31 @@ extension YHMakePlanViewController: UITableViewDelegate, UITableViewDataSource {
return 0.01
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let offsetY = scrollView.contentOffset.y + scrollView.contentInset.top
if offsetY > 0 {
var alpha = offsetY / k_Height_NavigationtBarAndStatuBar
if alpha > 1.0 {
alpha = 1.0
}
gk_navBarAlpha = alpha
gk_navBackgroundColor = .white
gk_navTitle = "续签至永居方案私人订制"
gk_navTitleColor = .black
gk_backImage = UIImage(named: "nav_black_24")
gk_navRightBarButtonItem?.image = UIImage(named: "share_item")
addRightItems()
} else {
gk_navBarAlpha = 0.0
gk_navBackgroundColor = .clear
gk_navTitle = nil
gk_backImage = UIImage(named: "back_icon_white")
addRightItems()
}
if offsetY > 333.fix - k_Height_NavigationtBarAndStatuBar - 44 - scrollView.contentInset.top {
topView.isHidden = false
} else {
topView.isHidden = true
}
}
}
......@@ -36,7 +36,6 @@ class YHMakePlanHeadView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor(hex: 0x070E33)
setUpView()
}
......
......@@ -70,7 +70,7 @@ class YHMakePlanPriceAlertView: UIView {
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.text = "价格明细"
......@@ -248,8 +248,8 @@ class YHMakePlanLabelCell: UITableViewCell {
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = UIColor(hex: 0x8993a2)
label.text = "价格明细"
return label
}()
......@@ -269,8 +269,10 @@ class YHMakePlanLabelCell: UITableViewCell {
}()
centerView.addSubview(mainItemView)
mainItemView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.bottom.equalToSuperview()
make.top.equalTo(36)
make.left.equalTo(18)
make.right.equalTo(-18)
}
let lineView = {
......@@ -297,7 +299,7 @@ class YHMakePlanLabelCell: UITableViewCell {
var h = 20
let titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = UIColor.mainTextColor
label.text = "香港身份申请至永居"
return label
......@@ -311,7 +313,7 @@ class YHMakePlanLabelCell: UITableViewCell {
let valueLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = UIColor.mainTextColor
label.textAlignment = .right
label.text = "¥58999"
......
......@@ -75,7 +75,7 @@ class YHMakePlanSelectAlertView: UIView {
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.text = "公司经营套餐选择"
......@@ -152,19 +152,22 @@ class YHMakePlanSelectAlertView: UIView {
centerView.addSubview(cardView)
cardView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(104)
make.height.equalTo(86)
make.top.equalTo(92)
make.height.equalTo(121)
}
sureButton = {
let button = UIButton(type: .custom)
button.backgroundColor = .black
button.setTitleColor(UIColor(hex: 0xffffff), for: .normal)
button.setTitle("确认", for: .normal)
button.layer.cornerRadius = 4
button.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
return button
}()
centerView.addSubview(sureButton)
sureButton.snp.makeConstraints { make in
make.bottom.equalTo(-54)
make.bottom.equalTo(-42)
make.left.equalTo(20)
make.right.equalTo(-20)
make.height.equalTo(46)
......@@ -258,9 +261,8 @@ class YHMakePlanCardCell: UITableViewCell {
private let containerView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = 8
view.layer.borderWidth = 1
view.layer.borderColor = UIColor.lightGray.cgColor
view.layer.borderColor = UIColor.mainTextColor.cgColor
return view
}()
......@@ -274,16 +276,16 @@ class YHMakePlanCardCell: UITableViewCell {
private let titleLabel: UILabel = {
let label = UILabel()
label.text = "星企航6年服务"
label.font = UIFont.systemFont(ofSize: 16, weight: .medium)
label.textColor = .darkGray
label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = .mainTextColor
return label
}()
private let priceLabel: UILabel = {
let label = UILabel()
label.text = "¥129980"
label.font = UIFont.systemFont(ofSize: 24, weight: .bold)
label.textColor = .black
label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = .mainTextColor
return label
}()
......@@ -320,20 +322,19 @@ class YHMakePlanCardCell: UITableViewCell {
bgImageView.snp.makeConstraints { make in
make.height.width.equalTo(46)
make.left.equalToSuperview().offset(16)
make.centerY.equalToSuperview().offset(-16)
make.centerY.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16)
make.top.equalToSuperview().offset(12)
make.left.equalToSuperview().offset(72)
make.right.equalToSuperview().offset(-16)
}
priceLabel.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(8)
make.left.equalToSuperview().offset(72)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-12)
}
}
......
//
// YHMakePlanTopView.swift
// galaxy
//
// Created by EDY on 2025/3/31.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHMakePlanTopView: UIView {
private let yearsLabel: UILabel = {
let label = UILabel()
let a: ASAttributedString = .init("预计可续期(年) ", .font(UIFont.PFSC_M(ofSize: 14)), .foreground(UIColor(hex: 0x6a7586)))
let b: ASAttributedString = .init("5", .font(UIFont.PFSC_M(ofSize: 24)), .foreground(UIColor.mainTextColor))
label.attributed.text = a + b
return label
}()
private let percentageLabel: UILabel = {
let label = UILabel()
let a: ASAttributedString = .init("续签综合通过率 ", .font(UIFont.PFSC_M(ofSize: 14)), .foreground(UIColor(hex: 0x6a7586)))
let b: ASAttributedString = .init("90", .font(UIFont.PFSC_M(ofSize: 24)), .foreground(UIColor.mainTextColor))
let c: ASAttributedString = .init("%", .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor))
label.attributed.text = a + b + c
return label
}()
private lazy var custtomView: YHMakePlanCusttomHeadView = {
let view = YHMakePlanCusttomHeadView()
return view
}()
override init(frame: CGRect) {
super.init(frame: frame)
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setUpView() {
backgroundColor = .white
let bgView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0xf8f9fb)
view.layer.cornerRadius = 6
return view
}()
addSubview(bgView)
addSubview(yearsLabel)
addSubview(percentageLabel)
addSubview(custtomView)
bgView.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-35)
make.height.equalTo(42)
make.top.equalTo(9)
}
yearsLabel.snp.makeConstraints { make in
make.left.equalTo(34)
make.height.equalTo(24)
make.top.equalTo(18)
}
percentageLabel.snp.makeConstraints { make in
make.left.equalTo(self.snp.centerX)
make.height.equalTo(24)
make.top.equalTo(18)
}
custtomView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(44)
}
}
}
//
// YHMakePlanViewModel.swift
// galaxy
//
// Created by EDY on 2025/4/1.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMakePlanViewModel: YHBaseViewModel {
var arrContactList: [YHContactItemModel] = []
// 请求白名单
func getWhitelist(callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Order.bywhitelist
_ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, _ in
// 1. json字符串 转 对象
guard self != nil else { return }
if json.code == 200 {
guard let dic = json.data?.peel as? [String: Any], let data = dic["Data"] as? [Any], let result = [YHServiceSearchModel].deserialize(from: data) else {
callBackBlock(false, nil)
return
}
if result.count != 0, let model = result.first, model.dictionary_code.count != 0 {
callBackBlock(true, nil)
} else {
callBackBlock(false, nil)
}
} else {
let error: YHErrorModel = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.count > 0 ? json.msg : "数据错误")
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
// 请求合同项
func getSearchList(_ order: String, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
let params: [String: Any] = ["order_sn": order]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Order.byorderid
_ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, _ in
// 1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
guard let dic = json.data?.peel as? [Any], let resultModel = [YHContactItemModel].deserialize(from: dic) else {
self.arrContactList = []
callBackBlock(false, nil)
return
}
let lastArray = resultModel.compactMap { $0 }
self.arrContactList = lastArray
callBackBlock(true, nil)
} else {
self.arrContactList = []
let error: YHErrorModel = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.count > 0 ? json.msg : "数据错误")
callBackBlock(false, error)
}
} failBlock: { err in
self.arrContactList = []
callBackBlock(false, err)
}
}
func getAssistList(callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Order.assist
_ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, _ in
// 1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
guard let dic = json.data?.peel as? [String: Any], let data = dic["orders"] as? [Any], let resultModel = [YHContactItemModel].deserialize(from: data) else {
self.arrContactList = []
callBackBlock(false, nil)
return
}
let lastArray = resultModel.compactMap { $0 }
self.arrContactList = lastArray
callBackBlock(true, nil)
} else {
self.arrContactList = []
let error: YHErrorModel = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.count > 0 ? json.msg : "数据错误")
callBackBlock(false, error)
}
} failBlock: { err in
self.arrContactList = []
callBackBlock(false, err)
}
}
}
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