无故事王国
2023-10-26 152da0e2d8cd3bd522fb04d1114f0930c33c9fdf
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
//
//  Def.swift
//  WanPai
//
//  Created by 杨锴 on 2023/6/7.
//
 
import Foundation
import UIKit
import JQTools
import SVProgressHUD
import QMUIKit
 
let SHAKEY = "BT7NPhA0f775uzcUuftWjCE1TYZlWmHZ"
let WechatUniversalLinks = "https://www.weparklife.com/"
let WeChatAPPID = "wx41d32f362ba0f911"
let WeChatSecrect = "cf0ebf950f5926a69041a0e2bbe20f3e"
let APPScheme = "weparklife"
let AMapKey = "a2aff8a000be5543e410555c548793b8"
let WeChatMinProgram = "gh_fea25aea0fc8" //
let WeChatMinProgramPath = "pages-sub/web/index"
 
let app = UIApplication.shared.delegate as! AppDelegate
 
let locationTool = JQ_LocationTool.instance()
 
var sceneDelegate:SceneDelegate? = {
    var uiScreen:UIScene?
    UIApplication.shared.connectedScenes.forEach { scenes in
        uiScreen = scenes
    }
    return (uiScreen?.delegate as? SceneDelegate)
}()
 
 
 
func LogSuccess(_ items:Any...,separator:String=" ",file:String=#file,function:String=#function,line:Int=#line){
#if DEBUG
    let file = (file as NSString).lastPathComponent.split(separator: ".").first!;
    print("✅✅✅ SUCCESS: \(file)  \(function) [Line: \(line)]: \(items)",separator);
#endif
}
 
func LogError(_ items:Any...,separator:String=" ",file:String=#file,function:String=#function,line:Int=#line){
#if DEBUG
    let file = (file as NSString).lastPathComponent.split(separator: ".").first!;
    print("❌❌❌ ERROR: \(file)  \(function) [Line: \(line)]: \(items)",separator);
#endif
}
 
func LogInfo(_ items:Any...,separator:String=" ",file:String=#file,function:String=#function,line:Int=#line){
#if DEBUG
    let file = (file as NSString).lastPathComponent.split(separator: ".").first!;
    print("⚠️⚠️⚠️INFO: \(file)  \(function) [Line: \(line)]: \(items)",separator);
#endif
}
 
    //提示框
func alert(msg: String) {
//    hiddenHUD()
    SVProgressHUD.showInfo(withStatus: msg,maskType: .clear)
}
 
func alertError(msg:String){
//    hiddenHUD()
    SVProgressHUD.showError(withStatus: msg,maskType: .clear)
}
 
func alertSuccess(msg:String){
//    hiddenHUD()
    SVProgressHUD.showSuccess(withStatus: msg,maskType: .clear)
}
 
func showHUD(_ text:String? = nil){
    SVProgressHUD.setContainerView(sceneDelegate?.window)
    SVProgressHUD.show(withStatus: text)
}
 
func hiddenHUD(_ delay:TimeInterval? = nil){
    if delay != nil{
        SVProgressHUD.dismiss(withDelay: delay!)
    }else{
        SVProgressHUD.dismiss()
    }
}
 
extension UIButton {
    func localGradientColor(cornerRadius:Double,bounds:CGRect? = nil){
        self.layer.sublayers?.removeAll(where: {$0 is CAGradientLayer})
        self.jq_gradientColor(colorArr: [UIColor(hexStr: "#FD8802").cgColor,UIColor(hexStr: "#FE7703").cgColor], cornerRadius: cornerRadius, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1), bounds: bounds)
    }
 
    public func openCountDown(_ t:Int = 59,defultTitle:String = "获取验证码"){
        var time = t //倒计时时间
        let queue = DispatchQueue.global()
        let timer = DispatchSource.makeTimerSource(flags: [], queue: queue)
        timer.schedule(wallDeadline: DispatchWallTime.now(), repeating: .seconds(1));
        timer.setEventHandler(handler: {
            if time <= 0 {
                timer.cancel()
                DispatchQueue.main.async(execute: {
                    self.setTitle(defultTitle, for: .normal)
                    self.setTitleColor(UIColor(hexStr: "#63BDDB"), for: .normal)
                    self.isUserInteractionEnabled = true
                });
            }else {
                DispatchQueue.main.async(execute: {
                    self.setTitle("\(time)s", for: .normal)
                    self.setTitleColor(UIColor.gray, for: .normal)
                    self.isUserInteractionEnabled = false
                });
            }
            time -= 1
        });
        timer.resume()
    }
}
 
