Commit a408d40d 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:
  文案修改
  去除无用代码
  //  卡片使用指引显示
  修改登录之后的逻辑
  //  城市显示
  //  我的名片
  签约之后再注册信息逻辑添加
  修复一些细节和bug
  //  我的名片
  细节修改
  //  动画优化
parents 9fcc3aa0 bb5420c5
......@@ -71,7 +71,7 @@ class YHInformationAuthorizationStepTwoViewController: UIViewController {
button.backgroundColor = UIColor.brandMainColor
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center
button.setTitle("下一步", for: .normal)
button.setTitle("完成", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius3
button.addTarget(self, action: #selector(nextStep), for: .touchUpInside)
......@@ -110,6 +110,7 @@ class YHInformationAuthorizationStepTwoViewController: UIViewController {
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.equalTo(view)
}
nextButton.setTitle("保存", for: .normal)
}
}
......
......@@ -284,17 +284,12 @@ class YHMatchResultListViewController: YHBaseViewController {
func animaiton() {
if self.matchUsersArr.count <= 0 {
return
}
let view3 = YHNameCardInfoView.createCardView()
view3.backgroundColor = UIColor.init(hex: 0xC4CEE3)
view3.y = -YHNameCardInfoView.height
view3.x = 36+10
view3.width = YHNameCardInfoView.width-5*4
view3.isHidden = self.matchUsersArr.count >= 3
view3.isHidden = self.matchUsersArr.count < 3
if self.matchUsersArr.count >= 3 {
if let user = self.matchUsersArr[2] {
view3.userModel = user
......@@ -307,7 +302,7 @@ class YHMatchResultListViewController: YHBaseViewController {
view2.y = -YHNameCardInfoView.height
view2.x = 36+5
view2.width = YHNameCardInfoView.width-5*2
view2.isHidden = self.matchUsersArr.count >= 2
view2.isHidden = self.matchUsersArr.count < 2
self.view.addSubview(view2)
if self.matchUsersArr.count >= 2 {
if let user = self.matchUsersArr[1] {
......@@ -318,6 +313,7 @@ class YHMatchResultListViewController: YHBaseViewController {
let view1 = YHNameCardInfoView.createCardView()
view1.y = -YHNameCardInfoView.height
view1.x = 36
view1.width = YHNameCardInfoView.width
self.view.addSubview(view1)
if self.matchUsersArr.count >= 0 {
if let user = self.matchUsersArr[0] {
......@@ -325,21 +321,43 @@ class YHMatchResultListViewController: YHBaseViewController {
}
}
UIView.animate(withDuration: 0.5, delay: 0, options: [.curveEaseInOut]) {
var delay1Time = 0.2
if self.matchUsersArr.count >= 3 {
delay1Time = 0.2
} else if self.matchUsersArr.count >= 2 {
delay1Time = 0.1
} else if self.matchUsersArr.count >= 1 {
delay1Time = 0.0
}
let delay2Time = delay1Time-0.1 >= 0.0 ? delay1Time-0.1 : 0.0
let delay3Time = delay2Time-0.1 >= 0.0 ? delay2Time-0.1 : 0.0
UIView.animate(withDuration: 0.5, delay: delay3Time, options: [.curveEaseInOut]) {
view3.y = 102+k_Height_NavigationtBarAndStatuBar+5*2
} completion: { finish in }
UIView.animate(withDuration: 0.5, delay: 0.1, options: [.curveEaseInOut]) {
UIView.animate(withDuration: 0.5, delay: delay2Time, options: [.curveEaseInOut]) {
view2.y = 102+k_Height_NavigationtBarAndStatuBar+5
} completion: { finish in }
UIView.animate(withDuration: 0.5, delay: 0.1, options: [.curveEaseInOut]) {
UIView.animate(withDuration: 0.5, delay: delay1Time, options: [.curveEaseInOut]) {
view1.y = 102+k_Height_NavigationtBarAndStatuBar
} completion: {
[weak self] finish in
guard let self = self else { return }
self.cardContainer.isHidden = false
let showCardGuideKey = "kHasShowCardGuide"
if let hasShowCardGuide = UserDefaults.standard.object(forKey: showCardGuideKey) as? Bool, hasShowCardGuide == true {
self.guideView.isHidden = true
} else { // 第一次展示卡片使用指引
UserDefaults.standard.set(true, forKey: showCardGuideKey)
UserDefaults.standard.synchronize()
self.guideView.isHidden = false
self.view.bringSubviewToFront(self.guideView)
}
view1.removeFromSuperview()
view2.removeFromSuperview()
view3.removeFromSuperview()
......
......@@ -84,14 +84,17 @@ class YHMatchUserViewController: YHBaseViewController {
self.headLottieView.isHidden = true
self.launchLottieView.isHidden = true
self.rotateLottieView.isHidden = true
self.bottomBtn.setTitle("开启AI人脉雷达", for: .normal)
} else {
self.firstImageView.isHidden = true
self.bottomLabel.isHidden = true
self.headLottieView.isHidden = false
self.launchLottieView.isHidden = false
self.rotateLottieView.isHidden = true
self.bottomBtn.setTitle("AI人脉雷达匹配", for: .normal)
}
}
viewModel.requestUserAuthorization { success, error in }
}
func createUI() {
......@@ -169,8 +172,19 @@ class YHMatchUserViewController: YHBaseViewController {
YHOneKeyLoginManager.shared.oneKeyLogin()
return
}
if informationAuthorizeViewModel.model.is_fillin == 1 {
if viewModel.setModel.authorization_basic_information == 2 {
startMatchUsers()
} else {
YHCommonAlertView.show("", "您暂未开启AI人脉匹配授权", "取消", "去开启") {
} callBack: {
let vc = YHInformationAuthorizationStepTwoViewController()
vc.stepFlag = false
self.navigationController?.pushViewController(vc)
}
}
} else {
let vc = YHInformationAuthorizationStepOneViewController()
self.navigationController?.pushViewController(vc)
......
......@@ -234,7 +234,7 @@ extension YHNameCardViewController {
func requestAuthorization() {
self.authorModel.requestUserAuthorization { success, error in
if self.authorModel.setModel.isclick_card != 2 {
if self.authorModel.setModel.isclick_card != 2 && self.authorModel.setModel.information_to_card != 2 {
YHCommonAlertView.show("", "授权信息同步至您的名片并对您的好友可见", "取消", "确认",fullGuestureEnable: false) {
self.authorModel.requestInformationToCardSubmit(agress: 1) { success, error in
self.requestNameCardInfo()
......@@ -266,22 +266,27 @@ extension YHNameCardViewController {
self.cardInfoArr.append(model1)
// 个人简介信息
var isShowIntroduce = true
if !self.isCurrentUser {
isShowIntroduce = !self.viewModel.nameCardInfo.bio.isEmpty
}
if isShowIntroduce {
let model2 = YHUserNameCardInfo()
model2.type = .introduce
model2.isCurrentUser = self.isCurrentUser
model2.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model2)
}
// 教育经历信息
var isShowEducation = true
if !self.isCurrentUser {
if !self.viewModel.nameCardInfo.isHiddenEducation {
let model3 = YHUserNameCardInfo()
model3.type = .education
model3.isCurrentUser = self.isCurrentUser
model3.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model3)
isShowEducation = !self.viewModel.nameCardInfo.isHiddenEducation
if isShowEducation {
isShowEducation = (!self.viewModel.nameCardInfo.college.isEmpty || !self.viewModel.nameCardInfo.background.isEmpty || !self.viewModel.nameCardInfo.major.isEmpty)
}
} else {
}
if isShowEducation {
let model3 = YHUserNameCardInfo()
model3.type = .education
model3.isCurrentUser = self.isCurrentUser
......@@ -289,17 +294,15 @@ extension YHNameCardViewController {
self.cardInfoArr.append(model3)
}
// 工作经历信息
var isShowWorkExperience = true
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)
isShowWorkExperience = !self.viewModel.nameCardInfo.isHiddenWorkExperience
if isShowWorkExperience {
isShowWorkExperience = (!self.viewModel.nameCardInfo.companyName.isEmpty || !self.viewModel.nameCardInfo.position.isEmpty || !self.viewModel.nameCardInfo.industry.isEmpty)
}
} else {
}
if isShowWorkExperience {
let model4 = YHUserNameCardInfo()
model4.type = .workExperience
model4.isCurrentUser = self.isCurrentUser
......@@ -308,18 +311,30 @@ extension YHNameCardViewController {
}
// 荣誉奖项信息
var isShowHonor = true
if !self.isCurrentUser {
isShowHonor = !self.viewModel.nameCardInfo.honor.isEmpty
}
if isShowHonor {
let model5 = YHUserNameCardInfo()
model5.type = .honor
model5.isCurrentUser = self.isCurrentUser
model5.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model5)
}
// 兴趣话题
var isShowTopics = true
if !self.isCurrentUser {
isShowTopics = self.viewModel.nameCardInfo.topics.count > 0
}
if isShowTopics {
let model6 = YHUserNameCardInfo()
model6.type = .topics
model6.isCurrentUser = self.isCurrentUser
model6.updateModel(self.viewModel.nameCardInfo)
self.cardInfoArr.append(model6)
}
self.tableView.reloadData()
......
......@@ -28,10 +28,18 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
self.headImgV.image = UIImage(named: "people_head_default")
}
let city = self.userModel.address.city
self.cityLabel.text = city
let cityWidth = self.getWith(font: self.cityLabel.font, height: 20, string: city)
var cityStr = self.userModel.address.city
var specialArea = ["北京市", "上海市", "天津市", "重庆市", "香港", "澳门", "台湾"]
for provinceName in specialArea {
if self.userModel.address.province.contains(provinceName) {
cityStr = self.userModel.address.province
break
}
}
self.cityLabel.text = cityStr
let cityWidth = self.getWith(font: self.cityLabel.font, height: 20, string: cityStr)
self.cityLabel.frame = CGRectMake(0, 0, cityWidth+8, 20)
self.zodiacLabel.text = self.userModel.zodiac
self.signImgV.isHidden = !self.userModel.isSigned
......@@ -39,7 +47,7 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
let cityTag: ASAttributedString = " \(.view(self.cityLabel, .original(.center)))"
let zodiacTag: ASAttributedString = " \(.view(self.zodiacLabel, .original(.center)))"
if !self.userModel.address.city.isEmpty {
if !cityStr.isEmpty {
name += cityTag
}
if !self.userModel.zodiac.isEmpty {
......@@ -106,6 +114,7 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
let view = UIView()
view.layer.cornerRadius = 3.0
view.backgroundColor = .white
view.clipsToBounds = true
return view
}()
......@@ -189,12 +198,12 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
// self.contentView.addSubview(self.bgImgV)
self.contentView.addSubview(self.cardView)
self.contentView.addSubview(self.headBgImgV)
self.contentView.addSubview(self.headImgV)
self.contentView.addSubview(self.signImgV)
cardView.addSubview(self.bgImgV)
cardView.addSubview(self.nameTextView)
cardView.addSubview(self.professionalLabel)
cardView.addSubview(self.detailLabel)
......@@ -205,9 +214,10 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
make.top.equalTo(headWidth/2.0)
}
// self.bgImgV.snp.makeConstraints { make in
// make.edges.equalTo(self.cardView)
// }
self.bgImgV.snp.makeConstraints { make in
make.left.right.right.equalToSuperview()
make.height.equalTo(160)
}
self.editBtn.snp.makeConstraints { make in
make.width.height.equalTo(20)
......
......@@ -23,32 +23,36 @@ class YHNameCardInfoView: DragCardView {
self.headImgV.image = UIImage(named: "people_head_default")
}
self.nameLabel.text = self.userModel.username
var result = ""
var isFirst = true
if !self.userModel.address.city.isEmpty {
if isFirst {
result += self.userModel.address.city
isFirst = false
var resultArr:[String] = []
// 城市文字
var cityStr = self.userModel.address.city
var specialArea = ["北京市", "上海市", "天津市", "重庆市", "香港", "澳门", "台湾"]
for provinceName in specialArea {
if self.userModel.address.province.contains(provinceName) {
cityStr = self.userModel.address.province
break
}
}
if !self.userModel.position.isEmpty {
if isFirst {
result += self.userModel.position
isFirst = false
} else {
result += " | " + self.userModel.position
if !cityStr.isEmpty {
resultArr.append(cityStr)
}
// 职位
if !self.userModel.position.isEmpty {
resultArr.append(self.userModel.position)
}
// 行业
if !self.userModel.industry.isEmpty {
if isFirst {
result += self.userModel.industry
isFirst = false
} else {
result += " | " + self.userModel.industry
resultArr.append(self.userModel.industry)
}
var resultStr = ""
if resultArr.count > 0 {
resultStr = resultArr.joined(separator: " | ")
}
self.professionalLabel.text = result
self.professionalLabel.text = resultStr
let detail = self.userModel.signature
self.detailLabel.text = detail
self.grayContentView.isHidden = detail.isEmpty
......@@ -98,8 +102,6 @@ class YHNameCardInfoView: DragCardView {
return view
}()
lazy var signImgV:UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "people_sign")
......
......@@ -13,6 +13,7 @@ class YHMatchUserViewModel: NSObject {
var matchUserArr:[YHMatchUserInfo?] = []
var nameCardInfo: YHUserNameCardInfo = YHUserNameCardInfo()
var friendListModel:YHFriendListModel = YHFriendListModel()
var setModel: YHMainUserInformationSetModel = YHMainUserInformationSetModel()
func getMatchUserlist(_ callBack: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
let params = ["page_size" : 20]
......@@ -151,5 +152,26 @@ class YHMatchUserViewModel: NSObject {
}
}
func requestUserAuthorization(callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.userAuthorization
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 = YHMainUserInformationSetModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false,nil)
return
}
self.setModel = result
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
}
......@@ -169,12 +169,12 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager.shared.loginSuccessActionBlock?()
YHHUD.flash(message: "登录成功")
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
self.dismiss(animated: true) {
if YHLoginManager.shared.userModel?.is_first_login == 1 {
let vc = UINavigationController(rootVC: YHUserInfoSettingViewController())
let vc = YHUserInfoSettingViewController()
vc.modalPresentationStyle = .fullScreen
UIViewController.current?.present(vc, animated: true)
}
self.navigationController?.pushViewController(vc)
} else {
self.dismiss(animated: true)
}
}
})
......@@ -190,12 +190,12 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager.shared.loginSuccessActionBlock?()
YHHUD.flash(message: "登录成功")
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
self.dismiss(animated: true) {
if YHLoginManager.shared.userModel?.is_first_login == 1 {
let vc = UINavigationController(rootVC: YHUserInfoSettingViewController())
let vc = YHUserInfoSettingViewController()
vc.modalPresentationStyle = .fullScreen
UIViewController.current?.present(vc, animated: true)
}
self.navigationController?.pushViewController(vc)
} else {
self.dismiss(animated: true)
}
}
})
......@@ -217,12 +217,12 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager.shared.loginSuccessActionBlock?()
YHHUD.flash(message: "登录成功")
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
self?.dismiss(animated: true) {
if YHLoginManager.shared.userModel?.is_first_login == 1 {
let vc = UINavigationController(rootVC: YHUserInfoSettingViewController())
let vc = YHUserInfoSettingViewController()
vc.modalPresentationStyle = .fullScreen
UIViewController.current?.present(vc, animated: true)
}
self?.navigationController?.pushViewController(vc)
} else {
self?.dismiss(animated: true)
}
}
}
......
......@@ -18,15 +18,36 @@ class YHUserInfoSettingViewController: YHBaseViewController {
var viewModel: YHUserInfoSettingViewModel = YHUserInfoSettingViewModel()
var headUrl: String = ""
var name: String = ""
let userViewModel = YHInformationAuthorizeViewModel()
override func viewDidLoad() {
super.viewDidLoad()
setView()
changeHead()
getData()
}
func getData() {
userViewModel.requestUserInfo {[weak self] success, error in
guard let self = self else { return }
let url = URL(string: self.userViewModel.model.avatar)
self.photoImageView.kf.setImage(with: url)
self.nameTextField.text = self.userViewModel.model.username
if self.nameTextField.text?.count != 0 {
self.nextButton.isEnabled = true
self.nextButton.backgroundColor = UIColor.brandMainColor
} else {
self.nextButton.isEnabled = false
self.nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
}
}
}
func setView() {
gk_navTitle = "设置"
gk_navLeftBarButtonItems = []
let target = self.navigationController?.interactivePopGestureRecognizer?.delegate
let pan = UIPanGestureRecognizer(target: target, action: nil)
self.view.addGestureRecognizer(pan)
view.backgroundColor = .white
photoImageView = {
let imageView = UIImageView()
......@@ -88,6 +109,7 @@ class YHUserInfoSettingViewController: YHBaseViewController {
nameTextField = {
let textField = UITextField()
textField.delegate = self
textField.textColor = UIColor.mainTextColor
textField.font = UIFont.PFSC_M(ofSize: 15)
textField.adjustsFontSizeToFitWidth = true
......@@ -106,13 +128,15 @@ class YHUserInfoSettingViewController: YHBaseViewController {
nextButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandMainColor
// button.backgroundColor = UIColor.brandMainColor
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center
button.setTitle("下一步", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius3
button.addTarget(self, action: #selector(nextStep), for: .touchUpInside)
button.isEnabled = false
button.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
return button
}()
view.addSubview(nextButton)
......@@ -164,3 +188,26 @@ class YHUserInfoSettingViewController: YHBaseViewController {
}
}
}
extension YHUserInfoSettingViewController: UITextFieldDelegate {
func textFieldDidEndEditing(_ textField: UITextField) {
}
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if newText.count > 0 {
nextButton.isEnabled = true
nextButton.backgroundColor = UIColor.brandMainColor
} else {
nextButton.isEnabled = false
nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
}
if newText.count > 20 {
return false
}
return true
}
}
......@@ -100,7 +100,7 @@ extension YHEditSchoolViewController: UITableViewDelegate, UITableViewDataSource
cell.block = { [weak self] model in
guard let self = self else { return }
self.viewModel.updateModel(model)
if model.id != .id8 {
if model.id != .id8 && model.id != .id3 {
self.getData()
}
if self.viewModel.isCanNext(step: 3) {
......
......@@ -100,7 +100,7 @@ extension YHEditWorkViewController: UITableViewDelegate, UITableViewDataSource {
cell.block = { [weak self] model in
guard let self = self else { return }
self.viewModel.updateModel(model)
if model.id != .id5 || model.id != .id10 {
if model.id != .id5 && model.id != .id10 {
self.getData()
}
if self.viewModel.isCanNext(step: 4) {
......
......@@ -80,7 +80,7 @@ class YHEditViewModel: YHBaseViewModel {
}
func getBaseSchoolDataSource() -> [YHUserInformationModel] {
let item1 = YHUserInformationModel(id: .id3, title: "毕业院校", isUserKeyBoard: false, prompts: "请输入您的毕业院校", message: model.college, type: .school)
let item1 = YHUserInformationModel(id: .id3, title: "毕业院校", isUserKeyBoard: true, prompts: "请输入您的毕业院校", message: model.college)
let item2 = YHUserInformationModel(id: .id8, title: "专业", isUserKeyBoard: true, prompts: "请输入您的专业", message: model.major)
let item3 = YHUserInformationModel(id: .id9, title: "学位", isUserKeyBoard: false, prompts: "请选择您的学位", message: model.background, type: .degree)
......
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "my_card_lead@2x.png",
"filename" : "我的-名片指引@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "my_card_lead@3x.png",
"filename" : "我的-名片指引@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
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