Commit 2e7f589c authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  //  UI
  // 赴港办证
  收入证明
  // 赴港办证UI
parents fa8c112c 6e08dfc9
This diff is collapsed.
......@@ -116,9 +116,33 @@ extension YHAddAdoptersViewController: UITableViewDelegate, UITableViewDataSourc
return cell
} else if indexPath.row == 2 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterAddNewTableViewCell.self)
cell.newAdopterBlock = {[weak self] in
guard let self = self else { return }
let items = [YHCertificateEditItem(type:.rename, title:"新增配偶"),
YHCertificateEditItem(type:.preview, title:"新增子女"),
YHCertificateEditItem(type:.cancel, title:"取消")]
YHCertificateEditSheetView.sheetView(items:items) {
[weak self] editType in
guard let self = self else { return }
if editType == .rename {
}
if editType == .preview {
}
if editType == .delete {
}
}.show()
}
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterIncomeTableViewCell.self)
cell.clickBlock = { [weak self] index in
guard let self = self else { return }
let vc = YHAdopterIncomeDetailViewController()
self.navigationController?.pushViewController(vc)
}
return cell
}
......
//
// YHAdopterIncomeDetailViewController.swift
// galaxy
//
// Created by EDY on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAdopterIncomeDetailViewController: YHBaseViewController {
var tableView: UITableView!
var nextButton: UIButton!
var clickIndex = -1
var file: [YHWorkExperienceFileModel] = []
var viewModel = YHBaseViewModel()
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "上传存款证明"
setView()
getData()
}
func getData() {
tableView.reloadData()
}
func setView() {
tableView = {
let tableView = UITableView(frame:.zero, style:.plain)
tableView.contentInsetAdjustmentBehavior = .never
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHAdopterIncomeTitleTableViewCell.self)
tableView.register(cellWithClass: YHAdopterIncomeFileTableViewCell.self)
tableView.register(cellWithClass: YHAdopterUploadTableViewCell.self)
tableView.register(cellWithClass: YHAdopterIncomeFileCountTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 8)
make.bottom.left.right.equalTo(view)
}
nextButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandMainColor
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center
button.setTitle("确认", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius3
button.addTarget(self, action: #selector(nextStep), for: .touchUpInside)
return button
}()
view.addSubview(nextButton)
nextButton.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-8 - k_Height_safeAreaInsetsBottom())
make.height.equalTo(48)
}
}
@objc func nextStep() {
}
@objc func submit() {
}
func uploadImage(_ img: UIImage, imageName:String, callBack:((Bool, String)->())?) {
// 先OSS上传得到URL
self.viewModel.uploadImage(img) {
[weak self] url, error in
guard self != nil else { return }
if let url = url, !url.isEmpty {
callBack?(true, url)
return
}
callBack?(false, "")
}
}
func uploadFile(_ fileUrl:URL) {
if let fileData = try? Data(contentsOf: fileUrl) {
// 将文件数据上传到服务器
let size = String(format: "%.2fM", Double(fileData.count)/(1024.0 * 1024.0))
// print("\(size)")
// 先OSS上传得到URL
YHHUD.show(.progress(message: "上传中..."))
self.viewModel.uploadFile(fileUrl.absoluteString) {
[weak self] successUrl, error in
YHHUD.hide()
guard let self = self else { return }
// 再调用业务接口
if let successUrl = successUrl, !successUrl.isEmpty {
var fileName = fileUrl.lastPathComponent
if fileName.isEmpty {
fileName = successUrl.lastPathComponent
}
let suffixName = successUrl.pathExtension.lowercased()
let timestamp = Date().timeIntervalSince1970
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy.MM.dd HH:mm:ss"
let currentDate = Date()
let formattedDate = dateFormatter.string(from: currentDate)
let model = YHWorkExperienceFileModel()
model.fileUrl = successUrl
model.fileName = fileName
model.uploadedAt = formattedDate
self.file.append(model)
self.tableView.reloadData()
YHHUD.flash(message: "上传成功")
return
}
var msg = "上传文件失败"
if let errorMsg = error?.errorMsg, !errorMsg.isEmpty {
msg = errorMsg
}
YHHUD.flash(message: msg)
}
} else {
YHHUD.flash(message: "识别文件失败")
}
}
}
extension YHAdopterIncomeDetailViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 4
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterIncomeTitleTableViewCell.self)
return cell
}
if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterIncomeFileTableViewCell.self)
cell.dataSource = self.file
return cell
}
if indexPath.row == 2 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterUploadTableViewCell.self)
cell.newFileBlock = {[weak self] in
guard let self = self else { return }
let count = self.file.count
if count >= 10 {
YHHUD.flash(message: "最多上传10个图片或文件")
return
}
var maxCount = 10 - count
if maxCount > 9 {
maxCount = 9
}
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectImageCount = maxCount
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
guard let self = self else { return }
print(fileUrl)
uploadFile(fileUrl)
}
sheetView.uploadImageBlock = {
[weak self] imgArr in
guard let self = self else { return }
let group = DispatchGroup()
var successArr:[String] = []
var failArr:[YHSelectImageItem] = []
YHHUD.show(.progress(message: "上传中..."))
for item in imgArr {
if let image = item.data {
group.enter()
uploadImage(image, imageName:item.name) {
success, url in
if success {
successArr.append(url)
} else {
failArr.append(item)
}
group.leave()
}
}
}
// 等待所有任务完成
group.notify(queue: .main) {
YHHUD.hide()
// 所有任务完成,回到主线程继续执行
if imgArr.count == successArr.count {
YHHUD.flash(message: "上传成功")
for item in successArr {
let timestamp = Date().timeIntervalSince1970
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy.MM.dd HH:mm:ss"
let currentDate = Date()
let formattedDate = dateFormatter.string(from: currentDate)
let model = YHWorkExperienceFileModel()
model.fileUrl = item
model.fileName = "\(UInt64(timestamp))" + ".jpg"
model.uploadedAt = formattedDate
self.file.append(model)
}
self.tableView.reloadData()
} else {
YHHUD.flash(message: "\(successArr.count)张照片上传成功\n\(failArr.count)张照片上传失败")
}
}
}
sheetView.show()
}
return cell
}
if indexPath.row == 3 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterIncomeFileCountTableViewCell.self)
return cell
}
return UITableViewCell()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 0 {
return 119
}
if indexPath.row == 1 {
let count = self.file.count
if count == 0 {
return 0
} else {
return CGFloat(55 * count + 16)
}
}
if indexPath.row == 2 {
return 71
}
return 45
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
}
......@@ -11,11 +11,11 @@ import UIKit
class YHAdopterAddNewTableViewCell: UITableViewCell {
typealias ExperienceListBlock = (_ model: YHWorkItemListModel) -> ()
typealias IsMoreBlock = (_ isMore: Bool) -> ()
typealias NewWorkBlock = () -> ()
typealias NewAdopterBlock = () -> ()
var clickBlock: ExperienceListBlock?
var deleteBlock: ExperienceListBlock?
var isMoreBlock: IsMoreBlock?
var newWorkBlock: NewWorkBlock?
var newAdopterBlock: NewAdopterBlock?
var centerView: UIView!
var titleLabel: UILabel!
var cannalButton: UIButton!
......@@ -143,7 +143,7 @@ class YHAdopterAddNewTableViewCell: UITableViewCell {
view.addBtn.setTitle("新增受养人".local, for: .normal)
view.clickBlock = {[weak self] in
guard let self = self else { return }
if let block = self.newWorkBlock {
if let block = self.newAdopterBlock {
block()
}
}
......
//
// YHAdopterIncomeFileCountTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHAdopterIncomeFileCountTableViewCell: UITableViewCell {
var alertLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
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() {
backgroundColor = .clear
alertLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.mainTextColor50
label.textAlignment = .center
label.numberOfLines = 0
let a: ASAttributedString = .init("已上传 ", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.labelTextColor2))
let b: ASAttributedString = .init(" 0/10", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor(hex: 0x222222)))
let c: ASAttributedString = .init(" 张图片或文件", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.labelTextColor2))
label.attributed.text = a + b + c
return label
}()
contentView.addSubview(alertLabel)
alertLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.bottom.equalTo(0)
make.right.equalTo(-18)
}
}
}
//
// YHAdopterIncomeFileTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAdopterIncomeFileTableViewCell: UITableViewCell {
typealias ExperienceListBlock = (_ model: YHWorkExperienceFileModel, _ type: YHWorkFileClickType) -> ()
typealias AddIntroductionBlock = () -> ()
var experienceListBlock: ExperienceListBlock?
var selectIntroductionBlock: AddIntroductionBlock?
var mainItemView: UIView!
var dataSource: [YHWorkExperienceFileModel]?{
didSet {
updateAllViews()
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
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() {
backgroundColor = .clear
mainItemView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
contentView.addSubview(mainItemView)
mainItemView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview()
make.top.equalTo(16)
}
}
func updateAllViews() {
mainItemView.removeSubviews()
for i in 0 ..< (dataSource?.count ?? 0) {
let itemView = YHWorkFileItemView()
itemView.backgroundColor = UIColor.pageBkgColor
itemView.dataSource = dataSource?[i]
itemView.block = {[weak self] model, type in
guard let self = self else { return }
if let block = self.experienceListBlock {
block(model, type)
}
}
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(55 * i)
make.height.equalTo(55)
}
}
}
}
//
// YHAdopterIncomeTitleTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAdopterIncomeTitleTableViewCell: UITableViewCell {
var titleLabel: UILabel!
var subTitleLabel: UILabel!
var alertLabel: UILabel!
var failLabel: UILabel!
var failImageView: UIImageView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
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() {
backgroundColor = .clear
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 17)
label.textColor = UIColor.mainTextColor
label.text = "存款证明"
return label
}()
contentView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(16)
make.height.equalTo(24)
}
subTitleLabel = {
let label = UILabel()
label.text = "已完成"
label.font = UIFont.PFSC_R(ofSize: 10)
label.textColor = UIColor(hex: 0x3cc694)
label.backgroundColor = UIColor(hex: 0xf0fbf7)
//带上传
// label.textColor = UIColor.brandMainColor
// label.backgroundColor = UIColor(hex: 0xf0f4fb)
//审核中
// label.textColor = UIColor(hex: 0xff8000)
// label.backgroundColor = UIColor(hex: 0xfff5eb)
//已驳回
// label.textColor = UIColor(hex: 0xf81d22)
// label.backgroundColor = UIColor(hex: 0xfff2f2)
return label
}()
contentView.addSubview(subTitleLabel)
subTitleLabel.snp.makeConstraints { make in
make.left.equalTo(titleLabel.snp.right).offset(4)
make.width.equalTo(38)
make.height.equalTo(16)
make.centerY.equalTo(titleLabel.snp.centerY)
}
alertLabel = {
let label = UILabel()
label.text = "存款证明有效期为3个月,并且存款金额为每个成员(包括额外新增受养人)最低为12万"
label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = UIColor.mainTextColor50
label.numberOfLines = 0
return label
}()
contentView.addSubview(alertLabel)
alertLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(46)
make.right.equalTo(-18)
}
failLabel = {
let label = UILabel()
label.text = "驳回原因:存款证明钱不够"
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor(hex: 0xf81d22)
return label
}()
contentView.addSubview(failLabel)
failLabel.snp.makeConstraints { make in
make.left.equalTo(36)
make.bottom.equalTo(0)
make.height.equalTo(17)
make.right.equalToSuperview()
}
failImageView = {
let view = UIImageView()
view.image = UIImage(named: "service_adopter_income_fail")
return view
}()
contentView.addSubview(failImageView)
failImageView.snp.makeConstraints { make in
make.left.equalTo(20)
make.width.height.equalTo(12)
make.centerY.equalTo(failLabel.snp.centerY)
}
}
}
//
// YHAdopterUploadTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAdopterUploadTableViewCell: UITableViewCell {
typealias NewFileBlock = () -> ()
var newFileBlock: NewFileBlock?
var bottomView: YHWorkItemAddView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
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() {
backgroundColor = .clear
bottomView = {
let view = YHWorkItemAddView()
view.addBtn.setTitle("上传".local, for: .normal)
view.clickBlock = {[weak self] in
guard let self = self else { return }
if let block = self.newFileBlock {
block()
}
}
return view
}()
contentView.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.right.equalTo(-18)
make.left.equalTo(18)
make.height.equalTo(45)
make.bottom.equalToSuperview()
}
}
}
......@@ -10,7 +10,9 @@ import UIKit
class YHCertificateAppointViewController: YHBaseViewController {
var items = ["", ""]
var items = ["", "", ""]
let viewModel = YHCerAppointViewModel()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionHeaderHeight = 16.0
......@@ -21,9 +23,11 @@ class YHCertificateAppointViewController: YHBaseViewController {
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = UIColor(hex: 0xF8F9FB)
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHCertificateAppointOptionCell.self, forCellReuseIdentifier: YHCertificateAppointOptionCell.cellReuseIdentifier)
tableView.register(YHSelectApplicantGroupCell.self, forCellReuseIdentifier: YHSelectApplicantGroupCell.cellReuseIdentifier)
tableView.register(YHGrabNumberListCell.self, forCellReuseIdentifier: YHGrabNumberListCell.cellReuseIdentifier)
return tableView
}()
......@@ -60,8 +64,13 @@ extension YHCertificateAppointViewController: UITableViewDelegate, UITableViewDa
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHSelectApplicantGroupCell.cellReuseIdentifier, for: indexPath) as! YHSelectApplicantGroupCell
if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHSelectApplicantGroupCell.cellReuseIdentifier, for: indexPath) as! YHSelectApplicantGroupCell
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: YHGrabNumberListCell.cellReuseIdentifier, for: indexPath) as! YHGrabNumberListCell
return cell
}
......@@ -71,6 +80,16 @@ extension YHCertificateAppointViewController: UITableViewDelegate, UITableViewDa
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.viewModel.getServicelist { success, error in
let view = YHServiceSelectAlertView.alertView()
view.items = self.viewModel.serviceArr
view.confirmBlock = {
[weak self] ids in
printLog("\(ids)")
}
view.show()
}
if 0 <= indexPath.section && indexPath.section < items.count {
}
......
//
// YHGrabFileCell.swift
// galaxy
//
// Created by edy on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHGrabFileCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHGrabFileCell"
lazy var selectImgView:UIImageView = {
let view = UIImageView(image: UIImage(named: ""))
return view
}()
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func createUI() {
self.layer.cornerRadius = 5.0
self.layer.borderWidth = 0.5
self.layer.borderColor = UIColor.init(hex: 0xD8D8D8).cgColor
}
}
//
// YHGrabNumberInfoView.swift
// galaxy
//
// Created by edy on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHGrabItemViewType: Int {
case info
case grab
case files
}
class YHGrabItem {
var type: YHGrabItemViewType = .info
var title: String = ""
var detail: String = ""
var files:[String] = []
required init() {
}
init(type: YHGrabItemViewType, title: String, detail: String, files:[String] = []) {
self.type = type
self.title = title
self.detail = detail
self.files = files
}
}
class YHGrabNumberInfoItemView: UIView {
let dotWidth = 4.0
let titleMaxWidth = 112.0
let grabNumColor = UIColor.brandMainColor
let infoColor = UIColor.mainTextColor
let gap = 8.0
let fileWidth = floorl((KScreenWidth-48.0*2.0-8.0*3.0)/4.0)
var item: YHGrabItem = YHGrabItem()
lazy var collectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .vertical
layout.minimumInteritemSpacing = 8.0
layout.minimumLineSpacing = 16
let collectView = UICollectionView(frame:.zero, collectionViewLayout: layout)
collectView.delegate = self
collectView.dataSource = self
collectView.backgroundColor = .clear
// 注册自定义单元格
collectView.register(YHGrabFileCell.self, forCellWithReuseIdentifier: YHGrabFileCell.cellReuseIdentifier)
return collectView
}()
func updateItem(_ item: YHGrabItem) {
self.item = item
titleLabel.text = item.title
detailLabel.text = item.detail
if item.type == .grab {
detailLabel.textColor = grabNumColor
} else {
detailLabel.textColor = infoColor
}
dotView.isHidden = (item.type != .grab)
collectionView.isHidden = item.type != .files
collectionView.reloadData()
var rowCount = item.files.count/4
if item.files.count%4 != 0 {
rowCount += 1
}
collectionView.snp.remakeConstraints { make in
make.left.right.bottom.equalTo(0)
make.top.equalTo(detailLabel.snp.bottom).offset(16)
if item.type == .files {
make.height.equalTo((fileWidth+16.0)*Double(rowCount))
} else {
make.height.equalTo(0)
}
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
lazy var dotView: UIView = {
let view = UIView()
view.backgroundColor = .brandMainColor
view.layer.cornerRadius = self.dotWidth/2.0
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = .mainTextColor(alpha: 0.5)
return label
}()
lazy var detailLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.textAlignment = .right
label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = self.infoColor
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func createUI() {
self.addSubview(titleLabel)
self.addSubview(detailLabel)
self.addSubview(dotView)
self.addSubview(collectionView)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(0)
make.top.equalTo(0)
make.width.equalTo(titleMaxWidth)
}
detailLabel.snp.makeConstraints { make in
make.right.equalTo(0)
make.top.equalTo(0)
make.height.greaterThanOrEqualTo(20.0)
}
dotView.snp.makeConstraints { make in
make.width.height.equalTo(dotWidth)
make.centerY.equalTo(detailLabel)
make.right.equalTo(detailLabel.snp.left).offset(-4)
make.left.greaterThanOrEqualTo(titleLabel.snp.right).offset(0)
}
collectionView.snp.makeConstraints { make in
make.left.right.equalTo(0)
make.top.equalTo(detailLabel.snp.bottom).offset(16)
make.height.equalTo(fileWidth)
make.bottom.equalTo(0)
}
}
}
class YHGrabNumberInfoView: UIView {
var items:[YHGrabItem] = []
lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = .mainTextColor
return label
}()
lazy var lineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func createUI() {
self.backgroundColor = UIColor.init(hex: 0xF8F9FB)
self.layer.cornerRadius = kCornerRadius4
self.clipsToBounds = true
self.addSubview(titleLabel)
self.addSubview(lineView)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(14)
make.top.equalTo(16)
}
lineView.snp.makeConstraints { make in
make.left.equalTo(14)
make.right.equalTo(-14)
make.height.equalTo(0.5)
make.top.equalTo(titleLabel.snp.bottom).offset(10)
}
}
func updateItems(_ items: [YHGrabItem]) {
self.items = items
var lastView: YHGrabNumberInfoItemView? = nil
for (index, item) in items.enumerated() {
let itemView = YHGrabNumberInfoItemView(frame: .zero)
self.addSubview(itemView)
itemView.updateItem(item)
itemView.snp.makeConstraints { make in
make.left.equalTo(14)
make.right.equalTo(-14)
if let last = lastView {
make.top.equalTo(last.snp.bottom).offset(0)
} else {
make.top.equalTo(lineView.snp.bottom).offset(12)
}
if index == items.count-1 {
make.bottom.equalTo(0)
}
}
lastView = itemView
}
}
}
extension YHGrabNumberInfoItemView: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
// 返回单元格数量
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return item.files.count
}
// 返回每个单元格的大小
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: fileWidth, height: fileWidth)
}
// 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHGrabFileCell.cellReuseIdentifier, for: indexPath) as! YHGrabFileCell
if 0 <= indexPath.item && indexPath.item < item.files.count {
let applicant = item.files[indexPath.item]
}
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if 0 <= indexPath.item && indexPath.item < item.files.count {
let text = item.files[indexPath.item]
}
}
}
//
// YHGrabNumberListCell.swift
// galaxy
//
// Created by edy on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHGrabNumberListCell: UITableViewCell {
static let cellReuseIdentifier = "YHGrabNumberListCell"
var items:[String] = ["", ""]
lazy var whiteContentView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
lazy var lineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.textColor = .mainTextColor
label.font = UIFont.PFSC_M(ofSize: 17)
label.text = "赴港办理抢号中批次"
return label
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
contentView.addSubview(whiteContentView)
whiteContentView.addSubview(titleLabel)
whiteContentView.addSubview(lineView)
whiteContentView.snp.makeConstraints { make in
make.top.equalTo(16)
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(0)
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(18)
make.left.equalTo(18)
make.right.equalTo(-18)
}
lineView.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(12)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
var lastView: YHGrabNumberListView? = nil
for (index, _) in items.enumerated() {
let listView = YHGrabNumberListView(frame: .zero)
let chineseNum = convertNumberToChineseText(index+1)
listView.titleLabel.text = "第\(chineseNum)批"
listView.membersLabel.text = "成员:刘德华德成员:刘德华德、刘德华德、刘德华德、刘德华德、刘德华德、刘德华德、刘德华德、刘德华德、刘德华德"
whiteContentView.addSubview(listView)
listView.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
if let last = lastView {
make.top.equalTo(last.snp.bottom)
} else {
make.top.equalTo(lineView.snp.bottom)
}
if index == items.count-1 {
make.bottom.equalTo(-16)
}
}
lastView = listView
}
}
//阿拉伯数字转文字
func convertNumberToChineseText(_ number: Int) -> String {
let numberFormatter = NumberFormatter()
numberFormatter.locale = Locale(identifier: "zh_CN")
numberFormatter.numberStyle = .spellOut
return numberFormatter.string(from: NSNumber(value: number)) ?? ""
}
}
//
// YHGrabNumberListView.swift
// galaxy
//
// Created by edy on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHGrabNumberListView: UIView {
lazy var lineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
lazy var markView:UIView = {
let view = UIView()
view.backgroundColor = .brandMainColor
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 16)
label.textColor = .mainTextColor
return label
}()
lazy var cancelAppointBtn: UIButton = {
let btn = UIButton()
btn.backgroundColor = .white
btn.titleLabel?.font = .PFSC_M(ofSize: 12)
btn.setTitle("取消预约", for: .normal)
btn.setTitleColor(.brandMainColor, for: .normal)
btn.layer.cornerRadius = kCornerRadius3
btn.layer.borderWidth = 1.0
btn.layer.borderColor = UIColor.brandMainColor.cgColor
return btn
}()
lazy var membersLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14)
label.text = "成员:"
label.textColor = .mainTextColor(alpha: 0.7)
return label
}()
lazy var grabInfoView: YHGrabNumberInfoView = {
let view = YHGrabNumberInfoView(frame: .zero)
view.titleLabel.text = "抢号信息"
let items = [YHGrabItem(type: .grab, title: "赴港时间:", detail: "抢号中"),
YHGrabItem(type: .grab, title: "香港入境处:", detail: "抢号中"),
YHGrabItem(type: .grab, title: "抢号反馈回执:", detail: "抢号中"),]
view.updateItems(items)
return view
}()
lazy var intentionInfoView: UIView = {
let view = YHGrabNumberInfoView(frame: .zero)
view.titleLabel.text = "意向信息"
let items = [YHGrabItem(type: .info, title: "期望赴港时间:", detail: "2023-07-17 ~ 2023-08-22"),
YHGrabItem(type: .info, title: "期望香港办证点:", detail: "屯门办事处(屯门)"),
YHGrabItem(type: .files, title: "抢号反馈回执:", detail: "", files: ["","","","",""]),]
view.updateItems(items)
return view
}()
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func createUI() {
self.addSubview(lineView)
self.addSubview(markView)
self.addSubview(titleLabel)
self.addSubview(cancelAppointBtn)
self.addSubview(membersLabel)
self.addSubview(grabInfoView)
self.addSubview(intentionInfoView)
lineView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(0.5)
}
cancelAppointBtn.snp.makeConstraints { make in
make.top.equalTo(12)
make.right.equalTo(-18)
make.size.equalTo(CGSizeMake(70, 32))
}
markView.snp.makeConstraints { make in
make.size.equalTo(CGSizeMake(3, 14))
make.left.equalTo(0)
make.centerY.equalTo(cancelAppointBtn)
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(markView.snp.right).offset(6)
make.height.equalTo(22)
make.centerY.equalTo(cancelAppointBtn)
}
membersLabel.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(titleLabel.snp.bottom).offset(12)
}
grabInfoView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(membersLabel.snp.bottom).offset(16)
// make.height.equalTo(166)
}
intentionInfoView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(grabInfoView.snp.bottom).offset(16)
// make.height.equalTo(130)
make.bottom.equalTo(-16)
}
}
}
//
// YHServiceItemCell.swift
// galaxy
//
// Created by edy on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHServiceItemCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHServiceItemCell"
lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 13)
label.textColor = .mainTextColor
label.textAlignment = .center
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func updateItem(_ item: YHServiceItem) {
titleLabel.text = item.name
if item.isSelect {
self.layer.borderWidth = 1.0
self.layer.borderColor = UIColor.brandMainColor.cgColor
titleLabel.textColor = UIColor.brandMainColor
} else {
self.layer.borderWidth = 0.0
self.layer.borderColor = nil
titleLabel.textColor = UIColor.mainTextColor
}
}
func createUI() {
self.layer.cornerRadius = kCornerRadius3
self.backgroundColor = UIColor.init(hex: 0xF4F6FA)
self.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
}
}
//
// YHServiceSelectAlertView.swift
// galaxy
//
// Created by edy on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
import SmartCodable
class YHServiceItem: SmartCodable {
var id: Int = 0
var name: String = ""
var isSelect: Bool = false
required init() {
}
init(id: Int = 0, name: String = "") {
self.id = id
self.name = name
}
}
class YHServiceSelectAlertView: UICollectionViewCell {
var items:[YHServiceItem] = [] {
didSet {
var rowCount = items.count/3
if items.count%3 != 0 {
rowCount += 1
}
var height = 0.0
if rowCount > 0 {
height = 42.0 * Double(rowCount) + 16.0 * Double(rowCount-1)
}
collectionView.reloadData()
collectionView.snp.updateConstraints { make in
make.height.equalTo(height)
}
}
}
var confirmBlock:(([Int])->())?
// 底层蒙版
lazy var blackMaskView: UIView = {
let view = UIView()
view.backgroundColor = .alertMaskColor
return view
}()
lazy var whiteContentView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
lazy var bgImgView: UIView = {
let view = UIImageView(image: UIImage(named: "service_list_bg"))
return view
}()
lazy var iconImgView: UIView = {
let view = UIImageView(image: UIImage(named: "service_list_icon"))
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
let a: ASAttributedString = .init("期望银河在", .font(UIFont.PFSC_B(ofSize: 18)),.foreground(UIColor.mainTextColor))
let b: ASAttributedString = .init("办证阶段", .font(UIFont.PFSC_B(ofSize: 18)),.foreground(UIColor.brandMainColor))
let c: ASAttributedString = .init("\n提供哪些服务", .font(UIFont.PFSC_B(ofSize: 18)),.foreground(UIColor.mainTextColor))
label.attributed.text = a+b+c
return label
}()
lazy var collectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .vertical
layout.minimumInteritemSpacing = 8.0
layout.minimumLineSpacing = 16
let collectView = UICollectionView(frame:.zero, collectionViewLayout: layout)
collectView.delegate = self
collectView.dataSource = self
collectView.backgroundColor = .clear
// 注册自定义单元格
collectView.register(YHServiceItemCell.self, forCellWithReuseIdentifier: YHServiceItemCell.cellReuseIdentifier)
return collectView
}()
lazy var confirmBtn: UIButton = {
let btn = UIButton()
btn.backgroundColor = .brandMainColor
btn.titleLabel?.font = .PFSC_M(ofSize: 14)
btn.setTitle("确认", for: .normal)
btn.setTitleColor(.white, for: .normal)
btn.layer.cornerRadius = kCornerRadius3
btn.addTarget(self, action: #selector(didConfirmBtnClicked), for: .touchUpInside)
return btn
}()
lazy var closeBtn:UIButton = {
let btn = UIButton()
btn.setImage(UIImage(named: "update_close"), for: .normal)
btn.addTarget(self, action: #selector(didCloseBtnClicked), for: .touchUpInside)
return btn
}()
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
}
func createUI() {
self.addSubview(blackMaskView)
self.addSubview(whiteContentView)
self.addSubview(closeBtn)
whiteContentView.addSubview(bgImgView)
whiteContentView.addSubview(iconImgView)
whiteContentView.addSubview(titleLabel)
whiteContentView.addSubview(confirmBtn)
whiteContentView.addSubview(collectionView)
whiteContentView.addSubview(confirmBtn)
blackMaskView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
whiteContentView.snp.makeConstraints { make in
make.left.equalTo(38)
make.right.equalTo(-38)
make.centerX.equalToSuperview()
make.centerY.equalToSuperview().offset(-24)
}
bgImgView.snp.makeConstraints { make in
make.left.right.top.equalTo(0)
make.height.equalTo(153)
}
iconImgView.snp.makeConstraints { make in
make.width.equalTo(102)
make.height.equalTo(84)
make.top.equalTo(16)
make.right.equalTo(-16)
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(34)
make.left.equalTo(18)
make.right.equalTo(iconImgView.snp.left)
}
collectionView.snp.makeConstraints { make in
make.top.equalTo(iconImgView.snp.bottom).offset(20)
make.left.equalTo(16)
make.right.equalTo(-16)
make.height.equalTo(0)
make.bottom.equalTo(confirmBtn.snp.top).offset(-30)
}
confirmBtn.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-16)
make.height.equalTo(45)
}
closeBtn.snp.makeConstraints { make in
make.width.height.equalTo(24)
make.top.equalTo(whiteContentView.snp.bottom).offset(24)
make.centerX.equalTo(whiteContentView)
}
}
static func alertView() -> YHServiceSelectAlertView {
let alertView = YHServiceSelectAlertView(frame:UIScreen.main.bounds)
return alertView
}
@objc func show() {
UIApplication.shared.yhKeyWindow()?.addSubview(self)
}
@objc func dismiss() {
self.removeFromSuperview()
}
@objc func didConfirmBtnClicked() {
var ids = [Int]()
for item in items {
if item.isSelect {
ids.append(item.id)
}
}
confirmBlock?(ids)
dismiss()
}
@objc func didCloseBtnClicked() {
dismiss()
}
}
extension YHServiceSelectAlertView: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
// 返回单元格数量
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return items.count
}
// 返回每个单元格的大小
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let width = floorl((KScreenWidth-54.0*2.0-10.0*2.0)/3.0)
return CGSize(width: width, height: 42)
}
// 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHServiceItemCell.cellReuseIdentifier, for: indexPath) as! YHServiceItemCell
if 0 <= indexPath.item && indexPath.item < items.count {
let item = items[indexPath.item]
cell.updateItem(item)
}
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if 0 <= indexPath.item && indexPath.item < items.count {
let item = items[indexPath.item]
item.isSelect = !item.isSelect
collectionView.reloadData()
}
}
}
//
// YHCerAppointViewModel.swift
// galaxy
//
// Created by edy on 2024/8/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCerAppointViewModel: NSObject {
var serviceArr:[YHServiceItem] = []
func getServicelist(_ callBack: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.MakeCertificate.servicelist
let _ = YHNetRequest.getRequest(url: strUrl) {
[weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog(json)
if json.code == 200 {
let dic = json.data
guard let list = [YHServiceItem].deserialize(array: dic as? [Any]) else {
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
self.serviceArr = []
callBack(false, err)
return
}
self.serviceArr.removeAll()
for item in list {
if let item = item {
self.serviceArr.append(item)
}
}
callBack(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
self.serviceArr = []
callBack(false, error)
}
} failBlock: { err in
self.serviceArr = []
callBack(false, err)
}
}
}
......@@ -19,5 +19,6 @@ class YHFileListModel: SmartCodable {
var arrTxt : [String] = [] //type=1时使用的内容
required init() {
}
}
......@@ -341,6 +341,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
}
if true {
// test dy
let vc = YHCertificateAppointViewController()
self.navigationController?.pushViewController(vc)
return
......
......@@ -403,4 +403,10 @@ class YHAllApiName {
static let sendMail = "infoflow/file/send-mail"
}
struct MakeCertificate {
// 获取香港服务列表
static let servicelist = "super-app/order/customer/journey/journey-service"
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Mask group@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Mask group@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 2033195689@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 2033195689@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "service_adopter_income_fail@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "service_adopter_income_fail@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