//
|
// MineSafeVC.swift
|
// OKProject
|
//
|
// Created by alvin_y on 2020/6/15.
|
// Copyright © 2020 yangwang. All rights reserved.
|
//
|
|
import UIKit
|
|
/// 安全
|
class MineSafeVC: YYTableViewController {
|
|
/// 紧急联系人
|
private let cell_contact: MineSafeCell = {
|
let cell = UINib.init(nibName: "MineSafeCell", bundle: Bundle.main).instantiate(withOwner: self, options: nil).first as! MineSafeCell
|
cell.label_name.text = "紧急联系人"
|
cell.separatorInset = UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 14)
|
cell.selectionStyle = .none
|
return cell
|
}()
|
|
/// 实名认证
|
private let cell_realName: MineSafeCell = {
|
let cell = UINib.init(nibName: "MineSafeCell", bundle: Bundle.main).instantiate(withOwner: self, options: nil).first as! MineSafeCell
|
cell.label_name.text = "实名认证"
|
cell.separatorInset = UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 14)
|
cell.selectionStyle = .none
|
return cell
|
}()
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
|
// Do any additional setup after loading the view.
|
}
|
|
override func viewWillAppear(_ animated: Bool) {
|
super.viewWillAppear(animated)
|
cell_contact.label_desc.text = app.userInfo.emergencyContact
|
cell_realName.label_desc.text = app.userInfo.verifiedFormat
|
}
|
|
|
//MARK: - UI
|
override func setupViews() {
|
super.setupViews()
|
navigationItem.title = "安全"
|
tableView.dataSource = self
|
tableView.delegate = self
|
tableView.separatorColor = UIColor.color(light: UIColor.color(hexString: "#000000",0.06), dark: UIColor.color(hexString: "#000000",0.06))
|
}
|
}
|
|
|
// MARK: - UITableViewDelegate
|
extension MineSafeVC:UITableViewDelegate{
|
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
return 50
|
}
|
|
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
if indexPath.row == 0{
|
let vc = MineContactVC.init(state: app.userInfo.emergencyContact == "" ? .add : .edit)
|
self.yy_push(vc: vc)
|
}else{
|
guard app.userInfo.verified != 2 else{return}
|
let vc = MineRealNameVC()
|
self.yy_push(vc: vc)
|
}
|
}
|
}
|
|
// MARK: - UITableViewDelegate
|
extension MineSafeVC:UITableViewDataSource{
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
return 2
|
}
|
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
return indexPath.row == 0 ? cell_contact : cell_realName
|
}
|
}
|