fix
无故事王国
2024-03-04 54c6ef0be42d9f2e49a344fd69f231cb6df43797
WanPai/Root/Other/VC/LogOffVC.swift
@@ -9,50 +9,50 @@
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(){
            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)
         }
      }
   }
            @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(){
                                                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)
                                    }
                        }
            }
}