Commit e816b57d 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:
  //  我的名片
  授权逻辑
  //  我的名片
  //  我的名片
  //  人脉
  //  人脉
  编辑页面细节同步
  //  人脉
  //  人脉
parents 0c18a739 dd2d0b62
...@@ -152,8 +152,8 @@ class YHMatchPeopleViewController: YHBaseViewController { ...@@ -152,8 +152,8 @@ class YHMatchPeopleViewController: YHBaseViewController {
@objc func didMyCardBtnClicked() { @objc func didMyCardBtnClicked() {
let vc = YHMyNameCardViewController() let vc = YHMyNameCardViewController()
if let userId = YHLoginManager.shared.userModel?.userid { if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty {
vc.userId = "\(userId)" vc.userId = userId
} }
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
...@@ -400,5 +400,12 @@ extension YHMatchPeopleViewController: DragCardDelegate { ...@@ -400,5 +400,12 @@ extension YHMatchPeopleViewController: DragCardDelegate {
public func dragCard(_ dragCard: DragCardContainer, didSelectTopCardAt index: Int, with cardView: DragCardView) { public func dragCard(_ dragCard: DragCardContainer, didSelectTopCardAt index: Int, with cardView: DragCardView) {
print("didSelectTopCardAt: \(index)") print("didSelectTopCardAt: \(index)")
if 0 <= index && index < self.matchUsersArr.count {
if let userModel = self.matchUsersArr[index] {
let vc = YHMyNameCardViewController()
vc.userId = userModel.yhId
self.navigationController?.pushViewController(vc)
}
}
} }
} }
...@@ -32,6 +32,12 @@ class YHMyNameCardViewController: YHBaseViewController { ...@@ -32,6 +32,12 @@ class YHMyNameCardViewController: YHBaseViewController {
return tableView return tableView
}() }()
var isCurrentUser: Bool {
get {
return (!self.userId.isEmpty && self.userId == YHLoginManager.shared.userModel?.id)
}
}
lazy var bgImgView:UIImageView = { lazy var bgImgView:UIImageView = {
let view = UIImageView(image: UIImage(named: "people_card_bg")) let view = UIImageView(image: UIImage(named: "people_card_bg"))
return view return view
...@@ -73,7 +79,11 @@ class YHMyNameCardViewController: YHBaseViewController { ...@@ -73,7 +79,11 @@ class YHMyNameCardViewController: YHBaseViewController {
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
requestNameCardInfo() if isCurrentUser {
requestAuthorization()
} else {
requestNameCardInfo()
}
} }
func createUI() { func createUI() {
...@@ -115,9 +125,21 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource ...@@ -115,9 +125,21 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
if 0 <= indexPath.section && indexPath.section < self.cardInfoArr.count { if 0 <= indexPath.section && indexPath.section < self.cardInfoArr.count {
let cardInfo = self.cardInfoArr[indexPath.section] let cardInfo = self.cardInfoArr[indexPath.section]
if cardInfo.type == .avatar {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyNameCardAvatarInfoCell.cellReuseIdentifier, for: indexPath) as! YHMyNameCardAvatarInfoCell
cell.userModel = cardInfo
cell.editBlock = { [weak self] in
guard let self = self else { return }
let vc = YHEditBaseUserInfoViewController()
vc.model = self.viewModel.nameCardInfo
self.navigationController?.pushViewController(vc)
}
return cell
}
if cardInfo.type == .honor || cardInfo.type == .introduce { if cardInfo.type == .honor || cardInfo.type == .introduce {
let introCell = tableView.dequeueReusableCell(withIdentifier: YHMyIntroductionCell.cellReuseIdentifier, for: indexPath) as! YHMyIntroductionCell let introCell = tableView.dequeueReusableCell(withIdentifier: YHMyIntroductionCell.cellReuseIdentifier, for: indexPath) as! YHMyIntroductionCell
introCell.userModel = self.viewModel.nameCardInfo introCell.userModel = cardInfo
introCell.editBlock = { [weak self] in introCell.editBlock = { [weak self] in
guard let self = self else { return } guard let self = self else { return }
if cardInfo.type == .honor { if cardInfo.type == .honor {
...@@ -135,7 +157,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource ...@@ -135,7 +157,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
if cardInfo.type == .education { if cardInfo.type == .education {
let eduCell = tableView.dequeueReusableCell(withIdentifier: YHMyEducationCell.cellReuseIdentifier, for: indexPath) as! YHMyEducationCell let eduCell = tableView.dequeueReusableCell(withIdentifier: YHMyEducationCell.cellReuseIdentifier, for: indexPath) as! YHMyEducationCell
eduCell.userModel = self.viewModel.nameCardInfo eduCell.userModel = cardInfo
eduCell.editBlock = { [weak self] in eduCell.editBlock = { [weak self] in
guard let self = self else { return } guard let self = self else { return }
let vc = YHEditSchoolViewController() let vc = YHEditSchoolViewController()
...@@ -147,7 +169,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource ...@@ -147,7 +169,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
if cardInfo.type == .workExperience { if cardInfo.type == .workExperience {
let workCell = tableView.dequeueReusableCell(withIdentifier: YHMyWorkExperienceCell.cellReuseIdentifier, for: indexPath) as! YHMyWorkExperienceCell let workCell = tableView.dequeueReusableCell(withIdentifier: YHMyWorkExperienceCell.cellReuseIdentifier, for: indexPath) as! YHMyWorkExperienceCell
workCell.userModel = self.viewModel.nameCardInfo workCell.userModel = cardInfo
workCell.editBlock = { [weak self] in workCell.editBlock = { [weak self] in
guard let self = self else { return } guard let self = self else { return }
let vc = YHEditWorkViewController() let vc = YHEditWorkViewController()
...@@ -159,7 +181,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource ...@@ -159,7 +181,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
if cardInfo.type == .topics { if cardInfo.type == .topics {
let topicCell = tableView.dequeueReusableCell(withIdentifier: YHMyInterestTopicCell.cellReuseIdentifier, for: indexPath) as! YHMyInterestTopicCell let topicCell = tableView.dequeueReusableCell(withIdentifier: YHMyInterestTopicCell.cellReuseIdentifier, for: indexPath) as! YHMyInterestTopicCell
topicCell.userModel = self.viewModel.nameCardInfo topicCell.userModel = cardInfo
topicCell.editBlock = { [weak self] in topicCell.editBlock = { [weak self] in
guard let self = self else { return } guard let self = self else { return }
let vc = YHEditInterestViewController() let vc = YHEditInterestViewController()
...@@ -170,15 +192,8 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource ...@@ -170,15 +192,8 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
} }
} }
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyNameCardAvatarInfoCell.cellReuseIdentifier, for: indexPath) as! YHMyNameCardAvatarInfoCell let defaultCell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
cell.userModel = self.viewModel.nameCardInfo return defaultCell
cell.editBlock = { [weak self] in
guard let self = self else { return }
let vc = YHEditBaseUserInfoViewController()
vc.model = self.viewModel.nameCardInfo
self.navigationController?.pushViewController(vc)
}
return cell
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
...@@ -208,7 +223,21 @@ extension YHMyNameCardViewController { ...@@ -208,7 +223,21 @@ extension YHMyNameCardViewController {
func requestAuthorization() { func requestAuthorization() {
self.authorModel.requestUserAuthorization { success, error in self.authorModel.requestUserAuthorization { success, error in
self.requestNameCardInfo() if self.authorModel.setModel.isclick_card != 2 {
YHCommonAlertView.show("", "授权信息同步至您的名片并对您的好友可见", "取消", "确认",fullGuestureEnable: false) {
self.authorModel.requestInformationToCardSubmit(agress: 1) { success, error in
self.requestNameCardInfo()
}
} callBack: {
self.authorModel.requestInformationToCardSubmit(agress: 2) { success, error in
self.authorModel.requestBusinessCardAuthorize { success, error in
self.requestNameCardInfo()
}
}
}
} else {
self.requestNameCardInfo()
}
} }
} }
...@@ -220,31 +249,57 @@ extension YHMyNameCardViewController { ...@@ -220,31 +249,57 @@ extension YHMyNameCardViewController {
let model1 = YHUserNameCardInfo() let model1 = YHUserNameCardInfo()
model1.type = .avatar model1.type = .avatar
model1.isCurrentUser = self.isCurrentUser
model1.updateModel(self.viewModel.nameCardInfo) model1.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model1) self.cardInfoArr.append(model1)
let model2 = YHUserNameCardInfo() let model2 = YHUserNameCardInfo()
model2.type = .introduce model2.type = .introduce
model2.isCurrentUser = self.isCurrentUser
model2.updateModel(self.viewModel.nameCardInfo) model2.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model2) self.cardInfoArr.append(model2)
let model3 = YHUserNameCardInfo() if !self.isCurrentUser {
model3.type = .education if !self.viewModel.nameCardInfo.isHiddenEducation {
model3.updateModel(self.viewModel.nameCardInfo) let model3 = YHUserNameCardInfo()
self.cardInfoArr.append(model3) model3.type = .education
model3.isCurrentUser = self.isCurrentUser
let model4 = YHUserNameCardInfo() model3.updateModel(self.viewModel.nameCardInfo)
model4.type = .workExperience self.cardInfoArr.append(model3)
model4.updateModel(self.viewModel.nameCardInfo) }
self.cardInfoArr.append(model4) } else {
let model3 = YHUserNameCardInfo()
model3.type = .education
model3.isCurrentUser = self.isCurrentUser
model3.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model3)
}
if !self.isCurrentUser {
if !self.viewModel.nameCardInfo.isHiddenWorkExperience {
let model4 = YHUserNameCardInfo()
model4.type = .workExperience
model4.isCurrentUser = self.isCurrentUser
model4.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model4)
}
} else {
let model4 = YHUserNameCardInfo()
model4.type = .workExperience
model4.isCurrentUser = self.isCurrentUser
model4.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model4)
}
let model5 = YHUserNameCardInfo() let model5 = YHUserNameCardInfo()
model5.type = .honor model5.type = .honor
model5.isCurrentUser = self.isCurrentUser
model5.updateModel(self.viewModel.nameCardInfo) model5.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model5) self.cardInfoArr.append(model5)
let model6 = YHUserNameCardInfo() let model6 = YHUserNameCardInfo()
model6.type = .topics model6.type = .topics
model6.isCurrentUser = self.isCurrentUser
model6.updateModel(self.viewModel.nameCardInfo) model6.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model6) self.cardInfoArr.append(model6)
......
...@@ -148,10 +148,10 @@ class YHPeopleViewController: YHBaseViewController { ...@@ -148,10 +148,10 @@ class YHPeopleViewController: YHBaseViewController {
@objc func didMatchBtnClicked() { @objc func didMatchBtnClicked() {
// if true { if true {
// startMatchUsers() startMatchUsers()
// return return
// } }
let vc = YHInformationAuthorizationStepOneViewController() let vc = YHInformationAuthorizationStepOneViewController()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
......
...@@ -48,6 +48,21 @@ class YHMatchUserAddress: SmartCodable { ...@@ -48,6 +48,21 @@ class YHMatchUserAddress: SmartCodable {
} }
} }
class YHAuthorizationModel: SmartCodable {
var educationExperience: Int = 0
var workExperience = 0
required init() {
}
enum CodingKeys: String, CodingKey {
case educationExperience = "public_education_experience"
case workExperience = "public_work_experience"
}
}
enum YHNameCardInfoType:Int { enum YHNameCardInfoType:Int {
case unknown = -1 case unknown = -1
case avatar = 0 case avatar = 0
...@@ -76,11 +91,21 @@ class YHUserNameCardInfo: SmartCodable { ...@@ -76,11 +91,21 @@ class YHUserNameCardInfo: SmartCodable {
var industry: String = "" var industry: String = ""
var honor: String = "" var honor: String = ""
var topics: [String] = [] var topics: [String] = []
var authorization: YHAuthorizationModel = YHAuthorizationModel()
// 自定义属性 // 自定义属性
var type:YHNameCardInfoType = .unknown var type:YHNameCardInfoType = .unknown
var isHiddenEducation = false var isHiddenEducation : Bool {
var isHiddenWorkExperience = false get {
return self.authorization.educationExperience != 2
}
}
var isHiddenWorkExperience: Bool {
get {
return self.authorization.educationExperience != 2
}
}
var isCurrentUser = false
required init() { required init() {
...@@ -110,11 +135,9 @@ class YHUserNameCardInfo: SmartCodable { ...@@ -110,11 +135,9 @@ class YHUserNameCardInfo: SmartCodable {
} }
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id
case yhId = "yh_id" case yhId = "yh_id"
case isSigned = "is_signed" case isSigned = "is_signed"
case avatar, username, address, zodiac, signature, bio, college, major, background case id, avatar, username, address, zodiac, signature, bio, college, major, background, authorization, position, industry, honor, topics
case companyName = "company_name" case companyName = "company_name"
case position, industry, honor, topics
} }
} }
...@@ -15,8 +15,38 @@ class YHMyEducationCell: UITableViewCell { ...@@ -15,8 +15,38 @@ class YHMyEducationCell: UITableViewCell {
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() { var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet { didSet {
self.collegeLabel.text = self.userModel.college
self.detailLabel.text = self.userModel.background self.editBtn.isHidden = !self.userModel.isCurrentUser
self.collegeLabel.textColor = UIColor.mainTextColor
self.detailLabel.textColor = UIColor.mainTextColor70
if !self.userModel.college.isEmpty {
self.collegeLabel.text = self.userModel.college
} else {
self.collegeLabel.text = ""
if self.userModel.isCurrentUser {
self.collegeLabel.text = "填写院校名称"
self.collegeLabel.textColor = UIColor.mainTextColor30
}
}
if !self.userModel.background.isEmpty {
self.detailLabel.text = self.userModel.background
} else {
self.detailLabel.text = ""
if self.userModel.isCurrentUser {
self.detailLabel.text = "填写专业 · 填写学位"
self.detailLabel.textColor = UIColor.mainTextColor30
}
}
if self.userModel.isCurrentUser {
self.hiddenBtn.isHidden = (self.userModel.authorization.educationExperience == 1)
} else {
self.hiddenBtn.isHidden = true
}
} }
} }
...@@ -39,7 +69,7 @@ class YHMyEducationCell: UITableViewCell { ...@@ -39,7 +69,7 @@ class YHMyEducationCell: UITableViewCell {
lazy var collegeLabel:UILabel = { lazy var collegeLabel:UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor.mainTextColor70 label.textColor = UIColor.mainTextColor
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_M(ofSize:14) label.font = UIFont.PFSC_M(ofSize:14)
label.numberOfLines = 0 label.numberOfLines = 0
...@@ -65,6 +95,7 @@ class YHMyEducationCell: UITableViewCell { ...@@ -65,6 +95,7 @@ class YHMyEducationCell: UITableViewCell {
lazy var hiddenBtn:UIButton = { lazy var hiddenBtn:UIButton = {
let btn = UIButton() let btn = UIButton()
btn.isHidden = true
btn.backgroundColor = UIColor.init(hex: 0xF4F6FA) btn.backgroundColor = UIColor.init(hex: 0xF4F6FA)
btn.layer.cornerRadius = 3.0 btn.layer.cornerRadius = 3.0
btn.setImage(UIImage(named: "people_card_hidden"), for: .normal) btn.setImage(UIImage(named: "people_card_hidden"), for: .normal)
......
...@@ -116,14 +116,6 @@ class YHMyInformationItemCell: UITableViewCell { ...@@ -116,14 +116,6 @@ class YHMyInformationItemCell: UITableViewCell {
titleLabel.attributedText = questionAttrStr titleLabel.attributedText = questionAttrStr
messageTextField.placeholder = dataSource.prompts messageTextField.placeholder = dataSource.prompts
messageTextField.text = dataSource.message messageTextField.text = dataSource.message
if dataSource.type == .constellation {
let arr = YHConstantArrayData.arrDegreeConstellation
arr.forEach { item in
if item["id"] == dataSource.message {
messageTextField.text = item["title"]
}
}
}
if dataSource.isUserKeyBoard ?? false { if dataSource.isUserKeyBoard ?? false {
nextStepImageView.isHidden = true nextStepImageView.isHidden = true
centerButton.isHidden = true centerButton.isHidden = true
...@@ -183,7 +175,7 @@ class YHMyInformationItemCell: UITableViewCell { ...@@ -183,7 +175,7 @@ class YHMyInformationItemCell: UITableViewCell {
case .constellation: case .constellation:
YHOtherPickerView.show(type: .constellation, selectTitle: self.dataSource?.message ?? "") { item in YHOtherPickerView.show(type: .constellation, selectTitle: self.dataSource?.message ?? "") { item in
print(item) print(item)
self.dataSource?.message = item.index self.dataSource?.message = item.title
self.updateAllViews() self.updateAllViews()
if let block = self.block { if let block = self.block {
block(self.dataSource ?? YHUserInformationModel()) block(self.dataSource ?? YHUserInformationModel())
......
...@@ -54,11 +54,54 @@ class YHMyInterestTopicCell: UITableViewCell { ...@@ -54,11 +54,54 @@ class YHMyInterestTopicCell: UITableViewCell {
var topicArr:[String] = [] var topicArr:[String] = []
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() { var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet { didSet {
self.topicArr.removeAll()
if self.userModel.topics.count > 0 { self.editBtn.isHidden = !self.userModel.isCurrentUser
self.topicArr.append(contentsOf: self.userModel.topics)
var isShowList = true
if self.userModel.isCurrentUser {
if self.topicArr.count <= 0 {
isShowList = false
}
}
self.collectionView.isHidden = !isShowList
self.detailLabel.isHidden = isShowList
if isShowList {
self.topicArr.removeAll()
if self.userModel.topics.count > 0 {
self.topicArr.append(contentsOf: self.userModel.topics)
}
self.collectionView.snp.remakeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-16)
make.height.equalTo(24)
make.top.equalTo(titleLabel.snp.bottom).offset(12)
}
self.detailLabel.snp.remakeConstraints { make in
make.edges.equalTo(self.collectionView)
}
self.collectionView.reloadData {
let height = self.collectionView.contentSize.height
self.collectionView.snp.updateConstraints { make in
make.height.equalTo(height)
}
}
} else {
self.detailLabel.snp.remakeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-16)
make.top.equalTo(titleLabel.snp.bottom).offset(12)
}
self.collectionView.snp.remakeConstraints { make in
make.edges.equalTo(self.detailLabel)
}
} }
self.collectionView.reloadData()
} }
} }
...@@ -106,6 +149,16 @@ class YHMyInterestTopicCell: UITableViewCell { ...@@ -106,6 +149,16 @@ class YHMyInterestTopicCell: UITableViewCell {
return collectView return collectView
}() }()
lazy var detailLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor30
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0
label.text = "填写你的兴趣爱好,与志同道合的人畅聊共同话题,如MBTI人格测试、艺术、运动、技术等方面。"
return label
}()
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
} }
...@@ -124,6 +177,7 @@ class YHMyInterestTopicCell: UITableViewCell { ...@@ -124,6 +177,7 @@ class YHMyInterestTopicCell: UITableViewCell {
self.contentView.addSubview(self.cardView) self.contentView.addSubview(self.cardView)
cardView.addSubview(self.titleLabel) cardView.addSubview(self.titleLabel)
cardView.addSubview(collectionView) cardView.addSubview(collectionView)
cardView.addSubview(detailLabel)
cardView.addSubview(self.editBtn) cardView.addSubview(self.editBtn)
...@@ -151,11 +205,8 @@ class YHMyInterestTopicCell: UITableViewCell { ...@@ -151,11 +205,8 @@ class YHMyInterestTopicCell: UITableViewCell {
make.top.equalTo(titleLabel.snp.bottom).offset(12) make.top.equalTo(titleLabel.snp.bottom).offset(12)
} }
collectionView.reloadData { detailLabel.snp.makeConstraints { make in
let height = self.collectionView.contentSize.height make.edges.equalTo(self.collectionView)
self.collectionView.snp.updateConstraints { make in
make.height.equalTo(height)
}
} }
} }
......
...@@ -15,13 +15,35 @@ class YHMyIntroductionCell: UITableViewCell { ...@@ -15,13 +15,35 @@ class YHMyIntroductionCell: UITableViewCell {
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() { var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet { didSet {
self.editBtn.isHidden = !self.userModel.isCurrentUser
if userModel.type == .introduce { if userModel.type == .introduce {
self.titleLabel.text = "个人简介" self.titleLabel.text = "个人简介"
self.detailLabel.text = self.userModel.bio self.detailLabel.textColor = UIColor.mainTextColor70
if !self.userModel.bio.isEmpty {
self.detailLabel.text = self.userModel.bio
} else {
self.detailLabel.text = ""
if self.userModel.isCurrentUser {
self.detailLabel.text = "快来完善你的个人简介,用简洁的文字描绘你的独特魅力。"
self.detailLabel.textColor = UIColor.mainTextColor30
}
}
} else if userModel.type == .honor { } else if userModel.type == .honor {
self.titleLabel.text = "荣誉奖项" self.titleLabel.text = "荣誉奖项"
self.detailLabel.text = self.userModel.honor self.detailLabel.textColor = UIColor.mainTextColor70
if !self.userModel.honor.isEmpty {
self.detailLabel.text = self.userModel.honor
} else {
self.detailLabel.text = ""
if self.userModel.isCurrentUser {
self.detailLabel.text = "展示你的辉煌时刻,让更多人见证你的卓越成就!"
self.detailLabel.textColor = UIColor.mainTextColor30
}
}
} }
} }
} }
...@@ -74,8 +96,6 @@ class YHMyIntroductionCell: UITableViewCell { ...@@ -74,8 +96,6 @@ class YHMyIntroductionCell: UITableViewCell {
self.backgroundColor = .clear self.backgroundColor = .clear
self.contentView.backgroundColor = .clear self.contentView.backgroundColor = .clear
detailLabel.text = "拥有超过十年的互联网行业经验,目前担任某知名科技公司的高级产品经理。成功领导并推动了多个产品的上线与迭代,赢得了业界和用户的广泛认可。"
self.contentView.addSubview(self.cardView) self.contentView.addSubview(self.cardView)
cardView.addSubview(self.titleLabel) cardView.addSubview(self.titleLabel)
cardView.addSubview(self.detailLabel) cardView.addSubview(self.detailLabel)
......
...@@ -17,6 +17,11 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -17,6 +17,11 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
let headWidth = 74.0 let headWidth = 74.0
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() { var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet { didSet {
self.professionalLabel.textColor = UIColor.mainTextColor
self.detailLabel.textColor = UIColor.mainTextColor50
self.editBtn.isHidden = !self.userModel.isCurrentUser
if let url = URL(string: self.userModel.avatar) { if let url = URL(string: self.userModel.avatar) {
self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default")) self.headImgV.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
} }
...@@ -27,33 +32,45 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -27,33 +32,45 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
self.cityLabel.frame = CGRectMake(0, 0, cityWidth+8, 20) self.cityLabel.frame = CGRectMake(0, 0, cityWidth+8, 20)
self.zodiacLabel.text = self.userModel.zodiac self.zodiacLabel.text = self.userModel.zodiac
if self.userModel.address.city.isEmpty && self.userModel.zodiac.isEmpty { var name:ASAttributedString = .init(string:self.userModel.username, .font(UIFont.PFSC_B(ofSize: 18)), .foreground(UIColor.mainTextColor))
self.nameTextView.attributed.text = """ let cityTag: ASAttributedString = " \(.view(self.cityLabel, .original(.center)))"
\(self.userModel.username, .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_B(ofSize:18))) let zodiacTag: ASAttributedString = " \(.view(self.zodiacLabel, .original(.center)))"
"""
} else if self.userModel.zodiac.isEmpty { if !self.userModel.address.city.isEmpty {
self.nameTextView.attributed.text = """ name += cityTag
\(self.userModel.username, .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_B(ofSize:18))) \(.view(self.cityLabel, .original(.center))) }
""" if !self.userModel.zodiac.isEmpty {
} else if self.userModel.address.city.isEmpty { name += zodiacTag
self.nameTextView.attributed.text = """ }
\(self.userModel.username, .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_B(ofSize:18))) \(.view(self.zodiacLabel, .original(.center))) self.nameTextView.attributed.text = name
"""
if !self.userModel.position.isEmpty {
self.professionalLabel.text = self.userModel.position
} else {
self.professionalLabel.text = ""
if self.userModel.isCurrentUser {
self.professionalLabel.textColor = UIColor.mainTextColor30
self.professionalLabel.text = "填写职位 | 填写所属行业"
}
}
if !self.userModel.signature.isEmpty {
self.detailLabel.text = self.userModel.signature
} else { } else {
self.nameTextView.attributed.text = """ self.detailLabel.text = ""
\(self.userModel.username, .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_B(ofSize:18))) \(.view(self.cityLabel, .original(.center))) \(.view(self.zodiacLabel, .original(.center))) if self.userModel.isCurrentUser {
""" self.detailLabel.textColor = UIColor.mainTextColor30
self.detailLabel.text = "填写个性签名,展现真我风采,彰显独特身份"
}
} }
self.professionalLabel.text = self.userModel.position
self.detailLabel.text = self.userModel.signature
self.signImgV.isHidden = !self.userModel.isSigned self.signImgV.isHidden = !self.userModel.isSigned
} }
} }
lazy var headImgV:UIImageView = { lazy var headImgV:UIImageView = {
let view = UIImageView() let view = UIImageView()
view.image = UIImage(named: "") view.image = UIImage(named: "people_head_default")
view.layer.cornerRadius = 74.0/2.0 view.layer.cornerRadius = 74.0/2.0
view.clipsToBounds = true view.clipsToBounds = true
return view return view
...@@ -67,16 +84,16 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -67,16 +84,16 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
lazy var cardView: UIView = { lazy var cardView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .white
let bgImgView = UIImageView(image: UIImage(named: "people_add_friend_bg"))
view.addSubview(bgImgView)
bgImgView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
view.layer.cornerRadius = 3.0 view.layer.cornerRadius = 3.0
view.backgroundColor = .white
return view return view
}() }()
lazy var bgImgV:UIImageView = {
let bgImgView = UIImageView(image: UIImage(named: "people_add_friend_bg"))
return bgImgView
}()
lazy var editBtn:UIButton = { lazy var editBtn:UIButton = {
let btn = UIButton() let btn = UIButton()
btn.setImage(UIImage(named: "people_card_edit"), for: .normal) btn.setImage(UIImage(named: "people_card_edit"), for: .normal)
...@@ -152,21 +169,25 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -152,21 +169,25 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
self.backgroundColor = .clear self.backgroundColor = .clear
self.contentView.backgroundColor = .clear self.contentView.backgroundColor = .clear
// self.contentView.addSubview(self.bgImgV)
self.contentView.addSubview(self.cardView) self.contentView.addSubview(self.cardView)
self.contentView.addSubview(self.headImgV) self.contentView.addSubview(self.headImgV)
self.contentView.addSubview(self.signImgV) self.contentView.addSubview(self.signImgV)
cardView.addSubview(self.nameTextView) cardView.addSubview(self.nameTextView)
cardView.addSubview(self.cityLabel)
cardView.addSubview(self.professionalLabel) cardView.addSubview(self.professionalLabel)
cardView.addSubview(self.detailLabel) cardView.addSubview(self.detailLabel)
cardView.addSubview(self.editBtn) cardView.addSubview(self.editBtn)
self.cardView.snp.makeConstraints { make in self.cardView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview() make.left.right.bottom.equalToSuperview()
make.top.equalTo(self.headImgV.snp.centerY) make.top.equalTo(headWidth/2.0)
} }
// self.bgImgV.snp.makeConstraints { make in
// make.edges.equalTo(self.cardView)
// }
self.editBtn.snp.makeConstraints { make in self.editBtn.snp.makeConstraints { make in
make.width.height.equalTo(20) make.width.height.equalTo(20)
make.right.equalTo(-16) make.right.equalTo(-16)
...@@ -188,13 +209,14 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -188,13 +209,14 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
self.nameTextView.snp.makeConstraints { make in self.nameTextView.snp.makeConstraints { make in
make.left.equalTo(16) make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(headWidth/2.0+10.0) make.top.equalTo(headWidth/2.0+10.0)
} }
self.professionalLabel.snp.makeConstraints { make in self.professionalLabel.snp.makeConstraints { make in
make.left.equalTo(16) make.left.equalTo(16)
make.right.equalTo(-16) make.right.equalTo(-16)
make.height.equalTo(20) // make.height.equalTo(20)
make.top.equalTo(self.nameTextView.snp.bottom).offset(8) make.top.equalTo(self.nameTextView.snp.bottom).offset(8)
} }
...@@ -202,7 +224,7 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -202,7 +224,7 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
make.left.equalTo(16) make.left.equalTo(16)
make.right.equalTo(-16) make.right.equalTo(-16)
make.top.equalTo(self.professionalLabel.snp.bottom).offset(8) make.top.equalTo(self.professionalLabel.snp.bottom).offset(8)
make.height.equalTo(18) // make.height.equalTo(18)
make.bottom.equalTo(-16) make.bottom.equalTo(-16)
} }
......
...@@ -23,6 +23,7 @@ class YHExperienceItemView: UIView { ...@@ -23,6 +23,7 @@ class YHExperienceItemView: UIView {
label.textColor = UIColor.mainTextColor70 label.textColor = UIColor.mainTextColor70
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14) label.font = UIFont.PFSC_R(ofSize:14)
label.text = "填写最近一份工作经验"
return label return label
}() }()
...@@ -59,27 +60,48 @@ class YHMyWorkExperienceCell: UITableViewCell { ...@@ -59,27 +60,48 @@ class YHMyWorkExperienceCell: UITableViewCell {
var userModel:YHUserNameCardInfo = YHUserNameCardInfo() { var userModel:YHUserNameCardInfo = YHUserNameCardInfo() {
didSet { didSet {
self.companyView.detailLabel.text = self.userModel.companyName
self.professionView.detailLabel.text = self.userModel.position
self.industryView.detailLabel.text = self.userModel.industry
self.companyView.isHidden = self.userModel.companyName.isEmpty self.editBtn.isHidden = !self.userModel.isCurrentUser
self.professionView.isHidden = self.userModel.position.isEmpty
self.industryView.isHidden = self.userModel.industry.isEmpty
let companyHeight = self.userModel.companyName.isEmpty ? 0.0 : 20 self.companyView.detailLabel.textColor = UIColor.mainTextColor70
self.companyView.snp.updateConstraints { make in self.professionView.detailLabel.textColor = UIColor.mainTextColor70
make.height.equalTo(companyHeight) self.industryView.detailLabel.textColor = UIColor.mainTextColor70
if !self.userModel.companyName.isEmpty {
self.companyView.detailLabel.text = self.userModel.companyName
} else {
self.companyView.detailLabel.text = ""
if self.userModel.isCurrentUser {
self.companyView.detailLabel.textColor = UIColor.mainTextColor30
self.companyView.detailLabel.text = "请填写最近一份工作经历"
}
}
if !self.userModel.position.isEmpty {
self.professionView.detailLabel.text = self.userModel.position
} else {
self.professionView.detailLabel.text = ""
if self.userModel.isCurrentUser {
self.professionView.detailLabel.textColor = UIColor.mainTextColor30
self.professionView.detailLabel.text = "请填写最近一份工作经历"
}
} }
let positionHeight = self.userModel.position.isEmpty ? 0.0 : 20 if !self.userModel.industry.isEmpty {
self.professionView.snp.updateConstraints { make in self.industryView.detailLabel.text = self.userModel.industry
make.height.equalTo(positionHeight) } else {
self.industryView.detailLabel.text = ""
if self.userModel.isCurrentUser {
self.industryView.detailLabel.textColor = UIColor.mainTextColor30
self.industryView.detailLabel.text = "请填写最近一份工作经历"
}
} }
let industryHeight = self.userModel.industry.isEmpty ? 0.0 : 20 if self.userModel.isCurrentUser {
self.industryView.snp.updateConstraints { make in self.hiddenBtn.isHidden = (self.userModel.authorization.workExperience == 1)
make.height.equalTo(industryHeight)
} else {
self.hiddenBtn.isHidden = true
} }
} }
} }
...@@ -109,6 +131,21 @@ class YHMyWorkExperienceCell: UITableViewCell { ...@@ -109,6 +131,21 @@ class YHMyWorkExperienceCell: UITableViewCell {
return btn return btn
}() }()
lazy var hiddenBtn:UIButton = {
let btn = UIButton()
btn.isHidden = true
btn.backgroundColor = UIColor.init(hex: 0xF4F6FA)
btn.layer.cornerRadius = 3.0
btn.setImage(UIImage(named: "people_card_hidden"), for: .normal)
btn.setTitle("已隐藏", for: .normal)
btn.setTitleColor(UIColor.mainTextColor50, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize:10)
btn.titleEdgeInsets = UIEdgeInsets(top: 0, left: -11, bottom: 0, right: 11)
btn.imageEdgeInsets = UIEdgeInsets(top: 0, left: 31, bottom: 0, right: -31)
return btn
}()
lazy var companyView:YHExperienceItemView = { lazy var companyView:YHExperienceItemView = {
let view = YHExperienceItemView() let view = YHExperienceItemView()
view.titleLabel.text = "所在企业" view.titleLabel.text = "所在企业"
...@@ -144,6 +181,7 @@ class YHMyWorkExperienceCell: UITableViewCell { ...@@ -144,6 +181,7 @@ class YHMyWorkExperienceCell: UITableViewCell {
self.contentView.addSubview(self.cardView) self.contentView.addSubview(self.cardView)
cardView.addSubview(self.titleLabel) cardView.addSubview(self.titleLabel)
cardView.addSubview(self.hiddenBtn)
cardView.addSubview(self.editBtn) cardView.addSubview(self.editBtn)
cardView.addSubview(self.companyView) cardView.addSubview(self.companyView)
cardView.addSubview(self.professionView) cardView.addSubview(self.professionView)
...@@ -165,6 +203,14 @@ class YHMyWorkExperienceCell: UITableViewCell { ...@@ -165,6 +203,14 @@ class YHMyWorkExperienceCell: UITableViewCell {
make.centerY.equalTo(titleLabel) make.centerY.equalTo(titleLabel)
} }
hiddenBtn.snp.makeConstraints { make in
make.width.equalTo(50)
make.height.equalTo(18)
make.centerY.equalTo(self.titleLabel)
make.left.equalTo(self.titleLabel.snp.right).offset(8)
make.right.lessThanOrEqualTo(self.editBtn.snp.left).offset(-15)
}
companyView.snp.makeConstraints { make in companyView.snp.makeConstraints { make in
make.left.equalTo(16) make.left.equalTo(16)
make.right.equalTo(-16) make.right.equalTo(-16)
......
...@@ -204,4 +204,38 @@ class YHInformationAuthorizeViewModel: YHBaseViewModel { ...@@ -204,4 +204,38 @@ class YHInformationAuthorizeViewModel: YHBaseViewModel {
callBackBlock(false, err) callBackBlock(false, err)
} }
} }
func requestInformationToCardSubmit(agress: Int, callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String: Any] = ["information_to_card": agress,
"isclick_card": 2]
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)
}
}
func requestBusinessCardAuthorize(callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.businessCardAuthorize
let _ = YHNetRequest.postRequest(url: strUrl) { [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)
}
}
} }
...@@ -73,7 +73,10 @@ class YHAllowUseMyInfoViewController: YHBaseViewController { ...@@ -73,7 +73,10 @@ class YHAllowUseMyInfoViewController: YHBaseViewController {
} }
viewModel.requestAuthorizationSubmit(agress: open) {[weak self] success, error in viewModel.requestAuthorizationSubmit(agress: open) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.dismiss(animated: true) viewModel.requestBusinessCardAuthorize {[weak self] success, error in
guard let self = self else { return }
self.dismiss(animated: true)
}
} }
} }
} }
......
...@@ -10,6 +10,7 @@ import UIKit ...@@ -10,6 +10,7 @@ import UIKit
import SmartCodable import SmartCodable
struct YHUserModel: SmartCodable { struct YHUserModel: SmartCodable {
var id:String = ""
var userid: Int? var userid: Int?
var nickname: String? var nickname: String?
var mobile: String? var mobile: String?
......
...@@ -67,4 +67,20 @@ class YHUserInfoSettingViewModel: YHBaseViewModel { ...@@ -67,4 +67,20 @@ class YHUserInfoSettingViewModel: YHBaseViewModel {
callBackBlock(false, err) callBackBlock(false, err)
} }
} }
func requestBusinessCardAuthorize(callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.businessCardAuthorize
let _ = YHNetRequest.postRequest(url: strUrl) { [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)
}
}
} }
...@@ -288,8 +288,8 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { ...@@ -288,8 +288,8 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
switch item.type { switch item.type {
case .myCard://我的名片 case .myCard://我的名片
let vc = YHMyNameCardViewController() let vc = YHMyNameCardViewController()
if let userId = YHLoginManager.shared.userModel?.userid { if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty {
vc.userId = "\(userId)" vc.userId = userId
} }
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
case .myMessage://我的消息 case .myMessage://我的消息
......
...@@ -28,6 +28,9 @@ class YHEditBaseUserInfoViewController: YHBaseViewController { ...@@ -28,6 +28,9 @@ class YHEditBaseUserInfoViewController: YHBaseViewController {
func getData() { func getData() {
viewModel.model = model viewModel.model = model
items = viewModel.getBaseDataSource() items = viewModel.getBaseDataSource()
let url = URL(string: self.viewModel.model.avatar)
photoImageView.kf.setImage(with: url)
footView.dataSource = self.viewModel.model.signature
tableView.reloadData() tableView.reloadData()
} }
......
...@@ -24,7 +24,12 @@ class YHEditHonorViewController: YHBaseViewController { ...@@ -24,7 +24,12 @@ class YHEditHonorViewController: YHBaseViewController {
func getData() { func getData() {
viewModel.model = model viewModel.model = model
messageTextField.text = model.honor
if messageTextField.text.count != 0 {
promptsLabel.isHidden = true
} else {
promptsLabel.isHidden = false
}
} }
func setView() { func setView() {
......
...@@ -390,6 +390,5 @@ class YHEditInterestViewCell: UICollectionViewCell { ...@@ -390,6 +390,5 @@ class YHEditInterestViewCell: UICollectionViewCell {
deleteButton.isHidden = false deleteButton.isHidden = false
} }
} }
} }
} }
...@@ -24,7 +24,12 @@ class YHEditPersonalProfileViewController: YHBaseViewController { ...@@ -24,7 +24,12 @@ class YHEditPersonalProfileViewController: YHBaseViewController {
func getData() { func getData() {
viewModel.model = model viewModel.model = model
messageTextField.text = model.bio
if messageTextField.text.count != 0 {
promptsLabel.isHidden = true
} else {
promptsLabel.isHidden = false
}
} }
func setView() { func setView() {
......
...@@ -338,6 +338,7 @@ class YHAllApiName { ...@@ -338,6 +338,7 @@ class YHAllApiName {
static let userInfo = "super-app/user-base/info" static let userInfo = "super-app/user-base/info"
static let userAuthorization = "super-app/user/authorization" static let userAuthorization = "super-app/user/authorization"
static let cardSave = "super-app/business-card/save" static let cardSave = "super-app/business-card/save"
static let businessCardAuthorize = "super-app/business-card/authorize"
} }
} }
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