WanPai/Assets.xcassets/Btns/btn_cancel.imageset/Contents.json
New file @@ -0,0 +1,22 @@ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "filename" : "btn_cancel@2x.png", "idiom" : "universal", "scale" : "2x" }, { "filename" : "btn_cancel@3x.png", "idiom" : "universal", "scale" : "3x" } ], "info" : { "author" : "xcode", "version" : 1 } } WanPai/Assets.xcassets/Btns/btn_cancel.imageset/btn_cancel@2x.png
WanPai/Assets.xcassets/Btns/btn_cancel.imageset/btn_cancel@3x.png
WanPai/Model/CommonModels.swift
@@ -43,11 +43,14 @@ var courseTimeFrame: String = "" var coverDrawing: String = "" var introduceDrawing: String = "" var payStatus: Int = 0 // 1:未支付,2:续课 var payStatus: PayStateType = .paymented // 1:未支付,2:续课 var vipAmount: Int = 0 var weeks: String? var weeks: String = "" var wpGold: Int = 0 var paymentPrice:Double = 0 var time = "" var list = [CourseDetailListModel]() var chooseHours = 0 } struct CourseDetailModel:HandyJSON { @@ -440,6 +443,7 @@ var videoName: String = "" var videoUrl: String = "" var videoId = 0 var coursePackageId = 0 } struct StartClouseReportModel:HandyJSON{ WanPai/Network/Services.swift
@@ -406,12 +406,13 @@ return NetworkRequest.request(params: params, method: .post, progress: false) } class func queryCourseInfo(id:Int)->Observable<BaseResponse<CourseDetailModel>>{ class func queryCourseInfo(id:Int,payId:Int? = nil)->Observable<BaseResponse<CourseDetailModel>>{ let params = ParamsAppender.build(url: All_Url) .interface(url: "/course/api/course/queryCourseInfo") .append(key: "id", value: id) .append(key: "lat", value: locationTool.currentLocation?.coordinate.latitude.string) .append(key: "lon", value: locationTool.currentLocation?.coordinate.longitude.string) .append(key: "payId", value: payId) return NetworkRequest.request(params: params, method: .post, progress: true) } @@ -591,7 +592,7 @@ } /// 课后练习-课后视频列表 static func exerciseCourseList(courseTypeId:Int?,search:String)->Observable<BaseResponse<[ExerciseVideoModel]>>{ static func exerciseCourseList(courseTypeId:Int?,search:String? = nil)->Observable<BaseResponse<[ExerciseVideoModel]>>{ let params = ParamsAppender.build(url: All_Url) .interface(url: "/course/api/startCource/afterSourceList") .append(key: "courseTypeId", value: courseTypeId) WanPai/Root/Activity/VC/ActivityListVC.xib
@@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" 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="22130"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/> <capability name="Named colors" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> @@ -157,7 +157,7 @@ </constraints> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="已报名赛事"> <state key="normal" title="已报名活动"> <color key="titleColor" red="0.94901960784313721" green="0.97647058823529409" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </state> <connections> WanPai/Root/Activity/VC/ActivitySignupDetailVC.swift
@@ -8,6 +8,7 @@ import UIKit import SDWebImage import JQTools import QMUIKit let CancelActivitySingup_Noti = Notification.Name.init("CancelActivitySingup_Noti") @@ -30,7 +31,7 @@ @IBOutlet weak var label_introducion: UILabel! @IBOutlet weak var img_enrollRequired: UIImageView! @IBOutlet weak var cons_imgEnrollHei: NSLayoutConstraint! @IBOutlet weak var btn_cancel: UIButton! @IBOutlet weak var btn_cancel: QMUIButton! @IBOutlet weak var tableView: UITableView! @IBOutlet weak var cons_tableHei: NSLayoutConstraint! @IBOutlet weak var label_matchStore: UILabel! @@ -93,32 +94,39 @@ case .prepare: let name = m.apply == 1 ? "取消":"已取消" let color = m.apply == 1 ? Def_ThemeColor:UIColor(hexStr: "#C0C0C0") btn_cancel.isEnabled = m.apply == 1 btn_cancel.isUserInteractionEnabled = m.apply == 1 btn_cancel.setTitle(name, for: .normal) btn_cancel.backgroundColor = color if m.apply == 1{ btn_cancel.setImage(UIImage(named: "btn_cancel"), for: .normal) } case .ongoing: let endTime = Date.jq_StringToTimeInterval(m.registerEndTime, "yyyy-MM-dd HH:mm") let a = Date.jq_CalByDays(startDate: Date(), endDate: Date(timeIntervalSince1970: endTime)) if Date.jq_CalByEnum(startDate: Date(), endDate: Date(timeIntervalSince1970: endTime)).minute > 0{ let name = m.apply == 1 ? "取消":"已取消" let color = m.apply == 1 ? Def_ThemeColor:UIColor(hexStr: "#C0C0C0") btn_cancel.isEnabled = m.apply == 1 btn_cancel.isUserInteractionEnabled = m.apply == 1 btn_cancel.setTitle(name, for: .normal) btn_cancel.backgroundColor = color if m.apply == 1{ btn_cancel.setImage(UIImage(named: "btn_cancel"), for: .normal) } }else{ btn_cancel.setTitle("进行中", for: .normal) btn_cancel.isEnabled = false btn_cancel.isUserInteractionEnabled = false btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") } case .over: btn_cancel.setTitle("已结束", for: .normal) btn_cancel.isEnabled = false btn_cancel.isUserInteractionEnabled = false btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") case .cancel: btn_cancel.setTitle("已取消", for: .normal) btn_cancel.isEnabled = false btn_cancel.isUserInteractionEnabled = false btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") default:break } @@ -145,6 +153,8 @@ } override func setUI() { btn_cancel.imagePosition = .left btn_cancel.spacingBetweenImageAndTitle = 12 tableView.delegate = self tableView.dataSource = self tableView.separatorStyle = .none WanPai/Root/Activity/VC/ActivitySignupDetailVC.xib
@@ -588,7 +588,7 @@ <constraint firstItem="u6Z-PS-k1D" firstAttribute="centerX" secondItem="Rym-cm-VUC" secondAttribute="centerX" id="iGj-93-P56"/> </constraints> </scrollView> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gsK-Ti-c0V"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gsK-Ti-c0V" customClass="QMUIButton"> <rect key="frame" x="0.0" y="770" width="393" height="48"/> <color key="backgroundColor" name="FE6E0D"/> <constraints> WanPai/Root/Course/VC/CourseDetailApplyVC.swift
@@ -43,14 +43,14 @@ private var detailModel:CourseDetailModel? private var selectClassIndex:Int = 0 private var isExtend:Bool = false private var CellW:Double! private var CellH:Double! private var studentModels = [CourseDetailStudentModel]() private var couponModels = [CouponInfoModel]() private var selectCouponModel:CouponInfoModel? private var classHours:Int? private var signUpCourseModel:SignUpCourseItemModel? // private var signUpCourseModel:SignUpCourseItemModel? private var signUpModel:SignUpCourseItemDetailModel? override func viewDidLoad() { super.viewDidLoad() @@ -108,17 +108,17 @@ view_banner.setItems(items: items) } if let m = signUpModel{ classHours = m.chooseHours if m.payStatus == .unPayment{ btn_handleBtn.setTitle("待支付", for: .normal) btn_addStudent.isHidden = true } btn_addStudent.isHidden = isExtend if isExtend{ btn_handleBtn.setTitle("续课", for: .normal) }else{ btn_handleBtn.setTitle("立即报名", for: .normal) } if signUpCourseModel?.payStatus == .unPayment{ btn_handleBtn.setTitle("待支付", for: .normal) btn_addStudent.isHidden = true if m.payStatus == .paymented{ btn_handleBtn.setTitle("续课", for: .normal) btn_addStudent.isHidden = true } } } @@ -142,12 +142,11 @@ btn_addStudent.spacingBetweenImageAndTitle = 3 } init(detailModel:CourseDetailModel,isExtend:Bool = false,classHours:Int? = nil,signUpCourseModel:SignUpCourseItemModel? = nil) { init(detailModel:CourseDetailModel,signUpModel:SignUpCourseItemDetailModel? = nil,classHours:Int? = nil) { super.init(nibName: nil, bundle: nil) self.detailModel = detailModel self.isExtend = isExtend self.signUpModel = signUpModel self.classHours = classHours self.signUpCourseModel = signUpCourseModel } required init?(coder: NSCoder) { @@ -193,7 +192,13 @@ StoresInfoView.show(detailModel!) { [weak self] status in guard let weakSelf = self else { return } if status{ if let model = weakSelf.detailModel?.list[weakSelf.selectClassIndex]{ if var model = weakSelf.detailModel?.list[weakSelf.selectClassIndex]{ //续课时价格 if let list = weakSelf.signUpModel?.list{ model = list[weakSelf.selectClassIndex] } var price:Double = 0 //是否是会员 @@ -213,16 +218,16 @@ PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil,integral:nil)) { [weak self] payType in guard let weakSelf = self else { return } var paymentPrice:Double = 0 var resultPayPrice:Double = 0 switch payType { case .aliPay,.wechat: paymentPrice = discountPrice resultPayPrice = price case .coin: paymentPrice = Double(coin) resultPayPrice = Double(coin) case .courseNum,.integral:break } Services.courcePayment(conponId: weakSelf.selectCouponModel?.id, courseConfigId: model.id, id: weakSelf.detailModel!.id, price: price, payType: payType, stuId: weakSelf.studentModels.map({$0.id})).subscribe(onNext: { data in Services.courcePayment(conponId: weakSelf.selectCouponModel?.id, courseConfigId: model.id, id: weakSelf.detailModel!.id, price: resultPayPrice, payType: payType, stuId: weakSelf.studentModels.map({$0.id})).subscribe(onNext: { data in if data.code == 200{ switch payType { case .aliPay: @@ -230,7 +235,7 @@ switch result { case .success: let vc = PaymentResultVC(result: .success, objType: .courseApply,handleVC: self,courseConfigId: model.id) vc.isExtend = self?.isExtend ?? false vc.isExtend = self?.signUpModel?.payStatus == .paymented self?.push(vc: vc) case .cancel: alert(msg: "已取消") @@ -243,9 +248,8 @@ self?.navigationController?.popViewController(animated: false) break case .coin: // self?.navigationController?.popViewController(animated: false) let vc = PaymentResultVC(result: .success, objType: .courseApply,handleVC: self,courseConfigId: model.id) vc.isExtend = self?.isExtend ?? false vc.isExtend = self?.signUpModel?.payStatus == .paymented self?.push(vc: vc) case .courseNum,.integral:break } @@ -482,7 +486,7 @@ alert(msg: "至少选择一位运动营成员") } } cell.btn_handle.isHidden = isExtend cell.btn_handle.isHidden = signUpModel != nil return cell } } WanPai/Root/Course/VC/CourseDetailVC.swift
@@ -180,9 +180,9 @@ super.viewDidLoad() title = "运动营详情" if signUpCourseModel?.payStatus == 1{ if signUpCourseModel?.payStatus == .unPayment{ btn_enroll.setTitle("待支付", for: .normal) }else if signUpCourseModel?.payStatus == 2{ }else if signUpCourseModel?.payStatus == .paymented{ btn_enroll.setTitle("续课", for: .normal) } @@ -204,17 +204,8 @@ } @IBAction func applyAction(_ sender: UIButton) { //待支付订单 if let m = signUpCourseModel,m.payStatus == 1{ return } if let m = detailModel{ let vc = CourseDetailApplyVC(detailModel: m,isExtend: signUpCourseModel?.payStatus == 2) let vc = CourseDetailApplyVC(detailModel: m,signUpModel: signUpCourseModel) push(vc: vc) } } WanPai/Root/Course/VC/CourseInfoVC.swift
@@ -325,12 +325,14 @@ let index = pageMenu.selectedItemIndex let models = startClouseHomeModel!.courseList guard index < models.count else {return} Services.queryCourseInfo(id: models[index].courseId).subscribe(onNext: {[weak self] data in if let m = data.data{ let vc = CourseDetailApplyVC(detailModel: m,isExtend: true) self?.push(vc: vc) Services.registeredData(coursePayId: models[index].id).subscribe(onNext: {data in if let m1 = data.data{ let vc = CourseDetailVC(id: models[index].courseId, signUpCourseModel: m1) self.push(vc: vc) } }).disposed(by: disposeBag) }) { error in }.disposed(by: disposeBag) } @IBAction func bookingRecordAction(_ sender: UIButton) { @@ -524,9 +526,13 @@ push(vc: vc) }else{ let model = startClouseHomeModel?.exerciseVideoList[indexPath.row] let vc = CourseVideoDetailVC(id: model!.videoId) vc.title = "课后练习" push(vc: vc) Services.exerciseCourseList(courseTypeId: model?.coursePackageId).subscribe(onNext: {[weak self] data in if let d = data.data?.first{ let vc = CourseVideoDetailVC(model: d) vc.title = "课后练习" self?.push(vc: vc) } }).disposed(by: disposeBag) } } } WanPai/Root/Course/VC/CourseVideoDetailVC.swift
@@ -146,7 +146,7 @@ @objc private func playbackEnd(){ if let m = exerciseVideoDetailModel{ if timeDuration >= CMTimeGetSeconds((playerVC.player?.currentItem?.duration)!) && m.studyStatus == 0 { if timeDuration >= CMTimeGetSeconds((playerVC.player?.currentItem?.duration)!) && m.studyStatus == 1 { Services.updateVideoStatus(coursePackageId: m.coursePackageId, videoId: m.videoId).subscribe(onNext: {[weak self] data in alertSuccess(msg: "已获得积分") self?.exerciseVideoDetailModel?.studyStatus = 2 WanPai/Root/Course/VC/SignUpCourseVC.swift
@@ -110,18 +110,22 @@ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let item = viewModel.dataSource.value[indexPath.row] Services.registeredData(coursePayId: item.coursePayId).subscribe(onNext: {data in if let m1 = data.data{ if m1.payStatus == .unPayment{ Services.queryCourseInfo(id: item.coursePackageId,payId: item.coursePayId).subscribe(onNext: { data in if let m2 = data.data{ let vc = CourseDetailApplyVC(detailModel: m2,signUpModel: m1) self.push(vc: vc) } }).disposed(by: self.disposeBag) }else{ let vc = CourseDetailVC(id: item.coursePackageId, signUpCourseModel: m1) self.push(vc: vc) } } }) { error in }.disposed(by: disposeBag) Services.queryCourseInfo(id: item.coursePackageId).subscribe(onNext: { data in if let m = data.data{ let vc = CourseDetailApplyVC(detailModel: m,signUpCourseModel: item) self.push(vc: vc) } }).disposed(by: self.disposeBag) } } WanPai/Root/Course/VC/StudentCourseDetailVC.swift
@@ -75,12 +75,15 @@ headView.renewalClouse = { [weak self] () in guard let weakSelf = self else { return } let model = weakSelf.models[weakSelf.headView.pageMenu.selectedItemIndex] Services.queryCourseInfo(id: model.courseId).subscribe(onNext: {[weak self] data in if let m = data.data{ let vc = CourseDetailApplyVC(detailModel: m,isExtend: true) self?.push(vc: vc) } }).disposed(by: weakSelf.disposeBag) Services.registeredData(coursePayId: model.id).subscribe(onNext: {[weak self]data in if let m1 = data.data{ let vc = CourseDetailVC(id: model.courseId, signUpCourseModel: m1) self?.push(vc: vc) } }) { error in }.disposed(by: weakSelf.disposeBag) } viewModel.startTime.accept(Date()) WanPai/Root/Other/VC/PaymentResultVC.swift
@@ -102,6 +102,9 @@ Services.queryMemberCoupon(menthod: 2).subscribe(onNext: {[weak self] data in if let models = data.data{ self?.models = models if models.count > 0{ self?.label_content.text = "支付成功,恭喜您成为玩湃会员!并获得优惠券!" } self?.collectionView.reloadData() } }) { error in