添加了webView
This commit is contained in:
170
yinmeng-ios/Modules/User/VC/UserInfoVC.swift
Normal file
170
yinmeng-ios/Modules/User/VC/UserInfoVC.swift
Normal file
@@ -0,0 +1,170 @@
|
||||
//
|
||||
// UserInfoVC.swift
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by MaiMang on 2024/2/25.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class UserInfoVC: BaseViewController, HiddenNavigationBarProtocol {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
loadSubView()
|
||||
}
|
||||
|
||||
private func loadSubView() {
|
||||
view.addSubview(backImgView)
|
||||
view.addSubview(titleLb)
|
||||
view.addSubview(rechargeView)
|
||||
view.addSubview(mobileView)
|
||||
view.addSubview(passwordView)
|
||||
view.addSubview(aboutView)
|
||||
view.addSubview(logOffView)
|
||||
view.addSubview(logoutBtn)
|
||||
|
||||
backImgView.snp.makeConstraints { make in
|
||||
make.edges.equalTo(view)
|
||||
}
|
||||
|
||||
titleLb.snp.makeConstraints { make in
|
||||
make.centerX.equalTo(view)
|
||||
make.top.equalTo(view).offset(StatusBarHeight + 10)
|
||||
make.height.equalTo(25)
|
||||
}
|
||||
|
||||
rechargeView.snp.makeConstraints { make in
|
||||
make.left.right.equalTo(view).inset(28)
|
||||
make.height.equalTo(68)
|
||||
make.top.equalTo(view).offset(NavHeight + 20)
|
||||
}
|
||||
|
||||
mobileView.snp.makeConstraints { make in
|
||||
make.left.equalTo(view).offset(28)
|
||||
make.height.equalTo(68)
|
||||
make.top.equalTo(rechargeView.snp.bottom).offset(12)
|
||||
make.right.equalTo(passwordView.snp.left).offset(-11)
|
||||
}
|
||||
|
||||
passwordView.snp.makeConstraints { make in
|
||||
make.centerY.height.width.equalTo(mobileView)
|
||||
make.right.equalTo(view).offset(-28)
|
||||
}
|
||||
|
||||
aboutView.snp.makeConstraints { make in
|
||||
make.width.centerX.height.equalTo(mobileView)
|
||||
make.top.equalTo(mobileView.snp.bottom).offset(12)
|
||||
}
|
||||
|
||||
logOffView.snp.makeConstraints { make in
|
||||
make.width.centerX.height.equalTo(passwordView)
|
||||
make.centerY.equalTo(aboutView)
|
||||
}
|
||||
|
||||
logoutBtn.snp.makeConstraints { make in
|
||||
make.left.right.equalTo(view).inset(40)
|
||||
make.height.equalTo(48)
|
||||
make.top.equalTo(logOffView.snp.bottom).offset(48)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@objc func logoutBtnAction() {
|
||||
//TODO: 退出登录
|
||||
}
|
||||
|
||||
private lazy var backImgView: UIImageView = {
|
||||
let imageView = UIImageView()
|
||||
imageView.image = UIImage(named: "auth_login_bg")
|
||||
imageView.isUserInteractionEnabled = true
|
||||
imageView.layer.masksToBounds = true
|
||||
imageView.contentMode = .scaleAspectFill
|
||||
return imageView
|
||||
}()
|
||||
|
||||
private lazy var titleLb: UILabel = {
|
||||
let label = UILabel()
|
||||
label.textColor = .white
|
||||
label.font = UIFont.systemFont(ofSize: 18, weight: .medium)
|
||||
label.text = "我的"
|
||||
return label
|
||||
}()
|
||||
|
||||
private lazy var rechargeView: UserFunctionView = {
|
||||
let view = UserFunctionView()
|
||||
view.delegate = self
|
||||
let item = UserFunctionItem(title: "充值", isHiddenIcon: false ,itmeType: .recharge)
|
||||
view.item = item
|
||||
return view
|
||||
}()
|
||||
|
||||
private lazy var mobileView: UserFunctionView = {
|
||||
let view = UserFunctionView()
|
||||
view.delegate = self
|
||||
let item = UserFunctionItem(title: "手机号码", isHiddenIcon: true ,itmeType: .mobile)
|
||||
view.item = item
|
||||
return view
|
||||
}()
|
||||
|
||||
|
||||
private lazy var passwordView: UserFunctionView = {
|
||||
let view = UserFunctionView()
|
||||
view.delegate = self
|
||||
let item = UserFunctionItem(title: "设置密码", isHiddenIcon: true ,itmeType: .password)
|
||||
view.item = item
|
||||
return view
|
||||
}()
|
||||
|
||||
private lazy var aboutView: UserFunctionView = {
|
||||
let view = UserFunctionView()
|
||||
view.delegate = self
|
||||
let item = UserFunctionItem(title: "关于", isHiddenIcon: true ,itmeType: .about)
|
||||
view.item = item
|
||||
return view
|
||||
}()
|
||||
|
||||
private lazy var logOffView: UserFunctionView = {
|
||||
let view = UserFunctionView()
|
||||
view.delegate = self
|
||||
let item = UserFunctionItem(title: "注销账号", isHiddenIcon: true ,itmeType: .logoff)
|
||||
view.item = item
|
||||
return view
|
||||
}()
|
||||
|
||||
|
||||
private lazy var logoutBtn: UIButton = {
|
||||
let button = UIButton(type: .custom)
|
||||
button.setBackgroundImage(UIImage.gradient([ThemeColor(hexStr: "#FFC926"), ThemeColor(hexStr: "#FFE784")], radius: 0), for: .normal)
|
||||
button.setTitle("退出登录", for: .normal)
|
||||
button.setTitleColor(UIColor.white, for: .normal)
|
||||
button.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
|
||||
button.layer.masksToBounds = true
|
||||
button.layer.cornerRadius = 24
|
||||
button.addTarget(self, action: #selector(logoutBtnAction), for: .touchUpInside)
|
||||
return button
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
|
||||
extension UserInfoVC: UserFunctionViewProtocol{
|
||||
func didClickItem(type: UserFunctionType) {
|
||||
switch type {
|
||||
case .recharge:
|
||||
//TODO: 充值
|
||||
print("aaa")
|
||||
case .mobile:
|
||||
//TODO: 手机号
|
||||
print("aaa")
|
||||
case .password:
|
||||
//TODO: 修改密码
|
||||
print("aaa")
|
||||
case .logoff:
|
||||
let web = WebViewController(url: "yinmeng/\(H5Utils.logoff.rawValue)")
|
||||
self.navigationController?.pushViewController(web, animated: true)
|
||||
case .about:
|
||||
self.navigationController?.pushViewController(AboutUsVC(), animated: true)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user