From f4c46a585290d8136819673dfff2df9ea5c5a330 Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期一, 04 十一月 2024 21:07:18 +0800 Subject: [PATCH] fix bug --- XQMuse/Root/Home/CCell/Home_Style_4_Inner_1_CCell.swift | 12 ++ XQMuse/Root/Plans/PlanGuide_1_VC.xib | 14 +- XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift | 10 + XQMuse/Root/Home/TCell/Home_Style_4_TCell.swift | 12 + XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.swift | 4 XQMuse/Root/Home/VC/HomeItemListVC.swift | 4 XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift | 16 ++ XQMuse/Root/Login/LoginVC.swift | 36 ++++++ XQMuse/Root/Plans/PlanGuideVC.swift | 33 +++++- XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.xib | 20 ++- XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.swift | 16 ++ XQMuse/Root/Home/HomeVC.swift | 19 ++- XQMuse/Root/Plans/PlanGuide_2_VC.swift | 7 XQMuse/Root/Home/VC/SearchContentVC.swift | 6 XQMuse.xcodeproj/project.pbxproj | 4 XQMuse/Root/Plans/PlanGuide_2_VC.xib | 12 +- XQMuse/Root/Course/TCell/CourseDetail_2_TCell.swift | 4 XQMuse/Root/Network/Models.swift | 1 XQMuse/Root/Plans/PlanGuide_3_VC.swift | 13 ++ XQMuse/Root/Network/Services.swift | 7 + 20 files changed, 188 insertions(+), 62 deletions(-) diff --git a/XQMuse.xcodeproj/project.pbxproj b/XQMuse.xcodeproj/project.pbxproj index fd49568..aefbb0e 100644 --- a/XQMuse.xcodeproj/project.pbxproj +++ b/XQMuse.xcodeproj/project.pbxproj @@ -1926,7 +1926,7 @@ GCC_OPTIMIZATION_LEVEL = s; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = XQMuse/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = "心泉冥想"; + INFOPLIST_KEY_CFBundleDisplayName = "心泉·疗愈"; INFOPLIST_KEY_LSApplicationCategoryType = ""; INFOPLIST_KEY_NSCameraUsageDescription = "相机"; INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "定位"; @@ -2081,7 +2081,7 @@ GCC_OPTIMIZATION_LEVEL = s; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = XQMuse/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = "心泉冥想"; + INFOPLIST_KEY_CFBundleDisplayName = "心泉·疗愈"; INFOPLIST_KEY_LSApplicationCategoryType = ""; INFOPLIST_KEY_NSCameraUsageDescription = "相机"; INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "定位"; diff --git a/XQMuse/Root/Course/TCell/CourseDetail_2_TCell.swift b/XQMuse/Root/Course/TCell/CourseDetail_2_TCell.swift index bebaa18..901dd01 100644 --- a/XQMuse/Root/Course/TCell/CourseDetail_2_TCell.swift +++ b/XQMuse/Root/Course/TCell/CourseDetail_2_TCell.swift @@ -40,7 +40,9 @@ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { guard let m = model else {return} - if m.chargeType == .free || (m.chargeType == .vipFree && UserViewModel.getAvatarInfo().isVip == .yes) || (m.chargeType == .payment && m.isBuy == .yes){ + let isVip = UserViewModel.getAvatarInfo().isVip + + if m.chargeType == .free || (m.chargeType == .vipFree && isVip == .yes) || (m.chargeType == .payment && m.isBuy == .yes){ let vc = CourseDetialVideoVC(items: model!.list, selectIndex: indexPath) JQ_currentNavigationController().pushViewController(vc) }else{ diff --git a/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift b/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift index 439d2c3..89f8307 100644 --- a/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift +++ b/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift @@ -19,8 +19,8 @@ @IBOutlet weak var view_price: UIView! @IBOutlet weak var label_price: UILabel! @IBOutlet weak var img_offine: UIImageView! - - + private var showType:DisplayType! + override func awakeFromNib() { super.awakeFromNib() // Initialization code @@ -28,9 +28,19 @@ view_price.jq_cornerRadius = 12.55 } - func setMeditationModel(_ model:MeditationModel){ + func setMeditationModel(_ model:MeditationModel,showType:DisplayType){ + self.showType = showType img_offine.isHidden = true img_cover.sd_setImage(with: URL(string: model.coverUrl)) + + let imageUrls = model.coverUrl.components(separatedBy: ",") + if showType == .horizontal{ + img_cover.sd_setImage(with: URL(string: imageUrls.first)) + }else{ + img_cover.sd_setImage(with: URL(string: imageUrls.last)) + } + + label_title.text = model.meditationTitle label_subTitle.text = model.coverDescription label_num.text = "\(model.realLearnedNum)" diff --git a/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.swift b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.swift index 29b98cc..d67b640 100644 --- a/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.swift +++ b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.swift @@ -44,7 +44,7 @@ } func setMeditationModel(_ model:MeditationModel){ - img_cover.sd_setImage(with: URL(string: model.coverUrl)) + img_cover.sd_setImage(with: URL(string: model.coverUrl.components(separatedBy: ",").last)) label_title.text = model.meditationTitle label_subTitle.text = model.coverDescription label_num.text = "\(model.realLearnedNum)" @@ -54,7 +54,7 @@ } func setCourseModel(_ model:CourseModel){ - img_cover.sd_setImage(with: URL(string: model.coverUrl)) + img_cover.sd_setImage(with: URL(string: model.coverUrl.components(separatedBy: ",").last)) label_title.text = model.courseTitle label_subTitle.text = model.briefIntroduction label_num.text = "\(model.count)" diff --git a/XQMuse/Root/Home/CCell/Home_Style_4_Inner_1_CCell.swift b/XQMuse/Root/Home/CCell/Home_Style_4_Inner_1_CCell.swift index 32268e5..a19cc38 100644 --- a/XQMuse/Root/Home/CCell/Home_Style_4_Inner_1_CCell.swift +++ b/XQMuse/Root/Home/CCell/Home_Style_4_Inner_1_CCell.swift @@ -16,6 +16,7 @@ @IBOutlet weak var label_subTitle: UILabel! var meditationModel:MeditationModel? + private var showType:DisplayType! override func awakeFromNib() { super.awakeFromNib() @@ -23,10 +24,17 @@ } - func setMeditationModel(_ model:MeditationModel){ + func setMeditationModel(_ model:MeditationModel,showType:DisplayType){ + self.showType = showType label_title.text = model.meditationTitle label_subTitle.text = model.coverDescription - cover_bgImage.sd_setImage(with: URL(string: model.coverUrl)) + + let imgUrls = model.coverUrl.components(separatedBy: ",") + if showType == .horizontal{ + cover_bgImage.sd_setImage(with: URL(string: imgUrls.first)) + }else{ + cover_bgImage.sd_setImage(with: URL(string: imgUrls.last)) + } } } diff --git a/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.swift b/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.swift index 00b223f..5093665 100644 --- a/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.swift +++ b/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.swift @@ -19,7 +19,9 @@ @IBOutlet weak var label_price: UILabel! @IBOutlet weak var img_vip: UIImageView! @IBOutlet weak var image_free: UIImageView! - + + private var showType:DisplayType! + override func awakeFromNib() { super.awakeFromNib() // Initialization code @@ -40,10 +42,18 @@ } - func setMeditationModel(_ model:MeditationModel){ + func setMeditationModel(_ model:MeditationModel,showType:DisplayType){ + self.showType = showType label_title.text = model.meditationTitle label_subTitle.text = model.coverDescription - cover_bgImage.sd_setImage(with: URL(string: model.coverUrl)) + + let imgUrls = model.coverUrl.components(separatedBy: ",") + if showType == .horizontal{ + cover_bgImage.sd_setImage(with: URL(string: imgUrls.first)) + }else{ + cover_bgImage.sd_setImage(with: URL(string: imgUrls.last)) + } + label_peopleNum.text = model.realLearnedNum.string image_free.isHidden = model.chargeType != .free diff --git a/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.xib b/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.xib index 4901f09..dfcf7b7 100644 --- a/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.xib +++ b/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.xib @@ -54,7 +54,7 @@ <rect key="frame" x="11" y="229.99999999999997" width="395" height="66.666666666666657"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="--" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1bZ-4v-DSk"> - <rect key="frame" x="11.666666666666664" y="17" width="18" height="18.666666666666671"/> + <rect key="frame" x="11.666666666666657" y="17" width="314" height="18.666666666666671"/> <constraints> <constraint firstAttribute="height" constant="18.5" id="ovU-Xb-Yac"/> </constraints> @@ -62,27 +62,33 @@ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="--" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Enr-D6-xzP"> - <rect key="frame" x="11.666666666666664" y="40.666666666666686" width="10.666666666666664" height="13.333333333333336"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" text="---------------------------------------------------------------" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Enr-D6-xzP"> + <rect key="frame" x="11.666666666666657" y="40.666666666666686" width="286.33333333333337" height="13.333333333333336"/> <fontDescription key="fontDescription" type="system" pointSize="11"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> <nil key="highlightedColor"/> </label> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_use_small" translatesAutoresizingMaskIntoConstraints="NO" id="oQL-yV-XUJ"> - <rect key="frame" x="35.666666666666671" y="42" width="10" height="10.333333333333336"/> + <rect key="frame" x="311.66666666666669" y="42" width="10" height="10.333333333333336"/> <constraints> <constraint firstAttribute="width" constant="10" id="Slz-7f-7Ue"/> <constraint firstAttribute="height" constant="10.5" id="XYC-hN-Jp1"/> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="10" id="Z1y-Lh-6y7"/> + <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="10.33" id="wvV-dq-I6B"/> </constraints> </imageView> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ANZ-Kn-isU"> - <rect key="frame" x="48.666666666666671" y="40.666666666666686" width="7" height="13.333333333333336"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ANZ-Kn-isU"> + <rect key="frame" x="324.66666666666669" y="40.666666666666686" width="7" height="13.333333333333336"/> <fontDescription key="fontDescription" type="system" pointSize="11"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> <nil key="highlightedColor"/> </label> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_play" translatesAutoresizingMaskIntoConstraints="NO" id="jHj-Io-MFM"> <rect key="frame" x="336.66666666666669" y="10.333333333333343" width="46" height="46"/> + <constraints> + <constraint firstAttribute="height" constant="46" id="6b5-gN-4vl"/> + <constraint firstAttribute="width" constant="46" id="bHl-i8-OE4"/> + </constraints> </imageView> </subviews> <constraints> @@ -94,9 +100,11 @@ <constraint firstItem="1bZ-4v-DSk" firstAttribute="leading" secondItem="1q9-TW-tvm" secondAttribute="leading" constant="11.5" id="WlQ-KT-pRy"/> <constraint firstItem="1bZ-4v-DSk" firstAttribute="top" secondItem="1q9-TW-tvm" secondAttribute="top" constant="17" id="e9a-W4-1PL"/> <constraint firstItem="Enr-D6-xzP" firstAttribute="top" secondItem="1bZ-4v-DSk" secondAttribute="bottom" constant="5" id="jib-WM-oJ0"/> + <constraint firstItem="jHj-Io-MFM" firstAttribute="leading" secondItem="1bZ-4v-DSk" secondAttribute="trailing" constant="11" id="rOf-uz-Hi5"/> <constraint firstItem="jHj-Io-MFM" firstAttribute="centerY" secondItem="1q9-TW-tvm" secondAttribute="centerY" id="sZY-bA-ajf"/> <constraint firstAttribute="height" constant="66.5" id="tHj-Nz-2qU"/> <constraint firstItem="ANZ-Kn-isU" firstAttribute="centerY" secondItem="Enr-D6-xzP" secondAttribute="centerY" id="ys8-jf-joH"/> + <constraint firstItem="jHj-Io-MFM" firstAttribute="leading" secondItem="ANZ-Kn-isU" secondAttribute="trailing" constant="5" id="z9j-1B-0F0"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="boolean" keyPath="ld_maskToBoundsXIB" value="YES"/> diff --git a/XQMuse/Root/Home/HomeVC.swift b/XQMuse/Root/Home/HomeVC.swift index c5f5ae6..771cc53 100644 --- a/XQMuse/Root/Home/HomeVC.swift +++ b/XQMuse/Root/Home/HomeVC.swift @@ -141,6 +141,9 @@ NotificationCenter.default.rx.notification(PlantGuideQuit_Noti).take(until: self.rx.deallocated).subscribe(onNext: {data in self.getData() + if UserDefaultSettingViewModel.getSetting()?.userFirstOpenTreeTask ?? true{ + self.navigationController?.tabBarController?.selectedIndex = 2 + } }).disposed(by: disposeBag) NotificationCenter.default.rx.notification(LoginSuccess_Noti).take(until: self.rx.deallocated).subscribe(onNext: {data in @@ -169,11 +172,11 @@ Services.getCategoryListByType(type: 2).subscribe(onNext: { data in var items = [HomeTopMenuItem]() for v in data.data ?? []{ - let model = HomeTopMenuItem(id: v.id, title: v.categoryName, image: v.firstIconUrl, imageFrom: .url) + let model = HomeTopMenuItem(id: v.id, title: v.categoryName, image: v.secondIconUrl, imageFrom: .url) items.append(model) } - self.viewModel.homeBottomMenuItems = items - self.tableView.reloadRows(at: [IndexPath(row: 3, section: 0)], with: .none) + self.viewModel.homeBottomMenuItems = items + self.tableView.reloadRows(at: [IndexPath(row: 4, section: 0)], with: .none) }).disposed(by: disposeBag) Services.getTopdayMedita().subscribe(onNext: { data in @@ -198,7 +201,7 @@ self.viewModel.meditationList = m - for v in self.viewModel.meditationList{ + for v in self.viewModel.meditationList{ if v.clientMeditationCategoryVO?.categoryName.isEmpty ?? true{continue} self.titleItems.append(TitleItem(title: v.clientMeditationCategoryVO?.categoryName ?? "", subTitle: v.clientMeditationCategoryVO?.description ?? "",hasMore:true)) } @@ -265,7 +268,7 @@ //私人定制 let cell = tableView.dequeueReusableCell(withIdentifier: "_Home_Style_4_TCell") as! Home_Style_4_TCell cell.style = .style1 - cell.setModels(viewModel.privateTodyModels) + cell.setModels(viewModel.privateTodyModels,showType: .horizontal) return cell }else if indexPath.section == 2{ // 新手冥想指南 @@ -278,18 +281,18 @@ let index = indexPath.section - 3 if index == 0 && indexPath.row != 0{ let cell = tableView.dequeueReusableCell(withIdentifier: "_Home_Style_5_TCell") as! Home_Style_5_TCell - cell.setHomeTopMenuItem(viewModel.homeBottomMenuItems) + cell.setHomeTopMenuItem(viewModel.homeBottomMenuItems) return cell }else{ let m = viewModel.meditationList[index] if m.clientMeditationCategoryVO!.showType == .horizontal{ let cell = tableView.dequeueReusableCell(withIdentifier: "_Home_Style_4_TCell") as! Home_Style_4_TCell cell.style = .style2 - cell.setModels(m.clientMeditationVOList) + cell.setModels(m.clientMeditationVOList,showType: .horizontal) return cell }else if m.clientMeditationCategoryVO!.showType == .vertical{ let cell = tableView.dequeueReusableCell(withIdentifier: "_Home_Style_3_TCell") as! Home_Style_3_TCell - cell.setModels(m.clientMeditationVOList) + cell.setModels(m.clientMeditationVOList,showType: .vertical) return cell } } diff --git a/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift b/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift index 2478dd3..f7fbd78 100644 --- a/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift +++ b/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift @@ -12,6 +12,7 @@ @IBOutlet weak var collectionView: UICollectionView! var meditationModels = [MeditationModel]() + private var showType:DisplayType! override func awakeFromNib() { super.awakeFromNib() @@ -29,7 +30,8 @@ } - func setModels(_ items:[MeditationModel]){ + func setModels(_ items:[MeditationModel],showType: DisplayType){ + self.showType = showType self.meditationModels = items collectionView.reloadData() } @@ -42,14 +44,16 @@ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBannerCCell", for: indexPath) as! HomeRelaxBannerCCell - cell.setMeditationModel(meditationModels[indexPath.row]) + cell.setMeditationModel(meditationModels[indexPath.row],showType: showType) return cell } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let m = meditationModels[indexPath.row] - if m.chargeType == .free{ + let isVip = UserViewModel.getAvatarInfo().isVip + + if m.chargeType == .free || (isVip == .yes && m.chargeType == .vipFree){ let vc = HomeItemDetailVC(id: m.id) 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 d1b2c48..376eabb 100644 --- a/XQMuse/Root/Home/TCell/Home_Style_4_TCell.swift +++ b/XQMuse/Root/Home/TCell/Home_Style_4_TCell.swift @@ -16,6 +16,7 @@ class Home_Style_4_TCell: UITableViewCell { var style:Home_Style_4_Style! + private var showType: DisplayType! var meditationModels = [MeditationModel]() @IBOutlet weak var collectionView: UICollectionView! @@ -30,7 +31,8 @@ collectionView.showsHorizontalScrollIndicator = false } - func setModels(_ items:[MeditationModel]){ + func setModels(_ items:[MeditationModel],showType: DisplayType){ + self.showType = showType self.meditationModels = items collectionView.reloadData() } @@ -42,7 +44,9 @@ let m = meditationModels[indexPath.row] - if m.chargeType == .free || (m.chargeType == .vipFree && UserViewModel.getAvatarInfo().isVip == .yes) || (m.chargeType == .payment && m.paidStatus == .yes){ + let isVip = UserViewModel.getAvatarInfo().isVip + + if m.chargeType == .free || (m.chargeType == .vipFree && isVip == .yes) || (m.chargeType == .payment && m.paidStatus == .yes){ let detailVC = HomeItemDetailVC(id: meditationModels[indexPath.row].id) JQ_currentViewController().jq_push(vc: detailVC) }else{ @@ -63,13 +67,13 @@ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { if style == .style1{ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_Home_Style_4_Inner_1_CCell", for: indexPath) as! Home_Style_4_Inner_1_CCell - cell.setMeditationModel(meditationModels[indexPath.row]) + cell.setMeditationModel(meditationModels[indexPath.row],showType: showType) return cell } if style == .style2{ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_Home_Style_4_Inner_CCell", for: indexPath) as! Home_Style_4_Inner_CCell - cell.setMeditationModel(meditationModels[indexPath.row]) + cell.setMeditationModel(meditationModels[indexPath.row],showType: showType) return cell } diff --git a/XQMuse/Root/Home/VC/HomeItemListVC.swift b/XQMuse/Root/Home/VC/HomeItemListVC.swift index 0894548..49db712 100644 --- a/XQMuse/Root/Home/VC/HomeItemListVC.swift +++ b/XQMuse/Root/Home/VC/HomeItemListVC.swift @@ -80,7 +80,9 @@ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let m = viewModel.dataSource.value!.list[indexPath.row] - if m.chargeType == .free || (m.chargeType == .vipFree && UserViewModel.getAvatarInfo().isVip == .yes) || (m.chargeType == .payment && m.paidStatus == .yes){ + let isVip = UserViewModel.getAvatarInfo().isVip + + if m.chargeType == .free || (m.chargeType == .vipFree && isVip == .yes) || (m.chargeType == .payment && m.paidStatus == .yes){ let detailVC = HomeItemDetailVC(id: m.id) jq_push(vc: detailVC) }else{ diff --git a/XQMuse/Root/Home/VC/SearchContentVC.swift b/XQMuse/Root/Home/VC/SearchContentVC.swift index 79c77d6..ad4dcd0 100644 --- a/XQMuse/Root/Home/VC/SearchContentVC.swift +++ b/XQMuse/Root/Home/VC/SearchContentVC.swift @@ -128,10 +128,12 @@ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + let isVip = UserViewModel.getAvatarInfo().isVip + switch serchType{ case .course: let m = courseViewModel!.dataSource.value!.list[indexPath.row] - if m.chargeType == .free || (m.chargeType == .vipFree && UserViewModel.getAvatarInfo().isVip == .yes) || (m.chargeType == .payment && m.isBuy == .yes){ + if m.chargeType == .free || (m.chargeType == .vipFree && isVip == .yes) || (m.chargeType == .payment && m.isBuy == .yes){ let vc = CourseDetialVC(courseId: m.id) JQ_currentViewController().jq_push(vc: vc) }else{ @@ -146,7 +148,7 @@ case .muse: let m = museViewModel!.dataSource.value!.list[indexPath.row] - if m.chargeType == .free || (m.chargeType == .vipFree && UserViewModel.getAvatarInfo().isVip == .yes) || (m.chargeType == .payment && m.paidStatus == .yes){ + if m.chargeType == .free || (m.chargeType == .vipFree && isVip == .yes) || (m.chargeType == .payment && m.paidStatus == .yes){ let detailVC = HomeItemDetailVC(id: m.id) JQ_currentViewController().jq_push(vc: detailVC) }else{ diff --git a/XQMuse/Root/Login/LoginVC.swift b/XQMuse/Root/Login/LoginVC.swift index 96f9c92..83a583b 100644 --- a/XQMuse/Root/Login/LoginVC.swift +++ b/XQMuse/Root/Login/LoginVC.swift @@ -10,6 +10,7 @@ import RxRelay import QMUIKit import AuthenticationServices +import CoreTelephony let LoginSuccess_Noti = Notification.Name.init("LoginSuccess_Noti") @@ -61,13 +62,44 @@ @IBOutlet weak var btn_sendCode: UIButton! @IBOutlet weak var btn_isRead: UIButton! @IBOutlet weak var btn_wechat: UIButton! - + + private var cellularData:CTCellularData! + private var viewModel = LoginViewModel() private let unlineImageView = UIImageView(image: UIImage(named: "icon_unline")) - override func viewDidLoad() { + override func viewDidLoad() { super.viewDidLoad() + + cellularData = CTCellularData() + cellularData.cellularDataRestrictionDidUpdateNotifier = {[weak self] state in + guard let weakSelf = self else { return } + + switch state{ + case .notRestricted: + if UserDefaultSettingViewModel.getSetting()?.userFirstLaunch ?? true{ + DispatchQueue.main.async { + let vc = LoginTreatyVC() + vc.topIndex = 0 + vc.clickHandle { state in + if !state{ + exit(0) + }else{ + if var m = UserDefaultSettingViewModel.getSetting(){ + m.userFirstLaunch = false + UserDefaultSettingViewModel.saveSetting(m) + } + } + } + vc.modalPresentationStyle = .custom + weakSelf.present(vc, animated: true) + } + } + default:break + } + + } } override func setRx() { diff --git a/XQMuse/Root/Network/Models.swift b/XQMuse/Root/Network/Models.swift index 8ebff6e..fab92ab 100644 --- a/XQMuse/Root/Network/Models.swift +++ b/XQMuse/Root/Network/Models.swift @@ -17,6 +17,7 @@ var playModel:PlayMode = .line var userFirstOpenTreeTask = true //第一次打开树苗 + var userFirstLaunch = true //第一次启动 } diff --git a/XQMuse/Root/Network/Services.swift b/XQMuse/Root/Network/Services.swift index d82f725..b66273f 100644 --- a/XQMuse/Root/Network/Services.swift +++ b/XQMuse/Root/Network/Services.swift @@ -665,6 +665,13 @@ } extension Services{ + + class func getPlan()->Observable<BaseResponse<String>>{ + let params = ParamsAppender.build(url: All_Url) + .interface(url: "/system/system/page/getPlan") + return NetworkRequest.request(params: params, method: .post, progress: false) + } + /// 获取协议 class func agreementBy(_ type:AgreementType)->Observable<BaseResponse<HtmlModel>>{ let params = ParamsAppender.build(url: All_Url) diff --git a/XQMuse/Root/Plans/PlanGuideVC.swift b/XQMuse/Root/Plans/PlanGuideVC.swift index 43d3a42..5fd10aa 100644 --- a/XQMuse/Root/Plans/PlanGuideVC.swift +++ b/XQMuse/Root/Plans/PlanGuideVC.swift @@ -22,8 +22,6 @@ @IBOutlet weak var label_info: UILabel! @IBOutlet weak var btn_custom: UIButton! - private let masterPlayer = AudioPlayer.getSharedInstance() - private lazy var player:AVPlayer = { let bgPath = Bundle.main.url(forResource: "bg_movie", withExtension: "mov") let p = AVPlayer(url: bgPath!) @@ -31,17 +29,40 @@ return p }() + private lazy var bgplayer:AVPlayer = { + let p = AVPlayer() + return p + }() + private lazy var playerLayer:AVPlayerLayer = { let pLayer = AVPlayerLayer() - pLayer.videoGravity = .resize + pLayer.videoGravity = .resizeAspectFill return pLayer }() override func viewDidLoad() { super.viewDidLoad() - let tempModel = MeditationModel() - masterPlayer.playSceneAt(backgroundVoiceUrl) + Services.getPlan().subscribe(onNext: {[weak self]data in + if let url = data.data{ + self?.bgplayer.replaceCurrentItem(with: AVPlayerItem(url: URL(string: url)!)) + self?.bgplayer.play() + } + }).disposed(by: disposeBag) + + self.bgplayer.addPeriodicTimeObserver(forInterval: CMTimeMake(value: 1, timescale: 1), queue: DispatchQueue.main) {[weak self] time in + guard let weakSelf = self else { return } + + //当前正在播放的时间 + let loadTime = CMTimeGetSeconds(time) + //视频总时间 + let totalTime = CMTimeGetSeconds((weakSelf.bgplayer.currentItem?.duration)!) + + if loadTime >= totalTime{ + weakSelf.bgplayer.seek(to: CMTime.zero) + weakSelf.bgplayer.play() + } + } } override func viewWillAppear(_ animated: Bool) { @@ -123,7 +144,7 @@ } deinit{ - masterPlayer.clean() + } } diff --git a/XQMuse/Root/Plans/PlanGuide_1_VC.xib b/XQMuse/Root/Plans/PlanGuide_1_VC.xib index 0d0fec1..251e17c 100644 --- a/XQMuse/Root/Plans/PlanGuide_1_VC.xib +++ b/XQMuse/Root/Plans/PlanGuide_1_VC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_12" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -22,11 +22,11 @@ <rect key="frame" x="0.0" y="0.0" width="393" height="852"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bg_guide" translatesAutoresizingMaskIntoConstraints="NO" id="lsJ-Pj-oQ7"> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bg_guide" translatesAutoresizingMaskIntoConstraints="NO" id="lsJ-Pj-oQ7"> <rect key="frame" x="0.0" y="0.0" width="393" height="852"/> </imageView> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="35k-EJ-Ttd"> - <rect key="frame" x="178" y="769" width="37" height="34"/> + <rect key="frame" x="178.66666666666666" y="769" width="36" height="34"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="跳过"> <color key="titleColor" red="0.15686274509803921" green="0.15686274509803921" blue="0.15686274509803921" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> @@ -36,13 +36,13 @@ </connections> </button> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="亲爱的家人" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OqX-ab-xko"> - <rect key="frame" x="153.33333333333334" y="120" width="86.666666666666657" height="21"/> + <rect key="frame" x="154.33333333333334" y="120" width="84.333333333333343" height="21"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2B0-5U-4lk"> - <rect key="frame" x="110.00000000000001" y="171" width="173.33333333333337" height="101.66666666666669"/> + <rect key="frame" x="112.33333333333333" y="171" width="168.66666666666669" height="101.66666666666669"/> <string key="text">请您遵从本心 回答以下问题 挑选您喜欢的空间环境 @@ -53,7 +53,7 @@ <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="懂您才可以更好的帮助您" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Al3-JQ-1uR"> - <rect key="frame" x="101.33333333333333" y="317.66666666666669" width="190.66666666666669" height="20.333333333333314"/> + <rect key="frame" x="103.66666666666667" y="317.66666666666669" width="185.66666666666663" height="20.333333333333314"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> <nil key="highlightedColor"/> diff --git a/XQMuse/Root/Plans/PlanGuide_2_VC.swift b/XQMuse/Root/Plans/PlanGuide_2_VC.swift index 6b5561a..19531cc 100644 --- a/XQMuse/Root/Plans/PlanGuide_2_VC.swift +++ b/XQMuse/Root/Plans/PlanGuide_2_VC.swift @@ -31,7 +31,6 @@ questions.append("您是否情绪失控暴躁易怒?") questions.append("您是否沉迷情感倍受伤害?") questions.append("您是否人生迷茫踌躇彷徨?") - questions.append("您是否内心纠结敏感多疑?") nextQuestion() } @@ -71,8 +70,8 @@ btn_OnceInAWel.titleLabel?.font = Def_SourceHanSerif_Medium(fontSize: 15) } - private func nextQuestion(){ - questionIndex += 1 + private func nextQuestion(page:Int = 0){ + questionIndex += page label_question.text = questions[questionIndex] btn_sure.isSelected = false btn_deny.isSelected = false @@ -147,7 +146,7 @@ self.push(vc: vc) } }else{ - self.nextQuestion() + self.nextQuestion(page: 1) } } } diff --git a/XQMuse/Root/Plans/PlanGuide_2_VC.xib b/XQMuse/Root/Plans/PlanGuide_2_VC.xib index 5c3c449..2217763 100644 --- a/XQMuse/Root/Plans/PlanGuide_2_VC.xib +++ b/XQMuse/Root/Plans/PlanGuide_2_VC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_12" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -25,11 +25,11 @@ <rect key="frame" x="0.0" y="0.0" width="393" height="852"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bg_guide_answer" translatesAutoresizingMaskIntoConstraints="NO" id="BSN-Vb-lfW"> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bg_guide_answer" translatesAutoresizingMaskIntoConstraints="NO" id="BSN-Vb-lfW"> <rect key="frame" x="0.0" y="0.0" width="393" height="852"/> </imageView> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tOt-d8-gyj"> - <rect key="frame" x="180" y="756" width="33" height="32"/> + <rect key="frame" x="180.66666666666666" y="756" width="32" height="32"/> <fontDescription key="fontDescription" type="system" pointSize="16"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="跳过"> @@ -43,13 +43,13 @@ <rect key="frame" x="40" y="443.33333333333326" width="313" height="287.66666666666674"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="星/星/知/我/心" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="G4q-vh-Uts"> - <rect key="frame" x="112.66666666666666" y="29.999999999999996" width="88" height="14.333333333333332"/> + <rect key="frame" x="113.33333333333334" y="29.999999999999996" width="86.333333333333343" height="14.333333333333332"/> <fontDescription key="fontDescription" type="system" pointSize="12"/> <color key="textColor" red="0.75294117647058822" green="0.75294117647058822" blue="0.75294117647058822" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="您是否内心纠结敏感多疑" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Qg0-hc-iCv"> - <rect key="frame" x="61.333333333333329" y="47.333333333333371" width="190.66666666666669" height="20.333333333333329"/> + <rect key="frame" x="63.666666666666671" y="47.333333333333371" width="185.66666666666663" height="20.333333333333329"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <color key="textColor" red="0.18823529411764706" green="0.30196078431372547" blue="0.12156862745098039" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> diff --git a/XQMuse/Root/Plans/PlanGuide_3_VC.swift b/XQMuse/Root/Plans/PlanGuide_3_VC.swift index 3ee6853..3803240 100644 --- a/XQMuse/Root/Plans/PlanGuide_3_VC.swift +++ b/XQMuse/Root/Plans/PlanGuide_3_VC.swift @@ -33,6 +33,19 @@ var topIndex = 0 Services.getTag().subscribe(onNext: { data in self.items = Array<TagModel>.splitArray((data.data ?? []), subArraySize: 3) + + + //分成3:4:3 + if let item = self.items[2]?.first{ + self.items[1]?.append(item) + self.items[2]?.removeFirst() + + if let m = self.items[3]?.first{ + self.items[2]?.append(m) + self.items[3]?.removeAll() + } + } + self.collectionVIew.reloadData() }).disposed(by: disposeBag) } -- Gitblit v1.7.1