Commit 7edbff6c authored by Steven杜宇's avatar Steven杜宇

// 名片

parent 55ceadf2
...@@ -24,16 +24,16 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController { ...@@ -24,16 +24,16 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController {
} }
func getData() { func getData() {
if stepFlag { // if stepFlag {
items = viewModel.getBaseSetDataSource() // items = viewModel.getBaseSetDataSource()
tableView.reloadData() // tableView.reloadData()
} else { // } else {
viewModel.requestUserAuthorization {[weak self] _, _ in viewModel.requestUserAuthorization {[weak self] _, _ in
guard let self = self else { return } guard let self = self else { return }
items = viewModel.getBaseSetDataSource() items = viewModel.getBaseSetDataSource()
tableView.reloadData() tableView.reloadData()
} }
} // }
} }
func setView() { func setView() {
...@@ -117,15 +117,15 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController { ...@@ -117,15 +117,15 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController {
@objc func nextStep() { @objc func nextStep() {
viewModel.requestAuthorizationSubmit {[weak self] _, _ in viewModel.requestAuthorizationSubmit {[weak self] _, _ in
guard let self = self else { return } guard let self = self else { return }
if self.stepFlag { // if self.stepFlag {
self.navigationController?.popToRootViewController(animated: true) // self.navigationController?.popToRootViewController(animated: true)
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))
view.titleLabel.text = "Hi,\(self.name)\n您的人脉网络已激活" // view.titleLabel.text = "Hi,\(self.name)\n您的人脉网络已激活"
let window = UIApplication.shared.yhKeyWindow() // let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view) // window?.addSubview(view)
} else { // } else {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} // }
} }
} }
} }
......
...@@ -61,11 +61,14 @@ class YHMainUserInformationModel: SmartCodable { ...@@ -61,11 +61,14 @@ class YHMainUserInformationModel: SmartCodable {
} }
class YHMainUserInformationSetModel: SmartCodable { class YHMainUserInformationSetModel: SmartCodable {
// 1: 关闭 2:开启
var uid: String = "" var uid: String = ""
var information_to_card: Int = 2 var information_to_card: Int = 2 // 弃用
var authorization_basic_information: Int = 2 var authorization_basic_information: Int = 2
var public_education_experience: Int = 2 var public_education_experience: Int = 2
var public_work_experience: Int = 2 var public_work_experience: Int = 2
var friend_education_experience: Int = 2
var friend_work_experience: Int = 2
var isclick_card: Int = 2 var isclick_card: Int = 2
required init() { required init() {
} }
......
...@@ -26,14 +26,23 @@ class YHSetExplainView: UIView { ...@@ -26,14 +26,23 @@ class YHSetExplainView: UIView {
titleLabel.text = "授权AI人脉匹配" titleLabel.text = "授权AI人脉匹配"
messageLabel.text = "启动该功能后,您将能够使用AI人脉雷达来高效匹配新人脉,申请交换名片并成功成为好友后,双方可互相查看名片。信息准确度越高,匹配结果越精准" messageLabel.text = "启动该功能后,您将能够使用AI人脉雷达来高效匹配新人脉,申请交换名片并成功成为好友后,双方可互相查看名片。信息准确度越高,匹配结果越精准"
topImageView.image = UIImage(named: "set_example_people") topImageView.image = UIImage(named: "set_example_people")
case .school: case .schoolToFriend:
titleLabel.text = "允许向好友公开您的教育经历" titleLabel.text = "允许向好友公开您的教育经历"
messageLabel.text = "授权开启后,您的个人主页将展示最高学历信息,仅对好友人脉开放查看权限,保护您的隐私安全" messageLabel.text = "授权开启后,您的个人主页将展示最高学历信息,仅对好友人脉开放查看权限,保护您的隐私安全"
topImageView.image = UIImage(named: "set_example_school") topImageView.image = UIImage(named: "set_example_school")
case .work: case .workToFriend:
titleLabel.text = "允许向好友公开您的工作经历" titleLabel.text = "允许向好友公开您的工作经历"
messageLabel.text = "授权开启后,您的个人主页将展示最新工作信息,仅对好友人脉开放查看权限,保护您的隐私安全" messageLabel.text = "授权开启后,您的个人主页将展示最新工作信息,仅对好友人脉开放查看权限,保护您的隐私安全"
topImageView.image = UIImage(named: "set_example_work") topImageView.image = UIImage(named: "set_example_work")
case .schoolToStranger:
titleLabel.text = "允许向陌生人公开您的教育经历"
messageLabel.text = "授权开启后,您的个人主页将展示最高学历信息,仅对非好友人脉开放查看权限,保护您的隐私安全"
topImageView.image = UIImage(named: "set_example_school")
case .workToStranger:
titleLabel.text = "允许向陌生人公开您的工作经历"
messageLabel.text = "授权开启后,您的个人主页将展示最新工作信息,仅对非好友人脉开放查看权限,保护您的隐私安全"
topImageView.image = UIImage(named: "set_example_work")
} }
} }
} }
......
...@@ -75,21 +75,26 @@ class YHInformationAuthorizeViewModel: YHBaseViewModel { ...@@ -75,21 +75,26 @@ class YHInformationAuthorizeViewModel: YHBaseViewModel {
} }
func getBaseSetDataSource() -> [YHSettingItem] { func getBaseSetDataSource() -> [YHSettingItem] {
let item1 = YHSettingItem(type: .people, title: "授权AI人脉匹配", subTitle: "开启后,您的信息将用于AI人脉匹配,为您构建高质量的人脉网络", isSelect: setModel.authorization_basic_information == 2 ? true : false, isShowAlert: true) let item1 = YHSettingItem(type: .people, title: "允许在公开人脉列表中展示", subTitle: "开启后,您的信息将展示在人脉列表,开启您的人脉网络", isSelect: setModel.authorization_basic_information == 2 ? true : false, isShowAlert: true)
let item2 = YHSettingItem(type: .school, title: "允许向好友公开您的教育经历", subTitle: "开启后,您的教育经历将在您的个人名片上对已交换名片的好友可见", isSelect: setModel.public_education_experience == 2 ? true : false, isShowAlert: true) let item2 = YHSettingItem(type: .schoolToStranger, title: "允许向陌生人公开您的教育经历", subTitle: "开启后,您的教育经历将在您的个人名片上对非好友可见", isSelect: setModel.public_education_experience == 2 ? true : false, isShowAlert: true)
let item3 = YHSettingItem(type: .work, title: "允许向好友公开您的工作经历", subTitle: "开启后,您的工作经历将在您的个人名片上对已交换名片的好友可见", isSelect: setModel.public_work_experience == 2 ? true : false, isShowAlert: true) let item3 = YHSettingItem(type: .workToStranger, title: "允许向陌生人公开您的工作经历", subTitle: "开启后,您的工作经历将在您的个人名片上对非好友可见", isSelect: setModel.public_work_experience == 2 ? true : false, isShowAlert: true)
return [item1, item2, item3] let item4 = YHSettingItem(type: .schoolToFriend, title: "允许向好友公开您的教育经历", subTitle: "开启后,您的教育经历将在您的个人名片上对您的好友可见", isSelect: setModel.friend_education_experience == 2 ? true : false, isShowAlert: true)
let item5 = YHSettingItem(type: .workToFriend, title: "允许向好友公开您的工作经历", subTitle: "开启后,您的工作经历将在您的个人名片上对您的好友可见", isSelect: setModel.friend_work_experience == 2 ? true : false, isShowAlert: true)
return [item1, item2, item3, item4, item5]
} }
func updateSetModel(_ item: YHSettingItem) { func updateSetModel(_ item: YHSettingItem) {
switch item.type { switch item.type {
case .normal: break case .normal: break
case .people: case .people:
setModel.authorization_basic_information = item.isSelect ? 2 : 1 setModel.authorization_basic_information = item.isSelect ? 2 : 1
case .school: case .schoolToFriend:
setModel.friend_education_experience = item.isSelect ? 2 : 1
case .workToFriend:
setModel.friend_work_experience = item.isSelect ? 2 : 1
case .schoolToStranger:
setModel.public_education_experience = item.isSelect ? 2 : 1 setModel.public_education_experience = item.isSelect ? 2 : 1
case .work: case .workToStranger:
setModel.public_work_experience = item.isSelect ? 2 : 1 setModel.public_work_experience = item.isSelect ? 2 : 1
} }
} }
...@@ -190,7 +195,9 @@ class YHInformationAuthorizeViewModel: YHBaseViewModel { ...@@ -190,7 +195,9 @@ class YHInformationAuthorizeViewModel: YHBaseViewModel {
func requestAuthorizationSubmit(callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) { func requestAuthorizationSubmit(callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
let params: [String: Any] = ["authorization_basic_information": setModel.authorization_basic_information, let params: [String: Any] = ["authorization_basic_information": setModel.authorization_basic_information,
"public_education_experience": setModel.public_education_experience, "public_education_experience": setModel.public_education_experience,
"public_work_experience": setModel.public_work_experience] "public_work_experience": setModel.public_work_experience,
"friend_education_experience": setModel.friend_education_experience,
"friend_work_experience": setModel.friend_work_experience]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.authorizationSubmit let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.authorizationSubmit
_ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, _ in _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, _ in
// 1. json字符串 转 对象 // 1. json字符串 转 对象
......
...@@ -11,8 +11,10 @@ import UIKit ...@@ -11,8 +11,10 @@ import UIKit
enum YHSettingType: Int { enum YHSettingType: Int {
case normal case normal
case people case people
case school case schoolToStranger
case work case workToStranger
case schoolToFriend
case workToFriend
} }
class YHSettingItem: NSObject { class YHSettingItem: NSObject {
......
...@@ -111,7 +111,7 @@ class YHAllowSettingTableViewCell: UITableViewCell { ...@@ -111,7 +111,7 @@ class YHAllowSettingTableViewCell: UITableViewCell {
} }
case .people: case .people:
if !detailSwitch.isOn { if !detailSwitch.isOn {
YHGrayCommonAlertView.show("", "关闭后,您将无法体验AI人脉匹配功能?", "仍然关闭", "开启", fullGuestureEnable: false) { YHGrayCommonAlertView.show("", "关闭后,您的信息将不会被展示在公开的人脉列表中", "仍然关闭", "开启", fullGuestureEnable: false) {
self.detailSwitch.isOn = false self.detailSwitch.isOn = false
model.isSelect = self.detailSwitch.isOn model.isSelect = self.detailSwitch.isOn
if let block = self.block { if let block = self.block {
...@@ -130,7 +130,7 @@ class YHAllowSettingTableViewCell: UITableViewCell { ...@@ -130,7 +130,7 @@ class YHAllowSettingTableViewCell: UITableViewCell {
block(model) block(model)
} }
} }
case .school: case .schoolToFriend:
if !detailSwitch.isOn { if !detailSwitch.isOn {
YHGrayCommonAlertView.show("", "关闭后,您的好友将无法从您的名片中查看您的教育经历", "仍然关闭", "开启", fullGuestureEnable: false) { YHGrayCommonAlertView.show("", "关闭后,您的好友将无法从您的名片中查看您的教育经历", "仍然关闭", "开启", fullGuestureEnable: false) {
self.detailSwitch.isOn = false self.detailSwitch.isOn = false
...@@ -151,7 +151,7 @@ class YHAllowSettingTableViewCell: UITableViewCell { ...@@ -151,7 +151,7 @@ class YHAllowSettingTableViewCell: UITableViewCell {
block(model) block(model)
} }
} }
case .work: case .workToFriend:
if !detailSwitch.isOn { if !detailSwitch.isOn {
YHGrayCommonAlertView.show("", "关闭后,您的好友将无法从您的名片中查看您的工作经历", "仍然关闭", "开启", fullGuestureEnable: false) { YHGrayCommonAlertView.show("", "关闭后,您的好友将无法从您的名片中查看您的工作经历", "仍然关闭", "开启", fullGuestureEnable: false) {
self.detailSwitch.isOn = false self.detailSwitch.isOn = false
...@@ -172,6 +172,48 @@ class YHAllowSettingTableViewCell: UITableViewCell { ...@@ -172,6 +172,48 @@ class YHAllowSettingTableViewCell: UITableViewCell {
block(model) block(model)
} }
} }
case .schoolToStranger:
if !detailSwitch.isOn {
YHGrayCommonAlertView.show("", "关闭后,非您的好友将无法从您的名片中查看您的教育经历", "仍然关闭", "开启", fullGuestureEnable: false) {
self.detailSwitch.isOn = false
model.isSelect = self.detailSwitch.isOn
if let block = self.block {
block(model)
}
} callBack: {
model.isSelect = self.detailSwitch.isOn
self.detailSwitch.isOn = true
if let block = self.block {
block(model)
}
}
} else {
model.isSelect = detailSwitch.isOn
if let block = block {
block(model)
}
}
case .workToStranger:
if !detailSwitch.isOn {
YHGrayCommonAlertView.show("", "关闭后,非您的好友将无法从您的名片中查看您的工作经历", "仍然关闭", "开启", fullGuestureEnable: false) {
self.detailSwitch.isOn = false
model.isSelect = self.detailSwitch.isOn
if let block = self.block {
block(model)
}
} callBack: {
model.isSelect = self.detailSwitch.isOn
self.detailSwitch.isOn = true
if let block = self.block {
block(model)
}
}
} else {
model.isSelect = detailSwitch.isOn
if let block = block {
block(model)
}
}
} }
} }
......
...@@ -58,15 +58,31 @@ class YHMyNewViewController: YHBaseViewController { ...@@ -58,15 +58,31 @@ class YHMyNewViewController: YHBaseViewController {
return tableView return tableView
}() }()
func enterNewNameCard() {
if let userId = YHLoginManager.shared.userModel?.id {
let enterKey = "name_card_first_enter_"+userId
if let hasEnter = UserDefaults.standard.object(forKey: enterKey) as? Bool, hasEnter == true {
let vc = YHNewNameCardViewController()
vc.userId = userId
self.navigationController?.pushViewController(vc)
} else {
// 授权页面
UserDefaults.standard.set(true, forKey: enterKey)
UserDefaults.standard.synchronize()
let vc = YHInformationAuthorizationStepOneViewController()
self.navigationController?.pushViewController(vc)
}
}
}
lazy var userInfoView: YHMyUserInfoView = { lazy var userInfoView: YHMyUserInfoView = {
let view = YHMyUserInfoView.createView() let view = YHMyUserInfoView.createView()
view.enterClick = { view.enterClick = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
if !checkLogin() { return } if !checkLogin() { return }
enterMyNameCard()
// enterUserInfoEditPage() // enterUserInfoEditPage()
enterNewNameCard()
} }
view.avatarClickBlock = { view.avatarClickBlock = {
...@@ -667,11 +683,7 @@ extension YHMyNewViewController { ...@@ -667,11 +683,7 @@ extension YHMyNewViewController {
switch item.type { switch item.type {
case .myCard:// 我的名片 case .myCard:// 我的名片
let vc = YHNewNameCardViewController() enterNewNameCard()
if let userId = YHLoginManager.shared.userModel?.id {
vc.userId = userId
}
self.navigationController?.pushViewController(vc)
// enterMyNameCard() // enterMyNameCard()
case .myMessage:// 我的消息 case .myMessage:// 我的消息
printLog("我的消息") printLog("我的消息")
...@@ -781,9 +793,7 @@ extension YHMyNewViewController { ...@@ -781,9 +793,7 @@ extension YHMyNewViewController {
let vc = YHMyGoodFriendsVC() let vc = YHMyGoodFriendsVC()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
case .myEnterprise: case .myEnterprise:
let vc = YHInformationAuthorizationStepOneViewController() print("")
// vc.stepFlag = false
self.navigationController?.pushViewController(vc)
default: default:
printLog("不需要响应") printLog("不需要响应")
} }
......
...@@ -14,6 +14,8 @@ class YHNewNameCardViewController: YHBaseViewController { ...@@ -14,6 +14,8 @@ class YHNewNameCardViewController: YHBaseViewController {
var userId: String = "" var userId: String = ""
var defaultIndex = 0 var defaultIndex = 0
let viewModel = YHMatchUserViewModel() let viewModel = YHMatchUserViewModel()
var authorModel: YHInformationAuthorizeViewModel = YHInformationAuthorizeViewModel()
var headerHeight: CGFloat = 300.0 var headerHeight: CGFloat = 300.0
let containerCellHeight = KScreenHeight-k_Height_NavigationtBarAndStatuBar-k_Height_safeAreaInsetsBottom()-88 let containerCellHeight = KScreenHeight-k_Height_NavigationtBarAndStatuBar-k_Height_safeAreaInsetsBottom()-88
...@@ -295,6 +297,9 @@ class YHNewNameCardViewController: YHBaseViewController { ...@@ -295,6 +297,9 @@ class YHNewNameCardViewController: YHBaseViewController {
containerVC.userId = self.userId containerVC.userId = self.userId
createUI() createUI()
if self.isCurrentUser {
requestAuthorization()
}
} }
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
...@@ -302,6 +307,24 @@ class YHNewNameCardViewController: YHBaseViewController { ...@@ -302,6 +307,24 @@ class YHNewNameCardViewController: YHBaseViewController {
self.requestNameCardInfo() self.requestNameCardInfo()
} }
func requestAuthorization() {
self.authorModel.requestUserAuthorization { _, _ in
if self.authorModel.setModel.authorization_basic_information != 2 && self.authorModel.setModel.isclick_card != 2 {
YHGrayCommonAlertView.show("温馨提示", "是否授权信息在公开的人脉列表中展示", "取消", "确认", fullGuestureEnable: false) {
self.authorModel.requestInformationToCardSubmit(agress: 1) { _, _ in
self.requestNameCardInfo()
}
} callBack: {
self.authorModel.requestInformationToCardSubmit(agress: 2) { _, _ in
self.authorModel.requestBusinessCardAuthorize { _, _ in
self.requestNameCardInfo()
}
}
}
}
}
}
func createUI() { func createUI() {
addObserver() addObserver()
self.editBtn.isHidden = !self.isCurrentUser self.editBtn.isHidden = !self.isCurrentUser
...@@ -379,7 +402,8 @@ class YHNewNameCardViewController: YHBaseViewController { ...@@ -379,7 +402,8 @@ class YHNewNameCardViewController: YHBaseViewController {
} }
@objc func authorizeBtnClicked() { @objc func authorizeBtnClicked() {
let vc = YHInformationAuthorizationStepTwoViewController()
self.navigationController?.pushViewController(vc)
} }
@objc func didBasciInfoBtnClicked() { @objc func didBasciInfoBtnClicked() {
......
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