Commit 97a50cd5 authored by Steven杜宇's avatar Steven杜宇

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

parents 2b6fb829 b125f518
......@@ -156,6 +156,7 @@
A5234E372B70802400A33433 /* YHBasicInfoCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5234E362B70802300A33433 /* YHBasicInfoCellModel.swift */; };
A5234E3E2B7235F000A33433 /* YHOtherInfoFillViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5234E3D2B7235F000A33433 /* YHOtherInfoFillViewController.swift */; };
A53026902B4E6F2700F35102 /* YHHomeCustomCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A530268F2B4E6F2700F35102 /* YHHomeCustomCell.swift */; };
A554A5002B95FB9100EA5973 /* YHMainInfoPreviewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A554A4FF2B95FB9100EA5973 /* YHMainInfoPreviewModel.swift */; };
A5551FFE2B4C26CE00510980 /* YHBaseViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5551FFD2B4C26CE00510980 /* YHBaseViewModel.swift */; };
A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5573ED12B317BFF00D98EC0 /* AppDelegate.swift */; };
A5573EDB2B317C0000D98EC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A5573EDA2B317C0000D98EC0 /* Assets.xcassets */; };
......@@ -460,6 +461,7 @@
A5234E362B70802300A33433 /* YHBasicInfoCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBasicInfoCellModel.swift; sourceTree = "<group>"; };
A5234E3D2B7235F000A33433 /* YHOtherInfoFillViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherInfoFillViewController.swift; sourceTree = "<group>"; };
A530268F2B4E6F2700F35102 /* YHHomeCustomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeCustomCell.swift; sourceTree = "<group>"; };
A554A4FF2B95FB9100EA5973 /* YHMainInfoPreviewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMainInfoPreviewModel.swift; sourceTree = "<group>"; };
A5551FFD2B4C26CE00510980 /* YHBaseViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBaseViewModel.swift; sourceTree = "<group>"; };
A5573ECE2B317BFF00D98EC0 /* galaxy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = galaxy.app; sourceTree = BUILT_PRODUCTS_DIR; };
A5573ED12B317BFF00D98EC0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
......@@ -1047,6 +1049,7 @@
A5FD63F92B68D95700D1D9DA /* YHPersonInfoIdentityCardModel.swift */,
A5191F612B89E748001069F7 /* YHPreviewQuestionAndAnswerModel.swift */,
A5B4A5842B9455F7003EFF8F /* YHPreviewForOtherInfoModel.swift */,
A554A4FF2B95FB9100EA5973 /* YHMainInfoPreviewModel.swift */,
);
path = M;
sourceTree = "<group>";
......@@ -1812,6 +1815,7 @@
0413A6D82B8C76290006D154 /* YHCertificateUploadVC.swift in Sources */,
A5ACE93A2B4564F7002C94D2 /* NSAttributedString+Extension.swift in Sources */,
04E86E662B86EB6F00A35F4B /* YHLoginManager.swift in Sources */,
A554A5002B95FB9100EA5973 /* YHMainInfoPreviewModel.swift in Sources */,
042F888B2B8477C6008B60BD /* YHEducationInfo.swift in Sources */,
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */,
042FBBBF2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift in Sources */,
......
......@@ -179,8 +179,14 @@ extension YHServiceCenterMainViewController : UITableViewDelegate,UITableViewDat
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
printLog("点击了 tableView Cell \(indexPath.section)")
//获取订单号
let orderId = serviceCenterMainReqVM.arrContactList[indexPath.section].id
UserDefaults.standard.set(orderId, forKey: "orderIdForPreview")
UserDefaults.standard.synchronize()
let vc = YHServiceCenterSecondViewController()
vc.orderId = serviceCenterMainReqVM.arrContactList[indexPath.section].id
vc.orderId = orderId
self.navigationController?.pushViewController(vc)
}
}
......
......@@ -167,6 +167,8 @@ extension YHServiceCenterSecondViewController : UITableViewDelegate,UITableViewD
let model = self.serviceCenterMainReqVM.arrContactStausItmes[indexPath.row]
if model.type == 1 {
let vc = YHInformationPerfectListVC()
vc.orderId = orderId
......
......@@ -1218,10 +1218,12 @@ class YHAddress: SmartCodable {
class YHChildStepchildClass: SmartCodable {
var has: String = ""
var info: String = ""
var number: String = ""
enum CodingKeys: String, CodingKey {
case has = "has"
case info = "info"
case number = "number"
}
required init() {
......
......@@ -92,12 +92,13 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
bottom.nextblock = { [weak self] in
guard let self = self else { return }
if self.viewModel.isCanNext(self.stepView.currentIndex) {
self.stepView.currentIndex = self.stepView.currentIndex + 1
self.viewModel.mainModel.step = self.stepView.currentIndex
self.viewModel.updateMainInformation(.submit, self.orderId) {[weak self] success, error in
guard let self = self else { return }
if let error = error {
YHHUD.flash(message: error.errorMsg )
} else {
self.stepView.currentIndex = self.stepView.currentIndex + 1
self.isShowPrompt = false
self.stepView.currentIndex = self.stepView.currentIndex
if self.stepView.currentIndex == self.stepView.dataSource?.count {
......
......@@ -17,6 +17,7 @@
import UIKit
import Alamofire
import Photos
class YHImagePickerView: UIView {
var backImage: ((UIImage) -> Void)?
......@@ -164,6 +165,7 @@ class YHImagePickerView: UIView {
}
@objc func takePhoto() {
guard getPhotoLibraryAuthorization() else { return }
if UIImagePickerController.isSourceTypeAvailable(.camera){
//创建图片控制器
let imagePicker = UIImagePickerController()
......@@ -183,6 +185,7 @@ class YHImagePickerView: UIView {
}
@objc func selectPhoto() {
guard getPhotoLibraryAuthorization() else { return }
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
......@@ -192,6 +195,28 @@ class YHImagePickerView: UIView {
UIViewController.current?.present(imagePicker,animated: true)
}
}
private func getPhotoLibraryAuthorization() -> Bool {
let authorizationStatus = PHPhotoLibrary.authorizationStatus()
switch authorizationStatus {
case .authorized:
print("已经授权")
return true
case .notDetermined:
print("不确定是否授权")
// 请求授权
PHPhotoLibrary.requestAuthorization({ (status) in })
case .denied:
print("拒绝授权")
case .restricted:
print("限制授权")
break
case .limited: break
@unknown default:
break
}
return false
}
}
extension YHImagePickerView: UIGestureRecognizerDelegate {
......@@ -219,7 +244,7 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.dismiss(animated: true, completion: nil)
}
//原生上传
......
......@@ -68,6 +68,7 @@ class YHStepView: UIScrollView {
make.left.equalTo(spaceWidth + i.cgFloat * (lineWidth + stepSpace * 2 + 14))
make.width.height.equalTo(14)
}
button.YH_clickEdgeInsets = UIEdgeInsets(top: 50, left: 50, bottom: 50, right: 50)
let label = UILabel()
label.text = array[i]
label.font = UIFont.PFSC_R(ofSize: 13)
......
......@@ -50,10 +50,6 @@ class YHScoreDetailViewController: YHBaseViewController {
//2.0
loadData()
//3.保存orderId 提供给后续UI使用
UserDefaults.standard.set(orderId, forKey: "orderIdForPreview")
UserDefaults.standard.synchronize()
}
}
......
//
// YHMainInfoPreviewModel.swift
// galaxy
//
// Created by davidhuangA on 2024/3/4.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHMainInfoPreviewModel: SmartCodable {
var username: String = ""
var used_name: String = ""
var username_pinyin : String = ""
var sex : String = ""
var birthday: String = ""
var birth_place: String = ""
var mobile: String = ""
var email: String = ""
var married: String = ""
var nationality: String = ""
var live_address: String = ""
var surname: String = ""
var birth_place_details : String = ""
var live_address_detail : String = ""
var is_handled: Int = 0
var is_live_oversea_year: Int = 0
var hk_id : YHChildStepchildClass?
var certificates:YHCertificatesPreviewModel?
required init() {
}
}
class YHCertificatesPreviewModel: SmartCodable {
var cnIdentityCard: YHCNIdentityCardPreviewModel = YHCNIdentityCardPreviewModel()
var passport: YHCNIdentityCardPreviewModel = YHCNIdentityCardPreviewModel()
var hkMacaoPass: YHCNIdentityCardPreviewModel = YHCNIdentityCardPreviewModel()
enum CodingKeys: String, CodingKey {
case cnIdentityCard = "cn_identity_card"
case passport = "passport"
case hkMacaoPass = "hk_macao_pass"
}
required init() {
}
}
class YHCNIdentityCardPreviewModel: SmartCodable {
static let longTime = "8888-01-01"
var id: Int = 0
var number: String = ""
var issueAt: String = ""
var issueDateStartAt: String = ""
var issueDateEndAt: String = ""
var imgFront: String = ""
var imgBack: String = ""
var passport_type: Int = -1
var type: String = ""
enum CodingKeys: String, CodingKey {
case id = "id"
case number = "number"
case issueAt = "issue_at"
case issueDateStartAt = "issue_date_start_at"
case issueDateEndAt = "issue_date_end_at"
case imgFront = "img_front"
case imgBack = "img_back"
case passport_type = "passport_type"
case type = "type"
}
required init() {
}
}
......@@ -54,6 +54,7 @@ class YHPreviewInfoNameAndSubNameItemView: UIView {
make.top.equalTo(nameLable.snp.top)
make.right.equalToSuperview()
make.left.equalTo(nameLable.snp.right).offset(10)
make.height.greaterThanOrEqualTo(20)
make.bottom.equalToSuperview()
}
......
......@@ -19,7 +19,7 @@ class YHPreviewViewModel: YHBaseViewModel {
//主申请人信息 预览 - 未完成
var mainApplicationInfoPreviewModel : YHMainInformationModel?
var mainApplicationInfoPreviewModel : YHMainInfoPreviewModel?
var arrDataForMainApplicationInfo : [YHPreviewInfoSessionModel] = []
//其他信息 预览
......@@ -68,8 +68,8 @@ extension YHPreviewViewModel {
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHMainInformationModel.deserialize(from: dic as? Dictionary) else {
let dic = json.data as? [AnyHashable : Any]
guard let result = YHMainInfoPreviewModel.deserialize(dict: dic) else {
callBackBlock(false,nil)
return
}
......@@ -169,66 +169,167 @@ private extension YHPreviewViewModel {
do {
//基本信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "主申请人:", answer: model.username)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: model.used_name)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: model.surname)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: model.used_name.isEmpty ? "--" : model.used_name)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: model.surname.isEmpty ? "--" : model.surname)
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: model.birth_place.area.description) //mainData.birth_place for test hjl todo
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "性别:", answer: model.sex.description)//mainData.birth_place for test hjl todo
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: model.married.description)//for test hjl todo
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: model.birth_place)
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "性别:", answer: model.sex)//for test hjl todo
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: model.married)//for test hjl todo
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "手机号:", answer: model.mobile)
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "邮箱:", answer: model.email)
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "现居住地址:", answer:model.live_address)
var arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9]
if model.live_address.contains("中国") == false {
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "是否在海外居住满1年及以上:", answer: model.is_live_oversea_year == 1 ? "是" : "否")
arr.append(tmp10)
} else {
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "详细地址:", answer: model.live_address_detail)
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")//model.hk_id.has //for test hjl todo
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "香港身份证:", answer: "-")//model.hk_id.number //for test hjl todo
arr.append(tmp10)
}
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9,tmp10,tmp11,tmp12]
if let card = model.hk_id,card.has.isEmpty == false {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: card.number.isEmpty ? "--" : card.number)
arr.append(tmp5)
arr.append(tmp6)
} else {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp5)
}
let model2 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "基本信息", cellData0: arr)
arrDataForMainApplicationInfo.append(model2)
}
if let model2 = model.certificates {
//1.跟随 证件信息
do {
//证件信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "中国身份证号码:", answer: "2203381990287633390")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
//中国身份证
var str = model2.cnIdentityCard.number
if str.isEmpty {
str = "无"
}
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "中国身份证号码:", answer: str)
str = model2.cnIdentityCard.issueAt
if str.isEmpty {
str = "无"
}
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: str)
str = model2.cnIdentityCard.issueAt
if str.isEmpty {
str = "无"
}
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model2.cnIdentityCard.issueDateEndAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model0 = YHPersonInfoCellModel1(cellTitle: "中国身份证", cellData: [tmp0,tmp1,tmp2,tmp3])
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "旅行社证件号码:", answer: "c2345639")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
var arr = [model0]
//港澳通行证
if model.is_handled == 1 {
str = model2.hkMacaoPass.number
if str.isEmpty {
str = "无"
}
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "旅行社证件号码:", answer: str)
str = model2.hkMacaoPass.issueAt
if str.isEmpty {
str = "无"
}
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: str)
str = model2.hkMacaoPass.issueDateEndAt
if str.isEmpty {
str = "无"
}
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model2.hkMacaoPass.issueDateStartAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model1 = YHPersonInfoCellModel1(cellTitle: "港澳通行证", cellData: [tmp4,tmp5,tmp6,tmp7])
arr.append(model1)
}
if model.nationality != "中国-China" {
//护照及其他旅行证件
var str = String(model2.passport.passport_type)//for test hjl todo
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "证件类别:", answer: str)
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "证件类别:", answer: "护照")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "证件号码:", answer: "p2345639")
str = model2.passport.number
if str.isEmpty {
str = "--"
}
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "证件号码:", answer: str)
str = model2.passport.issueAt
if str.isEmpty {
str = "无"
}
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2028-07-31")
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model2 = YHPersonInfoCellModel1(cellTitle: "护照及其他旅行证件", cellData: [tmp8,tmp9,tmp10,tmp11,tmp12])
let arr = [model0,model1,model2]
str = model2.passport.issueDateStartAt
if str.isEmpty {
str = "无"
}
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model2.passport.issueDateEndAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model2 = YHPersonInfoCellModel1(cellTitle: "护照及其他旅行证件", cellData: [tmp8,tmp9,tmp10,tmp11,tmp12])
arr.append(model2)
}
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "证件信息", cellData1: arr)
arrDataForMainApplicationInfo.append(model3)
}
//2.跟随 证件照
do {
//证件照片
let model1 = YHPersonInfoCellModel2(cellTitle: "中国身份证",frontUrl: "", backUrl: "", idType: 1)
let model2 = YHPersonInfoCellModel2(cellTitle: "港澳通行证",frontUrl: "", backUrl: "", idType: 2)
let front = model2.cnIdentityCard.imgFront
let back = model2.cnIdentityCard.imgBack
let model1 = YHPersonInfoCellModel2(cellTitle: "中国身份证",frontUrl: front, backUrl: back, idType: 1)
var arr = [model1]
if model.is_handled == 1 {
let front = model2.hkMacaoPass.imgFront
let back = model2.hkMacaoPass.imgBack
let model2 = YHPersonInfoCellModel2(cellTitle: "港澳通行证",frontUrl: front, backUrl: back, idType: 2)
arr.append(model2)
}
let arr = [model1,model2]
let model4 = YHPreviewInfoSessionModel(cellType: .idPictureType, cellTitle: "证件照片", cellData2: arr)
arrDataForMainApplicationInfo.append(model4)
}
}
}
//组装 基本资料预览 数据
func installDataForBasicInfo() {
......@@ -426,23 +527,20 @@ private extension YHPreviewViewModel {
private extension YHPreviewViewModel {
func installDataForFamilyInfo() {
//父母
installDataForParents()
//配偶
installDataForSpouse()
//子女
installDataForChildren()
//兄弟姐妹
installDataForBrother()
}
//父母 数据
func installDataForParents() {
do {
......@@ -472,10 +570,18 @@ private extension YHPreviewViewModel {
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: model.occupation)
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: model.occupationName)
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "现居住国家/地区:", answer: model.liveCountry)
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: model.hkIdentityCard == nil ? "否" : "是")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: model.hkIdentityCard ?? "--")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp11,tmp4,tmp5,tmp6,tmp7,tmp8]
var arr = [tmp0,tmp1,tmp2,tmp3,tmp11,tmp4,tmp5,tmp6]
if let card = model.hkIdentityCard,card.isEmpty == false {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: model.hkIdentityCard ?? "--")
arr.append(tmp5)
arr.append(tmp6)
} else {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp5)
}
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "父亲信息", cellData0: arr)
arrDataForParents.append(model1)
......@@ -532,10 +638,19 @@ private extension YHPreviewViewModel {
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: model.occupation)
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: model.occupationName)
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "现居住国家/地区:", answer: model.liveCountry)
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: model.hkIdentityCard == nil ? "否" : "是")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: model.hkIdentityCard ?? "--")
let arr = [tmp0,tmp1,tmp11,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8]
var arr = [tmp0,tmp1,tmp2,tmp3,tmp11,tmp4,tmp5,tmp6]
if let card = model.hkIdentityCard,card.isEmpty == false {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: model.hkIdentityCard ?? "--")
arr.append(tmp5)
arr.append(tmp6)
} else {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp5)
}
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "母亲信息-健在", cellData0: arr)
arrDataForParents.append(model1)
} else {
......@@ -567,14 +682,9 @@ private extension YHPreviewViewModel {
arrDataForFamilyInfo = arrDataForParents
}
//配偶 数据
func installDataForSpouse() {
guard let model = familyInfoPreviewModel?.spouse else {
printLog("error:配偶数据不存在")
return
}
private func installDataForSpouseOp(model : YHFamilyMember) {
var arrTemp : [YHPreviewInfoSessionModel] = []
do {
if model.follow == 0 {
do {
......@@ -582,7 +692,7 @@ private extension YHPreviewViewModel {
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "是否随行至香港:", answer: "否")
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息", cellData0: arr)
arrDataForSpouse.append(model1)
arrTemp.append(model1)
}
do {
......@@ -606,11 +716,19 @@ private extension YHPreviewViewModel {
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: model.hkIdentityCard == nil ? "否" : "是")
var arr = [tmp0,tmp1,tmp2,tmp3,tmp4]
if let card = model.hkIdentityCard,card.isEmpty == false {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: model.hkIdentityCard ?? "--")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6]
arr.append(tmp5)
arr.append(tmp6)
} else {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp5)
}
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "配偶信息", cellData0: arr)
arrDataForSpouse.append(model1)
arrTemp.append(model1)
}
} else {
......@@ -621,7 +739,7 @@ private extension YHPreviewViewModel {
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "港澳通行证:", answer: model.isHandled == 1 ? "已办理" : "未办理")
let arr = [tmp0,tmp1,tmp2]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息", cellData0: arr)
arrDataForSpouse.append(model1)
arrTemp.append(model1)
}
......@@ -719,14 +837,11 @@ private extension YHPreviewViewModel {
arr.append(tmp16)
}
let model2 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "基本信息", cellData0: arr)
arrDataForSpouse.append(model2)
arrTemp.append(model2)
}
}
}
if model.isFollow() {
//1.跟随 证件信息
do {
......@@ -831,7 +946,7 @@ private extension YHPreviewViewModel {
arr.append(model2)
}
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "证件信息", cellData1: arr)
arrDataForSpouse.append(model3)
arrTemp.append(model3)
}
//2.跟随 证件照
......@@ -850,123 +965,341 @@ private extension YHPreviewViewModel {
}
let model4 = YHPreviewInfoSessionModel(cellType: .idPictureType, cellTitle: "证件照片", cellData2: arr)
arrDataForSpouse.append(model4)
arrTemp.append(model4)
}
}
arrDataForFamilyInfo = arrDataForSpouse
}
arrDataForSpouse = arrTemp
}
//子女 数据
func installDataForChildren() {
//配偶 数据
func installDataForSpouse() {
guard let model = familyInfoPreviewModel?.spouse else {
printLog("error:配偶数据不存在")
return
}
arrDataForSpouse.removeAll()
installDataForSpouseOp(model: model)
}
private func installDataForChildOp(model : YHFamilyMember,childIndex : Int) {
var arrTemp : [YHPreviewInfoSessionModel] = []
do {
if model.follow != 1 {
do {
//随行信息-
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "该子女是否随行至香港:", answer: "否")
//随行信息 -
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "是否随行至香港:", answer: "否")
let arr = [tmp0]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息-否", cellData0: arr)
arrDataForChildren.append(model1)
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息" + String(childIndex + 1), cellData0: arr)
arrTemp.append(model1)
}
do {
//子女信息-否
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "子女姓名:", answer: "子女姓名")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: "曾用名:")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: "婚前姓氏:")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "性别:", answer: "性别")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "否")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "否")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: "否")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: "否")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: "否")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "子女信息-否", cellData0: arr)
arrDataForChildren.append(model1)
//配偶信息-否
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "配偶姓名:", answer: model.subsetName)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: model.usedName.isEmpty ? "--" : model.usedName)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: model.surname.isEmpty ? "--" : model.surname)
let tmp22 = YHPreviewQuestionAndAnswerModel(question: "性别:", answer: String(model.sex))//for test hjl todo
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
var city = ""
if model.birthPlaceAboard == 0 {
//国内
if model.birthPlace.area.count > 1 {
city = "国内 " + model.birthPlace.area[0] + "/" + model.birthPlace.area[1]
} else {
city = "国内 --"
}
} else {
//国外
city = "国外 " + model.birthPlace.foreign
}
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
let tmp44 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: model.married.isEmpty ? "--" : model.married)
let tmp444 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: model.occupation.isEmpty ? "--" : model.occupation)
var arr = [tmp0,tmp1,tmp2,tmp22,tmp3,tmp4,tmp44,tmp444]
if model.occupation != "无职业" {
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: model.occupationName.isEmpty ? "--" : model.occupationName)
arr.append(tmp6)
}
if let card = model.hkIdentityCard,card.isEmpty == false {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: model.hkIdentityCard ?? "--")
arr.append(tmp5)
arr.append(tmp6)
} else {
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp5)
}
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "子女信息" + String(childIndex + 1), cellData0: arr)
arrTemp.append(model1)
}
} else {
do {
//随行信息 - 是
let tmp00 = YHPreviewQuestionAndAnswerModel(question: "主申请人或现配偶是否拥有孩子护养权:", answer: "否")
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "是否随行至香港:", answer: "否")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "国家/国籍:", answer: "中国-China")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "港澳通行证:", answer: "未办理")
let tmp00 = YHPreviewQuestionAndAnswerModel(question: "主申请人或现配偶是否拥有孩子护养权:", answer:model.custody == 1 ? "是" : "否")
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "该子女是否随行至香港:", answer: "是")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "国家/国籍:", answer: model.nationality)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "港澳通行证:", answer: model.isHandled == 1 ? "已办理" : "未办理")
let arr = [tmp00,tmp0,tmp1,tmp2]
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息-是", cellData0: arr)
arrDataForChildren.append(model1)
let model1 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "随行信息" + String(childIndex + 1), cellData0: arr)
arrTemp.append(model1)
}
do {
//基本信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "子女姓名:", answer: "子女姓名")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: "--")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: "--")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: "1990年8月18日")
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: "国内 吉林省/吉林市")
let tmp44 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: "婚姻状况")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: "职业")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: "职业名称")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否拥有学位:", answer: "是否拥有学位")
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "学位证:", answer: "学位证:")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "学位证颁发地区:", answer: "职业名称")
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "是否和主申请人同住:", answer: "职业名称")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "现居住地址:", answer: "职业名称")
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "是否在海外居住满1年及以上:", answer: "职业名称")
let tmp122 = YHPreviewQuestionAndAnswerModel(question: "是否为前次婚姻的子女:", answer: "是否为前次婚姻的子女")
let tmp13 = YHPreviewQuestionAndAnswerModel(question: "目前是否在港:", answer: "职业名称")
let tmp14 = YHPreviewQuestionAndAnswerModel(question: "获准逗留至:", answer: "职业名称")
let tmp15 = YHPreviewQuestionAndAnswerModel(question: "在港身份:", answer: "职业名称")
let tmp16 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "职业名称")
let tmp17 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: "p102987(1)")
let arr = [tmp0,tmp1,tmp2,tmp3,tmp4,tmp44,tmp5,tmp6,tmp7,tmp8,tmp9,tmp10,tmp11,tmp12,tmp122,tmp13,tmp14,tmp15,tmp16,tmp17]
let model2 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "基本信息", cellData0: arr)
arrDataForChildren.append(model2)
//配偶信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "子女姓名:", answer: model.subsetName)
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "曾用名:", answer: model.usedName)
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "婚前姓氏:", answer: model.surname)
let tmp22 = YHPreviewQuestionAndAnswerModel(question: "性别:", answer: String(model.sex)) //for test hjl todo
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "出生日期:", answer: model.birthday)
var city = ""
if model.birthPlaceAboard == 0 {
//国内
if model.birthPlace.area.count > 1 {
city = "国内 " + model.birthPlace.area[0] + "/" + model.birthPlace.area[1]
} else {
city = "国内 --"
}
} else {
//国外
city = "国外 " + model.birthPlace.foreign
}
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "出生城市:", answer: city)
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "婚姻状况:", answer: model.married)
let tmp55 = YHPreviewQuestionAndAnswerModel(question: "职业:", answer: model.occupation)
var arr = [tmp0,tmp1,tmp2,tmp22,tmp3,tmp4,tmp5,tmp55]
if model.occupation != "无职业" {
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "职业名称:", answer: model.occupationName.isEmpty ? "--" : model.occupationName)
arr.append(tmp6)
}
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "是否拥有学位:", answer: model.hasDegree == "1" ? "有学位" : "无学位")
arr.append(tmp7)
if model.hasDegree == "1" {
for(index,item) in model.hasDegreeJson.enumerated() {
let title = "学位证" + String(index + 1) + ":"
let tmp8 = YHPreviewQuestionAndAnswerModel(question: title, answer: item.degree)
arr.append(tmp8)
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "学位证颁发地区:", answer: item.address)
arr.append(tmp9)
}
}
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "是否和主申请人同住:", answer: model.nows == 1 ? "是" : "否")
arr.append(tmp10)
var liveAbord = false //海外
var address = ""
if model.nows == 0 {
var title = ""
if model.address.country.contains("中国") {
//国内
title = "国内 "
if model.address.area.count > 1 {
title = title + model.address.area[0] + "/" + model.address.area[1]
} else {
title = "国内 --"
}
address = model.address.details
} else {
//国外
title = model.address.country
liveAbord = true
address = model.address.foreign
}
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "现居住地址:", answer: title)
arr.append(tmp11)
}
if liveAbord == true {
let title = model.isLiveOverseaYear == 1 ? "是" : "否"
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "是否在海外居住满1年及以上:", answer: title)
arr.append(tmp12)
}
if model.nows == 0 {
let tmp133 = YHPreviewQuestionAndAnswerModel(question: "详细地址:", answer: address)
arr.append(tmp133)
}
let tmp13 = YHPreviewQuestionAndAnswerModel(question: "目前是否在港:", answer: model.hkIdentity.isEmpty == false ? "是" : "否")
arr.append(tmp13)
if model.hkIdentity.isEmpty == false {
let tmp14 = YHPreviewQuestionAndAnswerModel(question: "获准逗留至:", answer: model.childInHk.info)
let tmp15 = YHPreviewQuestionAndAnswerModel(question: "在港身份:", answer: model.hkIdentity == "其他" ? (model.hkIdentityOther.isEmpty ? "其他" : model.hkIdentityOther) : model.hkIdentity)
arr.append(contentsOf: [tmp14,tmp15])
}
if let tmp = model.hkIdentityCard,tmp.isEmpty == false {
let tmp16 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "是")
arr.append(tmp16)
let tmp17 = YHPreviewQuestionAndAnswerModel(question: "香港身份证号码:", answer: tmp)
arr.append(tmp17)
} else {
let tmp16 = YHPreviewQuestionAndAnswerModel(question: "是否办理过香港身份证:", answer: "否")
arr.append(tmp16)
}
let model2 = YHPreviewInfoSessionModel(cellType: .countryInfoType, cellTitle: "子女信息" + String(childIndex + 1), cellData0: arr)
arrTemp.append(model2)
}
}
}
if model.isFollow() {
//1.跟随 证件信息
do {
//证件信息
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "中国身份证号码:", answer: "2203381990287633390")
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
//中国身份证
var str = model.certificates.cnIdentityCard.number
if str.isEmpty {
str = "无"
}
let tmp0 = YHPreviewQuestionAndAnswerModel(question: "中国身份证号码:", answer: str)
str = model.certificates.cnIdentityCard.issueAt
if str.isEmpty {
str = "无"
}
let tmp1 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: str)
str = model.certificates.cnIdentityCard.issueAt
if str.isEmpty {
str = "无"
}
let tmp2 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model.certificates.cnIdentityCard.issueDateEndAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp3 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model0 = YHPersonInfoCellModel1(cellTitle: "中国身份证", cellData: [tmp0,tmp1,tmp2,tmp3])
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "旅行社证件号码:", answer: "c2345639")
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2018-07-17")
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
var arr = [model0]
//港澳通行证
if model.isHandled == 1 {
str = model.certificates.hkMacaoPass.number
if str.isEmpty {
str = "无"
}
let tmp4 = YHPreviewQuestionAndAnswerModel(question: "旅行社证件号码:", answer: str)
str = model.certificates.hkMacaoPass.issueAt
if str.isEmpty {
str = "无"
}
let tmp5 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: str)
str = model.certificates.hkMacaoPass.issueDateEndAt
if str.isEmpty {
str = "无"
}
let tmp6 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model.certificates.hkMacaoPass.issueDateStartAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp7 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model1 = YHPersonInfoCellModel1(cellTitle: "港澳通行证", cellData: [tmp4,tmp5,tmp6,tmp7])
arr.append(model1)
}
if model.nationality != "中国-China" {
//护照及其他旅行证件
var str = String(model.certificates.passport.passPortType)//for test hjl todo
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "证件类别:", answer: str)
str = model.certificates.passport.number
if str.isEmpty {
str = "--"
}
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "证件号码:", answer: str)
let tmp8 = YHPreviewQuestionAndAnswerModel(question: "证件类别:", answer: "护照")
let tmp9 = YHPreviewQuestionAndAnswerModel(question: "证件号码:", answer: "p2345639")
str = model.certificates.passport.issueAt
if str.isEmpty {
str = "无"
}
let tmp10 = YHPreviewQuestionAndAnswerModel(question: "签发地:", answer: "北京市分局")
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: "2028-07-31")
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: "2028-07-31")
let model2 = YHPersonInfoCellModel1(cellTitle: "护照及其他旅行证件", cellData: [tmp8,tmp9,tmp10,tmp11,tmp12])
let arr = [model0,model1,model2]
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "证件信息", cellData1: arr)
arrDataForChildren.append(model3)
str = model.certificates.passport.issueDateStartAt
if str.isEmpty {
str = "无"
}
let tmp11 = YHPreviewQuestionAndAnswerModel(question: "签发日期:", answer: str)
str = model.certificates.passport.issueDateEndAt
if str.isEmpty {
str = "无"
} else {
if str == "8888-01-01" {
str = "至今"
}
}
let tmp12 = YHPreviewQuestionAndAnswerModel(question: "届满日期:", answer: str)
let model2 = YHPersonInfoCellModel1(cellTitle: "护照及其他旅行证件", cellData: [tmp8,tmp9,tmp10,tmp11,tmp12])
arr.append(model2)
}
let model3 = YHPreviewInfoSessionModel(cellType: .idCardInfoType, cellTitle: "证件信息" + String(childIndex + 1), cellData1: arr)
arrTemp.append(model3)
}
//2.跟随 证件照
do {
//证件照片
let model1 = YHPersonInfoCellModel2(cellTitle: "中国身份证",frontUrl: "", backUrl: "", idType: 1)
let model2 = YHPersonInfoCellModel2(cellTitle: "港澳通行证",frontUrl: "", backUrl: "", idType: 2)
let front = model.certificates.cnIdentityCard.imgFront
let back = model.certificates.cnIdentityCard.imgBack
let model1 = YHPersonInfoCellModel2(cellTitle: "中国身份证",frontUrl: front, backUrl: back, idType: 1)
var arr = [model1]
let arr = [model1,model2]
let model4 = YHPreviewInfoSessionModel(cellType: .idPictureType, cellTitle: "证件照片", cellData2: arr)
arrDataForChildren.append(model4)
if model.isHandled == 1 {
let front = model.certificates.hkMacaoPass.imgFront
let back = model.certificates.hkMacaoPass.imgBack
let model2 = YHPersonInfoCellModel2(cellTitle: "港澳通行证",frontUrl: front, backUrl: back, idType: 2)
arr.append(model2)
}
let model4 = YHPreviewInfoSessionModel(cellType: .idPictureType, cellTitle: "证件照片" + String(childIndex + 1), cellData2: arr)
arrTemp.append(model4)
}
arrDataForFamilyInfo = arrDataForChildren
}
arrDataForChildren.append(contentsOf: arrTemp)
}
//子女 数据
func installDataForChildren() {
guard let model1 = familyInfoPreviewModel?.child else {
return
}
arrDataForChildren.removeAll()
for(index,model) in model1.enumerated() {
installDataForChildOp(model: model, childIndex:index)
}
}
//兄弟姐妹 数据
func installDataForBrother() {
......@@ -1021,6 +1354,5 @@ private extension YHPreviewViewModel {
arrDataForBrother.append(model1)
}
}
arrDataForFamilyInfo = arrDataForBrother
}
}
......@@ -134,9 +134,14 @@ extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDa
}
cell.clickBlock = {[weak self] model in
guard let self = self else { return }
let firstModel = self.dataSource?.first
let vc = YHWorkExperienceViewController()
vc.workExperienceID = "\(model.id ?? 0)"
vc.orderID = self.orderId
vc.isShowMessageSelect = true
if firstModel?.id == model.id {
vc.isShowMessageSelect = false
}
self.navigationController?.pushViewController(vc, animated: true)
}
cell.deleteBlock = {[weak self] model in
......@@ -152,10 +157,15 @@ extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDa
}
cell.newWorkBlock = {[weak self] in
guard let self = self else { return }
if self.dataSource?.count == 10 {
YHHUD.flash(message: "新增工作经历不能超过10条")
} else {
let vc = YHWorkExperienceViewController()
vc.isShowMessageSelect = true
vc.orderID = self.orderId
self.navigationController?.pushViewController(vc, animated: true)
}
}
cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear
return cell
......
......@@ -9,17 +9,18 @@
import UIKit
class YHWorkExperienceViewController: YHBaseViewController {
var stepView: YHStepView!
var bottomView: YHBottomNextView!
var tableView: UITableView!
var viewModel: YHWorkExperienceViewModel!
var baseDataSource: [YHSectionWorkExperienceModel]?
var introductionDataSource: [YHWorkExperienceProjectModel]?
var fileDataSource: [String]?
var fileDataSource: [YHWorkExperienceFileModel]?
var workExperienceID: String?
var orderID: Int = 0
var isMore: Bool = false
var isShowPrompt: Bool = false
var isShowMessageSelect: Bool = true
override func viewDidLoad() {
super.viewDidLoad()
......@@ -27,6 +28,8 @@ class YHWorkExperienceViewController: YHBaseViewController {
gk_navTitle = "工作经验信息填写"
setView()
getData()
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardDidShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardDidHideNotification, object: nil)
// Do any additional setup after loading the view.
}
......@@ -37,10 +40,17 @@ class YHWorkExperienceViewController: YHBaseViewController {
viewModel.requestWorkDetail(workExperienceID ?? "") {[weak self] success, error in
guard let self = self else { return }
self.stepView.currentIndex = self.viewModel.mainModel.step
self.stepView.maxIndex = self.viewModel.mainModel.step
self.updateDataSource()
if self.viewModel.mainModel.is_project_introduction == 1 {
self.stepView.dataSource = ["基本信息", "工作职责", "工作亮点", "项目介绍", "简历/工作总结"]
} else {
self.stepView.dataSource = ["基本信息", "工作职责", "工作亮点", "简历/工作总结"]
}
self.viewModel.requestWorkInfoProject("\(self.viewModel.mainModel.id )") {[weak self] success, error in
guard let self = self else { return }
self.introductionDataSource = success
self.fileDataSource = self.viewModel.mainModel.file
self.updateDataSource()
}
}
......@@ -49,7 +59,7 @@ class YHWorkExperienceViewController: YHBaseViewController {
func updateDataSource() {
if self.stepView.currentIndex == 0 {
self.baseDataSource = self.viewModel.getBaseDataSource()
self.baseDataSource = self.viewModel.getBaseDataSource(isShowPrompt)
}
self.tableView.reloadData()
}
......@@ -57,7 +67,7 @@ class YHWorkExperienceViewController: YHBaseViewController {
func setView() {
stepView = {
let step = YHStepView()
step.dataSource = ["基本信息", "工作职责", "工作亮点", "项目介绍", "简历/工作总结"]
step.dataSource = ["基本信息", "工作职责", "工作亮点", "简历/工作总结"]
step.contentSize = CGSize(width: KScreenWidth * 1.2, height: 104)
step.showsHorizontalScrollIndicator = false
step.showsVerticalScrollIndicator = false
......@@ -102,16 +112,37 @@ class YHWorkExperienceViewController: YHBaseViewController {
let bottom = YHBottomNextView()
bottom.nextblock = { [weak self] in
guard let self = self else { return }
self.viewModel.saveWorkDetail(1, orderID: self.orderID, callBackBlock: {[weak self] flag, model in
if self.viewModel.isCanNext(self.stepView.currentIndex) {
self.viewModel.mainModel.step = self.stepView.currentIndex
self.viewModel.saveWorkDetail(1, orderID: self.orderID, callBackBlock: {[weak self] flag, error in
guard let self = self else { return }
if let error = error {
YHHUD.flash(message: error.errorMsg )
} else {
if self.stepView.currentIndex == 4 || (self.stepView.currentIndex == 3 && self.viewModel.mainModel.is_project_introduction == 0) {
YHHUD.flash(message: "提交成功")
self.navigationController?.popViewController()
} else {
self.stepView.currentIndex = self.stepView.currentIndex + 1
self.updateDataSource()
}
}
})
} else {
self.isShowPrompt = true
self.updateDataSource()
YHHUD.flash(message: "您还有信息未填写")
}
}
bottom.saveBlock = { [weak self] in
guard let self = self else { return }
self.viewModel.saveWorkDetail(0, orderID: self.orderID, callBackBlock: {[weak self] flag, model in
guard self != nil else { return }
self.viewModel.saveWorkDetail(0, orderID: self.orderID, callBackBlock: {[weak self] flag, error in
guard let self = self else { return }
if let error = error {
YHHUD.flash(message: error.errorMsg )
} else {
YHHUD.flash(message: "保存成功")
}
})
}
return bottom
......@@ -123,12 +154,55 @@ class YHWorkExperienceViewController: YHBaseViewController {
}
}
@objc func keyboardWillShow(_ notification: Notification) {
// 当键盘将要显示时调用此函数
stepView.snp.remakeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.height.equalTo(0)
}
stepView.isHidden = true
tableView.snp.remakeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.bottom.equalTo(view)
}
}
@objc func keyboardWillHide(_ notification: Notification) {
// 当键盘将要隐藏时调用此函数
stepView.snp.remakeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.height.equalTo(104)
}
stepView.isHidden = false
tableView.snp.remakeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + YHStepView.height)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.bottom.equalTo(view)
}
}
deinit {
NotificationCenter.default.removeObserver(self)
}
}
extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if stepView.currentIndex == 1 || stepView.currentIndex == 2 || stepView.currentIndex == 3 {
if stepView.currentIndex == 1 || stepView.currentIndex == 2 {
return 1
}
if stepView.currentIndex == 3 {
if self.viewModel.mainModel.is_project_introduction == 1 {
return 1
} else {
if viewModel.mainModel.not_need_upload_file == 1 {
return 1
}
return 2
}
}
if stepView.currentIndex == 4 {
if viewModel.mainModel.not_need_upload_file == 1 {
......@@ -160,6 +234,33 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
cell.messageBlock = {[weak self] message in
self?.viewModel.updateWduty(message)
}
cell.photoBlock = {[weak self] in
guard let self = self else { return }
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
YHHUD.show(.progress(message: ""))
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.requestFileMessage(url) {[weak self] success, model, error in
guard let self = self else { return }
if success {
YHHUD.hide()
self.viewModel.mainModel.wduty = model?.content ?? ""
cell.dataSource = viewModel.mainModel.wduty
} else {
YHHUD.hide()
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
}
}
}
}
return cell
} else if stepView.currentIndex == 2 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkHighlightsTableViewCell.self)
......@@ -183,9 +284,42 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
}
cell.switchBlock = {[weak self] isOn in
self?.viewModel.updateIsProjectIntroduction(isOn: isOn)
if isOn {
self?.stepView.dataSource = ["基本信息", "工作职责", "工作亮点", "项目介绍", "简历/工作总结"]
} else {
self?.stepView.dataSource = ["基本信息", "工作职责", "工作亮点", "简历/工作总结"]
}
}
cell.photoBlock = {[weak self] in
guard let self = self else { return }
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
YHHUD.show(.progress(message: ""))
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.requestFileMessage(url) {[weak self] success, model, error in
guard let self = self else { return }
if success {
YHHUD.hide()
self.viewModel.mainModel.highlights = model?.content ?? ""
cell.dataSource = viewModel.mainModel.highlights
} else {
YHHUD.hide()
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
}
}
}
}
return cell
} else if stepView.currentIndex == 3 {
if self.viewModel.mainModel.is_project_introduction == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkIntroductionTableViewCell.self)
cell.dataSource = introductionDataSource
if isMore {
......@@ -226,6 +360,56 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
self.navigationController?.pushViewController(vc, animated: true)
}
return cell
} else {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkMessageSelectTableViewCell.self)
cell.dataSource = viewModel.mainModel.not_need_upload_file
cell.isNeedFileBlock = { [weak self] value in
guard let self = self else { return }
self.viewModel.updateNotNeedUploadFile(value: value)
self.tableView.reloadData()
}
cell.isHidden = !self.isShowMessageSelect
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHWorkFileSyncTableViewCell.self)
cell.dataSource = fileDataSource
cell.addIntroductionBlock = { [weak self] in
guard let self = self else { return }
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
YHHUD.show(.progress(message: ""))
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
let timestamp = Date().timeIntervalSince1970
let model = YHWorkExperienceFileModel()
model.fileUrl = success ?? ""
model.fileName = "\(UInt64(timestamp))" + ".jpg"
self.fileDataSource?.append(model)
self.viewModel.mainModel.file = self.fileDataSource ?? []
self.tableView.reloadData()
YHHUD.hide()
}
}
}
cell.experienceListBlock = {[weak self] model, type in
guard let self = self else { return }
if type == .delete {
for i in 0..<(self.fileDataSource?.count ?? 0) {
let data = self.fileDataSource?[i]
if data?.fileName == model.fileName {
self.fileDataSource?.remove(at: i)
self.tableView.reloadData()
self.viewModel.mainModel.file = self.fileDataSource ?? []
return
}
}
}
}
return cell
}
}
} else if stepView.currentIndex == 4 {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHWorkMessageSelectTableViewCell.self)
......@@ -235,9 +419,44 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
self.viewModel.updateNotNeedUploadFile(value: value)
self.tableView.reloadData()
}
cell.isHidden = !self.isShowMessageSelect
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHWorkFileSyncTableViewCell.self)
cell.dataSource = fileDataSource
cell.addIntroductionBlock = { [weak self] in
guard let self = self else { return }
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
YHHUD.show(.progress(message: ""))
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
let timestamp = Date().timeIntervalSince1970
let model = YHWorkExperienceFileModel()
model.fileUrl = success ?? ""
model.fileName = "\(UInt64(timestamp))" + ".jpg"
self.fileDataSource?.append(model)
self.viewModel.mainModel.file = self.fileDataSource ?? []
self.tableView.reloadData()
YHHUD.hide()
}
}
}
cell.experienceListBlock = {[weak self] model, type in
guard let self = self else { return }
if type == .delete {
for i in 0..<(self.fileDataSource?.count ?? 0) {
let data = self.fileDataSource?[i]
if data?.fileName == model.fileName {
self.fileDataSource?.remove(at: i)
self.tableView.reloadData()
self.viewModel.mainModel.file = self.fileDataSource ?? []
return
}
}
}
}
return cell
}
} else {
......@@ -246,8 +465,11 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
cell.workExperienceBlock = {[weak self] model in
guard let self = self else { return }
self.viewModel.updateModel(model)
let id = model.id
if id != .id1 && id != .id3 && id != .id4 && id != .id7 && id != .id8 && id != .id12 && id != .id14 && id != .id17 && id != .id17 && id != .id18 {
self.updateDataSource()
}
}
return cell
}
}
......@@ -256,20 +478,39 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
if stepView.currentIndex == 1 || stepView.currentIndex == 2 {
return KScreenHeight - k_Height_NavigationtBarAndStatuBar - YHStepView.height - k_Height_safeAreaInsetsBottom() - 64
} else if stepView.currentIndex == 3 {
if self.viewModel.mainModel.is_project_introduction == 1 {
let number = introductionDataSource?.count ?? 0
return CGFloat(76 * number + 161)
} else {
if indexPath.row == 0 {
if self.isShowMessageSelect {
return 166
} else {
return 0
}
} else {
let count = fileDataSource?.count ?? 0
return CGFloat(52 * count + 145)
}
}
} else if stepView.currentIndex == 4 {
if indexPath.row == 0 {
if self.isShowMessageSelect {
return 166
} else {
return 0
}
} else {
let count = fileDataSource?.count ?? 0
return CGFloat(52 * count + 138)
return CGFloat(52 * count + 145)
}
} else {
let array = baseDataSource?[indexPath.row].models ?? []
var h = 0
for i in 0..<array.count {
let data = array[i]
let message = data.message ?? ""
let isShow = data.isShowPrompts ?? false
if data.id == .id3 || data.id == .id4 || data.id == .id18 {
h = h + 132
} else if data.id == .id13 {
......@@ -277,6 +518,9 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
} else {
h = h + 52
}
if isShow && message.count == 0 {
h = h + 20
}
}
return CGFloat(h + 52 + 14)
}
......
......@@ -19,7 +19,7 @@ class YHWorkIntroductionViewController: YHBaseViewController {
var actionView: YHWorkActionView!
var bottomView: UIView!
var bottomButton: UIButton!
var viewModel: YHWorkIntroductionViewModel?
var viewModel: YHWorkIntroductionViewModel!
var workModel: YHWorkExperienceDetailModel?
var dataSource: YHWorkExperienceProjectModel = YHWorkExperienceProjectModel()
......@@ -201,6 +201,33 @@ class YHWorkIntroductionViewController: YHBaseViewController {
vc.modalPresentationStyle = .pageSheet
self.navigationController?.present(vc, animated: true)
}
view.photoBlock = {[weak self] in
guard let self = self else { return }
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
YHHUD.show(.progress(message: "加载中"))
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.viewModel.requestFileMessage(url) {[weak self] success, model, error in
guard let self = self else { return }
if success {
YHHUD.hide()
self.dataSource.project_highlights = model?.content
self.messageTextField.text = model?.content
} else {
YHHUD.hide()
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
}
}
}
}
return view
}()
view.addSubview(actionView)
......@@ -241,6 +268,22 @@ class YHWorkIntroductionViewController: YHBaseViewController {
}
@objc func submit() {
guard let _ = dataSource.project_name else {
YHHUD.flash(message: "您还有信息未填写")
return
}
guard let _ = dataSource.project_start_time else {
YHHUD.flash(message: "您还有信息未填写")
return
}
guard let _ = dataSource.project_end_time else {
YHHUD.flash(message: "您还有信息未填写")
return
}
guard let _ = dataSource.project_highlights else {
YHHUD.flash(message: "您还有信息未填写")
return
}
viewModel?.saveWorkProjectDetail(workModel ?? YHWorkExperienceDetailModel(), projectModel: dataSource, callBackBlock: {[weak self] success, error in
guard let self = self else { return }
if let block = self.saveBlock {
......@@ -282,6 +325,12 @@ extension YHWorkIntroductionViewController: UITextViewDelegate {
promptsLabel.isHidden = false
}
}
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
let newLength = (textView.text as NSString).length + text.count - range.length
return newLength <= 2000
}
}
extension YHWorkIntroductionViewController: UITextFieldDelegate {
......
......@@ -15,3 +15,7 @@ class YHWorkExampleModel: YHBaseModel {
var highlights_list: [String]?
var template: [String]?
}
class YHFileContent:YHBaseModel {
var content: String?
}
......@@ -36,7 +36,7 @@ class YHWorkExperienceDetailModel: YHBaseModel {
var is_executives: Int = 0
var wduty: String = ""
var highlights: String = ""
var file: [String] = []
var file: [YHWorkExperienceFileModel] = []
var not_need_upload_file: Int = 0
var company_member_total: Int = 0
var administrative_level: Int = 0
......@@ -59,3 +59,8 @@ class YHWorkExperienceDetailModel: YHBaseModel {
var customer_center_id: Int = 0
var projects: [String] = []
}
class YHWorkExperienceFileModel: YHBaseModel {
var fileName: String = ""
var fileUrl: String = ""
}
......@@ -58,8 +58,10 @@ struct YHWorkExperienceModel {
var rightButtonString: String?
var type: YHWorkExperienceSelectType?
var value: [String]?
var isShowPrompts: Bool?
var alertMessage: String?
init(id: YHWorkExperienceID? = nil, isNeed: Bool? = nil, title: String? = nil, isUserKeyBoard: Bool? = nil, prompts: String? = nil, message: String? = nil, leftButtonString: String? = nil, rightButtonString: String? = nil, type: YHWorkExperienceSelectType? = nil, value: [String]? = nil) {
init(id: YHWorkExperienceID? = nil, isNeed: Bool? = nil, title: String? = nil, isUserKeyBoard: Bool? = nil, prompts: String? = nil, message: String? = nil, leftButtonString: String? = nil, rightButtonString: String? = nil, type: YHWorkExperienceSelectType? = nil, value: [String]? = nil, isShowPrompts: Bool? = nil, alertMessage: String? = nil) {
self.id = id
self.isNeed = isNeed
self.title = title
......@@ -70,6 +72,8 @@ struct YHWorkExperienceModel {
self.rightButtonString = rightButtonString
self.type = type
self.value = value
self.isShowPrompts = isShowPrompts
self.alertMessage = alertMessage
}
}
......
......@@ -10,9 +10,11 @@ import UIKit
class YHWorkActionView: UIView {
typealias ExampleBlock = () -> ()
typealias PhotoBlock = () -> ()
var exampleBlock: ExampleBlock?
var photoBlock: PhotoBlock?
var photoButton: UIButton!
var wxButton: UIButton!
// var wxButton: UIButton!
var exampleButton: UIButton!
override init(frame: CGRect) {
......@@ -40,18 +42,18 @@ class YHWorkActionView: UIView {
make.height.width.equalTo(21)
}
wxButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "work_experience_wx"), for: .normal)
button.addTarget(self, action: #selector(wxClick), for: .touchUpInside)
return button
}()
addSubview(wxButton)
wxButton.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(49)
make.height.width.equalTo(21)
}
// wxButton = {
// let button = UIButton(type: .custom)
// button.setBackgroundImage(UIImage(named: "work_experience_wx"), for: .normal)
// button.addTarget(self, action: #selector(wxClick), for: .touchUpInside)
// return button
// }()
// addSubview(wxButton)
// wxButton.snp.makeConstraints { make in
// make.centerY.equalToSuperview()
// make.left.equalTo(49)
// make.height.width.equalTo(21)
// }
exampleButton = {
let button = UIButton(type: .custom)
......@@ -76,7 +78,9 @@ class YHWorkActionView: UIView {
}
@objc func photoClick() {
if let block = photoBlock {
block()
}
}
@objc func wxClick() {
......
......@@ -17,6 +17,7 @@ class YHWorkExperienceItemView: UIView {
var centerButton: UIButton!
var leftButton: UIButton!
var rightButton: UIButton!
var showPromptLabel: UILabel!
var dataSource: YHWorkExperienceModel? {
didSet {
......@@ -48,6 +49,8 @@ class YHWorkExperienceItemView: UIView {
messageTextField = {
let textField = UITextField()
textField.delegate = self
textField.textColor = UIColor.mainTextColor
textField.font = UIFont.PFSC_M(ofSize: 14)
return textField
}()
addSubview(messageTextField)
......@@ -56,6 +59,19 @@ class YHWorkExperienceItemView: UIView {
make.left.equalTo(112)
}
showPromptLabel = {
let label = UILabel()
label.textColor = UIColor.red
label.font = UIFont.PFSC_M(ofSize: 12)
return label
}()
addSubview(showPromptLabel)
showPromptLabel.snp.makeConstraints { make in
make.left.equalTo(messageTextField.snp.left)
make.height.equalTo(20)
make.right.bottom.equalToSuperview()
}
nextStepImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "form_right_arrow")
......@@ -117,7 +133,6 @@ class YHWorkExperienceItemView: UIView {
make.height.equalTo(32)
make.width.equalTo(74)
}
}
func updateAllViews() {
......@@ -143,6 +158,10 @@ class YHWorkExperienceItemView: UIView {
}
messageTextField.placeholder = dataSource.prompts
messageTextField.text = dataSource.message
if dataSource.message == "0" {
messageTextField.text = ""
}
showPromptLabel.text = dataSource.alertMessage
if dataSource.isUserKeyBoard ?? false {
nextStepImageView.isHidden = true
centerButton.isHidden = true
......@@ -207,6 +226,16 @@ class YHWorkExperienceItemView: UIView {
} else {
rightButton.isHidden = true
}
if dataSource.isShowPrompts ?? false {
if dataSource.message?.count != 0 && dataSource.message != "0" {
showPromptLabel.isHidden = true
} else {
showPromptLabel.isHidden = false
}
} else {
showPromptLabel.isHidden = true
}
}
func buttonState(isLeft: Bool) {
......@@ -266,6 +295,7 @@ class YHWorkExperienceItemView: UIView {
}
@objc func centerClick() {
UIViewController.current?.view.endEditing(true) // 收起键盘
guard let type = dataSource?.type else { return }
switch type {
case .normal:
......@@ -362,9 +392,32 @@ class YHWorkExperienceItemView: UIView {
extension YHWorkExperienceItemView: UITextFieldDelegate {
func textFieldDidEndEditing(_ textField: UITextField) {
dataSource?.message = textField.text
}
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if (dataSource?.id == .id1 || dataSource?.id == .id7 || dataSource?.id == .id8 || dataSource?.id == .id12 || dataSource?.id == .id14 || dataSource?.id == .id16 || dataSource?.id == .id18) && newText.count > 100 {
return false
}
if dataSource?.id == .id3 && newText.count > 2000 {
return false
}
if dataSource?.id == .id4 && newText.count > 500 {
return false
}
if dataSource?.id == .id17 && newText.count > 10 {
return false
}
var data = dataSource ?? YHWorkExperienceModel()
data.message = newText
if let block = block {
block(dataSource ?? YHWorkExperienceModel())
block(data)
}
return true
}
}
......@@ -99,8 +99,13 @@ class YHWorkExperienceTableViewCell: UITableViewCell {
}
y = y + 1
let data = dataSource?.models?[i]
let isShow = data?.isShowPrompts ?? false
let message = data?.message ?? ""
if data?.id == .id3 || data?.id == .id4 || data?.id == .id18 {
var h = 131
if isShow && message.count == 0 {
h = h + 20
}
let itemView = YHWorkExperienceTextItemView()
itemView.dataSource = data
itemView.block = {[weak self] model in
......@@ -113,15 +118,18 @@ class YHWorkExperienceTableViewCell: UITableViewCell {
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(y)
make.height.equalTo(131)
make.height.equalTo(h)
make.right.equalTo(-18)
}
y = y + 131
y = y + h
} else {
var h = 51
if data?.id == .id13 {
h = 71
}
if isShow && message.count == 0 {
h = h + 20
}
let itemView = YHWorkExperienceItemView()
itemView.dataSource = data
itemView.block = {[weak self] model in
......
......@@ -8,13 +8,18 @@
import UIKit
enum YHWorkFileClickType {
case delete
case click
}
class YHWorkFileItemView: UIView {
typealias ItemBlock = (_ model: YHItemModel) -> ()
typealias ItemBlock = (_ model: YHWorkExperienceFileModel, _ type: YHWorkFileClickType) -> ()
var block: ItemBlock?
var titleLabel: UILabel!
var titleLabel: UIButton!
var deleteButton: UIButton!
var dataSource: YHWorkItemListModel? {
var dataSource: YHWorkExperienceFileModel? {
didSet {
updateAllViews()
}
......@@ -31,10 +36,11 @@ class YHWorkFileItemView: UIView {
func setUpView() {
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.textAlignment = .left
label.textColor = UIColor.mainTextColor
let label = UIButton(type: .custom)
label.setTitleColor(UIColor.mainTextColor, for: .normal)
label.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
label.addTarget(self, action: #selector(itemClick), for: .touchUpInside)
label.contentHorizontalAlignment = .left
return label
}()
addSubview(titleLabel)
......@@ -48,11 +54,10 @@ class YHWorkFileItemView: UIView {
deleteButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.contentHorizontalAlignment = .center
button.contentHorizontalAlignment = .right
button.setTitle("删除", for: .normal)
button.setTitleColor( UIColor.failColor, for: .normal)
button.setTitleColor(.red, for: .normal)
button.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
button.isHidden = true
return button
}()
addSubview(deleteButton)
......@@ -66,10 +71,18 @@ class YHWorkFileItemView: UIView {
func updateAllViews() {
guard let dataSource = dataSource else { return }
titleLabel.setTitle(dataSource.fileName, for: .normal)
}
@objc func itemClick() {
if let block = block, let dataSource = dataSource {
block(dataSource, .click)
}
}
@objc func deleteClick() {
if let block = block, let dataSource = dataSource {
block(dataSource, .delete)
}
}
}
......@@ -10,7 +10,7 @@ import UIKit
class YHWorkFileSyncTableViewCell: UITableViewCell {
typealias ExperienceListBlock = (_ model: YHItemModel) -> ()
typealias ExperienceListBlock = (_ model: YHWorkExperienceFileModel, _ type: YHWorkFileClickType) -> ()
typealias AddIntroductionBlock = () -> ()
var experienceListBlock: ExperienceListBlock?
var addIntroductionBlock: AddIntroductionBlock?
......@@ -18,7 +18,7 @@ class YHWorkFileSyncTableViewCell: UITableViewCell {
var titleLabel: UILabel!
var mainItemView: UIView!
var bottomView: YHWorkItemAddView!
var dataSource: [YHWorkItemListModel]?{
var dataSource: [YHWorkExperienceFileModel]?{
didSet {
updateAllViews()
}
......@@ -91,7 +91,7 @@ class YHWorkFileSyncTableViewCell: UITableViewCell {
mainItemView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalTo(-65)
make.top.equalTo(85)
make.top.equalTo(52)
}
bottomView = {
......@@ -127,10 +127,10 @@ class YHWorkFileSyncTableViewCell: UITableViewCell {
}
let itemView = YHWorkFileItemView()
itemView.dataSource = dataSource?[i]
itemView.block = {[weak self] model in
itemView.block = {[weak self] model, type in
guard let self = self else { return }
if let block = self.experienceListBlock {
block(model)
block(model, type)
}
}
mainItemView.addSubview(itemView)
......
......@@ -13,6 +13,7 @@ class YHWorkHighlightsTableViewCell: UITableViewCell {
typealias MessageBlock = (_ message: String) -> ()
typealias SwitchBlock = (_ isOn: Bool) -> ()
var exampleBlock: ExampleBlock?
var photoBlock: ExampleBlock?
var messageBlock: MessageBlock?
var switchBlock: SwitchBlock?
var centerView: UIView!
......@@ -179,6 +180,12 @@ class YHWorkHighlightsTableViewCell: UITableViewCell {
block()
}
}
view.photoBlock = {[weak self] in
guard let self = self else { return }
if let block = self.photoBlock {
block()
}
}
return view
}()
centerView.addSubview(bottomView)
......@@ -225,4 +232,9 @@ extension YHWorkHighlightsTableViewCell: UITextViewDelegate {
block(textView.text ?? "")
}
}
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
let newLength = (textView.text as NSString).length + text.count - range.length
return newLength <= 2000
}
}
......@@ -19,9 +19,9 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell {
var rightButton: UIButton!
var dataSource: Int?{
didSet {
var flag = true
var flag = false
if dataSource == 1 {
flag = false
flag = true
}
buttonState(isLeft: flag)
}
......@@ -158,14 +158,6 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell {
func buttonState(isLeft: Bool) {
if isLeft {
leftButton.isSelected = true
rightButton.isSelected = false
leftButton.layer.borderWidth = 1
leftButton.layer.borderColor = UIColor(hex: 0x2f7ef6).cgColor
leftButton.backgroundColor = UIColor(hex: 0x2f7ef6).withAlphaComponent(0.08)
rightButton.backgroundColor = UIColor.contentBkgColor
rightButton.layer.borderWidth = 0
} else {
rightButton.isSelected = true
leftButton.isSelected = false
rightButton.layer.borderWidth = 1
......@@ -173,6 +165,14 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell {
rightButton.backgroundColor = UIColor(hex: 0x2f7ef6).withAlphaComponent(0.08)
leftButton.backgroundColor = UIColor.contentBkgColor
leftButton.layer.borderWidth = 0
} else {
leftButton.isSelected = true
rightButton.isSelected = false
leftButton.layer.borderWidth = 1
leftButton.layer.borderColor = UIColor(hex: 0x2f7ef6).cgColor
leftButton.backgroundColor = UIColor(hex: 0x2f7ef6).withAlphaComponent(0.08)
rightButton.backgroundColor = UIColor.contentBkgColor
rightButton.layer.borderWidth = 0
}
}
......
......@@ -11,6 +11,7 @@ import UIKit
class YHWorkResponsibilitiesTableViewCell: UITableViewCell {
typealias ExampleBlock = () -> ()
typealias MessageBlock = (_ message: String) -> ()
var photoBlock: ExampleBlock?
var exampleBlock: ExampleBlock?
var messageBlock: MessageBlock?
var centerView: UIView!
......@@ -146,6 +147,13 @@ class YHWorkResponsibilitiesTableViewCell: UITableViewCell {
block()
}
}
view.photoBlock = {[weak self] in
guard let self = self else { return }
if let block = self.photoBlock {
block()
}
}
return view
}()
centerView.addSubview(bottomView)
......@@ -176,4 +184,10 @@ extension YHWorkResponsibilitiesTableViewCell: UITextViewDelegate {
block(textView.text ?? "")
}
}
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
let newLength = (textView.text as NSString).length + text.count - range.length
return newLength <= 2000
}
}
......@@ -7,6 +7,7 @@
//
import UIKit
import Alamofire
class YHWorkExperienceViewModel: YHBaseViewModel {
var mainModel: YHWorkExperienceDetailModel = YHWorkExperienceDetailModel()
......@@ -16,24 +17,24 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
super.init()
}
func getBaseDataSource() -> [YHSectionWorkExperienceModel] {
let item = YHWorkExperienceModel(id: .id1, isNeed: true, title: "用人单位", isUserKeyBoard: false, prompts: "请输入", message: mainModel.company_name , type: .unit)
let item1 = YHWorkExperienceModel(id: .id2, isNeed: true, title: "用人单位性质", isUserKeyBoard: false, prompts: "请输入", message: mainModel.industry, type: .nature)
func getBaseDataSource(_ isShowPrompt: Bool) -> [YHSectionWorkExperienceModel] {
let item = YHWorkExperienceModel(id: .id1, isNeed: true, title: "用人单位", isUserKeyBoard: false, prompts: "请输入", message: mainModel.company_name , type: .unit, isShowPrompts: isShowPrompt, alertMessage:"请输入用人单位")
let item1 = YHWorkExperienceModel(id: .id2, isNeed: true, title: "用人单位性质", isUserKeyBoard: false, prompts: "请输入", message: mainModel.industry, type: .nature, isShowPrompts: isShowPrompt, alertMessage:"请选择用人单位性质")
let item2 = YHWorkExperienceModel(id: .id3, isNeed: false, title: "用人单位介绍", isUserKeyBoard: true, prompts: "如方便提供,请填写", message: mainModel.company_introduce)
let item3 = YHWorkExperienceModel(id: .id4, isNeed: false, title: "用人单位官网", isUserKeyBoard: true, prompts: "如有,请输入官网链接", message: mainModel.company_website)
let item4 = YHWorkExperienceModel(id: .id5, isNeed: true, title: "出生国家/地区", isUserKeyBoard: false, prompts: nil, message: mainModel.location.country, type: .country)
let item4 = YHWorkExperienceModel(id: .id5, isNeed: true, title: "出生国家/地区", isUserKeyBoard: false, prompts: nil, message: mainModel.location.country, type: .country, isShowPrompts: isShowPrompt, alertMessage:"请选择工作国家/地区")
var string = ""
let array = mainModel.location.area
for item in array {
string = string + item
}
let item5 = YHWorkExperienceModel(id: .id6, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address)
let item55 = YHWorkExperienceModel(id: .id7, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.location.foreign)
let item6 = YHWorkExperienceModel(id: .id8, isNeed: true, title: "职位", isUserKeyBoard: true, prompts: "请输入", message: mainModel.position)
let item7 = YHWorkExperienceModel(id: .id9, isNeed: true, title: "入职年月", isUserKeyBoard: false, prompts: "请选择", message: mainModel.entry_time, type: .time)
let item8 = YHWorkExperienceModel(id: .id10, isNeed: true, title: "离职年月", isUserKeyBoard: false, prompts: "请选择", message: mainModel.departure_time, type: .time)
let item9 = YHWorkExperienceModel(id: .id11, isNeed: true, title: "工作证明文件", isUserKeyBoard: false, prompts: "请选择", message: mainModel.work_certificate, type: .certificate)
let item10 = YHWorkExperienceModel(id: .id12, isNeed: false, title: "职责性质", isUserKeyBoard: true, prompts: "请选择", message: mainModel.duty)
let item5 = YHWorkExperienceModel(id: .id6, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt, alertMessage:"请选择工作国家/地区")
let item55 = YHWorkExperienceModel(id: .id7, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.location.foreign, isShowPrompts: isShowPrompt, alertMessage:"请输入工作国家/地区")
let item6 = YHWorkExperienceModel(id: .id8, isNeed: true, title: "职位", isUserKeyBoard: true, prompts: "请输入", message: mainModel.position, isShowPrompts: isShowPrompt, alertMessage:"请输入职位")
let item7 = YHWorkExperienceModel(id: .id9, isNeed: true, title: "入职年月", isUserKeyBoard: false, prompts: "请选择", message: mainModel.entry_time, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择入职年月")
let item8 = YHWorkExperienceModel(id: .id10, isNeed: true, title: "离职年月", isUserKeyBoard: false, prompts: "请选择", message: mainModel.departure_time, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择离职年月")
let item9 = YHWorkExperienceModel(id: .id11, isNeed: true, title: "工作证明文件", isUserKeyBoard: false, prompts: "请选择", message: mainModel.work_certificate, type: .certificate, isShowPrompts: isShowPrompt, alertMessage:"请选择工作证明文件")
let item10 = YHWorkExperienceModel(id: .id12, isNeed: false, title: "职责性质", isUserKeyBoard: true, prompts: "请选择", message: mainModel.duty, isShowPrompts: isShowPrompt, alertMessage:"请输入职责性质")
let item11 = YHWorkExperienceModel(id: .id13, isNeed: false, title: "相关工作经验是否属于国际工作经验", isUserKeyBoard: false, prompts: "", message: "\(mainModel.international_work_experience)", leftButtonString: "是", rightButtonString: "否")
let addressCountry = mainModel.location.country
var section = YHSectionWorkExperienceModel()
......@@ -43,15 +44,15 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
section = YHSectionWorkExperienceModel(title: "企业信息", models: [item, item1, item2, item3, item4, item55, item6, item7, item8, item9, item10, item11])
}
let item12 = YHWorkExperienceModel(id: .id14, isNeed: true, title: "企业人数规模", isUserKeyBoard: true, prompts: "请输入", message: "\(mainModel.company_member_total)")
let item12 = YHWorkExperienceModel(id: .id14, isNeed: true, title: "企业人数规模", isUserKeyBoard: true, prompts: "请输入", message: "\(mainModel.company_member_total)", isShowPrompts: isShowPrompt, alertMessage:"请输入企业人数规模")
let item13 = YHWorkExperienceModel(id: .id15, isNeed: false, title: "行政架构层级", isUserKeyBoard: false, prompts: "请输入", message: "\(mainModel.administrative_level)", type: .structure)
let item14 = YHWorkExperienceModel(id: .id16, isNeed: true, title: "下属管理人数", isUserKeyBoard: true, prompts: "请输入", message: "\(mainModel.company_manage_total)")
let item14 = YHWorkExperienceModel(id: .id16, isNeed: true, title: "下属管理人数", isUserKeyBoard: true, prompts: "请输入", message: "\(mainModel.company_manage_total)", isShowPrompts: isShowPrompt, alertMessage:"请输入下属管理人数")
let item15 = YHWorkExperienceModel(id: .id17, isNeed: false, title: "公司营业额/港元 (近一年)", isUserKeyBoard: true, prompts: "请输入具体数字", message: "\(mainModel.turnover)")
let item16 = YHWorkExperienceModel(id: .id18, isNeed: false, title: "公司业务性质/范畴/所属行业", isUserKeyBoard: true, prompts: "请输入,100字内", message: mainModel.business_nature)
let item17 = YHWorkExperienceModel(id: .id19, isNeed: true, title: "职位水平类别", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.professional_level)", type: .level)
let item18 = YHWorkExperienceModel(id: .id20, isNeed: true, title: "高管证明文件", isUserKeyBoard: false, prompts: "请选择", message: mainModel.executives_certificate, type: .prove)
let item19 = YHWorkExperienceModel(id: .id21, isNeed: true, title: "高管在职开始时间", isUserKeyBoard: false, prompts: "请选择", message: mainModel.top_manager_start_at, type: .time)
let item20 = YHWorkExperienceModel(id: .id22, isNeed: true, title: "高管在职结束时间", isUserKeyBoard: false, prompts: "请选择", message: mainModel.top_manager_end_at, type: .time)
let item17 = YHWorkExperienceModel(id: .id19, isNeed: true, title: "职位水平类别", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.professional_level)", type: .level, isShowPrompts: isShowPrompt, alertMessage:"请选择职位水平类别")
let item18 = YHWorkExperienceModel(id: .id20, isNeed: true, title: "高管证明文件", isUserKeyBoard: false, prompts: "请选择", message: mainModel.executives_certificate, type: .prove, isShowPrompts: isShowPrompt, alertMessage:"请选择高管证明文件")
let item19 = YHWorkExperienceModel(id: .id21, isNeed: true, title: "高管在职开始时间", isUserKeyBoard: false, prompts: "请选择", message: mainModel.top_manager_start_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择入职年月")
let item20 = YHWorkExperienceModel(id: .id22, isNeed: true, title: "高管在职结束时间", isUserKeyBoard: false, prompts: "请选择", message: mainModel.top_manager_end_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择离职年月")
var section1 = YHSectionWorkExperienceModel()
if mainModel.professional_level == 1 {
section1 = YHSectionWorkExperienceModel(title: "企业规模", models: [item12, item13, item14, item15, item16, item17, item18, item19, item20])
......@@ -174,6 +175,12 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
"country": mainModel.location.country,
"details": mainModel.location.details,
"foreign": mainModel.location.foreign] as [String : Any]
var file: [[String : Any]] = []
for item in mainModel.file {
let fileDic = ["fileName": item.fileName,
"fileUrl": item.fileUrl]
file.append(fileDic)
}
let params: [String : Any] = ["administrative_level": mainModel.administrative_level,
"business_nature": mainModel.business_nature,
"business_remark":mainModel.business_remark,
......@@ -190,7 +197,7 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
"duty": mainModel.duty,
"entry_time": mainModel.entry_time,
"executives_certificate": mainModel.executives_certificate,
"file": mainModel.file,
"file": file,
"highlights": mainModel.highlights,
"id": mainModel.id,
"order_id": orderID,
......@@ -269,4 +276,141 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
}
}
// 上传方法
func uploadImage(_ image: UIImage, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let strUrl = "https://test-comserver.galaxy-immi.com/oss/upload/storage"
let boundary = UUID().uuidString
let headers: HTTPHeaders = [
"Content-type": "multipart/form-data; boundary=\(boundary)",
"businessCode": "4001001"
]
let _ = YHNetRequest.uplaodRequest(url: strUrl, headers: headers, image: image) { [weak self] json, code in
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(json.data as? String, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(nil, error)
}
} failBlock: { err in
callBackBlock(nil, err)
}
}
func getPublicImageUrl(_ url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let strUrl = "https://test-comserver.galaxy-immi.com/oss/storage/convertToPublicURL" + "?fileUrl=\(url)"
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(json.data as? String, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(nil, error)
}
} failBlock: { err in
callBackBlock(nil,err)
}
}
func requestFileMessage(_ url: String, callBackBlock:@escaping (_ success: Bool, _ model: YHFileContent?,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.WorkExperience.ocrFileContent + "?file_url=\(url)"
// let params: [String : Any] = ["url": url]
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHFileContent.deserialize(from: dic as? Dictionary) else {
callBackBlock(false, nil, nil)
return
}
callBackBlock(true, result, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, nil,error)
}
} failBlock: { err in
callBackBlock(false, nil, err)
}
}
func isCanNext(_ step: Int) -> Bool {
if step == 0 {
let companyName = mainModel.company_name //公司名称
let industry = mainModel.industry //用人单位性质
let country = mainModel.location.country //工作国家
let area = mainModel.location.area //工作城市
let foreign = mainModel.location.foreign //工作城市 国外
let entryTime = mainModel.entry_time //入职年月
let departureTime = mainModel.departure_time //离职年月
let workCertificate = mainModel.work_certificate //工作证明文件
let duty = mainModel.duty //职责性质
let companyMemberTotal = mainModel.company_member_total //企业人数规模
let companyManageTotal = mainModel.company_manage_total //下属管理人数
let professionalLevel = mainModel.professional_level //职位水平类别
let executivesCertificate = mainModel.executives_certificate //高管证明文件
let topManagerStartAt = mainModel.top_manager_start_at //高管在职开始时间
let topManagerEndAt = mainModel.top_manager_end_at //高管在职开始时间
guard companyName.count > 0 else { return false }
guard industry.count > 0 else { return false }
guard country.count > 0 else { return false }
guard entryTime.count > 0 else { return false }
guard workCertificate.count > 0 else { return false }
guard duty.count > 0 else { return false }
guard companyMemberTotal > 0 else { return false }
guard companyManageTotal > 0 else { return false }
guard professionalLevel > 0 else { return false }
if country.contains("中国") {
guard area.count > 0 else { return false }
} else {
guard foreign.count > 0 else { return false }
}
if professionalLevel == 1 {
guard executivesCertificate.count > 0 else { return false }
guard topManagerStartAt.count > 0 else { return false }
guard topManagerEndAt.count > 0 else { return false }
}
return true
} else if step == 1 {
let message = mainModel.wduty
guard message.count > 0 else { return false }
return true
} else if step == 2 {
let message = mainModel.highlights
guard message.count > 0 else { return false }
return true
} else if step == 3 {
//todo
let message = mainModel.is_project_introduction
let file = mainModel.file
let uploadFile = mainModel.not_need_upload_file
if message == 1 {
return true
} else {
if uploadFile == 1 {
return true
} else {
if file.count != 0 {
return true
} else {
return false
}
}
}
} else {
let file = mainModel.file
let uploadFile = mainModel.not_need_upload_file
if uploadFile == 1 {
return true
} else {
if file.count != 0 {
return true
} else {
return false
}
}
}
}
}
......@@ -7,6 +7,7 @@
//
import UIKit
import Alamofire
class YHWorkIntroductionViewModel: YHBaseViewModel {
var introducetionExampleModels: [YHWorkExampleModel]?
......@@ -52,5 +53,65 @@ class YHWorkIntroductionViewModel: YHBaseViewModel {
callBackBlock(false, err)
}
}
// 上传方法
func uploadImage(_ image: UIImage, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let strUrl = "https://test-comserver.galaxy-immi.com/oss/upload/storage"
let boundary = UUID().uuidString
let headers: HTTPHeaders = [
"Content-type": "multipart/form-data; boundary=\(boundary)",
"businessCode": "4001001"
]
let _ = YHNetRequest.uplaodRequest(url: strUrl, headers: headers, image: image) { [weak self] json, code in
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(json.data as? String, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(nil, error)
}
} failBlock: { err in
callBackBlock(nil, err)
}
}
func getPublicImageUrl(_ url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let strUrl = "https://test-comserver.galaxy-immi.com/oss/storage/convertToPublicURL" + "?fileUrl=\(url)"
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(json.data as? String, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(nil, error)
}
} failBlock: { err in
callBackBlock(nil,err)
}
}
func requestFileMessage(_ url: String, callBackBlock:@escaping (_ success: Bool, _ model: YHFileContent?,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.WorkExperience.ocrFileContent + "?file_url=\(url)"
// let params: [String : Any] = ["url": url]
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHFileContent.deserialize(from: dic as? Dictionary) else {
callBackBlock(false, nil, nil)
return
}
callBackBlock(true, result, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, nil,error)
}
} failBlock: { err in
callBackBlock(false, nil, err)
}
}
}
......@@ -126,3 +126,35 @@ extension UIButton {
return self as! T
}
}
// 扩大点击范围
extension UIButton{
private struct RuntimeKey {
static let clickEdgeInsets = UnsafeRawPointer.init(bitPattern: "clickEdgeInsets".hashValue)
}
/// 需要扩充的点击边距
public var YH_clickEdgeInsets: UIEdgeInsets? {
set {
objc_setAssociatedObject(self, UIButton.RuntimeKey.clickEdgeInsets!, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_COPY)
}
get {
return objc_getAssociatedObject(self, UIButton.RuntimeKey.clickEdgeInsets!) as? UIEdgeInsets ?? UIEdgeInsets.zero
}
}
// 重写系统方法修改点击区域
open override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
super.point(inside: point, with: event)
var bounds = self.bounds
if (YH_clickEdgeInsets != nil) {
let x: CGFloat = -(YH_clickEdgeInsets?.left ?? 0)
let y: CGFloat = -(YH_clickEdgeInsets?.top ?? 0)
let width: CGFloat = bounds.width + (YH_clickEdgeInsets?.left ?? 0) + (YH_clickEdgeInsets?.right ?? 0)
let height: CGFloat = bounds.height + (YH_clickEdgeInsets?.top ?? 0) + (YH_clickEdgeInsets?.bottom ?? 0)
bounds = CGRect(x: x, y: y, width: width, height: height) //负值是方法响应范围
}
return bounds.contains(point)
}
}
......@@ -95,14 +95,14 @@ class YHNetRequest: NSObject {
requestHeader.add(name:"sign",value:sign)
requestHeader.add(name: "token", value: YHLoginManager.shared.userModel?.token ?? "-")
// testToken(&requestHeader) //for test hjl 使用固定token
testToken(&requestHeader) //for test hjl 使用测试token
headers = requestHeader
}
private func testToken(_ requestHeader:inout HTTPHeaders) {
//金龙的账号
requestHeader.add(name: "token", value: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTE2MDcwNjQsImkiOjE0NDg0MTczMjc0MjE2LCJ1Ijoi6ZO25rKz6ZuG5ZuiIiwiciI6InN1cGVyX2FwcCJ9.KwTWdaLy5UG4LLs6i-D9ne0RflRTT5v4zvu-66yihDE")
// requestHeader.add(name: "token", value:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTE3ODI1OTUsImkiOjEyNDMwMTA1MTY0OTA0LCJ1Ijoi6ZO25rKz6ZuG5ZuiIiwiciI6InN1cGVyX2FwcCJ9.jqWpIf3SmbetApdErmBIYh-YEhX1zF_WqgqgOq5oI2A")
// requestHeader.add(name: "token", value:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTE3ODI1OTUsImkiOjEyNDMwMTA1MTY0OTA0LCJ1Ijoi6ZO25rKz6ZuG5ZuiIiwiciI6InN1cGVyX2FwcCJ9.jqWpIf3SmbetApdErmBIYh-YEhX1zF_WqgqgOq5oI2A")
}
///  链式语法
......
{
"images" : [
{
"filename" : "应用图标1024*1024.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
......
{
"images" : [
{
"filename" : "超级app启动页占位图.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "launch_screen_image@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "launch_screen_image@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
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