杨锴
2025-04-16 09a372bc45fde16fd42257ab6f78b8deeecf720b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//
//  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
//            }
//        }
                }
}