//
|
// MineAccountSecurityVC.swift
|
// OKProject
|
//
|
// Created by alvin_y on 2020/6/17.
|
// Copyright © 2020 yangwang. All rights reserved.
|
//
|
|
import UIKit
|
|
/// 账户安全
|
class MineAccountSecurityVC: YYTableViewController {
|
|
/// 数据源
|
private let dataSource = ["修改手机号","登录密码"]
|
|
/// 手机号
|
private var label_phone: UILabel?
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
|
// Do any additional setup after loading the view.
|
}
|
|
override func viewWillAppear(_ animated: Bool) {
|
super.viewWillAppear(animated)
|
if label_phone != nil{
|
label_phone?.text = app.userInfo.phone.safePhone()
|
}
|
}
|
|
//MARK: - UI
|
override func setupViews() {
|
super.setupViews()
|
navigationItem.title = "设置"
|
tableView.delegate = self
|
tableView.dataSource = self
|
tableView.tableFooterView = UIView()
|
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "item")
|
tableView.separatorColor = UIColor.color(light: UIColor.color(hexString: "#F6F6F6"), dark: UIColor.color(hexString: "#F6F6F6"))
|
}
|
}
|
// MARK: - UITableViewDelegate
|
extension MineAccountSecurityVC:UITableViewDelegate{
|
func numberOfSections(in tableView: UITableView) -> Int {
|
return 1
|
}
|
|
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
return 50
|
}
|
|
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
tableView.deselectRow(at: indexPath, animated: true)
|
switch dataSource[indexPath.row] {
|
case "修改手机号":
|
let vc = MineModifyPhoneVC()
|
self.yy_push(vc: vc)
|
break
|
default:
|
let vc = MineModifyPasswordVC()
|
self.yy_push(vc: vc)
|
break
|
}
|
}
|
}
|
|
// MARK: - UITableViewDelegate
|
extension MineAccountSecurityVC:UITableViewDataSource{
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
return dataSource.count
|
}
|
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
let cell = tableView.dequeueReusableCell(withIdentifier: "item", for: indexPath)
|
cell.textLabel?.text = dataSource[indexPath.row]
|
cell.textLabel?.font = Medium(font: 14)
|
cell.textLabel?.textColor = UIColor.color(light: UIColor.color(hexString: "#333333"), dark: UIColor.color(hexString: "#333333"))
|
cell.separatorInset = UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 14)
|
cell.accessoryType = .disclosureIndicator
|
let label_desc = UILabel()
|
label_desc.textColor = UIColor.color(light: UIColor.color(hexString: "#333333",0.4), dark: UIColor.color(hexString: "#333333",0.4))
|
label_desc.font = Medium(font: 14)
|
cell.contentView.addSubview(label_desc)
|
label_desc.snp.makeConstraints { (make) in
|
make.centerY.equalToSuperview()
|
make.right.equalToSuperview().offset(-14)
|
}
|
label_desc.isHidden = indexPath.row == 1
|
if indexPath.section == 0 && indexPath.row == 0{
|
label_desc.text = app.userInfo.phone.safePhone()
|
label_phone = label_desc
|
}
|
return cell
|
}
|
|
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
return section == 0 ? 0 : 5
|
}
|
|
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
|
let view = UIView()
|
view.backgroundColor = UIColor.color(light: UIColor.color(hexString: "#F3F4F5"), dark: UIColor.color(hexString: "#F3F4F5"))
|
return view
|
}
|
}
|