Commit 1385866d authored by pete谢兆麟's avatar pete谢兆麟

用户资料权限UI

parent e65f4255
......@@ -55,6 +55,11 @@
044D0BF62C2154CA00C5CF5E /* YHAllowUseMyInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044D0BF52C2154CA00C5CF5E /* YHAllowUseMyInfoViewController.swift */; };
044D0BF82C21572B00C5CF5E /* YHAllowSettingTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044D0BF72C21572B00C5CF5E /* YHAllowSettingTableViewCell.swift */; };
044D0BFA2C215C6F00C5CF5E /* YHSettingItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044D0BF92C215C6F00C5CF5E /* YHSettingItem.swift */; };
044D0BFC2C21635B00C5CF5E /* YHInformationAuthorizationStepOneViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044D0BFB2C21635B00C5CF5E /* YHInformationAuthorizationStepOneViewController.swift */; };
044D0BFE2C21649A00C5CF5E /* YHUserInformationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044D0BFD2C21649A00C5CF5E /* YHUserInformationModel.swift */; };
044D0C002C21663300C5CF5E /* YHMyInformationItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044D0BFF2C21663300C5CF5E /* YHMyInformationItemCell.swift */; };
044D0C022C216AAF00C5CF5E /* YHInformationAuthorizeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044D0C012C216AAF00C5CF5E /* YHInformationAuthorizeViewModel.swift */; };
044D0C042C2180B700C5CF5E /* YHInformationAuthorizationStepTwoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044D0C032C2180B700C5CF5E /* YHInformationAuthorizationStepTwoViewController.swift */; };
045EEE792B9F171A0022A143 /* YHPreviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EED9A2B9F171A0022A143 /* YHPreviewViewModel.swift */; };
045EEE7A2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EED9C2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift */; };
045EEE7B2B9F171A0022A143 /* YHPersonInfoCellModel2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EED9D2B9F171A0022A143 /* YHPersonInfoCellModel2.swift */; };
......@@ -562,6 +567,11 @@
044D0BF52C2154CA00C5CF5E /* YHAllowUseMyInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAllowUseMyInfoViewController.swift; sourceTree = "<group>"; };
044D0BF72C21572B00C5CF5E /* YHAllowSettingTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAllowSettingTableViewCell.swift; sourceTree = "<group>"; };
044D0BF92C215C6F00C5CF5E /* YHSettingItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSettingItem.swift; sourceTree = "<group>"; };
044D0BFB2C21635B00C5CF5E /* YHInformationAuthorizationStepOneViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInformationAuthorizationStepOneViewController.swift; sourceTree = "<group>"; };
044D0BFD2C21649A00C5CF5E /* YHUserInformationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHUserInformationModel.swift; sourceTree = "<group>"; };
044D0BFF2C21663300C5CF5E /* YHMyInformationItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyInformationItemCell.swift; sourceTree = "<group>"; };
044D0C012C216AAF00C5CF5E /* YHInformationAuthorizeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInformationAuthorizeViewModel.swift; sourceTree = "<group>"; };
044D0C032C2180B700C5CF5E /* YHInformationAuthorizationStepTwoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInformationAuthorizationStepTwoViewController.swift; sourceTree = "<group>"; };
045EED9A2B9F171A0022A143 /* YHPreviewViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHPreviewViewModel.swift; sourceTree = "<group>"; };
045EED9C2B9F171A0022A143 /* YHPreviewForOtherInfoModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHPreviewForOtherInfoModel.swift; sourceTree = "<group>"; };
045EED9D2B9F171A0022A143 /* YHPersonInfoCellModel2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHPersonInfoCellModel2.swift; sourceTree = "<group>"; };
......@@ -1154,6 +1164,7 @@
044D0BE92C2019AC00C5CF5E /* VM */ = {
isa = PBXGroup;
children = (
044D0C012C216AAF00C5CF5E /* YHInformationAuthorizeViewModel.swift */,
);
path = VM;
sourceTree = "<group>";
......@@ -1161,6 +1172,7 @@
044D0BEA2C2019AC00C5CF5E /* M */ = {
isa = PBXGroup;
children = (
044D0BFD2C21649A00C5CF5E /* YHUserInformationModel.swift */,
);
path = M;
sourceTree = "<group>";
......@@ -1173,6 +1185,8 @@
044D0BF12C20262100C5CF5E /* YHPeopleViewController.swift */,
04F957462C203033003C631C /* YHMyGoodFriendsVC.swift */,
04FD85652C2124AF00BEF9C5 /* YHMyNameCardViewController.swift */,
044D0BFB2C21635B00C5CF5E /* YHInformationAuthorizationStepOneViewController.swift */,
044D0C032C2180B700C5CF5E /* YHInformationAuthorizationStepTwoViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -2012,6 +2026,7 @@
04FD856D2C215DC900BEF9C5 /* YHMyWorkExperienceCell.swift */,
04FD856F2C21646200BEF9C5 /* YHMyInterestTopicCell.swift */,
04F9574C2C20644E003C631C /* YHFriendsRequestView.swift */,
044D0BFF2C21663300C5CF5E /* YHMyInformationItemCell.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -2888,6 +2903,7 @@
A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */,
A567E5A12BD7643D00D5D5A0 /* YHHKEventViewController.swift in Sources */,
A5ACE9542B4564F7002C94D2 /* YHNavigationController.swift in Sources */,
044D0C002C21663300C5CF5E /* YHMyInformationItemCell.swift in Sources */,
045EEF252B9F171A0022A143 /* YHMainInformationCardTableViewCell.swift in Sources */,
045EEE862B9F171A0022A143 /* YHPreviewWorkExpViewController.swift in Sources */,
045EEED22B9F171A0022A143 /* YHScoreTitleView.swift in Sources */,
......@@ -2922,6 +2938,7 @@
A5EF21352BA6E05E005027E6 /* YHQuestionAndAnswerViewController.swift in Sources */,
A5EF213B2BA6EC98005027E6 /* YHQuestionAndAnswerCell.swift in Sources */,
045EEEA82B9F171A0022A143 /* YHWorkIntroductionViewController.swift in Sources */,
044D0BFC2C21635B00C5CF5E /* YHInformationAuthorizationStepOneViewController.swift in Sources */,
045EEEBF2B9F171A0022A143 /* YHWorkFileItemView.swift in Sources */,
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */,
A520124F2BABCE05008655EA /* YHFileListContentView.swift in Sources */,
......@@ -3183,6 +3200,7 @@
045EEEF22B9F171A0022A143 /* YHChildBasicInfoVC.swift in Sources */,
A567E5A22BD7643D00D5D5A0 /* YHConfigManager.swift in Sources */,
04174D772BCD5B74000BA46D /* YHMessageDetailListVC.swift in Sources */,
044D0BFE2C21649A00C5CF5E /* YHUserInformationModel.swift in Sources */,
A592BFEF2B9AB720004C04A9 /* YHWholeScreenTipsView.swift in Sources */,
045EEEF42B9F171A0022A143 /* YHSpouseBasicInfoVC.swift in Sources */,
A5FD63C32B63438A00D1D9DA /* YHContactMainItemStatusModel.swift in Sources */,
......@@ -3192,6 +3210,7 @@
045EEEF32B9F171A0022A143 /* YHFamilyMemberInfoListVC.swift in Sources */,
0445E6B42BEA15C4003C52F9 /* YHAppVersionManager.swift in Sources */,
04EA230C2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift in Sources */,
044D0C022C216AAF00C5CF5E /* YHInformationAuthorizeViewModel.swift in Sources */,
A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */,
A5DF3D462BF72BA1003D5F03 /* YHTestViewController.swift in Sources */,
A517A4E52BB6C4BB000DEECD /* YHDocumentFileItemView.swift in Sources */,
......@@ -3236,6 +3255,7 @@
A567E5932BD7643D00D5D5A0 /* YHHomePageViewModel.swift in Sources */,
045EEE822B9F171A0022A143 /* YHPersonInfoIdentityCardModel.swift in Sources */,
045EEE952B9F171A0022A143 /* YHPreviewInfoCertificateInformationItemsView.swift in Sources */,
044D0C042C2180B700C5CF5E /* YHInformationAuthorizationStepTwoViewController.swift in Sources */,
044413FD2BC386DA00784A14 /* YHServiceViewController.swift in Sources */,
045EEEBB2B9F171A0022A143 /* YHWorkIntroductionTableViewCell.swift in Sources */,
045EEEED2B9F171A0022A143 /* YHParentInfoVC.swift in Sources */,
......
//
// YHInformationAuthorizationStepOneViewController.swift
// galaxy
//
// Created by EDY on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHInformationAuthorizationStepOneViewController: YHBaseViewController {
var stepOneView: UIView!
var stepTwoView: UIView!
var photoImageView: UIImageView!
var photoButton: UIButton!
var changeButton: UIButton!
var nextButton: UIButton!
var tableView: UITableView!
var promptView: YHFailPromptView!
var items: [YHUserInformationModel] = []
var viewModel: YHInformationAuthorizeViewModel = YHInformationAuthorizeViewModel()
override func viewDidLoad() {
super.viewDidLoad()
setView()
getData()
}
func getData() {
items = viewModel.getBaseDataSource()
tableView.reloadData()
}
func setView() {
gk_navTitle = "设置"
view.backgroundColor = .white
stepOneView = {
let view = UIView()
view.backgroundColor = UIColor.brandMainColor
return view
}()
view.addSubview(stepOneView)
stepOneView.snp.makeConstraints { make in
make.left.equalTo(21)
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 16)
make.height.equalTo(3)
make.right.equalTo(view.snp.centerX).offset(-3)
}
stepTwoView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0xf4f6fa)
return view
}()
view.addSubview(stepTwoView)
stepTwoView.snp.makeConstraints { make in
make.right.equalTo(-21)
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 16)
make.height.equalTo(3)
make.left.equalTo(view.snp.centerX).offset(3)
}
photoImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "user_photo_default")
imageView.contentMode = .scaleAspectFill
imageView.isUserInteractionEnabled = true
imageView.layer.cornerRadius = 46.5
imageView.layer.masksToBounds = true
return imageView
}()
view.addSubview(photoImageView)
photoImageView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 59)
make.height.width.equalTo(93)
}
photoButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "user_take_photo"), for: .normal)
button.addTarget(self, action: #selector(takePhoto), for: .touchUpInside)
return button
}()
view.addSubview(photoButton)
photoButton.snp.makeConstraints { make in
make.bottom.equalTo(photoImageView.snp.bottom)
make.right.equalTo(photoImageView.snp.right)
make.width.height.equalTo(28)
}
changeButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "user_change_photo"), for: .normal)
button.addTarget(self, action: #selector(changeHead), for: .touchUpInside)
return button
}()
view.addSubview(changeButton)
changeButton.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(photoImageView.snp.bottom).offset(20)
make.width.equalTo(68.5)
make.height.equalTo(20)
}
nextButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
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
return button
}()
view.addSubview(nextButton)
nextButton.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-8 - k_Height_safeAreaInsetsBottom())
make.height.equalTo(48)
}
tableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.backgroundColor = .white
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHMyInformationItemCell.self)
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(changeButton.snp.bottom).offset(24)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64 - 36)
make.left.right.equalTo(view)
}
promptView = {
let view = YHFailPromptView()
view.titleLable.text = "温馨提示:请填写真实信息,AI人脉匹配更精准"
view.backgroundColor = UIColor(hex: 0xf0f4fb)
view.titleLable.textColor = UIColor.brandMainColor
view.alertImageView.image = UIImage(named: "user_prompt_image")
return view
}()
view.addSubview(promptView)
promptView.snp.makeConstraints { make in
make.height.equalTo(36)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.equalTo(view)
}
}
@objc func takePhoto() {
view.endEditing(true)
YHImagePickerView.show() {[weak self] image in
guard let self = self else { return }
self.photoImageView.image = image
}
}
@objc func changeHead() {
}
@objc func nextStep() {
let vc = YHInformationAuthorizationStepTwoViewController()
self.navigationController?.pushViewController(vc)
}
}
extension YHInformationAuthorizationStepOneViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHMyInformationItemCell.self)
cell.dataSource = items[indexPath.row]
cell.block = { [weak self] model in
guard let self = self else { return }
self.viewModel.updateModel(model)
if self.viewModel.isCanNext() {
nextButton.isEnabled = true
nextButton.backgroundColor = UIColor.brandMainColor
} else {
nextButton.isEnabled = false
nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
}
if model.id != .id1 && model.id != .id3 && model.id != .id5 {
self.getData()
}
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 61.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 0.01))
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
}
//
// YHInformationAuthorizationStepTwoViewController.swift
// galaxy
//
// Created by EDY on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHInformationAuthorizationStepTwoViewController: UIViewController {
var stepOneView: UIView!
var stepTwoView: UIView!
var nextButton: UIButton!
var tableView: UITableView!
var items: [YHSettingItem] = [YHSettingItem(type: .normal, title: "允许您的信息在名片中使用", subTitle: "开启后,您的信息将自动同步至您的个人名片,并对您的好友公开可见", isSelect: true, isShowAlert: false)]
var viewModel: YHInformationAuthorizeViewModel = YHInformationAuthorizeViewModel()
var stepFlag: Bool = true
override func viewDidLoad() {
super.viewDidLoad()
setView()
getData()
}
func getData() {
items = viewModel.getBaseSetDataSource()
tableView.reloadData()
}
func setView() {
gk_navTitle = "设置"
view.backgroundColor = .white
stepOneView = {
let view = UIView()
view.backgroundColor = UIColor.brandMainColor
return view
}()
view.addSubview(stepOneView)
stepOneView.snp.makeConstraints { make in
make.left.equalTo(21)
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 16)
make.height.equalTo(3)
make.right.equalTo(view.snp.centerX).offset(-3)
}
stepTwoView = {
let view = UIView()
view.backgroundColor = UIColor.brandMainColor
return view
}()
view.addSubview(stepTwoView)
stepTwoView.snp.makeConstraints { make in
make.right.equalTo(-21)
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 16)
make.height.equalTo(3)
make.left.equalTo(view.snp.centerX).offset(3)
}
nextButton = {
let button = UIButton(type: .custom)
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)
return button
}()
view.addSubview(nextButton)
nextButton.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-8 - k_Height_safeAreaInsetsBottom())
make.height.equalTo(48)
}
tableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.backgroundColor = .white
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.register(cellWithClass: YHAllowSettingTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(35 + k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.equalTo(view)
}
if !stepFlag {
tableView.snp.remakeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 64)
make.left.right.equalTo(view)
}
}
}
@objc func nextStep() {
}
}
extension YHInformationAuthorizationStepTwoViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHAllowSettingTableViewCell.self)
cell.item = items[indexPath.row]
cell.block = { [weak self] model in
guard let self = self else { return }
self.viewModel.updateSetModel(model)
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 98.0
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 0.01))
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
}
//
// YHUserInformationModel.swift
// galaxy
//
// Created by EDY on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHUserInformationID: Int {
case id1 = 0 // 真实姓名
case id2 = 1 // 所在地
case id3 = 2 // 毕业院校
case id4 = 3 // 所属行业
case id5 = 4 // 职位
}
struct YHUserInformationModel {
var id: YHUserInformationID?
var title: String?
var isUserKeyBoard: Bool?
var prompts: String?
var message: String?
var type: YHItemSelectType?
var value: [String]?
init(id: YHUserInformationID? = nil, title: String? = nil, isUserKeyBoard: Bool? = nil, prompts: String? = nil, message: String? = nil, type: YHItemSelectType? = nil, value: [String]? = nil) {
self.id = id
self.title = title
self.isUserKeyBoard = isUserKeyBoard
self.prompts = prompts
self.message = message
self.type = type
self.value = value
}
}
class YHMainUserInformationModel: YHBaseModel {
var headUrl: String = ""
var username: String = ""
var area: [String] = []
var school: String = ""
var industry: String = ""
var position: String = ""
}
class YHMainUserInformationSetModel: YHBaseModel {
var isRea: Bool = true
var isWork: Bool = true
var isSchool: Bool = true
}
//
// YHMyInformationItemCell.swift
// galaxy
//
// Created by EDY on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMyInformationItemCell: UITableViewCell {
typealias ItemBlock = (_ model: YHUserInformationModel) -> ()
var block: ItemBlock?
var titleLabel: UILabel!
var messageTextField: UITextField!
var nextStepImageView: UIImageView!
var centerButton: UIButton!
var dataSource: YHUserInformationModel? {
didSet {
updateAllViews()
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
titleLabel = {
let label = UILabel()
label.numberOfLines = 0
return label
}()
contentView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.width.equalTo(112)
make.left.equalTo(21)
}
messageTextField = {
let textField = UITextField()
textField.delegate = self
textField.textColor = UIColor.mainTextColor
textField.font = UIFont.PFSC_M(ofSize: 14)
textField.adjustsFontSizeToFitWidth = true
//最小字体
textField.minimumFontSize = 12
return textField
}()
contentView.addSubview(messageTextField)
messageTextField.snp.makeConstraints { make in
make.right.top.bottom.equalToSuperview()
make.left.equalTo(129)
}
nextStepImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "form_right_arrow")
return imageView
}()
contentView.addSubview(nextStepImageView)
nextStepImageView.snp.makeConstraints { make in
make.right.equalTo(-21)
make.centerY.equalToSuperview()
make.height.width.equalTo(20)
}
centerButton = {
let button = UIButton(type: .custom)
button.addTarget(self, action: #selector(centerClick), for: .touchUpInside)
return button
}()
contentView.addSubview(centerButton)
centerButton.snp.makeConstraints { make in
make.right.top.bottom.equalToSuperview()
make.left.equalTo(112)
}
let lineView = UIView()
lineView.backgroundColor = UIColor.separatorColor
contentView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.right.equalTo(-21)
make.left.equalTo(21)
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
}
func updateAllViews() {
guard let dataSource = dataSource else { return }
let str = dataSource.title ?? ""
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
titleLabel.attributedText = questionAttrStr
messageTextField.placeholder = dataSource.prompts
messageTextField.text = dataSource.message
if dataSource.isUserKeyBoard ?? false {
nextStepImageView.isHidden = true
centerButton.isHidden = true
} else {
if let type = dataSource.type {
switch type {
case .normal: break
case .address: break
case .time: break
case .image: break
case .id: break
case .country: break
case .sex: break
case .marry: break
}
}
nextStepImageView.isHidden = false
centerButton.isHidden = false
messageTextField.snp.remakeConstraints { make in
make.top.bottom.equalToSuperview()
make.right.equalTo(-20)
make.left.equalTo(129)
}
}
}
@objc func centerClick() {
UIViewController.current?.view.endEditing(true) // 收起键盘
guard let type = dataSource?.type else { return }
switch type {
case .normal:
printLog("不需要跳转")
case .address:
let provice = ""
let addressPicker = YHAddressViewController(selectProvince: provice)
addressPicker.backLocationStringController = { (address,province,city,area) in
self.dataSource?.message = address
self.dataSource?.value = [province, city]
self.updateAllViews()
if let block = self.block {
block(self.dataSource ?? YHUserInformationModel())
}
}
UIViewController.current?.present(addressPicker, animated: true, completion: nil)
case .time: break
case .image: break
case .id:
YHOtherPickerView.show(type: .professionalSkill, selectTitle: self.dataSource?.message ?? "") { item in
print(item)
self.dataSource?.message = item.title
self.updateAllViews()
if let block = self.block {
block(self.dataSource ?? YHUserInformationModel())
}
}
case .country: break
case .sex: break
case .marry: break
}
}
}
extension YHMyInformationItemCell: UITextFieldDelegate {
func textFieldDidEndEditing(_ textField: UITextField) {
}
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if string.isEmpty == true {
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
var data = dataSource ?? YHUserInformationModel()
data.message = newText
if let block = block {
block(data)
}
return true
}
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if newText.count > 30 {
return false
}
var data = dataSource ?? YHUserInformationModel()
data.message = newText
if let block = block {
block(data)
}
return true
}
}
//
// YHInformationAuthorizeViewModel.swift
// galaxy
//
// Created by EDY on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHInformationAuthorizeViewModel: YHBaseViewModel {
var mainModel: YHMainUserInformationModel = YHMainUserInformationModel()
var setModel: YHMainUserInformationSetModel = YHMainUserInformationSetModel()
override init() {
super.init()
}
func getBaseDataSource() -> [YHUserInformationModel] {
let item1 = YHUserInformationModel(id: .id1, title: "真实姓名", isUserKeyBoard: true, prompts: "请输入您的真实姓名", message: mainModel.username)
var string = ""
let array = mainModel.area
for item in array {
if string.count != 0 {
string = string + "/" + item
} else {
string = string + item
}
}
let item2 = YHUserInformationModel(id: .id2, title: "所在地", isUserKeyBoard: false, prompts: "请选择您的所在地", message: string, type: .address, value: mainModel.area)
let item3 = YHUserInformationModel(id: .id3, title: "毕业院校", isUserKeyBoard: true, prompts: "请输入您的毕业院校", message: mainModel.school)
let item4 = YHUserInformationModel(id: .id4, title: "所属行业", isUserKeyBoard: false, prompts: "请选择您的所属行业", message: mainModel.industry, type: .id)
let item5 = YHUserInformationModel(id: .id5, title: "职位", isUserKeyBoard: true, prompts: "请输入您的职位", message: mainModel.position)
return [item1, item2, item3, item4, item5]
}
func updateModel(_ item: YHUserInformationModel) {
guard let type = item.id else { return }
switch type {
case .id1:
mainModel.username = item.message ?? ""
case .id2:
mainModel.area = item.value ?? []
case .id3:
mainModel.school = item.message ?? ""
case .id4:
mainModel.industry = item.message ?? ""
case .id5:
mainModel.position = item.message ?? ""
}
}
func isCanNext() -> Bool {
let username = mainModel.username
let school = mainModel.school
let area = mainModel.area
let industry = mainModel.industry
let position = mainModel.position
guard username.count > 0 else { return false }
guard school.count > 0 else { return false }
guard industry.count > 0 else { return false }
guard position.count > 0 else { return false }
guard area.count > 0 else { return false }
return true
}
func getBaseSetDataSource() -> [YHSettingItem] {
let item1 = YHSettingItem(type: .people, title: "授权AI人脉匹配", subTitle: "开启后,您的信息将用于AI人脉匹配,为您构建高质量的人脉网络", isSelect: setModel.isRea, isShowAlert: true)
let item2 = YHSettingItem(type: .people, title: "允许向好友公开您的教育经历", subTitle: "开启后,您的教育经历将在您的个人名片上对已交换名片的好友可见", isSelect: setModel.isSchool, isShowAlert: true)
let item3 = YHSettingItem(type: .people, title: "允许向好友公开您的工作经历", subTitle: "开启后,您的工作经历将在您的个人名片上对已交换名片的好友可见", isSelect: setModel.isWork, isShowAlert: true)
return [item1, item2, item3]
}
func updateSetModel(_ item: YHSettingItem) {
switch item.type {
case .normal: break
case .people:
setModel.isRea = item.isSelect
case .school:
setModel.isSchool = item.isSelect
case .work:
setModel.isWork = item.isSelect
}
}
}
......@@ -24,7 +24,7 @@ class YHFailPromptView: UIView {
return button
}()
private lazy var titleLable : UILabel = {
lazy var titleLable : UILabel = {
let lable0 = UILabel(text: "")
lable0.textColor = UIColor.failColor
lable0.font = UIFont.PFSC_R(ofSize: 12)
......
......@@ -11,7 +11,8 @@ import UIKit
class YHAllowUseMyInfoViewController: YHBaseViewController {
var tableView: UITableView!
var nextButton: UIButton!
let items: [YHSettingItem] = [YHSettingItem(title: "允许您的信息在名片中使用", subTitle: "开启后,您的信息将自动同步至您的个人名片,并对您的好友公开可见", isSelect: true, isShowAlert: false)]
let items: [YHSettingItem] = [YHSettingItem(type: .normal, title: "允许您的信息在名片中使用", subTitle: "开启后,您的信息将自动同步至您的个人名片,并对您的好友公开可见", isSelect: true, isShowAlert: false)]
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "设置"
......@@ -64,7 +65,8 @@ class YHAllowUseMyInfoViewController: YHBaseViewController {
}
@objc func nextStep() {
let vc = YHInformationAuthorizationStepOneViewController()
self.navigationController?.pushViewController(vc)
}
}
......
......@@ -8,13 +8,22 @@
import UIKit
enum YHSettingType: Int {
case normal
case people
case school
case work
}
class YHSettingItem: NSObject {
var type: YHSettingType = .normal
var title: String = ""
var subTitle: String = ""
var isSelect: Bool = true
var isShowAlert: Bool = true
init(title: String, subTitle: String, isSelect: Bool, isShowAlert: Bool) {
init(type: YHSettingType, title: String, subTitle: String, isSelect: Bool, isShowAlert: Bool) {
self.type = type
self.title = title
self.subTitle = subTitle
self.isSelect = isSelect
......
......@@ -9,6 +9,8 @@
import UIKit
class YHAllowSettingTableViewCell: UITableViewCell {
typealias ItemBlock = (_ model: YHSettingItem) -> ()
var block: ItemBlock?
var titleLabel: UILabel!
var exampleButton: UIButton!
var subTitleLabel: UILabel!
......@@ -106,7 +108,77 @@ class YHAllowSettingTableViewCell: UITableViewCell {
}
@objc func switchViewChange() {
guard let model = item else { return }
switch model.type {
case .normal:
model.isSelect = detailSwitch.isOn
if let block = block {
block(model)
}
case .people:
if !detailSwitch.isOn {
YHCommonAlertView.show("", "关闭后,您将无法体验AI人脉匹配功能?", "仍然关闭", "开启") {
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 .school:
if !detailSwitch.isOn {
YHCommonAlertView.show("", "关闭后,您的好友将无法从您的名片中查看您的教育经历", "仍然关闭", "开启") {
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 .work:
if !detailSwitch.isOn {
YHCommonAlertView.show("", "关闭后,您的好友将无法从您的名片中查看您的工作经历", "仍然关闭", "开启") {
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)
}
}
}
}
func updateData() {
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "user_prompt_image@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "user_prompt_image@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