func jumpPage(name:String,page:String = "",type:String = "",id:Int? = nil){
 
    var storeModel:NormalSimpleModel?
    if let storeStr = UserDefaults.standard.object(forKey: "CurrentStore") as? String{
        if let deserModel = HomeStoreModel.deserialize(from: storeStr){
            storeModel = NormalSimpleModel(id: deserModel.storeId, name: deserModel.name)
        }
    }
 
    switch name {
        case "加入玩湃":
            if page == "主页"{}
 
            if page == "运动营列表"{
                if type == "详情"{
                    JQ_currentViewController().jq_push(vc: CourseDetailVC(id:id ?? 0))
                }else{
                    JQ_currentViewController().jq_push(vc: CourseListVC(selectStore: storeModel))
                }
            }
 
            if page == "赛事活动列表"{
                if type == "详情"{
                    JQ_currentViewController().jq_push(vc: ActivityDetailVC(id: id ?? 0))
                }else{
                    JQ_currentViewController().jq_push(vc: ActivityListVC())
                }
            }
 
            if page == "线上课得积分"{
                if type == "详情"{
 
                }else{
                    let vc = CourseOnlineListVC(position: 1)
                    vc.title = page
                    JQ_currentViewController().jq_push(vc: vc)
                }
            }
 
            if page == "看视频得奖励"{
                if type == "详情"{
                    let vc = CourseVideoDetailVC(id: id ?? 0)
                    vc.title = page
                }else{
                    let vc = CourseOnlineListVC(position: 2)
                    vc.title = page
                    JQ_currentViewController().jq_push(vc: vc)
                }
            }
 
            if page == "预约场地"{
                if type == "详情"{
                    JQ_currentViewController().jq_push(vc: YardDetailVC(id: id ?? 0))
                }else{
                    JQ_currentViewController().jq_push(vc: YardListVC(selectStore: storeModel))
                }
            }
 
            if page == "智慧球场"{
                JQ_currentViewController().jq_push(vc: GamesVC())
            }
 
            if page == "成为会员"{
                JQ_currentViewController().jq_push(vc: JoinMemberIntroduceVC())
            }
 
        case "开始运动营":
            if page == "主页"{
 
            }
 
        case "使用福利":
            if page == "主页"{
 
            }
 
            if page == "充值中心"{
                JQ_currentViewController().jq_push(vc: RechargeCenterVC())
            }
 
            if page == "积分商城"{
                if type == "主页"{
                    JQ_currentViewController().jq_push(vc: CoinStoreCenterVC())
                }
                if type == "指定商品"{
                    JQ_currentViewController().jq_push(vc: WelfareRedeemGoodsDetailVC(commodityId: id ?? 0, goodsType: .goods))
                }
            }
 
            if page == "本周福利"{
                if type == "限时折扣"{
                    JQ_currentViewController().jq_push(vc: WelfareWeeklyListVC(page: 0))
                }
                if type == "赠送课时"{
                    JQ_currentViewController().jq_push(vc: WelfareWeeklyListVC(page: 1))
                }
                if type == "指定折扣"{
                    JQ_currentViewController().jq_push(vc: WelfareWeeklyDetailVC(id: id ?? 0))
                }
            }
 
        case "探索玩湃":
            if page == "门店列表"{
 
            }
 
            if page == "常见问题"{
                if type == "列表"{
                    JQ_currentViewController().jq_push(vc: CustomerListVC(page: 1))
                }
                if type == "详情"{
                    JQ_currentViewController().jq_push(vc: CustomerContentDetailVC(id: id ?? 0, type: .QA))
                }
            }
 
            if page == "公告发布"{
                if type == "列表"{
                    JQ_currentViewController().jq_push(vc: CustomerListVC(page: 0))
                }
                if type == "详情"{
                    JQ_currentViewController().jq_push(vc: CustomerContentDetailVC(id: id ?? 0, type: .notice))
                }
            }
        default:break
    }
}