//
|
// SettingVC.swift
|
// XQMuse
|
//
|
// Created by 无故事王国 on 2024/8/20.
|
//
|
|
import UIKit
|
import JQTools
|
|
class SettingVC: BaseVC {
|
|
@IBOutlet weak var btn_exchange: UIButton!
|
@IBOutlet weak var btn_logout: UIButton!
|
@IBOutlet weak var btn_dispel: TapBtn!
|
@IBOutlet weak var label_version: UILabel!
|
@IBOutlet weak var btn_newVersion: UIButton!
|
private var model:VersionResultModel?
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
title = "设置"
|
btn_newVersion.isHidden = true
|
navigationController?.navigationBar.standardAppearance.backgroundColor = .white
|
navigationController?.navigationBar.scrollEdgeAppearance?.backgroundColor = .white
|
|
btn_exchange.isHidden = UserViewModel.getLoginInfo()?.accessToken.isEmpty ?? true
|
btn_logout.isHidden = UserViewModel.getLoginInfo()?.accessToken.isEmpty ?? true
|
btn_dispel.isHidden = UserViewModel.getLoginInfo()?.accessToken.isEmpty ?? true
|
|
label_version.text = JQTool.currentVersion()
|
|
JQTool.checkVersion(appid: AppleID) { state, model, url in
|
if state{
|
DispatchQueue.main.async {
|
self.btn_newVersion.isHidden = false
|
self.model = model
|
}
|
}
|
}
|
}
|
|
override func setUI() {
|
super.setUI()
|
view.backgroundColor = UIColor(hexString: "#fafafa")
|
btn_newVersion.jq_cornerRadius = 13.5
|
}
|
|
@IBAction func bindPhoneAction(_ sender: TapBtn) {
|
guard sceneDelegate!.checkisLoginState() else {return}
|
let vc = BindAccountVC()
|
push(vc: vc)
|
}
|
|
@IBAction func cancelCacheAction(_ sender: TapBtn) {
|
JQTool.cleanCache {
|
alertSuccess(msg: "清理成功")
|
}
|
}
|
|
@IBAction func aboutUsAction(_ sender: TapBtn) {
|
let vc = WebVC(type: .aboutUs)
|
vc.title = "关于泉疗愈"
|
push(vc: vc)
|
}
|
|
@IBAction func logoutAction(_ sender: TapBtn) {
|
let vc = LogoutAccountVC()
|
push(vc: vc)
|
}
|
|
@IBAction func blackListAction(_ sender: TapBtn) {
|
let vc = BlackListVC()
|
push(vc: vc)
|
}
|
|
@IBAction func treatyAction(_ sender: TapBtn) {
|
let vc = TreatyVC()
|
push(vc: vc)
|
}
|
|
@IBAction func checkVersion(_ sender: TapBtn) {
|
// JQTool.checkVersion(appid: AppleID) { stat, model, url in
|
// if stat{
|
// CommonAlertView.show(title: "版本更新", content: "发现新版本,是否更新?") { s in
|
// if let u = url, s == true{
|
// UIApplication.shared.open(u)
|
// }
|
// }
|
// }else{
|
// alert(msg: "当前已是最新版本")
|
// }
|
// }
|
}
|
|
@IBAction func newVersionAction(_ sender: Any) {
|
if let m = model{
|
UIApplication.shared.open(URL(string: m.trackViewUrl)!)
|
}
|
}
|
|
@IBAction func exchangeAccountAction(_ sender: UIButton) {
|
// CommonAlertView.show(title: "提示", content: "是否切换当前账号?") {[weak self] s in
|
// if s{
|
sceneDelegate?.needLogin()
|
self.btn_exchange.isHidden = true
|
self.btn_logout.isHidden = true
|
self.btn_dispel.isHidden = true
|
// }
|
// }
|
}
|
|
@IBAction func quitAccountAction(_ sender: UIButton) {
|
// CommonAlertView.show(title: "提示", content: "是否退出当前账号?") {[weak self] s in
|
// if s{
|
sceneDelegate?.needLogin()
|
self.btn_exchange.isHidden = true
|
self.btn_logout.isHidden = true
|
self.btn_dispel.isHidden = true
|
// }
|
// }
|
}
|
}
|