Commit 54122f24 authored by David黄金龙's avatar David黄金龙

完成 我的文书列表的全流程

parent 611667f3
......@@ -354,8 +354,10 @@
A5D001212BAA9D99001F003C /* YHChoiceButtonHoldView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D001202BAA9D99001F003C /* YHChoiceButtonHoldView.swift */; };
A5D0012A2BABC84A001F003C /* YHFileListHeaerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D001272BABC84A001F003C /* YHFileListHeaerView.swift */; };
A5D0012C2BABC84A001F003C /* YHFileListBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D001292BABC84A001F003C /* YHFileListBottomView.swift */; };
A5D5ADEF2BB90FBC0039FA6B /* YHCheckEamilAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D5ADEE2BB90FBB0039FA6B /* YHCheckEamilAlertView.swift */; };
A5D6AB1B2B46A1CC001C10A5 /* YHHomeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */; };
A5D6AB1D2B46AAFB001C10A5 /* YHHomePageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5D6AB1C2B46AAFB001C10A5 /* YHHomePageViewModel.swift */; };
A5DE0D3C2BB9016200976FE1 /* YHEmailInputAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5DE0D3B2BB9016200976FE1 /* YHEmailInputAlertView.swift */; };
A5E69D512BA304D400411932 /* DIN Alternate Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A5E69D502BA304D400411932 /* DIN Alternate Bold.ttf */; };
A5EF21312BA6DF94005027E6 /* YHMineSchemeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5EF21302BA6DF94005027E6 /* YHMineSchemeViewController.swift */; };
A5EF21332BA6E030005027E6 /* YHFileListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5EF21322BA6E030005027E6 /* YHFileListViewController.swift */; };
......@@ -759,8 +761,10 @@
A5D001202BAA9D99001F003C /* YHChoiceButtonHoldView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChoiceButtonHoldView.swift; sourceTree = "<group>"; };
A5D001272BABC84A001F003C /* YHFileListHeaerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFileListHeaerView.swift; sourceTree = "<group>"; };
A5D001292BABC84A001F003C /* YHFileListBottomView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFileListBottomView.swift; sourceTree = "<group>"; };
A5D5ADEE2BB90FBB0039FA6B /* YHCheckEamilAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCheckEamilAlertView.swift; sourceTree = "<group>"; };
A5D6AB1A2B46A1CC001C10A5 /* YHHomeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeModel.swift; sourceTree = "<group>"; };
A5D6AB1C2B46AAFB001C10A5 /* YHHomePageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomePageViewModel.swift; sourceTree = "<group>"; };
A5DE0D3B2BB9016200976FE1 /* YHEmailInputAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHEmailInputAlertView.swift; sourceTree = "<group>"; };
A5E69D502BA304D400411932 /* DIN Alternate Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "DIN Alternate Bold.ttf"; sourceTree = "<group>"; };
A5EF21302BA6DF94005027E6 /* YHMineSchemeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMineSchemeViewController.swift; sourceTree = "<group>"; };
A5EF21322BA6E030005027E6 /* YHFileListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFileListViewController.swift; sourceTree = "<group>"; };
......@@ -1644,6 +1648,8 @@
A53B61182BB3C9960010B573 /* YHMyDocListHeaderView.swift */,
A517A4DE2BB53BE8000DEECD /* YHDocListBottomView.swift */,
A517A4E02BB573EB000DEECD /* YHDocListCell.swift */,
A5DE0D3B2BB9016200976FE1 /* YHEmailInputAlertView.swift */,
A5D5ADEE2BB90FBB0039FA6B /* YHCheckEamilAlertView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -2359,6 +2365,7 @@
0468D4362B57752F00CFB916 /* YHUserModel.swift in Sources */,
045EEE992B9F171A0022A143 /* YHPreviewInfoHoldView.swift in Sources */,
045EEE7E2B9F171A0022A143 /* YHPersonInfoCellModel1.swift in Sources */,
A5DE0D3C2BB9016200976FE1 /* YHEmailInputAlertView.swift in Sources */,
A5ACE9512B4564F7002C94D2 /* YhConstant.swift in Sources */,
045EEF192B9F171A0022A143 /* YHAddressModel.swift in Sources */,
045EEEDB2B9F171A0022A143 /* YHCollegeSearchViewController.swift in Sources */,
......@@ -2423,6 +2430,7 @@
045EEEAE2B9F171A0022A143 /* YHWorkHighlightsTableViewCell.swift in Sources */,
045EEF062B9F171A0022A143 /* YHFormItemQuestionsCell.swift in Sources */,
0468D4242B494BEA00CFB916 /* YHCodeResultViewController.swift in Sources */,
A5D5ADEF2BB90FBC0039FA6B /* YHCheckEamilAlertView.swift in Sources */,
04A671602BA0280800C1FB91 /* YHFileRenameInputView.swift in Sources */,
A5ACE93F2B4564F7002C94D2 /* UIViewController+Extension.swift in Sources */,
A53B61192BB3C9960010B573 /* YHMyDocListHeaderView.swift in Sources */,
......
......@@ -531,7 +531,7 @@ extension YHCertificateUploadContentListVC {
@objc func handleKeyboardNotification(_ notification: Notification) {
if let userInfo = notification.userInfo {
if notification.userInfo != nil {
guard let keyboardFrame = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as AnyObject).cgRectValue else {return }
......
......@@ -26,7 +26,8 @@ enum YHCertificateEditType:Int {
case preview = 2
case delete = 3
case cancel = 4
case reUpload = 5
case reupload = 5
case sendEmail = 6
}
class YHCertificateEditItem {
......
......@@ -7,6 +7,7 @@
//
import UIKit
import IQKeyboardManagerSwift
/*
*我的文书 列表
*/
......@@ -42,6 +43,23 @@ class YHMyDocumentsListViewController: YHBaseViewController {
}()
lazy var emailInputView: YHEmailInputAlertView = {
let view = YHEmailInputAlertView.emailInputView(defalutText: "请输入邮箱")
return view
}()
lazy var blackMaskView: UIView = {
let view = UIView(frame:UIScreen.main.bounds)
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5)
let tap = UITapGestureRecognizer(target: self, action: #selector(dismissed))
view.addGestureRecognizer(tap)
view.isHidden = true
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
viewModel = YHMyDocumentsListViewModel()
......@@ -54,6 +72,11 @@ class YHMyDocumentsListViewController: YHBaseViewController {
super.viewWillAppear(animated)
getData()
}
deinit {
removeNotify()
}
}
extension YHMyDocumentsListViewController {
......@@ -70,6 +93,9 @@ extension YHMyDocumentsListViewController {
}
func setView() {
addKeyBoardNotify()
//1
view.addSubview(headBkgImagV)
headBkgImagV.snp.makeConstraints { make in
......@@ -150,8 +176,51 @@ extension YHMyDocumentsListViewController {
}
bottomView.layoutIfNeeded()
bottomView.bottomButton.addYinHeGradualLayer()
view.addSubview(blackMaskView)
view.addSubview(emailInputView)
emailInputView.snp.makeConstraints { make in
make.left.right.equalTo(view)
make.height.equalTo(YHEmailInputAlertView.height)
make.bottom.equalToSuperview().offset(YHEmailInputAlertView.height)
}
emailInputView.editBlock = {
[weak self] text in
guard let self = self else { return }
if let text = text {
YHCheckEamilAlertView.show(nil,text, "取消", "确认") {
//进行
//发送接口
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
let params = ["order_id":orderID,"ids":self.arrIDs,"email":text]
self.viewModel?.sendEmailForDocs(params, callBackBlock: { success, error in
if success {
YHHUD.flash(message: "发送成功")
} else {
let msg = error?.errorMsg ?? "发送失败"
YHHUD.flash(message: msg)
}
})
} else {
YHHUD.flash(message: "订单ID 为空")
}
}
}
}
}
@objc func dismissed() {
emailInputView.textField.resignFirstResponder()
}
private func updateUIForClickButton(type : ClickButtonType) {
bottomView.snp.removeConstraints()
tableView.snp.removeConstraints()
......@@ -199,7 +268,7 @@ extension YHMyDocumentsListViewController {
arrIDs.removeAll()
for item in dataSource.docs {
if item.isSelectedFlag {
arrIDs.append(item.id)
arrIDs.append(item.sign_doc.id)
}
}
......@@ -209,19 +278,18 @@ extension YHMyDocumentsListViewController {
}
//弹窗 选择发送邮箱
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
let params = ["order_id":orderID,"ids":arrIDs,"email":"383913637@qq.com"]
viewModel?.sendEmailForDocs(params, callBackBlock: { success, error in
if success {
YHHUD.flash(message: "发送成功")
} else {
let msg = error?.errorMsg ?? "发送失败"
YHHUD.flash(message: msg)
}
})
} else {
YHHUD.flash(message: "订单ID 为空")
let items = [YHCertificateEditItem(type:.sendEmail, title:"发送至邮箱"),
YHCertificateEditItem(type:.cancel, title:"取消")]
YHCertificateEditSheetView.sheetView(items:items) {
[weak self] editType in
guard let self = self else { return }
IQKeyboardManager.shared.enable = false
if editType == .sendEmail {
emailInputView.textField.text = ""
emailInputView.textField.becomeFirstResponder()
}
}.show()
}
}
......@@ -259,3 +327,40 @@ extension YHMyDocumentsListViewController: UITableViewDelegate, UITableViewDataS
}
}
extension YHMyDocumentsListViewController {
func addKeyBoardNotify() {
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
}
func removeNotify() {
NotificationCenter.default.removeObserver(self)
}
@objc func handleKeyboardNotification(_ notification: Notification) {
if notification.userInfo != nil {
guard let keyboardFrame = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as AnyObject).cgRectValue else {return }
let isKeyboardShow = notification.name == UIResponder.keyboardWillShowNotification
self.blackMaskView.isHidden = !isKeyboardShow
let bottomMargin = (isKeyboardShow ? -keyboardFrame.height : YHFileRenameInputView.height)
if !isKeyboardShow {
IQKeyboardManager.shared.enable = true
}
self.emailInputView.snp.updateConstraints { make in
make.bottom.equalToSuperview().offset(bottomMargin)
}
self.view.setNeedsLayout()
self.view.layoutIfNeeded()
}
}
}
//
// YHCheckEamilAlertView.swift
// galaxy
//
// Created by davidhuangA on 2024/3/31.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHCheckEamilAlertView: UIView {
typealias AgreeBlock = () -> ()
var agreeBlock: AgreeBlock?
var centerView: UIView!
var titleLabel: UILabel!
var messageLabel: UILabel!
var agreeButton: UIButton!
var disAgressButton: UIButton!
static func show(_ title: String? = nil, _ message: String? = nil, _ leftButtonString: String? = nil, _ rightButtonString: String? = nil, callBack: @escaping (() -> Void)) {
let view = YHCheckEamilAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.agreeBlock = callBack
view.setContent(title, message, leftButtonString, rightButtonString)
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()
}
func setContent(_ title: String? = nil, _ message: String? = nil, _ leftButtonString: String? = nil, _ rightButtonString: String? = nil) {
self.titleLabel.text = title
// self.messageLabel.text = message
let a: ASAttributedString = .init("请确认接收邮箱是否为\n", .font(UIFont.PFSC_R(ofSize: 16)),.foreground(UIColor.mainTextColor))
let aa: ASAttributedString = .init(NSAttributedString(string: message ?? "--"), .font(UIFont.PFSC_R(ofSize: 16)),.foreground(UIColor.brandMainColor))
self.messageLabel.attributed.text = a + aa
self.disAgressButton.setTitle(leftButtonString, for: .normal)
self.agreeButton.setTitle(rightButtonString, for: .normal)
if title?.count == 0 || title == nil {
centerView.snp.remakeConstraints { make in
make.center.equalToSuperview()
make.width.equalTo(299)
}
messageLabel.snp.remakeConstraints { make in
make.left.equalTo(22)
make.right.equalTo(-22)
make.top.equalTo(40)
make.bottom.equalTo(disAgressButton.snp.top).offset(-18)
}
disAgressButton.snp.removeConstraints()
disAgressButton.snp.remakeConstraints { make in
make.top.equalTo(messageLabel.snp.bottom).offset(kMargin)
make.left.equalTo(16)
make.width.equalTo(128)
make.height.equalTo(45)
make.bottom.equalTo(-21)
}
agreeButton.snp.removeConstraints()
agreeButton.snp.makeConstraints { make in
make.right.equalTo(-16)
make.width.equalTo(128)
make.height.equalTo(45)
make.top.equalTo(messageLabel.snp.bottom).offset(kMargin)
}
}
}
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 = kCornerRadius6
return view
}()
addSubview(centerView)
centerView.snp.makeConstraints { make in
make.center.equalToSuperview()
make.width.equalTo(299)
make.height.equalTo(187)
}
titleLabel = {
let label = UILabel()
label.textAlignment = .center
label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_M(ofSize: 17)
label.numberOfLines = 0
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(22)
make.right.equalTo(-22)
make.height.equalTo(20)
make.top.equalTo(16)
}
messageLabel = {
let label = UILabel()
label.textAlignment = .center
label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_R(ofSize: 16)
label.numberOfLines = 0
return label
}()
centerView.addSubview(messageLabel)
messageLabel.snp.makeConstraints { make in
make.left.equalTo(22)
make.right.equalTo(-22)
make.height.equalTo(42)
make.top.equalTo(63)
}
disAgressButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0xffffff)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
button.contentHorizontalAlignment = .center
button.setTitle("不同意", for: .normal)
button.setTitleColor( UIColor(hex:0x3c86f8), for: .normal)
button.layer.cornerRadius = kCornerRadius6
button.layer.borderWidth = 1
button.layer.borderColor = UIColor(hex: 0x3c86f8).cgColor
button.addTarget(self, action: #selector(disagree), for: .touchUpInside)
return button
}()
centerView.addSubview(disAgressButton)
disAgressButton.snp.makeConstraints { make in
make.left.equalTo(16)
make.bottom.equalTo(-21)
make.width.equalTo(128)
make.height.equalTo(45)
}
agreeButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0x3c86f8)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
button.contentHorizontalAlignment = .center
button.setTitle("同意", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius6
button.addTarget(self, action: #selector(agree), for: .touchUpInside)
return button
}()
centerView.addSubview(agreeButton)
agreeButton.snp.makeConstraints { make in
make.right.equalTo(-16)
make.bottom.equalTo(-21)
make.width.equalTo(128)
make.height.equalTo(45)
}
}
@objc func agree() {
if let block = self.agreeBlock {
block()
}
dismiss()
}
@objc private func handleTap(_ sender: AnyObject?) {
print("处理点击手势")
dismiss()
}
@objc func disagree() {
dismiss()
}
func dismiss() {
removeFromSuperview()
}
}
extension YHCheckEamilAlertView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer:UIGestureRecognizer, shouldReceive touch:UITouch) -> Bool {
if touch.view == self {
return true
}
return false
}
}
//
// YHEmailInputAlertView.swift
// galaxy
//
// Created by davidhuangA on 2024/3/31.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHEmailInputAlertView: UIView {
static let height = 217.0
static let maxWordsCount = 30
var editBlock:((String?)->Void)?
lazy var blackMaskView: UIView = {
let view = UIView(frame:UIScreen.main.bounds)
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5)
let tap = UITapGestureRecognizer(target: self, action: #selector(dismiss))
view.addGestureRecognizer(tap)
return view
}()
lazy var whiteContentView: UIView = {
let view = UIView()
view.backgroundColor = .white
let tap = UITapGestureRecognizer(target: self, action: #selector(didWhiteContentViewTap))
view.addGestureRecognizer(tap)
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
label.font = UIFont.PFSC_B(ofSize:17)
label.text = "填写要发送的邮箱"
return label
}()
lazy var closeBtn: UIButton = {
let btn = UIButton()
btn.setImage(UIImage(named:"my_cer_sheet_close"), for: .normal)
btn.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
return btn
}()
lazy var topLine:UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
lazy var inputContentView: UIView = {
let view = UIView()
view.backgroundColor = .contentBkgColor
view.layer.cornerRadius = 6.0
view.clipsToBounds = true
return view
}()
lazy var textField:UITextField = {
let textField = UITextField()
textField.backgroundColor = .clear
textField.placeholder = "请输入邮箱"
textField.font = UIFont.PFSC_M(ofSize: 16)
textField.tintColor = UIColor.brandMainColor
textField.textColor = UIColor.mainTextColor
textField.delegate = self
textField.clearButtonMode = .whileEditing
return textField
}()
lazy var cancelBtn:UIButton = {
let btn = UIButton()
btn.setTitle("取消", for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
btn.setTitleColor(UIColor.mainTextColor, for: .normal)
btn.backgroundColor = .contentBkgColor
btn.layer.cornerRadius = 6.0
btn.addTarget(self, action: #selector(didClickCancelBtn), for: .touchUpInside)
return btn
}()
lazy var confirmBtn:UIButton = {
let btn = UIButton()
btn.setTitle("确定".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
btn.setTitleColor(.white, for: .normal)
btn.backgroundColor = UIColor(hexString:"#4388FF")
btn.layer.cornerRadius = 6.0
btn.addTarget(self, action: #selector(didClickConfirmBtn), for: .touchUpInside)
return btn
}()
override init(frame: CGRect) {
super.init(frame:frame)
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
static func emailInputView(defalutText:String?)-> YHEmailInputAlertView {
let view = YHEmailInputAlertView(frame:CGRect(x: 0, y: 0, width:KScreenWidth, height:Self.height))
view.textField.text = defalutText
return view
}
func createUI() {
self.addSubview(whiteContentView)
whiteContentView.addSubview(titleLabel)
whiteContentView.addSubview(closeBtn)
whiteContentView.addSubview(topLine)
whiteContentView.addSubview(inputContentView)
inputContentView.addSubview(textField)
whiteContentView.addSubview(cancelBtn)
whiteContentView.addSubview(confirmBtn)
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
let path = UIBezierPath(roundedRect:bounds,byRoundingCorners: corner,cornerRadii:CGSizeMake(16.0, 16.0));
let layer = CAShapeLayer();
layer.frame = whiteContentView.bounds;
layer.path = path.cgPath;
whiteContentView.layer.mask = layer;
whiteContentView.snp.makeConstraints { make in
make.left.right.top.bottom.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(52.0)
}
closeBtn.snp.makeConstraints { make in
make.width.height.equalTo(24.0)
make.right.equalToSuperview().offset(-20)
make.centerY.equalTo(titleLabel)
}
topLine.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(titleLabel.snp.bottom)
make.height.equalTo(1)
}
inputContentView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
make.top.equalTo(topLine.snp.bottom).offset(20)
make.height.equalTo(48)
}
textField.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.height.equalTo(20)
make.centerY.equalToSuperview()
}
cancelBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalTo(whiteContentView.snp.centerX).offset(-6)
make.top.equalTo(inputContentView.snp.bottom).offset(30)
make.height.equalTo(45)
}
confirmBtn.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-16)
make.left.equalTo(whiteContentView.snp.centerX).offset(6)
make.top.equalTo(cancelBtn)
make.height.equalTo(45)
}
}
}
extension YHEmailInputAlertView {
@objc func dismiss() {
self.textField.resignFirstResponder()
UIApplication.shared.yhKeyWindow()?.endEditing(true)
}
@objc func didWhiteContentViewTap() {
self.textField.becomeFirstResponder()
}
@objc func didClickCancelBtn() {
dismiss()
}
@objc func didClickConfirmBtn() {
if isEmptyString(textField.text) {
YHHUD.flash(message: "邮箱不可为空")
return
}
if let txt = textField.text,txt.isValidEmail {
if let editBlock = editBlock {
editBlock(textField.text)
}
dismiss()
} else {
YHHUD.flash(message: "邮箱不合法")
}
}
}
extension YHEmailInputAlertView: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if string.isEmpty == true { // 点击删除
return true
}
var newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if newText.count > Self.maxWordsCount {
YHHUD.flash(message: "重命名限制最多30个字符")
return false
}
return true
}
}
......@@ -142,13 +142,13 @@ class YHFileItemView: UIView {
@objc func deleteClick() {
let items = [YHCertificateEditItem(type:.preview, title:"预览"),
YHCertificateEditItem(type:.reUpload, title:"重传"),
YHCertificateEditItem(type:.reupload, title:"重传"),
YHCertificateEditItem(type:.delete, title:"删除"),
YHCertificateEditItem(type:.cancel, title:"取消")]
YHCertificateEditSheetView.sheetView(items:items) {
[weak self] editType in
guard let self = self else { return }
if editType == .reUpload {
if editType == .reupload {
if let block = itemBlock {
block(.reUpload, index)
}
......
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