Commit 236c0d57 authored by Steven杜宇's avatar Steven杜宇

// 旅行证件准备

parent 6d79550f
......@@ -392,6 +392,7 @@
048058332C7DC0CF00502CAA /* YHTravelCertificateTipsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048058322C7DC0CF00502CAA /* YHTravelCertificateTipsCell.swift */; };
048058352C7DC7AC00502CAA /* YHMyTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048058342C7DC7AC00502CAA /* YHMyTestViewController.swift */; };
048058372C7F03B500502CAA /* YHTravelCertificateUploadCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048058362C7F03B500502CAA /* YHTravelCertificateUploadCell.swift */; };
048058392C7F289700502CAA /* YHTravelCertificateItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048058382C7F289700502CAA /* YHTravelCertificateItemView.swift */; };
0480976B2BA15269000B9DCA /* YHCertificateInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */; };
0480976D2BA158A1000B9DCA /* YHCertificateListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */; };
048097712BA18D66000B9DCA /* YHCertificateSearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */; };
......@@ -1166,6 +1167,7 @@
048058322C7DC0CF00502CAA /* YHTravelCertificateTipsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTravelCertificateTipsCell.swift; sourceTree = "<group>"; };
048058342C7DC7AC00502CAA /* YHMyTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyTestViewController.swift; sourceTree = "<group>"; };
048058362C7F03B500502CAA /* YHTravelCertificateUploadCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTravelCertificateUploadCell.swift; sourceTree = "<group>"; };
048058382C7F289700502CAA /* YHTravelCertificateItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTravelCertificateItemView.swift; sourceTree = "<group>"; };
0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateInfoCell.swift; sourceTree = "<group>"; };
0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListVC.swift; sourceTree = "<group>"; };
048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateSearchBar.swift; sourceTree = "<group>"; };
......@@ -3508,6 +3510,7 @@
048058302C7DBDC900502CAA /* YHTravelCertificateTipsView.swift */,
048058322C7DC0CF00502CAA /* YHTravelCertificateTipsCell.swift */,
048058362C7F03B500502CAA /* YHTravelCertificateUploadCell.swift */,
048058382C7F289700502CAA /* YHTravelCertificateItemView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -4397,6 +4400,7 @@
045EEF132B9F171A0022A143 /* YHCountryMessage.swift in Sources */,
04EC2F812C22888E002907D7 /* YHFriendRequestView.swift in Sources */,
0430E6722C749E74000511E2 /* YHAdopterBirthViewController.swift in Sources */,
048058392C7F289700502CAA /* YHTravelCertificateItemView.swift in Sources */,
045EEE7B2B9F171A0022A143 /* YHPersonInfoCellModel2.swift in Sources */,
A53B61122BB128AF0010B573 /* YHFileListItemsView2.swift in Sources */,
04358E042C77322700811928 /* YHHaveGrabbedNumberListCell.swift in Sources */,
......
......@@ -9,6 +9,23 @@
import UIKit
class YHCardUploadView: UIView {
var titleHeight: CGFloat = 22.0 {
didSet {
self.frontLabel.snp.updateConstraints { make in
make.height.equalTo(titleHeight)
}
}
}
var imgHeight: CGFloat = 99.0 {
didSet {
frontImageButton.snp.updateConstraints { make in
make.height.equalTo(90.0)
}
}
}
typealias UrlBlock = (_ url: String, _ index: Int) -> ()
var urlBlock: UrlBlock?
var deleteBlock: UrlBlock?
......
......@@ -47,7 +47,7 @@ class YHMyTestViewController: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.gk_navTitle = "旅行证件准"
self.gk_navTitle = "旅行证件准"
self.view.backgroundColor = .white
self.view.addSubview(self.tableView)
self.tableView.snp.makeConstraints { make in
......
......@@ -7,21 +7,161 @@
//
import UIKit
import AttributedString
enum YHTravelDocsType: Int {
case unknown = -1 // 未知
case HK = 0 // 港澳通行证
case chinesePassPort = 1 // 中国护照
case forignPassPort = 2 // 外国护照
}
enum YHTravelCerSectionType: Int {
case tips = 0
case certificate = 1
}
class YHTravelCerSectionItem {
var type: YHTravelCerSectionType = .tips
var tipsArr: [ASAttributedString] = []
var cerDetailModel: YHTravelDocsPreparationDetailItemModel = YHTravelDocsPreparationDetailItemModel()
init(type: YHTravelCerSectionType, tipsArr:[ASAttributedString]) {
self.type = type
self.tipsArr = tipsArr
}
}
class YHTravelDocsPreparationDetailVC: YHBaseViewController {
var type:YHTravelDocsType = .HK
lazy var viewModel: YHTravelDocsPreparationViewModel = {
let vm = YHTravelDocsPreparationViewModel()
return vm
}()
//上个界面传递过来的数据对象
var dataModel : YHTravelDocsPreparationListModel?
var dataModel : YHTravelDocsPreparationListModel = YHTravelDocsPreparationListModel()
var orderId: Int = 0
var sectionItems:[YHTravelCerSectionItem] = []
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionHeaderHeight = 16.0
tableView.estimatedSectionFooterHeight = 0.01
tableView.contentInsetAdjustmentBehavior = .never
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = UIColor(hex: 0xF8F9FB)
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHTravelCertificateTipsCell.self, forCellReuseIdentifier: YHTravelCertificateTipsCell.cellReuseIdentifier)
tableView.register(YHTravelCertificateUploadCell.self, forCellReuseIdentifier: YHTravelCertificateUploadCell.cellReuseIdentifier)
return tableView
}()
lazy var bottomView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.addSubview(bottomBtn)
bottomBtn.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(8)
make.height.equalTo(48)
}
return view
}()
lazy var bottomBtn: UIButton = {
let btn = UIButton()
btn.backgroundColor = .brandMainColor
btn.setTitle("确认,保存", for: .normal)
btn.setTitleColor(.white, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
btn.addTarget(self, action: #selector(didSaveBtnClicked), for: .touchUpInside)
btn.layer.cornerRadius = kCornerRadius3
return btn
}()
override func viewDidLoad() {
super.viewDidLoad()
self.gk_navTitle = "旅行证件准备"
self.view.backgroundColor = .white
self.view.addSubview(self.tableView)
self.view.addSubview(bottomView)
self.tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(bottomView.snp.top)
}
self.bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(98.0)
}
loadDetailInfo()
}
func updateData() {
// travel_cert_type 证件类型 0-未知 1-护照 3-港澳通行证
// nationality : Int = -1 国籍 1-中国 2-国外
if dataModel.nationality == 2 { // 国籍为国外
self.type = .forignPassPort
} else { // 国籍为中国
if dataModel.travel_cert_type == 1 { // 中国护照
self.type = .chinesePassPort
} else if dataModel.travel_cert_type == 3 { // 港澳通行证
self.type = .HK
}
}
// 头部提示
let tipsArr = viewModel.getTipsWithType(self.type)
let item1 = YHTravelCerSectionItem(type: .tips, tipsArr: tipsArr)
sectionItems.append(item1)
// 证件相关
if let list = self.viewModel.travelDetailModel?.list, list.count > 0 {
for model in list {
let item2 = YHTravelCerSectionItem(type: .certificate, tipsArr: [])
if let model = model {
item2.cerDetailModel = model
sectionItems.append(item2)
}
}
} else { // 没有上传过证件
let item = YHTravelCerSectionItem(type: .certificate, tipsArr: [])
if self.type == .HK {
var userId = 0
if let uid = YHLoginManager.shared.userModel?.id {
userId = Int(uid) ?? 0
}
let cerModel1 = YHTravelDocsPreparationDetailItemModel(type: 3, order_id: self.orderId, order_sn: "", img_back: "", img_front: "", status: 0, issue_start: "", issue_end: "", user_id:userId , user_type: dataModel.type, remark: "", nationality: "\(dataModel.nationality)")
item.cerDetailModel = cerModel1
sectionItems.append(item)
}
}
tableView.reloadData()
}
@objc func didSaveBtnClicked() {
}
}
......@@ -29,25 +169,30 @@ class YHTravelDocsPreparationDetailVC: YHBaseViewController {
private extension YHTravelDocsPreparationDetailVC {
//1、获取详情信息
func loadDetailInfo() {
if let model = dataModel {
let params = [
"order_id":orderId,
"user_id":model.id,
"user_type":model.type
] as [String : Any]
viewModel.getTravelDocsDetailInfo(param: params) { success, error in
if success {
// TODO: 杜宇哥 UI刷新
} else {
}
let params = [
"order_id": orderId,
"user_id": dataModel.id,
"user_type": dataModel.type
] as [String : Any]
YHHUD.show(.progress(message: "加载中..."))
viewModel.getTravelDocsDetailInfo(param: params) { success, error in
YHHUD.hide()
if success {
// TODO: 杜宇哥 UI刷新
self.updateData()
} else {
}
}
}
//2、保存旅行证件
func saveAllTravelCertificate() {
if let model = dataModel {
/*
{
......@@ -67,10 +212,11 @@ private extension YHTravelDocsPreparationDetailVC {
*/
let params = [
"order_id":orderId,
"user_id":model.id,
"user_type":model.type,
"user_id":dataModel.id,
"user_type":dataModel.type,
"certificates":[] // TODO: 杜宇哥完善下这个数据
] as [String : Any]
viewModel.saveTravelDocsInfo(params: params) { success, error in
if success {
......@@ -78,8 +224,68 @@ private extension YHTravelDocsPreparationDetailVC {
}
}
}
}
extension YHTravelDocsPreparationDetailVC: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return sectionItems.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if 0 <= indexPath.section && indexPath.section < sectionItems.count {
let item = sectionItems[indexPath.section]
if item.type == .tips {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHTravelCertificateTipsCell.cellReuseIdentifier, for: indexPath) as! YHTravelCertificateTipsCell
cell.tipsArr = item.tipsArr
return cell
}
}
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHTravelCertificateUploadCell.cellReuseIdentifier, for: indexPath) as! YHTravelCertificateUploadCell
if 0 <= indexPath.section && indexPath.section < sectionItems.count {
let item = sectionItems[indexPath.section]
cell.updateModel(item.cerDetailModel)
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.section && indexPath.section < sectionItems.count {
}
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 16.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
return view
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
return view
}
}
......@@ -34,6 +34,28 @@ class YHTravelDocsPreparationDetailItemModel: SmartCodable {
var remark : String = ""//备注
var nationality : String = ""//国籍 1-中国 2-国外
// 自定义
var isNeedCheck: Bool = false
var checkTips: String = ""
var isNeedShowRejectReason: Bool = false
var rejectReason: String = ""
required init() {
}
init(type: Int, order_id: Int, order_sn: String, img_back: String, img_front: String, status: Int, issue_start: String, issue_end: String, user_id: Int, user_type: String, remark: String, nationality: String) {
self.type = type
self.order_id = order_id
self.order_sn = order_sn
self.img_back = img_back
self.img_front = img_front
self.status = status
self.issue_start = issue_start
self.issue_end = issue_end
self.user_id = user_id
self.user_type = user_type
self.remark = remark
self.nationality = nationality
}
}
//
// YHTravelCertificateItemView.swift
// galaxy
//
// Created by edy on 2024/8/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHTravelCertificateItemView: UIView {
var titleMaxWidth = 112.0
var clickBlock: (()->())?
var title: String = "" {
didSet {
titleLabel.text = title
}
}
var placeHolder: String = ""
var errorTips: String = "" {
didSet {
errorLabel.text = errorTips
}
}
var isNeedShowErrorTips: Bool = false {
didSet {
errorLabel.isHidden = !isNeedShowErrorTips
errorLabel.snp.remakeConstraints { make in
make.top.equalTo(detailLabel.snp.bottom).offset(isNeedShowErrorTips ? 5 : 0)
make.left.equalTo(titleLabel)
make.right.equalTo(0)
make.bottom.equalTo(-16)
if !isNeedShowErrorTips {
make.height.equalTo(0)
}
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
var detail: String = "" {
didSet {
if detail.isEmpty {
// 显示placeHolder
detailLabel.text = self.placeHolder
detailLabel.textColor = .placeHolderColor
detailLabel.textAlignment = .left
return
}
detailLabel.text = detail
detailLabel.textColor = .mainTextColor
detailLabel.textAlignment = .left
}
}
lazy var lineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = .mainTextColor
return label
}()
private lazy var detailLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = .mainTextColor
return label
}()
private lazy var errorLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = .failColor
return label
}()
lazy var arrowImgView: UIImageView = {
let view = UIImageView(image: UIImage(named: "family_info_arrow"))
return view
}()
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc func didSelectView() {
clickBlock?()
}
func createUI() {
self.addSubview(titleLabel)
self.addSubview(detailLabel)
self.addSubview(arrowImgView)
self.addSubview(lineView)
self.addSubview(errorLabel)
let tap = UITapGestureRecognizer(target: self, action: #selector(didSelectView))
self.addGestureRecognizer(tap)
lineView.snp.makeConstraints { make in
make.left.equalTo(0)
make.right.equalTo(0)
make.top.equalTo(0)
make.height.equalTo(0.5)
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(0)
make.top.equalTo(16)
make.width.equalTo(titleMaxWidth)
}
detailLabel.snp.makeConstraints { make in
make.top.equalTo(16)
make.left.equalTo(titleLabel.snp.right)
make.right.equalTo(arrowImgView.snp.left)
}
errorLabel.snp.makeConstraints { make in
make.top.equalTo(detailLabel.snp.bottom).offset(0)
make.left.equalTo(titleLabel)
make.right.equalTo(0)
make.bottom.equalTo(-16)
}
arrowImgView.snp.makeConstraints { make in
make.width.height.equalTo(22)
make.top.equalTo(15)
make.right.equalTo(0)
}
}
}
......@@ -9,10 +9,39 @@
import UIKit
import AttributedString
enum YHCertificateID: Int {
case signDate = 0 // 签发日期
case deadDate = 1 // 届满日期
case kind = 2 //
}
class YHCertificateDateItem {
var id: YHCertificateID = .signDate
var title: String = ""
var value: String = ""
var placeHolder: String = ""
var errorTips: String = ""
var isShowErrorTips: Bool = false
init(id: YHCertificateID, title: String, value: String, placeHolder: String, errorTips: String, isShowErrorTips: Bool = false) {
self.id = id
self.title = title
self.value = value
self.placeHolder = placeHolder
self.errorTips = errorTips
self.isShowErrorTips = isShowErrorTips
}
}
class YHTravelCertificateUploadCell: UITableViewCell {
static let cellReuseIdentifier = "YHTravelCertificateUploadCell"
var dataModel: YHTravelDocsPreparationDetailItemModel = YHTravelDocsPreparationDetailItemModel()
lazy var whiteConentView: UIView = {
let view = UIView()
view.backgroundColor = .white
......@@ -60,21 +89,27 @@ class YHTravelCertificateUploadCell: UITableViewCell {
return label
}()
lazy var certificateFrontView: UIView = {
let view = UIView()
view.backgroundColor = .red
lazy var unvalidLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 13)
label.textColor = UIColor.failColor
label.text = "有效期未覆盖赴港日期,请核查文件"
return label
}()
lazy var certificateFrontView: YHCardUploadView = {
let view = YHCardUploadView(frame: .zero)
return view
}()
lazy var certificateBackView: YHCardUploadView = {
let view = YHCardUploadView(frame: .zero)
view.backgroundColor = .green
return view
}()
lazy var selectPanelContentView: UIView = {
let view = UIView()
view.backgroundColor = .yellow
return view
}()
......@@ -82,35 +117,124 @@ class YHTravelCertificateUploadCell: UITableViewCell {
}
func updateArr(_ arr: [YHItemModel]) {
func updateArr(_ arr: [YHCertificateDateItem]) {
selectPanelContentView.removeSubviews()
var lastItemView: YHItemView? = nil
var lastItemView: YHTravelCertificateItemView? = nil
for (index, item) in arr.enumerated() {
let itemView = YHItemView(frame: .zero)
itemView.dataSource = item
let itemView = YHTravelCertificateItemView(frame: .zero)
itemView.title = item.title
itemView.placeHolder = item.placeHolder
itemView.detail = item.value
itemView.isNeedShowErrorTips = item.isShowErrorTips
itemView.errorTips = item.errorTips
itemView.clickBlock = {
[weak self] in
guard let self = self else { return }
}
selectPanelContentView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(0)
make.right.equalTo(0)
if let lastView = lastItemView {
make.top.equalTo(lastView.snp.bottom)
} else {
make.top.equalTo(0)
}
if index == arr.count-1 {
make.bottom.equalTo(0)
}
}
lastItemView = itemView
}
}
func updateModel() {
func updateModel(_ model: YHTravelDocsPreparationDetailItemModel) {
dataModel = model
var title = ""
var frontTitle = ""
var backTitle = ""
var title: ASAttributedString = .init(string:"港澳通行证 (逗留D签注)" , .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor))
if model.type == 3 {
title = "港澳通行证 (逗留D签注)"
frontTitle = "港澳通行证正面"
backTitle = "港澳通行证反面"
}
// 标题设置
var titleStr: ASAttributedString = .init(string: title, .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor))
let mustTag: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 16)),.foreground(UIColor.failColor))
let template: ASAttributedString = " \(.view(templateButton, .original(.center)))"
var isMust = true
var isShowTemplate = true
let isMust = true
let isShowTemplate = true
if isMust {
title = mustTag + title
titleStr = mustTag + titleStr
}
if isShowTemplate {
title += template
}
titleView.attributed.text = titleStr
// 证件正反面标题
certificateFrontView.frontLabel.text = frontTitle
certificateBackView.frontLabel.text = backTitle
certificateFrontView.url = model.img_front
certificateBackView.url = model.img_back
// 是否有证件
let hasNoCertiInfo = model.img_front.isEmpty && model.img_back.isEmpty
// 需要显示被拒原因
let isShowReason = (model.isNeedShowRejectReason && !model.rejectReason.isEmpty)
rejectReasonLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(lineView.snp.bottom).offset(isShowReason ? 18 : 0)
make.bottom.equalTo(certificateFrontView.snp.top).offset(-18)
if !isShowReason {
make.height.equalTo(0)
}
}
let isShowCheck = (model.isNeedCheck && !model.checkTips.isEmpty)
unvalidLabel.snp.remakeConstraints { make in
make.top.equalTo(certificateFrontView.snp.bottom).offset(isShowCheck ? 8 : 0)
make.left.equalTo(18)
make.right.equalTo(-18)
if !isShowCheck {
make.height.equalTo(0)
}
}
selectPanelContentView.snp.remakeConstraints { make in
make.top.equalTo(unvalidLabel.snp.bottom).offset(isShowCheck ? 8 : 16)
make.bottom.equalTo(0)
make.left.equalTo(18)
make.right.equalTo(-10)
if !hasNoCertiInfo {
make.height.equalTo(0)
}
}
titleView.attributed.text = title
if hasNoCertiInfo {
updateArr([])
} else {
let item1 = YHCertificateDateItem(id: .signDate, title: "签发日期", value: model.issue_start, placeHolder: "请选择", errorTips: "请选择签发日期", isShowErrorTips: false)
let item2 = YHCertificateDateItem(id: .deadDate, title: "届满日期", value: model.issue_end, placeHolder: "请选择", errorTips: "请选择届满日期", isShowErrorTips: false)
let arr:[YHCertificateDateItem] = [item1, item2]
updateArr(arr)
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
......@@ -126,16 +250,18 @@ class YHTravelCertificateUploadCell: UITableViewCell {
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
contentView.addSubview(whiteConentView)
whiteConentView.addSubview(titleView)
whiteConentView.addSubview(lineView)
whiteConentView.addSubview(rejectReasonLabel)
whiteConentView.addSubview(certificateFrontView)
whiteConentView.addSubview(certificateBackView)
whiteConentView.addSubview(unvalidLabel)
whiteConentView.addSubview(selectPanelContentView)
updateModel()
whiteConentView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
......@@ -160,28 +286,38 @@ class YHTravelCertificateUploadCell: UITableViewCell {
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(lineView.snp.bottom).offset(18)
make.bottom.equalTo(certificateFrontView.snp.top).offset(-18)
}
certificateFrontView.titleHeight = 20.0
certificateFrontView.imgHeight = 90.0
certificateFrontView.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(certificateBackView.snp.left).offset(-10)
make.right.equalTo(certificateBackView.snp.left).offset(-2)
make.width.equalTo(certificateBackView.snp.width)
make.top.equalTo(rejectReasonLabel.snp.bottom).offset(18)
make.height.equalTo(122)
}
certificateBackView.titleHeight = 20.0
certificateBackView.imgHeight = 90.0
certificateBackView.snp.makeConstraints { make in
make.right.equalTo(-18)
make.top.equalTo(certificateFrontView)
make.height.equalTo(122)
}
selectPanelContentView.snp.makeConstraints { make in
unvalidLabel.snp.makeConstraints { make in
make.top.equalTo(certificateFrontView.snp.bottom).offset(8)
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(certificateFrontView.snp.bottom).offset(16)
}
selectPanelContentView.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-10)
make.top.equalTo(unvalidLabel.snp.bottom).offset(8)
make.bottom.equalTo(0)
make.height.equalTo(52.0*3.0)
}
}
}
......@@ -7,6 +7,7 @@
//
import UIKit
import AttributedString
class YHTravelDocsPreparationViewModel: YHBaseViewModel {
......@@ -102,3 +103,63 @@ extension YHTravelDocsPreparationViewModel {
}
}
extension YHTravelDocsPreparationViewModel {
func getTextWithType(type: Int) -> ASAttributedString {
if type == 0 {
return .init("上传《港澳通行证》(需有效期≥dd-mm-yyyy)", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
}
if type == 1 {
let a = ASAttributedString.init("办理逗留D签注", .font(UIFont.PFSC_R(ofSize:14)), .foreground(UIColor.mainTextColor(alpha: 0.5)))
let b = ASAttributedString.init("《港澳通行证逗留 (D) -办理操作指引》", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.brandMainColor))
let c = ASAttributedString.init("点击查看", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
return a+b+c
}
if type == 2 {
return .init("上传《护照》(需有效期≥签证时长+3个月)", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
}
if type == 3 {
return .init("上传《护照》(需有效期≥dd-mm-yyyy)", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
}
if type == 4 {
return .init("上传中国居留许可签证", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
}
return .init("", .font(UIFont.PFSC_R(ofSize:14)),.foreground(UIColor.mainTextColor(alpha: 0.5)))
}
func getTipsWithType(_ type: YHTravelDocsType) -> [ASAttributedString] {
if type == .HK {
return [self.getTextWithType(type: 0),
self.getTextWithType(type: 1)]
}
if type == .chinesePassPort {
return [self.getTextWithType(type: 2)]
}
if type == .forignPassPort {
return [self.getTextWithType(type: 3),
self.getTextWithType(type: 4)]
}
return []
}
func getCertificateDateSelectItemOfType(_ type: YHTravelDocsType) -> [YHCertificateDateItem] {
if type == .HK {
let item1 = YHCertificateDateItem(id: .signDate, title: "签发日期", value: "2018-07-31", placeHolder: "请选择", errorTips: "请选择签发日期", isShowErrorTips: false)
let item2 = YHCertificateDateItem(id: .deadDate, title: "届满日期", value: "", placeHolder: "请选择", errorTips: "请选择届满日期", isShowErrorTips: false)
return [item1, item2]
}
return []
}
}
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