Commit 3e6a60c5 authored by Steven杜宇's avatar Steven杜宇

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

parents 1e41fe20 632ca7b1
This diff is collapsed.
//
// YHPaddedLabel.swift
// galaxy
//
// Created by alexzzw on 2024/9/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHPaddedLabel: UILabel {
var padding: UIEdgeInsets
init(padding: UIEdgeInsets) {
self.padding = padding
super.init(frame: .zero)
}
required init?(coder: NSCoder) {
self.padding = UIEdgeInsets(top: 0, left: 4, bottom: 0, right: 4)
super.init(coder: coder)
}
override func drawText(in rect: CGRect) {
let insetRect = rect.inset(by: padding)
super.drawText(in: insetRect)
}
override var intrinsicContentSize: CGSize {
let size = super.intrinsicContentSize
return CGSize(width: size.width + padding.left + padding.right,
height: size.height + padding.top + padding.bottom)
}
}
......@@ -23,6 +23,7 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController {
var urls: [String] = [""]
var data: [YHItemModel] = []
var isShowPrompt = false
var failString: String = ""
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
......@@ -129,6 +130,8 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController {
@objc func didSaveBtnClicked() {
if !checkInfo() {
isShowPrompt = true
updateData()
return
}
......@@ -136,81 +139,17 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController {
}
func checkInfo() -> Bool {
var errorItemCount = 0
// if item.type == .certificate {
// var hasSubmitError = false
// var isDateValidate = true
// item.cerDetailModel.isNeedCheckCer = false
// item.cerDetailModel.isNeedCheckDate = false
//
// if item.cerDetailModel.isOCR_failed {
// // 无法识别不能当做无法提交的错误 所以 此处 hasError 不必设置为true
// item.cerDetailModel.isNeedCheckCer = true
// item.cerDetailModel.checkTips = "无法识别,请核查文件"
//
// } else {
// var noCerInfo = false
// if item.cerDetailModel.type == 3 { // 只有港澳通行证有正反面
// noCerInfo = (item.cerDetailModel.img_front.isEmpty || item.cerDetailModel.img_back.isEmpty)
// } else {
// noCerInfo = item.cerDetailModel.img_front.isEmpty
// }
//
// if noCerInfo {
// hasSubmitError = true
// item.cerDetailModel.isNeedCheckCer = true
// if item.cerDetailModel.type == 3 { // 港澳通行证
// item.cerDetailModel.checkTips = item.cerDetailModel.img_front.isEmpty ? "请上传港澳通行证正面" : "请上传港澳通行证反面"
//
// } else if item.cerDetailModel.type == 1 { // 中国护照
// item.cerDetailModel.checkTips = "请上传护照"
//
// } else if item.cerDetailModel.type == 2 { // 中国居留许可签证
// item.cerDetailModel.checkTips = "请上传中国居留许可签证"
// }
//
// } else {
// item.cerDetailModel.isNeedCheckDate = false
// if item.cerDetailModel.issue_start.isEmpty || item.cerDetailModel.issue_end.isEmpty {
// hasSubmitError = true
// item.cerDetailModel.isNeedCheckDate = true
//
// } else {
// let isValidCertificate = item.cerDetailModel.isValidCer()
// if !isValidCertificate {
// if item.cerDetailModel.type == 2, item.cerDetailModel.china_travel_latest_validaty_date.isEmpty {
// // 这个情况直接弹toast
// hasSubmitError = true
// YHHUD.flash(message: "赴港行程尚未成功预约,请前往检查")
//
// } else {
// // 有效期不足也能提交
// isDateValidate = false
// item.cerDetailModel.isNeedCheckCer = true
// let deadDate: String = (item.cerDetailModel.type == 2 ? item.cerDetailModel.china_travel_latest_validaty_date : item.cerDetailModel.latest_validaty_date)
// item.cerDetailModel.checkTips = "有效期不足,需要为\(deadDate)或以后"
// }
// }
// }
// }
// }
// if !hasSubmitError {
// // 无法识别或有效期不足也要可以提交
// if !item.cerDetailModel.isOCR_failed && isDateValidate {
// item.cerDetailModel.isNeedCheckCer = false
// item.cerDetailModel.isNeedCheckDate = false
// }
//
// } else {
// errorItemCount += 1
// }
// }
self.tableView.reloadData()
if urls.first?.count == 0 {
failString = "请上传护照"
return false
}
if self.viewModel.dataModel.cert_info.issue_start.count == 0 {
return false
}
if self.viewModel.dataModel.cert_info.issue_end.count == 0 {
return false
}
return true
}
}
......@@ -219,31 +158,30 @@ class YHResignCertificateDetailPassPortViewController: YHBaseViewController {
private extension YHResignCertificateDetailPassPortViewController {
//1、获取详情信息
func loadDetailInfo() {
// 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 {
//
// }
// }
self.updateData()
}
//2、保存旅行证件
func saveAllTravelCertificate() {
let passPort: [String: Any] = ["name": "护照",
"issue_start": self.viewModel.dataModel.cert_info.issue_start,
"issue_end": self.viewModel.dataModel.cert_info.issue_end,
"img_front": urls[0]]
let params : [String : Any] = [
"passPort": passPort,
"id": dataModel.id
]
viewModel.submitResignCertificateUpdate(params) { success, error in
if success {
YHHUD.flash(message: "保存成功")
self.navigationController?.popViewController()
} else {
let msg = error?.errorMsg ?? "保存失败,请重试"
YHHUD.flash(message: msg)
}
}
}
}
......@@ -269,19 +207,18 @@ extension YHResignCertificateDetailPassPortViewController: UITableViewDelegate,
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignCertificatePassportTableViewCell.cellReuseIdentifier, for: indexPath) as! YHResignCertificatePassportTableViewCell
cell.firstImageName = "service_adopter_card_china_travel_front"
cell.firstLabelName = "护照资料页"
cell.failString = failString
cell.urls = urls
cell.data = data
cell.dataModel = dataModel
cell.urlBlock = { [weak self] url, index in
guard let self = self else { return }
self.urls[index] = url
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
// self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in
// guard let self = self else { return }
// self.data = viewModel.getBaseDataSource(isShowPrompt)
// self.tableView.reloadData()
// }
self.data = viewModel.getPassPortDataSource(isShowPrompt)
self.tableView.reloadData()
}
}
cell.deleteBlock = { [weak self] url, index in
......@@ -290,12 +227,7 @@ extension YHResignCertificateDetailPassPortViewController: UITableViewDelegate,
}
cell.block = {[weak self] model in
guard let self = self else { return }
// self.viewModel.updateModel(model)
// let id = model.id
// if id != .id2 && id != .id3 && id != .id4 {
// self.data = viewModel.getBaseDataSource(isShowPrompt)
// self.tableView.reloadData()
// }
self.viewModel.updateModel(model)
}
return cell
}
......
......@@ -30,6 +30,12 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
var viewModel: YHBaseViewModel = YHBaseViewModel()
var firstUrl: String = ""
var lastUrl: String = ""
var dataModel: YHResignCertificateModel = YHResignCertificateModel()
var failString: String = "" {
didSet {
showMessageLabel.text = failString
}
}
var firstImageName: String = "" {
didSet {
frontImageButton.setBackgroundImage(UIImage(named: firstImageName), for: .normal)
......@@ -140,7 +146,6 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
titleLabel = {
let label = UILabel()
// label.font = UIFont.PFSC_M(ofSize: 17)
let str = "* " + "港澳通行证 (逗留D签注)"
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_M(ofSize: 17),
......@@ -150,7 +155,6 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
let starRange = NSRange(location: 0, length: 2)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
label.attributedText = questionAttrStr
// label.textColor = UIColor.mainTextColor
return label
}()
centerView.addSubview(titleLabel)
......@@ -307,6 +311,11 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
guard let self = self else { return }
if let block = self.block {
block(model)
if self.compareDates(dateString1: model.message ?? "", dateString2: self.dataModel.valid_date) {
} else {
failString = "有效期不足,需要为\(self.dataModel.valid_date)或以后"
}
}
}
centerView.addSubview(cardEndView)
......@@ -358,4 +367,18 @@ class YHResignCertificatePassportTableViewCell: UITableViewCell {
}
}
func compareDates(dateString1: String, dateString2: String) -> Bool {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
guard let date1 = dateFormatter.date(from: dateString1),
let date2 = dateFormatter.date(from: dateString2) else {
return false
}
if date1 < date2 {
return false
}
return true
}
}
......@@ -42,4 +42,20 @@ class YHResignCertificateDetailViewModel: YHBaseViewModel {
let item2 = YHItemModel(id: .id2, isNeed: true, title: "到期时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_end, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择到期时间")
return [item1, item2]
}
func updateModel(_ item: YHItemModel) {
guard let type = item.id else { return }
switch type {
case .id1:
dataModel.cert_info.issue_start = item.message ?? ""
case .id2:
dataModel.cert_info.issue_end = item.message ?? ""
case .id3:
dataModel.cert_info.issue_start = item.message ?? ""
case .id4:
dataModel.cert_info.issue_end = item.message ?? ""
default:
break
}
}
}
//
// YHResignDocumentDetailViewController.swift
// galaxy
//
// Created by alexzzw on 2024/9/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResignDocumentDetailViewController: YHBaseViewController {
private var editEvent: (() -> Void)?
private var submitEvent: (() -> Void)?
private var signatureConfirmationEvent: (() -> Void)?
private var previewEvent: (() -> Void)?
private var infoConfirmationEvent: (() -> Void)?
enum RowType {
case tips(_ title: String, _ detail: NSAttributedString)
case content(_ title: String, _ fileName: String, _ status: YHResignDocumentStatus, _ config: YHResignDocumentStatusCell.ButtonsConfig)
}
private var datas: [[RowType]] {
let normalText = "请主申请人完成电子签字请您尽快核对信息,如信息有误,可进行在线编辑如信息无误,"
let attText = "请您在右下角的位置完成电子签字"
let attStr = NSMutableAttributedString(string: normalText + attText)
attStr.setAttributes([.foregroundColor: UIColor.brandMainColor], range: NSRange(location: normalText.count, length: attText.count))
let config = getStatusButtonsConfig(docType: docType, status: status)
let firstSetcion: [RowType] = [.tips("​填写指引", attStr)]
let secondSetcion: [RowType] = [.content("文书稿件", "雇主的推荐信(仅签字)深圳华为科技有限公司.doc", .awaitingSignature, config)]
return [firstSetcion, secondSetcion]
}
private var docType: YHResignDocumentType
private var status: YHResignDocumentStatus = .awaitingSignature
init(_ docType: YHResignDocumentType, _ status: YHResignDocumentStatus) {
self.docType = docType
self.status = status
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private lazy var tableView: UITableView = {
let view = UITableView(frame:.zero, style:.grouped)
view.estimatedSectionHeaderHeight = 16.0
view.estimatedSectionFooterHeight = 0.01
view.sectionHeaderHeight = 16.0
view.sectionFooterHeight = 0.01
view.contentInsetAdjustmentBehavior = .never
view.showsVerticalScrollIndicator = false
view.separatorStyle = .none
view.delegate = self
view.dataSource = self
view.backgroundColor = .clear
view.tableFooterView = UITableViewHeaderFooterView()
view.rowHeight = UITableView.automaticDimension
view.register(YHResignDocumentTipsCell.self, forCellReuseIdentifier: YHResignDocumentTipsCell.cellReuseIdentifier)
view.register(YHResignDocumentStatusCell.self, forCellReuseIdentifier: YHResignDocumentStatusCell.cellReuseIdentifier)
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
editEvent = {
print("###editEvent")
}
submitEvent = {
print("###submitEvent")
}
signatureConfirmationEvent = {
print("###signatureConfirmationEvent")
}
previewEvent = {
print("###previewEvent")
}
infoConfirmationEvent = {
print("###infoConfirmationEvent")
}
tableView.reloadData()
}
}
extension YHResignDocumentDetailViewController {
private func setupUI() {
gk_navTitle = docType.title
gk_navBarAlpha = 1.0
gk_navBackgroundColor = .white
view.backgroundColor = UIColor.contentBkgColor
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview()
}
}
}
extension YHResignDocumentDetailViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
datas.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
guard datas.count > section else {
return 0
}
return datas[section].count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard datas.count > indexPath.section else {
return UITableViewCell()
}
let sectionArr = datas[indexPath.section]
guard sectionArr.count > indexPath.row else {
return UITableViewCell()
}
let item = sectionArr[indexPath.row]
switch item {
case let .tips(title, detail):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHResignDocumentTipsCell.cellReuseIdentifier) as? YHResignDocumentTipsCell {
cell.setupCellInfo(title: title, detail: detail)
return cell
}
case let .content(title, fileName, status, config):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHResignDocumentStatusCell.cellReuseIdentifier) as? YHResignDocumentStatusCell {
cell.setupCellInfo(title: title, fileName: fileName, status: status, buttonsConfig: config)
return cell
}
}
return UITableViewCell()
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
}
extension YHResignDocumentDetailViewController {
private func getStatusButtonsConfig(docType: YHResignDocumentType, status: YHResignDocumentStatus) -> YHResignDocumentStatusCell.ButtonsConfig {
var config = YHResignDocumentStatusCell.ButtonsConfig()
/*
private var editEvent: (() -> Void)?
private var submitEvent: (() -> Void)?
private var signatureConfirmationEvent: (() -> Void)?
private var previewEvent: (() -> Void)?
private var infoConfirmationEvent: (() -> Void)?
*/
var actions: [(() -> Void)] = []
switch docType {
case .powerOfAttorney, .settlementPlan, .explanatoryStatement:
switch status {
case .pendingConfirmation, .awaitingSignature:
config.names = ["在线编辑", "提交", "签字确认"]
if let editEvent = editEvent {
actions.append(editEvent)
}
if let submitEvent = submitEvent {
actions.append(submitEvent)
}
if let signatureConfirmationEvent = signatureConfirmationEvent {
actions.append(signatureConfirmationEvent)
}
config.actions = actions
config.style = .three
case .finalizing, .underReview, .completed:
if let previewEvent = previewEvent {
actions.append(previewEvent)
}
config.names = ["查看"]
config.actions = actions
config.style = .one
}
case .qmasDoc:
switch status {
case .pendingConfirmation:
if let infoConfirmationEvent = infoConfirmationEvent {
actions.append(infoConfirmationEvent)
}
config.names = ["信息确认"]
config.actions = actions
config.style = .one
case .finalizing, .underReview, .completed:
if let previewEvent = previewEvent {
actions.append(previewEvent)
}
config.names = ["查看"]
config.actions = actions
config.style = .one
case .awaitingSignature:
if let infoConfirmationEvent = infoConfirmationEvent {
actions.append(infoConfirmationEvent)
}
if let signatureConfirmationEvent = signatureConfirmationEvent {
actions.append(signatureConfirmationEvent)
}
config.names = ["信息确认", "签字确认"]
config.actions = actions
config.style = .two
}
}
return config
}
}
......@@ -35,9 +35,6 @@ class YHResignDocumentManagementVC: YHBaseViewController {
view.dataSource = self
view.backgroundColor = .clear
view.rowHeight = 52
// if #available(iOS 15.0, *) {
// view.sectionHeaderTopPadding = 0
// }
view.tableFooterView = UITableViewHeaderFooterView()
view.register(YHResignDocumentHeaderCell.self, forCellReuseIdentifier: YHResignDocumentHeaderCell.cellReuseIdentifier)
view.register(YHResignDocumentContentCell.self, forCellReuseIdentifier: YHResignDocumentContentCell.cellReuseIdentifier)
......@@ -63,8 +60,6 @@ extension YHResignDocumentManagementVC {
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview()
// make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
// make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom)
}
}
}
......@@ -117,6 +112,25 @@ extension YHResignDocumentManagementVC: UITableViewDelegate, UITableViewDataSour
return UITableViewCell()
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
guard datas.count > indexPath.section else {
return
}
let sectionArr = datas[indexPath.section]
guard sectionArr.count > indexPath.row else {
return
}
let item = sectionArr[indexPath.row]
switch item {
case .header:
return
case let .content(title, status):
let controller = YHResignDocumentDetailViewController(.explanatoryStatement, status)
navigationController?.pushViewController(controller)
}
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
......
//
// YHResignDocumentType.swift
// galaxy
//
// Created by alexzzw on 2024/9/14.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
enum YHResignDocumentType {
case powerOfAttorney
case settlementPlan
case explanatoryStatement
// qualityMigrantAdmissionScheme
case qmasDoc
var title: String {
switch self {
case .powerOfAttorney:
return "代理委托书"
case .settlementPlan:
return "定居计划"
case .explanatoryStatement:
return "解释说明"
case .qmasDoc:
return "QMAS文件"
}
}
}
//
// YHResignDocumentTipsCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResignDocumentTipsCell: YHResignDocumentCell {
static let cellReuseIdentifier = "YHResignDocumentTipsCell"
private lazy var bgView: UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "document_prompt_bg_small")
view.contentMode = .scaleAspectFill
return view
}()
private lazy var tipIconView: UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "service_step_tips")
return view
}()
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_M(ofSize:13)
label.textColor = .brandMainColor
label.text = "填写指引"
return label
}()
private lazy var infoDetailLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor50
label.font = .PFSC_R(ofSize:12)
label.numberOfLines = 0
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(title: String?, detail: NSAttributedString?) {
infoTitleLabel.text = title
infoDetailLabel.attributedText = detail
}
}
extension YHResignDocumentTipsCell {
private func setupUI() {
updateCellCorner(.single)
subContainerView.addSubview(bgView)
subContainerView.addSubview(tipIconView)
subContainerView.addSubview(infoTitleLabel)
subContainerView.addSubview(infoDetailLabel)
subContainerView.sendSubviewToBack(bgView)
bgView.setContentCompressionResistancePriority(.defaultLow, for: .vertical)
bgView.setContentHuggingPriority(.defaultLow, for: .vertical)
bgView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
tipIconView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.top.equalToSuperview().offset(18)
make.width.height.equalTo(14)
}
infoTitleLabel.snp.makeConstraints { make in
make.left.equalTo(tipIconView.snp.right).offset(8)
make.centerY.equalTo(tipIconView)
}
infoDetailLabel.snp.makeConstraints { make in
make.top.equalTo(tipIconView.snp.bottom).offset(8)
make.left.equalTo(tipIconView.snp.left)
make.right.lessThanOrEqualToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-16)
}
}
}
//
// YHResignGuidelinesExampleShareViewController.swift
// galaxy
//
// Created by EDY on 2024/9/14.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import Photos
class YHResignGuidelinesExampleShareViewController: YHBaseViewController {
var bottomView: UIView!
var leftButton: YHShareButton!
var centerButton: YHShareButton!
var rightButton: YHShareButton!
var centerImageView: UIImageView!
var imageView: UIImageView!
var logoImageView: UIImageView!
var centerImageName: String = ""
var url: String = " "
override func viewDidLoad() {
super.viewDidLoad()
setView()
loadData()
}
}
extension YHResignGuidelinesExampleShareViewController {
func getData() {
}
func updateDataSource() {
}
func setView() {
view.backgroundColor = .contentBkgColor
gk_navTitle = "分享活动"
bottomView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
view.addSubview(bottomView)
bottomView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(148)
}
leftButton = {
let button = YHShareButton()
button.setContent("invitation_with_gifts_share_left", "保存海报")
button.addTarget(self, action: #selector(saveBtnClick), for: .touchUpInside)
return button
}()
bottomView.addSubview(leftButton)
leftButton.snp.makeConstraints { make in
make.top.equalTo(20)
make.left.equalTo(42)
make.height.equalTo(74)
make.width.equalTo(52)
}
centerButton = {
let button = YHShareButton()
button.setContent("invitation_with_gifts_share_center", "微信好友")
button.addTarget(self, action: #selector(wxClick), for: .touchUpInside)
return button
}()
bottomView.addSubview(centerButton)
centerButton.snp.makeConstraints { make in
make.top.equalTo(20)
make.centerX.equalToSuperview()
make.height.equalTo(74)
make.width.equalTo(52)
}
rightButton = {
let button = YHShareButton()
button.setContent("invitation_with_gifts_share_right", "朋友圈")
button.addTarget(self, action: #selector(peopleClick), for: .touchUpInside)
return button
}()
bottomView.addSubview(rightButton)
rightButton.snp.makeConstraints { make in
make.top.equalTo(20)
make.right.equalTo(-42)
make.height.equalTo(74)
make.width.equalTo(52)
}
centerImageView = {
let view = UIImageView()
view.image = UIImage(named: centerImageName)
return view
}()
view.addSubview(centerImageView)
centerImageView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 46.fix)
make.centerX.equalToSuperview()
make.height.equalTo(466)
make.width.equalTo(270)
}
imageView = {
let view = UIImageView()
return view
}()
centerImageView.addSubview(imageView)
imageView.snp.makeConstraints { make in
make.bottom.equalTo(-18)
make.right.equalTo(-18)
make.width.height.equalTo(77)
}
logoImageView = {
let view = UIImageView()
view.image = UIImage(named: "share_icon")
return view
}()
imageView.addSubview(logoImageView)
logoImageView.snp.makeConstraints { make in
make.center.equalToSuperview()
make.width.height.equalTo(21)
}
let qrString = url
if let qrCode = qrString.generateQRCode() {
// 可以将qrCode设置为UIImageView的image属性来显示二维码
imageView.image = qrCode
}
}
func loadData() {
}
@objc func saveBtnClick() {
guard let combinedImage = combinedImageFrom(imageView: centerImageView) else { return }
saveImageToPhotosAlbum(image: combinedImage)
}
func saveImageToPhotosAlbum(image: UIImage) {
// 确保应用有权访问相册
PHPhotoLibrary.requestAuthorization { status in
if status == .authorized {
// 保存图片到相册
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
DispatchQueue.main.async {
YHHUD.flash(message: "保存成功")
}
} else {
YHHUD.flash(message: "保存失败,请检查系统权限")
}
}
}
@objc func wxClick() {
// YHShareManager.shared.sendLinkContent("香港身份规划专属礼包,限时领取!", "1000元折扣福利券,资深银河规划专家1V1评估方案", UIImage(named: "invitation_with_gifts_share_other") ?? UIImage(), link: YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/evaluation?channel=lkhtj-app&customer_id=\(YHLoginManager.shared.userModel?.id ?? "")&scene_id=30")
}
@objc func peopleClick() {
// YHShareManager.shared.sendLinkContent("香港身份规划专属礼包,限时领取!", "1000元折扣福利券,资深银河规划专家1V1评估方案", UIImage(named: "invitation_with_gifts_share_other") ?? UIImage(), link: YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/evaluation?channel=lkhtj-app&customer_id=\(YHLoginManager.shared.userModel?.id ?? "")&scene_id=30", WXSceneTimeline)
}
func combinedImageFrom(imageView: UIImageView) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, false, 0.0)
// 首先绘制 imageView 的内容
imageView.layer.render(in: UIGraphicsGetCurrentContext()!)
// 获取合成后的图像
let combinedImage = UIGraphicsGetImageFromCurrentImageContext()
// 结束绘图上下文
UIGraphicsEndImageContext()
return combinedImage
}
func currentPage(collectionView: UICollectionView) -> Int {
let pageWidth = collectionView.frame.width
let offset = collectionView.contentOffset
return Int(offset.x / pageWidth)
}
}
//
// YHResignGuidelinesExampleViewController.swift
// galaxy
//
// Created by EDY on 2024/9/14.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHResignGuidelinesExampleType: Int {
case house
case work
case taxation
case noWork
}
class YHResignGuidelinesExampleViewController: YHBaseViewController {
var tableView: UITableView!
var nextButton: UIButton!
var url: String = ""
var imageName: String = ""
var type: YHResignGuidelinesExampleType = .house
// var viewModel = YHResignCertificateListViewModel()
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "银河续签案例分享"
gk_navBackgroundColor = .white
gk_navBarAlpha = 1.0
setView()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
getData()
}
func getData() {
if type == .house {
imageName = "resign_guidelines_example_house"
} else if type == .work {
imageName = "resign_guidelines_example_work"
} else if type == .taxation {
imageName = "resign_guidelines_example_taxation"
} else {
imageName = "resign_guidelines_example_nowork"
}
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.showsVerticalScrollIndicator = false
tableView.showsHorizontalScrollIndicator = false
tableView.register(cellWithClass: YHResignGuidelinesExampleTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.bottom.equalTo(-98)
}
let bottonView = UIView()
bottonView.backgroundColor = .white
bottonView.isHidden = true
view.addSubview(bottonView)
bottonView.snp.makeConstraints { make in
make.height.equalTo(98)
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() {
var imageName = ""
if type == .house {
imageName = "resign_guidelines_example_house_share"
} else if type == .work {
imageName = "resign_guidelines_example_work_share"
} else if type == .taxation {
imageName = "resign_guidelines_example_taxation_share"
} else {
imageName = "resign_guidelines_example_nowork_share"
}
let vc = YHResignGuidelinesExampleShareViewController()
vc.centerImageName = imageName
vc.url = "https://baidu.com"
self.navigationController?.pushViewController(vc)
}
}
extension YHResignGuidelinesExampleViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHResignGuidelinesExampleTableViewCell.self)
cell.imageName = imageName
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if type == .house {
return 986.fix
} else if type == .work {
return 925.fix
} else if type == .taxation {
return 946.fix
} else {
return 1069.fix
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
}
class YHResignGuidelinesExampleTableViewCell: UITableViewCell {
var bgImageView: UIImageView!
var imageName: String? {
didSet {
bgImageView.image = UIImage(named: imageName ?? "")
}
}
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
bgImageView = {
let imageView = UIImageView()
return imageView
}()
contentView.addSubview(bgImageView)
bgImageView.snp.makeConstraints { make in
make.top.left.right.bottom.equalToSuperview()
}
}
}
......@@ -75,6 +75,7 @@ extension UIColor {
//提示 color
static let tipsColor : UIColor = UIColor(hexString: "#2F7EF6")!
static let tipsColor8: UIColor = UIColor(hexString: "#2F7EF6", transparency: 0.08)!
//页面背景
static let pageBkgColor : UIColor = UIColor(hexString: "#F8F8F8")!
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "document_prompt_bg_small@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "document_prompt_bg_small@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_house@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_house@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_house_share@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_house_share@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_nowork@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_nowork@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_nowork_share@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_nowork_share@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_taxation@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_taxation@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_taxation_share@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_taxation_share@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_work@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_work@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "resign_guidelines_example_work_share@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "resign_guidelines_example_work_share@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