Commit 6d79550f authored by Steven杜宇's avatar Steven杜宇

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

parents 031c54bf 16571401
......@@ -125,6 +125,8 @@
0430E68A2C77415D000511E2 /* YHAdopterAddModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6892C77415D000511E2 /* YHAdopterAddModel.swift */; };
0430E68C2C786257000511E2 /* YHAdopterIncomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E68B2C786257000511E2 /* YHAdopterIncomeViewModel.swift */; };
0430E68E2C7875F4000511E2 /* YHAdopterDependentDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E68D2C7875F4000511E2 /* YHAdopterDependentDataModel.swift */; };
0430E6902C7EC78C000511E2 /* YHCardUploadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E68F2C7EC78C000511E2 /* YHCardUploadView.swift */; };
0430E6922C7EF08B000511E2 /* YHAdopterOtherCardTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6912C7EF08B000511E2 /* YHAdopterOtherCardTableViewCell.swift */; };
04358E042C77322700811928 /* YHHaveGrabbedNumberListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04358E032C77322700811928 /* YHHaveGrabbedNumberListCell.swift */; };
04358E062C77334B00811928 /* YHHaveGrabbedNumberInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04358E052C77334B00811928 /* YHHaveGrabbedNumberInfoView.swift */; };
04358E082C77657000811928 /* YHReAppointViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04358E072C77657000811928 /* YHReAppointViewController.swift */; };
......@@ -894,6 +896,8 @@
0430E6892C77415D000511E2 /* YHAdopterAddModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterAddModel.swift; sourceTree = "<group>"; };
0430E68B2C786257000511E2 /* YHAdopterIncomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterIncomeViewModel.swift; sourceTree = "<group>"; };
0430E68D2C7875F4000511E2 /* YHAdopterDependentDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterDependentDataModel.swift; sourceTree = "<group>"; };
0430E68F2C7EC78C000511E2 /* YHCardUploadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCardUploadView.swift; sourceTree = "<group>"; };
0430E6912C7EF08B000511E2 /* YHAdopterOtherCardTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterOtherCardTableViewCell.swift; sourceTree = "<group>"; };
04358E032C77322700811928 /* YHHaveGrabbedNumberListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHaveGrabbedNumberListCell.swift; sourceTree = "<group>"; };
04358E052C77334B00811928 /* YHHaveGrabbedNumberInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHaveGrabbedNumberInfoView.swift; sourceTree = "<group>"; };
04358E072C77657000811928 /* YHReAppointViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHReAppointViewController.swift; sourceTree = "<group>"; };
......@@ -1846,6 +1850,8 @@
0430E6772C74A53F000511E2 /* YHAdopterMarryCardTableViewCell.swift */,
0430E67F2C75966D000511E2 /* YHAdopterCardExampleView.swift */,
0430E6812C75E067000511E2 /* YHAdopterCardOtherGuideView.swift */,
0430E68F2C7EC78C000511E2 /* YHCardUploadView.swift */,
0430E6912C7EF08B000511E2 /* YHAdopterOtherCardTableViewCell.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -4394,6 +4400,7 @@
045EEE7B2B9F171A0022A143 /* YHPersonInfoCellModel2.swift in Sources */,
A53B61122BB128AF0010B573 /* YHFileListItemsView2.swift in Sources */,
04358E042C77322700811928 /* YHHaveGrabbedNumberListCell.swift in Sources */,
0430E6922C7EF08B000511E2 /* YHAdopterOtherCardTableViewCell.swift in Sources */,
044D0BF62C2154CA00C5CF5E /* YHAllowUseMyInfoViewController.swift in Sources */,
0485DFE12C6A0B6200B50293 /* YHPrincipleApprovedResultVC.swift in Sources */,
04256DF42C73626900A37BA4 /* YHServiceSelectAlertView.swift in Sources */,
......@@ -4865,6 +4872,7 @@
A517A4E12BB573EB000DEECD /* YHDocListCell.swift in Sources */,
A58037212BAD7B2A0031C312 /* YHMySchemeModel.swift in Sources */,
0493B3DE2BA80C2300AF9393 /* YHCertificateFilterButton.swift in Sources */,
0430E6902C7EC78C000511E2 /* YHCardUploadView.swift in Sources */,
04FA8B2B2C06F59D00ABE43F /* YHAppleLoginManager.swift in Sources */,
048058372C7F03B500502CAA /* YHTravelCertificateUploadCell.swift in Sources */,
A567E5932BD7643D00D5D5A0 /* YHHomePageViewModel.swift in Sources */,
......@@ -5050,7 +5058,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyTestEnv.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -5191,7 +5199,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -5395,7 +5403,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -5441,7 +5449,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......
......@@ -15,7 +15,7 @@ class YHAdopterOtherViewController: YHBaseViewController {
var data: [YHItemModel] = []
var viewModel = YHYHAdopterTravelViewModel()
var model: YHAdopterDependentDataDocModel = YHAdopterDependentDataDocModel()
var urls : [String] = [""]
var urls : [String] = []
override func viewDidLoad() {
super.viewDidLoad()
......@@ -23,9 +23,6 @@ class YHAdopterOtherViewController: YHBaseViewController {
gk_navBackgroundColor = .white
gk_navBarAlpha = 1
urls = model.url
if urls.count == 0 {
urls = [""]
}
setView()
getData()
}
......@@ -45,8 +42,9 @@ class YHAdopterOtherViewController: YHBaseViewController {
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHAdopterExampleTableViewCell.self)
tableView.register(cellWithClass: YHAdopterResidentTableViewCell.self)
tableView.register(cellWithClass: YHAdopterOtherCardTableViewCell.self)
tableView.register(cellWithClass: YHAdopterCardExplainTableViewCell.self)
tableView.register(cellWithClass: YHAdopterIncomeFileCountTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
......@@ -85,6 +83,10 @@ class YHAdopterOtherViewController: YHBaseViewController {
}
@objc func nextStep() {
if urls.count == 0 {
YHHUD.flash(message: "您还有信息未填写")
return
}
for item in urls {
if item.count == 0 {
self.getData()
......@@ -102,7 +104,7 @@ class YHAdopterOtherViewController: YHBaseViewController {
extension YHAdopterOtherViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
return 4
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
......@@ -125,12 +127,32 @@ extension YHAdopterOtherViewController: UITableViewDelegate, UITableViewDataSour
return cell
}
if indexPath.row == 2 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterResidentTableViewCell.self)
cell.urls = urls
let cell = tableView.dequeueReusableCell(withClass: YHAdopterOtherCardTableViewCell.self)
cell.state = model.status
cell.dataSource = urls
cell.urlBlock = { [weak self] url, index in
guard let self = self else { return }
self.urls[index] = url
self.urls.append(url)
self.tableView.reloadData()
}
cell.deleteBlock = { [weak self] url, index in
guard let self = self else { return }
for (index, value) in urls.enumerated() {
if value == url {
self.urls.remove(at: index)
self.tableView.reloadData()
}
}
}
if indexPath.row == 3 {
let cell = tableView.dequeueReusableCell(withClass: YHAdopterIncomeFileCountTableViewCell.self)
cell.setContentData(self.urls.count)
if urls.count == 0 {
cell.isHidden = true
} else {
cell.isHidden = false
}
return cell
}
return cell
}
......@@ -146,9 +168,10 @@ extension YHAdopterOtherViewController: UITableViewDelegate, UITableViewDataSour
return 84
}
if indexPath.row == 2 {
return 173
let count = urls.count/2
return CGFloat(173 + count * 173)
}
return 0
return 45
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
......
//
// YHAdopterOtherCardTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/8/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAdopterOtherCardTableViewCell: UITableViewCell {
typealias UrlBlock = (_ url: String, _ index: Int) -> ()
var urlBlock: UrlBlock?
var deleteBlock: UrlBlock?
lazy var collectView = {
// 设置布局方向
let flowLayout = YHHomeCollectionLayout()
flowLayout.minimumInteritemSpacing = 7.0
flowLayout.minimumColumnSpacing = 7.0
flowLayout.sectionInset = UIEdgeInsets(top: 8, left: 20, bottom: 0, right: 20)
let collectinoView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectinoView.backgroundColor = .white
collectinoView.register(YHAdopterOtherCardCollectionViewCell.self, forCellWithReuseIdentifier:YHAdopterOtherCardCollectionViewCell.cellReuseIdentifier)
collectinoView.delegate = self
collectinoView.dataSource = self
collectinoView.translatesAutoresizingMaskIntoConstraints = false
collectinoView.alwaysBounceVertical = true
return collectinoView
}()
var state: Int = 0
var dataSource: [String] = [] {
didSet {
if state == 1 || state == 2 {
} else {
self.dataSource.append("")
}
self.collectView.reloadData()
}
}
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
contentView.addSubview(collectView)
collectView.snp.makeConstraints { make in
make.left.right.top.bottom.equalToSuperview()
}
}
}
extension YHAdopterOtherCardTableViewCell: UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.dataSource.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHAdopterOtherCardCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHAdopterOtherCardCollectionViewCell
cell.url = self.dataSource[indexPath.row]
cell.state = state
cell.urlBlock = { [weak self] url, index in
guard let self = self else { return }
if let block = self.urlBlock {
block(url, index)
}
}
cell.deleteBlock = { [weak self] url, index in
guard let self = self else { return }
if let block = self.deleteBlock {
block(url, index)
}
}
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
}
}
extension YHAdopterOtherCardTableViewCell : CollectionViewWaterfallLayoutDelegate {
func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return CGSize(width: CGFloat(168).scaleSizeFrom375px(size: 168), height: 133)
}
}
class YHAdopterOtherCardCollectionViewCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHAdopterOtherCardCollectionViewCell"
typealias UrlBlock = (_ url: String, _ index: Int) -> ()
var urlBlock: UrlBlock?
var deleteBlock: UrlBlock?
var imagePickView: YHCardUploadView!
var url: String? {
didSet {
updataSubViews()
}
}
var state: Int = 0 {
didSet {
if self.state == 1 || self.state == 2 {
imagePickView.state = true
}
}
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
}
extension YHAdopterOtherCardCollectionViewCell {
private func setupUI() {
imagePickView = {
let view = YHCardUploadView()
view.urlBlock = { [weak self] url, index in
guard let self = self else { return }
if let block = self.urlBlock {
block(url, index)
}
}
view.deleteBlock = { [weak self] url, index in
guard let self = self else { return }
if let block = self.deleteBlock {
block(url, index)
}
}
return view
}()
contentView.addSubview(imagePickView)
imagePickView.snp.makeConstraints { make in
make.left.right.top.bottom.equalToSuperview()
}
}
func updataSubViews() {
imagePickView.url = url
}
}
//
// YHCardUploadView.swift
// galaxy
//
// Created by EDY on 2024/8/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCardUploadView: UIView {
typealias UrlBlock = (_ url: String, _ index: Int) -> ()
var urlBlock: UrlBlock?
var deleteBlock: UrlBlock?
var frontLabel: UILabel!
var frontImageButton: YHCardButton!
var frontDeleteButton: UIButton!
var viewModel: YHBaseViewModel = YHBaseViewModel()
var firstUrl: String = ""
var defaultImageName: String = "service_hk_card_front"
var url: String? {
didSet {
guard let firstUrl = url, firstUrl.count != 0 else {
self.firstUrl = ""
frontDeleteButton.isHidden = true
frontImageButton.setBackgroundImage(UIImage(named: defaultImageName), for: .normal)
frontImageButton.setContent("card_upload", "点击上传")
return
}
self.firstUrl = firstUrl
self.viewModel.getPublicImageUrl(firstUrl) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.frontImageButton.kf.setBackgroundImage(with: URL(string: url), for: .normal, completionHandler: { _ in
self.frontDeleteButton.isHidden = false
if self.state ?? false {
self.frontDeleteButton.isHidden = true
}
})
self.frontImageButton.setContent("", "")
}
}
}
var state: Bool? {
didSet {
if state ?? false {
frontDeleteButton.isHidden = true
}
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
func setupUI() {
backgroundColor = .clear
frontLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.subTextColor
label.text = "证件页1"
label.textAlignment = .center
return label
}()
addSubview(frontLabel)
frontLabel.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(0)
make.height.equalTo(22)
}
frontImageButton = {
let button = YHCardButton()
button.setContent("card_upload", "点击上传")
button.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal)
button.addTarget(self, action: #selector(frontImageClick), for: .touchUpInside)
button.layer.cornerRadius = 4
button.clipsToBounds = true
return button
}()
addSubview(frontImageButton)
frontImageButton.snp.makeConstraints { make in
make.left.bottom.equalToSuperview()
make.height.equalTo(99)
make.right.equalTo(-8)
}
frontDeleteButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_delete"), for: .normal)
button.addTarget(self, action: #selector(frontDeleteClick), for: .touchUpInside)
button.isHidden = true
return button
}()
addSubview(frontDeleteButton)
frontDeleteButton.snp.makeConstraints { make in
make.centerX.equalTo(frontImageButton.snp.right)
make.centerY.equalTo(frontImageButton.snp.top)
make.height.equalTo(21)
make.width.equalTo(21)
}
}
@objc func frontImageClick() {
if firstUrl.count != 0 {
let vc = YHImageViewController()
vc.imgString = firstUrl
UIViewController.current?.navigationController?.pushViewController(vc)
return
}
if state ?? false {
return
}
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
self.frontImageButton.setContent("card_loading", "上传中")
self.frontImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
guard let url = success else { return }
self.frontImageButton.setBackgroundImage(image, for: .normal)
self.frontDeleteButton.isHidden = false
if let block = self.urlBlock {
block(url, 0)
}
}
}
}
@objc func frontDeleteClick() {
frontDeleteButton.isHidden = true
frontImageButton.setBackgroundImage(UIImage(named: defaultImageName), for: .normal)
frontImageButton.setContent("card_upload", "点击上传")
if let block = deleteBlock {
block(url ?? "", 0)
}
}
}
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