Commit 57b2d83b authored by David黄金龙's avatar David黄金龙

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

* '630-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  设置编辑传值
  // 人脉
  首次人脉授权信息接口联调
  // 人脉API
  // 人脉
  登录成功接口调试
parents 7a9d4f0a c99cfcbb
...@@ -256,6 +256,7 @@ ...@@ -256,6 +256,7 @@
0477E17A2BA41C7E00436346 /* YHCertificateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E1792BA41C7E00436346 /* YHCertificateModel.swift */; }; 0477E17A2BA41C7E00436346 /* YHCertificateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E1792BA41C7E00436346 /* YHCertificateModel.swift */; };
0477E17C2BA4238400436346 /* YHCertificateListContainerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17B2BA4238400436346 /* YHCertificateListContainerVC.swift */; }; 0477E17C2BA4238400436346 /* YHCertificateListContainerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17B2BA4238400436346 /* YHCertificateListContainerVC.swift */; };
0477E17E2BA4362A00436346 /* YHCustomNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */; }; 0477E17E2BA4362A00436346 /* YHCustomNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */; };
047A3DF52C295AFF0048937B /* YHFriendListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047A3DF42C295AFF0048937B /* YHFriendListModel.swift */; };
0480976B2BA15269000B9DCA /* YHCertificateInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */; }; 0480976B2BA15269000B9DCA /* YHCertificateInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */; };
0480976D2BA158A1000B9DCA /* YHCertificateListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */; }; 0480976D2BA158A1000B9DCA /* YHCertificateListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */; };
048097712BA18D66000B9DCA /* YHCertificateSearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */; }; 048097712BA18D66000B9DCA /* YHCertificateSearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */; };
...@@ -299,6 +300,8 @@ ...@@ -299,6 +300,8 @@
04AD31772C22DE6600DF5655 /* YHEditInterestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD31762C22DE6600DF5655 /* YHEditInterestViewController.swift */; }; 04AD31772C22DE6600DF5655 /* YHEditInterestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD31762C22DE6600DF5655 /* YHEditInterestViewController.swift */; };
04AD31792C23FFC700DF5655 /* YHInterestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD31782C23FFC700DF5655 /* YHInterestModel.swift */; }; 04AD31792C23FFC700DF5655 /* YHInterestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD31782C23FFC700DF5655 /* YHInterestModel.swift */; };
04AD317B2C2428CB00DF5655 /* YHPeopleSuccessView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */; }; 04AD317B2C2428CB00DF5655 /* YHPeopleSuccessView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */; };
04AD317D2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317C2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift */; };
04AD317F2C295C0300DF5655 /* YHChangeHeadModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317E2C295C0300DF5655 /* YHChangeHeadModel.swift */; };
04AF514E2BEB585C00009E3A /* YHVideoPlayerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */; }; 04AF514E2BEB585C00009E3A /* YHVideoPlayerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */; };
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; }; 04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; };
04AF82D62C25542D0028CE2A /* YHInterestTopicLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */; }; 04AF82D62C25542D0028CE2A /* YHInterestTopicLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */; };
...@@ -814,6 +817,7 @@ ...@@ -814,6 +817,7 @@
0477E1792BA41C7E00436346 /* YHCertificateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateModel.swift; sourceTree = "<group>"; }; 0477E1792BA41C7E00436346 /* YHCertificateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateModel.swift; sourceTree = "<group>"; };
0477E17B2BA4238400436346 /* YHCertificateListContainerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListContainerVC.swift; sourceTree = "<group>"; }; 0477E17B2BA4238400436346 /* YHCertificateListContainerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListContainerVC.swift; sourceTree = "<group>"; };
0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCustomNavigationBar.swift; sourceTree = "<group>"; }; 0477E17D2BA4362A00436346 /* YHCustomNavigationBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCustomNavigationBar.swift; sourceTree = "<group>"; };
047A3DF42C295AFF0048937B /* YHFriendListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFriendListModel.swift; sourceTree = "<group>"; };
0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateInfoCell.swift; sourceTree = "<group>"; }; 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateInfoCell.swift; sourceTree = "<group>"; };
0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListVC.swift; sourceTree = "<group>"; }; 0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListVC.swift; sourceTree = "<group>"; };
048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateSearchBar.swift; sourceTree = "<group>"; }; 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateSearchBar.swift; sourceTree = "<group>"; };
...@@ -857,6 +861,8 @@ ...@@ -857,6 +861,8 @@
04AD31762C22DE6600DF5655 /* YHEditInterestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHEditInterestViewController.swift; sourceTree = "<group>"; }; 04AD31762C22DE6600DF5655 /* YHEditInterestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHEditInterestViewController.swift; sourceTree = "<group>"; };
04AD31782C23FFC700DF5655 /* YHInterestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInterestModel.swift; sourceTree = "<group>"; }; 04AD31782C23FFC700DF5655 /* YHInterestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInterestModel.swift; sourceTree = "<group>"; };
04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPeopleSuccessView.swift; sourceTree = "<group>"; }; 04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPeopleSuccessView.swift; sourceTree = "<group>"; };
04AD317C2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHUserInfoSettingViewModel.swift; sourceTree = "<group>"; };
04AD317E2C295C0300DF5655 /* YHChangeHeadModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChangeHeadModel.swift; sourceTree = "<group>"; };
04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVideoPlayerVC.swift; sourceTree = "<group>"; }; 04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVideoPlayerVC.swift; sourceTree = "<group>"; };
04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; }; 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; };
04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInterestTopicLayout.swift; sourceTree = "<group>"; }; 04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInterestTopicLayout.swift; sourceTree = "<group>"; };
...@@ -1287,6 +1293,7 @@ ...@@ -1287,6 +1293,7 @@
children = ( children = (
044D0BFD2C21649A00C5CF5E /* YHUserInformationModel.swift */, 044D0BFD2C21649A00C5CF5E /* YHUserInformationModel.swift */,
04FB01CF2C23FA420040115D /* YHMatchUserInfo.swift */, 04FB01CF2C23FA420040115D /* YHMatchUserInfo.swift */,
047A3DF42C295AFF0048937B /* YHFriendListModel.swift */,
); );
path = M; path = M;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1954,6 +1961,7 @@ ...@@ -1954,6 +1961,7 @@
children = ( children = (
0468D4352B57752F00CFB916 /* YHUserModel.swift */, 0468D4352B57752F00CFB916 /* YHUserModel.swift */,
044D0BF92C215C6F00C5CF5E /* YHSettingItem.swift */, 044D0BF92C215C6F00C5CF5E /* YHSettingItem.swift */,
04AD317E2C295C0300DF5655 /* YHChangeHeadModel.swift */,
); );
path = M; path = M;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1962,6 +1970,7 @@ ...@@ -1962,6 +1970,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0468D4392B579EAC00CFB916 /* YHLoginViewModel.swift */, 0468D4392B579EAC00CFB916 /* YHLoginViewModel.swift */,
04AD317C2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift */,
); );
path = VM; path = VM;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3356,6 +3365,7 @@ ...@@ -3356,6 +3365,7 @@
045EEF1E2B9F171A0022A143 /* YHBottomNextView.swift in Sources */, 045EEF1E2B9F171A0022A143 /* YHBottomNextView.swift in Sources */,
A567E59E2BD7643D00D5D5A0 /* YHHomePageViewController.swift in Sources */, A567E59E2BD7643D00D5D5A0 /* YHHomePageViewController.swift in Sources */,
045EEEBA2B9F171A0022A143 /* YHWorkResponsibilitiesTableViewCell.swift in Sources */, 045EEEBA2B9F171A0022A143 /* YHWorkResponsibilitiesTableViewCell.swift in Sources */,
04AD317F2C295C0300DF5655 /* YHChangeHeadModel.swift in Sources */,
A5ACE9552B4564F7002C94D2 /* YHTabBarViewController.swift in Sources */, A5ACE9552B4564F7002C94D2 /* YHTabBarViewController.swift in Sources */,
045EEF0A2B9F171A0022A143 /* YHBasicInfoSessionModel.swift in Sources */, 045EEF0A2B9F171A0022A143 /* YHBasicInfoSessionModel.swift in Sources */,
045EEF022B9F171A0022A143 /* YHFormItemDegreeInfoCell.swift in Sources */, 045EEF022B9F171A0022A143 /* YHFormItemDegreeInfoCell.swift in Sources */,
...@@ -3367,6 +3377,7 @@ ...@@ -3367,6 +3377,7 @@
0445E6AF2BE9CFF6003C52F9 /* YHAppVersionForceUpdateView.swift in Sources */, 0445E6AF2BE9CFF6003C52F9 /* YHAppVersionForceUpdateView.swift in Sources */,
04B9EE5A2C06CC3100A4018D /* YHCodeSueecssViewController.swift in Sources */, 04B9EE5A2C06CC3100A4018D /* YHCodeSueecssViewController.swift in Sources */,
045EEEC12B9F171A0022A143 /* YHOtherInfoFillModel.swift in Sources */, 045EEEC12B9F171A0022A143 /* YHOtherInfoFillModel.swift in Sources */,
047A3DF52C295AFF0048937B /* YHFriendListModel.swift in Sources */,
0468D43A2B579EAC00CFB916 /* YHLoginViewModel.swift in Sources */, 0468D43A2B579EAC00CFB916 /* YHLoginViewModel.swift in Sources */,
045EEE9E2B9F171A0022A143 /* YHWorkExampleModel.swift in Sources */, 045EEE9E2B9F171A0022A143 /* YHWorkExampleModel.swift in Sources */,
045EEE8A2B9F171A0022A143 /* YHPreviewOtherInformationViewController.swift in Sources */, 045EEE8A2B9F171A0022A143 /* YHPreviewOtherInformationViewController.swift in Sources */,
...@@ -3441,6 +3452,7 @@ ...@@ -3441,6 +3452,7 @@
045EEEA92B9F171A0022A143 /* YHWorkExperienceListViewController.swift in Sources */, 045EEEA92B9F171A0022A143 /* YHWorkExperienceListViewController.swift in Sources */,
04A7BD132BA42F4200BD35A2 /* YHMyDocumentsDetailViewController.swift in Sources */, 04A7BD132BA42F4200BD35A2 /* YHMyDocumentsDetailViewController.swift in Sources */,
04A671622BA058DE00C1FB91 /* YHCertificateEditSheetView.swift in Sources */, 04A671622BA058DE00C1FB91 /* YHCertificateEditSheetView.swift in Sources */,
04AD317D2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift in Sources */,
04FD85682C21277800BEF9C5 /* YHMyNameCardAvatarInfoCell.swift in Sources */, 04FD85682C21277800BEF9C5 /* YHMyNameCardAvatarInfoCell.swift in Sources */,
A566A79A2C219FA400980D06 /* YHHomeSalonAreaView.swift in Sources */, A566A79A2C219FA400980D06 /* YHHomeSalonAreaView.swift in Sources */,
A5ACE9432B4564F7002C94D2 /* UILable+Extension.swift in Sources */, A5ACE9432B4564F7002C94D2 /* UILable+Extension.swift in Sources */,
......
...@@ -12,7 +12,7 @@ import Alamofire ...@@ -12,7 +12,7 @@ import Alamofire
class YHBaseViewModel { class YHBaseViewModel {
// 上传方法 // 上传方法
func uploadImage(_ image: UIImage, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) { func uploadImage(_ image: UIImage, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
#if DEBUG #if DEBUG
let size = image.imageSize() let size = image.imageSize()
YHHUD.flash(message: "\(Float(size/1024/1024))M") YHHUD.flash(message: "\(Float(size/1024/1024))M")
...@@ -44,7 +44,7 @@ class YHBaseViewModel { ...@@ -44,7 +44,7 @@ class YHBaseViewModel {
return return
} }
YHOSSManager.share.updateToken { YHOSSManager.share.updateToken {
YHOSSManager.share.putObject(image: image) {[weak self] success, error in YHOSSManager.share.putObject(image: image, isPublic) {[weak self] success, error in
guard let _ = self else { return } guard let _ = self else { return }
DispatchQueue.main.async { DispatchQueue.main.async {
// 在这里执行需要在主线程上完成的任务 // 在这里执行需要在主线程上完成的任务
...@@ -54,8 +54,7 @@ class YHBaseViewModel { ...@@ -54,8 +54,7 @@ class YHBaseViewModel {
} }
} }
//换取一张 func getPublicImageUrl(_ url: String, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
func getPublicImageUrl(_ url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
// let strUrl = YHBaseUrlManager.shared.curOssURL() + YHAllApiName.OSS.getPublicApi // let strUrl = YHBaseUrlManager.shared.curOssURL() + YHAllApiName.OSS.getPublicApi
// let param: [String: Any] = ["fileUrl": url] // let param: [String: Any] = ["fileUrl": url]
// let _ = YHNetRequest.getRequest(url: strUrl, params: param) { [weak self] json, code in // let _ = YHNetRequest.getRequest(url: strUrl, params: param) { [weak self] json, code in
...@@ -80,7 +79,7 @@ class YHBaseViewModel { ...@@ -80,7 +79,7 @@ class YHBaseViewModel {
return return
} }
YHOSSManager.share.updateToken { YHOSSManager.share.updateToken {
YHOSSManager.share.getPublic(url: url, callBackBlock: { [weak self] success, error in YHOSSManager.share.getPublic(url: url, isPublic, callBackBlock: { [weak self] success, error in
guard let _ = self else { return } guard let _ = self else { return }
DispatchQueue.main.async { DispatchQueue.main.async {
// 在这里执行需要在主线程上完成的任务 // 在这里执行需要在主线程上完成的任务
...@@ -109,7 +108,7 @@ class YHBaseViewModel { ...@@ -109,7 +108,7 @@ class YHBaseViewModel {
} }
// 上传方法 // 上传方法
func uploadFile(_ url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) { func uploadFile(_ url: String, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
// let strUrl = YHBaseUrlManager.shared.curOssURL() + YHAllApiName.OSS.uploadApi // let strUrl = YHBaseUrlManager.shared.curOssURL() + YHAllApiName.OSS.uploadApi
// printLog("\(url)") // printLog("\(url)")
// let boundary = UUID().uuidString // let boundary = UUID().uuidString
...@@ -138,7 +137,7 @@ class YHBaseViewModel { ...@@ -138,7 +137,7 @@ class YHBaseViewModel {
return return
} }
YHOSSManager.share.updateToken { YHOSSManager.share.updateToken {
YHOSSManager.share.putFile(file: url, callBackBlock: {[weak self] success, error in YHOSSManager.share.putFile(file: url, isPublic, callBackBlock: {[weak self] success, error in
guard let _ = self else { return } guard let _ = self else { return }
DispatchQueue.main.async { DispatchQueue.main.async {
// 在这里执行需要在主线程上完成的任务 // 在这里执行需要在主线程上完成的任务
......
...@@ -27,8 +27,20 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController { ...@@ -27,8 +27,20 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController {
} }
func getData() { func getData() {
items = viewModel.getBaseDataSource() viewModel.requestUserInfo {[weak self] success, error in
tableView.reloadData() guard let self = self else { return }
self.items = viewModel.getBaseDataSource()
self.tableView.reloadData()
let url = URL(string: self.viewModel.model.avatar)
self.photoImageView.kf.setImage(with: url)
if self.viewModel.isCanNext() {
nextButton.isEnabled = true
nextButton.backgroundColor = UIColor.brandMainColor
} else {
nextButton.isEnabled = false
nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
}
}
} }
func setView() { func setView() {
...@@ -164,16 +176,27 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController { ...@@ -164,16 +176,27 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController {
YHImagePickerView.show() {[weak self] image in YHImagePickerView.show() {[weak self] image in
guard let self = self else { return } guard let self = self else { return }
self.photoImageView.image = image self.photoImageView.image = image
self.viewModel.uploadImage(image, true) {[weak self] success, error in
guard let self = self else { return }
self.viewModel.model.avatar = success ?? ""
}
} }
} }
@objc func changeHead() { @objc func changeHead() {
viewModel.requestChangeHead {[weak self] success, error in
guard let self = self else { return }
let url = URL(string: self.viewModel.model.avatar)
self.photoImageView.kf.setImage(with: url)
}
} }
@objc func nextStep() { @objc func nextStep() {
let vc = YHInformationAuthorizationStepTwoViewController() viewModel.requestSaveUserInfo {[weak self] success, error in
self.navigationController?.pushViewController(vc) guard let self = self else { return }
let vc = YHInformationAuthorizationStepTwoViewController()
self.navigationController?.pushViewController(vc)
}
} }
} }
...@@ -196,7 +219,8 @@ extension YHInformationAuthorizationStepOneViewController: UITableViewDelegate, ...@@ -196,7 +219,8 @@ extension YHInformationAuthorizationStepOneViewController: UITableViewDelegate,
nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4) nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
} }
if model.id != .id1 && model.id != .id3 && model.id != .id5 { if model.id != .id1 && model.id != .id3 && model.id != .id5 {
self.getData() self.items = viewModel.getBaseDataSource()
self.tableView.reloadData()
} }
} }
return cell return cell
......
...@@ -24,8 +24,16 @@ class YHInformationAuthorizationStepTwoViewController: UIViewController { ...@@ -24,8 +24,16 @@ class YHInformationAuthorizationStepTwoViewController: UIViewController {
} }
func getData() { func getData() {
items = viewModel.getBaseSetDataSource() if stepFlag {
tableView.reloadData() items = viewModel.getBaseSetDataSource()
tableView.reloadData()
} else {
viewModel.requestUserAuthorization {[weak self] success, error in
guard let self = self else { return }
items = viewModel.getBaseSetDataSource()
tableView.reloadData()
}
}
} }
func setView() { func setView() {
...@@ -106,7 +114,10 @@ class YHInformationAuthorizationStepTwoViewController: UIViewController { ...@@ -106,7 +114,10 @@ class YHInformationAuthorizationStepTwoViewController: UIViewController {
} }
@objc func nextStep() { @objc func nextStep() {
viewModel.requestAuthorizationSubmit {[weak self] success, error in
guard let self = self else { return }
self.navigationController?.popViewController(animated: true)
}
} }
} }
......
...@@ -9,12 +9,15 @@ ...@@ -9,12 +9,15 @@
import UIKit import UIKit
import DragCardContainer import DragCardContainer
protocol YHMatchProtocol: NSObjectProtocol {
func startMatchUsers()
}
class YHMatchPeopleViewController: YHBaseViewController { class YHMatchPeopleViewController: YHBaseViewController {
let viewModel = YHMatchUserViewModel() let viewModel = YHMatchUserViewModel()
var matchUsersArr:[YHMatchUserInfo?] = [] var matchUsersArr:[YHMatchUserInfo?] = []
weak var delegate: YHMatchProtocol?
lazy var bgImgV:UIImageView = { lazy var bgImgV:UIImageView = {
let bg = UIImageView(image: UIImage(named: "people_match_result_bg")) let bg = UIImageView(image: UIImage(named: "people_match_result_bg"))
return bg return bg
...@@ -154,6 +157,8 @@ class YHMatchPeopleViewController: YHBaseViewController { ...@@ -154,6 +157,8 @@ class YHMatchPeopleViewController: YHBaseViewController {
@objc func didRematchBtnClicked() { @objc func didRematchBtnClicked() {
self.delegate?.startMatchUsers()
self.navigationController?.popViewController(animated: true)
} }
func createUI() { func createUI() {
...@@ -256,23 +261,46 @@ class YHMatchPeopleViewController: YHBaseViewController { ...@@ -256,23 +261,46 @@ class YHMatchPeopleViewController: YHBaseViewController {
func animaiton() { func animaiton() {
let view1 = YHNameCardInfoView.createCardView() if self.matchUsersArr.count <= 0 {
view1.y = -YHNameCardInfoView.height
view1.x = 36 return
let view2 = YHNameCardInfoView.createCardView() }
view2.backgroundColor = UIColor.init(hex: 0xE7EBF3)
view2.y = -YHNameCardInfoView.height
view2.x = 36+5
view2.width = YHNameCardInfoView.width-5*2
let view3 = YHNameCardInfoView.createCardView() let view3 = YHNameCardInfoView.createCardView()
view3.backgroundColor = UIColor.init(hex: 0xC4CEE3) view3.backgroundColor = UIColor.init(hex: 0xC4CEE3)
view3.y = -YHNameCardInfoView.height view3.y = -YHNameCardInfoView.height
view3.x = 36+10 view3.x = 36+10
view3.width = YHNameCardInfoView.width-5*4 view3.width = YHNameCardInfoView.width-5*4
view3.isHidden = self.matchUsersArr.count >= 3
if self.matchUsersArr.count >= 3 {
if let user = self.matchUsersArr[2] {
view3.userModel = user
}
}
self.view.addSubview(view3) self.view.addSubview(view3)
let view2 = YHNameCardInfoView.createCardView()
view2.backgroundColor = UIColor.init(hex: 0xE7EBF3)
view2.y = -YHNameCardInfoView.height
view2.x = 36+5
view2.width = YHNameCardInfoView.width-5*2
view2.isHidden = self.matchUsersArr.count >= 2
self.view.addSubview(view2) self.view.addSubview(view2)
if self.matchUsersArr.count >= 2 {
if let user = self.matchUsersArr[1] {
view2.userModel = user
}
}
let view1 = YHNameCardInfoView.createCardView()
view1.y = -YHNameCardInfoView.height
view1.x = 36
self.view.addSubview(view1) self.view.addSubview(view1)
if self.matchUsersArr.count >= 0 {
if let user = self.matchUsersArr[0] {
view1.userModel = user
}
}
UIView.animate(withDuration: 0.5, delay: 0, options: [.curveEaseInOut]) { UIView.animate(withDuration: 0.5, delay: 0, options: [.curveEaseInOut]) {
view3.y = 102+k_Height_NavigationtBarAndStatuBar+5*2 view3.y = 102+k_Height_NavigationtBarAndStatuBar+5*2
......
...@@ -10,6 +10,8 @@ import UIKit ...@@ -10,6 +10,8 @@ import UIKit
class YHMyGoodFriendsVC: YHBaseViewController { class YHMyGoodFriendsVC: YHBaseViewController {
let viewModel = YHMatchUserViewModel()
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped) let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionHeaderHeight = 100 tableView.estimatedSectionHeaderHeight = 100
...@@ -46,8 +48,8 @@ class YHMyGoodFriendsVC: YHBaseViewController { ...@@ -46,8 +48,8 @@ class YHMyGoodFriendsVC: YHBaseViewController {
return view return view
}() }()
var friendsArr:[String] = ["","","",""] var friendsArr:[YHFriendModel] = []
var friendRequestArr:[String] = ["","","",""] var friendRequestArr:[YHFriendModel] = []
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -64,6 +66,11 @@ class YHMyGoodFriendsVC: YHBaseViewController { ...@@ -64,6 +66,11 @@ class YHMyGoodFriendsVC: YHBaseViewController {
} }
} }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.requestFriendList()
}
func createCorner(cell:UITableViewCell, isLastCell:Bool) { func createCorner(cell:UITableViewCell, isLastCell:Bool) {
if (isLastCell) { if (isLastCell) {
let corner = UIRectCorner(rawValue: UIRectCorner.bottomLeft.rawValue | UIRectCorner.bottomRight.rawValue) let corner = UIRectCorner(rawValue: UIRectCorner.bottomLeft.rawValue | UIRectCorner.bottomRight.rawValue)
...@@ -106,6 +113,8 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource { ...@@ -106,6 +113,8 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyFriendsCell.cellReuseIdentifier, for: indexPath) as! YHMyFriendsCell let cell = tableView.dequeueReusableCell(withIdentifier: YHMyFriendsCell.cellReuseIdentifier, for: indexPath) as! YHMyFriendsCell
self.createCorner(cell: cell, isLastCell: indexPath.row == self.friendsArr.count-1) self.createCorner(cell: cell, isLastCell: indexPath.row == self.friendsArr.count-1)
if 0 <= indexPath.row && indexPath.row < friendsArr.count { if 0 <= indexPath.row && indexPath.row < friendsArr.count {
let friend = self.friendsArr[indexPath.row]
cell.friendModel = friend
} }
return cell return cell
} }
...@@ -207,5 +216,26 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource { ...@@ -207,5 +216,26 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
} }
return view return view
} }
}
extension YHMyGoodFriendsVC {
func requestFriendList() {
self.viewModel.getMyFriendList {
[weak self] success, error in
guard let self = self else { return }
self.friendsArr.removeAll()
self.friendRequestArr.removeAll()
if self.viewModel.friendListModel.friends.count > 0 {
self.friendsArr.append(contentsOf: self.viewModel.friendListModel.friends)
self.friendRequestArr.append(contentsOf: self.viewModel.friendListModel.applyFriends)
}
self.tableView.reloadData()
if self.friendsArr.count <= 0 && self.friendRequestArr.count <= 0 {
self.emptyDataTipsView.isHidden = false
} else {
self.emptyDataTipsView.isHidden = true
}
}
}
} }
...@@ -10,6 +10,8 @@ import UIKit ...@@ -10,6 +10,8 @@ import UIKit
class YHMyNameCardViewController: YHBaseViewController { class YHMyNameCardViewController: YHBaseViewController {
var userId: String = ""
let viewModel = YHMatchUserViewModel()
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped) let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionHeaderHeight = 100 tableView.estimatedSectionHeaderHeight = 100
...@@ -67,6 +69,11 @@ class YHMyNameCardViewController: YHBaseViewController { ...@@ -67,6 +69,11 @@ class YHMyNameCardViewController: YHBaseViewController {
createUI() createUI()
} }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
requestNameCardInfo()
}
func createUI() { func createUI() {
gk_navigationBar.isHidden = true gk_navigationBar.isHidden = true
self.view.backgroundColor = UIColor.init(hex: 0xF8FAFB) self.view.backgroundColor = UIColor.init(hex: 0xF8FAFB)
...@@ -185,3 +192,14 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource ...@@ -185,3 +192,14 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
} }
} }
extension YHMyNameCardViewController {
func requestNameCardInfo() {
self.viewModel.getUserNameCardInfo(uid: self.userId) {
success, error in
self.viewModel.nameCardInfo
}
}
}
...@@ -149,23 +149,15 @@ class YHPeopleViewController: YHBaseViewController { ...@@ -149,23 +149,15 @@ class YHPeopleViewController: YHBaseViewController {
@objc func didMatchBtnClicked() { @objc func didMatchBtnClicked() {
if true { if true {
self.headLottieView.isHidden = true startMatchUsers()
self.launchLottieView.loopMode = .playOnce
self.launchLottieView.play {
[weak self] completed in
guard let self = self else { return }
self.launchLottieView.isHidden = true
self.rotateLottieView.isHidden = false
self.rotateLottieView.loopMode = .loop
self.rotateLottieView.play()
self.requestMatchUserList()
}
return return
} }
let view = YHPeopleSuccessView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight)) // let view = YHPeopleSuccessView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
let window = UIApplication.shared.yhKeyWindow() // let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view) // window?.addSubview(view)
let vc = YHInformationAuthorizationStepOneViewController()
self.navigationController?.pushViewController(vc)
} }
func resetAnimation() { func resetAnimation() {
...@@ -183,6 +175,22 @@ extension YHPeopleViewController: JXSegmentedListContainerViewListDelegate { ...@@ -183,6 +175,22 @@ extension YHPeopleViewController: JXSegmentedListContainerViewListDelegate {
} }
} }
extension YHPeopleViewController: YHMatchProtocol {
func startMatchUsers() {
self.headLottieView.isHidden = true
self.launchLottieView.loopMode = .playOnce
self.launchLottieView.play {
[weak self] completed in
guard let self = self else { return }
self.launchLottieView.isHidden = true
self.rotateLottieView.isHidden = false
self.rotateLottieView.loopMode = .loop
self.rotateLottieView.play()
self.requestMatchUserList()
}
}
}
extension YHPeopleViewController { extension YHPeopleViewController {
func requestMatchUserList() { func requestMatchUserList() {
self.viewModel.getMatchUserlist { self.viewModel.getMatchUserlist {
...@@ -190,6 +198,7 @@ extension YHPeopleViewController { ...@@ -190,6 +198,7 @@ extension YHPeopleViewController {
self.rotateLottieView.stop() self.rotateLottieView.stop()
let vc = YHMatchPeopleViewController() let vc = YHMatchPeopleViewController()
vc.delegate = self
vc.matchUsersArr = self.viewModel.matchUserArr vc.matchUsersArr = self.viewModel.matchUserArr
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
......
//
// YHFriendListModel.swift
// galaxy
//
// Created by edy on 2024/6/24.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHFriendListModel: SmartCodable {
var friends: [YHFriendModel] = []
var applyFriends: [YHFriendModel] = []
required init() {
}
enum CodingKeys: String, CodingKey {
case friends
case applyFriends = "apply_friends"
}
}
class YHFriendModel: SmartCodable {
var id: Int = 0
var yhId: String = ""
var username: String = ""
var avatar: String = ""
var position: String = ""
var industry: String = ""
var bio: String = ""
var isSign: Bool = false
var verifyInfo: String = ""
required init() {
}
enum CodingKeys: String, CodingKey {
case id
case yhId = "yh_id"
case username, avatar, position, industry, bio
case isSign = "is_sign"
case verifyInfo = "verify_info"
}
}
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
import UIKit import UIKit
import SmartCodable import SmartCodable
class YHPeopleCardModel: NSObject {
var isSend:Bool = false
}
class YHMatchUserInfo: SmartCodable { class YHMatchUserInfo: SmartCodable {
var id: String = "" var id: String = ""
var yhId: String = "" var yhId: String = ""
var username: String = ""
var avatar: String = ""
var position: String = "" var position: String = ""
var industry: String = "" var industry: String = ""
var isSign: Int = 0
var address: YHMatchUserAddress = YHMatchUserAddress() var address: YHMatchUserAddress = YHMatchUserAddress()
var signature: String = "" var signature: String = ""
...@@ -32,7 +32,8 @@ class YHMatchUserInfo: SmartCodable { ...@@ -32,7 +32,8 @@ class YHMatchUserInfo: SmartCodable {
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id case id
case yhId = "yh_id" case yhId = "yh_id"
case position, industry, address, signature case isSign = "is_sign"
case username, avatar, position, industry, address, signature
} }
} }
...@@ -46,3 +47,36 @@ class YHMatchUserAddress: SmartCodable { ...@@ -46,3 +47,36 @@ class YHMatchUserAddress: SmartCodable {
} }
} }
class YHUserNameCardInfo: SmartCodable {
var id: String = ""
var yhId: String = ""
var isSigned: Bool = false
var avatar: String = ""
var username: String = ""
var address: YHMatchUserAddress = YHMatchUserAddress()
var zodiac: String = ""
var signature: String = ""
var bio: String = ""
var college: String = ""
var major: String = ""
var background: String = ""
var companyName: String = ""
var position: String = ""
var industry: String = ""
var honor: String = ""
let topics: [String] = []
required init() {
}
enum CodingKeys: String, CodingKey {
case id
case yhId = "yh_id"
case isSigned = "is_signed"
case avatar, username, address, zodiac, signature, bio, college, major, background
case companyName = "company_name"
case position, industry, honor, topics
}
}
...@@ -56,8 +56,26 @@ class YHMainUserInformationModel: YHBaseModel { ...@@ -56,8 +56,26 @@ class YHMainUserInformationModel: YHBaseModel {
} }
class YHMainUserInformationSetModel: YHBaseModel { class YHMainUserInformationSetModel: YHBaseModel {
var isRea: Bool = true var uid: String = ""
var isWork: Bool = true var information_to_card: Int = 2
var isSchool: Bool = true var authorization_basic_information: Int = 2
var public_education_experience: Int = 2
var public_work_experience: Int = 2
var isclick_card: Int = 2
}
class YHUserInformationDetailModel: YHBaseModel {
var username: String = ""
var avatar: String = ""
var address: YHUserInformationDetailAddressModel = YHUserInformationDetailAddressModel()
var college: String = ""
var industry: String = ""
var position: String = ""
}
class YHUserInformationDetailAddressModel: YHBaseModel {
var country: String = ""
var province: String = ""
var city: String = ""
} }
...@@ -39,6 +39,18 @@ class YHAddFriendCardCell: UITableViewCell { ...@@ -39,6 +39,18 @@ class YHAddFriendCardCell: UITableViewCell {
} }
} }
var friendModel: YHFriendModel = YHFriendModel() {
didSet {
if let url = URL(string: self.friendModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
}
self.nameLabel.text = self.friendModel.username
self.professionalLabel.text = self.friendModel.position
self.msgLabel.text = self.friendModel.verifyInfo
self.signImgV.isHidden = !self.friendModel.isSign
}
}
static let height = 218.0 static let height = 218.0
lazy var cardView: UIView = { lazy var cardView: UIView = {
......
...@@ -13,6 +13,18 @@ class YHFriendRequestView: UIView { ...@@ -13,6 +13,18 @@ class YHFriendRequestView: UIView {
var sendBlock:((String?)->())? var sendBlock:((String?)->())?
static let cardHeight = 313.0 static let cardHeight = 313.0
let textMaxCount = 200 let textMaxCount = 200
var userModel:YHMatchUserInfo = YHMatchUserInfo() {
didSet {
if let url = URL(string: self.userModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
}
self.nameLabel.text = self.userModel.username
self.professionalLabel.text = self.userModel.position
self.signImgV.isHidden = (self.userModel.isSign != 1)
}
}
// 底层蒙版 // 底层蒙版
lazy var blackMaskView: UIView = { lazy var blackMaskView: UIView = {
let view = UIView() let view = UIView()
...@@ -174,10 +186,6 @@ class YHFriendRequestView: UIView { ...@@ -174,10 +186,6 @@ class YHFriendRequestView: UIView {
cardView.addSubview(cancelBtn) cardView.addSubview(cancelBtn)
cardView.addSubview(sendBtn) cardView.addSubview(sendBtn)
self.headImgV.backgroundColor = .red
self.nameLabel.text = "XASAFSDFASDXASAFSDFASDXASAFSDFASDXASAFSDFASD"
self.professionalLabel.text = "咨询副总监 | 资讯科技及电讯"
blackMaskView.snp.makeConstraints { make in blackMaskView.snp.makeConstraints { make in
make.edges.equalToSuperview() make.edges.equalToSuperview()
} }
......
...@@ -141,11 +141,6 @@ class YHFriendsResponseView: UIView { ...@@ -141,11 +141,6 @@ class YHFriendsResponseView: UIView {
cardView.addSubview(ignoreBtn) cardView.addSubview(ignoreBtn)
cardView.addSubview(acceptBtn) cardView.addSubview(acceptBtn)
self.headImgV.backgroundColor = .red
self.nameLabel.text = "XASAFSDFASDXASAFSDFASDXASAFSDFASDXASAFSDFASD"
self.professionalLabel.text = "咨询副总监 | 资讯科技及电讯"
self.msgLabel.text = "资讯科技及电讯资讯科技及电讯资讯科技及电讯资讯科技及电讯资讯科技及电讯资讯科技及电讯资讯科技及电讯资讯科技及电讯"
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.left.top.right.equalToSuperview() make.left.top.right.equalToSuperview()
make.height.equalTo(22.0) make.height.equalTo(22.0)
......
...@@ -13,6 +13,13 @@ class YHMyEducationCell: UITableViewCell { ...@@ -13,6 +13,13 @@ class YHMyEducationCell: UITableViewCell {
var editBlock: EditBlock? var editBlock: EditBlock?
static let cellReuseIdentifier = "YHMyEducationCell" static let cellReuseIdentifier = "YHMyEducationCell"
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet {
self.collegeLabel.text = self.userModel.college
self.detailLabel.text = self.userModel.background
}
}
lazy var cardView: UIView = { lazy var cardView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .white view.backgroundColor = .white
......
...@@ -7,10 +7,22 @@ ...@@ -7,10 +7,22 @@
// //
import UIKit import UIKit
import Kingfisher
class YHMyFriendsCell: UITableViewCell { class YHMyFriendsCell: UITableViewCell {
static let cellReuseIdentifier = "YHMyFriendsCell" static let cellReuseIdentifier = "YHMyFriendsCell"
var friendModel: YHFriendModel = YHFriendModel() {
didSet {
if let url = URL(string: self.friendModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
}
self.nameLabel.text = self.friendModel.username
self.professionalLabel.text = self.friendModel.position
self.detailLabel.text = self.friendModel.bio
self.signImgV.isHidden = !self.friendModel.isSign
}
}
lazy var headImgV:UIImageView = { lazy var headImgV:UIImageView = {
let view = UIImageView() let view = UIImageView()
...@@ -75,12 +87,6 @@ class YHMyFriendsCell: UITableViewCell { ...@@ -75,12 +87,6 @@ class YHMyFriendsCell: UITableViewCell {
self.contentView.addSubview(self.detailLabel) self.contentView.addSubview(self.detailLabel)
self.contentView.addSubview(self.lineView) self.contentView.addSubview(self.lineView)
self.headImgV.backgroundColor = .red
self.nameLabel.text = "XASAFSDFASDXASAFSDFASDXASAFSDFASDXASAFSDFASD"
self.professionalLabel.text = "咨询副总监 | 资讯科技及电讯"
self.detailLabel.text = "极致服务|创新突破|长期主义|合作共赢|求真务实"
self.lineView.snp.makeConstraints { make in self.lineView.snp.makeConstraints { make in
make.left.equalTo(15) make.left.equalTo(15)
make.right.equalTo(-15) make.right.equalTo(-15)
......
...@@ -13,6 +13,11 @@ class YHMyIntroductionCell: UITableViewCell { ...@@ -13,6 +13,11 @@ class YHMyIntroductionCell: UITableViewCell {
var editBlock: EditBlock? var editBlock: EditBlock?
static let cellReuseIdentifier = "YHMyIntroductionCell" static let cellReuseIdentifier = "YHMyIntroductionCell"
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet {
self.detailLabel.text = self.userModel.bio
}
}
lazy var cardView: UIView = { lazy var cardView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .white view.backgroundColor = .white
......
...@@ -14,6 +14,17 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -14,6 +14,17 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHMyNameCardAvatarInfoCell" static let cellReuseIdentifier = "YHMyNameCardAvatarInfoCell"
let headWidth = 74.0 let headWidth = 74.0
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet {
if let url = URL(string: self.userModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
}
self.nameLabel.text = self.userModel.username
self.professionalLabel.text = self.userModel.position
self.detailLabel.text = self.userModel.signature
self.signImgV.isHidden = !self.userModel.isSigned
}
}
lazy var headImgV:UIImageView = { lazy var headImgV:UIImageView = {
let view = UIImageView() let view = UIImageView()
......
...@@ -56,6 +56,14 @@ class YHMyWorkExperienceCell: UITableViewCell { ...@@ -56,6 +56,14 @@ class YHMyWorkExperienceCell: UITableViewCell {
typealias EditBlock = () -> () typealias EditBlock = () -> ()
var editBlock: EditBlock? var editBlock: EditBlock?
static let cellReuseIdentifier = "YHMyWorkExperienceCell" static let cellReuseIdentifier = "YHMyWorkExperienceCell"
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet {
if !self.userModel.companyName.isEmpty {
self.companyView.detailLabel.text = ""
}
}
}
lazy var cardView: UIView = { lazy var cardView: UIView = {
let view = UIView() let view = UIView()
......
...@@ -17,11 +17,14 @@ class YHNameCardInfoView: DragCardView { ...@@ -17,11 +17,14 @@ class YHNameCardInfoView: DragCardView {
var userModel:YHMatchUserInfo = YHMatchUserInfo() { var userModel:YHMatchUserInfo = YHMatchUserInfo() {
didSet { didSet {
if let url = URL(string: self.userModel.avatar) {
self.nameLabel.text = self.userModel.id self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
}
self.nameLabel.text = self.userModel.username
self.professionalLabel.text = self.userModel.position self.professionalLabel.text = self.userModel.position
self.detailLabel.text = self.userModel.signature self.detailLabel.text = self.userModel.signature
self.signImgV.isHidden = (self.userModel.isSign != 1)
if self.userModel.isSendRequest { if self.userModel.isSendRequest {
self.bottomBtn.setTitle("已发送好友申请", for: .normal) self.bottomBtn.setTitle("已发送好友申请", for: .normal)
self.bottomBtn.backgroundColor = .brandMainColor30 self.bottomBtn.backgroundColor = .brandMainColor30
...@@ -37,7 +40,6 @@ class YHNameCardInfoView: DragCardView { ...@@ -37,7 +40,6 @@ class YHNameCardInfoView: DragCardView {
lazy var bgImgV:UIImageView = { lazy var bgImgV:UIImageView = {
let view = UIImageView() let view = UIImageView()
view.image = UIImage(named: "people_card_head_bg") view.image = UIImage(named: "people_card_head_bg")
view.backgroundColor = .red
return view return view
}() }()
...@@ -45,7 +47,7 @@ class YHNameCardInfoView: DragCardView { ...@@ -45,7 +47,7 @@ class YHNameCardInfoView: DragCardView {
let view = UIImageView() let view = UIImageView()
view.image = UIImage(named: "") view.image = UIImage(named: "")
view.layer.cornerRadius = 98.0/2.0 view.layer.cornerRadius = 98.0/2.0
view.backgroundColor = .green view.clipsToBounds = true
return view return view
}() }()
...@@ -111,6 +113,7 @@ class YHNameCardInfoView: DragCardView { ...@@ -111,6 +113,7 @@ class YHNameCardInfoView: DragCardView {
@objc func didBottomBtnClicked() { @objc func didBottomBtnClicked() {
let view = YHFriendRequestView.createView() let view = YHFriendRequestView.createView()
view.userModel = self.userModel
view.sendBlock = { view.sendBlock = {
[weak self] text in [weak self] text in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -11,6 +11,8 @@ import UIKit ...@@ -11,6 +11,8 @@ import UIKit
class YHMatchUserViewModel: NSObject { class YHMatchUserViewModel: NSObject {
var matchUserArr:[YHMatchUserInfo?] = [] var matchUserArr:[YHMatchUserInfo?] = []
var nameCardInfo: YHUserNameCardInfo = YHUserNameCardInfo()
var friendListModel:YHFriendListModel = YHFriendListModel()
func getMatchUserlist(_ callBack: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) { func getMatchUserlist(_ callBack: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
let params = ["page_size" : 5] let params = ["page_size" : 5]
...@@ -65,4 +67,65 @@ class YHMatchUserViewModel: NSObject { ...@@ -65,4 +67,65 @@ class YHMatchUserViewModel: NSObject {
callBack(false, err) callBack(false, err)
} }
} }
func getMyFriendList(callBack: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.friendListApi
let _ = YHNetRequest.getRequest(url: strUrl) {
[weak self] json, code in
guard let self = self else { return }
let dic = json.data
printLog("model 是 ==> \(json)")
if json.code == 200 {
guard let result = YHFriendListModel.deserialize(dict: dic as? Dictionary ) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
self.friendListModel = YHFriendListModel()
callBack(false, error)
return
}
self.friendListModel = result
callBack(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
self.friendListModel = YHFriendListModel()
callBack(false, error)
}
} failBlock: { error in
self.friendListModel = YHFriendListModel()
callBack(false, error)
}
}
func getUserNameCardInfo(uid: String, callBack: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.nameCardInfoApi
let _ = YHNetRequest.getRequest(url: strUrl) {
[weak self] json, code in
guard let self = self else { return }
let dic = json.data
printLog("model 是 ==> \(json)")
if json.code == 200 {
guard let result = YHUserNameCardInfo.deserialize(dict: dic as? Dictionary ) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
self.nameCardInfo = YHUserNameCardInfo()
callBack(false, error)
return
}
self.nameCardInfo = result
callBack(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
self.nameCardInfo = YHUserNameCardInfo()
callBack(false, error)
}
} failBlock: { error in
self.nameCardInfo = YHUserNameCardInfo()
callBack(false, error)
}
}
} }
...@@ -12,6 +12,8 @@ class YHAllowUseMyInfoViewController: YHBaseViewController { ...@@ -12,6 +12,8 @@ class YHAllowUseMyInfoViewController: YHBaseViewController {
var tableView: UITableView! var tableView: UITableView!
var nextButton: UIButton! var nextButton: UIButton!
let items: [YHSettingItem] = [YHSettingItem(type: .normal, title: "允许您的信息在名片中使用", subTitle: "开启后,您的信息将自动同步至您的个人名片,并对您的好友公开可见", isSelect: true, isShowAlert: false)] let items: [YHSettingItem] = [YHSettingItem(type: .normal, title: "允许您的信息在名片中使用", subTitle: "开启后,您的信息将自动同步至您的个人名片,并对您的好友公开可见", isSelect: true, isShowAlert: false)]
var viewModel: YHUserInfoSettingViewModel = YHUserInfoSettingViewModel()
var isOpen: Bool = true
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -65,8 +67,14 @@ class YHAllowUseMyInfoViewController: YHBaseViewController { ...@@ -65,8 +67,14 @@ class YHAllowUseMyInfoViewController: YHBaseViewController {
} }
@objc func nextStep() { @objc func nextStep() {
let vc = YHInformationAuthorizationStepOneViewController() var open = 1
self.navigationController?.pushViewController(vc) if isOpen {
open = 2
}
viewModel.requestAuthorizationSubmit(agress: open) {[weak self] success, error in
guard let self = self else { return }
self.dismiss(animated: true)
}
} }
} }
...@@ -78,6 +86,10 @@ extension YHAllowUseMyInfoViewController: UITableViewDelegate, UITableViewDataSo ...@@ -78,6 +86,10 @@ extension YHAllowUseMyInfoViewController: UITableViewDelegate, UITableViewDataSo
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHAllowSettingTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHAllowSettingTableViewCell.self)
cell.item = items[indexPath.row] cell.item = items[indexPath.row]
cell.block = { [weak self] model in
guard let self = self else { return }
self.isOpen = !self.isOpen
}
return cell return cell
} }
......
...@@ -169,8 +169,13 @@ class YHCodeSueecssViewController: YHBaseViewController { ...@@ -169,8 +169,13 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager.shared.loginSuccessActionBlock?() YHLoginManager.shared.loginSuccessActionBlock?()
YHHUD.flash(message: "登录成功") YHHUD.flash(message: "登录成功")
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
self.dismiss(animated: true) self.dismiss(animated: true) {
self.navigationController?.popToRootViewController(animated: true) if YHLoginManager.shared.userModel?.is_first_login == 1 {
let vc = UINavigationController(rootVC: YHUserInfoSettingViewController())
vc.modalPresentationStyle = .fullScreen
UIViewController.current?.present(vc, animated: true)
}
}
} }
}) })
} }
...@@ -185,8 +190,13 @@ class YHCodeSueecssViewController: YHBaseViewController { ...@@ -185,8 +190,13 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager.shared.loginSuccessActionBlock?() YHLoginManager.shared.loginSuccessActionBlock?()
YHHUD.flash(message: "登录成功") YHHUD.flash(message: "登录成功")
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
self.dismiss(animated: true) self.dismiss(animated: true) {
self.navigationController?.popToRootViewController(animated: true) if YHLoginManager.shared.userModel?.is_first_login == 1 {
let vc = UINavigationController(rootVC: YHUserInfoSettingViewController())
vc.modalPresentationStyle = .fullScreen
UIViewController.current?.present(vc, animated: true)
}
}
} }
}) })
} }
...@@ -207,8 +217,13 @@ class YHCodeSueecssViewController: YHBaseViewController { ...@@ -207,8 +217,13 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager.shared.loginSuccessActionBlock?() YHLoginManager.shared.loginSuccessActionBlock?()
YHHUD.flash(message: "登录成功") YHHUD.flash(message: "登录成功")
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
self?.dismiss(animated: true) self?.dismiss(animated: true) {
self?.navigationController?.popToRootViewController(animated: true) if YHLoginManager.shared.userModel?.is_first_login == 1 {
let vc = UINavigationController(rootVC: YHUserInfoSettingViewController())
vc.modalPresentationStyle = .fullScreen
UIViewController.current?.present(vc, animated: true)
}
}
} }
} }
} }
......
...@@ -15,10 +15,14 @@ class YHUserInfoSettingViewController: YHBaseViewController { ...@@ -15,10 +15,14 @@ class YHUserInfoSettingViewController: YHBaseViewController {
var nameLabel: UILabel! var nameLabel: UILabel!
var nameTextField: UITextField! var nameTextField: UITextField!
var nextButton: UIButton! var nextButton: UIButton!
var viewModel: YHUserInfoSettingViewModel = YHUserInfoSettingViewModel()
var headUrl: String = ""
var name: String = ""
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
setView() setView()
changeHead()
} }
func setView() { func setView() {
...@@ -125,11 +129,20 @@ class YHUserInfoSettingViewController: YHBaseViewController { ...@@ -125,11 +129,20 @@ class YHUserInfoSettingViewController: YHBaseViewController {
YHImagePickerView.show() {[weak self] image in YHImagePickerView.show() {[weak self] image in
guard let self = self else { return } guard let self = self else { return }
self.photoImageView.image = image self.photoImageView.image = image
self.viewModel.uploadImage(image, true) {[weak self] success, error in
guard let self = self else { return }
self.headUrl = success ?? ""
}
} }
} }
@objc func changeHead() { @objc func changeHead() {
viewModel.requestChangeHead {[weak self] success, error in
guard let self = self else { return }
self.headUrl = self.viewModel.headUrl
let url = URL(string: self.headUrl)
self.photoImageView.kf.setImage(with: url)
}
} }
@objc func nextStep() { @objc func nextStep() {
...@@ -137,7 +150,12 @@ class YHUserInfoSettingViewController: YHBaseViewController { ...@@ -137,7 +150,12 @@ class YHUserInfoSettingViewController: YHBaseViewController {
YHHUD.flash(message: "请填写您的真实姓名") YHHUD.flash(message: "请填写您的真实姓名")
return return
} }
let vc = YHAllowUseMyInfoViewController() self.name = nameTextField.text ?? ""
self.navigationController?.pushViewController(vc) // 请求接口逻辑
viewModel.requestSaveUserInfo(head: headUrl, name: name) {[weak self] success, error in
guard let self = self else { return }
let vc = YHAllowUseMyInfoViewController()
self.navigationController?.pushViewController(vc)
}
} }
} }
//
// YHChangeHeadModel.swift
// galaxy
//
// Created by EDY on 2024/6/24.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHChangeHeadModel: YHBaseModel {
var avatar: String = ""
}
...@@ -16,6 +16,7 @@ struct YHUserModel: SmartCodable { ...@@ -16,6 +16,7 @@ struct YHUserModel: SmartCodable {
var headpic: String? var headpic: String?
var sex: Int? var sex: Int?
var token: String? var token: String?
var is_first_login: Int = 0
} }
struct YHDeviceTokenModel { struct YHDeviceTokenModel {
......
//
// YHUserInfoSettingViewModel.swift
// galaxy
//
// Created by EDY on 2024/6/24.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHUserInfoSettingViewModel: YHBaseViewModel {
var headUrl: String = ""
func requestChangeHead(callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.change
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 = YHChangeHeadModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false,nil)
return
}
self.headUrl = result.avatar
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
func requestSaveUserInfo(head: String, name: String, callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String: Any] = ["avatar": head,
"username": name]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.userSubmit
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
func requestAuthorizationSubmit(agress: Int, callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String: Any] = ["information_to_card": agress]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.authorizationSubmit
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
}
...@@ -17,7 +17,8 @@ class YHEditBaseUserInfoViewController: YHBaseViewController { ...@@ -17,7 +17,8 @@ class YHEditBaseUserInfoViewController: YHBaseViewController {
var footView: YHEditBaseInfoFootView! var footView: YHEditBaseInfoFootView!
var items: [YHUserInformationModel] = [] var items: [YHUserInformationModel] = []
var viewModel: YHEditViewModel = YHEditViewModel() var viewModel: YHEditViewModel = YHEditViewModel()
var model: YHUserNameCardInfo = YHUserNameCardInfo()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
setView() setView()
...@@ -25,6 +26,7 @@ class YHEditBaseUserInfoViewController: YHBaseViewController { ...@@ -25,6 +26,7 @@ class YHEditBaseUserInfoViewController: YHBaseViewController {
} }
func getData() { func getData() {
viewModel.model = model
items = viewModel.getBaseDataSource() items = viewModel.getBaseDataSource()
tableView.reloadData() tableView.reloadData()
} }
......
...@@ -14,6 +14,7 @@ class YHEditHonorViewController: YHBaseViewController { ...@@ -14,6 +14,7 @@ class YHEditHonorViewController: YHBaseViewController {
var numberLabel : UILabel! var numberLabel : UILabel!
var nextButton: UIButton! var nextButton: UIButton!
var viewModel: YHEditViewModel = YHEditViewModel() var viewModel: YHEditViewModel = YHEditViewModel()
var model: YHUserNameCardInfo = YHUserNameCardInfo()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -22,7 +23,8 @@ class YHEditHonorViewController: YHBaseViewController { ...@@ -22,7 +23,8 @@ class YHEditHonorViewController: YHBaseViewController {
} }
func getData() { func getData() {
viewModel.model = model
} }
func setView() { func setView() {
......
...@@ -15,7 +15,8 @@ class YHEditInterestViewController: YHBaseViewController { ...@@ -15,7 +15,8 @@ class YHEditInterestViewController: YHBaseViewController {
var normalItems: [YHInterestModel] = [YHInterestModel(name: "香港子女教育", isNormal: true, isSelect: false), YHInterestModel(name: "香港房产", isNormal: true, isSelect: false), YHInterestModel(name: "香港创业", isNormal: true, isSelect: false), YHInterestModel(name: "香港就业", isNormal: true, isSelect: false), YHInterestModel(name: "香港保险", isNormal: true, isSelect: false), YHInterestModel(name: "香港商务", isNormal: true, isSelect: false), YHInterestModel(name: "企业家", isNormal: true, isSelect: false), YHInterestModel(name: "ENTJ指挥家", isNormal: true, isSelect: false), YHInterestModel(name: "ENTP辩论家", isNormal: true, isSelect: false), YHInterestModel(name: "INTJ建筑师", isNormal: true, isSelect: false)] var normalItems: [YHInterestModel] = [YHInterestModel(name: "香港子女教育", isNormal: true, isSelect: false), YHInterestModel(name: "香港房产", isNormal: true, isSelect: false), YHInterestModel(name: "香港创业", isNormal: true, isSelect: false), YHInterestModel(name: "香港就业", isNormal: true, isSelect: false), YHInterestModel(name: "香港保险", isNormal: true, isSelect: false), YHInterestModel(name: "香港商务", isNormal: true, isSelect: false), YHInterestModel(name: "企业家", isNormal: true, isSelect: false), YHInterestModel(name: "ENTJ指挥家", isNormal: true, isSelect: false), YHInterestModel(name: "ENTP辩论家", isNormal: true, isSelect: false), YHInterestModel(name: "INTJ建筑师", isNormal: true, isSelect: false)]
var likeItems: [YHInterestModel] = [YHInterestModel(name: "ENTP辩论家", isNormal: false, isSelect: false), YHInterestModel(name: "+自定义", isNormal: false, isSelect: true)] var likeItems: [YHInterestModel] = [YHInterestModel(name: "ENTP辩论家", isNormal: false, isSelect: false), YHInterestModel(name: "+自定义", isNormal: false, isSelect: true)]
var viewModel: YHEditViewModel = YHEditViewModel() var viewModel: YHEditViewModel = YHEditViewModel()
var model: YHUserNameCardInfo = YHUserNameCardInfo()
lazy var blackMaskView: UIView = { lazy var blackMaskView: UIView = {
let view = UIView(frame:UIScreen.main.bounds) let view = UIView(frame:UIScreen.main.bounds)
view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5) view.backgroundColor = UIColor(hex: 0x0F1214, alpha: 0.5)
...@@ -36,7 +37,8 @@ class YHEditInterestViewController: YHBaseViewController { ...@@ -36,7 +37,8 @@ class YHEditInterestViewController: YHBaseViewController {
} }
func getData() { func getData() {
viewModel.model = model
} }
func setView() { func setView() {
......
...@@ -14,6 +14,7 @@ class YHEditPersonalProfileViewController: YHBaseViewController { ...@@ -14,6 +14,7 @@ class YHEditPersonalProfileViewController: YHBaseViewController {
var numberLabel : UILabel! var numberLabel : UILabel!
var nextButton: UIButton! var nextButton: UIButton!
var viewModel: YHEditViewModel = YHEditViewModel() var viewModel: YHEditViewModel = YHEditViewModel()
var model: YHUserNameCardInfo = YHUserNameCardInfo()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -22,7 +23,8 @@ class YHEditPersonalProfileViewController: YHBaseViewController { ...@@ -22,7 +23,8 @@ class YHEditPersonalProfileViewController: YHBaseViewController {
} }
func getData() { func getData() {
viewModel.model = model
} }
func setView() { func setView() {
......
...@@ -13,7 +13,8 @@ class YHEditSchoolViewController: YHBaseViewController { ...@@ -13,7 +13,8 @@ class YHEditSchoolViewController: YHBaseViewController {
var tableView: UITableView! var tableView: UITableView!
var items: [YHUserInformationModel] = [] var items: [YHUserInformationModel] = []
var viewModel: YHEditViewModel = YHEditViewModel() var viewModel: YHEditViewModel = YHEditViewModel()
var model: YHUserNameCardInfo = YHUserNameCardInfo()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
setView() setView()
...@@ -21,6 +22,7 @@ class YHEditSchoolViewController: YHBaseViewController { ...@@ -21,6 +22,7 @@ class YHEditSchoolViewController: YHBaseViewController {
} }
func getData() { func getData() {
viewModel.model = model
items = viewModel.getBaseSchoolDataSource() items = viewModel.getBaseSchoolDataSource()
tableView.reloadData() tableView.reloadData()
} }
......
...@@ -13,7 +13,8 @@ class YHEditWorkViewController: YHBaseViewController { ...@@ -13,7 +13,8 @@ class YHEditWorkViewController: YHBaseViewController {
var tableView: UITableView! var tableView: UITableView!
var items: [YHUserInformationModel] = [] var items: [YHUserInformationModel] = []
var viewModel: YHEditViewModel = YHEditViewModel() var viewModel: YHEditViewModel = YHEditViewModel()
var model: YHUserNameCardInfo = YHUserNameCardInfo()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
setView() setView()
...@@ -21,6 +22,7 @@ class YHEditWorkViewController: YHBaseViewController { ...@@ -21,6 +22,7 @@ class YHEditWorkViewController: YHBaseViewController {
} }
func getData() { func getData() {
viewModel.model = model
items = viewModel.getBaseWorkDataSource() items = viewModel.getBaseWorkDataSource()
tableView.reloadData() tableView.reloadData()
} }
......
...@@ -9,26 +9,23 @@ ...@@ -9,26 +9,23 @@
import UIKit import UIKit
class YHEditViewModel: YHBaseViewModel { class YHEditViewModel: YHBaseViewModel {
var mainModel: YHMainUserInformationModel = YHMainUserInformationModel() var model: YHUserNameCardInfo = YHUserNameCardInfo()
override init() { override init() {
super.init() super.init()
} }
func getBaseDataSource() -> [YHUserInformationModel] { func getBaseDataSource() -> [YHUserInformationModel] {
let item1 = YHUserInformationModel(id: .id1, title: "真实姓名", isUserKeyBoard: true, prompts: "请输入您的真实姓名", message: mainModel.username) let item1 = YHUserInformationModel(id: .id1, title: "真实姓名", isUserKeyBoard: true, prompts: "请输入您的真实姓名", message: model.username)
let item2 = YHUserInformationModel(id: .id6, title: "所在地", isUserKeyBoard: false, prompts: "请选择您的所在地", message: mainModel.country, type: .country, value: mainModel.area) let item2 = YHUserInformationModel(id: .id6, title: "所在地", isUserKeyBoard: false, prompts: "请选择您的所在地", message: model.address.country, type: .country)
var string = "" var string = ""
let array = mainModel.area if model.address.province.count != 0 {
for item in array { string = model.address.province + "/" + model.address.city
if string.count != 0 {
string = string + "/" + item
} else {
string = string + item
}
} }
let item3 = YHUserInformationModel(id: .id2, title: "所在地-省市", isUserKeyBoard: false, prompts: "请选择您的所在地", message: string, type: .address, value: mainModel.area)
let item4 = YHUserInformationModel(id: .id7, title: "星座", isUserKeyBoard: false, prompts: "请选择您的星座", message: mainModel.constellation, type: .constellation) let item3 = YHUserInformationModel(id: .id2, title: "所在地-省市", isUserKeyBoard: false, prompts: "请选择您的所在地", message: string, type: .address)
if mainModel.country.contains("中国") { let item4 = YHUserInformationModel(id: .id7, title: "星座", isUserKeyBoard: false, prompts: "请选择您的星座", message: model.zodiac, type: .constellation)
if model.address.country.contains("中国") {
return [item1, item2, item3, item4] return [item1, item2, item3, item4]
} }
return [item1, item2, item4] return [item1, item2, item4]
...@@ -38,40 +35,41 @@ class YHEditViewModel: YHBaseViewModel { ...@@ -38,40 +35,41 @@ class YHEditViewModel: YHBaseViewModel {
guard let type = item.id else { return } guard let type = item.id else { return }
switch type { switch type {
case .id1: case .id1:
mainModel.username = item.message ?? "" model.username = item.message ?? ""
case .id2: case .id2:
mainModel.area = item.value ?? [] model.address.province = item.value?.first ?? ""
model.address.city = item.value?.last ?? ""
case .id3: case .id3:
mainModel.school = item.message ?? "" model.college = item.message ?? ""
case .id4: case .id4:
mainModel.industry = item.message ?? "" model.industry = item.message ?? ""
case .id5: case .id5:
mainModel.position = item.message ?? "" model.position = item.message ?? ""
case .id6: case .id6:
mainModel.country = item.message ?? "" model.address.country = item.message ?? ""
case .id7: case .id7:
mainModel.constellation = item.message ?? "" model.zodiac = item.message ?? ""
case .id8: case .id8:
mainModel.major = item.message ?? "" model.major = item.message ?? ""
case .id9: case .id9:
mainModel.degree = item.message ?? "" model.background = item.message ?? ""
case .id10: case .id10:
mainModel.company = item.message ?? "" model.companyName = item.message ?? ""
} }
} }
func getBaseSchoolDataSource() -> [YHUserInformationModel] { func getBaseSchoolDataSource() -> [YHUserInformationModel] {
let item1 = YHUserInformationModel(id: .id3, title: "毕业院校", isUserKeyBoard: false, prompts: "请输入您的毕业院校", message: mainModel.school, type: .school) let item1 = YHUserInformationModel(id: .id3, title: "毕业院校", isUserKeyBoard: false, prompts: "请输入您的毕业院校", message: model.college, type: .school)
let item2 = YHUserInformationModel(id: .id8, title: "专业", isUserKeyBoard: true, prompts: "请输入您的专业", message: mainModel.major) let item2 = YHUserInformationModel(id: .id8, title: "专业", isUserKeyBoard: true, prompts: "请输入您的专业", message: model.major)
let item3 = YHUserInformationModel(id: .id9, title: "学位", isUserKeyBoard: false, prompts: "请选择您的学位", message: mainModel.degree, type: .degree) let item3 = YHUserInformationModel(id: .id9, title: "学位", isUserKeyBoard: false, prompts: "请选择您的学位", message: model.background, type: .degree)
return [item1, item2, item3] return [item1, item2, item3]
} }
func getBaseWorkDataSource() -> [YHUserInformationModel] { func getBaseWorkDataSource() -> [YHUserInformationModel] {
let item1 = YHUserInformationModel(id: .id10, title: "所在企业", isUserKeyBoard: true, prompts: "请输入您的所在企业", message: mainModel.company) let item1 = YHUserInformationModel(id: .id10, title: "所在企业", isUserKeyBoard: true, prompts: "请输入您的所在企业", message: model.companyName)
let item2 = YHUserInformationModel(id: .id5, title: "职位", isUserKeyBoard: true, prompts: "请输入您的职位", message: mainModel.position) let item2 = YHUserInformationModel(id: .id5, title: "职位", isUserKeyBoard: true, prompts: "请输入您的职位", message: model.position)
let item3 = YHUserInformationModel(id: .id4, title: "所在行业", isUserKeyBoard: false, prompts: "请选择您的所在行业", message: mainModel.industry, type: .id) let item3 = YHUserInformationModel(id: .id4, title: "所在行业", isUserKeyBoard: false, prompts: "请选择您的所在行业", message: model.industry, type: .id)
return [item1, item2, item3] return [item1, item2, item3]
} }
......
...@@ -17,7 +17,7 @@ class YHAnalytics { ...@@ -17,7 +17,7 @@ class YHAnalytics {
#if DEBUG #if DEBUG
let options = SAConfigOptions.init(serverURL: YhConstant.SensorsAnalytics.urlForTest, launchOptions: launchOptions) let options = SAConfigOptions.init(serverURL: YhConstant.SensorsAnalytics.urlForTest, launchOptions: launchOptions)
//开启log //开启log
options.enableLog = true options.enableLog = false
SensorsAnalyticsSDK.sharedInstance()?.set(["evn" : "test"]) SensorsAnalyticsSDK.sharedInstance()?.set(["evn" : "test"])
#elseif TESTENV #elseif TESTENV
let options = SAConfigOptions.init(serverURL: YhConstant.SensorsAnalytics.urlForTest, launchOptions: launchOptions) let options = SAConfigOptions.init(serverURL: YhConstant.SensorsAnalytics.urlForTest, launchOptions: launchOptions)
......
...@@ -314,5 +314,16 @@ class YHAllApiName { ...@@ -314,5 +314,16 @@ class YHAllApiName {
static let addFriendApi = "super-app/community/friend-application" static let addFriendApi = "super-app/community/friend-application"
// 接收好友请求 // 接收好友请求
static let receiveFriendRequestApi = "super-app/community/process-friend-requests" static let receiveFriendRequestApi = "super-app/community/process-friend-requests"
// 好友列表
static let friendListApi = "super-app/community/my-friends"
// 我的名片
static let nameCardInfoApi = "super-app/business-card/my-detail"
static let change = "super-app/avatar/change"
static let userSubmit = "super-app/user-base/submit"
static let authorizationSubmit = "super-app/authorization/submit"
static let userInfo = "super-app/user-base/info"
static let userAuthorization = "super-app/user/authorization"
} }
} }
...@@ -68,8 +68,8 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -68,8 +68,8 @@ class YHOSSManager: NSObject, URLSessionDelegate {
} }
} }
func putObject(image: UIImage, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) { func putObject(image: UIImage, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let request = OSSPutObjectRequest() let request = OSSPutObjectACLRequest()
let size = Int(2 * 1024 * 1024) let size = Int(2 * 1024 * 1024)
guard let imageData = image.compressOriginalImage(size) else { guard let imageData = image.compressOriginalImage(size) else {
callBackBlock(nil, YHErrorModel()) callBackBlock(nil, YHErrorModel())
...@@ -86,7 +86,12 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -86,7 +86,12 @@ class YHOSSManager: NSObject, URLSessionDelegate {
dateFormatter.dateFormat = "yyyyMMdd" dateFormatter.dateFormat = "yyyyMMdd"
let currentDateMMdd = dateFormatter.string(from: Date()) let currentDateMMdd = dateFormatter.string(from: Date())
self.fileName.append(name) self.fileName.append(name)
request.objectKey = "4001001" + "/" + currentDateMMdd + "/" + "\(name)" if isPublic {
request.acl = "public-read-write"
request.objectKey = "5000000" + "/" + currentDateMMdd + "/" + "\(name)"
} else {
request.objectKey = "4001001" + "/" + currentDateMMdd + "/" + "\(name)"
}
request.contentDisposition = "inline" request.contentDisposition = "inline"
request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in
printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)") printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)")
...@@ -102,9 +107,13 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -102,9 +107,13 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let dateFormatter = DateFormatter() let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyyMMdd" dateFormatter.dateFormat = "yyyyMMdd"
let currentDateMMdd = dateFormatter.string(from: Date()) let currentDateMMdd = dateFormatter.string(from: Date())
let string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "4001001" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")" var string = ""
if isPublic {
string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "5000000" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")"
} else {
string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "4001001" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")"
}
self.fileName.removeFirst() self.fileName.removeFirst()
print("------------\(string)")
callBackBlock(string, YHErrorModel()) callBackBlock(string, YHErrorModel())
} }
return return
...@@ -112,8 +121,8 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -112,8 +121,8 @@ class YHOSSManager: NSObject, URLSessionDelegate {
} }
} }
func putFile(file: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) { func putFile(file: String, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let request = OSSPutObjectRequest() let request = OSSPutObjectACLRequest()
guard let fileData = try? Data(contentsOf: URL(string: file) ?? URL(fileURLWithPath: "")) else { guard let fileData = try? Data(contentsOf: URL(string: file) ?? URL(fileURLWithPath: "")) else {
callBackBlock(nil, YHErrorModel()) callBackBlock(nil, YHErrorModel())
return return
...@@ -129,7 +138,12 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -129,7 +138,12 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let dateFormatter = DateFormatter() let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyyMMdd" dateFormatter.dateFormat = "yyyyMMdd"
let currentDateMMdd = dateFormatter.string(from: Date()) let currentDateMMdd = dateFormatter.string(from: Date())
request.objectKey = "4001001" + "/" + currentDateMMdd + "/" + "\(name)" if isPublic {
request.acl = "public-read-write"
request.objectKey = "5000000" + "/" + currentDateMMdd + "/" + "\(name)"
} else {
request.objectKey = "4001001" + "/" + currentDateMMdd + "/" + "\(name)"
}
request.contentDisposition = "inline" request.contentDisposition = "inline"
request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in
printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)") printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)")
...@@ -147,7 +161,12 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -147,7 +161,12 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let dateFormatter = DateFormatter() let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyyMMdd" dateFormatter.dateFormat = "yyyyMMdd"
let currentDateMMdd = dateFormatter.string(from: Date()) let currentDateMMdd = dateFormatter.string(from: Date())
let string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "4001001" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")" var string = ""
if isPublic {
string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "5000000" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")"
} else {
string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "4001001" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")"
}
self.fileName.removeFirst() self.fileName.removeFirst()
callBackBlock(string, YHErrorModel()) callBackBlock(string, YHErrorModel())
} }
...@@ -156,7 +175,7 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -156,7 +175,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
} }
} }
func getPublic(url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) { func getPublic(url: String, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
DispatchQueue.global().async { DispatchQueue.global().async {
let bucketName = self.getBucket(url) let bucketName = self.getBucket(url)
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "默认头像图@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "默认头像图@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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