Commit 4636fcc6 authored by pete谢兆麟's avatar pete谢兆麟

UI

parent fd4807c3
......@@ -1231,6 +1231,9 @@
04B00F862D966EAB00F640C5 /* YHMakePlanBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B00F852D966EAB00F640C5 /* YHMakePlanBottomView.swift */; };
04B00F882D96964100F640C5 /* YHMakePlanCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B00F872D96964100F640C5 /* YHMakePlanCardView.swift */; };
04B00F8A2D96969E00F640C5 /* YHMakePlanCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B00F892D96969E00F640C5 /* YHMakePlanCell.swift */; };
04B00F8C2D97C07900F640C5 /* YHMakePlanPriceAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B00F8B2D97C07900F640C5 /* YHMakePlanPriceAlertView.swift */; };
04B00F8E2D97CBD900F640C5 /* YHMakePlanSelectAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B00F8D2D97CBD900F640C5 /* YHMakePlanSelectAlertView.swift */; };
04B00F902D97D7A700F640C5 /* YHMakePlanShareAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B00F8F2D97D7A700F640C5 /* YHMakePlanShareAlertView.swift */; };
04D8FF552D9258AA00703C75 /* YHPlanScoreView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D8FF542D9258AA00703C75 /* YHPlanScoreView.swift */; };
04D8FF572D925A0800703C75 /* YHPlanScoreChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D8FF562D925A0800703C75 /* YHPlanScoreChart.swift */; };
04D8FF592D925E6700703C75 /* YHPlanModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D8FF582D925E6700703C75 /* YHPlanModel.swift */; };
......@@ -2517,6 +2520,9 @@
04B00F852D966EAB00F640C5 /* YHMakePlanBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMakePlanBottomView.swift; sourceTree = "<group>"; };
04B00F872D96964100F640C5 /* YHMakePlanCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMakePlanCardView.swift; sourceTree = "<group>"; };
04B00F892D96969E00F640C5 /* YHMakePlanCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMakePlanCell.swift; sourceTree = "<group>"; };
04B00F8B2D97C07900F640C5 /* YHMakePlanPriceAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMakePlanPriceAlertView.swift; sourceTree = "<group>"; };
04B00F8D2D97CBD900F640C5 /* YHMakePlanSelectAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMakePlanSelectAlertView.swift; sourceTree = "<group>"; };
04B00F8F2D97D7A700F640C5 /* YHMakePlanShareAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMakePlanShareAlertView.swift; sourceTree = "<group>"; };
04D8FF542D9258AA00703C75 /* YHPlanScoreView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPlanScoreView.swift; sourceTree = "<group>"; };
04D8FF562D925A0800703C75 /* YHPlanScoreChart.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPlanScoreChart.swift; sourceTree = "<group>"; };
04D8FF582D925E6700703C75 /* YHPlanModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPlanModel.swift; sourceTree = "<group>"; };
......@@ -6696,6 +6702,9 @@
04B00F852D966EAB00F640C5 /* YHMakePlanBottomView.swift */,
04B00F872D96964100F640C5 /* YHMakePlanCardView.swift */,
04B00F892D96969E00F640C5 /* YHMakePlanCell.swift */,
04B00F8B2D97C07900F640C5 /* YHMakePlanPriceAlertView.swift */,
04B00F8D2D97CBD900F640C5 /* YHMakePlanSelectAlertView.swift */,
04B00F8F2D97D7A700F640C5 /* YHMakePlanShareAlertView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -7341,6 +7350,7 @@
04AE20152D12CFAF00891D24 /* YHGCApplicationTypeSelectCell.swift in Sources */,
04AE20162D12CFAF00891D24 /* YHGCBasicInfoFillViewController.swift in Sources */,
04AE20172D12CFAF00891D24 /* YHGCSchemeTableHeadView.swift in Sources */,
04B00F8E2D97CBD900F640C5 /* YHMakePlanSelectAlertView.swift in Sources */,
04AE20182D12CFAF00891D24 /* YHGCApplicationModel.swift in Sources */,
04AE20192D12CFAF00891D24 /* YHGCApplicationTypeResponseModel.swift in Sources */,
0411CF022D1A80F500644D35 /* YHGCMySignatureDetailViewController.swift in Sources */,
......@@ -8079,6 +8089,7 @@
045C12FD2D12CA5F00BD2DC0 /* YHOtherLoginViewController.swift in Sources */,
045C12FE2D12CA5F00BD2DC0 /* YHInformationAuthorizationStepTwoViewController.swift in Sources */,
045C12FF2D12CA5F00BD2DC0 /* YHWorkActionView.swift in Sources */,
04B00F902D97D7A700F640C5 /* YHMakePlanShareAlertView.swift in Sources */,
045C13002D12CA5F00BD2DC0 /* YHImproveTargetCell.swift in Sources */,
045C13012D12CA5F00BD2DC0 /* YHPreviewFamilyMemberViewController.swift in Sources */,
0411CF102D1C055100644D35 /* YHGCSignatureAddViewController.swift in Sources */,
......@@ -8216,6 +8227,7 @@
045C13782D12CA5F00BD2DC0 /* YHResignUploadTravelCardListfootView.swift in Sources */,
045C13792D12CA5F00BD2DC0 /* YHWorkExperienceModel.swift in Sources */,
045C137A2D12CA5F00BD2DC0 /* YHSchemeTableFooterView.swift in Sources */,
04B00F8C2D97C07900F640C5 /* YHMakePlanPriceAlertView.swift in Sources */,
045C137B2D12CA5F00BD2DC0 /* YHWorkExperienceItemView.swift in Sources */,
045C137C2D12CA5F00BD2DC0 /* YHVisaRenewalPayInfoBaseCell.swift in Sources */,
045C137D2D12CA5F00BD2DC0 /* YHPaddedLabel.swift in Sources */,
......
......@@ -52,7 +52,9 @@ class YHMakePlanViewController: YHBaseViewController {
// Configure with data
priceView.configure(price: "489800") {
print("Action button tapped!")
// Handle the "去办理" action here
YHMakePlanShareAlertView.show { _ in
}
}
self.view.addSubview(tableView)
......
//
// YHMakePlanPriceAlertView.swift
// galaxy
//
// Created by EDY on 2025/3/29.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMakePlanPriceAlertView: UIView {
typealias Block = (Int) -> Void
var block: Block?
var centerView: UIView!
var titleLabel: UILabel!
var closeButton: UIButton!
var lineView: UIView!
lazy var priceView: YHMakePlanBottomView = {
let view = YHMakePlanBottomView()
return view
}()
lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHMakePlanLabelCell.self)
return tableView
}()
static func show(callBack: @escaping ((Int) -> Void)) {
let view = YHMakePlanPriceAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.block = callBack
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor(white: 0.5, alpha: 0.1)
let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap))
tap.delegate = self
addGestureRecognizer(tap)
setView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView() {
backgroundColor = UIColor(hex: 0x0000, alpha: 0.5)
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius3
return view
}()
addSubview(centerView)
centerView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(554)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.text = "价格明细"
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(20)
make.right.equalTo(-18)
}
closeButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "address_close"), for: .normal)
button.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
return button
}()
centerView.addSubview(closeButton)
closeButton.snp.makeConstraints { make in
make.right.equalTo(-21)
make.height.width.equalTo(24)
make.top.equalTo(18)
}
closeButton.YH_clickEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
lineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(52)
make.height.equalTo(1)
make.right.equalTo(-18)
}
centerView.addSubview(priceView)
priceView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(98)
}
// Configure with data
priceView.configure(price: "489800") {
print("Action button tapped!")
// Handle the "去办理" action here
}
centerView.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(52)
make.bottom.equalTo(-98)
}
}
@objc private func handleTap(_ sender: AnyObject?) {
dismiss()
}
@objc func dismiss() {
removeFromSuperview()
}
@objc func orderButtonClick() {
if let block = block {
block(1)
}
dismiss()
}
@objc func guideButtonClick() {
if let block = block {
block(2)
}
dismiss()
}
}
extension YHMakePlanPriceAlertView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
if touch.view == self {
return true
}
return false
}
}
extension YHMakePlanPriceAlertView: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// return items.count
return 4
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withClass: YHMakePlanLabelCell.self) as? YHMakePlanLabelCell else {
return UITableViewCell()
}
cell.dataSource = [CompanyPackageData(title: "香港身份申请至永居删除", subtitle: "香港高才入境计划申请到永居全流程", companyName: "", priceTag: "", price: "¥20000.00", showCheckmark: true)]
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 96
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
}
class YHMakePlanLabelCell: UITableViewCell {
// typealias InformationBlock = (_ model: YHItemModel) -> Void
var centerView: UIView!
var titleLabel: UILabel!
var mainItemView: UIView!
var country: String = ""
var dataSource: [CompanyPackageData]? {
didSet {
updateAllViews()
}
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
contentView.backgroundColor = .clear
backgroundColor = .clear
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
contentView.addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(7)
make.bottom.equalTo(-7)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.textColor = UIColor.mainTextColor
label.text = "价格明细"
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(20)
make.right.equalTo(-18)
}
mainItemView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
centerView.addSubview(mainItemView)
mainItemView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(36)
}
let lineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.equalTo(18)
make.bottom.equalToSuperview()
make.height.equalTo(1)
make.right.equalTo(-18)
}
}
func updateAllViews() {
titleLabel.text = "基础身份续签"
mainItemView.removeSubviews()
var y = 0
for i in 0 ..< (dataSource?.count ?? 0) {
y += 12
var h = 20
let titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.textColor = UIColor.mainTextColor
label.text = "香港身份申请至永居"
return label
}()
mainItemView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(y)
make.height.equalTo(h)
}
let valueLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.textColor = UIColor.mainTextColor
label.textAlignment = .right
label.text = "¥58999"
return label
}()
mainItemView.addSubview(valueLabel)
valueLabel.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(y)
make.height.equalTo(h)
}
y += h
}
}
}
//
// YHMakePlanSelectAlertView.swift
// galaxy
//
// Created by EDY on 2025/3/29.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMakePlanSelectAlertView: UIView {
typealias Block = (Int) -> Void
var block: Block?
var centerView: UIView!
var titleLabel: UILabel!
var closeButton: UIButton!
var sureButton: UIButton!
var hasSelectLabel: UILabel!
var cardView: YHMakePlanCardView!
var lineView: UIView!
lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 44))
let label = UILabel()
label.text = "产品类型"
label.frame = CGRect(x: 20, y: 24, width: KScreenWidth, height: 20)
view.addSubview(label)
tableView.tableHeaderView = view
tableView.register(cellWithClass: YHMakePlanCardCell.self)
return tableView
}()
static func show(callBack: @escaping ((Int) -> Void)) {
let view = YHMakePlanSelectAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.block = callBack
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor(white: 0.5, alpha: 0.1)
let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap))
tap.delegate = self
addGestureRecognizer(tap)
setView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView() {
backgroundColor = UIColor(hex: 0x0000, alpha: 0.5)
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius3
return view
}()
addSubview(centerView)
centerView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(720)
}
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.text = "公司经营套餐选择"
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(20)
make.right.equalTo(-18)
}
closeButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "address_close"), for: .normal)
button.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
return button
}()
centerView.addSubview(closeButton)
closeButton.snp.makeConstraints { make in
make.right.equalTo(-21)
make.height.width.equalTo(24)
make.top.equalTo(18)
}
closeButton.YH_clickEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
lineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(52)
make.height.equalTo(1)
make.right.equalTo(-18)
}
let bottomLineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(bottomLineView)
bottomLineView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(214)
make.height.equalTo(1)
make.right.equalTo(-18)
}
hasSelectLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.textColor = UIColor.mainTextColor
label.text = "已选产品"
return label
}()
centerView.addSubview(hasSelectLabel)
hasSelectLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(72)
make.height.equalTo(20)
make.right.equalTo(-18)
}
cardView = {
let label = YHMakePlanCardView()
return label
}()
centerView.addSubview(cardView)
cardView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(104)
make.height.equalTo(86)
}
sureButton = {
let button = UIButton(type: .custom)
button.backgroundColor = .black
button.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
return button
}()
centerView.addSubview(sureButton)
sureButton.snp.makeConstraints { make in
make.bottom.equalTo(-54)
make.left.equalTo(20)
make.right.equalTo(-20)
make.height.equalTo(46)
}
centerView.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(215)
make.bottom.equalTo(-96)
}
}
@objc private func handleTap(_ sender: AnyObject?) {
dismiss()
}
@objc func dismiss() {
removeFromSuperview()
}
@objc func orderButtonClick() {
if let block = block {
block(1)
}
dismiss()
}
@objc func guideButtonClick() {
if let block = block {
block(2)
}
dismiss()
}
}
extension YHMakePlanSelectAlertView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
if touch.view == self {
return true
}
return false
}
}
extension YHMakePlanSelectAlertView: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// return items.count
return 4
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withClass: YHMakePlanCardCell.self) as? YHMakePlanCardCell else {
return UITableViewCell()
}
cell.configure(with: ServiceModel(title: "星企航7年服务", price: 18900))
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 94
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
}
class YHMakePlanCardCell: UITableViewCell {
// MARK: - UI Elements
private let containerView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = 8
view.layer.borderWidth = 1
view.layer.borderColor = UIColor.lightGray.cgColor
return view
}()
private let bgImageView: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "")
imageView.backgroundColor = .red
return imageView
}()
private let titleLabel: UILabel = {
let label = UILabel()
label.text = "星企航6年服务"
label.font = UIFont.systemFont(ofSize: 16, weight: .medium)
label.textColor = .darkGray
return label
}()
private let priceLabel: UILabel = {
let label = UILabel()
label.text = "¥129980"
label.font = UIFont.systemFont(ofSize: 24, weight: .bold)
label.textColor = .black
return label
}()
// MARK: - Initialization
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
setupConstraints()
selectionStyle = .none
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - Setup
private func setupUI() {
backgroundColor = .clear
contentView.backgroundColor = .clear
contentView.addSubview(containerView)
containerView.addSubview(bgImageView)
containerView.addSubview(titleLabel)
containerView.addSubview(priceLabel)
}
private func setupConstraints() {
containerView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(8)
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-8)
}
bgImageView.snp.makeConstraints { make in
make.height.width.equalTo(46)
make.left.equalToSuperview().offset(16)
make.centerY.equalToSuperview().offset(-16)
}
titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16)
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)
}
}
// MARK: - Configuration
func configure(with service: ServiceModel) {
titleLabel.text = service.title
priceLabel.text = "¥\(service.price)"
}
}
// Example model for configuration
struct ServiceModel {
let title: String
let price: Int
}
//
// YHMakePlanShareAlertView.swift
// galaxy
//
// Created by EDY on 2025/3/29.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMakePlanShareAlertView: UIView {
typealias Block = (Int) -> Void
var block: Block?
var centerView: UIView!
var sureButton: UIButton!
var leftButton: YHShareButton!
var rightButton: YHShareButton!
static func show(callBack: @escaping ((Int) -> Void)) {
let view = YHMakePlanShareAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.block = callBack
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor(white: 0.5, alpha: 0.1)
let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap))
tap.delegate = self
addGestureRecognizer(tap)
setView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView() {
backgroundColor = UIColor(hex: 0x0000, alpha: 0.5)
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius3
return view
}()
addSubview(centerView)
centerView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(216)
}
sureButton = {
let button = UIButton(type: .custom)
button.backgroundColor = .black
button.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
return button
}()
centerView.addSubview(sureButton)
sureButton.snp.makeConstraints { make in
make.bottom.equalTo(-54)
make.left.equalTo(20)
make.right.equalTo(-20)
make.height.equalTo(46)
}
leftButton = {
let button = YHShareButton()
button.setContent("invitation_with_gifts_share_center", "微信好友")
button.addTarget(self, action: #selector(peopleClick), for: .touchUpInside)
return button
}()
centerView.addSubview(leftButton)
leftButton.snp.makeConstraints { make in
make.top.equalTo(20)
make.right.equalTo(centerView.snp.centerX).offset(-33)
make.height.equalTo(74)
make.width.equalTo(52)
}
rightButton = {
let button = YHShareButton()
button.setContent("invitation_with_gifts_share_center", "复制链接")
button.addTarget(self, action: #selector(wxClick), for: .touchUpInside)
return button
}()
centerView.addSubview(rightButton)
rightButton.snp.makeConstraints { make in
make.top.equalTo(20)
make.left.equalTo(centerView.snp.centerX).offset(33)
make.height.equalTo(74)
make.width.equalTo(52)
}
}
@objc func wxClick() {
// guard let combinedImage = combinedImageFrom(imageView: centerImageView) else { return }
YHShareManager.shared.sendLinkContent("香港身份规划专属礼包,限时领取!", "资深银河规划专家1V1评估方案", UIImage(named: "invitation_with_gifts_share_other") ?? UIImage(), link: YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/evaluation?channel=lkhtj-app&customer_id=\(YHLoginManager.shared.userModel?.id ?? "")&scene_id=30")
// YHShareManager.shared.sendImageContent(combinedImage)
}
@objc func peopleClick() {
// guard let combinedImage = combinedImageFrom(imageView: centerImageView) else { return }
// YHShareManager.shared.sendImageContent(combinedImage, WXSceneTimeline)
YHShareManager.shared.sendLinkContent("香港身份规划专属礼包,限时领取!", "资深银河规划专家1V1评估方案", UIImage(named: "invitation_with_gifts_share_other") ?? UIImage(), link: YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/evaluation?channel=lkhtj-app&customer_id=\(YHLoginManager.shared.userModel?.id ?? "")&scene_id=30", WXSceneTimeline)
}
@objc private func handleTap(_ sender: AnyObject?) {
dismiss()
}
@objc func dismiss() {
removeFromSuperview()
}
@objc func orderButtonClick() {
if let block = block {
block(1)
}
dismiss()
}
@objc func guideButtonClick() {
if let block = block {
block(2)
}
dismiss()
}
}
extension YHMakePlanShareAlertView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
if touch.view == self {
return true
}
return false
}
}
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