Commit 4243ac84334a1795543c1e511ad63adf9aacca07

Authored by “张旭”
1 parent ce22b596

新增工作记录页面逻辑

metaCode/Classes/Common/Util/CNLiveCommonQiniuTool.swift
@@ -52,6 +52,28 @@ class UploadManager: NSObject { @@ -52,6 +52,28 @@ class UploadManager: NSObject {
52 return key 52 return key
53 } 53 }
54 54
  55 + /// 数字简历上传图片
  56 + /// - Parameters:
  57 + /// - imageData: 图片数据
  58 + /// - progressBlock: 进度回调
  59 + /// - successBlock: 成功回调
  60 + static func uploadViateImage(imageData: NSData, progressBlock:@escaping ProgressBlcok, successBlock: @escaping SuccessBlock) -> String {
  61 + let key = UploadManager.createViateImageFileName()
  62 + UploadManager.uploadData(madiaData: imageData, key: key, progress: progressBlock, success: successBlock)
  63 + return key
  64 + }
  65 +
  66 + /// 数字简历上传视频
  67 + /// - Parameters:
  68 + /// - imageData: 视频数据
  69 + /// - progressBlock: 进度回调
  70 + /// - successBlock: 成功回调
  71 + static func uploadViateVideo(videoData: NSData, progressBlock:@escaping ProgressBlcok, successBlock: @escaping SuccessBlock) -> String {
  72 + let key = UploadManager.createViateVideoFileName()
  73 + UploadManager.uploadData(madiaData: videoData, key: key, progress: progressBlock, success: successBlock)
  74 + return key
  75 + }
  76 +
