Commit 5b2421ab authored by Steven杜宇's avatar Steven杜宇

// 我的页面

parent 65cb67ef
......@@ -1187,6 +1187,12 @@
04AE205A2D1944D600891D24 /* YHGCMyFileListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE20592D1944D600891D24 /* YHGCMyFileListViewController.swift */; };
04AE20632D1ADA8100891D24 /* YHGCPreviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE20622D1ADA8100891D24 /* YHGCPreviewViewModel.swift */; };
04AE20652D1BD9B500891D24 /* YHGCCertificateEntryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AE20642D1BD9B500891D24 /* YHGCCertificateEntryCell.swift */; };
04AFEF3F2D5D8F8A0007A011 /* YHMyNewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF3E2D5D8F8A0007A011 /* YHMyNewViewController.swift */; };
04AFEF412D5D97140007A011 /* YHMySectionGroupCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF402D5D97140007A011 /* YHMySectionGroupCell.swift */; };
04AFEF432D5D99420007A011 /* YHMyFunctionGroupItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF422D5D99420007A011 /* YHMyFunctionGroupItemCell.swift */; };
04AFEF452D5DDCCB0007A011 /* YHMyFunctionGroup2Cell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF442D5DDCCB0007A011 /* YHMyFunctionGroup2Cell.swift */; };
04AFEF492D5DDE180007A011 /* YHMyFunctionGroupItem2Cell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF482D5DDE180007A011 /* YHMyFunctionGroupItem2Cell.swift */; };
04AFEF4B2D5DF3710007A011 /* YHMyUserInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF4A2D5DF3710007A011 /* YHMyUserInfoView.swift */; };
04EA376D2BEA06EF00DBAF64 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376C2BEA06EF00DBAF64 /* WebKit.framework */; };
04EA376F2BEA071600DBAF64 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376E2BEA070500DBAF64 /* libc++.tbd */; };
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
......@@ -2411,6 +2417,12 @@
04AE20592D1944D600891D24 /* YHGCMyFileListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCMyFileListViewController.swift; sourceTree = "<group>"; };
04AE20622D1ADA8100891D24 /* YHGCPreviewViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCPreviewViewModel.swift; sourceTree = "<group>"; };
04AE20642D1BD9B500891D24 /* YHGCCertificateEntryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCCertificateEntryCell.swift; sourceTree = "<group>"; };
04AFEF3E2D5D8F8A0007A011 /* YHMyNewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyNewViewController.swift; sourceTree = "<group>"; };
04AFEF402D5D97140007A011 /* YHMySectionGroupCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySectionGroupCell.swift; sourceTree = "<group>"; };
04AFEF422D5D99420007A011 /* YHMyFunctionGroupItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyFunctionGroupItemCell.swift; sourceTree = "<group>"; };
04AFEF442D5DDCCB0007A011 /* YHMyFunctionGroup2Cell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyFunctionGroup2Cell.swift; sourceTree = "<group>"; };
04AFEF482D5DDE180007A011 /* YHMyFunctionGroupItem2Cell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyFunctionGroupItem2Cell.swift; sourceTree = "<group>"; };
04AFEF4A2D5DF3710007A011 /* YHMyUserInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyUserInfoView.swift; sourceTree = "<group>"; };
04EA376C2BEA06EF00DBAF64 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
04EA376E2BEA070500DBAF64 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
04FA8B2D2C084C7E00ABE43F /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = ATAuthSDK.bundle; path = "galaxy/Classes/Modules/AutoLogin(一键登录)/framework/ATAuthSDK_D.framework/ATAuthSDK.bundle"; sourceTree = "<group>"; };
......@@ -5686,6 +5698,7 @@
045C0EDC2D12CA5E00BD2DC0 /* YHMyPermissionSettingVC.swift */,
045C0EDD2D12CA5E00BD2DC0 /* YHMySettingViewController.swift */,
045C0EDE2D12CA5E00BD2DC0 /* YHMyViewController.swift */,
04AFEF3E2D5D8F8A0007A011 /* YHMyNewViewController.swift */,
045C0EDF2D12CA5E00BD2DC0 /* YHTestViewController.swift */,
045C0EE02D12CA5E00BD2DC0 /* YHVideoPlaySettingVC.swift */,
);
......@@ -5757,8 +5770,13 @@
045C0EF52D12CA5E00BD2DC0 /* YHAboutUsCell.swift */,
045C0EF62D12CA5E00BD2DC0 /* YHMyPermissionCell.swift */,
045C0EF72D12CA5E00BD2DC0 /* YHMySettingCell.swift */,
04AFEF402D5D97140007A011 /* YHMySectionGroupCell.swift */,
04AFEF442D5DDCCB0007A011 /* YHMyFunctionGroup2Cell.swift */,
04AFEF422D5D99420007A011 /* YHMyFunctionGroupItemCell.swift */,
04AFEF482D5DDE180007A011 /* YHMyFunctionGroupItem2Cell.swift */,
045C0EF82D12CA5E00BD2DC0 /* YHPersonalCenterCell.swift */,
045C0EF92D12CA5E00BD2DC0 /* YHUserInfoHeaderView.swift */,
04AFEF4A2D5DF3710007A011 /* YHMyUserInfoView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -6937,6 +6955,7 @@
045C102A2D12CA5F00BD2DC0 /* YHEditViewModel.swift in Sources */,
045C102B2D12CA5F00BD2DC0 /* YHAppVersionForceUpdateView.swift in Sources */,
045C102C2D12CA5F00BD2DC0 /* YHMyPermissionCell.swift in Sources */,
04AFEF3F2D5D8F8A0007A011 /* YHMyNewViewController.swift in Sources */,
045C102D2D12CA5F00BD2DC0 /* YHHKEventModel.swift in Sources */,
045C102E2D12CA5F00BD2DC0 /* YHOfficailLetterColledtionCell.swift in Sources */,
045C102F2D12CA5F00BD2DC0 /* YHFormItemInputTextCell.swift in Sources */,
......@@ -7061,6 +7080,7 @@
045C10942D12CA5F00BD2DC0 /* YHWorkItemListViewModel.swift in Sources */,
045C10952D12CA5F00BD2DC0 /* YHHomeInfoSectionCell.swift in Sources */,
045C10962D12CA5F00BD2DC0 /* YHShareViewOnTablebarView.swift in Sources */,
04AFEF432D5D99420007A011 /* YHMyFunctionGroupItemCell.swift in Sources */,
045C10972D12CA5F00BD2DC0 /* YHMaterialListCell.swift in Sources */,
045C10982D12CA5F00BD2DC0 /* YHTravelDocsPreparationListModel.swift in Sources */,
045C10992D12CA5F00BD2DC0 /* YHCertificateAppointOptionCell.swift in Sources */,
......@@ -7706,6 +7726,7 @@
045C12E42D12CA5F00BD2DC0 /* YHMsgViewModel.swift in Sources */,
045C12E52D12CA5F00BD2DC0 /* YHJsApi.swift in Sources */,
045C12E62D12CA5F00BD2DC0 /* YHScoreResultView.swift in Sources */,
04AFEF492D5DDE180007A011 /* YHMyFunctionGroupItem2Cell.swift in Sources */,
045C12E72D12CA5F00BD2DC0 /* YHAIChatShadowView.swift in Sources */,
045C12E82D12CA5F00BD2DC0 /* YHSettingItem.swift in Sources */,
045C12E92D12CA5F00BD2DC0 /* YHBasicInfoFillCell.swift in Sources */,
......@@ -7779,6 +7800,7 @@
045C13282D12CA5F00BD2DC0 /* YHResignDocumentSignatureModel.swift in Sources */,
045C13292D12CA5F00BD2DC0 /* YHAICardItemView.swift in Sources */,
045C132A2D12CA5F00BD2DC0 /* YHServiceSelectAlertView.swift in Sources */,
04AFEF412D5D97140007A011 /* YHMySectionGroupCell.swift in Sources */,
045C132B2D12CA5F00BD2DC0 /* YHResignUploadDocListCell.swift in Sources */,
045C132C2D12CA5F00BD2DC0 /* YHImageViewController.swift in Sources */,
045C132D2D12CA5F00BD2DC0 /* YHSelectCountryViewController.swift in Sources */,
......@@ -7872,6 +7894,7 @@
045C13812D12CA5F00BD2DC0 /* YHParentInfoVC.swift in Sources */,
045C13822D12CA5F00BD2DC0 /* YHResignMaterialUploadVC.swift in Sources */,
045C13832D12CA5F00BD2DC0 /* YHVisaRenewalGuideIndentCell.swift in Sources */,
04AFEF4B2D5DF3710007A011 /* YHMyUserInfoView.swift in Sources */,
045C13842D12CA5F00BD2DC0 /* YHOtherInfoFillModel.swift in Sources */,
04AE20252D13B11200891D24 /* YHGCSpouseBasicInfoVC.swift in Sources */,
045C13852D12CA5F00BD2DC0 /* YHCertificateUploadVC.swift in Sources */,
......@@ -7926,6 +7949,7 @@
045C13B22D12CA5F00BD2DC0 /* YHPersonInfoFillStepModel.swift in Sources */,
045C13B32D12CA5F00BD2DC0 /* YHDocumentUploadTableViewCell.swift in Sources */,
045C13B42D12CA5F00BD2DC0 /* YHHKRequiredItemListCell.swift in Sources */,
04AFEF452D5DDCCB0007A011 /* YHMyFunctionGroup2Cell.swift in Sources */,
045C13B52D12CA5F00BD2DC0 /* YHFamilyInitialInfo.swift in Sources */,
045C13B62D12CA5F00BD2DC0 /* YHPickPhoneAddressViewController.swift in Sources */,
);
......
......@@ -42,12 +42,14 @@ enum YHPersonalModuleItemType: Int {
class PersonalModuleItem {
var icon: String?
var title: String
var desc: String
var type:YHPersonalModuleItemType = .none
var isShowRedPoint:Bool = false
init(icon: String? = nil, title: String, isShowRedPoint:Bool = false, type:YHPersonalModuleItemType) {
init(icon: String? = nil, title: String, desc: String = "", isShowRedPoint:Bool = false, type:YHPersonalModuleItemType) {
self.icon = icon
self.title = title
self.desc = desc
self.isShowRedPoint = isShowRedPoint
self.type = type
}
......
//
// YHMyFunctionGroup2Cell.swift
// galaxy
//
// Created by Dufet on 2025/2/13.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMyFunctionGroup2Cell: UITableViewCell {
static let cellReuseIdentifier = "YHMyFunctionGroup2Cell"
static let itemHeight = 74.0
func updateGroup(_ group: YHFunctionGroupInfo) {
groupArr = group.arr
}
var groupArr: [PersonalModuleItem] = [] {
didSet {
let countPerRow = 2
let rowHeight = Self.itemHeight
var listHeight = rowHeight
if groupArr.count%countPerRow == 0 {
listHeight = rowHeight * Double(groupArr.count/countPerRow)
} else {
listHeight = rowHeight * Double(groupArr.count/countPerRow + 1)
}
collectionView.snp.updateConstraints { make in
make.height.equalTo(listHeight)
}
collectionView.reloadData()
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
lazy var collectionView: UICollectionView = {
let flowLayout = UICollectionViewFlowLayout()
flowLayout.minimumInteritemSpacing = 10.0
flowLayout.minimumLineSpacing = 0.0
flowLayout.scrollDirection = .vertical
let collectView = UICollectionView(frame:.zero, collectionViewLayout: flowLayout)
collectView.backgroundColor = .clear
collectView.delegate = self
collectView.dataSource = self
collectView.register(YHMyFunctionGroupItem2Cell.self, forCellWithReuseIdentifier: YHMyFunctionGroupItem2Cell.cellReuseIdentifier)
collectView.contentInset = .zero
collectView.showsVerticalScrollIndicator = false
collectView.contentInsetAdjustmentBehavior = .never
return collectView
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
contentView.backgroundColor = .clear
contentView.addSubview(collectionView)
collectionView.snp.makeConstraints { make in
make.top.equalTo(16)
make.bottom.equalTo(-16)
make.left.right.equalToSuperview()
make.height.equalTo(Self.itemHeight)
}
}
}
extension YHMyFunctionGroup2Cell: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
// 返回单元格数量
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return groupArr.count
}
// 返回每个单元格的大小
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let width = floor((KScreenWidth-20.0*2.0-10.0)/2.0)
return CGSize(width: width, height: Self.itemHeight)
}
// 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHMyFunctionGroupItem2Cell.cellReuseIdentifier, for: indexPath) as! YHMyFunctionGroupItem2Cell
if 0 <= indexPath.item && indexPath.item < groupArr.count {
let item: PersonalModuleItem = groupArr[indexPath.item]
cell.updateItem(item)
}
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
}
}
//
// YHMyFunctionGroupItem2Cell.swift
// galaxy
//
// Created by Dufet on 2025/2/13.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMyFunctionGroupItem2Cell: UICollectionViewCell {
static let cellReuseIdentifier = "YHMyFunctionGroupItem2Cell"
func updateItem(_ item : PersonalModuleItem) {
titleLabel.text = item.title
descLabel.text = item.desc
if let icon = item.icon, !icon.isEmpty {
iconImgView.image = UIImage(named:icon)
} else {
iconImgView.image = nil
}
}
lazy var whiteView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = 4.0
view.clipsToBounds = true
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor
label.textAlignment = .left
label.font = UIFont.PFSC_M(ofSize: 14)
return label
}()
lazy var descLabel: UILabel = {
let label = UILabel()
label.textColor = .init(UIColor(hex: 0x8993A2))
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize: 12)
return label
}()
lazy var iconImgView: UIImageView = {
let v = UIImageView(image: UIImage(named: ""))
return v
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
func setupUI() {
self.contentView.addSubview(whiteView)
self.whiteView.addSubview(titleLabel)
self.whiteView.addSubview(descLabel)
self.whiteView.addSubview(iconImgView)
whiteView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
iconImgView.snp.makeConstraints { make in
make.left.equalTo(12)
make.width.height.equalTo(42)
make.centerY.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(iconImgView.snp.right).offset(8)
make.right.equalTo(-8)
make.top.equalTo(iconImgView)
make.right.equalTo(-8)
make.height.equalTo(20)
}
descLabel.snp.makeConstraints { make in
make.left.equalTo(titleLabel)
make.top.equalTo(titleLabel.snp.bottom).offset(2)
make.height.equalTo(17)
make.right.equalTo(-8)
}
}
}
//
// YHMySectionGroupItemCellCollectionViewCell.swift
// galaxy
//
// Created by Dufet on 2025/2/13.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMyFunctionGroupItemCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHMyFunctionGroupItemCell"
func updateItem(_ item : PersonalModuleItem) {
titleLabel.text = item.title
if let icon = item.icon, !icon.isEmpty {
iconImgView.image = UIImage(named:icon)
} else {
iconImgView.image = nil
}
}
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor
label.textAlignment = .center
label.font = UIFont.PFSC_R(ofSize: 12)
return label
}()
lazy var iconImgView: UIImageView = {
let v = UIImageView(image: UIImage(named: ""))
return v
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
func setupUI() {
self.contentView.addSubview(titleLabel)
self.contentView.addSubview(iconImgView)
iconImgView.snp.makeConstraints { make in
make.top.equalTo(20)
make.width.height.equalTo(24)
make.centerX.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(iconImgView.snp.bottom).offset(8)
make.height.equalTo(18)
make.left.right.equalToSuperview()
}
}
}
//
// YHMySectionGroupCell.swift
// galaxy
//
// Created by Dufet on 2025/2/13.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMySectionGroupCell: UITableViewCell {
static let cellReuseIdentifier = "YHMySectionGroupCell"
func updateGroup(_ group: YHFunctionGroupInfo) {
titleLabel.text = group.title
groupArr = group.arr
}
var groupArr: [PersonalModuleItem] = [] {
didSet {
let countPerRow = 4
let rowHeight = 90.0
var listHeight = rowHeight
if groupArr.count%countPerRow == 0 {
listHeight = rowHeight * Double(groupArr.count/countPerRow)
} else {
listHeight = rowHeight * Double(groupArr.count/countPerRow + 1)
}
collectionView.snp.updateConstraints { make in
make.height.equalTo(listHeight)
}
collectionView.reloadData()
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
lazy var whiteView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = 4.0
view.clipsToBounds = true
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor
label.textAlignment = .left
label.font = UIFont.PFSC_M(ofSize: 14)
return label
}()
lazy var collectionView: UICollectionView = {
let flowLayout = UICollectionViewFlowLayout()
flowLayout.minimumInteritemSpacing = 0.0
flowLayout.minimumLineSpacing = 0.0
flowLayout.scrollDirection = .vertical
let collectView = UICollectionView(frame:.zero, collectionViewLayout: flowLayout)
collectView.backgroundColor = .clear
collectView.delegate = self
collectView.dataSource = self
collectView.register(YHMyFunctionGroupItemCell.self, forCellWithReuseIdentifier: YHMyFunctionGroupItemCell.cellReuseIdentifier)
collectView.contentInset = .zero
collectView.showsVerticalScrollIndicator = false
collectView.contentInsetAdjustmentBehavior = .never
return collectView
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
contentView.backgroundColor = .clear
contentView.addSubview(whiteView)
whiteView.addSubview(titleLabel)
whiteView.addSubview(collectionView)
whiteView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.bottom.equalTo(-16)
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(16)
make.height.equalTo(20)
}
collectionView.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(0)
make.bottom.left.right.equalToSuperview()
make.height.equalTo(90)
}
}
}
extension YHMySectionGroupCell: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
// 返回单元格数量
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return groupArr.count
}
// 返回每个单元格的大小
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let width = floor((KScreenWidth-20.0*2.0)/4.0)
return CGSize(width: width, height: 90.0)
}
// 返回自定义单元格
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHMyFunctionGroupItemCell.cellReuseIdentifier, for: indexPath) as! YHMyFunctionGroupItemCell
if 0 <= indexPath.item && indexPath.item < groupArr.count {
let item: PersonalModuleItem = groupArr[indexPath.item]
cell.updateItem(item)
}
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
}
}
//
// YHMyUserInfoView.swift
// galaxy
//
// Created by Dufet on 2025/2/13.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMyUserInfoView: UIView {
static let likeTag = 9527
static let collectTag = 9528
static let scanTag = 9529
var avatarClickBlock:(()->Void)?
var nickNameClickBlock:(()->Void)?
var likeClick:(()->Void)?
var collectClick:(()->Void)?
var recentScanClick:(()->Void)?
lazy var contentView: UIView = {
let view = UIView()
return view
}()
lazy var avarImgView:UIImageView = {
let imgView = UIImageView(image: UIImage(named: "mine_head_logout"))
imgView.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(didAvarImgViewTapped))
imgView.addGestureRecognizer(tap)
imgView.layer.cornerRadius = 27.0
imgView.contentMode = .scaleAspectFill
imgView.clipsToBounds = true
return imgView
}()
private lazy var userNameLabel:UILabel = {
let label = UILabel()
label.text = "登录/注册".local
label.textColor = .mainTextColor
label.textAlignment = NSTextAlignment.left
label.font = UIFont.PFSC_M(ofSize: 21)
label.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(didNickNameTapped))
label.addGestureRecognizer(tap)
return label
}()
private lazy var likeLabel:UILabel = {
let label = UILabel()
label.text = "点赞 0".local
label.textColor = UIColor.mainTextColor50
label.textAlignment = NSTextAlignment.left
label.font = UIFont.PFSC_R(ofSize: 13)
label.isUserInteractionEnabled = true
label.tag = Self.likeTag
let tap = UITapGestureRecognizer(target: self, action: #selector(tap(gestureRecognizer:)))
label.addGestureRecognizer(tap)
return label
}()
private lazy var collectLabel:UILabel = {
let label = UILabel()
label.text = "收藏 0".local
label.textColor = UIColor.mainTextColor50
label.textAlignment = NSTextAlignment.left
label.font = UIFont.PFSC_R(ofSize: 13)
label.isUserInteractionEnabled = true
label.tag = Self.collectTag
let tap = UITapGestureRecognizer(target: self, action: #selector(tap(gestureRecognizer:)))
label.addGestureRecognizer(tap)
return label
}()
private lazy var scanLabel:UILabel = {
let label = UILabel()
label.text = "最近浏览 0".local
label.textColor = UIColor.mainTextColor50
label.textAlignment = NSTextAlignment.left
label.font = UIFont.PFSC_R(ofSize: 13)
label.isUserInteractionEnabled = true
label.tag = Self.scanTag
let tap = UITapGestureRecognizer(target: self, action: #selector(tap(gestureRecognizer:)))
label.addGestureRecognizer(tap)
return label
}()
private lazy var line1View:UIView = {
let line = UIView()
line.backgroundColor = UIColor(hex:0x92959D, alpha: 0.2)
return line
}()
private lazy var line2View:UIView = {
let line = UIView()
line.backgroundColor = UIColor(hex:0x92959D, alpha: 0.2)
return line
}()
lazy var arrowImgView: UIImageView = {
let imgV = UIImageView()
imgV.image = UIImage(named: "form_right_arrow")
return imgV
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.clipsToBounds = true
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
static func createView() -> YHMyUserInfoView {
let view = YHMyUserInfoView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height:107))
return view
}
private func createUI() {
self.addSubview(contentView)
contentView.addSubview(avarImgView)
contentView.addSubview(userNameLabel)
contentView.addSubview(likeLabel)
contentView.addSubview(collectLabel)
contentView.addSubview(scanLabel)
contentView.addSubview(line1View)
contentView.addSubview(line2View)
contentView.addSubview(arrowImgView)
contentView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.height.equalTo(54)
make.top.equalTo(21)
make.bottom.equalTo(-31)
}
avarImgView.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: 55, height: 55))
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(0)
}
userNameLabel.snp.makeConstraints { make in
make.left.equalTo(avarImgView.snp.right).offset(16)
make.top.equalTo(avarImgView)
make.right.equalTo(arrowImgView.snp.left)
make.height.equalTo(29.0)
}
likeLabel.snp.makeConstraints { make in
make.left.equalTo(userNameLabel)
make.right.equalTo(line1View.snp.left).offset(-12)
make.height.equalTo(17.0)
make.top.equalTo(userNameLabel.snp.bottom).offset(6)
}
likeLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
likeLabel.setContentHuggingPriority(.required, for: .horizontal)
line1View.snp.makeConstraints { make in
make.centerY.equalTo(likeLabel)
make.size.equalTo(CGSize(width: 1, height: 12))
}
collectLabel.snp.makeConstraints { make in
make.left.equalTo(line1View.snp.right).offset(12)
make.right.equalTo(line2View.snp.left).offset(-12)
make.height.equalTo(17.0)
make.top.equalTo(likeLabel)
}
collectLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
collectLabel.setContentHuggingPriority(.required, for: .horizontal)
line2View.snp.makeConstraints { make in
make.centerY.equalTo(likeLabel)
make.size.equalTo(CGSize(width: 1, height: 12))
}
scanLabel.snp.makeConstraints { make in
make.left.equalTo(line2View.snp.right).offset(12)
make.right.equalTo(arrowImgView.snp.left)
make.height.equalTo(17.0)
make.top.equalTo(likeLabel)
}
scanLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
arrowImgView.snp.makeConstraints { make in
make.width.height.equalTo(20)
make.centerY.equalToSuperview()
make.right.equalTo(0)
}
}
@objc func tap(gestureRecognizer:UITapGestureRecognizer) {
if let view = gestureRecognizer.view {
if view.tag == Self.likeTag {
self.likeClick?()
} else if view.tag == Self.collectTag {
self.collectClick?()
} else if view.tag == Self.scanTag {
self.recentScanClick?()
}
}
}
@objc func didAvarImgViewTapped() {
if let avatarClickBlock = avatarClickBlock {
avatarClickBlock()
}
}
@objc func didNickNameTapped() {
if let nickNameClickBlock = nickNameClickBlock {
nickNameClickBlock()
}
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "头部背景图@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "头部背景图@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 2033197226@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 2033197226@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 2033197220@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 2033197220@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