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 @@ ...@@ -156,6 +156,7 @@
A5234E372B70802400A33433 /* YHBasicInfoCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5234E362B70802300A33433 /* YHBasicInfoCellModel.swift */; }; A5234E372B70802400A33433 /* YHBasicInfoCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5234E362B70802300A33433 /* YHBasicInfoCellModel.swift */; };
A5234E3E2B7235F000A33433 /* YHOtherInfoFillViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5234E3D2B7235F000A33433 /* YHOtherInfoFillViewController.swift */; }; A5234E3E2B7235F000A33433 /* YHOtherInfoFillViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5234E3D2B7235F000A33433 /* YHOtherInfoFillViewController.swift */; };
A53026902B4E6F2700F35102 /* YHHomeCustomCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A530268F2B4E6F2700F35102 /* YHHomeCustomCell.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 */; }; A5551FFE2B4C26CE00510980 /* YHBaseViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5551FFD2B4C26CE00510980 /* YHBaseViewModel.swift */; };
A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5573ED12B317BFF00D98EC0 /* AppDelegate.swift */; }; A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5573ED12B317BFF00D98EC0 /* AppDelegate.swift */; };
A5573EDB2B317C0000D98EC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A5573EDA2B317C0000D98EC0 /* Assets.xcassets */; }; A5573EDB2B317C0000D98EC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A5573EDA2B317C0000D98EC0 /* Assets.xcassets */; };
...@@ -460,6 +461,7 @@ ...@@ -460,6 +461,7 @@
A5234E362B70802300A33433 /* YHBasicInfoCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBasicInfoCellModel.swift; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 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>"; }; 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; }; 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>"; }; A5573ED12B317BFF00D98EC0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
...@@ -1047,6 +1049,7 @@ ...@@ -1047,6 +1049,7 @@
A5FD63F92B68D95700D1D9DA /* YHPersonInfoIdentityCardModel.swift */, A5FD63F92B68D95700D1D9DA /* YHPersonInfoIdentityCardModel.swift */,
A5191F612B89E748001069F7 /* YHPreviewQuestionAndAnswerModel.swift */, A5191F612B89E748001069F7 /* YHPreviewQuestionAndAnswerModel.swift */,
A5B4A5842B9455F7003EFF8F /* YHPreviewForOtherInfoModel.swift */, A5B4A5842B9455F7003EFF8F /* YHPreviewForOtherInfoModel.swift */,
A554A4FF2B95FB9100EA5973 /* YHMainInfoPreviewModel.swift */,
); );
path = M; path = M;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1812,6 +1815,7 @@ ...@@ -1812,6 +1815,7 @@
0413A6D82B8C76290006D154 /* YHCertificateUploadVC.swift in Sources */, 0413A6D82B8C76290006D154 /* YHCertificateUploadVC.swift in Sources */,
A5ACE93A2B4564F7002C94D2 /* NSAttributedString+Extension.swift in Sources */, A5ACE93A2B4564F7002C94D2 /* NSAttributedString+Extension.swift in Sources */,
04E86E662B86EB6F00A35F4B /* YHLoginManager.swift in Sources */, 04E86E662B86EB6F00A35F4B /* YHLoginManager.swift in Sources */,
A554A5002B95FB9100EA5973 /* YHMainInfoPreviewModel.swift in Sources */,
042F888B2B8477C6008B60BD /* YHEducationInfo.swift in Sources */, 042F888B2B8477C6008B60BD /* YHEducationInfo.swift in Sources */,
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */, 04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */,
042FBBBF2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift in Sources */, 042FBBBF2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift in Sources */,
......
...@@ -179,8 +179,14 @@ extension YHServiceCenterMainViewController : UITableViewDelegate,UITableViewDat ...@@ -179,8 +179,14 @@ extension YHServiceCenterMainViewController : UITableViewDelegate,UITableViewDat
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true) tableView.deselectRow(at: indexPath, animated: true)
printLog("点击了 tableView Cell \(indexPath.section)") printLog("点击了 tableView Cell \(indexPath.section)")
//获取订单号
let orderId = serviceCenterMainReqVM.arrContactList[indexPath.section].id
UserDefaults.standard.set(orderId, forKey: "orderIdForPreview")
UserDefaults.standard.synchronize()
let vc = YHServiceCenterSecondViewController() let vc = YHServiceCenterSecondViewController()
vc.orderId = serviceCenterMainReqVM.arrContactList[indexPath.section].id vc.orderId = orderId
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
} }
......
...@@ -167,6 +167,8 @@ extension YHServiceCenterSecondViewController : UITableViewDelegate,UITableViewD ...@@ -167,6 +167,8 @@ extension YHServiceCenterSecondViewController : UITableViewDelegate,UITableViewD
let model = self.serviceCenterMainReqVM.arrContactStausItmes[indexPath.row] let model = self.serviceCenterMainReqVM.arrContactStausItmes[indexPath.row]
if model.type == 1 { if model.type == 1 {
let vc = YHInformationPerfectListVC() let vc = YHInformationPerfectListVC()
vc.orderId = orderId vc.orderId = orderId
......
...@@ -1218,10 +1218,12 @@ class YHAddress: SmartCodable { ...@@ -1218,10 +1218,12 @@ class YHAddress: SmartCodable {
class YHChildStepchildClass: SmartCodable { class YHChildStepchildClass: SmartCodable {
var has: String = "" var has: String = ""
var info: String = "" var info: String = ""
var number: String = ""
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case has = "has" case has = "has"
case info = "info" case info = "info"
case number = "number"
} }
required init() { required init() {
......
...@@ -92,12 +92,13 @@ class YHMainApplicantInformationViewController: YHBaseViewController { ...@@ -92,12 +92,13 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
bottom.nextblock = { [weak self] in bottom.nextblock = { [weak self] in
guard let self = self else { return } guard let self = self else { return }
if self.viewModel.isCanNext(self.stepView.currentIndex) { 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 self.viewModel.updateMainInformation(.submit, self.orderId) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if let error = error { if let error = error {
YHHUD.flash(message: error.errorMsg ) YHHUD.flash(message: error.errorMsg )
} else { } else {
self.stepView.currentIndex = self.stepView.currentIndex + 1
self.isShowPrompt = false self.isShowPrompt = false
self.stepView.currentIndex = self.stepView.currentIndex self.stepView.currentIndex = self.stepView.currentIndex
if self.stepView.currentIndex == self.stepView.dataSource?.count { if self.stepView.currentIndex == self.stepView.dataSource?.count {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
import UIKit import UIKit
import Alamofire import Alamofire
import Photos
class YHImagePickerView: UIView { class YHImagePickerView: UIView {
var backImage: ((UIImage) -> Void)? var backImage: ((UIImage) -> Void)?
...@@ -164,6 +165,7 @@ class YHImagePickerView: UIView { ...@@ -164,6 +165,7 @@ class YHImagePickerView: UIView {
} }
@objc func takePhoto() { @objc func takePhoto() {
guard getPhotoLibraryAuthorization() else { return }
if UIImagePickerController.isSourceTypeAvailable(.camera){ if UIImagePickerController.isSourceTypeAvailable(.camera){
//创建图片控制器 //创建图片控制器
let imagePicker = UIImagePickerController() let imagePicker = UIImagePickerController()
...@@ -183,6 +185,7 @@ class YHImagePickerView: UIView { ...@@ -183,6 +185,7 @@ class YHImagePickerView: UIView {
} }
@objc func selectPhoto() { @objc func selectPhoto() {
guard getPhotoLibraryAuthorization() else { return }
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){ if UIImagePickerController.isSourceTypeAvailable(.photoLibrary){
let imagePicker = UIImagePickerController() let imagePicker = UIImagePickerController()
imagePicker.delegate = self imagePicker.delegate = self
...@@ -192,6 +195,28 @@ class YHImagePickerView: UIView { ...@@ -192,6 +195,28 @@ class YHImagePickerView: UIView {
UIViewController.current?.present(imagePicker,animated: true) 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 { extension YHImagePickerView: UIGestureRecognizerDelegate {
...@@ -219,7 +244,7 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro ...@@ -219,7 +244,7 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
} }
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.dismiss(animated: true, completion: nil)
} }
//原生上传 //原生上传
......
...@@ -68,6 +68,7 @@ class YHStepView: UIScrollView { ...@@ -68,6 +68,7 @@ class YHStepView: UIScrollView {
make.left.equalTo(spaceWidth + i.cgFloat * (lineWidth + stepSpace * 2 + 14)) make.left.equalTo(spaceWidth + i.cgFloat * (lineWidth + stepSpace * 2 + 14))
make.width.height.equalTo(14) make.width.height.equalTo(14)
} }
button.YH_clickEdgeInsets = UIEdgeInsets(top: 50, left: 50, bottom: 50, right: 50)
let label = UILabel() let label = UILabel()
label.text = array[i] label.text = array[i]
label.font = UIFont.PFSC_R(ofSize: 13) label.font = UIFont.PFSC_R(ofSize: 13)
......
...@@ -474,13 +474,13 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -474,13 +474,13 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
func isCanNext(_ step: Int) -> Bool { func isCanNext(_ step: Int) -> Bool {
if step == 0 { if step == 0 {
let nationality = mainModel.nationality let nationality = mainModel.nationality
let country = mainModel.address.country let country = mainModel.address.country
let area = mainModel.address.area let area = mainModel.address.area
let details = mainModel.address.details let details = mainModel.address.details
let foreign = mainModel.address.foreign let foreign = mainModel.address.foreign
let is_live_oversea_year = mainModel.is_live_oversea_year let is_live_oversea_year = mainModel.is_live_oversea_year
let has_hk_id = mainModel.has_hk_id let has_hk_id = mainModel.has_hk_id
if country.contains("中国") { if country.contains("中国") {
if nationality.count != 0 && country.count != 0 && area.count != 0 && details.count != 0 { if nationality.count != 0 && country.count != 0 && area.count != 0 && details.count != 0 {
return true return true
......
...@@ -50,10 +50,6 @@ class YHScoreDetailViewController: YHBaseViewController { ...@@ -50,10 +50,6 @@ class YHScoreDetailViewController: YHBaseViewController {
//2.0 //2.0
loadData() 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 { ...@@ -54,6 +54,7 @@ class YHPreviewInfoNameAndSubNameItemView: UIView {
make.top.equalTo(nameLable.snp.top) make.top.equalTo(nameLable.snp.top)
make.right.equalToSuperview() make.right.equalToSuperview()
make.left.equalTo(nameLable.snp.right).offset(10) make.left.equalTo(nameLable.snp.right).offset(10)
make.height.greaterThanOrEqualTo(20)
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
} }
......
...@@ -134,9 +134,14 @@ extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDa ...@@ -134,9 +134,14 @@ extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDa
} }
cell.clickBlock = {[weak self] model in cell.clickBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
let firstModel = self.dataSource?.first
let vc = YHWorkExperienceViewController() let vc = YHWorkExperienceViewController()
vc.workExperienceID = "\(model.id ?? 0)" vc.workExperienceID = "\(model.id ?? 0)"
vc.orderID = self.orderId vc.orderID = self.orderId
vc.isShowMessageSelect = true
if firstModel?.id == model.id {
vc.isShowMessageSelect = false
}
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} }
cell.deleteBlock = {[weak self] model in cell.deleteBlock = {[weak self] model in
...@@ -152,9 +157,14 @@ extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDa ...@@ -152,9 +157,14 @@ extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDa
} }
cell.newWorkBlock = {[weak self] in cell.newWorkBlock = {[weak self] in
guard let self = self else { return } guard let self = self else { return }
let vc = YHWorkExperienceViewController() if self.dataSource?.count == 10 {
vc.orderID = self.orderId YHHUD.flash(message: "新增工作经历不能超过10条")
self.navigationController?.pushViewController(vc, animated: true) } else {
let vc = YHWorkExperienceViewController()
vc.isShowMessageSelect = true
vc.orderID = self.orderId
self.navigationController?.pushViewController(vc, animated: true)
}
} }
cell.backgroundColor = .clear cell.backgroundColor = .clear
cell.contentView.backgroundColor = .clear cell.contentView.backgroundColor = .clear
......
...@@ -19,7 +19,7 @@ class YHWorkIntroductionViewController: YHBaseViewController { ...@@ -19,7 +19,7 @@ class YHWorkIntroductionViewController: YHBaseViewController {
var actionView: YHWorkActionView! var actionView: YHWorkActionView!
var bottomView: UIView! var bottomView: UIView!
var bottomButton: UIButton! var bottomButton: UIButton!
var viewModel: YHWorkIntroductionViewModel? var viewModel: YHWorkIntroductionViewModel!
var workModel: YHWorkExperienceDetailModel? var workModel: YHWorkExperienceDetailModel?
var dataSource: YHWorkExperienceProjectModel = YHWorkExperienceProjectModel() var dataSource: YHWorkExperienceProjectModel = YHWorkExperienceProjectModel()
...@@ -201,6 +201,33 @@ class YHWorkIntroductionViewController: YHBaseViewController { ...@@ -201,6 +201,33 @@ class YHWorkIntroductionViewController: YHBaseViewController {
vc.modalPresentationStyle = .pageSheet vc.modalPresentationStyle = .pageSheet
self.navigationController?.present(vc, animated: true) 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 return view
}() }()
view.addSubview(actionView) view.addSubview(actionView)
...@@ -241,6 +268,22 @@ class YHWorkIntroductionViewController: YHBaseViewController { ...@@ -241,6 +268,22 @@ class YHWorkIntroductionViewController: YHBaseViewController {
} }
@objc func submit() { @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 viewModel?.saveWorkProjectDetail(workModel ?? YHWorkExperienceDetailModel(), projectModel: dataSource, callBackBlock: {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if let block = self.saveBlock { if let block = self.saveBlock {
...@@ -282,6 +325,12 @@ extension YHWorkIntroductionViewController: UITextViewDelegate { ...@@ -282,6 +325,12 @@ extension YHWorkIntroductionViewController: UITextViewDelegate {
promptsLabel.isHidden = false 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 { extension YHWorkIntroductionViewController: UITextFieldDelegate {
......
...@@ -15,3 +15,7 @@ class YHWorkExampleModel: YHBaseModel { ...@@ -15,3 +15,7 @@ class YHWorkExampleModel: YHBaseModel {
var highlights_list: [String]? var highlights_list: [String]?
var template: [String]? var template: [String]?
} }
class YHFileContent:YHBaseModel {
var content: String?
}
...@@ -36,7 +36,7 @@ class YHWorkExperienceDetailModel: YHBaseModel { ...@@ -36,7 +36,7 @@ class YHWorkExperienceDetailModel: YHBaseModel {
var is_executives: Int = 0 var is_executives: Int = 0
var wduty: String = "" var wduty: String = ""
var highlights: String = "" var highlights: String = ""
var file: [String] = [] var file: [YHWorkExperienceFileModel] = []
var not_need_upload_file: Int = 0 var not_need_upload_file: Int = 0
var company_member_total: Int = 0 var company_member_total: Int = 0
var administrative_level: Int = 0 var administrative_level: Int = 0
...@@ -59,3 +59,8 @@ class YHWorkExperienceDetailModel: YHBaseModel { ...@@ -59,3 +59,8 @@ class YHWorkExperienceDetailModel: YHBaseModel {
var customer_center_id: Int = 0 var customer_center_id: Int = 0
var projects: [String] = [] var projects: [String] = []
} }
class YHWorkExperienceFileModel: YHBaseModel {
var fileName: String = ""
var fileUrl: String = ""
}
...@@ -58,8 +58,10 @@ struct YHWorkExperienceModel { ...@@ -58,8 +58,10 @@ struct YHWorkExperienceModel {
var rightButtonString: String? var rightButtonString: String?
var type: YHWorkExperienceSelectType? var type: YHWorkExperienceSelectType?
var value: [String]? 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.id = id
self.isNeed = isNeed self.isNeed = isNeed
self.title = title self.title = title
...@@ -70,6 +72,8 @@ struct YHWorkExperienceModel { ...@@ -70,6 +72,8 @@ struct YHWorkExperienceModel {
self.rightButtonString = rightButtonString self.rightButtonString = rightButtonString
self.type = type self.type = type
self.value = value self.value = value
self.isShowPrompts = isShowPrompts
self.alertMessage = alertMessage
} }
} }
......
...@@ -10,9 +10,11 @@ import UIKit ...@@ -10,9 +10,11 @@ import UIKit
class YHWorkActionView: UIView { class YHWorkActionView: UIView {
typealias ExampleBlock = () -> () typealias ExampleBlock = () -> ()
typealias PhotoBlock = () -> ()
var exampleBlock: ExampleBlock? var exampleBlock: ExampleBlock?
var photoBlock: PhotoBlock?
var photoButton: UIButton! var photoButton: UIButton!
var wxButton: UIButton! // var wxButton: UIButton!
var exampleButton: UIButton! var exampleButton: UIButton!
override init(frame: CGRect) { override init(frame: CGRect) {
...@@ -40,18 +42,18 @@ class YHWorkActionView: UIView { ...@@ -40,18 +42,18 @@ class YHWorkActionView: UIView {
make.height.width.equalTo(21) make.height.width.equalTo(21)
} }
wxButton = { // wxButton = {
let button = UIButton(type: .custom) // let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "work_experience_wx"), for: .normal) // button.setBackgroundImage(UIImage(named: "work_experience_wx"), for: .normal)
button.addTarget(self, action: #selector(wxClick), for: .touchUpInside) // button.addTarget(self, action: #selector(wxClick), for: .touchUpInside)
return button // return button
}() // }()
addSubview(wxButton) // addSubview(wxButton)
wxButton.snp.makeConstraints { make in // wxButton.snp.makeConstraints { make in
make.centerY.equalToSuperview() // make.centerY.equalToSuperview()
make.left.equalTo(49) // make.left.equalTo(49)
make.height.width.equalTo(21) // make.height.width.equalTo(21)
} // }
exampleButton = { exampleButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
...@@ -76,7 +78,9 @@ class YHWorkActionView: UIView { ...@@ -76,7 +78,9 @@ class YHWorkActionView: UIView {
} }
@objc func photoClick() { @objc func photoClick() {
if let block = photoBlock {
block()
}
} }
@objc func wxClick() { @objc func wxClick() {
......
...@@ -17,7 +17,8 @@ class YHWorkExperienceItemView: UIView { ...@@ -17,7 +17,8 @@ class YHWorkExperienceItemView: UIView {
var centerButton: UIButton! var centerButton: UIButton!
var leftButton: UIButton! var leftButton: UIButton!
var rightButton: UIButton! var rightButton: UIButton!
var showPromptLabel: UILabel!
var dataSource: YHWorkExperienceModel? { var dataSource: YHWorkExperienceModel? {
didSet { didSet {
updateAllViews() updateAllViews()
...@@ -48,6 +49,8 @@ class YHWorkExperienceItemView: UIView { ...@@ -48,6 +49,8 @@ class YHWorkExperienceItemView: UIView {
messageTextField = { messageTextField = {
let textField = UITextField() let textField = UITextField()
textField.delegate = self textField.delegate = self
textField.textColor = UIColor.mainTextColor
textField.font = UIFont.PFSC_M(ofSize: 14)
return textField return textField
}() }()
addSubview(messageTextField) addSubview(messageTextField)
...@@ -56,6 +59,19 @@ class YHWorkExperienceItemView: UIView { ...@@ -56,6 +59,19 @@ class YHWorkExperienceItemView: UIView {
make.left.equalTo(112) 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 = { nextStepImageView = {
let imageView = UIImageView() let imageView = UIImageView()
imageView.image = UIImage(named: "form_right_arrow") imageView.image = UIImage(named: "form_right_arrow")
...@@ -117,7 +133,6 @@ class YHWorkExperienceItemView: UIView { ...@@ -117,7 +133,6 @@ class YHWorkExperienceItemView: UIView {
make.height.equalTo(32) make.height.equalTo(32)
make.width.equalTo(74) make.width.equalTo(74)
} }
} }
func updateAllViews() { func updateAllViews() {
...@@ -143,6 +158,10 @@ class YHWorkExperienceItemView: UIView { ...@@ -143,6 +158,10 @@ class YHWorkExperienceItemView: UIView {
} }
messageTextField.placeholder = dataSource.prompts messageTextField.placeholder = dataSource.prompts
messageTextField.text = dataSource.message messageTextField.text = dataSource.message
if dataSource.message == "0" {
messageTextField.text = ""
}
showPromptLabel.text = dataSource.alertMessage
if dataSource.isUserKeyBoard ?? false { if dataSource.isUserKeyBoard ?? false {
nextStepImageView.isHidden = true nextStepImageView.isHidden = true
centerButton.isHidden = true centerButton.isHidden = true
...@@ -207,6 +226,16 @@ class YHWorkExperienceItemView: UIView { ...@@ -207,6 +226,16 @@ class YHWorkExperienceItemView: UIView {
} else { } else {
rightButton.isHidden = true 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) { func buttonState(isLeft: Bool) {
...@@ -266,6 +295,7 @@ class YHWorkExperienceItemView: UIView { ...@@ -266,6 +295,7 @@ class YHWorkExperienceItemView: UIView {
} }
@objc func centerClick() { @objc func centerClick() {
UIViewController.current?.view.endEditing(true) // 收起键盘
guard let type = dataSource?.type else { return } guard let type = dataSource?.type else { return }
switch type { switch type {
case .normal: case .normal:
...@@ -362,9 +392,32 @@ class YHWorkExperienceItemView: UIView { ...@@ -362,9 +392,32 @@ class YHWorkExperienceItemView: UIView {
extension YHWorkExperienceItemView: UITextFieldDelegate { extension YHWorkExperienceItemView: UITextFieldDelegate {
func textFieldDidEndEditing(_ textField: UITextField) { 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 { if let block = block {
block(dataSource ?? YHWorkExperienceModel()) block(data)
} }
return true
} }
} }
...@@ -99,8 +99,13 @@ class YHWorkExperienceTableViewCell: UITableViewCell { ...@@ -99,8 +99,13 @@ class YHWorkExperienceTableViewCell: UITableViewCell {
} }
y = y + 1 y = y + 1
let data = dataSource?.models?[i] let data = dataSource?.models?[i]
let isShow = data?.isShowPrompts ?? false
let message = data?.message ?? ""
if data?.id == .id3 || data?.id == .id4 || data?.id == .id18 { if data?.id == .id3 || data?.id == .id4 || data?.id == .id18 {
var h = 131
if isShow && message.count == 0 {
h = h + 20
}
let itemView = YHWorkExperienceTextItemView() let itemView = YHWorkExperienceTextItemView()
itemView.dataSource = data itemView.dataSource = data
itemView.block = {[weak self] model in itemView.block = {[weak self] model in
...@@ -113,15 +118,18 @@ class YHWorkExperienceTableViewCell: UITableViewCell { ...@@ -113,15 +118,18 @@ class YHWorkExperienceTableViewCell: UITableViewCell {
itemView.snp.makeConstraints { make in itemView.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
make.top.equalTo(y) make.top.equalTo(y)
make.height.equalTo(131) make.height.equalTo(h)
make.right.equalTo(-18) make.right.equalTo(-18)
} }
y = y + 131 y = y + h
} else { } else {
var h = 51 var h = 51
if data?.id == .id13 { if data?.id == .id13 {
h = 71 h = 71
} }
if isShow && message.count == 0 {
h = h + 20
}
let itemView = YHWorkExperienceItemView() let itemView = YHWorkExperienceItemView()
itemView.dataSource = data itemView.dataSource = data
itemView.block = {[weak self] model in itemView.block = {[weak self] model in
......
...@@ -8,13 +8,18 @@ ...@@ -8,13 +8,18 @@
import UIKit import UIKit
enum YHWorkFileClickType {
case delete
case click
}
class YHWorkFileItemView: UIView { class YHWorkFileItemView: UIView {
typealias ItemBlock = (_ model: YHItemModel) -> () typealias ItemBlock = (_ model: YHWorkExperienceFileModel, _ type: YHWorkFileClickType) -> ()
var block: ItemBlock? var block: ItemBlock?
var titleLabel: UILabel! var titleLabel: UIButton!
var deleteButton: UIButton! var deleteButton: UIButton!
var dataSource: YHWorkItemListModel? { var dataSource: YHWorkExperienceFileModel? {
didSet { didSet {
updateAllViews() updateAllViews()
} }
...@@ -31,10 +36,11 @@ class YHWorkFileItemView: UIView { ...@@ -31,10 +36,11 @@ class YHWorkFileItemView: UIView {
func setUpView() { func setUpView() {
titleLabel = { titleLabel = {
let label = UILabel() let label = UIButton(type: .custom)
label.font = UIFont.PFSC_M(ofSize: 14) label.setTitleColor(UIColor.mainTextColor, for: .normal)
label.textAlignment = .left label.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = UIColor.mainTextColor label.addTarget(self, action: #selector(itemClick), for: .touchUpInside)
label.contentHorizontalAlignment = .left
return label return label
}() }()
addSubview(titleLabel) addSubview(titleLabel)
...@@ -48,11 +54,10 @@ class YHWorkFileItemView: UIView { ...@@ -48,11 +54,10 @@ class YHWorkFileItemView: UIView {
deleteButton = { deleteButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14) button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.contentHorizontalAlignment = .center button.contentHorizontalAlignment = .right
button.setTitle("删除", for: .normal) button.setTitle("删除", for: .normal)
button.setTitleColor( UIColor.failColor, for: .normal) button.setTitleColor(.red, for: .normal)
button.addTarget(self, action: #selector(deleteClick), for: .touchUpInside) button.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
button.isHidden = true
return button return button
}() }()
addSubview(deleteButton) addSubview(deleteButton)
...@@ -66,10 +71,18 @@ class YHWorkFileItemView: UIView { ...@@ -66,10 +71,18 @@ class YHWorkFileItemView: UIView {
func updateAllViews() { func updateAllViews() {
guard let dataSource = dataSource else { return } 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() { @objc func deleteClick() {
if let block = block, let dataSource = dataSource {
block(dataSource, .delete)
}
} }
} }
...@@ -10,7 +10,7 @@ import UIKit ...@@ -10,7 +10,7 @@ import UIKit
class YHWorkFileSyncTableViewCell: UITableViewCell { class YHWorkFileSyncTableViewCell: UITableViewCell {
typealias ExperienceListBlock = (_ model: YHItemModel) -> () typealias ExperienceListBlock = (_ model: YHWorkExperienceFileModel, _ type: YHWorkFileClickType) -> ()
typealias AddIntroductionBlock = () -> () typealias AddIntroductionBlock = () -> ()
var experienceListBlock: ExperienceListBlock? var experienceListBlock: ExperienceListBlock?
var addIntroductionBlock: AddIntroductionBlock? var addIntroductionBlock: AddIntroductionBlock?
...@@ -18,7 +18,7 @@ class YHWorkFileSyncTableViewCell: UITableViewCell { ...@@ -18,7 +18,7 @@ class YHWorkFileSyncTableViewCell: UITableViewCell {
var titleLabel: UILabel! var titleLabel: UILabel!
var mainItemView: UIView! var mainItemView: UIView!
var bottomView: YHWorkItemAddView! var bottomView: YHWorkItemAddView!
var dataSource: [YHWorkItemListModel]?{ var dataSource: [YHWorkExperienceFileModel]?{
didSet { didSet {
updateAllViews() updateAllViews()
} }
...@@ -91,7 +91,7 @@ class YHWorkFileSyncTableViewCell: UITableViewCell { ...@@ -91,7 +91,7 @@ class YHWorkFileSyncTableViewCell: UITableViewCell {
mainItemView.snp.makeConstraints { make in mainItemView.snp.makeConstraints { make in
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
make.bottom.equalTo(-65) make.bottom.equalTo(-65)
make.top.equalTo(85) make.top.equalTo(52)
} }
bottomView = { bottomView = {
...@@ -127,10 +127,10 @@ class YHWorkFileSyncTableViewCell: UITableViewCell { ...@@ -127,10 +127,10 @@ class YHWorkFileSyncTableViewCell: UITableViewCell {
} }
let itemView = YHWorkFileItemView() let itemView = YHWorkFileItemView()
itemView.dataSource = dataSource?[i] itemView.dataSource = dataSource?[i]
itemView.block = {[weak self] model in itemView.block = {[weak self] model, type in
guard let self = self else { return } guard let self = self else { return }
if let block = self.experienceListBlock { if let block = self.experienceListBlock {
block(model) block(model, type)
} }
} }
mainItemView.addSubview(itemView) mainItemView.addSubview(itemView)
......
...@@ -13,6 +13,7 @@ class YHWorkHighlightsTableViewCell: UITableViewCell { ...@@ -13,6 +13,7 @@ class YHWorkHighlightsTableViewCell: UITableViewCell {
typealias MessageBlock = (_ message: String) -> () typealias MessageBlock = (_ message: String) -> ()
typealias SwitchBlock = (_ isOn: Bool) -> () typealias SwitchBlock = (_ isOn: Bool) -> ()
var exampleBlock: ExampleBlock? var exampleBlock: ExampleBlock?
var photoBlock: ExampleBlock?
var messageBlock: MessageBlock? var messageBlock: MessageBlock?
var switchBlock: SwitchBlock? var switchBlock: SwitchBlock?
var centerView: UIView! var centerView: UIView!
...@@ -179,6 +180,12 @@ class YHWorkHighlightsTableViewCell: UITableViewCell { ...@@ -179,6 +180,12 @@ class YHWorkHighlightsTableViewCell: UITableViewCell {
block() block()
} }
} }
view.photoBlock = {[weak self] in
guard let self = self else { return }
if let block = self.photoBlock {
block()
}
}
return view return view
}() }()
centerView.addSubview(bottomView) centerView.addSubview(bottomView)
...@@ -225,4 +232,9 @@ extension YHWorkHighlightsTableViewCell: UITextViewDelegate { ...@@ -225,4 +232,9 @@ extension YHWorkHighlightsTableViewCell: UITextViewDelegate {
block(textView.text ?? "") 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 { ...@@ -19,9 +19,9 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell {
var rightButton: UIButton! var rightButton: UIButton!
var dataSource: Int?{ var dataSource: Int?{
didSet { didSet {
var flag = true var flag = false
if dataSource == 1 { if dataSource == 1 {
flag = false flag = true
} }
buttonState(isLeft: flag) buttonState(isLeft: flag)
} }
...@@ -158,14 +158,6 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell { ...@@ -158,14 +158,6 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell {
func buttonState(isLeft: Bool) { func buttonState(isLeft: Bool) {
if isLeft { 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 rightButton.isSelected = true
leftButton.isSelected = false leftButton.isSelected = false
rightButton.layer.borderWidth = 1 rightButton.layer.borderWidth = 1
...@@ -173,6 +165,14 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell { ...@@ -173,6 +165,14 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell {
rightButton.backgroundColor = UIColor(hex: 0x2f7ef6).withAlphaComponent(0.08) rightButton.backgroundColor = UIColor(hex: 0x2f7ef6).withAlphaComponent(0.08)
leftButton.backgroundColor = UIColor.contentBkgColor leftButton.backgroundColor = UIColor.contentBkgColor
leftButton.layer.borderWidth = 0 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 ...@@ -11,6 +11,7 @@ import UIKit
class YHWorkResponsibilitiesTableViewCell: UITableViewCell { class YHWorkResponsibilitiesTableViewCell: UITableViewCell {
typealias ExampleBlock = () -> () typealias ExampleBlock = () -> ()
typealias MessageBlock = (_ message: String) -> () typealias MessageBlock = (_ message: String) -> ()
var photoBlock: ExampleBlock?
var exampleBlock: ExampleBlock? var exampleBlock: ExampleBlock?
var messageBlock: MessageBlock? var messageBlock: MessageBlock?
var centerView: UIView! var centerView: UIView!
...@@ -146,6 +147,13 @@ class YHWorkResponsibilitiesTableViewCell: UITableViewCell { ...@@ -146,6 +147,13 @@ class YHWorkResponsibilitiesTableViewCell: UITableViewCell {
block() block()
} }
} }
view.photoBlock = {[weak self] in
guard let self = self else { return }
if let block = self.photoBlock {
block()
}
}
return view return view
}() }()
centerView.addSubview(bottomView) centerView.addSubview(bottomView)
...@@ -176,4 +184,10 @@ extension YHWorkResponsibilitiesTableViewCell: UITextViewDelegate { ...@@ -176,4 +184,10 @@ extension YHWorkResponsibilitiesTableViewCell: UITextViewDelegate {
block(textView.text ?? "") 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 @@ ...@@ -7,6 +7,7 @@
// //
import UIKit import UIKit
import Alamofire
class YHWorkIntroductionViewModel: YHBaseViewModel { class YHWorkIntroductionViewModel: YHBaseViewModel {
var introducetionExampleModels: [YHWorkExampleModel]? var introducetionExampleModels: [YHWorkExampleModel]?
...@@ -52,5 +53,65 @@ class YHWorkIntroductionViewModel: YHBaseViewModel { ...@@ -52,5 +53,65 @@ class YHWorkIntroductionViewModel: YHBaseViewModel {
callBackBlock(false, err) 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 { ...@@ -126,3 +126,35 @@ extension UIButton {
return self as! T 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 { ...@@ -95,14 +95,14 @@ class YHNetRequest: NSObject {
requestHeader.add(name:"sign",value:sign) requestHeader.add(name:"sign",value:sign)
requestHeader.add(name: "token", value: YHLoginManager.shared.userModel?.token ?? "-") requestHeader.add(name: "token", value: YHLoginManager.shared.userModel?.token ?? "-")
// testToken(&requestHeader) //for test hjl 使用固定token testToken(&requestHeader) //for test hjl 使用测试token
headers = requestHeader headers = requestHeader
} }
private func testToken(_ requestHeader:inout HTTPHeaders) { private func testToken(_ requestHeader:inout HTTPHeaders) {
//金龙的账号 //金龙的账号
requestHeader.add(name: "token", value: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTE2MDcwNjQsImkiOjE0NDg0MTczMjc0MjE2LCJ1Ijoi6ZO25rKz6ZuG5ZuiIiwiciI6InN1cGVyX2FwcCJ9.KwTWdaLy5UG4LLs6i-D9ne0RflRTT5v4zvu-66yihDE") 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" : [ "images" : [
{ {
"filename" : "应用图标1024*1024.png",
"idiom" : "universal", "idiom" : "universal",
"platform" : "ios", "platform" : "ios",
"size" : "1024x1024" "size" : "1024x1024"
......
{ {
"images" : [ "images" : [
{ {
"filename" : "超级app启动页占位图.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "launch_screen_image@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "launch_screen_image@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "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