55 // MARK: - 取消上传 77 // MARK: - 取消上传
56 func cancelUploadKey(key:String){ 78 func cancelUploadKey(key:String){
57 for (_,obj) in self.uploadModels.enumerated() { 79 for (_,obj) in self.uploadModels.enumerated() {
@@ -95,14 +117,14 @@ class UploadManager: NSObject { @@ -95,14 +117,14 @@ class UploadManager: NSObject {
95 param.setValue("2", forKey: "storageType") 117 param.setValue("2", forKey: "storageType")
96 param.setValue(kBucketName_QN, forKey: "bucket") 118 param.setValue(kBucketName_QN, forKey: "bucket")
97 let custom_param = NSMutableDictionary() 119 let custom_param = NSMutableDictionary()
98 - custom_param.setValue(CNLiveMCEnvironmentManager.shared.appId, forKey: "appId")  
99 - custom_param.setValue(CNLiveMCEnvironmentManager.shared.appKey, forKey: "appKey") 120 + custom_param.setValue("802_li40qhp922", forKey: "appId")//CNLiveMCEnvironmentManager.shared.appId
  121 + custom_param.setValue("ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac", forKey: "appKey")//CNLiveMCEnvironmentManager.shared.appKey
100 CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) 122 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
101 CNLiveNetworking.setupShowResult(true) 123 CNLiveNetworking.setupShowResult(true)
102 CNLiveNetworking.setAllowRequestDefaultArgument(true) 124 CNLiveNetworking.setAllowRequestDefaultArgument(true)
103 CNLiveNetworking.setupShowDataResult(false) 125 CNLiveNetworking.setupShowDataResult(false)
104 - CNLiveNetworking.setupSignRequestKey(CNLiveMCEnvironmentManager.shared.appKey)//APPKey_wjj APPKey  
105 - 126 + CNLiveNetworking.setupSignRequestKey("ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac")//CNLiveMCEnvironmentManager.shared.appKey)//APPKey_wjj APPKey
  127 +
106 CNLiveNetworking.requestNetwork(with: .POST, urlString: "\(CNLiveMCEnvironmentManager.shared.img_token_url)/vod_epg/getUploadAuthForApp", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in 128 CNLiveNetworking.requestNetwork(with: .POST, urlString: "\(CNLiveMCEnvironmentManager.shared.img_token_url)/vod_epg/getUploadAuthForApp", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
107 hiddenLoading() 129 hiddenLoading()
108 130
@@ -166,6 +188,21 @@ class UploadManager: NSObject { @@ -166,6 +188,21 @@ class UploadManager: NSObject {
166 let imageName = "802/mateCode/video/\(NSDate().string(withFormat: "yyyy/MM/dd") )/\(arc4random()).mp4" 188 let imageName = "802/mateCode/video/\(NSDate().string(withFormat: "yyyy/MM/dd") )/\(arc4random()).mp4"
167 return imageName 189 return imageName
168 } 190 }
  191 +
  192 + ///数字简历使用的bucket,图片bucket是"vitae_photo_" , 视频是"vitae_video_"
  193 + /// 设置图片名称
  194 + /// - Returns: 图片名
  195 + static private func createViateImageFileName() -> String {
  196 + let imageName = "802/mateCode/img/vitae_photo_0/\(NSDate().string(withFormat: "yyyy/MM/dd") )/\(arc4random()).jpg"
  197 + return imageName
  198 + }
  199 +
  200 + /// 设置视频名称
  201 + /// - Returns: 图片名
  202 + static private func createViateVideoFileName() -> String {
  203 + let imageName = "802/mateCode/video/vitae_video_0/\(NSDate().string(withFormat: "yyyy/MM/dd") )/\(arc4random()).mp4"
  204 + return imageName
  205 + }
169 } 206 }
170 207
171 class QiNiuUploadModel: BaseModel { 208 class QiNiuUploadModel: BaseModel {
metaCode/Classes/Main/HomePage/Controller/DigitalAuth/CNLiveDigitalResumeInfoController.swift
@@ -10,12 +10,10 @@ import SnapKit @@ -10,12 +10,10 @@ import SnapKit
10 import CoreLocation 10 import CoreLocation
11 11
12 12
13 -class CNLiveDigitalResumeInfoController:CNLiveBaseViewController, UITextFieldDelegate,CLLocationManagerDelegate{ 13 +class CNLiveDigitalResumeInfoController:CNLiveBaseViewController, UITextFieldDelegate{
14 14
15 var selectAreaVC:CNLiveDigitalResumeInfoSelectAddressController? 15 var selectAreaVC:CNLiveDigitalResumeInfoSelectAddressController?
16 16
17 - let locationManager = CLLocationManager()  
18 -  
19 lazy var topWhiteView :UIView = { 17 lazy var topWhiteView :UIView = {
20 let bottomNavView = UIView() 18 let bottomNavView = UIView()
21 bottomNavView.backgroundColor = .white 19 bottomNavView.backgroundColor = .white
metaCode/Classes/Main/HomePage/Controller/DigitalAuth/工作相关页面/CNLiveVitaeAddWorkController.swift
@@ -10,6 +10,11 @@ import SnapKit @@ -10,6 +10,11 @@ import SnapKit
10 10
11 class CNLiveVitaeAddWorkController:CNLiveBaseViewController,UITableViewDataSource, UITableViewDelegate{ 11 class CNLiveVitaeAddWorkController:CNLiveBaseViewController,UITableViewDataSource, UITableViewDelegate{
12 12
  13 + var hangHeight:CGFloat = (KSreenWidth-90)/3.0+10
  14 + var secCell:CNLiveVitaeAddWorkSecCell?
  15 + var seleArr:Array<String>?
  16 + var seleVideoUrl:String = ""
  17 +
13 let kCNLiveVitaeAddWorkFirCellIdentifier = "kCNLiveVitaeAddWorkFirCellIdentifier" 18 let kCNLiveVitaeAddWorkFirCellIdentifier = "kCNLiveVitaeAddWorkFirCellIdentifier"
14 let kCNLiveVitaeAddWorkSecCellIdentifier = "kCNLiveVitaeAddWorkSecCellIdentifier" 19 let kCNLiveVitaeAddWorkSecCellIdentifier = "kCNLiveVitaeAddWorkSecCellIdentifier"
15 let kCNLiveVitaeAddWorkThreeCellIdentifier = "kCNLiveVitaeAddWorkThreeCellIdentifier" 20 let kCNLiveVitaeAddWorkThreeCellIdentifier = "kCNLiveVitaeAddWorkThreeCellIdentifier"
@@ -117,6 +122,22 @@ class CNLiveVitaeAddWorkController:CNLiveBaseViewController,UITableViewDataSourc @@ -117,6 +122,22 @@ class CNLiveVitaeAddWorkController:CNLiveBaseViewController,UITableViewDataSourc
117 cell.uploadImageSuceessBlock = { imageUrl in 122 cell.uploadImageSuceessBlock = { imageUrl in
118 123
119 } 124 }
  125 + cell.selectUploadImageView?.changeUploadDataCallBack = { imageUrls , videoUrl in
  126 + self.seleVideoUrl = videoUrl
  127 + self.seleArr = imageUrls
  128 + }
  129 +
  130 + cell.updateAddWorkSecCellHeightBlock = {cell, hangHeight in
  131 + self.hangHeight = hangHeight
  132 + self.secCell = cell
  133 + let arr = cell.selectUploadImageView?.getCurrentSelectImageUrls()
  134 + let videoUrl = cell.selectUploadImageView?.getCurrentSelectVideoUrl()
  135 + self.seleVideoUrl = videoUrl ?? ""
  136 + self.seleArr = arr
  137 + self.tableView.reloadData()
  138 + print("11111video\(self.seleVideoUrl)")
  139 + print("11111photo\(self.seleArr)")
  140 + }
120 return cell 141 return cell
121 }else if indexPath.row == 2{ 142 }else if indexPath.row == 2{
122 //ThreeCell 143 //ThreeCell
@@ -139,7 +160,11 @@ class CNLiveVitaeAddWorkController:CNLiveBaseViewController,UITableViewDataSourc @@ -139,7 +160,11 @@ class CNLiveVitaeAddWorkController:CNLiveBaseViewController,UITableViewDataSourc
139 if indexPath.row == 0{ 160 if indexPath.row == 0{
140 return 276+15 161 return 276+15
141 }else if indexPath.row == 1{ 162 }else if indexPath.row == 1{
142 - return 368+15 163 + if self.secCell == nil{
  164 + return self.hangHeight+268+15
  165 + }else{
  166 + return self.hangHeight
  167 + }
143 }else if indexPath.row == 2{ 168 }else if indexPath.row == 2{
144 return 123+15 169 return 123+15
145 }else{ 170 }else{
@@ -149,25 +174,70 @@ class CNLiveVitaeAddWorkController:CNLiveBaseViewController,UITableViewDataSourc @@ -149,25 +174,70 @@ class CNLiveVitaeAddWorkController:CNLiveBaseViewController,UITableViewDataSourc
149 174
150 //确认提交证书 175 //确认提交证书
151 @objc func addWorkBtnAction(){ 176 @objc func addWorkBtnAction(){
152 -// let cell = self.tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as! CNLiveVitaeCertificateAddInfoCell  
153 -// //判断非空  
154 -// if self.seleImage == nil{  
155 -// showMessage(message: "请上传图片")  
156 -// return  
157 -// }  
158 -// if cell.cerNameTF.text?.count == 0{  
159 -// showMessage(message: "请填写证书名称")  
160 -// return  
161 -// }  
162 -// if cell.cerNumberTF.text?.count == 0{  
163 -// showMessage(message: "请填写资格证编号")  
164 -// return  
165 -// }  
166 -// if cell.cerJiGouTF.text?.count == 0{  
167 -// showMessage(message: "请填写发证机构")  
168 -// return  
169 -// }  
170 -// let vsid = UserInfoManager.shared.userInfo.currentUser?.vsid ?? "" 177 + let firCell = self.tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as? CNLiveVitaeAddWorkFirCell
  178 + let secCell = self.tableView.cellForRow(at: IndexPath(row: 1, section: 0)) as? CNLiveVitaeAddWorkSecCell
  179 + let threeCell = self.tableView.cellForRow(at: IndexPath(row: 2, section: 0)) as? CNLiveVitaeAddWorkThreeCell
  180 + //判断非空
  181 + if firCell?.weizhiRightTitleLabel.text?.count == 0 || firCell?.weizhiRightTitleLabel.text == "请选择"{
  182 + showMessage(message: "请选择职业")
  183 + return
  184 + }
  185 + if firCell?.phoneTextFiled.text?.count == 0 || firCell?.phoneTextFiled.text == "请填写"{
  186 + showMessage(message: "请填写岗位名称")
  187 + return
  188 + }
  189 + if firCell?.canjiaRightTitleLabel.text?.count == 0 || firCell?.canjiaRightTitleLabel.text == "请选择"{
  190 + showMessage(message: "请选择开始时间")
  191 + return
  192 + }
  193 + if firCell?.endTimeRightTitleLabel.text?.count == 0 || firCell?.endTimeRightTitleLabel.text == "请选择"{
  194 + showMessage(message: "请选择结束时间")
  195 + return
  196 + }
  197 + if secCell?.huoJiangtextView.text?.count == 0 || secCell?.huoJiangtextView.text == "获奖描述"{
  198 + showMessage(message: "请填写经历描述")
  199 + return
  200 + }
  201 +
  202 + var newString = ""
  203 + if self.seleArr?.count ?? 0 > 0{
  204 + if self.seleVideoUrl.count > 0{
  205 + self.seleArr!.append(self.seleVideoUrl)
  206 + }
  207 + newString = self.seleArr!.joined(separator: ",")
  208 + }else{
  209 + if self.seleArr == nil || self.seleArr?.count ?? 0 == 0{
  210 + if self.seleVideoUrl.count == 0{
  211 + //
  212 + showMessage(message: "请上传凭证")
  213 + return
  214 + }else{
  215 + if self.seleVideoUrl.count > 0{
  216 + newString = self.seleVideoUrl
  217 + }
  218 + }
  219 + }else{
  220 +
  221 + }
  222 + }
  223 + let danWei = threeCell?.phoneTextFiled.text ?? ""
  224 + let workDiDian = threeCell?.weizhiRightTitleLabel.text ?? ""
  225 + let vsid = UserInfoManager.shared.userInfo.currentUser?.vsid ?? ""
  226 + if let userDic = UserDefaults.standard.dictionary(forKey: UserInfoManager.shared.userInfo.uid){
  227 + let jianli_vitaeId = userDic["jianli_vitaeId"] as? String
  228 + let vsid = userDic["vsid"] as? String
  229 + //提交工作记录
  230 + CNLiveVitaeViewModel.saveWork(city: workDiDian, companyName: danWei, imgs: newString, jobDuties: secCell?.huoJiangtextView.text ?? "", startWorkingDate: firCell?.canjiaRightTitleLabel.text ?? "", endWorkingDate: firCell?.endTimeRightTitleLabel.text ?? "", position: firCell?.phoneTextFiled.text ?? "", profession: firCell?.weizhiRightTitleLabel.text ?? "", vsid: vsid ?? "", vitaeId: jianli_vitaeId ?? "") { result, status in
  231 + if status == .success{
  232 + self.navigationController?.viewControllers.forEach({ item in
  233 + if (item.isKind(of: CNLiveDigitalResumeController.self)) {
  234 + self.navigationController?.popToViewController(item, animated: true)
  235 + }
  236 + })
  237 + }
  238 + }
  239 +
  240 + }
171 // //提交证书 241 // //提交证书
172 // CNLiveVitaeViewModel.saveCertificate(img: self.seleImageUrl, lv: cell.cerLevelTF.text ?? "", number: cell.cerNumberTF.text ?? "", organization: cell.cerJiGouTF.text ?? "", time: cell.cerTimeTF.text ?? "", title: cell.cerNameTF.text ?? "", uploadTime: "", validity: cell.cerYouXiaoTF.text ?? "", vsid: vsid){result, respStatue in 242 // CNLiveVitaeViewModel.saveCertificate(img: self.seleImageUrl, lv: cell.cerLevelTF.text ?? "", number: cell.cerNumberTF.text ?? "", organization: cell.cerJiGouTF.text ?? "", time: cell.cerTimeTF.text ?? "", title: cell.cerNameTF.text ?? "", uploadTime: "", validity: cell.cerYouXiaoTF.text ?? "", vsid: vsid){result, respStatue in
173 // if respStatue == .success{ 243 // if respStatue == .success{
@@ -179,5 +249,6 @@ class CNLiveVitaeAddWorkController:CNLiveBaseViewController,UITableViewDataSourc @@ -179,5 +249,6 @@ class CNLiveVitaeAddWorkController:CNLiveBaseViewController,UITableViewDataSourc
179 // } 249 // }
180 // 250 //
181 // } 251 // }
  252 +
182 } 253 }
183 } 254 }
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/DigitalResume/CNLiveDigitalResumeCell.swift
@@ -241,7 +241,7 @@ class CNLiveDigitalResumeCell: UITableViewCell { @@ -241,7 +241,7 @@ class CNLiveDigitalResumeCell: UITableViewCell {
241 lazy var chakanTitleLabel: UILabel = { 241 lazy var chakanTitleLabel: UILabel = {
242 let titleLabel = UILabel() 242 let titleLabel = UILabel()
243 titleLabel.textColor = HexColor("#999999") 243 titleLabel.textColor = HexColor("#999999")
244 - titleLabel.textAlignment = .right 244 + titleLabel.textAlignment = .center
245 titleLabel.text = "查看完整资料 >" 245 titleLabel.text = "查看完整资料 >"
246 titleLabel.font = Font_14 246 titleLabel.font = Font_14
247 titleLabel.isUserInteractionEnabled = true 247 titleLabel.isUserInteractionEnabled = true
@@ -462,7 +462,7 @@ class CNLiveDigitalResumeCell: UITableViewCell { @@ -462,7 +462,7 @@ class CNLiveDigitalResumeCell: UITableViewCell {
462 self.chakanTitleLabel.snp.makeConstraints { make in 462 self.chakanTitleLabel.snp.makeConstraints { make in
463 make.top.equalTo(self.bottomLineView.snp.bottom).offset(15) 463 make.top.equalTo(self.bottomLineView.snp.bottom).offset(15)
464 make.centerX.equalToSuperview() 464 make.centerX.equalToSuperview()
465 - make.width.equalTo(100) 465 + make.width.equalTo(200)
466 } 466 }
467 self.whiteBgView.addSubview(self.shezhiView) 467 self.whiteBgView.addSubview(self.shezhiView)
468 self.shezhiView.snp.makeConstraints { make in 468 self.shezhiView.snp.makeConstraints { make in
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/Vitae/Certificate/CNLiveVitaeCertificateAddPhotoCell.swift
@@ -190,7 +190,7 @@ extension CNLiveVitaeCertificateAddPhotoCell { @@ -190,7 +190,7 @@ extension CNLiveVitaeCertificateAddPhotoCell {
190 didFinishSelection result: PickerResult) { 190 didFinishSelection result: PickerResult) {
191 result.getImage { [weak self] (image, photoAsset, index) in 191 result.getImage { [weak self] (image, photoAsset, index) in
192 if let image = image { 192 if let image = image {
193 - let uploadKey = UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in 193 + let uploadKey = UploadManager.uploadViateImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in
194 print("获取进度==>\(progress)") 194 print("获取进度==>\(progress)")
195 }, successBlock: { [weak self] key,url in 195 }, successBlock: { [weak self] key,url in
196 self?.selectImageBlock?(image,key,url) 196 self?.selectImageBlock?(image,key,url)
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/Vitae/Work/CNLiveVitaeAddWorkFirCell.swift
@@ -306,14 +306,60 @@ class CNLiveVitaeAddWorkFirCell:UITableViewCell, UITextFieldDelegate{ @@ -306,14 +306,60 @@ class CNLiveVitaeAddWorkFirCell:UITableViewCell, UITextFieldDelegate{
306 } 306 }
307 307
308 @objc func startTimeTapAction(){ 308 @objc func startTimeTapAction(){
309 - 309 + currentViewController()?.view.endEditing(true)
  310 + MineInfoAlertView.showSelectView(showType: .selectDay) { [weak self] text in
  311 + print("刷新之后的数据是=>\(text)")//"2024-06-18"
  312 + if (text as! String).count > 0{
  313 + let textStr = text as! String
  314 + self?.canjiaRightTitleLabel.text = textStr
  315 + self?.canjiaRightTitleLabel.textColor = HexColor("#333333")
  316 + }else{
  317 + self?.canjiaRightTitleLabel.text = "请选择"
  318 + self?.canjiaRightTitleLabel.textColor = HexColor("#B4B4B4")
  319 + }
  320 + }
310 } 321 }
311 @objc func endTimeTapAction(){ 322 @objc func endTimeTapAction(){
312 - 323 + currentViewController()?.view.endEditing(true)
  324 + MineInfoAlertView.showSelectView(showType: .selectDay) { [weak self] text in
  325 + print("刷新之后的数据是=>\(text)")//"2024-06-18"
  326 + if (text as! String).count > 0{
  327 + let textStr = text as! String
  328 + self?.endTimeRightTitleLabel.text = textStr
  329 + self?.endTimeRightTitleLabel.textColor = HexColor("#333333")
  330 + }else{
  331 + self?.endTimeRightTitleLabel.text = "请选择"
  332 + self?.endTimeRightTitleLabel.textColor = HexColor("#B4B4B4")
  333 + }
  334 + }
313 } 335 }
314 336
315 @objc func zhiJinBtnAction(){ 337 @objc func zhiJinBtnAction(){
316 - 338 + if let text = getCurrentDateAsString() {
  339 + print(text) // 输出类似 "2024-06-18" 的字符串,具体取决于当前日期
  340 + let textStr = text
  341 + self.endTimeRightTitleLabel.text = textStr
  342 + self.endTimeRightTitleLabel.textColor = HexColor("#333333")
  343 + }else{
  344 + self.endTimeRightTitleLabel.text = "请选择"
  345 + self.endTimeRightTitleLabel.textColor = HexColor("#B4B4B4")
  346 + }
  347 + }
  348 + func getCurrentDateAsString() -> String? {
  349 + // 创建一个Date对象,它默认表示当前日期和时间
  350 + let now = Date()
  351 +
  352 + // 创建一个DateFormatter对象
  353 + let formatter = DateFormatter()
  354 +
  355 + // 设置DateFormatter的日期格式
  356 + formatter.dateFormat = "yyyy-MM-dd"
  357 +
  358 + // 使用DateFormatter将Date对象格式化为字符串
  359 + let dateString = formatter.string(from: now)
  360 +
  361 + // 返回格式化后的日期字符串
  362 + return dateString
317 } 363 }
318 364
319 } 365 }
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/Vitae/Work/CNLiveVitaeAddWorkSecCell.swift
@@ -9,7 +9,7 @@ import Foundation @@ -9,7 +9,7 @@ import Foundation
9 import Kingfisher 9 import Kingfisher
10 import SnapKit 10 import SnapKit
11 11
12 -typealias UpdateAddWorkSecCellHeightBlock = (_ currentCell: CNLiveVitaeAddWorkSecCell ,_ height:Int) -> Void 12 +typealias UpdateAddWorkSecCellHeightBlock = (_ currentCell: CNLiveVitaeAddWorkSecCell ,_ uploadHeight:CGFloat) -> Void
13 13
14 class CNLiveVitaeAddWorkSecCell:UITableViewCell, UITextViewDelegate{ 14 class CNLiveVitaeAddWorkSecCell:UITableViewCell, UITextViewDelegate{
15 var updateAddWorkSecCellHeightBlock:UpdateAddWorkSecCellHeightBlock? 15 var updateAddWorkSecCellHeightBlock:UpdateAddWorkSecCellHeightBlock?
@@ -66,14 +66,54 @@ class CNLiveVitaeAddWorkSecCell:UITableViewCell, UITextViewDelegate{ @@ -66,14 +66,54 @@ class CNLiveVitaeAddWorkSecCell:UITableViewCell, UITextViewDelegate{
66 var selectUploadImageView:CNLiveAddGoodsSelectUploadImageView?{ 66 var selectUploadImageView:CNLiveAddGoodsSelectUploadImageView?{
67 get{ 67 get{
68 if _selectUploadImageView == nil{ 68 if _selectUploadImageView == nil{
69 - _selectUploadImageView = CNLiveAddGoodsSelectUploadImageView(frame: CGRect(x: 0, y: 248, width: KSreenWidth, height: 100)) 69 + _selectUploadImageView = CNLiveAddGoodsSelectUploadImageView(frame: CGRect(x: 0, y: 248, width: KSreenWidth-30, height: 110))
70 _selectUploadImageView?.maxSelectImageCount = 9 70 _selectUploadImageView?.maxSelectImageCount = 9
  71 + _selectUploadImageView?.column = 3
71 _selectUploadImageView?.isAbleSelectVideo = true 72 _selectUploadImageView?.isAbleSelectVideo = true
  73 + _selectUploadImageView?.isViate = true
72 _selectUploadImageView?.deleteImage = UIImage(named: "DS_happ_daren_dynamic_delete") 74 _selectUploadImageView?.deleteImage = UIImage(named: "DS_happ_daren_dynamic_delete")
  75 + _selectUploadImageView?.changeFrameCallBack = {
  76 + let whiteH = self.selectUploadImageView!.height + self.selectUploadImageView!.top+20
  77 + self.topWhiteView.snp.remakeConstraints { make in
  78 + make.top.equalTo(15)
  79 + make.left.equalTo(15)
  80 + make.right.equalToSuperview().offset(-15)
  81 + make.height.equalTo(whiteH)
  82 + }
  83 + self.updateAddWorkSecCellHeightBlock!(self, whiteH+20)
  84 +
  85 + }
73 _selectUploadImageView?.endUploadImageCallBack = { 86 _selectUploadImageView?.endUploadImageCallBack = {
74 let imageUrl = self.selectUploadImageView?.getCurrentSelectImageUrls().first 87 let imageUrl = self.selectUploadImageView?.getCurrentSelectImageUrls().first
75 self.uploadImageSuceessBlock!(imageUrl ?? "") 88 self.uploadImageSuceessBlock!(imageUrl ?? "")
  89 +
  90 + let arr = self.selectUploadImageView?.getCurrentSelectImageUrls()
  91 + var hangNum = 1
  92 + if arr?.count ?? 0 <= 1{
  93 + hangNum = 1
  94 + }else if arr?.count ?? 0 <= 4{
  95 + hangNum = 2
  96 + }else if arr?.count ?? 0 <= 9{
  97 + hangNum = 3
  98 + }else{
  99 + hangNum = 4
  100 + }
  101 + let addXRSpace = 15 - 17*0.5
  102 + let addXSpace = 15 - 17*0.5
  103 + let column:CGFloat = 3
  104 + let totalSpace = 15 + addXRSpace + addXSpace*CGFloat(column - 1)
  105 + let aHeight = ((KSreenWidth-30 - totalSpace) / column)
  106 + self.selectUploadImageView?.height = (aHeight+10)*CGFloat(hangNum)
  107 + let whiteH = self.selectUploadImageView!.height + self.selectUploadImageView!.top+20
  108 + self.topWhiteView.snp.remakeConstraints { make in
  109 + make.top.equalTo(15)
  110 + make.left.equalTo(15)
  111 + make.right.equalToSuperview().offset(-15)
  112 + make.height.equalTo(whiteH)
  113 + }
  114 + self.updateAddWorkSecCellHeightBlock!(self, whiteH+20)
76 } 115 }
  116 +
77 117
78 } 118 }
79 return _selectUploadImageView 119 return _selectUploadImageView
@@ -103,7 +143,7 @@ class CNLiveVitaeAddWorkSecCell:UITableViewCell, UITextViewDelegate{ @@ -103,7 +143,7 @@ class CNLiveVitaeAddWorkSecCell:UITableViewCell, UITextViewDelegate{
103 make.top.equalTo(15) 143 make.top.equalTo(15)
104 make.left.equalTo(15) 144 make.left.equalTo(15)
105 make.right.equalToSuperview().offset(-15) 145 make.right.equalToSuperview().offset(-15)
106 - make.height.equalTo(368) 146 + make.height.equalTo(368+15)
107 } 147 }
108 self.topWhiteView.addSubview(self.weizhiTitleLabel) 148 self.topWhiteView.addSubview(self.weizhiTitleLabel)
109 self.weizhiTitleLabel.snp.makeConstraints { make in 149 self.weizhiTitleLabel.snp.makeConstraints { make in
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/Vitae/Work/CNLiveVitaeAddWorkThreeCell.swift
@@ -10,6 +10,8 @@ import Kingfisher @@ -10,6 +10,8 @@ import Kingfisher
10 import SnapKit 10 import SnapKit
11 11
12 class CNLiveVitaeAddWorkThreeCell:UITableViewCell, UITextFieldDelegate{ 12 class CNLiveVitaeAddWorkThreeCell:UITableViewCell, UITextFieldDelegate{
  13 + var selectAreaVC:CNLiveDigitalResumeInfoSelectAddressController?
  14 +
13 lazy var topWhiteView :UIView = { 15 lazy var topWhiteView :UIView = {
14 let bottomNavView = UIView() 16 let bottomNavView = UIView()
15 bottomNavView.backgroundColor = .white 17 bottomNavView.backgroundColor = .white
@@ -185,8 +187,24 @@ class CNLiveVitaeAddWorkThreeCell:UITableViewCell, UITextFieldDelegate{ @@ -185,8 +187,24 @@ class CNLiveVitaeAddWorkThreeCell:UITableViewCell, UITextFieldDelegate{
185 } 187 }
186 188
187 @objc func workCityTapAction(){ 189 @objc func workCityTapAction(){
188 - 190 + self.displaySelectAreaVC()
189 } 191 }
  192 + func displaySelectAreaVC(){
  193 + if self.selectAreaVC == nil{
  194 + let vc = CNLiveDigitalResumeInfoSelectAddressController()
  195 + vc.finishSelectAreaCallBack = { [weak self] in
  196 + self?.weizhiRightTitleLabel.text = String(format: "%@%@%@",self?.selectAreaVC?.province ?? "",self?.selectAreaVC?.city ?? "",self?.selectAreaVC?.area ?? "" )
  197 + }
  198 + let currVC = currentViewController()
  199 + currVC?.addChild(vc)
  200 + vc.view.frame = CGRect(x: 0, y: 0, width: KSreenWidth, height: KSreenHeight)
  201 + currVC?.view.addSubview(vc.view)
  202 + vc.didMove(toParent: currVC)
  203 + self.selectAreaVC = vc
  204 + }
  205 + self.selectAreaVC?.display()
  206 + }
  207 +
190 208
191 } 209 }
192 210
metaCode/Classes/Main/HomePage/View/Shop/GoodsManager/CNLiveAddGoodsSelectUploadImageView.swift
@@ -36,6 +36,7 @@ typealias endUploadImageCallBackBlock = ()-&gt;Void @@ -36,6 +36,7 @@ typealias endUploadImageCallBackBlock = ()-&gt;Void
36 36
37 37
38 class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegate, PhotoPickerControllerDelegate { 38 class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegate, PhotoPickerControllerDelegate {
  39 + var isViate = false//是否是 数字简历,bucket不一样
39 40
40 // MARK: - 属性 41 // MARK: - 属性
41 /// 显示类型 42 /// 显示类型
@@ -715,6 +716,26 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat @@ -715,6 +716,26 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat
715 } 716 }
716 } 717 }
717 break 718 break
  719 + }else{
  720 + if model.isVideo == true{
  721 + //当前要删除的是视频
  722 + if self.uploadVideoModel?.isVideo == true{
  723 + //subview是视频
  724 + if self.uploadVideoModel?.isUploading == true{
  725 + //subview正在上传中
  726 + UploadManager.shared.cancelUploadKey(key: self.uploadVideoModel!.uploadKey!)
  727 + self.uploadVideoModel = nil
  728 + }else{
  729 + //subview上传完成
  730 + //标记当前有视频,并替换model
  731 + self.replaceVideoUrls.append(self.uploadVideoModel!)
  732 + let videoModel = CNLiveSelectUploadImageModel()
  733 + videoModel.isVideo = true
  734 + self.uploadVideoModel = videoModel
  735 + }
  736 + }
  737 + break
  738 + }
718 } 739 }
719 740
720 } 741 }
@@ -746,25 +767,47 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat @@ -746,25 +767,47 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat
746 self.uploadVideoModel?.image = firstImage.first 767 self.uploadVideoModel?.image = firstImage.first
747 self.uploadVideoModel?.localVideoUrl = videoUrl 768 self.uploadVideoModel?.localVideoUrl = videoUrl
748 self.uploadVideoModel?.isUploading = true 769 self.uploadVideoModel?.isUploading = true
749 -  
750 - self.uploadVideoModel?.uploadKey = UploadManager.uploadVideo(videoData: videoData, progressBlock: { [weak self] key, progress in  
751 - self!.uploadVideoModel?.uploadingPercent = progress  
752 - self?.replaceVideoModelInSubviews(model: (self?.uploadVideoModel)!, target: firstImage.first!)  
753 - }, successBlock: { [weak self] key,url in  
754 - self?.uploadVideoModel?.videoUrl = url  
755 - self?.uploadVideoModel?.isUploading = false  
756 - self?.uploadVideoModel?.uploadKey = nil  
757 - self?.replaceVideoModelInSubviews(model: (self?.uploadVideoModel)!, target: firstImage.first!)  
758 - self?.uploadingCount = self!.uploadingCount - 1  
759 - if self?.uploadingCount == 0{  
760 - if ((self?.endUploadImageCallBack?()) != nil){  
761 - self?.endUploadImageCallBack!() 770 + if self.isViate == true{
  771 + self.uploadVideoModel?.uploadKey = UploadManager.uploadViateVideo(videoData: videoData, progressBlock: { [weak self] key, progress in
  772 + self!.uploadVideoModel?.uploadingPercent = progress
  773 + self?.replaceVideoModelInSubviews(model: (self?.uploadVideoModel)!, target: firstImage.first!)
  774 + }, successBlock: { [weak self] key,url in
  775 + self?.uploadVideoModel?.videoUrl = url
  776 + self?.uploadVideoModel?.isUploading = false
  777 + self?.uploadVideoModel?.uploadKey = nil
  778 + self?.replaceVideoModelInSubviews(model: (self?.uploadVideoModel)!, target: firstImage.first!)
  779 + self?.uploadingCount = self!.uploadingCount - 1
  780 + if self?.uploadingCount == 0{
  781 + if ((self?.endUploadImageCallBack?()) != nil){
  782 + self?.endUploadImageCallBack!()
  783 + }
762 } 784 }
763 - }  
764 - if ((self?.changeUploadDataCallBack?((self?.getCurrentSelectImageUrls())!,(self?.getCurrentSelectVideoUrl())!)) != nil){  
765 - self?.changeUploadDataCallBack!((self?.getCurrentSelectImageUrls())!,(self?.getCurrentSelectVideoUrl())!)  
766 - }  
767 - }) 785 + if ((self?.changeUploadDataCallBack?((self?.getCurrentSelectImageUrls())!,(self?.getCurrentSelectVideoUrl())!)) != nil){
  786 + self?.changeUploadDataCallBack!((self?.getCurrentSelectImageUrls())!,(self?.getCurrentSelectVideoUrl())!)
  787 + }
  788 + })
  789 +
  790 + }else{
  791 + self.uploadVideoModel?.uploadKey = UploadManager.uploadVideo(videoData: videoData, progressBlock: { [weak self] key, progress in
  792 + self!.uploadVideoModel?.uploadingPercent = progress
  793 + self?.replaceVideoModelInSubviews(model: (self?.uploadVideoModel)!, target: firstImage.first!)
  794 + }, successBlock: { [weak self] key,url in
  795 + self?.uploadVideoModel?.videoUrl = url
  796 + self?.uploadVideoModel?.isUploading = false
  797 + self?.uploadVideoModel?.uploadKey = nil
  798 + self?.replaceVideoModelInSubviews(model: (self?.uploadVideoModel)!, target: firstImage.first!)
  799 + self?.uploadingCount = self!.uploadingCount - 1
  800 + if self?.uploadingCount == 0{
  801 + if ((self?.endUploadImageCallBack?()) != nil){
  802 + self?.endUploadImageCallBack!()
  803 + }
  804 + }
  805 + if ((self?.changeUploadDataCallBack?((self?.getCurrentSelectImageUrls())!,(self?.getCurrentSelectVideoUrl())!)) != nil){
  806 + self?.changeUploadDataCallBack!((self?.getCurrentSelectImageUrls())!,(self?.getCurrentSelectVideoUrl())!)
  807 + }
  808 + })
  809 +
  810 + }
768 DispatchQueue.main.async { 811 DispatchQueue.main.async {
769 self.resetUI() 812 self.resetUI()
770 self.autoAdjustHeight() 813 self.autoAdjustHeight()
@@ -790,27 +833,54 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat @@ -790,27 +833,54 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat
790 model.image = image 833 model.image = image
791 model.isUploading = true 834 model.isUploading = true
792 835
793 - self!.uploadVideoModel?.uploadKey = UploadManager.uploadImage(imageData: imageData) { [weak self] key, percent in  
794 - model.uploadingPercent = percent  
795 - self?.replaceImageModelInDataArr(model: model, target: image)  
796 - } successBlock: { key, url in  
797 - model.imageUrl = url  
798 - model.isUploading = false  
799 - model.uploadKey = nil  
800 - self!.replaceImageModelInDataArr(model: model, target: image)  
801 -  
802 - self!.uploadingCount = self!.uploadingCount - 1  
803 -  
804 - if self!.uploadingCount == 0{  
805 - if self!.endUploadImageCallBack?() != nil{  
806 - self!.endUploadImageCallBack!() 836 + if self!.isViate == true{
  837 + self!.uploadVideoModel?.uploadKey = UploadManager.uploadViateImage(imageData: imageData) { [weak self] key, percent in
  838 + model.uploadingPercent = percent
  839 + self?.replaceImageModelInDataArr(model: model, target: image)
  840 + } successBlock: { key, url in
  841 + model.imageUrl = url
  842 + model.isUploading = false
  843 + model.uploadKey = nil
  844 + self!.replaceImageModelInDataArr(model: model, target: image)
  845 +
  846 + self!.uploadingCount = self!.uploadingCount - 1
  847 +
  848 + if self!.uploadingCount == 0{
  849 + if self!.endUploadImageCallBack?() != nil{
  850 + self!.endUploadImageCallBack!()
  851 + }
  852 + }
  853 +
  854 + if self!.changeUploadDataCallBack?(self!.getCurrentSelectImageUrls(),self!.getCurrentSelectVideoUrl()) != nil{
  855 + self!.changeUploadDataCallBack!(self!.getCurrentSelectImageUrls(),self!.getCurrentSelectVideoUrl())
807 } 856 }
808 } 857 }
809 -  
810 - if self!.changeUploadDataCallBack?(self!.getCurrentSelectImageUrls(),self!.getCurrentSelectVideoUrl()) != nil{  
811 - self!.changeUploadDataCallBack!(self!.getCurrentSelectImageUrls(),self!.getCurrentSelectVideoUrl()) 858 +
  859 + }else{
  860 + self!.uploadVideoModel?.uploadKey = UploadManager.uploadImage(imageData: imageData) { [weak self] key, percent in
  861 + model.uploadingPercent = percent
  862 + self?.replaceImageModelInDataArr(model: model, target: image)
  863 + } successBlock: { key, url in
  864 + model.imageUrl = url
  865 + model.isUploading = false
  866 + model.uploadKey = nil
  867 + self!.replaceImageModelInDataArr(model: model, target: image)
  868 +
  869 + self!.uploadingCount = self!.uploadingCount - 1
  870 +
  871 + if self!.uploadingCount == 0{
  872 + if self!.endUploadImageCallBack?() != nil{
  873 + self!.endUploadImageCallBack!()
  874 + }
  875 + }
  876 +
  877 + if self!.changeUploadDataCallBack?(self!.getCurrentSelectImageUrls(),self!.getCurrentSelectVideoUrl()) != nil{
  878 + self!.changeUploadDataCallBack!(self!.getCurrentSelectImageUrls(),self!.getCurrentSelectVideoUrl())
  879 + }
812 } 880 }
  881 +
813 } 882 }
  883 +
814 self!.uploadImageUrls.append(model) 884 self!.uploadImageUrls.append(model)
815 self!.resetUI() 885 self!.resetUI()
816 self!.autoAdjustHeight() 886 self!.autoAdjustHeight()
metaCode/Classes/Main/HomePage/ViewModel/Vitae/CNLiveVitaeViewModel.swift
@@ -231,6 +231,65 @@ class CNLiveVitaeViewModel:NSObject{ @@ -231,6 +231,65 @@ class CNLiveVitaeViewModel:NSObject{
231 } 231 }
232 232
233 } 233 }
  234 +
  235 + /*
  236 + 保存简历-工作经历(新增工作记录)
  237 + 参数 vsid 实名对象id
  238 + */
  239 + static func saveWork(city:String,companyName:String,imgs:String,jobDuties:String,startWorkingDate:String,endWorkingDate:String,position:String,profession:String,vsid:String,vitaeId:String,resultBlock: @escaping downSlideResultBlock) {
  240 + let values = NSMutableDictionary()
  241 + values.addEntries(from: ["profession":profession])
  242 + values.addEntries(from: ["position":position])
  243 + values.addEntries(from: ["startWorkingDate":startWorkingDate])
  244 + values.addEntries(from: ["endWorkingDate":endWorkingDate])
  245 + values.addEntries(from: ["jobDuties":jobDuties])
  246 + values.addEntries(from: ["imgs":imgs])
  247 + values.addEntries(from: ["companyName":companyName])
  248 + values.addEntries(from: ["city":city])
  249 + values.addEntries(from: ["vsid":vsid])
  250 + values.addEntries(from: ["vitaeId":vitaeId])
  251 + do {
  252 + let request = URLRequest.init(url: URL.init(string: APPBaseMCUrl+"/userApi/saveVitaeWork")!) as! NSMutableURLRequest
  253 + request.httpMethod = "POST"
  254 + request.timeoutInterval = 10
  255 + request.setValue("application/json", forHTTPHeaderField: "Content-Type")
  256 + let data = try JSONSerialization.data(withJSONObject: values, options: .prettyPrinted)
  257 + request.httpBody = data
  258 + showLoading(message: "")
  259 + let custom_param = NSMutableDictionary()
  260 + custom_param.setValue(CNLiveMCEnvironmentManager.shared.appId, forKey: "appId")
  261 + custom_param.setValue(CNLiveMCEnvironmentManager.shared.appKey, forKey: "appKey")
  262 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
  263 + CNLiveNetworking.setAllowRequestDefaultArgument(false)
  264 + CNLiveNetworking.setupShowDataResult(false)
  265 + CNLiveNetworking.setBuildCustomUrlRequest(request as URLRequest) { task, result, error in
  266 + hiddenLoading()
  267 + if (error == nil) {
  268 + let resp = result as! NSDictionary
  269 + let errorCode = "\(resp["errorCode"] ?? "0")"
  270 + if (errorCode == "0") {
  271 + resultBlock(true,.success)
  272 + } else {
  273 + showMessage(message: resp["errorMessage"] as! String)
  274 + resultBlock(NSNull(),.failed)
  275 + }
  276 + } else {
  277 + if CNLiveNetworking.isNetworking() {
  278 + showMessage(message: "上传失败")
  279 + resultBlock(NSNull(),.failed)
  280 + } else {
  281 + showMessage(message: "似乎与网络断开链接")
  282 + resultBlock(NSNull(),.noNetwork)
  283 + }
  284 + }
  285 + }
  286 + } catch {
  287 + showMessage(message: "上传失败")
  288 + resultBlock(NSNull(),.failed)
  289 + }
  290 +
  291 + }
  292 +
234 } 293 }
235 294
236 295
metaCode/Classes/Main/MinePage/View/CNLiveMineInfoAlertView.swift
@@ -287,8 +287,8 @@ class MineInfoAlertView: UIView { @@ -287,8 +287,8 @@ class MineInfoAlertView: UIView {
287 case .other: 287 case .other:
288 break 288 break
289 } 289 }
290 -  
291 - let window = UIApplication.shared.windows.last 290 +
  291 + let window = UIApplication.shared.windows.first
292 window?.addSubview(pickerView) 292 window?.addSubview(pickerView)
293 pickerView.snp.makeConstraints { make in 293 pickerView.snp.makeConstraints { make in
294 make.edges.equalToSuperview() 294 make.edges.equalToSuperview()
@@ -334,6 +334,14 @@ class MineInfoAlertView: UIView { @@ -334,6 +334,14 @@ class MineInfoAlertView: UIView {
334 } 334 }
335 if type == .selectDay { 335 if type == .selectDay {
336 value = selectDay ?? "" 336 value = selectDay ?? ""
  337 + if value.count == 0{
  338 + let formatter = DateFormatter()
  339 + formatter.dateFormat = "yyyy-MM-dd"
  340 + let date = formatter.string(from: datePicker.date)
  341 + print("获取到的时间是:\(date)")
  342 + result!(date)
  343 + return
  344 + }
337 result!(value) 345 result!(value)
338 return 346 return
339 } 347 }