Commit ecaee50daf10723f379fc4af051cb3d6ebbcefe4
1 parent
7c172508
我的数字简历-修改头像
Showing
3 changed files
with
123 additions
and
13 deletions
metaCode/Classes/Main/HomePage/View/DigitalAuthViews/DigitalResume/CNLiveDigitalResumeCell.swift
| ... | ... | @@ -74,6 +74,7 @@ class CNLiveDigitalResumeCell: UITableViewCell { |
| 74 | 74 | iconImgView.image = UIImage(named: "mine_jianli_icon") |
| 75 | 75 | iconImgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(jianliIconAction))) |
| 76 | 76 | iconImgView.isUserInteractionEnabled = true |
| 77 | + iconImgView.contentMode = .scaleAspectFit | |
| 77 | 78 | return iconImgView |
| 78 | 79 | }() |
| 79 | 80 | //已认证 名字 |
| ... | ... | @@ -666,7 +667,12 @@ class CNLiveDigitalResumeCell: UITableViewCell { |
| 666 | 667 | |
| 667 | 668 | // MARK: - buttonAction |
| 668 | 669 | @objc func jianliIconAction(){ |
| 669 | - | |
| 670 | + //换简历头像 | |
| 671 | + let vc = CNLiveMineInfoViewController.init(mineIconType: .mineViateIcon, result: { image in | |
| 672 | + self.jianliIconImgView.image = image | |
| 673 | + self.updateViateDataBlock?() | |
| 674 | + }) | |
| 675 | + navigationViewController().pushViewController(vc, animated: true) | |
| 670 | 676 | } |
| 671 | 677 | @objc func changePersonBtnAction(){ |
| 672 | 678 | var infoArr = Array<String>() |
| ... | ... | @@ -748,6 +754,8 @@ class CNLiveDigitalResumeCell: UITableViewCell { |
| 748 | 754 | |
| 749 | 755 | |
| 750 | 756 | func setupNewUI(model:CNLiveVitaeModel){ |
| 757 | + | |
| 758 | + self.jianliIconImgView.kf.setImage(with: URL(string: model.vitae?.icon ?? ""), placeholder: UIImage(named: "mine_jianli_icon")) | |
| 751 | 759 | let name = UserInfoManager.shared.userInfo.currentUser?.name ?? "" |
| 752 | 760 | self.authNameTitleLabel.text = name |
| 753 | 761 | let idNo = UserInfoManager.shared.userInfo.currentUser?.idNo ?? "" | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInfoViewController.swift
| ... | ... | @@ -3,14 +3,23 @@ |
| 3 | 3 | // metaCode |
| 4 | 4 | // |
| 5 | 5 | // Created by open on 2023/6/9. |
| 6 | -// | |
| 6 | +// 我的-修改头像页面 / 我的-数字简历-简历头像 | |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | 9 | import HXPHPicker |
| 10 | 10 | import Kingfisher |
| 11 | 11 | import APButton |
| 12 | 12 | typealias ClickInfoResultBlock = (_ image: UIImage) -> Void |
| 13 | +/// 头像类型 | |
| 14 | +enum CNLiveMineIconType { | |
| 15 | + ///我的个人头像 | |
| 16 | + case mineIcon | |
| 17 | + ///我的简历头像 | |
| 18 | + case mineViateIcon | |
| 19 | +} | |
| 20 | + | |
| 13 | 21 | class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControllerDelegate { |
| 22 | + var mineIconType:CNLiveMineIconType = .mineIcon | |
| 14 | 23 | |
| 15 | 24 | lazy var imageView: UIImageView = { |
| 16 | 25 | let imageView = UIImageView.init() |
| ... | ... | @@ -18,8 +27,10 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl |
| 18 | 27 | imageView.contentMode = .scaleAspectFill |
| 19 | 28 | imageView.clipsToBounds = true |
| 20 | 29 | imageView.image = UIImage(named: "mine_header_icon_defult_ava") |
| 21 | - imageView.kf.indicatorType = .activity | |
| 22 | - imageView.kf.setImage(with: URL(string: UserInfoManager.shared.userInfo.bigFaceUrl), placeholder: UIImage(named: "mine_header_icon_defult_ava")) | |
| 30 | + if self.mineIconType == .mineIcon{ | |
| 31 | + imageView.kf.indicatorType = .activity | |
| 32 | + imageView.kf.setImage(with: URL(string: UserInfoManager.shared.userInfo.bigFaceUrl), placeholder: UIImage(named: "mine_header_icon_defult_ava")) | |
| 33 | + } | |
| 23 | 34 | return imageView |
| 24 | 35 | }() |
| 25 | 36 | |
| ... | ... | @@ -61,9 +72,10 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl |
| 61 | 72 | |
| 62 | 73 | var _select_image: UIImage! |
| 63 | 74 | var reslut: ClickInfoResultBlock |
| 64 | - init(result: @escaping ClickInfoResultBlock) { | |
| 75 | + init(mineIconType:CNLiveMineIconType,result: @escaping ClickInfoResultBlock) { | |
| 76 | + self.mineIconType = mineIconType | |
| 65 | 77 | self.reslut = result |
| 66 | - super.init(nibName:nil, bundle:nil) | |
| 78 | + super.init(nibName:nil, bundle:nil) | |
| 67 | 79 | } |
| 68 | 80 | |
| 69 | 81 | required init?(coder: NSCoder) { |
| ... | ... | @@ -126,13 +138,25 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl |
| 126 | 138 | |
| 127 | 139 | @objc func changeSendAction() { |
| 128 | 140 | sendBtn.startAnimating() |
| 129 | - CNLiveMineViewModel.requestUploadIconAction(_select_image) { [weak self] type, statue in | |
| 130 | - if statue { | |
| 131 | - self?.sendBtn.stopAnimating() | |
| 132 | - //再这里进行图片上传 | |
| 133 | - self!.reslut(self!._select_image) | |
| 134 | - self!.navigationController?.popViewController(animated: true) | |
| 141 | + if self.mineIconType == .mineIcon{ | |
| 142 | + CNLiveMineViewModel.requestUploadIconAction(_select_image) { [weak self] type, statue in | |
| 143 | + if statue { | |
| 144 | + self?.sendBtn.stopAnimating() | |
| 145 | + //再这里进行图片上传 | |
| 146 | + self!.reslut(self!._select_image) | |
| 147 | + self!.navigationController?.popViewController(animated: true) | |
| 148 | + } | |
| 135 | 149 | } |
| 150 | + }else{ | |
| 151 | + //我的数字简历-更换头像 | |
| 152 | + //上传头像 | |
| 153 | + let uploadKey = UploadManager.uploadViateImage(imageData: _select_image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in | |
| 154 | + print("获取进度==>\(progress)") | |
| 155 | + }, successBlock: { [weak self] key,url in | |
| 156 | + | |
| 157 | + //保存imgUrl到简历接口 | |
| 158 | + self?.updateViate(key: "jianli_icon", value: url) | |
| 159 | + }) | |
| 136 | 160 | } |
| 137 | 161 | } |
| 138 | 162 | |
| ... | ... | @@ -153,6 +177,84 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl |
| 153 | 177 | pickerController.isOriginal = false |
| 154 | 178 | self.navigationController?.present(pickerController, animated: true, completion: nil) |
| 155 | 179 | } |
| 180 | + | |
| 181 | + func updateViate(key:String,value:Any){ | |
| 182 | + if let userDic = UserDefaults.standard.dictionary(forKey: UserInfoManager.shared.userInfo.uid){ | |
| 183 | + var jianli_city = userDic["jianli_city"] as? String | |
| 184 | + if key == "jianli_city"{ | |
| 185 | + jianli_city = (value as! String) | |
| 186 | + } | |
| 187 | + var jianli_vitaeId = userDic["jianli_vitaeId"] as? String | |
| 188 | + if key == "jianli_vitaeId"{ | |
| 189 | + jianli_vitaeId = (value as! String) | |
| 190 | + } | |
| 191 | + var vsid = userDic["vsid"] as? String | |
| 192 | + if key == "vsid"{ | |
| 193 | + vsid = (value as! String) | |
| 194 | + } | |
| 195 | + var jianli_profession = userDic["jianli_profession"] as? String ?? "" | |
| 196 | + if key == "jianli_profession"{ | |
| 197 | + jianli_profession = value as! String | |
| 198 | + } | |
| 199 | + var jianli_professionId = userDic["jianli_professionId"] as? String | |
| 200 | + if key == "jianli_professionId"{ | |
| 201 | + jianli_professionId = (value as! String) | |
| 202 | + } | |
| 203 | + var jianli_icon = userDic["jianli_icon"] as? String ?? "" | |
| 204 | + if key == "jianli_icon"{ | |
| 205 | + jianli_icon = value as! String | |
| 206 | + } | |
| 207 | + var jianli_phone = userDic["jianli_phone"] as? String ?? "" | |
| 208 | + if key == "jianli_phone"{ | |
| 209 | + jianli_phone = value as! String | |
| 210 | + } | |
| 211 | + var jianli_selfIntroduction = userDic["jianli_selfIntroduction"] as? String | |
| 212 | + if key == "jianli_selfIntroduction"{ | |
| 213 | + jianli_selfIntroduction = (value as! String) | |
| 214 | + } | |
| 215 | + var jianli_workTime = userDic["jianli_workTime"] as? String | |
| 216 | + if key == "jianli_workTime"{ | |
| 217 | + jianli_workTime = (value as! String) | |
| 218 | + } | |
| 219 | + var jianli_showAge = userDic["jianli_showAge"] as? Bool ?? false | |
| 220 | + if key == "jianli_showAge"{ | |
| 221 | + jianli_showAge = value as! Bool | |
| 222 | + } | |
| 223 | + var jianli_showAddress = userDic["jianli_showAddress"] as? Bool ?? false | |
| 224 | + if key == "jianli_showAddress"{ | |
| 225 | + jianli_showAddress = value as! Bool | |
| 226 | + } | |
| 227 | + var jianli_showAwards = userDic["jianli_showAwards"] as? Bool ?? false | |
| 228 | + if key == "jianli_showAwards"{ | |
| 229 | + jianli_showAwards = value as! Bool | |
| 230 | + } | |
| 231 | + var jianli_showPhone = userDic["jianli_showPhone"] as? Bool ?? false | |
| 232 | + if key == "jianli_showPhone"{ | |
| 233 | + jianli_showPhone = value as! Bool | |
| 234 | + } | |
| 235 | + var jianli_updateTime = userDic["jianli_updateTime"] as? String ?? "" | |
| 236 | + if key == "jianli_updateTime"{ | |
| 237 | + jianli_updateTime = value as! String | |
| 238 | + } | |
| 239 | + | |
| 240 | + CNLiveVitaeViewModel.saveVitae(city: jianli_city ?? "", icon: jianli_icon, isSave: false, id: jianli_vitaeId ?? "", phone: jianli_phone, profession: jianli_profession , professionId: jianli_professionId ?? "", selfIntroduction: jianli_selfIntroduction ?? "", showAddress: jianli_showAddress, showAge: jianli_showAge, showAwards: jianli_showAwards, showPhone:jianli_showPhone, updateTime: jianli_updateTime, vsid: vsid ?? "", workTime: jianli_workTime ?? ""){ result, respStatue in | |
| 241 | + if respStatue == .success{ | |
| 242 | + self.sendBtn.stopAnimating() | |
| 243 | + //再这里进行图片上传 | |
| 244 | + self.reslut(self._select_image) | |
| 245 | + self.navigationController?.popViewController(animated: true) | |
| 246 | + }else{ | |
| 247 | + self.sendBtn.stopAnimating() | |
| 248 | + } | |
| 249 | + } | |
| 250 | + }else{ | |
| 251 | + let tempDic = NSMutableDictionary() | |
| 252 | + UserDefaults.standard.setValue(tempDic, forKey: UserInfoManager.shared.userInfo.uid) | |
| 253 | + UserDefaults.standard.synchronize() | |
| 254 | + } | |
| 255 | + | |
| 256 | + | |
| 257 | + } | |
| 156 | 258 | } |
| 157 | 259 | |
| 158 | 260 | extension CNLiveMineInfoViewController { | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveTypeFeedBackViewController.swift
| ... | ... | @@ -322,7 +322,7 @@ extension CNLiveTypeFeedBackViewController { |
| 322 | 322 | if _show_type == .info { |
| 323 | 323 | if indexPath.section == 0 { |
| 324 | 324 | let cell = tableView.cellForRow(at: indexPath) as! MineBodyTwoListViewCell |
| 325 | - let vc = CNLiveMineInfoViewController.init(result: { image in | |
| 325 | + let vc = CNLiveMineInfoViewController.init(mineIconType: .mineIcon, result: { image in | |
| 326 | 326 | cell.avatarView.image = image |
| 327 | 327 | }) |
| 328 | 328 | self.navigationController?.pushViewController(vc, animated: true) | ... | ... |