Commit 6bc5484c 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:
  //  我的名片
  首次登录后的UI绘制
parents 63f42576 6976ddbc
This diff is collapsed.
...@@ -22,7 +22,7 @@ class YHBaseViewController: UIViewController { ...@@ -22,7 +22,7 @@ class YHBaseViewController: UIViewController {
gk_navLineHidden = true gk_navLineHidden = true
gk_navBarAlpha = 0 gk_navBarAlpha = 0
gk_backImage = UIImage(named: "nav_back_icon") gk_backImage = UIImage(named: "back_icon")
#if DEBUG #if DEBUG
......
...@@ -21,6 +21,9 @@ class YHMyNameCardViewController: YHBaseViewController { ...@@ -21,6 +21,9 @@ class YHMyNameCardViewController: YHBaseViewController {
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell") tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHMyNameCardAvatarInfoCell.self, forCellReuseIdentifier: YHMyNameCardAvatarInfoCell.cellReuseIdentifier) tableView.register(YHMyNameCardAvatarInfoCell.self, forCellReuseIdentifier: YHMyNameCardAvatarInfoCell.cellReuseIdentifier)
tableView.register(YHMyIntroductionCell.self, forCellReuseIdentifier: YHMyIntroductionCell.cellReuseIdentifier) tableView.register(YHMyIntroductionCell.self, forCellReuseIdentifier: YHMyIntroductionCell.cellReuseIdentifier)
tableView.register(YHMyEducationCell.self, forCellReuseIdentifier: YHMyEducationCell.cellReuseIdentifier)
tableView.register(YHMyWorkExperienceCell.self, forCellReuseIdentifier: YHMyWorkExperienceCell.cellReuseIdentifier)
tableView.register(YHMyInterestTopicCell.self, forCellReuseIdentifier: YHMyInterestTopicCell.cellReuseIdentifier)
tableView.contentInset = UIEdgeInsets(top: 41, left: 0, bottom: 0, right: 0) tableView.contentInset = UIEdgeInsets(top: 41, left: 0, bottom: 0, right: 0)
return tableView return tableView
}() }()
...@@ -57,7 +60,7 @@ class YHMyNameCardViewController: YHBaseViewController { ...@@ -57,7 +60,7 @@ class YHMyNameCardViewController: YHBaseViewController {
extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource { extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
return 7 return 6
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
...@@ -65,6 +68,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource ...@@ -65,6 +68,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyNameCardAvatarInfoCell.cellReuseIdentifier, for: indexPath) as! YHMyNameCardAvatarInfoCell let cell = tableView.dequeueReusableCell(withIdentifier: YHMyNameCardAvatarInfoCell.cellReuseIdentifier, for: indexPath) as! YHMyNameCardAvatarInfoCell
if indexPath.section == 1 { if indexPath.section == 1 {
...@@ -72,6 +76,26 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource ...@@ -72,6 +76,26 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyIntroductionCell.cellReuseIdentifier, for: indexPath) as! YHMyIntroductionCell let cell = tableView.dequeueReusableCell(withIdentifier: YHMyIntroductionCell.cellReuseIdentifier, for: indexPath) as! YHMyIntroductionCell
return cell return cell
} }
if indexPath.section == 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyEducationCell.cellReuseIdentifier, for: indexPath) as! YHMyEducationCell
return cell
}
if indexPath.section == 3 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyWorkExperienceCell.cellReuseIdentifier, for: indexPath) as! YHMyWorkExperienceCell
return cell
}
if indexPath.section == 4 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyIntroductionCell.cellReuseIdentifier, for: indexPath) as! YHMyIntroductionCell
cell.titleLabel.text = "荣誉奖项"
return cell
}
if indexPath.section == 5 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyInterestTopicCell.cellReuseIdentifier, for: indexPath) as! YHMyInterestTopicCell
return cell
}
return cell return cell
} }
......
//
// YHMyEducationCell.swift
// galaxy
//
// Created by edy on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMyEducationCell: UITableViewCell {
static let cellReuseIdentifier = "YHMyEducationCell"
lazy var cardView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = 3.0
view.clipsToBounds = true
return view
}()
lazy var titleLabel:UILabel = {
let label = UILabel()
label.text = "教育经历"
label.textColor = UIColor(hexString: "#222222")
label.textAlignment = .left
label.font = UIFont.PFSC_M(ofSize:17)
return label
}()
lazy var collegeLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor70
label.textAlignment = .left
label.font = UIFont.PFSC_M(ofSize:14)
label.numberOfLines = 0
return label
}()
lazy var detailLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor70
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0
return label
}()
lazy var editBtn:UIButton = {
let btn = UIButton()
btn.setImage(UIImage(named: "people_card_edit"), for: .normal)
btn.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
return btn
}()
lazy var hiddenBtn:UIButton = {
let btn = UIButton()
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
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
collegeLabel.text = "上海交通大学xxxx学院"
detailLabel.text = "宗教学宗教学宗教学宗教学 · 本科"
self.contentView.addSubview(self.cardView)
cardView.addSubview(self.titleLabel)
cardView.addSubview(self.collegeLabel)
cardView.addSubview(self.detailLabel)
cardView.addSubview(self.editBtn)
cardView.addSubview(self.hiddenBtn)
cardView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(16)
make.top.equalTo(16)
make.height.equalTo(24)
}
editBtn.snp.makeConstraints { make in
make.width.height.equalTo(20)
make.right.equalTo(-15)
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)
}
collegeLabel.snp.makeConstraints { make in
make.top.equalTo(self.titleLabel.snp.bottom).offset(12)
make.left.equalTo(16)
make.right.equalTo(-16)
make.height.greaterThanOrEqualTo(20)
}
detailLabel.snp.makeConstraints { make in
make.top.equalTo(self.collegeLabel.snp.bottom).offset(8)
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-16)
}
}
}
//
// YHMyInterestTopicCell.swift
// galaxy
//
// Created by edy on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHTopicItemCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHTopicItemCell"
lazy var titleLabel: UILabel = {
var label = UILabel()
label.font = .PFSC_R(ofSize: 12)
label.textAlignment = .left
label.textColor = UIColor.mainTextColor
return label
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
func setupUI() {
contentView.layer.cornerRadius = 3.0
contentView.layer.borderColor = UIColor(red: 0.071, green: 0.102, blue: 0.149, alpha: 0.3).cgColor
contentView.layer.borderWidth = 1.0
contentView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.left.equalToSuperview().offset(4.0)
make.right.equalToSuperview().offset(-4.0)
}
}
}
class YHMyInterestTopicCell: UITableViewCell {
static let cellReuseIdentifier = "YHMyInterestTopicCell"
var topicArr:[String] = ["深度阅读爱好者", "皮划艇玩家", "创新主义", "茶道", "皮划艇玩家", "创新主义", "茶道", "深度阅读爱好者"]
lazy var cardView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = 3.0
view.clipsToBounds = true
return view
}()
lazy var titleLabel:UILabel = {
let label = UILabel()
label.text = "兴趣话题"
label.textColor = UIColor(hexString: "#222222")
label.textAlignment = .left
label.font = UIFont.PFSC_M(ofSize:17)
return label
}()
lazy var editBtn:UIButton = {
let btn = UIButton()
btn.setImage(UIImage(named: "people_card_edit"), for: .normal)
btn.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
return btn
}()
lazy var collectionView: UICollectionView = {
// 创建集合视图布局
let layout = YHSearchItemLayout()
layout.scrollDirection = .vertical
// 创建集合视图
let collectView = UICollectionView(frame:.zero, collectionViewLayout: layout)
collectView.delegate = self
collectView.dataSource = self
collectView.backgroundColor = .white
// 注册自定义单元格
collectView.register(YHTopicItemCell.self, forCellWithReuseIdentifier: YHTopicItemCell.cellReuseIdentifier)
return collectView
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
self.contentView.addSubview(self.cardView)
cardView.addSubview(self.titleLabel)
cardView.addSubview(collectionView)
cardView.addSubview(self.editBtn)
cardView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(16)
make.top.equalTo(16)
make.height.equalTo(24)
}
editBtn.snp.makeConstraints { make in
make.width.height.equalTo(20)
make.right.equalTo(-15)
make.centerY.equalTo(titleLabel)
}
collectionView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-16)
make.height.equalTo(58)
make.top.equalTo(titleLabel.snp.bottom).offset(12)
}
}
}
extension YHMyInterestTopicCell: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
// 返回单元格数量
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return topicArr.count
}
// 返回每个单元格的大小
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let size = self.getwith(font: UIFont.systemFont(ofSize: 12), height: 24, string: topicArr[indexPath.item])
var width = size.width + 4*2.0
if width > 226.0 {
width = 226.0
}
return CGSize(width: width, height: 24.0)
}
// 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHTopicItemCell.cellReuseIdentifier, for: indexPath) as! YHTopicItemCell
if 0 <= indexPath.item && indexPath.item < topicArr.count {
cell.titleLabel.text = topicArr[indexPath.item]
}
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if 0 <= indexPath.item && indexPath.item < topicArr.count {
let text = topicArr[indexPath.item]
}
}
// 计算文字宽度大小
func getwith(font: UIFont, height: CGFloat, string: String) -> CGSize {
let size = CGSize.init(width: CGFloat(MAXFLOAT), height: height)
let dic = [NSAttributedString.Key.font: font] // swift 4.2
var strSize = string.boundingRect(with: size, options: [.usesLineFragmentOrigin], attributes: dic, context:nil).size
return CGSizeMake(ceil(strSize.width), strSize.height)
}
}
...@@ -16,6 +16,7 @@ class YHMyIntroductionCell: UITableViewCell { ...@@ -16,6 +16,7 @@ class YHMyIntroductionCell: UITableViewCell {
let view = UIView() let view = UIView()
view.backgroundColor = .white view.backgroundColor = .white
view.layer.cornerRadius = 3.0 view.layer.cornerRadius = 3.0
view.clipsToBounds = true
return view return view
}() }()
...@@ -54,9 +55,7 @@ class YHMyIntroductionCell: UITableViewCell { ...@@ -54,9 +55,7 @@ class YHMyIntroductionCell: UITableViewCell {
} }
func setupUI() { func setupUI() {
self.backgroundColor = .white
self.selectionStyle = .none
self.selectionStyle = .none self.selectionStyle = .none
self.backgroundColor = .clear self.backgroundColor = .clear
self.contentView.backgroundColor = .clear self.contentView.backgroundColor = .clear
......
...@@ -40,6 +40,13 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -40,6 +40,13 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
return view return view
}() }()
lazy var editBtn:UIButton = {
let btn = UIButton()
btn.setImage(UIImage(named: "people_card_edit"), for: .normal)
btn.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
return btn
}()
lazy var nameLabel:UILabel = { lazy var nameLabel:UILabel = {
let nameLabel = UILabel() let nameLabel = UILabel()
nameLabel.textColor = UIColor.mainTextColor nameLabel.textColor = UIColor.mainTextColor
...@@ -88,7 +95,8 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -88,7 +95,8 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
cardView.addSubview(self.nameLabel) cardView.addSubview(self.nameLabel)
cardView.addSubview(self.professionalLabel) cardView.addSubview(self.professionalLabel)
cardView.addSubview(self.detailLabel) cardView.addSubview(self.detailLabel)
cardView.addSubview(self.editBtn)
self.nameLabel.text = "啊防守打法胜多负少" self.nameLabel.text = "啊防守打法胜多负少"
self.professionalLabel.text = "阿迪发沙发沙发撒发生大发三大发沙发沙发上1阿斯顿发双法防" self.professionalLabel.text = "阿迪发沙发沙发撒发生大发三大发沙发沙发上1阿斯顿发双法防"
self.detailLabel.text = "阿凡达所发生的发顺丰大沙发沙发沙发沙发沙发沙发沙发沙发沙发沙发沙发沙发发沙发" self.detailLabel.text = "阿凡达所发生的发顺丰大沙发沙发沙发沙发沙发沙发沙发沙发沙发沙发沙发沙发发沙发"
...@@ -98,6 +106,12 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -98,6 +106,12 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
make.top.equalTo(self.headImgV.snp.centerY) make.top.equalTo(self.headImgV.snp.centerY)
} }
self.editBtn.snp.makeConstraints { make in
make.width.height.equalTo(20)
make.right.equalTo(-16)
make.top.equalTo(16)
}
self.headImgV.snp.makeConstraints { make in self.headImgV.snp.makeConstraints { make in
make.width.height.equalTo(headWidth) make.width.height.equalTo(headWidth)
make.left.equalTo(10) make.left.equalTo(10)
......
//
// YHMyWorkExperienceCell.swift
// galaxy
//
// Created by edy on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHExperienceItemView: UIView {
lazy var titleLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor50
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
return label
}()
lazy var detailLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor70
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:14)
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func createUI() {
self.addSubview(self.titleLabel)
self.addSubview(self.detailLabel)
self.titleLabel.snp.makeConstraints { make in
make.left.equalTo(0)
make.width.equalTo(56)
make.height.equalTo(20)
make.centerY.equalToSuperview()
}
self.detailLabel.snp.makeConstraints { make in
make.left.equalTo(self.titleLabel.snp.right).offset(56)
make.right.equalToSuperview()
make.centerY.equalToSuperview()
}
}
}
class YHMyWorkExperienceCell: UITableViewCell {
static let cellReuseIdentifier = "YHMyWorkExperienceCell"
lazy var cardView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = 3.0
view.clipsToBounds = true
return view
}()
lazy var titleLabel:UILabel = {
let label = UILabel()
label.text = "工作经历"
label.textColor = UIColor(hexString: "#222222")
label.textAlignment = .left
label.font = UIFont.PFSC_M(ofSize:17)
return label
}()
lazy var editBtn:UIButton = {
let btn = UIButton()
btn.setImage(UIImage(named: "people_card_edit"), for: .normal)
btn.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
return btn
}()
lazy var companyView:YHExperienceItemView = {
let view = YHExperienceItemView()
view.titleLabel.text = "所在企业"
return view
}()
lazy var professionView:YHExperienceItemView = {
let view = YHExperienceItemView()
view.titleLabel.text = "职位"
return view
}()
lazy var industryView:YHExperienceItemView = {
let view = YHExperienceItemView()
view.titleLabel.text = "所在行业"
return view
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
self.contentView.addSubview(self.cardView)
cardView.addSubview(self.titleLabel)
cardView.addSubview(self.editBtn)
cardView.addSubview(self.companyView)
cardView.addSubview(self.professionView)
cardView.addSubview(self.industryView)
cardView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(16)
make.top.equalTo(16)
make.height.equalTo(24)
}
editBtn.snp.makeConstraints { make in
make.width.height.equalTo(20)
make.right.equalTo(-15)
make.centerY.equalTo(titleLabel)
}
companyView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.height.equalTo(20)
make.top.equalTo(self.titleLabel.snp.bottom).offset(12)
}
professionView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.height.equalTo(20)
make.top.equalTo(self.companyView.snp.bottom).offset(14)
}
industryView.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.height.equalTo(20)
make.top.equalTo(self.professionView.snp.bottom).offset(14)
make.bottom.equalToSuperview().offset(-16)
}
}
}
//
// YHAllowUseMyInfoViewController.swift
// galaxy
//
// Created by EDY on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAllowUseMyInfoViewController: YHBaseViewController {
var tableView: UITableView!
var nextButton: UIButton!
let items: [YHSettingItem] = [YHSettingItem(title: "允许您的信息在名片中使用", subTitle: "开启后,您的信息将自动同步至您的个人名片,并对您的好友公开可见", isSelect: true, isShowAlert: false)]
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "设置"
gk_navBackgroundColor = .white
gk_navBarAlpha = 1
setView()
// Do any additional setup after loading the view.
}
func setView() {
view.backgroundColor = .contentBkgColor
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(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(-k_Height_safeAreaInsetsBottom() - 48)
make.left.right.equalTo(view)
}
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)
}
}
@objc func nextStep() {
}
}
extension YHAllowUseMyInfoViewController: 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]
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
}
}
//
// YHUserInfoSettingViewController.swift
// galaxy
//
// Created by EDY on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHUserInfoSettingViewController: YHBaseViewController {
var photoImageView: UIImageView!
var photoButton: UIButton!
var changeButton: UIButton!
var nameLabel: UILabel!
var nameTextField: UITextField!
var nextButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
setView()
}
func setView() {
gk_navTitle = "设置"
view.backgroundColor = .white
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 + 30)
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)
}
nameLabel = {
let label = UILabel()
label.text = "真实姓名"
label.font = UIFont.PFSC_M(ofSize: 15)
label.textColor = UIColor.mainTextColor
return label
}()
view.addSubview(nameLabel)
nameLabel.snp.makeConstraints { make in
make.left.equalTo(21)
make.width.equalTo(70)
make.top.equalTo(changeButton.snp.bottom).offset(44)
make.height.equalTo(21)
}
nameTextField = {
let textField = UITextField()
textField.textColor = UIColor.mainTextColor
textField.font = UIFont.PFSC_M(ofSize: 15)
textField.adjustsFontSizeToFitWidth = true
//最小字体
textField.minimumFontSize = 12
textField.placeholder = "请输入"
return textField
}()
view.addSubview(nameTextField)
nameTextField.snp.makeConstraints { make in
make.centerY.equalTo(nameLabel.snp.centerY)
make.left.equalTo(129)
make.right.equalTo(-21)
make.height.equalTo(21)
}
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)
}
}
@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() {
if nameTextField.text?.count == 0 {
YHHUD.flash(message: "请填写您的真实姓名")
return
}
let vc = YHAllowUseMyInfoViewController()
self.navigationController?.pushViewController(vc)
}
}
//
// YHSettingItem.swift
// galaxy
//
// Created by EDY on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSettingItem: NSObject {
var title: String = ""
var subTitle: String = ""
var isSelect: Bool = true
var isShowAlert: Bool = true
init(title: String, subTitle: String, isSelect: Bool, isShowAlert: Bool) {
self.title = title
self.subTitle = subTitle
self.isSelect = isSelect
self.isShowAlert = isShowAlert
}
}
...@@ -16,7 +16,6 @@ struct YHUserModel: SmartCodable { ...@@ -16,7 +16,6 @@ struct YHUserModel: SmartCodable {
var headpic: String? var headpic: String?
var sex: Int? var sex: Int?
var token: String? var token: String?
} }
struct YHDeviceTokenModel { struct YHDeviceTokenModel {
......
//
// YHAllowSettingTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/6/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAllowSettingTableViewCell: UITableViewCell {
var titleLabel: UILabel!
var exampleButton: UIButton!
var subTitleLabel: UILabel!
var detailSwitch: UISwitch!
var item: YHSettingItem? {
didSet {
updateData()
}
}
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
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
contentView.backgroundColor = .clear
backgroundColor = .clear
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor
return label
}()
contentView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.equalTo(21)
make.top.equalTo(16)
make.height.equalTo(22)
}
exampleButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "work_experience_alert"), for: .normal)
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside)
return button
}()
contentView.addSubview(exampleButton)
exampleButton.snp.makeConstraints { make in
make.left.equalTo(titleLabel.snp.right).offset(4)
make.centerY.equalTo(titleLabel.snp.centerY)
make.height.equalTo(18)
make.width.equalTo(18)
}
subTitleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 13)
label.textColor = UIColor.mainTextColor30
label.numberOfLines = 0
return label
}()
contentView.addSubview(subTitleLabel)
subTitleLabel.snp.makeConstraints { make in
make.left.equalTo(21)
make.right.equalTo(-87)
make.top.equalTo(46)
}
detailSwitch = {
let switchView = UISwitch()
switchView.onTintColor = UIColor.brandMainColor
switchView.addTarget(self, action: #selector(switchViewChange), for: .valueChanged)
return switchView
}()
contentView.addSubview(detailSwitch)
detailSwitch.snp.makeConstraints { make in
make.right.equalTo(-21)
make.centerY.equalToSuperview()
make.height.equalTo(22)
make.width.equalTo(40)
}
exampleButton.YH_clickEdgeInsets = UIEdgeInsets(top: 50, left: 50, bottom: 50, right: 50)
detailSwitch.transform = CGAffineTransform(scaleX: 0.77, y: 0.77)
}
@objc func exampleClick() {
}
@objc func switchViewChange() {
}
func updateData() {
guard let model = item else { return }
titleLabel.text = model.title
subTitleLabel.text = model.subTitle
exampleButton.isHidden = !model.isShowAlert
detailSwitch.isOn = model.isSelect
}
}
...@@ -285,7 +285,9 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { ...@@ -285,7 +285,9 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
switch item.type { switch item.type {
case .myMessage://我的消息 case .myMessage://我的消息
printLog("我的消息") printLog("我的消息")
let vc = YHMessageListVC() // let vc = YHMessageListVC()
// self.navigationController?.pushViewController(vc)
let vc = YHUserInfoSettingViewController()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
case .scoreCenter:////积分中心 case .scoreCenter:////积分中心
printLog("积分中心") printLog("积分中心")
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "user_change_photo@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "user_change_photo@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "user_photo_default@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "user_photo_default@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "user_take_photo@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "user_take_photo@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Frame@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame@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