From 2004d0578480d12cd69c4d42d414ffd11828d0f1 Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期四, 31 十月 2024 20:18:47 +0800 Subject: [PATCH] fix bug --- XQMuse/Root/Course/VC/CourseDetialVC.swift | 10 XQMuse/Root/Me/VC/InviteVC.swift | 4 XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift | 2 XQMuse/Root/Home/TCell/Home_Style_4_TCell.swift | 2 Pods/Pods.xcodeproj/project.pbxproj | 7 XQMuse/Root/Home/VC/PaymentOrderVC.swift | 26 ++ XQMuse/Root/Me/VC/WatchHistoryDetailVC.swift | 8 XQMuse/Assets.xcassets/AppIcon.appiconset/Contents.json | 77 +++++++++ XQMuse/Root/Home/VC/SearchContentVC.swift | 2 XQMuse.xcodeproj/project.pbxproj | 3 XQMuse/Root/Home/View/PaymentOrderResultTopView.swift | 25 ++ XQMuse/Root/Other/View/CountdownChooseListView.swift | 56 ++++-- XQMuse/Root/Login/VC/RegisterVC.swift | 1 XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.swift | 10 + XQMuse/Root/Home/VC/HomeItemListVC.swift | 2 XQMuse/Root/Home/VC/PaymentOrderResultVC.swift | 53 +++++- XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift | 19 +- XQMuse/Root/Home/VC/HomeItemDetailVC.swift | 17 + XQMuse/SceneDelegate.swift | 53 +++-- XQMuse/Root/Plans/PlanGuideVC.swift | 4 XQMuse/Root/Home/HomeVC.swift | 6 XQMuse/Root/Me/MeVC.swift | 3 XQMuse/Root/Home/TCell/Home_Style_5_TCell.swift | 3 XQMuse/Root/Network/Services.swift | 25 ++ XQMuse/Root/Other/View/ShareView.swift | 8 25 files changed, 317 insertions(+), 109 deletions(-) diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj index 87df656..62a1eb4 100644 --- a/Pods/Pods.xcodeproj/project.pbxproj +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -14000,7 +14000,7 @@ GCC_PREFIX_HEADER = "Target Support Files/HandyJSON/HandyJSON-prefix.pch"; INFOPLIST_FILE = "Target Support Files/HandyJSON/HandyJSON-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -14011,7 +14011,8 @@ PRODUCT_NAME = HandyJSON; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -15657,7 +15658,7 @@ GCC_PREFIX_HEADER = "Target Support Files/HandyJSON/HandyJSON-prefix.pch"; INFOPLIST_FILE = "Target Support Files/HandyJSON/HandyJSON-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/XQMuse.xcodeproj/project.pbxproj b/XQMuse.xcodeproj/project.pbxproj index a1a4809..fd49568 100644 --- a/XQMuse.xcodeproj/project.pbxproj +++ b/XQMuse.xcodeproj/project.pbxproj @@ -1889,6 +1889,7 @@ ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu17; GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -1922,6 +1923,7 @@ "$(inherited)", "$(PROJECT_DIR)/XQMuse/Config/SDK", ); + GCC_OPTIMIZATION_LEVEL = s; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = XQMuse/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "心泉冥想"; @@ -2076,6 +2078,7 @@ "$(inherited)", "$(PROJECT_DIR)/XQMuse/Config/SDK", ); + GCC_OPTIMIZATION_LEVEL = s; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = XQMuse/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "心泉冥想"; diff --git a/XQMuse/Assets.xcassets/AppIcon.appiconset/Contents.json b/XQMuse/Assets.xcassets/AppIcon.appiconset/Contents.json index 13613e3..637124a 100644 --- a/XQMuse/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/XQMuse/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,13 +1,80 @@ { "images" : [ { - "idiom" : "universal", - "platform" : "ios", + "idiom" : "iphone", + "filename" : "icon-small.png", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "filename" : "icon-small@2x.png", + "size" : "29x29" + }, + { + "scale" : "3x", + "idiom" : "iphone", + "filename" : "icon-small@3x.png", + "size" : "29x29" + }, + { + "scale" : "2x", + "idiom" : "iphone", + "size" : "40x40", + "filename" : "icon-40@2x.png" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "icon-40@3x.png", + "scale" : "3x" + }, + { + "scale" : "1x", + "size" : "57x57", + "filename" : "icon.png", + "idiom" : "iphone" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "57x57", + "filename" : "icon@2x.png" + }, + { + "filename" : "icon-60@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60", + "filename" : "icon-60@3x.png" + }, + { + "idiom" : "iphone", + "filename" : "notification-icon@2x.png", + "size" : "20x20", + "scale" : "2x" + }, + { + "scale" : "3x", + "filename" : "notification-icon@3x.png", + "size" : "20x20", + "idiom" : "iphone" + }, + { + "scale" : "1x", + "idiom" : "ios-marketing", + "filename" : "ios-marketing.png", "size" : "1024x1024" } ], "info" : { - "author" : "xcode", - "version" : 1 + "version" : "4.1", + "author" : "AssetsGen" } -} +} \ No newline at end of file diff --git a/XQMuse/Root/Course/VC/CourseDetialVC.swift b/XQMuse/Root/Course/VC/CourseDetialVC.swift index 6503f1f..637f0d1 100644 --- a/XQMuse/Root/Course/VC/CourseDetialVC.swift +++ b/XQMuse/Root/Course/VC/CourseDetialVC.swift @@ -248,9 +248,13 @@ } @objc func shareAction(){ - // xqzhihui.com/courseOnline 线上课程详情 -// xqzhihui.com/courseOffOnline 线下课程详情 - ShareView.show(URL(string: "xqzhihui.com/courseOffOnline")!) + + + guard let m = courseDetailModel else{return} + + let path = courseDetailModel!.courseType == .offline ? "/courseDetail/offLine":"/courseDetail/onLine" + let string = String(format: "%@%@?courseId=%ld", ShareUrl,path,m.id) + ShareView.show(URL(string: string)!,title: m.courseTitle,desc: m.description) } @objc func handleAction(_ btn:QMUIButton){ diff --git a/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift b/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift index 5090154..439d2c3 100644 --- a/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift +++ b/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift @@ -25,6 +25,7 @@ super.awakeFromNib() // Initialization code jq_cornerRadius = 25 + view_price.jq_cornerRadius = 12.55 } func setMeditationModel(_ model:MeditationModel){ @@ -65,15 +66,15 @@ view_price.isHidden = true img_vip.isHidden = true return - } - - switch model.chargeType { - case .payment: - image_free.isHidden = true - view_price.isHidden = false - label_price.attributedText = AttributedStringbuilder.build().add(string: "¥", withFont: UIFont(name: "DIN-Bold", size: 7.11) ?? UIFont.systemFont(ofSize: 7, weight: .bold), withColor: .white).add(string: "\(model.generalPrice.jq_formatFloat)", withFont: UIFont(name: "DIN-Bold", size: 11.44) ?? .systemFont(ofSize: 11,weight: .bold), withColor: .white).mutableAttributedString - default:break + }else{ + img_offine.isHidden = true + switch model.chargeType { + case .payment: + image_free.isHidden = true + view_price.isHidden = false + label_price.attributedText = AttributedStringbuilder.build().add(string: "¥", withFont: UIFont(name: "DIN-Bold", size: 7.11) ?? UIFont.systemFont(ofSize: 7, weight: .bold), withColor: .white).add(string: "\(model.generalPrice.jq_formatFloat)", withFont: UIFont(name: "DIN-Bold", size: 11.44) ?? .systemFont(ofSize: 11,weight: .bold), withColor: .white).mutableAttributedString + default:break + } } } - } diff --git a/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.swift b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.swift index e1df9ac..b3e4722 100644 --- a/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.swift +++ b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.swift @@ -56,6 +56,16 @@ } } + func setMeditationModel(_ model:MeditationModel){ + img_cover.sd_setImage(with: URL(string: model.coverUrl)) + label_title.text = model.meditationTitle + label_subTitle.text = model.coverDescription + label_num.text = "\(model.realLearnedNum)" + + img_offline.isHidden = true + setChargePrice(model.chargeType, price: model.generalPrice) + } + private func setChargePrice(_ type:ChargeType,price:Double){ image_free.isHidden = type != .free diff --git a/XQMuse/Root/Home/HomeVC.swift b/XQMuse/Root/Home/HomeVC.swift index e1ccfcc..c5f5ae6 100644 --- a/XQMuse/Root/Home/HomeVC.swift +++ b/XQMuse/Root/Home/HomeVC.swift @@ -191,6 +191,12 @@ Services.getMeditationAndCateList().subscribe(onNext: { data in if let m = data.data{ self.viewModel.meditationList.removeAll() + self.titleItems.removeAll() + self.titleItems.append(TitleItem(title: "每日疗愈", subTitle: "Daily Meditation")) + self.titleItems.append(TitleItem(title: "私人订制", subTitle: "Private Meditation",hasMore: true)) + self.titleItems.append(TitleItem(title: "新手冥想指南", subTitle: "Meditation guide")) + + self.viewModel.meditationList = m for v in self.viewModel.meditationList{ if v.clientMeditationCategoryVO?.categoryName.isEmpty ?? true{continue} diff --git a/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift b/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift index 3c660d4..2478dd3 100644 --- a/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift +++ b/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift @@ -56,7 +56,7 @@ } if m.chargeType == .payment && m.paidStatus == .no{ - let vc = PaymentOrderVC(id: m.id,type: .muse,giftToOther: true) + let vc = PaymentOrderVC(id: m.id,type: .muse) JQ_currentViewController().jq_push(vc: vc) return } diff --git a/XQMuse/Root/Home/TCell/Home_Style_4_TCell.swift b/XQMuse/Root/Home/TCell/Home_Style_4_TCell.swift index a132a7e..d1b2c48 100644 --- a/XQMuse/Root/Home/TCell/Home_Style_4_TCell.swift +++ b/XQMuse/Root/Home/TCell/Home_Style_4_TCell.swift @@ -50,7 +50,7 @@ let vc = VIPCenterVC() JQ_currentViewController().jq_push(vc: vc) }else{ - let vc = PaymentOrderVC(id: m.id,type: .muse,giftToOther: true) + let vc = PaymentOrderVC(id: m.id,type: .muse) JQ_currentViewController().jq_push(vc:vc) } } diff --git a/XQMuse/Root/Home/TCell/Home_Style_5_TCell.swift b/XQMuse/Root/Home/TCell/Home_Style_5_TCell.swift index e03eb46..fcba4cf 100644 --- a/XQMuse/Root/Home/TCell/Home_Style_5_TCell.swift +++ b/XQMuse/Root/Home/TCell/Home_Style_5_TCell.swift @@ -62,7 +62,8 @@ @objc func tapAction(_ btn:UIButton){ let index = btn.tag - 1000 - let vc = HomeItemDetailVC(id: items[index].id) + + let vc = HomeItemListVC(topTitle: items[index].title, id: items[index].id) JQ_currentViewController().jq_push(vc: vc) } } diff --git a/XQMuse/Root/Home/VC/HomeItemDetailVC.swift b/XQMuse/Root/Home/VC/HomeItemDetailVC.swift index ca7a6ad..9428343 100644 --- a/XQMuse/Root/Home/VC/HomeItemDetailVC.swift +++ b/XQMuse/Root/Home/VC/HomeItemDetailVC.swift @@ -161,9 +161,17 @@ } @IBAction func timeAction(_ sender: UIButton) { - CountdownChooseListView.show {[weak self] times in + CountdownChooseListView.show {[weak self] status in guard let weakSelf = self else { return } - weakSelf.audioPlayer.setTimer(times: times * 60) + + switch status { + case .close: + weakSelf.audioPlayer.stopTimer() + case .choose(let times): + weakSelf.audioPlayer.setTimer(times: times * 60) + } + + // if times <= 0{ // weakSelf.timer = nil @@ -233,7 +241,10 @@ } @objc func shareAction(){ - ShareView.show(URL(string:"xqzhihui.com/meditation")!) + guard let m = model else {return} + + let string = String(format: "%@%@?id=%ld", ShareUrl,"/healDetail/healDetail",m.id) + ShareView.show(URL(string:string)!,title: m.meditationTitle,desc: m.detailDescription) } override func viewDidLayoutSubviews() { diff --git a/XQMuse/Root/Home/VC/HomeItemListVC.swift b/XQMuse/Root/Home/VC/HomeItemListVC.swift index cd4cacd..0894548 100644 --- a/XQMuse/Root/Home/VC/HomeItemListVC.swift +++ b/XQMuse/Root/Home/VC/HomeItemListVC.swift @@ -88,7 +88,7 @@ let vc = VIPCenterVC() jq_push(vc: vc) }else{ - let vc = PaymentOrderVC(id: m.id,type: .muse,giftToOther: true) + let vc = PaymentOrderVC(id: m.id,type: .muse) jq_push(vc: vc) } } diff --git a/XQMuse/Root/Home/VC/PaymentOrderResultVC.swift b/XQMuse/Root/Home/VC/PaymentOrderResultVC.swift index c0b4616..fa83395 100644 --- a/XQMuse/Root/Home/VC/PaymentOrderResultVC.swift +++ b/XQMuse/Root/Home/VC/PaymentOrderResultVC.swift @@ -11,13 +11,15 @@ var collectionView:UICollectionView! private let topView = PaymentOrderResultTopView.jq_loadNibView() - private var courseId:Int! + private var id:Int! + private var type:PaymentOrderVC.PaymentOrderType! private var price:Double! - private var models = [CourseModel]() + private var models = [Any]() - init(courseId:Int,price:Double) { + init(type:PaymentOrderVC.PaymentOrderType,id:Int,price:Double) { super.init(nibName: nil, bundle: nil) - self.courseId = courseId + self.id = id + self.type = type self.price = price } @@ -53,12 +55,21 @@ } } - topView.setPrice(courseId: courseId, price: price) + topView.setPrice(type: type, id: id, price: price) - Services.paymentSuccess(courseId: courseId).subscribe(onNext: {data in - self.models = data.data ?? [] - self.collectionView.reloadData() - }).disposed(by: disposeBag) + if type == .course{ + Services.coursePaymentSuccess(courseId: id).subscribe(onNext: {data in + self.models = data.data ?? [] + self.collectionView.reloadData() + }).disposed(by: disposeBag) + } + + if type == .muse{ + Services.musePaymentSuccess(meditationId: id).subscribe(onNext: {data in + self.models = data.data ?? [] + self.collectionView.reloadData() + }).disposed(by: disposeBag) + } } override func setUI() { @@ -123,15 +134,31 @@ } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - let model = models[indexPath.row] - let vc = CourseDetialVC(courseId: model.id) - push(vc: vc) + + switch type { + case .course: + let model = models[indexPath.row] as! CourseModel + let vc = CourseDetialVC(courseId: model.id) + push(vc: vc) + case .muse: + let model = models[indexPath.row] as! MeditationModel + let vc = HomeItemDetailVC(id: model.id) + push(vc: vc) + case .none:break + } } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBanner_2_1_CCell", for: indexPath) as! HomeRelaxBanner_2_1_CCell let model = models[indexPath.row] - cell.setCourseModel(model) + + if let m = model as? CourseModel{ + cell.setCourseModel(m) + } + + if let m = model as? MeditationModel{ + cell.setMeditationModel(m) + } return cell } diff --git a/XQMuse/Root/Home/VC/PaymentOrderVC.swift b/XQMuse/Root/Home/VC/PaymentOrderVC.swift index f4832e9..bae25cc 100644 --- a/XQMuse/Root/Home/VC/PaymentOrderVC.swift +++ b/XQMuse/Root/Home/VC/PaymentOrderVC.swift @@ -160,13 +160,26 @@ @IBAction func completeAction(_ sender: UIButton) { - guard let m = courseModel else {return} + + var money:Double = 0 + var id:Int = 0 + + if let m = courseModel{ + money = m.generalPrice + id = m.id + } + + if let m = museModel{ + money = m.generalPrice + id = m.id + } + + guard btn_isRead.isSelected else { alertError(msg: "请先阅读并同意《课程/疗愈音频购买协议》");return } if giftToOther { - guard !tf_phone.text!.isEmpty else { alertError(msg: "请输入您要赠送人的手机号");return } @@ -176,7 +189,7 @@ } } - guard balance > m.generalPrice else{ + guard balance > money else{ CommonAlertView.show(title: "提示", content: "当前余额不足,请先充值", cancelStr: "暂不充值", completeStr: "去充值", isSingle: false) { state in if state{ @@ -185,7 +198,10 @@ return } - let vc = PaymentOrderResultVC(courseId: id, price: m.generalPrice) - push(vc: vc) + Services.gvieCourse(orderForm: type, targetId: id,receiverId: giftUserId).subscribe(onNext: {[weak self]data in + guard let weakSelf = self else { return } + let vc = PaymentOrderResultVC(type: weakSelf.type, id: id, price: money) + self?.push(vc: vc) + }).disposed(by: disposeBag) } } diff --git a/XQMuse/Root/Home/VC/SearchContentVC.swift b/XQMuse/Root/Home/VC/SearchContentVC.swift index 98787a6..79c77d6 100644 --- a/XQMuse/Root/Home/VC/SearchContentVC.swift +++ b/XQMuse/Root/Home/VC/SearchContentVC.swift @@ -154,7 +154,7 @@ let vc = VIPCenterVC() JQ_currentViewController().jq_push(vc: vc) }else{ - let vc = PaymentOrderVC(id: m.id,type: .muse,giftToOther: true) + let vc = PaymentOrderVC(id: m.id,type: .muse) JQ_currentViewController().jq_push(vc:vc) } } diff --git a/XQMuse/Root/Home/View/PaymentOrderResultTopView.swift b/XQMuse/Root/Home/View/PaymentOrderResultTopView.swift index bfad3e9..d935306 100644 --- a/XQMuse/Root/Home/View/PaymentOrderResultTopView.swift +++ b/XQMuse/Root/Home/View/PaymentOrderResultTopView.swift @@ -12,15 +12,22 @@ @IBOutlet weak var label_price: UILabel! @IBOutlet weak var btn_lookCourse: UIButton! - private var courseId:Int! + private var id:Int! + private var type:PaymentOrderVC.PaymentOrderType! override func awakeFromNib() { super.awakeFromNib() } - func setPrice(courseId:Int,price:Double){ - self.courseId = courseId + func setPrice(type:PaymentOrderVC.PaymentOrderType,id:Int,price:Double){ + self.id = id + self.type = type label_price.text = "\(price.jq_formatFloat)" + + switch type { + case .course:btn_lookCourse.setTitle("查看课程", for: .normal) + case .muse:btn_lookCourse.setTitle("查看疗愈", for: .normal) + } } @IBAction func backRootAction(_ sender: UIButton) { @@ -28,8 +35,16 @@ } @IBAction func lookCourseAction(_ sender: UIButton) { - let vc = CourseDetialVC(courseId: courseId) - JQ_currentViewController().jq_push(vc: vc) + + if type == .course{ + let vc = CourseDetialVC(courseId: id) + JQ_currentViewController().jq_push(vc: vc) + } + + if type == .muse{ + let vc = HomeItemDetailVC(id: id) + JQ_currentViewController().jq_push(vc: vc) + } } diff --git a/XQMuse/Root/Login/VC/RegisterVC.swift b/XQMuse/Root/Login/VC/RegisterVC.swift index acc3c80..69f4423 100644 --- a/XQMuse/Root/Login/VC/RegisterVC.swift +++ b/XQMuse/Root/Login/VC/RegisterVC.swift @@ -118,6 +118,7 @@ if let model = data.data{ sceneDelegate?.loginSuccess() UserViewModel.saveAvatarInfo(model) + self.dismiss(animated: true) } }).disposed(by: self.disposeBag) } diff --git a/XQMuse/Root/Me/MeVC.swift b/XQMuse/Root/Me/MeVC.swift index 1626e5a..92c2150 100644 --- a/XQMuse/Root/Me/MeVC.swift +++ b/XQMuse/Root/Me/MeVC.swift @@ -143,7 +143,7 @@ } @objc func rankAction(){ - let vc = WebVC() + let vc = WebVC(url: ShareUrl + "/ranking/ranking?userId=\(UserViewModel.getAvatarInfo().id)") vc.title = "爱心榜单" push(vc: vc) } @@ -223,7 +223,6 @@ @IBAction func shareAction(_ sender: QMUIButton) { let vc = InviteVC() push(vc: vc) -// ShareView.show(URL(string: "xqzhihui.com/commission")!) } } diff --git a/XQMuse/Root/Me/VC/InviteVC.swift b/XQMuse/Root/Me/VC/InviteVC.swift index 9adf25f..571c863 100644 --- a/XQMuse/Root/Me/VC/InviteVC.swift +++ b/XQMuse/Root/Me/VC/InviteVC.swift @@ -40,7 +40,9 @@ } @IBAction func shareAction(_ sender: UIButton) { - ShareView.show("测试") + + let string = String(format: "%@%@?userId=%ld", ShareUrl,"/poster/poster",UserViewModel.getAvatarInfo().id) + ShareView.show(URL(string: string)!, title: "心泉疗愈", desc: "心泉疗愈1") } } diff --git a/XQMuse/Root/Me/VC/WatchHistoryDetailVC.swift b/XQMuse/Root/Me/VC/WatchHistoryDetailVC.swift index 851e738..fd33903 100644 --- a/XQMuse/Root/Me/VC/WatchHistoryDetailVC.swift +++ b/XQMuse/Root/Me/VC/WatchHistoryDetailVC.swift @@ -84,11 +84,11 @@ let m = viewModel.dataSource.value[indexPath.row] if viewModel.state.value == 1{ - let vc = HomeItemDetailVC(id: m.businessId) - JQ_currentViewController().jq_push(vc: vc) + let vc = CourseDetialVC(courseId: m.businessId) + JQ_currentViewController().jq_push(vc: vc) }else{ - let vc = CourseDetialVC(courseId: m.businessId) - JQ_currentViewController().jq_push(vc: vc) + let vc = HomeItemDetailVC(id: m.businessId) + JQ_currentViewController().jq_push(vc: vc) } } } diff --git a/XQMuse/Root/Network/Services.swift b/XQMuse/Root/Network/Services.swift index 4efaf0d..d82f725 100644 --- a/XQMuse/Root/Network/Services.swift +++ b/XQMuse/Root/Network/Services.swift @@ -16,8 +16,11 @@ let All_Url = "http://192.168.110.64:9000" //let All_Url = "https://mock.apipost.net/mock/31b303c60464000" #else -let All_Url = "http://" //正式地址 +let All_Url = "http://192.168.110.64:9000" #endif + +let ShareUrl = "http://113.45.158.158/share/#/pages" + class Services: NSObject { @@ -335,6 +338,16 @@ .append(key: "apipost_id", value: "2d2eb9d23993be") return NetworkRequest.request(params: params, method: .get, progress: true) } + + class func gvieCourse(orderForm:PaymentOrderVC.PaymentOrderType,targetId:Int,receiverId:Int? = nil)->Observable<BaseResponse<SimpleModel>>{ + let params = ParamsAppender.build(url: All_Url) + params.interface(url: "/order/client/order/order/gvieCourse") + .append(key: "orderFrom", value: orderForm == .course ? 2:1) + .append(key: "payType", value: 2) + .append(key: "targetId", value: targetId) + .append(key: "receiverId", value: receiverId) + return NetworkRequest.request(params: params, method: .post, progress: true) + } } /// 疗愈馆 @@ -416,7 +429,7 @@ } /// 支付成功 - class func paymentSuccess(courseId:Int)->Observable<BaseResponse<[CourseModel]>>{ + class func coursePaymentSuccess(courseId:Int)->Observable<BaseResponse<[CourseModel]>>{ let params = ParamsAppender.build(url: All_Url) params.interface(url: "/course/client/course/course/successOrder") .append(key: "courseId", value: courseId) @@ -424,6 +437,14 @@ return NetworkRequest.request(params: params, method: .post, progress: true) } + /// 支付成功 + class func musePaymentSuccess(meditationId:Int)->Observable<BaseResponse<[MeditationModel]>>{ + let params = ParamsAppender.build(url: All_Url) + params.interface(url: "/meditation/client/meditation/meditation/successOrder") + .append(key: "meditationId", value: meditationId) + return NetworkRequest.request(params: params, method: .post, progress: true) + } + class func getUserBalance()->Observable<BaseResponse<Double>>{ let params = ParamsAppender.build(url: All_Url) params.interface(url: "/user/client/app-user/getUserBalance") diff --git a/XQMuse/Root/Other/View/CountdownChooseListView.swift b/XQMuse/Root/Other/View/CountdownChooseListView.swift index 80acca1..255602c 100644 --- a/XQMuse/Root/Other/View/CountdownChooseListView.swift +++ b/XQMuse/Root/Other/View/CountdownChooseListView.swift @@ -22,7 +22,7 @@ @IBOutlet weak var cons_bottom: NSLayoutConstraint! @IBOutlet weak var tf_input: UITextField! private var disposeBag = DisposeBag() - private var clouse:((Int)->Void)? + private var clouse:((CountDownStatus)->Void)? private var status:CountDownStatus = .close var numberMinutes = 1 @@ -68,7 +68,7 @@ } - static func show(clouse:@escaping (Int)->Void){ + static func show(clouse:@escaping (CountDownStatus)->Void){ let countdownChooseListView = CountdownChooseListView.jq_loadNibView() countdownChooseListView.clouse = clouse countdownChooseListView.frame = sceneDelegate?.window?.frame ?? .zero @@ -107,7 +107,7 @@ endEditing(true) if case .choose(let v) = status { - clouse?(v) + clouse?(status) } cons_bottom.constant = -JQ_ScreenH @@ -146,30 +146,40 @@ @IBAction func clickAction(_ sender: TapBtn) { endEditing(true) + + for subView in stackView.arrangedSubviews as! [TapBtn]{ if subView.tag == sender.tag{ - for v in subView.subviews{ - if let label = v as? UILabel{ - label.textColor = UIColor(hexString: "#8AAE65") - switch label.text { - case "关闭倒计时": - numberMinutes = -1 - status = .close - case "自定义","分钟": - numberMinutes = self.tf_input.text!.int ?? 1 - status = .choose(numberMinutes) - default: - numberMinutes = label.text?.jq_filterNum().int ?? 0 - self.tf_input.text = numberMinutes.string - status = .choose(numberMinutes) - } - } + var text:String? + for v in subView.subviews{ + if let label = v as? UILabel{ + label.textColor = UIColor(hexString: "#8AAE65") + text = label.text + break + } + } - if let image = v as? UIImageView{ - image.image = UIImage(named: "icon_choose_small_s") - } - } + for v in subView.subviews{ + if let image = v as? UIImageView{ + image.image = UIImage(named: "icon_choose_small_s") + break + } + } + + + switch text! { + case "关闭倒计时": + numberMinutes = -1 + status = .close + case "自定义": + numberMinutes = self.tf_input.text!.int ?? 1 + status = .choose(numberMinutes) + default: + numberMinutes = text!.jq_filterNum().int ?? 0 + tf_input.text = numberMinutes.string + status = .choose(numberMinutes) + } }else{ for v in subView.subviews{ if let label = v as? UILabel{ diff --git a/XQMuse/Root/Other/View/ShareView.swift b/XQMuse/Root/Other/View/ShareView.swift index c79fefb..17da856 100644 --- a/XQMuse/Root/Other/View/ShareView.swift +++ b/XQMuse/Root/Other/View/ShareView.swift @@ -17,6 +17,8 @@ @IBOutlet weak var btn_save: TapBtn! private var shareContent:Any! private var scene:WXScene! + private var title:String! + private var desc:String! override func awakeFromNib() { super.awakeFromNib() @@ -30,9 +32,11 @@ btn_save.isHidden = true } - static func show(_ content:Any){ + static func show(_ content:Any,title:String,desc:String){ let shareView = ShareView.jq_loadNibView() shareView.shareContent = content + shareView.title = title + shareView.desc = desc sceneDelegate?.window?.addSubview(shareView) shareView.frame = sceneDelegate?.window?.frame ?? .zero shareView.cons_bottom.constant = 0 @@ -69,7 +73,7 @@ } if let url = shareContent as? URL{ - WeChatTools.shareUrl(url.absoluteString, title: "疗愈", desc: "测", thumb:UIImage()) + WeChatTools.shareUrl(url.absoluteString, title: title, desc: desc, thumb:UIImage()) } } } diff --git a/XQMuse/Root/Plans/PlanGuideVC.swift b/XQMuse/Root/Plans/PlanGuideVC.swift index 21e8199..43d3a42 100644 --- a/XQMuse/Root/Plans/PlanGuideVC.swift +++ b/XQMuse/Root/Plans/PlanGuideVC.swift @@ -39,7 +39,9 @@ override func viewDidLoad() { super.viewDidLoad() - masterPlayer.playBGMAt(firstPlayIndex: 0, model: MeditationModel(backgroundUrl:backgroundVoiceUrl), delegate: self) + + let tempModel = MeditationModel() + masterPlayer.playSceneAt(backgroundVoiceUrl) } override func viewWillAppear(_ animated: Bool) { diff --git a/XQMuse/SceneDelegate.swift b/XQMuse/SceneDelegate.swift index f16c49f..6215f3d 100644 --- a/XQMuse/SceneDelegate.swift +++ b/XQMuse/SceneDelegate.swift @@ -84,35 +84,42 @@ func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { - if URLContexts.first?.url.scheme == WeChatAPPID,let code = URLContexts.first?.url.jq_params?["code"]{ - DispatchQueue.main.async { - hiddenHUD() - let resp = SendAuthResp() - resp.code = code - WeChatTools.getAccessToken(resp) { model in - if let m = model{ - WeChatTools.getUserInfo(access_token: m.access_token, openId: m.openid) { userInfoModel in - if let u = userInfoModel{ - Services.loginByWechat(headImgUrl: u.headimgurl, nickname: u.nickname, sex: u.sex, wxOpenId: u.openid).subscribe(onNext: {data in - if let model = data.data{ - sceneDelegate?.loginSuccess() - JQ_currentViewController().dismiss(animated:true) - UserViewModel.saveLoginInfo(model) + if URLContexts.first?.url.scheme == WeChatAPPID{ - Services.getUserInfo().subscribe(onNext: {data in - if let model = data.data{ - UserViewModel.saveAvatarInfo(model) - } - }).disposed(by: JQ_disposeBag) - } - }).disposed(by: JQ_disposeBag) - }else{ - alertError(msg: "获取信息失败") + if let code = URLContexts.first?.url.jq_params?["code"]{ + DispatchQueue.main.async { + hiddenHUD() + let resp = SendAuthResp() + resp.code = code + WeChatTools.getAccessToken(resp) { model in + if let m = model{ + WeChatTools.getUserInfo(access_token: m.access_token, openId: m.openid) { userInfoModel in + if let u = userInfoModel{ + Services.loginByWechat(headImgUrl: u.headimgurl, nickname: u.nickname, sex: u.sex, wxOpenId: u.openid).subscribe(onNext: {data in + if let model = data.data{ + sceneDelegate?.loginSuccess() + JQ_currentViewController().dismiss(animated:true) + UserViewModel.saveLoginInfo(model) + + Services.getUserInfo().subscribe(onNext: {data in + if let model = data.data{ + UserViewModel.saveAvatarInfo(model) + } + }).disposed(by: JQ_disposeBag) + } + }).disposed(by: JQ_disposeBag) + }else{ + alertError(msg: "获取信息失败") + } } } } } + }else{ + WXApi.handleOpen(URLContexts.first!.url, delegate: self) } + + } } -- Gitblit v1.7.1