//
|
// LogOffVC.swift
|
// WanPai
|
//
|
// Created by 无故事王国 on 2023/11/15.
|
//
|
|
import UIKit
|
import WebKit
|
|
class LogOffVC: BaseVC {
|
|
@IBOutlet weak var webView: WKWebView!
|
|
private var timer:Timer?
|
private var time:Int = 6
|
@IBOutlet weak var btn_complete: UIButton!
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
title = "注销账号"
|
btn_complete.isEnabled = false
|
btn_complete.backgroundColor = .gray.withAlphaComponent(0.5)
|
Services.queryProtocol(.other,progress: false).subscribe(onNext: {[weak self] result in
|
if let text = result.data?.jq_wrapHtml(edge: .init(top: 5, left: 3, bottom: 0, right: 3)){
|
self?.webView.loadHTMLString(text, baseURL: nil)
|
}
|
}).disposed(by: disposeBag)
|
|
timer = Timer(timeInterval: 1.0, repeats: true, block: {[weak self] t in
|
guard let weakSelf = self else { return }
|
self?.time -= 1
|
self?.btn_complete.setTitle("确认(\(weakSelf.time))", for: .normal)
|
if self?.time == 0{
|
t.invalidate()
|
self?.btn_complete.isEnabled = true
|
self?.btn_complete.backgroundColor = Def_ThemeColor
|
self?.btn_complete.setTitle("确认", for: .normal)
|
}
|
})
|
timer?.fire()
|
RunLoop.current.add(timer!, forMode: .common)
|
}
|
|
@IBAction func cancelAction(_ sender: UIButton) {
|
navigationController?.popViewController()
|
}
|
|
@IBAction func completeAction(_ sender: Any) {
|
CommonAlertView.show(title: "提示", content: "确认注销账号?") { status in
|
if status{
|
Services.logOff().subscribe(onNext: {data in
|
app.needLogin()
|
}).disposed(by: self.disposeBag)
|
}
|
}
|
}
|
}
|