From 731a5d58da1d182ded7b389ce0f391623978995c Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期三, 30 十月 2024 17:43:33 +0800 Subject: [PATCH] fix --- XQMuse/Root/Course/VC/CourseDetialVC.swift | 99 +++++---- XQMuse/Root/Home/TCell/Home_Style_5_TCell.xib | 18 + XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.xib | 40 +++ XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift | 3 XQMuse/Root/Home/TCell/Home_Style_4_TCell.swift | 17 + XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.swift | 32 ++ XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.swift | 32 +- XQMuse/Root/Home/VC/HomeItemListVC.swift | 17 + XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift | 44 ++++ XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.xib | 44 ++++ XQMuse/Root/Home/VC/PaymentOrderVC.swift | 59 ++++- XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.xib | 40 +++ XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.swift | 37 +++ XQMuse/Root/Home/HomeVC.swift | 2 XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.xib | 17 + XQMuse/Root/Course/VC/CourseVCOfficalCommentVC.swift | 2 XQMuse/Root/Home/VC/SearchContentVC.swift | 33 ++ XQMuse/Root/Home/TCell/Home_Style_5_TCell.swift | 16 + XQMuse/Root/Course/TCell/CourseDetail_2_TCell.swift | 9 XQMuse/Root/Course/View/CourseDetailHeaderView.swift | 13 + XQMuse/Root/Network/Models.swift | 3 XQMuse/Info.plist | 8 XQMuse/Root/Network/Services.swift | 2 23 files changed, 468 insertions(+), 119 deletions(-) diff --git a/XQMuse/Info.plist b/XQMuse/Info.plist index c68ccb3..b3b64e3 100644 --- a/XQMuse/Info.plist +++ b/XQMuse/Info.plist @@ -14,6 +14,14 @@ <string>wx4b9c1d814c2902a3</string> </array> </dict> + <dict> + <key>CFBundleTypeRole</key> + <string>Editor</string> + <key>CFBundleURLSchemes</key> + <array> + <string>XQMuse</string> + </array> + </dict> </array> <key>LSApplicationQueriesSchemes</key> <array> diff --git a/XQMuse/Root/Course/TCell/CourseDetail_2_TCell.swift b/XQMuse/Root/Course/TCell/CourseDetail_2_TCell.swift index f9077e7..bebaa18 100644 --- a/XQMuse/Root/Course/TCell/CourseDetail_2_TCell.swift +++ b/XQMuse/Root/Course/TCell/CourseDetail_2_TCell.swift @@ -44,8 +44,13 @@ let vc = CourseDetialVideoVC(items: model!.list, selectIndex: indexPath) JQ_currentNavigationController().pushViewController(vc) }else{ - let vc = PaymentOrderVC(courseId: m.id) - JQ_currentNavigationController().pushViewController(vc) + if m.chargeType == .vipFree{ + let vc = VIPCenterVC() + JQ_currentViewController().jq_push(vc: vc) + }else{ + let vc = PaymentOrderVC(id: m.id,type: .course,giftToOther: true) + JQ_currentViewController().jq_push(vc:vc) + } } } diff --git a/XQMuse/Root/Course/VC/CourseDetialVC.swift b/XQMuse/Root/Course/VC/CourseDetialVC.swift index acb976c..6503f1f 100644 --- a/XQMuse/Root/Course/VC/CourseDetialVC.swift +++ b/XQMuse/Root/Course/VC/CourseDetialVC.swift @@ -129,40 +129,46 @@ } private func getData(){ - Services.getCourseDetail(courseId: courseId).subscribe(onNext: {data in + Services.getCourseDetail(courseId: courseId).subscribe(onNext: {[weak self] data in + guard let weakSelf = self else { return } if let m = data.data{ - self.courseDetailModel = m - self.collect_bitem.image = m.isCollect == .yes ? UIImage(named: "btn_collect_1_s"):UIImage(named: "btn_collect") - self.collect_bitem.tintColor = m.isCollect == .yes ? UIColor(hexString: "#fe5b60"):.white - self.headerView.setCourseModel(m) - self.section1TCell.setItems(m) - self.section2TCell.setItems(m.list2) + weakSelf.courseDetailModel = m + weakSelf.collect_bitem.image = m.isCollect == .yes ? UIImage(named: "btn_collect_1_s"):UIImage(named: "btn_collect") + weakSelf.collect_bitem.tintColor = m.isCollect == .yes ? UIColor(hexString: "#fe5b60"):.white + weakSelf.headerView.setCourseModel(m) + weakSelf.section1TCell.setItems(m) + weakSelf.section2TCell.setItems(m.list2) - //是否需要购买 - var needPayment:Bool = true - switch m.chargeType{ - case .free:needPayment = false - case .payment:needPayment = !(m.isBuy == .yes) - case .vipFree:needPayment = !(UserViewModel.getAvatarInfo().isVip == .yes) - } + if m.courseType == .online{ + weakSelf.style = .style1 + weakSelf.pageMenu.setItems(["简介","章节","相关推荐"], selectedItemIndex: 0) - if needPayment{ - let attribute = AttributedStringbuilder.build().add(string: " 疗愈币", withFont: .systemFont(ofSize: 12,weight: .bold), withColor: UIColor(hexString: "#F6F6F6")!).add(string: "\(m.generalPrice.jq_formatFloat)", withFont: .systemFont(ofSize: 21.71, weight: .bold), withColor: UIColor(hexString: "#F6F6F6")!).add(string: " 立即购买 ", withFont: .systemFont(ofSize: 16, weight: .bold), withColor: UIColor(hexString: "#F6F6F6")!).mutableAttributedString - self.studyBtn.setAttributedTitle(attribute, for: .normal) - }else{ - let attribute = AttributedStringbuilder.build().add(string: " 立即学习 ", withFont: .systemFont(ofSize: 16, weight: .bold), withColor: UIColor(hexString: "#F6F6F6")!).mutableAttributedString - self.studyBtn.setAttributedTitle(attribute, for: .normal) - } + //是否需要购买 + var needPayment:Bool = true + switch m.chargeType{ + case .free:needPayment = false + case .payment:needPayment = !(m.isBuy == .yes) + case .vipFree:needPayment = !(UserViewModel.getAvatarInfo().isVip == .yes) + } - if m.detailUrl.jq_isVideo{ - self.style = .style1 - self.pageMenu.setItems(["简介","章节","相关推荐"], selectedItemIndex: 0) + if needPayment{ + let attribute = AttributedStringbuilder.build().add(string: " 疗愈币", withFont: .systemFont(ofSize: 12,weight: .bold), withColor: UIColor(hexString: "#F6F6F6")!).add(string: "\(m.generalPrice.jq_formatFloat)", withFont: .systemFont(ofSize: 21.71, weight: .bold), withColor: UIColor(hexString: "#F6F6F6")!).add(string: " 立即购买 ", withFont: .systemFont(ofSize: 16, weight: .bold), withColor: UIColor(hexString: "#F6F6F6")!).mutableAttributedString + weakSelf.studyBtn.setAttributedTitle(attribute, for: .normal) + }else{ + let attribute = AttributedStringbuilder.build().add(string: " 立即学习 ", withFont: .systemFont(ofSize: 16, weight: .bold), withColor: UIColor(hexString: "#F6F6F6")!).mutableAttributedString + weakSelf.studyBtn.setAttributedTitle(attribute, for: .normal) + } + + weakSelf.setFootView() + }else{ - self.style = .style2 - self.pageMenu.setItems(["简介"], selectedItemIndex: 0) + weakSelf.style = .style2 + DispatchQueue.main.asyncAfter(delay: 0.5) { + weakSelf.headerView.setVideo(url: m.detailUrl, coverImageUrl: m.coverUrl, delegate: self!) + } + weakSelf.pageMenu.setItems(["简介"], selectedItemIndex: 0) } - self.tableView?.reloadData() - self.setFootView() + weakSelf.tableView?.reloadData() } }).disposed(by: disposeBag) } @@ -212,31 +218,31 @@ return size.height } return nil - }.subscribe(onNext: { [unowned self](height) in + }.subscribe(onNext: { [weak self](height) in if let height = height{ - if height > section0Height{ - self.section0Height = height - self.tableView?.reloadData() + if height > self?.section0Height ?? 0{ + self?.section0Height = height + self?.tableView?.reloadData() } } }).disposed(by: disposeBag) - NotificationCenter.default.rx.notification(CourseRefresh_Noti).take(until: self.rx.deallocated).subscribe(onNext: {data in - self.getData() + NotificationCenter.default.rx.notification(CourseRefresh_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self]data in + self?.getData() }).disposed(by: disposeBag) } @objc func collectionAction(){ - Services.clouseFavorite(id: courseId).subscribe(onNext: {data in - self.courseDetailModel?.isCollect.troggle() - if self.courseDetailModel?.isCollect == .yes{ + Services.clouseFavorite(id: courseId).subscribe(onNext: {[weak self]data in + self?.courseDetailModel?.isCollect.troggle() + if self?.courseDetailModel?.isCollect == .yes{ alertSuccess(msg: "收藏成功") - self.collect_bitem.image = UIImage(named: "btn_collect_1_s") - self.collect_bitem.tintColor = UIColor(hexString: "fe5b60") + self?.collect_bitem.image = UIImage(named: "btn_collect_1_s") + self?.collect_bitem.tintColor = UIColor(hexString: "fe5b60") }else{ alertSuccess(msg: "已取消收藏") - self.collect_bitem.image = UIImage(named: "btn_collect") - self.collect_bitem.tintColor = .white + self?.collect_bitem.image = UIImage(named: "btn_collect") + self?.collect_bitem.tintColor = .white } }).disposed(by: disposeBag) } @@ -257,7 +263,8 @@ let vc = CourseDetialVideoVC(items: m.list, selectIndex: IndexPath(row: 0, section: 0)) push(vc: vc);return } - let vc = PaymentOrderVC(courseId: m.id) + + let vc = PaymentOrderVC(id: m.id, type: .course) push(vc: vc) } } @@ -265,7 +272,7 @@ @objc func sendGift(_ btn:QMUIButton){ if let price = courseDetailModel?.generalPrice{ CourseSendGiftView.show(price:price) { - let vc = PaymentOrderVC(courseId: self.courseDetailModel!.id,giftToOther: true) + let vc = PaymentOrderVC(id: self.courseDetailModel!.id,type: .course,giftToOther: true) self.push(vc: vc) } } @@ -359,7 +366,7 @@ (navigationItem.leftBarButtonItem?.customView as? UIButton)?.setImage(UIImage(named: "btn_back")?.withTintColor(.black.withAlphaComponent(v)), for: .normal) (navigationItem.rightBarButtonItem?.customView as? UIButton)?.setImage(UIImage(named: "btn_back")?.withTintColor(.black.withAlphaComponent(v)), for: .normal) - collect_bitem.tintColor = UIColor(hexString: "#fe5b60") + collect_bitem.tintColor = .black share_bitem.tintColor = .black self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor:Def_NavFontColor.withAlphaComponent(v),.font:Def_NavFont] @@ -416,3 +423,7 @@ } } } + +extension CourseDetialVC:CLPlayerDelegate{ + +} diff --git a/XQMuse/Root/Course/VC/CourseVCOfficalCommentVC.swift b/XQMuse/Root/Course/VC/CourseVCOfficalCommentVC.swift index 241bcfc..cce13d2 100644 --- a/XQMuse/Root/Course/VC/CourseVCOfficalCommentVC.swift +++ b/XQMuse/Root/Course/VC/CourseVCOfficalCommentVC.swift @@ -14,7 +14,7 @@ var cateId = BehaviorRelay<Int?>(value: nil) var search = BehaviorRelay<String?>(value: nil) override func api() -> (Observable<BaseResponse<BaseResponseList<CourseModel>>>)? { - return Services.getCoursePageList(page: page,courseTitle: search.value) + return Services.getCoursePageList(page: page,cateId: cateId.value, courseTitle: search.value) } } diff --git a/XQMuse/Root/Course/View/CourseDetailHeaderView.swift b/XQMuse/Root/Course/View/CourseDetailHeaderView.swift index d50a3db..af512d1 100644 --- a/XQMuse/Root/Course/View/CourseDetailHeaderView.swift +++ b/XQMuse/Root/Course/View/CourseDetailHeaderView.swift @@ -15,6 +15,10 @@ @IBOutlet weak var label_studyNum: UILabel! @IBOutlet weak var image_cover: UIImageView! @IBOutlet weak var icon: UIImageView! + + private var videoView:VideoView? + + override func awakeFromNib() { super.awakeFromNib() } @@ -25,4 +29,13 @@ label_studyNum.text = "\(model.count)人已加入学习" image_cover.sd_setImage(with: URL(string: model.coverUrl)) } + + func setVideo(url:String,coverImageUrl:String,delegate:CLPlayerDelegate){ + videoView = VideoView(url: url, autoPlay: false, placeHoderImageUrl: coverImageUrl, delegate: delegate) + + addSubview(videoView!) + videoView!.snp.makeConstraints { make in + make.edges.equalTo(self.image_cover) + } + } } diff --git a/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift b/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift index 8c708f9..5090154 100644 --- a/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift +++ b/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.swift @@ -15,7 +15,12 @@ @IBOutlet weak var label_title: UILabel! @IBOutlet weak var label_subTitle: UILabel! @IBOutlet weak var label_num: UILabel! - + @IBOutlet weak var image_free: UIImageView! + @IBOutlet weak var view_price: UIView! + @IBOutlet weak var label_price: UILabel! + @IBOutlet weak var img_offine: UIImageView! + + override func awakeFromNib() { super.awakeFromNib() // Initialization code @@ -23,11 +28,25 @@ } func setMeditationModel(_ model:MeditationModel){ + img_offine.isHidden = true 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_vip.isHidden = model.chargeType != .vipFree + + image_free.isHidden = model.chargeType != .free + img_vip.isHidden = model.chargeType != .vipFree + view_price.isHidden = model.chargeType != .payment + + 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 + } + + } func setCourseModel(_ model:CourseModel){ @@ -35,7 +54,26 @@ label_title.text = model.courseTitle label_subTitle.text = model.briefIntroduction label_num.text = "\(model.count)" - img_vip.isHidden = model.chargeType != .vipFree + + image_free.isHidden = model.chargeType != .free + img_vip.isHidden = model.chargeType != .vipFree + view_price.isHidden = model.chargeType != .payment + + if model.courseType == .offline{ + img_offine.isHidden = false + image_free.isHidden = true + 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 + } } } diff --git a/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.xib b/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.xib index 7b3185e..9bd8ef5 100644 --- a/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.xib +++ b/XQMuse/Root/Home/CCell/HomeRelaxBannerCCell.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="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> @@ -18,6 +18,32 @@ <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="u6A-Y4-rQ5"> <rect key="frame" x="0.0" y="0.0" width="165" height="218"/> + </imageView> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_offline" translatesAutoresizingMaskIntoConstraints="NO" id="uEc-dY-dVJ"> + <rect key="frame" x="10" y="10" width="34" height="18"/> + </imageView> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xQS-TU-DTd"> + <rect key="frame" x="10" y="10" width="38.666666666666664" height="25"/> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="APF-eW-1da"> + <rect key="frame" x="5.0000000000000018" y="0.0" width="28.666666666666671" height="25"/> + <fontDescription key="fontDescription" type="system" pointSize="11"/> + <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <color key="backgroundColor" red="0.8980392157" green="0.71372549019999998" blue="0.3921568627" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="25.100000000000001" id="83q-tN-O9w"/> + <constraint firstItem="APF-eW-1da" firstAttribute="leading" secondItem="xQS-TU-DTd" secondAttribute="leading" constant="5" id="JMa-Vt-vm6"/> + <constraint firstItem="APF-eW-1da" firstAttribute="top" secondItem="xQS-TU-DTd" secondAttribute="top" id="O9I-d9-Xnk"/> + <constraint firstAttribute="trailing" secondItem="APF-eW-1da" secondAttribute="trailing" constant="5" id="aXq-X5-Ux2"/> + <constraint firstAttribute="height" constant="25.100000000000001" id="d2N-VC-V1F"/> + <constraint firstAttribute="bottom" secondItem="APF-eW-1da" secondAttribute="bottom" id="uOl-Gh-Y2N"/> + </constraints> + </view> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_freee" translatesAutoresizingMaskIntoConstraints="NO" id="eTx-n7-epB"> + <rect key="frame" x="10" y="15" width="50" height="18"/> </imageView> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Emq-gn-QOX"> <rect key="frame" x="0.0" y="162.66666666666666" width="165" height="55.333333333333343"/> @@ -58,7 +84,7 @@ <nil key="highlightedColor"/> </label> </subviews> - <color key="backgroundColor" red="0.67450980392156867" green="0.67450980392156867" blue="0.67450980392156867" alpha="0.75" colorSpace="custom" customColorSpace="sRGB"/> + <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.55000000000000004" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="55.25" id="10l-1C-Vxq"/> <constraint firstItem="KBd-aZ-LFh" firstAttribute="leading" secondItem="fsN-0y-q8f" secondAttribute="trailing" constant="5" id="2Ea-AQ-Tu0"/> @@ -85,28 +111,40 @@ </subviews> </view> <constraints> + <constraint firstItem="xQS-TU-DTd" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="10" id="000-sg-EYm"/> <constraint firstAttribute="trailing" secondItem="Emq-gn-QOX" secondAttribute="trailing" id="04n-4q-t3c"/> + <constraint firstItem="eTx-n7-epB" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="10" id="0iF-Cq-0lH"/> <constraint firstAttribute="bottom" secondItem="Emq-gn-QOX" secondAttribute="bottom" id="1pR-zR-iEn"/> <constraint firstItem="u6A-Y4-rQ5" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="FM9-d1-o7D"/> + <constraint firstItem="eTx-n7-epB" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="15" id="Lk4-Gc-sgU"/> <constraint firstItem="qF4-sn-dec" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="15" id="Pp8-Ev-814"/> <constraint firstAttribute="trailing" secondItem="u6A-Y4-rQ5" secondAttribute="trailing" id="Wmf-QD-q2l"/> + <constraint firstItem="uEc-dY-dVJ" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="10" id="XL6-q7-Yqm"/> <constraint firstItem="qF4-sn-dec" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="14" id="a9F-c7-D0F"/> <constraint firstItem="u6A-Y4-rQ5" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="hwT-Ww-t9Q"/> + <constraint firstItem="xQS-TU-DTd" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="10" id="pUw-nM-PXY"/> <constraint firstItem="Emq-gn-QOX" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="peA-Sh-3Fg"/> <constraint firstAttribute="bottom" secondItem="u6A-Y4-rQ5" secondAttribute="bottom" id="urP-g7-eE1"/> + <constraint firstItem="uEc-dY-dVJ" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="10" id="zpu-w0-ppT"/> </constraints> <size key="customSize" width="165" height="218"/> <connections> + <outlet property="image_free" destination="eTx-n7-epB" id="f4e-MW-Ck1"/> <outlet property="img_cover" destination="u6A-Y4-rQ5" id="jgL-1i-bbr"/> + <outlet property="img_offine" destination="uEc-dY-dVJ" id="ZBx-id-buz"/> <outlet property="img_vip" destination="qF4-sn-dec" id="Srv-K5-XZ8"/> <outlet property="label_num" destination="ZK6-Lk-6Cs" id="YnU-l2-kpJ"/> + <outlet property="label_price" destination="APF-eW-1da" id="O14-P0-c6M"/> <outlet property="label_subTitle" destination="AYK-rI-cj9" id="fbU-5M-2Gw"/> <outlet property="label_title" destination="fsN-0y-q8f" id="MyU-K8-8hi"/> + <outlet property="view_price" destination="xQS-TU-DTd" id="ycm-vC-jQn"/> </connections> <point key="canvasLocation" x="168.70229007633588" y="79.577464788732399"/> </collectionViewCell> </objects> <resources> + <image name="icon_freee" width="50" height="18"/> + <image name="icon_offline" width="34" height="18"/> <image name="icon_play" width="46" height="46"/> <image name="icon_use_small" width="10" height="10.666666984558105"/> <image name="icon_vip" width="21.666666030883789" height="21.666666030883789"/> diff --git a/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.swift b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.swift index 69a3f2b..e1df9ac 100644 --- a/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.swift +++ b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.swift @@ -15,7 +15,11 @@ @IBOutlet weak var label_title: UILabel! @IBOutlet weak var label_subTitle: UILabel! @IBOutlet weak var label_num: UILabel! - @IBOutlet weak var img_isFree: UIImageView! + @IBOutlet weak var image_free: UIImageView! + @IBOutlet weak var view_price: UIView! + @IBOutlet weak var label_price: UILabel! + @IBOutlet weak var img_vip: UIImageView! + @IBOutlet weak var img_offline: UIImageView! override func awakeFromNib() { super.awakeFromNib() @@ -23,7 +27,7 @@ jq_cornerRadius = 10 - + view_price.jq_cornerRadius = 12.55 let blurEffect = UIBlurEffect(style: .light) let visualEffectView = UIVisualEffectView(effect: blurEffect) view_text_bg.addSubview(visualEffectView) @@ -40,8 +44,30 @@ label_title.text = model.courseTitle label_subTitle.text = model.briefIntroduction label_num.text = "\(model.count)" -// img_vip.isHidden = model.chargeType != .vipFree + + if model.courseType == .online{ + img_offline.isHidden = true + setChargePrice(model.chargeType, price: model.generalPrice) + }else{ + img_offline.isHidden = false + img_vip.isHidden = true + view_price.isHidden = true + image_free.isHidden = true + } } + private func setChargePrice(_ type:ChargeType,price:Double){ + + image_free.isHidden = type != .free + img_vip.isHidden = type != .vipFree + view_price.isHidden = type != .payment + + switch type { + case .payment: + 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: "\(price.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.xib b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.xib index 5f19c3a..02c7bf3 100644 --- a/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.xib +++ b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_1_CCell.xib @@ -20,6 +20,29 @@ <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="VwD-36-ent"> <rect key="frame" x="0.0" y="0.0" width="160" height="196"/> </imageView> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_vip" translatesAutoresizingMaskIntoConstraints="NO" id="MDc-Db-v12"> + <rect key="frame" x="11.000000000000002" y="8.6666666666666661" width="21.666666666666671" height="21.666666666666671"/> + </imageView> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tNS-EM-X8Z"> + <rect key="frame" x="7" y="5" width="38.666666666666664" height="25"/> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KaS-j6-dko"> + <rect key="frame" x="5.0000000000000018" y="0.0" width="28.666666666666671" height="25"/> + <fontDescription key="fontDescription" type="system" pointSize="11"/> + <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <color key="backgroundColor" red="0.8980392157" green="0.71372549019999998" blue="0.3921568627" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <constraint firstAttribute="height" constant="25.100000000000001" id="L4H-E8-mqA"/> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="25.100000000000001" id="PQi-Ka-PUO"/> + <constraint firstItem="KaS-j6-dko" firstAttribute="top" secondItem="tNS-EM-X8Z" secondAttribute="top" id="XkQ-YO-BTQ"/> + <constraint firstAttribute="trailing" secondItem="KaS-j6-dko" secondAttribute="trailing" constant="5" id="qWj-kT-K4d"/> + <constraint firstItem="KaS-j6-dko" firstAttribute="leading" secondItem="tNS-EM-X8Z" secondAttribute="leading" constant="5" id="xKe-fC-CpF"/> + <constraint firstAttribute="bottom" secondItem="KaS-j6-dko" secondAttribute="bottom" id="zW6-UI-Hos"/> + </constraints> + </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nyj-tV-0t4"> <rect key="frame" x="0.0" y="146" width="160" height="50"/> <subviews> @@ -73,27 +96,40 @@ <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_freee" translatesAutoresizingMaskIntoConstraints="NO" id="C5o-Fs-4Xu"> <rect key="frame" x="11" y="9" width="50" height="18"/> </imageView> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_offline" translatesAutoresizingMaskIntoConstraints="NO" id="988-87-RLf"> + <rect key="frame" x="8" y="7" width="34" height="18"/> + </imageView> </subviews> </view> <viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/> <constraints> <constraint firstAttribute="bottom" secondItem="nyj-tV-0t4" secondAttribute="bottom" id="6kR-m6-W7L"/> <constraint firstItem="VwD-36-ent" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="6q4-UC-TbP"/> + <constraint firstItem="988-87-RLf" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="7" id="AZp-Bf-kii"/> <constraint firstItem="nyj-tV-0t4" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="HsY-aP-b2m"/> + <constraint firstItem="tNS-EM-X8Z" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="5" id="IDx-Rk-dVG"/> <constraint firstItem="C5o-Fs-4Xu" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="11" id="LW9-j0-pdo"/> <constraint firstItem="C5o-Fs-4Xu" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="9" id="M5Z-Od-Ixc"/> + <constraint firstItem="MDc-Db-v12" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="8.5" id="TAz-42-XQP"/> <constraint firstAttribute="trailing" secondItem="VwD-36-ent" secondAttribute="trailing" id="eMF-Er-Mtm"/> <constraint firstItem="VwD-36-ent" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="gba-Nk-kGk"/> + <constraint firstItem="tNS-EM-X8Z" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="7" id="j3U-db-f7D"/> + <constraint firstItem="MDc-Db-v12" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="11" id="jP0-pB-RmD"/> + <constraint firstItem="988-87-RLf" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="8" id="lIk-og-l06"/> <constraint firstAttribute="trailing" secondItem="nyj-tV-0t4" secondAttribute="trailing" id="oZN-uZ-l0V"/> <constraint firstAttribute="bottom" secondItem="VwD-36-ent" secondAttribute="bottom" id="p7n-UX-5N7"/> </constraints> <size key="customSize" width="160" height="196"/> <connections> + <outlet property="image_free" destination="C5o-Fs-4Xu" id="yA1-gH-NE1"/> <outlet property="img_cover" destination="VwD-36-ent" id="93Z-v8-bjM"/> - <outlet property="img_isFree" destination="C5o-Fs-4Xu" id="eut-gN-uQO"/> + <outlet property="img_offline" destination="988-87-RLf" id="d81-nh-tqD"/> + <outlet property="img_vip" destination="MDc-Db-v12" id="FNN-By-3UD"/> <outlet property="label_num" destination="Wxc-EY-qwU" id="zxI-Y4-tTv"/> + <outlet property="label_price" destination="KaS-j6-dko" id="T7A-UW-g49"/> <outlet property="label_subTitle" destination="EeQ-hi-VEz" id="U39-7s-GGD"/> <outlet property="label_title" destination="6md-5M-Pce" id="j50-e3-otB"/> + <outlet property="view_price" destination="tNS-EM-X8Z" id="POp-Nu-BIU"/> <outlet property="view_text_bg" destination="nyj-tV-0t4" id="Lef-w5-fi6"/> </connections> <point key="canvasLocation" x="164.8854961832061" y="71.83098591549296"/> @@ -101,6 +137,8 @@ </objects> <resources> <image name="icon_freee" width="50" height="18"/> + <image name="icon_offline" width="34" height="18"/> <image name="icon_use_small_s" width="9" height="9"/> + <image name="icon_vip" width="21.666666030883789" height="21.666666030883789"/> </resources> </document> diff --git a/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.swift b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.swift index 465c02e..29b98cc 100644 --- a/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.swift +++ b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.swift @@ -21,7 +21,8 @@ @IBOutlet weak var view_price: UIView! @IBOutlet weak var label_price: UILabel! @IBOutlet weak var image_free: UIImageView! - + @IBOutlet weak var img_offline: UIImageView! + private var meditationModel:MeditationModel? override func awakeFromNib() { super.awakeFromNib() @@ -47,6 +48,7 @@ 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) } @@ -58,23 +60,27 @@ label_num.text = "\(model.count)" img_vip.isHidden = model.isVip != .yes - setChargePrice(model.chargeType, price: model.generalPrice) + if model.courseType == .online{ + img_offline.isHidden = true + setChargePrice(model.chargeType, price: model.generalPrice) + }else{ + img_offline.isHidden = false + img_vip.isHidden = true + view_price.isHidden = true + image_free.isHidden = true + } } private func setChargePrice(_ type:ChargeType,price:Double){ + + image_free.isHidden = type != .free + img_vip.isHidden = type != .vipFree + view_price.isHidden = type != .payment + switch type { 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: price.jq_formatFloat, withFont: UIFont(name: "DIN-Bold", size: 11.44) ?? .systemFont(ofSize: 11,weight: .bold), withColor: .white).mutableAttributedString - case .free: - image_free.isHidden = false - view_price.isHidden = true - img_vip.isHidden = true - case .vipFree: - image_free.isHidden = true - view_price.isHidden = true - img_vip.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: "\(price.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_CCell.xib b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.xib index 18f93d1..8696632 100644 --- a/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.xib +++ b/XQMuse/Root/Home/CCell/HomeRelaxBanner_2_CCell.xib @@ -19,6 +19,9 @@ <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="cCC-0f-GSV"> <rect key="frame" x="0.0" y="0.0" width="178" height="301"/> </imageView> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_offline" translatesAutoresizingMaskIntoConstraints="NO" id="IJ3-94-7an"> + <rect key="frame" x="8" y="7" width="34" height="18"/> + </imageView> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Fb9-IV-vVk"> <rect key="frame" x="0.0" y="236" width="178" height="65"/> <subviews> @@ -65,10 +68,10 @@ <rect key="frame" x="14.666666666666666" y="7.6666666666666661" width="21.333333333333336" height="21.333333333333336"/> </imageView> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rmi-DQ-cp9"> - <rect key="frame" x="14.666666666666664" y="7.6666666666666679" width="25" height="25.000000000000004"/> + <rect key="frame" x="14.666666666666668" y="7.6666666666666679" width="38.666666666666657" height="25.000000000000004"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kTL-dA-lNA"> - <rect key="frame" x="0.0" y="0.0" width="25" height="25"/> + <rect key="frame" x="5.0000000000000018" y="0.0" width="28.666666666666671" height="25"/> <fontDescription key="fontDescription" type="system" pointSize="11"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> @@ -76,10 +79,10 @@ </subviews> <color key="backgroundColor" red="0.89803921568627454" green="0.71372549019607845" blue="0.39215686274509803" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> - <constraint firstAttribute="trailing" secondItem="kTL-dA-lNA" secondAttribute="trailing" id="4rs-Ms-47V"/> + <constraint firstAttribute="trailing" secondItem="kTL-dA-lNA" secondAttribute="trailing" constant="5" id="4rs-Ms-47V"/> <constraint firstAttribute="bottom" secondItem="kTL-dA-lNA" secondAttribute="bottom" id="Gk6-tP-QxW"/> - <constraint firstItem="kTL-dA-lNA" firstAttribute="leading" secondItem="rmi-DQ-cp9" secondAttribute="leading" id="Utr-e1-5lW"/> - <constraint firstAttribute="width" constant="25.100000000000001" id="j5h-a9-Qj3"/> + <constraint firstItem="kTL-dA-lNA" firstAttribute="leading" secondItem="rmi-DQ-cp9" secondAttribute="leading" constant="5" id="Utr-e1-5lW"/> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="25.100000000000001" id="j5h-a9-Qj3"/> <constraint firstItem="kTL-dA-lNA" firstAttribute="top" secondItem="rmi-DQ-cp9" secondAttribute="top" id="qKa-MB-Ohi"/> <constraint firstAttribute="height" constant="25.100000000000001" id="xtT-s6-JWf"/> </constraints> @@ -100,6 +103,8 @@ <constraint firstAttribute="trailing" secondItem="cCC-0f-GSV" secondAttribute="trailing" id="brF-kM-RJ7"/> <constraint firstItem="cCC-0f-GSV" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="c6s-ah-BAB"/> <constraint firstAttribute="bottom" secondItem="Fb9-IV-vVk" secondAttribute="bottom" id="jcg-ng-xeW"/> + <constraint firstItem="IJ3-94-7an" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="7" id="lJE-19-Y4g"/> + <constraint firstItem="IJ3-94-7an" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="8" id="sRa-g7-6M4"/> <constraint firstItem="deT-IZ-PtZ" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="7" id="tPU-LR-azA"/> <constraint firstItem="cCC-0f-GSV" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="tmD-tf-gYR"/> <constraint firstItem="rmi-DQ-cp9" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="7.5" id="wLQ-lC-KXg"/> @@ -109,6 +114,7 @@ <outlet property="cons_maxSubTitle" destination="Fam-ne-FM1" id="L5X-GP-uev"/> <outlet property="image_free" destination="deT-IZ-PtZ" id="kI7-7g-aIM"/> <outlet property="img_cover" destination="cCC-0f-GSV" id="85x-ue-edy"/> + <outlet property="img_offline" destination="IJ3-94-7an" id="EYY-vi-GGP"/> <outlet property="img_tipPeople" destination="hE1-AV-t8f" id="ObN-5h-jnl"/> <outlet property="img_vip" destination="yBF-fO-fwz" id="icq-m9-dx3"/> <outlet property="label_num" destination="JaY-19-IAL" id="2RU-X7-0wb"/> @@ -123,6 +129,7 @@ </objects> <resources> <image name="icon_freee" width="50" height="18"/> + <image name="icon_offline" width="34" height="18"/> <image name="icon_use_small" width="10" height="10.666666984558105"/> <image name="icon_vip" width="21.666666030883789" height="21.666666030883789"/> </resources> 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 b722eee..00b223f 100644 --- a/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.swift +++ b/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.swift @@ -6,14 +6,27 @@ // import UIKit +import JQTools class Home_Style_4_Inner_CCell: UICollectionViewCell { - @IBOutlet weak var view_text_bg: UIView! - override func awakeFromNib() { + @IBOutlet weak var label_title: UILabel! + @IBOutlet weak var label_subTitle: UILabel! + @IBOutlet weak var view_text_bg: UIView! + @IBOutlet weak var label_peopleNum: UILabel! + @IBOutlet weak var cover_bgImage: UIImageView! + @IBOutlet weak var view_price: UIView! + @IBOutlet weak var label_price: UILabel! + @IBOutlet weak var img_vip: UIImageView! + @IBOutlet weak var image_free: UIImageView! + + override func awakeFromNib() { super.awakeFromNib() // Initialization code + + cover_bgImage.jq_cornerRadius = 10 + view_price.jq_cornerRadius = 12.55 let blurEffect = UIBlurEffect(style: .light) let visualEffectView = UIVisualEffectView(effect: blurEffect) @@ -26,4 +39,24 @@ visualEffectView.layer.masksToBounds = true } + + func setMeditationModel(_ model:MeditationModel){ + label_title.text = model.meditationTitle + label_subTitle.text = model.coverDescription + cover_bgImage.sd_setImage(with: URL(string: model.coverUrl)) + label_peopleNum.text = model.realLearnedNum.string + + image_free.isHidden = model.chargeType != .free + img_vip.isHidden = model.chargeType != .vipFree + view_price.isHidden = model.chargeType != .payment + + 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/Home_Style_4_Inner_CCell.xib b/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.xib index 81ddb77..4901f09 100644 --- a/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.xib +++ b/XQMuse/Root/Home/CCell/Home_Style_4_Inner_CCell.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="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> @@ -24,6 +24,29 @@ <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="demo_pg_1" translatesAutoresizingMaskIntoConstraints="NO" id="0wr-Ds-8U1"> <rect key="frame" x="0.0" y="0.0" width="417" height="306"/> </imageView> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_freee" translatesAutoresizingMaskIntoConstraints="NO" id="qtk-jE-zYr"> + <rect key="frame" x="10" y="25" width="50" height="18"/> + </imageView> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uuN-2T-9v0"> + <rect key="frame" x="20.999999999999996" y="21" width="38.666666666666657" height="25"/> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GYP-BU-qEb"> + <rect key="frame" x="5.0000000000000018" y="0.0" width="28.666666666666671" height="25"/> + <fontDescription key="fontDescription" type="system" pointSize="11"/> + <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <color key="backgroundColor" red="0.8980392157" green="0.71372549019999998" blue="0.3921568627" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <constraint firstAttribute="height" constant="25.100000000000001" id="3O3-Wj-ZQk"/> + <constraint firstItem="GYP-BU-qEb" firstAttribute="top" secondItem="uuN-2T-9v0" secondAttribute="top" id="Tzl-UN-BMh"/> + <constraint firstItem="GYP-BU-qEb" firstAttribute="leading" secondItem="uuN-2T-9v0" secondAttribute="leading" constant="5" id="XsV-Ix-1OA"/> + <constraint firstAttribute="bottom" secondItem="GYP-BU-qEb" secondAttribute="bottom" id="Ylc-8p-Xdu"/> + <constraint firstAttribute="trailing" secondItem="GYP-BU-qEb" secondAttribute="trailing" constant="5" id="jS2-fF-2N8"/> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="25.100000000000001" id="kwa-m0-MN9"/> + </constraints> + </view> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_vip" translatesAutoresizingMaskIntoConstraints="NO" id="3SE-bW-QUN"> <rect key="frame" x="22.666666666666664" y="22" width="21.666666666666664" height="21.666666666666671"/> </imageView> @@ -86,12 +109,16 @@ <color key="backgroundColor" systemColor="systemBackgroundColor"/> <constraints> <constraint firstItem="3SE-bW-QUN" firstAttribute="top" secondItem="uBp-4Z-R7I" secondAttribute="top" constant="22" id="7pu-mh-ZHA"/> + <constraint firstItem="uuN-2T-9v0" firstAttribute="top" secondItem="uBp-4Z-R7I" secondAttribute="top" constant="21" id="8Bg-sg-Vj2"/> + <constraint firstItem="uuN-2T-9v0" firstAttribute="leading" secondItem="uBp-4Z-R7I" secondAttribute="leading" constant="21" id="DmF-KG-7vU"/> <constraint firstAttribute="bottom" secondItem="0wr-Ds-8U1" secondAttribute="bottom" id="IG4-8T-fQI"/> <constraint firstItem="1q9-TW-tvm" firstAttribute="leading" secondItem="uBp-4Z-R7I" secondAttribute="leading" constant="11" id="NDB-uF-c6J"/> <constraint firstAttribute="trailing" secondItem="0wr-Ds-8U1" secondAttribute="trailing" id="Rp9-rB-RjA"/> + <constraint firstItem="qtk-jE-zYr" firstAttribute="top" secondItem="uBp-4Z-R7I" secondAttribute="top" constant="25" id="SJD-A0-8xJ"/> <constraint firstItem="0wr-Ds-8U1" firstAttribute="leading" secondItem="uBp-4Z-R7I" secondAttribute="leading" id="VB8-6e-alw"/> <constraint firstAttribute="width" secondItem="uBp-4Z-R7I" secondAttribute="height" multiplier="1:0.734" id="a3p-O7-YVH"/> <constraint firstItem="3SE-bW-QUN" firstAttribute="leading" secondItem="uBp-4Z-R7I" secondAttribute="leading" constant="22.5" id="acq-2b-o03"/> + <constraint firstItem="qtk-jE-zYr" firstAttribute="leading" secondItem="uBp-4Z-R7I" secondAttribute="leading" constant="10" id="dLN-nd-UyR"/> <constraint firstAttribute="bottom" secondItem="1q9-TW-tvm" secondAttribute="bottom" constant="9.5" id="n7D-lz-0VO"/> <constraint firstAttribute="trailing" secondItem="1q9-TW-tvm" secondAttribute="trailing" constant="11" id="tQX-QX-bnF"/> <constraint firstItem="0wr-Ds-8U1" firstAttribute="top" secondItem="uBp-4Z-R7I" secondAttribute="top" id="yhp-sW-lXD"/> @@ -107,6 +134,14 @@ </constraints> <size key="customSize" width="455" height="385"/> <connections> + <outlet property="cover_bgImage" destination="0wr-Ds-8U1" id="IXg-DC-fLZ"/> + <outlet property="image_free" destination="qtk-jE-zYr" id="jEv-yO-uAa"/> + <outlet property="img_vip" destination="3SE-bW-QUN" id="MVq-Rr-ZaX"/> + <outlet property="label_peopleNum" destination="ANZ-Kn-isU" id="Qwy-mQ-ZXZ"/> + <outlet property="label_price" destination="GYP-BU-qEb" id="bVC-be-fMq"/> + <outlet property="label_subTitle" destination="Enr-D6-xzP" id="nHP-Rn-uin"/> + <outlet property="label_title" destination="1bZ-4v-DSk" id="X3J-ac-ebe"/> + <outlet property="view_price" destination="uuN-2T-9v0" id="NBM-4w-kOO"/> <outlet property="view_text_bg" destination="1q9-TW-tvm" id="vW7-g9-YjL"/> </connections> <point key="canvasLocation" x="448.09160305343511" y="138.38028169014086"/> @@ -114,6 +149,7 @@ </objects> <resources> <image name="demo_pg_1" width="353.66665649414062" height="259.66665649414062"/> + <image name="icon_freee" width="50" height="18"/> <image name="icon_play" width="46" height="46"/> <image name="icon_use_small" width="10" height="10.666666984558105"/> <image name="icon_vip" width="21.666666030883789" height="21.666666030883789"/> diff --git a/XQMuse/Root/Home/HomeVC.swift b/XQMuse/Root/Home/HomeVC.swift index 97d7309..e1ccfcc 100644 --- a/XQMuse/Root/Home/HomeVC.swift +++ b/XQMuse/Root/Home/HomeVC.swift @@ -278,7 +278,7 @@ 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 = .style1 + cell.style = .style2 cell.setModels(m.clientMeditationVOList) return cell }else if m.clientMeditationCategoryVO!.showType == .vertical{ diff --git a/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift b/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift index 51e7a40..3c660d4 100644 --- a/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift +++ b/XQMuse/Root/Home/TCell/Home_Style_3_TCell.swift @@ -42,7 +42,6 @@ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBannerCCell", for: indexPath) as! HomeRelaxBannerCCell - cell.contentView.backgroundColor = .jq_randomColor cell.setMeditationModel(meditationModels[indexPath.row]) return cell } @@ -57,7 +56,7 @@ } if m.chargeType == .payment && m.paidStatus == .no{ - let vc = PaymentOrderVC(courseId: m.id) + let vc = PaymentOrderVC(id: m.id,type: .muse,giftToOther: true) 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 5dc3c75..a132a7e 100644 --- a/XQMuse/Root/Home/TCell/Home_Style_4_TCell.swift +++ b/XQMuse/Root/Home/TCell/Home_Style_4_TCell.swift @@ -40,8 +40,20 @@ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - let detailVC = HomeItemDetailVC(id: meditationModels[indexPath.row].id) - JQ_currentViewController().jq_push(vc: detailVC) + let m = meditationModels[indexPath.row] + + if m.chargeType == .free || (m.chargeType == .vipFree && UserViewModel.getAvatarInfo().isVip == .yes) || (m.chargeType == .payment && m.paidStatus == .yes){ + let detailVC = HomeItemDetailVC(id: meditationModels[indexPath.row].id) + JQ_currentViewController().jq_push(vc: detailVC) + }else{ + if m.chargeType == .vipFree{ + let vc = VIPCenterVC() + JQ_currentViewController().jq_push(vc: vc) + }else{ + let vc = PaymentOrderVC(id: m.id,type: .muse,giftToOther: true) + JQ_currentViewController().jq_push(vc:vc) + } + } } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { @@ -57,6 +69,7 @@ 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]) return cell } diff --git a/XQMuse/Root/Home/TCell/Home_Style_5_TCell.swift b/XQMuse/Root/Home/TCell/Home_Style_5_TCell.swift index f1447f0..e03eb46 100644 --- a/XQMuse/Root/Home/TCell/Home_Style_5_TCell.swift +++ b/XQMuse/Root/Home/TCell/Home_Style_5_TCell.swift @@ -12,9 +12,12 @@ private var items = [HomeTopMenuItem]() @IBOutlet weak var btn_1: UIButton! - @IBOutlet weak var btn_2: UIButton! + @IBOutlet weak var cons_btn_1_w: NSLayoutConstraint! + @IBOutlet weak var btn_2: UIButton! + @IBOutlet weak var cons_btn_2_w: NSLayoutConstraint! @IBOutlet weak var btn_3: UIButton! - + @IBOutlet weak var cons_btn_3_w: NSLayoutConstraint! + override func awakeFromNib() { super.awakeFromNib() btn_1.isHidden = true @@ -28,6 +31,15 @@ btn_1.tag = 1000 btn_2.tag = 1001 btn_3.tag = 1002 + + btn_1.jq_cornerRadius = 10 + btn_2.jq_cornerRadius = 10 + btn_3.jq_cornerRadius = 10 + + let w = (JQ_ScreenW - 19 * 2 - 9.5 * 2) / 3.0 + cons_btn_1_w.constant = w + cons_btn_2_w.constant = w + cons_btn_3_w.constant = w } func setHomeTopMenuItem(_ items:[HomeTopMenuItem]){ diff --git a/XQMuse/Root/Home/TCell/Home_Style_5_TCell.xib b/XQMuse/Root/Home/TCell/Home_Style_5_TCell.xib index 9d2fd31..a76868a 100644 --- a/XQMuse/Root/Home/TCell/Home_Style_5_TCell.xib +++ b/XQMuse/Root/Home/TCell/Home_Style_5_TCell.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="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -18,27 +18,30 @@ <autoresizingMask key="autoresizingMask"/> <subviews> <stackView opaque="NO" contentMode="scaleToFill" spacing="9.5" translatesAutoresizingMaskIntoConstraints="NO" id="iSv-Jr-Qcx"> - <rect key="frame" x="53.666666666666657" y="27.333333333333336" width="354.66666666666674" height="126.66666666666666"/> + <rect key="frame" x="53.666666666666657" y="27.333333333333336" width="354.66666666666674" height="126.33333333333331"/> <subviews> <button opaque="NO" contentMode="scaleAspectFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="30T-1D-WNl"> - <rect key="frame" x="0.0" y="0.0" width="111.66666666666667" height="126.66666666666667"/> + <rect key="frame" x="0.0" y="0.0" width="111.66666666666667" height="126.33333333333333"/> <constraints> + <constraint firstAttribute="width" constant="111.67" id="fzt-qD-W54"/> <constraint firstAttribute="width" secondItem="30T-1D-WNl" secondAttribute="height" multiplier="1:1.134" id="rI9-Qc-ZN4"/> </constraints> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" image="bg_home_3"/> </button> <button opaque="NO" contentMode="scaleAspectFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vXA-OX-SB1"> - <rect key="frame" x="121.33333333333334" y="0.0" width="112" height="126.66666666666667"/> + <rect key="frame" x="121.33333333333334" y="-0.3333333333333357" width="112" height="126.66666666666669"/> <constraints> <constraint firstAttribute="width" secondItem="vXA-OX-SB1" secondAttribute="height" multiplier="1:1.134" id="AHL-qK-kMk"/> + <constraint firstAttribute="width" constant="112" id="Gkt-sc-pFk"/> </constraints> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" image="bg_home_1"/> </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xmc-SJ-H1U"> - <rect key="frame" x="243.00000000000003" y="0.0" width="111.66666666666666" height="126.66666666666667"/> + <rect key="frame" x="243.00000000000003" y="0.0" width="111.66666666666666" height="126.33333333333333"/> <constraints> + <constraint firstAttribute="width" constant="111.67" id="iGJ-mz-GOJ"/> <constraint firstAttribute="width" secondItem="xmc-SJ-H1U" secondAttribute="height" multiplier="1:1.134" id="nka-Yt-rjX"/> </constraints> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> @@ -57,6 +60,9 @@ <outlet property="btn_1" destination="30T-1D-WNl" id="lfD-IP-ddb"/> <outlet property="btn_2" destination="vXA-OX-SB1" id="a4n-5r-1jP"/> <outlet property="btn_3" destination="xmc-SJ-H1U" id="uf7-FI-OON"/> + <outlet property="cons_btn_1_w" destination="fzt-qD-W54" id="yZ2-D5-0WD"/> + <outlet property="cons_btn_2_w" destination="Gkt-sc-pFk" id="CU8-ai-4oE"/> + <outlet property="cons_btn_3_w" destination="iGJ-mz-GOJ" id="0QG-q0-JHM"/> </connections> <point key="canvasLocation" x="174.04580152671755" y="68.661971830985919"/> </tableViewCell> diff --git a/XQMuse/Root/Home/VC/HomeItemListVC.swift b/XQMuse/Root/Home/VC/HomeItemListVC.swift index e4007fa..cd4cacd 100644 --- a/XQMuse/Root/Home/VC/HomeItemListVC.swift +++ b/XQMuse/Root/Home/VC/HomeItemListVC.swift @@ -78,8 +78,19 @@ } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - let id = viewModel.dataSource.value!.list[indexPath.row].id - let vc = HomeItemDetailVC(id: id) - push(vc: vc) + 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 detailVC = HomeItemDetailVC(id: m.id) + jq_push(vc: detailVC) + }else{ + if m.chargeType == .vipFree{ + let vc = VIPCenterVC() + jq_push(vc: vc) + }else{ + let vc = PaymentOrderVC(id: m.id,type: .muse,giftToOther: true) + jq_push(vc: vc) + } + } } } diff --git a/XQMuse/Root/Home/VC/PaymentOrderVC.swift b/XQMuse/Root/Home/VC/PaymentOrderVC.swift index ad2c25f..f4832e9 100644 --- a/XQMuse/Root/Home/VC/PaymentOrderVC.swift +++ b/XQMuse/Root/Home/VC/PaymentOrderVC.swift @@ -12,6 +12,11 @@ class PaymentOrderVC: BaseVC { + enum PaymentOrderType { + case course + case muse + } + @IBOutlet weak var image_cover: UIImageView! @IBOutlet weak var label_price: UILabel! @IBOutlet weak var label_teacher: UILabel! @@ -33,16 +38,19 @@ @IBOutlet weak var tf_phone: QMUITextField! @IBOutlet weak var label_walletBalance: UILabel! @IBOutlet weak var btn_isreadAgreement: UIButton! - private var courseId:Int! + private var id:Int! private var giftUserId:Int? private var giftToOther:Bool! private var courseModel:CourseModel? + private var museModel:MeditationModel? private var balance:Double = 0 + private var type:PaymentOrderType! - init(courseId:Int,giftToOther:Bool = false) { + init(id:Int,type:PaymentOrderType,giftToOther:Bool = false) { super.init(nibName: nil, bundle: nil) - self.courseId = courseId + self.id = id self.giftToOther = giftToOther + self.type = type } required init?(coder: NSCoder) { @@ -57,18 +65,37 @@ getBalance() - Services.getCourseDetail(courseId: courseId).subscribe(onNext: {data in - if let m = data.data{ - self.courseModel = m - self.image_cover.sd_setImage(with: URL(string: m.coverUrl)) - self.label_courseName.text = m.courseTitle - self.label_price.text = "愈疗币\(m.generalPrice.jq_formatFloat)" - self.label_teacher.text = "导师\(m.tutor)" - self.label_paymentCount.text = "x\(m.count)" - self.label_orderPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" - self.label_totalPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" - } - }).disposed(by: disposeBag) + if type == .course{ + Services.getCourseDetail(courseId: id).subscribe(onNext: {data in + if let m = data.data{ + self.courseModel = m + self.image_cover.sd_setImage(with: URL(string: m.coverUrl)) + self.label_courseName.text = m.courseTitle + self.label_price.text = "愈疗币\(m.generalPrice.jq_formatFloat)" + self.label_teacher.text = "导师\(m.tutor)" + self.label_paymentCount.text = "x\(m.count)" + self.label_orderPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" + self.label_totalPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" + } + }).disposed(by: disposeBag) + } + + if type == .muse{ + Services.getMeditationDetail(id: id).subscribe(onNext: {data in + if let m = data.data{ + self.museModel = m + self.image_cover.sd_setImage(with: URL(string: m.coverUrl)) + self.label_courseName.text = m.meditationTitle + self.label_price.text = "愈疗币\(m.generalPrice.jq_formatFloat)" + self.label_teacher.text = "" + self.label_paymentCount.text = "x1" + self.label_orderPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" + self.label_totalPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" + } + }).disposed(by: disposeBag) + } + + } override func setUI() { @@ -158,7 +185,7 @@ return } - let vc = PaymentOrderResultVC(courseId: courseId, price: m.generalPrice) + let vc = PaymentOrderResultVC(courseId: id, price: m.generalPrice) push(vc: vc) } } diff --git a/XQMuse/Root/Home/VC/SearchContentVC.swift b/XQMuse/Root/Home/VC/SearchContentVC.swift index 86087c5..98787a6 100644 --- a/XQMuse/Root/Home/VC/SearchContentVC.swift +++ b/XQMuse/Root/Home/VC/SearchContentVC.swift @@ -131,13 +131,33 @@ switch serchType{ case .course: let m = courseViewModel!.dataSource.value!.list[indexPath.row] - let vc = CourseDetialVC(courseId: m.id) - JQ_currentViewController().jq_push(vc: vc) + if m.chargeType == .free || (m.chargeType == .vipFree && UserViewModel.getAvatarInfo().isVip == .yes) || (m.chargeType == .payment && m.isBuy == .yes){ + let vc = CourseDetialVC(courseId: m.id) + JQ_currentViewController().jq_push(vc: vc) + }else{ + if m.chargeType == .vipFree{ + let vc = VIPCenterVC() + JQ_currentViewController().jq_push(vc: vc) + }else{ + let vc = PaymentOrderVC(id: m.id,type: .course,giftToOther: true) + JQ_currentViewController().jq_push(vc:vc) + } + } case .muse: let m = museViewModel!.dataSource.value!.list[indexPath.row] - let vc = HomeItemDetailVC(id: m.id) - JQ_currentViewController().jq_push(vc: vc) + if m.chargeType == .free || (m.chargeType == .vipFree && UserViewModel.getAvatarInfo().isVip == .yes) || (m.chargeType == .payment && m.paidStatus == .yes){ + let detailVC = HomeItemDetailVC(id: m.id) + JQ_currentViewController().jq_push(vc: detailVC) + }else{ + if m.chargeType == .vipFree{ + let vc = VIPCenterVC() + JQ_currentViewController().jq_push(vc: vc) + }else{ + let vc = PaymentOrderVC(id: m.id,type: .muse,giftToOther: true) + JQ_currentViewController().jq_push(vc:vc) + } + } default:break } @@ -148,8 +168,9 @@ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBanner_2_CCell", for: indexPath) as! HomeRelaxBanner_2_CCell switch serchType{ - case .course:break - + case .course: + let m = courseViewModel!.dataSource.value!.list[indexPath.row] + cell.setCourseModel(m) case .muse: let m = museViewModel!.dataSource.value!.list[indexPath.row] cell.setMeditationModel(m) diff --git a/XQMuse/Root/Network/Models.swift b/XQMuse/Root/Network/Models.swift index f9f4768..8ebff6e 100644 --- a/XQMuse/Root/Network/Models.swift +++ b/XQMuse/Root/Network/Models.swift @@ -99,7 +99,7 @@ var backgroundUrl: String = "" var cateId: Int = 0 var chargeType:ChargeType = .free - var paidStatus:ConditionType = .no + var paidStatus:ConditionType = .no //是否购买 var coverDescription: String = "" var coverUrl: String = "" var detailDescription: String = "" @@ -117,6 +117,7 @@ var tutorAudioUrl: String = "" var virtualLearnedNum: Int = 0 var favorite:ConditionType = .no // 是否收藏:1:是 2:否 + var tutor:String = "" var meditationMusicList = [String]() } diff --git a/XQMuse/Root/Network/Services.swift b/XQMuse/Root/Network/Services.swift index 981a497..4efaf0d 100644 --- a/XQMuse/Root/Network/Services.swift +++ b/XQMuse/Root/Network/Services.swift @@ -301,7 +301,7 @@ } /// 获取课程列表 - class func getCoursePageList(page:Int,pageSize:Int = 20,cateId:String? = nil,courseTitle:String? = nil)->Observable<BaseResponse<BaseResponseList<CourseModel>>>{ + class func getCoursePageList(page:Int,pageSize:Int = 20,cateId:Int? = nil,courseTitle:String? = nil)->Observable<BaseResponse<BaseResponseList<CourseModel>>>{ let params = ParamsAppender.build(url: All_Url) params.interface(url: "/course/client/course/course/getCoursePageList") .append(key: "pageCurr", value: page) -- Gitblit v1.7.1