From a1ac0f1634ff0bd8f04259fc4cf7ebabd8c8c82d Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期二, 10 十月 2023 16:40:52 +0800 Subject: [PATCH] 修复BUG --- WanPai/Config/Def.swift | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 154 insertions(+), 1 deletions(-) diff --git a/WanPai/Config/Def.swift b/WanPai/Config/Def.swift index dd9ab18..45e9f3a 100644 --- a/WanPai/Config/Def.swift +++ b/WanPai/Config/Def.swift @@ -88,6 +88,159 @@ 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: "#FD8802").cgColor], cornerRadius: cornerRadius, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1), bounds: bounds) + 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 } } -- Gitblit v1.7.1