Commit 3665a7b8 authored by David黄金龙's avatar David黄金龙

报名alert

parent d68c19cb
......@@ -435,6 +435,7 @@
A592FE932BA6CFFC0062FACA /* YHCertificateEntryBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A592FE922BA6CFFC0062FACA /* YHCertificateEntryBottomView.swift */; };
A592FE952BA6D23C0062FACA /* YHCertificateEntryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A592FE942BA6D23C0062FACA /* YHCertificateEntryCell.swift */; };
A592FE972BA6DB340062FACA /* YHCertificateViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A592FE962BA6DB340062FACA /* YHCertificateViewModel.swift */; };
A59CCBCE2C241FCB001910FE /* YHApplyActivityAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = A59CCBCD2C241FCB001910FE /* YHApplyActivityAlert.swift */; };
A5ACE9282B4564F7002C94D2 /* YHSmsCodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE8DE2B4564F7002C94D2 /* YHSmsCodeView.swift */; };
A5ACE9292B4564F7002C94D2 /* YHSmsCodeInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE8E02B4564F7002C94D2 /* YHSmsCodeInputView.swift */; };
A5ACE92C2B4564F7002C94D2 /* YHLoginStyleButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5ACE8E42B4564F7002C94D2 /* YHLoginStyleButton.swift */; };
......@@ -980,6 +981,7 @@
A592FE922BA6CFFC0062FACA /* YHCertificateEntryBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateEntryBottomView.swift; sourceTree = "<group>"; };
A592FE942BA6D23C0062FACA /* YHCertificateEntryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateEntryCell.swift; sourceTree = "<group>"; };
A592FE962BA6DB340062FACA /* YHCertificateViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHCertificateViewModel.swift; sourceTree = "<group>"; };
A59CCBCD2C241FCB001910FE /* YHApplyActivityAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHApplyActivityAlert.swift; sourceTree = "<group>"; };
A5ACE8DE2B4564F7002C94D2 /* YHSmsCodeView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSmsCodeView.swift; sourceTree = "<group>"; };
A5ACE8E02B4564F7002C94D2 /* YHSmsCodeInputView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSmsCodeInputView.swift; sourceTree = "<group>"; };
A5ACE8E42B4564F7002C94D2 /* YHLoginStyleButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHLoginStyleButton.swift; sourceTree = "<group>"; };
......@@ -2317,6 +2319,7 @@
A5787E3B2C23DEE500B021D7 /* YHAcitivityTitleItemView.swift */,
A5787E3D2C23DF8C00B021D7 /* YHAcitivityDetailItemView.swift */,
A5787E3F2C23DFD000B021D7 /* YHAcitivityTipsItemView.swift */,
A59CCBCD2C241FCB001910FE /* YHApplyActivityAlert.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -3392,6 +3395,7 @@
045EEE912B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemView.swift in Sources */,
044867B62BA1A03800DFAD4A /* YHCertificateFilterItemCell.swift in Sources */,
04FD856A2C21362300BEF9C5 /* YHMyIntroductionCell.swift in Sources */,
A59CCBCE2C241FCB001910FE /* YHApplyActivityAlert.swift in Sources */,
045EEEE62B9F171A0022A143 /* YHMySignatureListViewController.swift in Sources */,
049537852BA9B28500AF7E59 /* YHCertificateTemplateCell.swift in Sources */,
A582B23D2BB944ED009D098C /* YHHKPlanDoctumentVC.swift in Sources */,
......
......@@ -75,6 +75,11 @@ class YHActivityDetailViewController: YHBaseViewController {
//2.
// addTopView()
// topView.backgroundColor = .red
YHApplyActivityAlert.showApplyActivityAlertView { tag in
}
}
}
......
//
// YHApplyActivityAlert.swift
// galaxy
//
// Created by davidhuangA on 2024/6/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHApplyActivityAlert: UIView {
typealias Block = (Bool) -> ()
var block: Block?
var centerView: UIView!
var titleLabel: UILabel!
var messageLabel: UILabel!
var agreeButton: UIButton!
lazy var nameTextField:UITextField = {
let textField = UITextField()
textField.backgroundColor = .clear
textField.attributedPlaceholder = NSAttributedString(string: "请输入您的姓名".local, attributes: [NSAttributedString.Key.foregroundColor : UIColor.yhGreyColor])
textField.font = UIFont.PFSC_M(ofSize: 14)
textField.tintColor = UIColor.brandMainColor
textField.textColor = UIColor.mainTextColor
textField.clearButtonMode = .whileEditing
// textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged)
textField.delegate = self
return textField
}()
lazy var subButton:UIButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
button.contentHorizontalAlignment = .center
button.setImage(UIImage(named: "activity_sub_0"), for: .normal)
button.setImage(UIImage(named: "activity_sub_1"), for: .selected)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius3
button.addTarget(self, action: #selector(agree), for: .touchUpInside)
return button
}()
lazy var addButton:UIButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
button.contentHorizontalAlignment = .center
button.setImage(UIImage(named: "activity_add_0"), for: .normal)
button.setImage(UIImage(named: "activity_add_1"), for: .selected)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius3
button.addTarget(self, action: #selector(agree), for: .touchUpInside)
return button
}()
lazy var applyNumberTextField:UITextField = {
let textField = UITextField()
textField.backgroundColor = .clear
textField.attributedPlaceholder = NSAttributedString(string: "请输入您的姓名".local, attributes: [NSAttributedString.Key.foregroundColor : UIColor.yhGreyColor])
textField.font = UIFont.PFSC_M(ofSize: 14)
textField.tintColor = UIColor.brandMainColor
textField.textColor = UIColor.mainTextColor
textField.textAlignment = .center
// textField.clearButtonMode = .whileEditing
textField.text = "10"
// textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged)
textField.delegate = self
return textField
}()
lazy var phoneTextField:UITextField = {
let textField = UITextField()
textField.backgroundColor = .clear
textField.attributedPlaceholder = NSAttributedString(string: "请输入".local, attributes: [NSAttributedString.Key.foregroundColor : UIColor.yhGreyColor])
textField.font = UIFont.PFSC_M(ofSize: 14)
textField.tintColor = UIColor.brandMainColor
textField.textColor = UIColor.mainTextColor
// textField.clearButtonMode = .whileEditing
// textField.text = ""
// textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged)
textField.delegate = self
return textField
}()
lazy var phoneTipsLable:UILabel = {
let lable = UILabel()
lable.textColor = UIColor.failColor
lable.textAlignment = .left
lable.font = UIFont.PFSC_R(ofSize:12)
lable.text = "手机号不能为空"
return lable
}()
lazy var submitButton:UIButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center
button.setTitle("提交", for: .normal)
button.setTitle("提交", for: .highlighted)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .highlighted)
button.layer.cornerRadius = kCornerRadius3
button.addTarget(self, action: #selector(clickSubmitBtn), for: .touchUpInside)
button.layer.cornerRadius = kCornerRadius3
button.clipsToBounds = true
button.backgroundColor = .brandMainColor
return button
}()
//类方法 - 展示
static func showApplyActivityAlertView(callBack: @escaping Block) {
let view = YHApplyActivityAlert(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)
setView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView() {
backgroundColor = UIColor.mainTextColor50
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius8
view.clipsToBounds = true
return view
}()
addSubview(centerView)
let viewH = 386.0
centerView.snp.makeConstraints { make in
make.bottom.equalToSuperview()
make.width.equalTo(KScreenWidth)
make.height.equalTo(viewH)
}
//1.0
let titleLable = UILabel()
titleLable.textColor = UIColor.mainTextColor
titleLable.textAlignment = .center
titleLable.font = UIFont.PFSC_M(ofSize:17)
titleLable.text = "活动报名"
titleLable.numberOfLines = 0
centerView.addSubview(titleLable)
titleLable.snp.makeConstraints { make in
make.top.equalTo(kMargin)
make.centerX.equalToSuperview()
make.height.equalTo(24)
}
let line1 = UIView()
line1.backgroundColor = .separatorColor
centerView.addSubview(line1)
line1.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.height.equalTo(1)
make.top.equalTo(titleLable.snp.bottom).offset(12)
}
let closeBtn : UIButton = UIButton(type: .custom)
closeBtn.setImage(UIImage(named: "person_info_close_btn"), for: .normal)
closeBtn.setImage(UIImage(named: "person_info_close_btn"), for: .highlighted)
centerView.addSubview(closeBtn)
closeBtn.addTarget(self, action: #selector(clickCloseBtn), for: .touchUpInside)
closeBtn.snp.makeConstraints { make in
make.centerY.equalTo(titleLable.snp.centerY)
make.right.equalTo(-21)
make.width.height.equalTo(24)
}
closeBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
//1、您的姓名
let nameLable = UILabel()
nameLable.textColor = UIColor.mainTextColor
nameLable.textAlignment = .left
nameLable.font = UIFont.PFSC_R(ofSize:14)
nameLable.text = "您的姓名"
centerView.addSubview(nameLable)
nameLable.snp.makeConstraints { make in
make.left.equalTo(28)
make.height.equalTo(20)
make.top.equalTo(line1.snp.bottom).offset(36)
}
centerView.addSubview(nameTextField)
nameTextField.text = "黄金龙"
nameTextField.snp.makeConstraints { make in
make.left.equalTo(nameLable.snp.right).offset(48)
make.centerY.equalTo(nameLable.snp.centerY)
make.height.equalTo(nameLable.snp.height)
make.right.equalTo(-kMargin)
}
let line2 = UIView()
line2.backgroundColor = .separatorColor
centerView.addSubview(line2)
line2.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.height.equalTo(1)
make.top.equalTo(nameTextField.snp.bottom).offset(16)
}
//2、报名人数
let redStarImagV = UIImageView()
redStarImagV.backgroundColor = .red
redStarImagV.image = UIImage(named: "activity_red_star")
redStarImagV.contentMode = .scaleAspectFit
centerView.addSubview(redStarImagV)
redStarImagV.snp.makeConstraints { make in
make.left.equalTo(20)
make.height.width.equalTo(6)
make.top.equalTo(line2.snp.bottom).offset(27)
}
let numberLable = UILabel()
numberLable.textColor = UIColor.mainTextColor
numberLable.textAlignment = .left
numberLable.font = UIFont.PFSC_R(ofSize:14)
numberLable.text = "报名人数"
centerView.addSubview(numberLable)
numberLable.snp.makeConstraints { make in
make.left.equalTo(redStarImagV.snp.right).offset(2)
make.height.equalTo(20)
make.centerY.equalTo(redStarImagV.snp.centerY)
}
centerView.addSubview(subButton)
subButton.snp.makeConstraints { make in
make.left.equalTo(numberLable.snp.right).offset(48)
make.centerY.equalTo(numberLable.snp.centerY)
make.width.height.equalTo(28)
}
centerView.addSubview(applyNumberTextField)
applyNumberTextField.snp.makeConstraints { make in
make.left.equalTo(subButton.snp.right).offset(2)
make.centerY.equalTo(numberLable.snp.centerY)
make.width.height.equalTo(28)
}
applyNumberTextField.layer.cornerRadius = kCornerRadius6
applyNumberTextField.backgroundColor = UIColor(hex: 0xf5f5f5, alpha: 1.0)
centerView.addSubview(addButton)
addButton.snp.makeConstraints { make in
make.left.equalTo(applyNumberTextField.snp.right).offset(2)
make.centerY.equalTo(numberLable.snp.centerY)
make.width.height.equalTo(28)
}
let line3 = UIView()
line3.backgroundColor = .separatorColor
centerView.addSubview(line3)
line3.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.height.equalTo(1)
make.top.equalTo(addButton.snp.bottom).offset(16)
}
//3、手机号码
let redStarImagV2 = UIImageView()
redStarImagV2.backgroundColor = .red
redStarImagV2.image = UIImage(named: "activity_red_star")
redStarImagV2.contentMode = .scaleAspectFill
centerView.addSubview(redStarImagV2)
redStarImagV2.snp.makeConstraints { make in
make.left.equalTo(20)
make.height.width.equalTo(6)
make.top.equalTo(line3.snp.bottom).offset(27)
}
let phoneLable = UILabel()
phoneLable.textColor = UIColor.mainTextColor
phoneLable.textAlignment = .left
phoneLable.font = UIFont.PFSC_R(ofSize:14)
phoneLable.text = "手机号码"
centerView.addSubview(phoneLable)
phoneLable.snp.makeConstraints { make in
make.left.equalTo(redStarImagV2.snp.right).offset(2)
make.height.equalTo(20)
make.centerY.equalTo(redStarImagV2.snp.centerY)
}
centerView.addSubview(phoneTextField)
phoneTextField.snp.makeConstraints { make in
make.left.equalTo(subButton.snp.left)
make.height.equalTo(20)
make.centerY.equalTo(phoneLable)
make.right.equalTo(20)
}
let line4 = UIView()
line4.backgroundColor = .separatorColor
centerView.addSubview(line4)
line4.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.height.equalTo(1)
make.top.equalTo(phoneTextField.snp.bottom).offset(39)
}
centerView.addSubview(phoneTipsLable)
phoneTipsLable.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.height.equalTo(17)
make.top.equalTo(phoneTextField.snp.bottom).offset(6)
}
//提交
centerView.addSubview(submitButton)
submitButton.snp.makeConstraints { make in
make.left.equalTo(kMargin)
make.right.equalTo(-kMargin)
make.height.equalTo(48)
make.bottom.equalToSuperview().offset(-42)
}
}
@objc func clickCloseBtn() {
dismiss()
}
@objc func clickSubmitBtn() {
clickCloseBtn()
}
@objc func agree() {
block?(true)
}
@objc func disagree() {
block?(false)
dismiss()
}
func dismiss() {
removeFromSuperview()
}
}
extension YHApplyActivityAlert: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
// if string.isEmpty == true { // 点击删除
// return true
// }
//
// let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
// if newText.count > Self.maxWordsCount {
// YHHUD.flash(message: "搜索限制最多\(Self.maxWordsCount)个字符")
// return false
// }
return true
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "activity_red_star@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "activity_red_star@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Frame 18253@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame 18253@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" : "Frame 18254@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame 18254@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
}
}
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