| | |
| | | open func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { |
| | | |
| | | let status = lucencyVCs.contains(where: {$0 == viewController.classForCoder}) |
| | | print("--->\(viewController)") |
| | | |
| | | if navigationController.viewControllers.count == 1 || status{ |
| | | if #available(iOS 15.0, *) { |
| | |
| | | self.interactivePopGestureRecognizer!.delegate = nil |
| | | } |
| | | } |
| | | |
| | | |
| | | open override var childForStatusBarHidden: UIViewController? { |
| | | return self.topViewController |
| | | } |
| | |
| | | formatter.positivePrefix = "¥" |
| | | return formatter.string(from: NSNumber(value: self)) ?? "¥0" |
| | | } |
| | | |
| | | func currencyNotPrefix()->String{ |
| | | let formatter = NumberFormatter() |
| | | formatter.numberStyle = .decimal |
| | | formatter.groupingSeparator = "," |
| | | formatter.groupingSize = 3 |
| | | formatter.positivePrefix = "" |
| | | return formatter.string(from: NSNumber(value: self)) ?? "0" |
| | | } |
| | | } |
| | | |
| | | extension Double{ |
| | |
| | | formatter.positivePrefix = "¥" |
| | | return formatter.string(from: NSNumber(value: Darwin.floor(self))) ?? "¥0" |
| | | } |
| | | func currencyNotPrefix()->String{ |
| | | let formatter = NumberFormatter() |
| | | formatter.numberStyle = .decimal |
| | | formatter.groupingSeparator = "," |
| | | formatter.groupingSize = 3 |
| | | formatter.positivePrefix = "" |
| | | return formatter.string(from: NSNumber(value: self)) ?? "0" |
| | | } |
| | | } |
| | |
| | | UIView.animate(withDuration: 0.4) { |
| | | self.alpha = 0 |
| | | self.layoutIfNeeded() |
| | | } completion: { _ in |
| | | self.removeFromSuperview() |
| | | self.clouse!(1) |
| | | } completion: { [weak self] _ in |
| | | let number = self?.numberValue.value.int ?? 1 |
| | | self?.removeFromSuperview() |
| | | self?.clouse!(number) |
| | | } |
| | | } |
| | | |
| | |
| | | // |
| | | |
| | | import UIKit |
| | | import JQTools |
| | | |
| | | class IDCardView: UIView { |
| | | |
| | |
| | | private func setUI(){ |
| | | avgCellW = screenW / 3.0 |
| | | avgCellH = VIEW_HEIGHT / 4.0 |
| | | frame = CGRect(origin: .zero, size: CGSize(width: screenW, height: VIEW_HEIGHT + SafeInserts.bottom)) |
| | | frame = CGRect(origin: .zero, size: CGSize(width: screenW, height: VIEW_HEIGHT + UIDevice.jq_safeEdges.bottom)) |
| | | backgroundColor = .white |
| | | |
| | | for (index,item) in cellItems.enumerated() { |
| | |
| | | let paymentView = PaymentView.jq_loadNibView() |
| | | paymentView.frame = screnDelegate?.window?.frame ?? .zero |
| | | paymentView.clouse = clouse |
| | | paymentView.view_wechat.isHidden = money.wx == nil |
| | | paymentView.view_coin.isHidden = money.coin == nil |
| | | paymentView.view_course.isHidden = money.course == nil |
| | | paymentView.view_alipay.isHidden = money.ali == nil |
| | | paymentView.view_wechat.isHidden = (money.wx == nil || money.wx == 0) |
| | | paymentView.view_coin.isHidden = (money.coin == nil || money.coin == 0) |
| | | paymentView.view_course.isHidden = (money.course == nil || money.course == 0) |
| | | paymentView.view_alipay.isHidden = (money.ali == nil || money.ali == 0) |
| | | paymentView.label_aliPayMoney.text = money.ali?.currency() ?? "0" |
| | | paymentView.label_wechatMoney.text = money.wx?.currency() ?? "0" |
| | | paymentView.label_coinMoney.text = "\(money.coin ?? 0)币" |
| | |
| | | SVProgressHUD.showSuccess(withStatus: msg) |
| | | } |
| | | |
| | | func showHUD(_ text:String){ |
| | | SVProgressHUD.show(withStatus:text) |
| | | func showHUD(_ text:String? = nil){ |
| | | SVProgressHUD.setContainerView(screnDelegate?.window) |
| | | SVProgressHUD.show(withStatus: text) |
| | | } |
| | | |
| | | func hiddenHUD(){ |
| | | SVProgressHUD.dismiss() |
| | | func hiddenHUD(_ delay:TimeInterval? = nil){ |
| | | if delay != nil{ |
| | | SVProgressHUD.dismiss(withDelay: delay!) |
| | | }else{ |
| | | SVProgressHUD.dismiss() |
| | | } |
| | | } |
| | |
| | | enum ExchangePaymentType:Int,HandyJSONEnum{ |
| | | case coin = 1 |
| | | case cashAndCoin = 2 |
| | | case cash = 3 |
| | | } |
| | | |
| | | enum UseStateType:Int,HandyJSONEnum{ |
| | |
| | | </array> |
| | | </dict> |
| | | </dict> |
| | | <key>UIBackgroundModes</key> |
| | | <array/> |
| | | <key>UIViewControllerBasedStatusBarAppearance</key> |
| | | <true/> |
| | | </dict> |
| | |
| | | struct CouponInfoModel:HandyJSON{ |
| | | ///有效时间 |
| | | var effectiveTime: String = "" |
| | | /// 优惠内容 |
| | | var favorable: String = "" |
| | | /// 优惠 |
| | | var favorable: Double = 0 |
| | | var id: Int = 0 |
| | | var name: String = "" |
| | | var type:CouponType = .none |
| | |
| | | struct CoinExchangeModel:HandyJSON{ |
| | | var amount:Double = 0 |
| | | var wpGold:Int = 0 |
| | | var chargeId = 0 |
| | | } |
| | | |
| | | struct ExchangeGoodsModel:HandyJSON { |
| | |
| | | var purchaseType = "" |
| | | } |
| | | |
| | | struct WeeklyCourseModel:HandyJSON{ |
| | | class WeeklyCourseModel:HandyJSON{ |
| | | var areaName: String = "" |
| | | var courses = [WeeklyCourseItemModel]() |
| | | var siteDistance: Double = 0 |
| | | var lat:Double = 0 |
| | | var lon:Double = 0 |
| | | var storeId: Int = 0 |
| | | |
| | | required init(){} |
| | | } |
| | | |
| | | struct WeeklyCourseItemModel:HandyJSON{ |
| | | class WeeklyCourseItemModel:HandyJSON{ |
| | | var courseID: Int = 0 |
| | | var courseName: String = "" |
| | | var detail: String = "" |
| | | var timeStr: String = "" |
| | | |
| | | required init(){} |
| | | } |
| | | |
| | | struct StudentMedalInfoModel:HandyJSON{ |
| | | var isTopLevel = 2 |
| | | var levelNum = 0 |
| | | var medalName = "" |
| | | var medalType:MedalType = .club |
| | | var nextLevel = 0 |
| | | var upgradeConditions = "" |
| | | } |
| | | |
| | | |
| | |
| | | return Disposables.create{} |
| | | } |
| | | |
| | | if progress {showHUD()} |
| | | |
| | | if progress {SVProgressHUD.show()} |
| | | |
| | | var headers = HTTPHeaders() |
| | | if let token = UserViewModel.getToken(){ |
| | | headers.add(name: "Authorization", value: "Bearer" + " " + token) |
| | | LogInfo("USER_token:\(token)") |
| | | LogInfo("USER_token:Bearer \(token)") |
| | | } |
| | | |
| | | if encoding is JSONEncoding { |
| | |
| | | sharedSessionManager.request(params.url.absoluteString, method: method, parameters:params.done(), encoding: newEncoding, headers:headers).validate().responseData{response in |
| | | LogInfo("请求地址:\(params.url)") |
| | | LogInfo("请求参数:\(params.params)") |
| | | SVProgressHUD.dismiss(withDelay: 0.5) |
| | | hiddenHUD(0.5) |
| | | |
| | | guard response.error == nil else { |
| | | LogError("\(response.error!)") |
| | |
| | | } |
| | | |
| | | /// 支付 |
| | | class func useBenefitPayment(chargeId:Int,payType:PayType)->Observable<BaseResponse<SimpleModel>>{ |
| | | class func useBenefitPayment(amount:Double,payType:PayType)->Observable<BaseResponse<PaymentModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/account/api/useBenefit/payment") |
| | | .append(key: "chargeId", value: chargeId) |
| | | .append(key: "amount", value: amount) |
| | | .append(key: "payType", value: payType.rawValue) |
| | | return NetworkRequest.request(params: params, method: .post, progress: true) |
| | | } |
| | | |
| | | |
| | | /// 充值说明 |
| | | class func rechargeDescription()->Observable<BaseResponse<String>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/other/base/stored/rechargeDescription") |
| | | return NetworkRequest.request(params: params, method: .post, progress: true) |
| | | |
| | | } |
| | | } |
| | | |
| | | // MARK: -- 课程相关 |
| | |
| | | .interface(url: "/account/api/startCource/recordDetails") |
| | | .append(key: "stuId", value: stuId) |
| | | .append(key: "lessionId", value: lessionId) |
| | | .append(key: "startTime", value: startTime) |
| | | .append(key: "time", value: startTime) |
| | | .append(key: "type", value: type) |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | | /// 更新课后视频学习状态 |
| | | static func updateVideoStatus(coursePackageId:Int,videoId:Int)->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/course/api/startCource/updateVideoStatus") |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | | /// 更新课后视频学习状态 |
| | | static func receiveAward(id:Int)->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/activity/api/benefitsVideo/receiveAward") |
| | | .append(key: "id", value: id) |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | | /// 上课主页-预约操作 |
| | | static func startCourceRreverse(courseId:Int,time:String,stuId:Int)->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/course/api/startCource/reverse") |
| | | .append(key: "courseId", value: courseId) |
| | | .append(key: "time", value: time) |
| | | .append(key: "stuId", value: stuId) |
| | | return NetworkRequest.request(params: params, method: .post, progress: true) |
| | | } |
| | | |
| | | |
| | | /// 学员勋章详情 |
| | | static func courseStuMedal(stuId:Int)->Observable<BaseResponse<[StudentMedalInfoModel]>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/account/api/startCource/stuMedal") |
| | | .append(key: "stuId", value: stuId) |
| | | return NetworkRequest.request(params: params, method: .post, progress: true) |
| | | } |
| | | |
| | | } |
| | | |
| | | // MARK: -- 探索玩湃 |
| | |
| | | static func exploreHome()->Observable<BaseResponse<[StartClouseExploreModel]>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/account/api/exploreWP/indexOfEx") |
| | | .append(key: "lat", value: locationTool.currentLocation?.coordinate.latitude.string) |
| | | .append(key: "lon", value: locationTool.currentLocation?.coordinate.longitude.string) |
| | | .append(key: "latitude", value: locationTool.currentLocation?.coordinate.latitude.string) |
| | | .append(key: "longitude", value: locationTool.currentLocation?.coordinate.longitude.string) |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | |
| | | static func UseBenefitDetail(goodsId:Int,goodsType:ExchangeType)->Observable<BaseResponse<ExchangeGoodsModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/account/api/useBenefit/goodsDetails") |
| | | .append(key: "goodsId", value: goodsId) |
| | | .append(key: "goodId", value: goodsId) |
| | | .append(key: "goodsType", value: goodsType.rawValue) |
| | | return NetworkRequest.request(params: params, method: .post, progress: true) |
| | | } |
| | |
| | | |
| | | |
| | | /// 兑换商品 |
| | | static func exchangeOperation(exchangeType:ExchangePaymentType,goodsId:Int,goodsType:ExchangeType,num:Int,payType:PayType?,stuIds:String)->Observable<BaseResponse<PaymentModel>>{ |
| | | static func exchangeOperation(exchangeType:ExchangePaymentType,goodsId:Int,goodsType:ExchangeType,num:Int,payType:PayType?,stuIds:String,storeId:Int?)->Observable<BaseResponse<PaymentModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/account/api/useBenefit/productRedemptionOperation") |
| | | .append(key: "exchangeType", value: exchangeType.rawValue) |
| | |
| | | .append(key: "nums", value: num) |
| | | .append(key: "payType", value: payType?.rawValue) |
| | | .append(key: "stuIds", value: stuIds) |
| | | .append(key: "storeId", value: storeId) |
| | | return NetworkRequest.request(params: params, method: .post, progress: true) |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | /// 商城中心 |
| | | class func mallList(goodsType:ExchangeType?,rank:Sort2Type?,search:String?)->Observable<BaseResponse<[MarketMdoel]>>{ |
| | | class func mallList(page:Int,goodsType:ExchangeType?,rank:Sort2Type?,search:String?)->Observable<BaseResponse<[MarketMdoel]>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/account/api/useBenefit/integralMallList") |
| | | .append(key: "goodsType", value: goodsType?.rawValue) |
| | | .append(key: "rank", value: rank?.rawValue) |
| | | .append(key: "lat", value: locationTool.currentLocation?.coordinate.latitude.string) |
| | | .append(key: "lon", value: locationTool.currentLocation?.coordinate.longitude.string) |
| | | .append(key: "pageNum", value: page) |
| | | .append(key: "pageSize", value: 20) |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "competition/api/competition/paymentCompetition") |
| | | .append(key: "id", value: id) |
| | | .append(key: "userIds", value: userIds) |
| | | .append(key: "ids", value: userIds) |
| | | .append(key: "payType", value: payType.rawValue) |
| | | return NetworkRequest.request(params: params, method: .post, progress: true) |
| | | } |
| | |
| | | btn_addStudent.spacingBetweenImageAndTitle = 4 |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.separatorStyle = .none |
| | | tableView.register(UINib(nibName: "StudentInfo_2_TCell", bundle: nil), forCellReuseIdentifier: "_StudentInfo_2_TCell") |
| | | |
| | | view_banner.addSubview(bannerView) |
| | |
| | | StoresInfoView.show(activityDetailModel) { [weak self] status in |
| | | guard let weakSelf = self else { return } |
| | | |
| | | let price = weakSelf.activityDetailModel.cashPrice * Double(weakSelf.activityDetailModel.participant.count) |
| | | let coin = weakSelf.activityDetailModel.playPaiCoin * weakSelf.activityDetailModel.participant.count |
| | | let course = weakSelf.activityDetailModel.classPrice * weakSelf.activityDetailModel.participant.count |
| | | let price = weakSelf.activityDetailModel.cashPrice * Double(weakSelf.students.count) |
| | | let coin = weakSelf.activityDetailModel.playPaiCoin * weakSelf.students.count |
| | | let course = weakSelf.activityDetailModel.classPrice * weakSelf.students.count |
| | | |
| | | if status{ |
| | | PaymentView.show(money: (ali:price,wx:price,coin:coin,course:course)) { [weak self] type in |
| | |
| | | let vc = PaymentResultVC(result: .success, objType: .activityApply) |
| | | vc.modalPresentationStyle = .fullScreen |
| | | weakSelf.present(vc, animated: true) |
| | | weakSelf.btn_enroll.setTitle("已报名", for: .normal) |
| | | weakSelf.btn_enroll.backgroundColor = UIColor.gray.withAlphaComponent(0.5) |
| | | case .cancel: |
| | | alert(msg: "已取消") |
| | | case .failure(let error): |
| | |
| | | } |
| | | } |
| | | case .wechat:break |
| | | case .coin:break |
| | | case .courseNum:break |
| | | case .coin,.courseNum: |
| | | let vc = PaymentResultVC(result: .success, objType: .activityApply) |
| | | vc.modalPresentationStyle = .fullScreen |
| | | weakSelf.present(vc, animated: true) |
| | | weakSelf.btn_enroll.setTitle("已报名", for: .normal) |
| | | weakSelf.btn_enroll.backgroundColor = UIColor.gray.withAlphaComponent(0.5) |
| | | } |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | |
| | | <constraint firstItem="XMe-LD-M9B" firstAttribute="leading" secondItem="YbO-3U-B92" secondAttribute="leading" id="Kuy-bW-P8N"/> |
| | | <constraint firstItem="XMe-LD-M9B" firstAttribute="top" secondItem="YbO-3U-B92" secondAttribute="top" id="ORO-bL-EWB"/> |
| | | <constraint firstItem="XMe-LD-M9B" firstAttribute="centerX" secondItem="YbO-3U-B92" secondAttribute="centerX" id="Zyn-hz-7yI"/> |
| | | <constraint firstAttribute="bottom" secondItem="XMe-LD-M9B" secondAttribute="bottom" id="xIV-UG-9RB"/> |
| | | <constraint firstAttribute="bottom" secondItem="XMe-LD-M9B" secondAttribute="bottom" constant="15" id="xIV-UG-9RB"/> |
| | | </constraints> |
| | | </scrollView> |
| | | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="V8a-fY-mQH"> |
| | |
| | | private var cityChooseSubTypeView:CityChooseSubTypeView? |
| | | |
| | | private var viewModel = ActivityListViewModel() |
| | | |
| | | private var selectSignupConditionModel:NormalSimpleModel? |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | |
| | | items.append(NormalSimpleModel(id: 1, name: "全部用户")) |
| | | items.append(NormalSimpleModel(id: 2, name: "仅限年度会员参与")) |
| | | items.append(NormalSimpleModel(id: 3, name: "仅限学员参与")) |
| | | courseSubTypeView = CourseSubTypeView.show(inView: self.view, afterView: btn_joinCondition, items: items) { [weak self] m in |
| | | courseSubTypeView = CourseSubTypeView.show(inView: self.view, afterView: btn_joinCondition, items: items,selectModel: selectSignupConditionModel) { [weak self] m in |
| | | sender.setTitle(m.name, for: .normal) |
| | | sender.isSelected = false |
| | | self?.selectSignupConditionModel = m |
| | | self?.viewModel.registerCondition.accept(RegisterAcitivyType(rawValue: m.id)) |
| | | self?.viewModel.beginRefresh() |
| | | } closeClouse: { |
| | |
| | | |
| | | guard let m = activityDetailModel else {return} |
| | | |
| | | img_profile.sd_setImage(with: URL(string: m.storeCoverDrawing)!) |
| | | img_profile.sd_setImage(with: URL(string: m.storeCoverDrawing)) |
| | | label_storeName.text = m.storeName + "(\(m.storeAddress))" |
| | | label_title.text = m.name |
| | | label_joinCondition.text = m.registerCondition.strTitle |
| | |
| | | cons_tableHei.constant = Double(m.participant.count) * 100 |
| | | tableView.reloadData() |
| | | |
| | | |
| | | let name = m.apply == 1 ? "已取消":"取消" |
| | | let color = m.apply == 1 ? UIColor.gray:Def_ThemeColor |
| | | btn_cancel.setTitle(name, for: .normal) |
| | | btn_cancel.backgroundColor = color |
| | | } |
| | | } |
| | | |
| | |
| | | override func setUI() { |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.separatorStyle = .none |
| | | tableView.register(UINib(nibName: "StudentInfo_2_TCell", bundle: nil), forCellReuseIdentifier: "_StudentInfo_2_TCell") |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @objc func datetimeAction(){ |
| | | JQ_MenuView().show(self, tapView: funcView.btn_datetime, items: ["全部","最近一周","最近一月","最近一年"],tableHei: 150) {[weak self] index, str in |
| | | JQ_MenuView().show(self, tapView: funcView.btn_datetime, items: ["全部","最近一周","最近一月","最近一年"],tableHei: 220) {[weak self] index, str in |
| | | let vc = self?.pageViewController.currentController as! CourseBookingSubListVC |
| | | vc.viewModel.timeType.accept(StudentAppointDateType(rawValue: index)!) |
| | | vc.viewModel.beginRefresh() |
| | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | view.backgroundColor = .white |
| | | viewModel.configure(tableView) |
| | | viewModel.configure(tableView,needMore: false) |
| | | viewModel.beginRefresh() |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | @IBAction func couponAction(_ sender: TapBtn) { |
| | | CouponChooseView.show(couponModels,defaultModel: selectCouponModel) { m in |
| | | self.selectCouponModel = m |
| | | CouponChooseView.show(couponModels,defaultModel: selectCouponModel) {[weak self] m in |
| | | guard let weakSelf = self else { return } |
| | | weakSelf.selectCouponModel = m |
| | | guard m != nil else { |
| | | self.btn_couponInfo.setTitle("去选择", for: .normal);return |
| | | weakSelf.btn_couponInfo.setTitle("去选择", for: .normal);return |
| | | } |
| | | self.btn_couponInfo.setTitle("-\(m!.favorable)", for: .normal) |
| | | weakSelf.btn_couponInfo.setTitle("-\(m!.favorable)", for: .normal) |
| | | weakSelf.changePrice(weakSelf.selectClassIndex) |
| | | } |
| | | } |
| | | |
| | |
| | | guard let weakSelf = self else { return } |
| | | if status{ |
| | | if let model = weakSelf.detailModel?.list[weakSelf.selectClassIndex]{ |
| | | let price = model.vipPrice == nil ? model.originalPrice : model.vipPrice |
| | | let coin = model.playPaiCoin |
| | | PaymentView.show(money: (ali:price,wx:price,coin:coin,course:nil)) { [weak self] payType in |
| | | let price = (model.vipPrice == nil ? (model.originalPrice ?? 0) : model.vipPrice!) * Double(weakSelf.studentModels.count) |
| | | let discountPrice = price - (weakSelf.selectCouponModel?.favorable ?? 0) |
| | | let coin = (model.playPaiCoin ?? 0) * weakSelf.studentModels.count |
| | | |
| | | PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil)) { [weak self] payType in |
| | | guard let weakSelf = self else { return } |
| | | Services.courcePayment(conponId: weakSelf.selectCouponModel?.id, courseConfigId: model.id, id: weakSelf.detailModel!.id, price: model.paymentPrice, payType: payType, stuId: weakSelf.studentModels.map({$0.id})).subscribe(onNext: { data in |
| | | |
| | | var paymentPrice:Double = 0 |
| | | switch payType { |
| | | case .aliPay,.wechat: |
| | | paymentPrice = price |
| | | case .coin: |
| | | paymentPrice = Double(coin) |
| | | case .courseNum:break |
| | | } |
| | | |
| | | Services.courcePayment(conponId: weakSelf.selectCouponModel?.id, courseConfigId: model.id, id: weakSelf.detailModel!.id, price: paymentPrice, payType: payType, stuId: weakSelf.studentModels.map({$0.id})).subscribe(onNext: { data in |
| | | if let m = data.data{ |
| | | switch payType { |
| | | case .aliPay: |
| | | YYPaymentManager.shared.sendPaymentRequest(YYAlipayRequest(orderString: m.orderString)) { [weak self] result in |
| | | switch result { |
| | | case .success: |
| | | self?.navigationController?.popViewController(animated: false) |
| | | let vc = PaymentResultVC(result: .success, objType: .courseApply) |
| | | vc.modalPresentationStyle = .fullScreen |
| | | self?.present(vc, animated: true) |
| | | case .cancel: |
| | | alert(msg: "已取消") |
| | |
| | | self?.present(vc, animated: true) |
| | | } |
| | | } |
| | | case .wechat:break |
| | | case .coin:break |
| | | case .wechat: |
| | | self?.navigationController?.popViewController(animated: false) |
| | | break |
| | | case .coin: |
| | | self?.navigationController?.popViewController(animated: false) |
| | | let vc = PaymentResultVC(result: .success, objType: .courseApply) |
| | | vc.modalPresentationStyle = .fullScreen |
| | | self?.present(vc, animated: true) |
| | | case .courseNum:break |
| | | } |
| | | }else{ |
| | |
| | | |
| | | private func changePrice(_ index:Int){ |
| | | if let subM = detailModel?.list[index]{ |
| | | label_price.text = (subM.paymentPrice * Double(studentModels.count)).currency() |
| | | label_price.text = (subM.paymentPrice * Double(studentModels.count) - (selectCouponModel?.favorable ?? 0)).currency() |
| | | label_originPrice.isHidden = subM.originalPrice == nil || subM.originalPrice == 0 |
| | | label_coin.isHidden = subM.playPaiCoin == nil || subM.playPaiCoin == 0 |
| | | label_vipPrice.isHidden = subM.vipPrice == nil || subM.vipPrice == 0 |
| | |
| | | </placeholder> |
| | | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
| | | <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> |
| | | <rect key="frame" x="0.0" y="0.0" width="393" height="55"/> |
| | | <rect key="frame" x="0.0" y="0.0" width="415" height="55"/> |
| | | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
| | | <subviews> |
| | | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IWP-av-zUk"> |
| | | <rect key="frame" x="363" y="0.0" width="30" height="28"/> |
| | | <rect key="frame" x="385" y="0.0" width="30" height="28"/> |
| | | <constraints> |
| | | <constraint firstAttribute="width" constant="30" id="O7y-RK-Xib"/> |
| | | <constraint firstAttribute="height" constant="28" id="naa-lg-mP6"/> |
| | |
| | | <state key="normal" image="icon_L"/> |
| | | </button> |
| | | <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Bgy-rf-HKK"> |
| | | <rect key="frame" x="30" y="0.0" width="333" height="50"/> |
| | | <rect key="frame" x="30" y="0.0" width="355" height="50"/> |
| | | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="50" id="bKd-Hj-KoW"/> |
| | |
| | | <constraint firstItem="Bgy-rf-HKK" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="u80-x0-rty"/> |
| | | </constraints> |
| | | <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> |
| | | <point key="canvasLocation" x="75.572519083969468" y="-260.21126760563379"/> |
| | | <point key="canvasLocation" x="8.3969465648854964" y="-262.32394366197184"/> |
| | | </view> |
| | | </objects> |
| | | <resources> |
| | |
| | | @IBOutlet weak var label_totalNums: UILabel! |
| | | @IBOutlet weak var label_deductedNums: UILabel! |
| | | @IBOutlet weak var label_remainingNums: UILabel! |
| | | @IBOutlet weak var stack_courseExercise: UIStackView! |
| | | @IBOutlet weak var view_exerciseTitle: UIView! |
| | | @IBOutlet weak var view_footer: UIView! |
| | | |
| | | |
| | | var startClouseHomeModel:StartClouseHomeModel? |
| | | var weeklyCourseModels = [WeeklyCourseModel]() |
| | |
| | | label_deductedNums.text = "已扣学时数\( m.courseList.first?.deductedNums ?? 0)" |
| | | label_remainingNums.text = "剩余学时数\( m.courseList.first?.remainingNums ?? 0)" |
| | | |
| | | exerciseCollectionView.isHidden = m.exerciseVideoList.isEmpty |
| | | view_exerciseTitle.isHidden = m.exerciseVideoList.isEmpty |
| | | view_footer.isHidden = m.exerciseVideoList.isEmpty |
| | | |
| | | Services.studMedalList(studentId: m.stuId).subscribe(onNext: {[weak self] data in |
| | | guard let weakSelf = self else { return } |
| | |
| | | weakSelf.mentalCollectionView.reloadData() |
| | | let he = ceil(Double(models.count) / 3) * 91 + floor(Double(models.count) / 3) * 35 |
| | | weakSelf.cons_mentalViewHei.constant = he |
| | | UIView.animate(withDuration: 0.3) { |
| | | weakSelf.view.layoutIfNeeded() |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | |
| | | pageViewController.delegate = self |
| | | view_schedule.insertSubview(pageViewController.view, at: 0) |
| | | pageViewController.didMove(toParent: self) |
| | | pageViewController.view.frame = CGRect(x: 0, y: 0, width: JQ_ScreenW, height: 50) |
| | | pageViewController.view.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: 90) |
| | | |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | |
| | | navigationItem.leftBarButtonItem = UIBarButtonItem(customView: leftBtn) |
| | | |
| | | } |
| | | |
| | | override func setRx() { |
| | | NotificationCenter.default.rx.notification(StudentUpdate_Nofi).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] noti in |
| | | guard let weakSelf = self else { return } |
| | | Services.startCourseHome().subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | | if model.isThere == 1{ |
| | | let courseInfoVC = CourseInfoVC() |
| | | courseInfoVC.startClouseHomeModel = model |
| | | let clouseNav = BaseNav(rootViewController: courseInfoVC) |
| | | clouseNav.tabBarItem = UITabBarItem(title: "开始上课", image: UIImage(named: "tabbar_course"), selectedImage: UIImage(named: "tabbar_course_s")!.withRenderingMode(.alwaysOriginal)) |
| | | self?.tabBarController?.viewControllers![1] = clouseNav |
| | | }else { |
| | | if let vc = (self?.tabBarController?.viewControllers?[1] as? BaseNav)?.topViewController as? CourseVC{ |
| | | vc.startClouseHomeModel = model |
| | | self?.viewDidLoad() |
| | | } |
| | | } |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | private func setAttribute(t1:String,t2:String)->NSMutableAttributedString{ |
| | | let color:UIColor = UIColor(hexStr: "#2F5264") |
| | |
| | | Services.weeksOfCourseDetails(stuId: model.stuId, time: currentDate).subscribe(onNext: {[weak self] data in |
| | | if let models = data.data{ |
| | | self?.weeklyCourseModels = models |
| | | self?.cons_tableHei.constant = Double(models.flatMap({$0.courses}).count) * 70 + 58 * Double(models.count) |
| | | self?.cons_tableHei.constant = Double(models.flatMap({$0.courses}).count) * 70 + 58 * Double(models.count) |
| | | UIView.animate(withDuration: 0.3) { |
| | | self?.view.layoutIfNeeded() |
| | | self?.viewDidLayoutSubviews() |
| | | } |
| | | self?.tableView.reloadData() |
| | | } |
| | | }).disposed(by: disposeBag) |
| | |
| | | let offsetX = min(1,max(0,-(scrollView.contentOffset.y / 177.0))) |
| | | leftBtn.alpha = offsetX |
| | | } |
| | | |
| | | @objc func localDetailAction(btn:UIButton){ |
| | | let index = btn.tag - 10 |
| | | let model = weeklyCourseModels[index] |
| | | JQ_MapNavigationTool.startNav(CLLocationCoordinate2D(latitude: model.lat, longitude: model.lon), distanceName: model.areaName, scheme: "weparklife") |
| | | } |
| | | } |
| | | |
| | | extension CourseInfoVC:UITableViewDelegate{ |
| | |
| | | cell.contentView.jq_addCorners(corner: [.allCorners], radius: 0,width: JQ_ScreenW - 48,height: 70) |
| | | } |
| | | cell.weeklyCourseItemModel = weeklyCourseModels[indexPath.section].courses[indexPath.row] |
| | | cell.clickClouse = {m in |
| | | print("--->") |
| | | cell.clickClouse = {[weak self] m in |
| | | guard let weakSelf = self else { return } |
| | | if let stuId = weakSelf.startClouseHomeModel?.stuId{ |
| | | Services.startCourceRreverse(courseId: m.courseID, time: weakSelf.currentDate.jq_format("yyyy-MM-dd"), stuId: stuId).subscribe(onNext: { data in |
| | | alertSuccess(msg: "预约成功") |
| | | tableView.beginUpdates() |
| | | weakSelf.weeklyCourseModels[indexPath.section].courses.remove(at: indexPath.row) |
| | | tableView.deleteRows(at: [indexPath], with: .automatic) |
| | | tableView.endUpdates() |
| | | weakSelf.cons_tableHei.constant = Double(weakSelf.weeklyCourseModels.flatMap({$0.courses}).count) * 70 + 58 * Double(weakSelf.weeklyCourseModels.count) |
| | | UIView.animate(withDuration: 0.3) { |
| | | weakSelf.view.layoutIfNeeded() |
| | | weakSelf.viewDidLayoutSubviews() |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | } |
| | | |
| | |
| | | |
| | | let btn_detial = QMUIButton(type: .custom) |
| | | btn_detial.setTitle("位置详情", for: .normal) |
| | | btn_detial.tag = 10 + section |
| | | btn_detial.addTarget(self, action: #selector(localDetailAction(btn:)), for: .touchUpInside) |
| | | btn_detial.titleLabel?.font = UIFont.systemFont(ofSize: 10) |
| | | btn_detial.setTitleColor(UIColor(hexStr: "#AFB4BC"), for: .normal) |
| | | btn_detial.setImage(UIImage(named: "icon_pop"), for: .normal) |
| | |
| | | } |
| | | |
| | | if let label = headerView?.contentView.viewWithTag(1000) as? UILabel{ |
| | | label.text = String(format: "%@ %.1km", m.areaName,m.siteDistance) |
| | | label.text = String(format: "%@ %.1lfkm", m.areaName,m.siteDistance) |
| | | } |
| | | |
| | | headerView?.contentView.backgroundColor = .white |
| | |
| | | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| | | |
| | | if collectionView.tag == 1000{ |
| | | let vc = StudentMentalListVC() |
| | | guard let stuId = startClouseHomeModel?.stuId else { return } |
| | | let vc = StudentMentalListVC(stuId: stuId) |
| | | push(vc: vc) |
| | | }else{ |
| | | let vc = CourseVideoDetailVC(id: 0) |
| | |
| | | } |
| | | |
| | | func totalPagesOfpageViewController(_ pageViewConteoller: FFPageViewController) -> UInt { |
| | | return 15 |
| | | return 11 |
| | | } |
| | | |
| | | func pageViewController(_ pageViewConteoller: FFPageViewController, controllerForPage page: Int) -> UIViewController { |
| | |
| | | <outlet property="label_weeklyScope" destination="N78-t5-4OO" id="mZG-Sv-baX"/> |
| | | <outlet property="mentalCollectionView" destination="b9G-TL-PI1" id="sKR-Vx-ntA"/> |
| | | <outlet property="scrollView" destination="fJF-28-SsM" id="jJu-L6-Dl1"/> |
| | | <outlet property="stack_courseExercise" destination="wNl-09-jiS" id="1p1-Go-KlU"/> |
| | | <outlet property="tableView" destination="O0u-hX-kAR" id="SXs-52-gvZ"/> |
| | | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
| | | <outlet property="view_container" destination="dM8-7c-aXP" id="EVK-r9-tap"/> |
| | | <outlet property="view_exerciseTitle" destination="KR4-hI-8vp" id="3ph-Lh-15K"/> |
| | | <outlet property="view_footer" destination="a77-hD-aIq" id="RXN-X9-IH0"/> |
| | | <outlet property="view_menu" destination="DRH-pO-upo" id="4sa-Yf-4nH"/> |
| | | <outlet property="view_schedule" destination="UMv-8K-vwR" id="2rT-1C-945"/> |
| | | </connections> |
| | |
| | | </view> |
| | | <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_star" translatesAutoresizingMaskIntoConstraints="NO" id="uha-8d-tRd"> |
| | | <rect key="frame" x="24" y="621.33333333333337" width="22" height="23"/> |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="23" id="SDl-H8-Wdc"/> |
| | | <constraint firstAttribute="width" constant="22" id="VaN-Xb-9IW"/> |
| | | </constraints> |
| | | </imageView> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="学员勋章" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ioo-oF-wME"> |
| | | <rect key="frame" x="52.999999999999993" y="623.33333333333337" width="65.333333333333314" height="19.333333333333371"/> |
| | |
| | | <constraint firstItem="clG-di-bFf" firstAttribute="leading" secondItem="s1y-gM-ejj" secondAttribute="trailing" constant="8" id="jD4-u8-AbG"/> |
| | | <constraint firstAttribute="trailing" secondItem="b9G-TL-PI1" secondAttribute="trailing" id="kUc-2f-uS8"/> |
| | | <constraint firstItem="Okg-Yc-buM" firstAttribute="top" secondItem="b9G-TL-PI1" secondAttribute="bottom" constant="17" id="lV4-8e-Z9f"/> |
| | | <constraint firstAttribute="bottom" secondItem="wNl-09-jiS" secondAttribute="bottom" id="ld4-jQ-Q11"/> |
| | | <constraint firstAttribute="bottom" secondItem="wNl-09-jiS" secondAttribute="bottom" priority="750" id="ld4-jQ-Q11"/> |
| | | <constraint firstItem="2CP-x2-Qn7" firstAttribute="centerY" secondItem="s1y-gM-ejj" secondAttribute="centerY" id="mwb-cW-nv3"/> |
| | | <constraint firstItem="N78-t5-4OO" firstAttribute="centerX" secondItem="dM8-7c-aXP" secondAttribute="centerX" id="psh-NY-wpI"/> |
| | | <constraint firstItem="wNl-09-jiS" firstAttribute="leading" secondItem="dM8-7c-aXP" secondAttribute="leading" constant="22" id="pwE-Zg-2eb"/> |
| | |
| | | self?.viewModel.selectPackeType.accept(nil) |
| | | } |
| | | sender.isSelected = false |
| | | self?.refreshStatus.onNext(.beingHeaderRefresh) |
| | | self?.viewModel.beginRefresh() |
| | | } closeClouse: { |
| | | sender.isSelected = false |
| | | } |
| | |
| | | self?.viewModel.selectStore.accept(nil) |
| | | } |
| | | sender.isSelected = false |
| | | self?.refreshStatus.onNext(.beingHeaderRefresh) |
| | | self?.viewModel.beginRefresh() |
| | | } closeClouse: { |
| | | sender.isSelected = false |
| | | } |
| | |
| | | let sortType = sender.isSelected ? SortType.desc:SortType.asc |
| | | viewModel.salesRanking.accept(sortType) |
| | | sender.setImage(viewModel.salesRanking.value?.img, for: .normal) |
| | | refreshStatus.onNext(.beingHeaderRefresh) |
| | | viewModel.beginRefresh() |
| | | } |
| | | |
| | | @IBAction func distanceAction(_ sender: UIButton) { |
| | |
| | | let sortType = sender.isSelected ? SortType.desc:SortType.asc |
| | | viewModel.distanceSort.accept(sortType) |
| | | sender.setImage(viewModel.distanceSort.value?.img, for: .normal) |
| | | refreshStatus.onNext(.beingHeaderRefresh) |
| | | viewModel.beginRefresh() |
| | | } |
| | | |
| | | } |
| | |
| | | collectionView.register(UINib(nibName: "CourseOnlineHeadView", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "_CourseOnlineHeadView") |
| | | collectionView.delegate = self |
| | | collectionView.dataSource = self |
| | | collectionView.backgroundColor = .white |
| | | |
| | | let insertH = JQ_ScreenW * 0.564 + 57 |
| | | collectionView.contentInset = UIEdgeInsets(top: insertH, left: 14, bottom: 14, right: 14) |
| | |
| | | NotificationCenter.default.rx.notification(StudentUpdate_Nofi).take(until: self.rx.deallocated).subscribe(onNext: { [weak self] data in |
| | | guard let weakSelf = self else { return } |
| | | Services.startCourseHome().subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | | if model.isThere == 1{ |
| | | let courseInfoVC = CourseInfoVC() |
| | | courseInfoVC.startClouseHomeModel = model |
| | | let clouseNav = BaseNav(rootViewController: courseInfoVC) |
| | | clouseNav.tabBarItem = UITabBarItem(title: "开始上课", image: UIImage(named: "tabbar_course"), selectedImage: UIImage(named: "tabbar_course_s")) |
| | | self?.tabBarController?.viewControllers![1] = clouseNav |
| | | } |
| | | if let model = data.data{ |
| | | if model.isThere == 1{ |
| | | let courseInfoVC = CourseInfoVC() |
| | | courseInfoVC.startClouseHomeModel = model |
| | | let clouseNav = BaseNav(rootViewController: courseInfoVC) |
| | | clouseNav.tabBarItem = UITabBarItem(title: "开始上课", image: UIImage(named: "tabbar_course"), selectedImage: UIImage(named: "tabbar_course_s")!.withRenderingMode(.alwaysOriginal)) |
| | | self?.tabBarController?.viewControllers![1] = clouseNav |
| | | }else{ |
| | | let courseVC = CourseVC() |
| | | courseVC.startClouseHomeModel = model |
| | | let clouseNav = BaseNav(rootViewController: courseVC) |
| | | clouseNav.tabBarItem = UITabBarItem(title: "开始上课", image: UIImage(named: "tabbar_course"), selectedImage: UIImage(named: "tabbar_course_s")!.withRenderingMode(.alwaysOriginal)) |
| | | self?.tabBarController?.viewControllers![1] = clouseNav |
| | | } |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | }).disposed(by: disposeBag) |
| | |
| | | // |
| | | // CourseVideoDetailVC.swift |
| | | // WanPai |
| | | // |
| | | // Created by 无故事王国 on 2023/6/16. |
| | | // |
| | | // |
| | | // CourseVideoDetailVC.swift |
| | | // WanPai |
| | | // |
| | | // Created by 无故事王国 on 2023/6/16. |
| | | // |
| | | |
| | | import UIKit |
| | | import AVKit |
| | |
| | | import JQTools |
| | | |
| | | class CourseVideoDetailVC: BaseVC { |
| | | @IBOutlet weak var view_videoContainer: UIView! |
| | | @IBOutlet weak var view_videoContainer: UIView! |
| | | |
| | | private var id:Int? |
| | | private var model:ExerciseVideoModel? |
| | | private var id:Int? |
| | | private var model:ExerciseVideoModel? |
| | | private var detailModel:VideoDetailModel? |
| | | private var exerciseVideoDetailModel:ExerciseVideoDetailModel? |
| | | |
| | | @IBOutlet weak var label_name: UILabel! |
| | | @IBOutlet weak var label_introduce: UILabel! |
| | | @IBOutlet weak var label_studyState: UILabel! |
| | | @IBOutlet weak var img_introduceCover: UIImageView! |
| | | @IBOutlet weak var label_coin: UILabel! |
| | | @IBOutlet weak var cons_imgHei: NSLayoutConstraint! |
| | | @IBOutlet weak var label_name: UILabel! |
| | | @IBOutlet weak var label_introduce: UILabel! |
| | | @IBOutlet weak var label_studyState: UILabel! |
| | | @IBOutlet weak var img_introduceCover: UIImageView! |
| | | @IBOutlet weak var label_coin: UILabel! |
| | | @IBOutlet weak var cons_imgHei: NSLayoutConstraint! |
| | | private var timeDuration:Double = 0 |
| | | |
| | | |
| | | private lazy var playerVC:AVPlayerViewController = { |
| | | let player = AVPlayerViewController() |
| | | player.allowsPictureInPicturePlayback = true |
| | | player.delegate = self |
| | | return player |
| | | }() |
| | | private lazy var playerVC:AVPlayerViewController = { |
| | | let player = AVPlayerViewController() |
| | | player.allowsPictureInPicturePlayback = true |
| | | player.delegate = self |
| | | return player |
| | | }() |
| | | |
| | | |
| | | init(id:Int) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.id = id |
| | | } |
| | | init(id:Int) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.id = id |
| | | } |
| | | |
| | | init(model:ExerciseVideoModel){ |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.model = model |
| | | } |
| | | init(model:ExerciseVideoModel){ |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.model = model |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | if let id { |
| | | Services.benefitsVideoDetail(id: id).subscribe(onNext: { [weak self] data in |
| | | if let model = data.data{ |
| | | self?.playerVC.player = AVPlayer(url: URL(string: model.courseVideo)!) |
| | | self?.playerVC.player?.play() |
| | | if let id { |
| | | Services.benefitsVideoDetail(id: id).subscribe(onNext: { [weak self] data in |
| | | if let model = data.data{ |
| | | self?.detailModel = model |
| | | self?.playerVC.player = AVPlayer(url: URL(string: model.courseVideo)!) |
| | | self?.playerVC.player?.play() |
| | | |
| | | self?.label_name.text = model.name |
| | | self?.label_coin.text = "\(model.integral)积分" |
| | | self?.label_introduce.text = model.introduce |
| | | if model.study == 1{ |
| | | self?.label_studyState.text = "已学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#318C10").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = UIColor(hexStr: "#318C10") |
| | | }else{ |
| | | self?.label_studyState.text = "未学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#FD9331").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = Def_ThemeColor |
| | | } |
| | | self?.playerVC.player?.addPeriodicTimeObserver(forInterval: CMTimeMake(value: 1, timescale: 1), queue: DispatchQueue.main) { [weak self](time) in |
| | | self?.timeDuration += 1 |
| | | } |
| | | |
| | | SDWebImageDownloader.shared.downloadImage(with: URL(string: model.introductionDrawing)) { image, data, error, state in |
| | | if let img = image{ |
| | | self?.img_introduceCover.image = img |
| | | let radio = img.size.width / img.size.height |
| | | self?.cons_imgHei.constant = JQ_ScreenW * radio |
| | | } |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | self?.label_name.text = model.name |
| | | self?.label_coin.text = "\(model.integral)积分" |
| | | self?.label_introduce.text = model.introduce |
| | | if model.study == 1{ |
| | | self?.label_studyState.text = "已学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#318C10").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = UIColor(hexStr: "#318C10") |
| | | }else{ |
| | | self?.label_studyState.text = "未学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#FD9331").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = Def_ThemeColor |
| | | } |
| | | |
| | | if let model{ |
| | | Services.exerciseCourseDetail(coursePackageId: model.coursePackageId, videoId: model.videoId).subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | | self?.playerVC.player = AVPlayer(url: URL(string: model.videoURL)!) |
| | | self?.playerVC.player?.play() |
| | | SDWebImageDownloader.shared.downloadImage(with: URL(string: model.introductionDrawing)) { image, data, error, state in |
| | | if let img = image{ |
| | | self?.img_introduceCover.image = img |
| | | let radio = img.size.width / img.size.height |
| | | self?.cons_imgHei.constant = JQ_ScreenW * radio |
| | | } |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | self?.label_name.text = model.packageName |
| | | self?.label_coin.text = "\(model.integral)积分" |
| | | self?.label_introduce.text = model.synopsis |
| | | if model.studyStatus == 1{ |
| | | self?.label_studyState.text = "已学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#318C10").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = UIColor(hexStr: "#318C10") |
| | | }else{ |
| | | self?.label_studyState.text = "未学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#FD9331").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = Def_ThemeColor |
| | | } |
| | | if let model{ |
| | | Services.exerciseCourseDetail(coursePackageId: model.coursePackageId, videoId: model.videoId).subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | | self?.exerciseVideoDetailModel = model |
| | | self?.playerVC.player = AVPlayer(url: URL(string: model.videoURL)!) |
| | | self?.playerVC.player?.play() |
| | | |
| | | SDWebImageDownloader.shared.downloadImage(with: URL(string: model.detailedDiagram)) { image, data, error, state in |
| | | if let img = image{ |
| | | self?.img_introduceCover.image = img |
| | | let radio = img.size.width / img.size.height |
| | | self?.cons_imgHei.constant = JQ_ScreenW * radio |
| | | } |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | self?.playerVC.player?.addPeriodicTimeObserver(forInterval: CMTimeMake(value: 1, timescale: 1), queue: DispatchQueue.main) { [weak self](time) in |
| | | self?.timeDuration += 1 |
| | | } |
| | | |
| | | override func setUI() { |
| | | view_videoContainer.addSubview(playerVC.view) |
| | | playerVC.view.frame = view_videoContainer.frame |
| | | self.addChild(playerVC) |
| | | playerVC.didMove(toParent: self) |
| | | self?.label_name.text = model.packageName |
| | | self?.label_coin.text = "\(model.integral)积分" |
| | | self?.label_introduce.text = model.synopsis |
| | | if model.studyStatus == 1{ |
| | | self?.label_studyState.text = "已学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#318C10").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = UIColor(hexStr: "#318C10") |
| | | }else{ |
| | | self?.label_studyState.text = "未学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#FD9331").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = Def_ThemeColor |
| | | } |
| | | |
| | | } |
| | | SDWebImageDownloader.shared.downloadImage(with: URL(string: model.detailedDiagram)) { image, data, error, state in |
| | | if let img = image{ |
| | | self?.img_introduceCover.image = img |
| | | let radio = img.size.width / img.size.height |
| | | self?.cons_imgHei.constant = JQ_ScreenW * radio |
| | | } |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | NotificationCenter.default.addObserver(self, selector: #selector(playbackEnd), name:NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: nil) |
| | | |
| | | } |
| | | |
| | | override func setUI() { |
| | | view_videoContainer.addSubview(playerVC.view) |
| | | playerVC.view.frame = view_videoContainer.frame |
| | | self.addChild(playerVC) |
| | | playerVC.didMove(toParent: self) |
| | | |
| | | } |
| | | |
| | | @objc private func playbackEnd(){ |
| | | if let m = exerciseVideoDetailModel{ |
| | | if timeDuration >= CMTimeGetSeconds((playerVC.player?.currentItem?.duration)!) && m.studyStatus == 0 { |
| | | Services.updateVideoStatus(coursePackageId: m.coursePackageId, videoId: m.videoId).subscribe(onNext: {[weak self] data in |
| | | alertSuccess(msg: "已获得积分") |
| | | self?.exerciseVideoDetailModel?.studyStatus = 1 |
| | | self?.label_studyState.text = "已学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#318C10").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = UIColor(hexStr: "#318C10") |
| | | self?.timeDuration = 0 |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | |
| | | |
| | | if let m = detailModel{ |
| | | if timeDuration >= CMTimeGetSeconds((playerVC.player?.currentItem?.duration)!) && m.study == 0 { |
| | | Services.receiveAward(id: m.id).subscribe(onNext: {[weak self] data in |
| | | alertSuccess(msg: "已获得积分") |
| | | self?.detailModel?.study = 1 |
| | | self?.label_studyState.text = "已学习" |
| | | self?.label_studyState.backgroundColor = UIColor(hexStr: "#318C10").withAlphaComponent(0.29) |
| | | self?.label_studyState.textColor = UIColor(hexStr: "#318C10") |
| | | self?.timeDuration = 0 |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | }() |
| | | |
| | | private var items = [MentalInfo]() |
| | | private var stuId:Int! |
| | | |
| | | required init(stuId:Int) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.stuId = stuId |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "学员勋章" |
| | | |
| | | items.append(MentalInfo(icon: UIImage(named: "icon_coupon_1"), l1: "COURSE", l2: "俱乐部之星", level: 0, info: "再上课打卡10次可升级LV2", btnName: "去预约")) |
| | | items.append(MentalInfo(icon: UIImage(named: "icon_coupon_2"), l1: "EVENTS", l2: "运动大人", level: 0, info: "再参与赛事10次可升级LV2", btnName: "去报名")) |
| | | items.append(MentalInfo(icon: UIImage(named: "icon_coupon_3"), l1: "ON_LINE", l2: "社区之王", level: 0, info: "再预约场地10次可升级LV2", btnName: "去预约")) |
| | | items.append(MentalInfo(icon: UIImage(named: "icon_coupon_4"), l1: "APPOINTMENT", l2: "深度玩家", level: 0, info: "再完成课后练习10次可升级LV2", btnName: "去完成")) |
| | | view.addSubview(tableView) |
| | | tableView.snp.makeConstraints { make in |
| | | make.edges.equalToSuperview() |
| | | } |
| | | |
| | | Services.courseStuMedal(stuId: stuId).subscribe(onNext: { [weak self] data in |
| | | if let models = data.data{ |
| | | for model in models{ |
| | | switch model.medalType{ |
| | | case .club: |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_1"), l1: "COURSE", l2: model.medalName, level: model.levelNum, info: model.upgradeConditions, btnName: "去预约")) |
| | | case .communtiy: |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_3"), l1: "ON_LINE", l2: model.medalName, level: model.levelNum, info: model.upgradeConditions, btnName: "去预约")) |
| | | case .deepPlayer: |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_4"), l1: "APPOINTMENT", l2: model.medalName, level: model.levelNum, info: model.upgradeConditions, btnName: "去完成")) |
| | | case .sport: |
| | | self?.items.append(MentalInfo(icon: UIImage(named: "icon_coupon_2"), l1: "EVENTS", l2: model.medalName, level: model.levelNum, info: model.upgradeConditions, btnName: "去报名")) |
| | | } |
| | | } |
| | | self?.tableView.reloadData() |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | |
| | |
| | | <rect key="frame" x="0.0" y="0.0" width="357" height="416"/> |
| | | <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> |
| | | <subviews> |
| | | <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="9vT-54-wYE"> |
| | | <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="9vT-54-wYE"> |
| | | <rect key="frame" x="0.0" y="0.0" width="357" height="416"/> |
| | | </imageView> |
| | | </subviews> |
| | |
| | | private var layout:WaterFallFlowLayout! |
| | | @IBOutlet weak var label_store: UILabel! |
| | | private var items = Array<HomeStoreConfigModel>() |
| | | // private var storeModel:HomeStoreModel? |
| | | private var storeModel:HomeStoreModel? |
| | | var viewModel = HomeViewModel() |
| | | |
| | | override func viewDidAppear(_ animated: Bool) { |
| | | super.viewDidAppear(animated) |
| | | if storeModel == nil{ |
| | | startLocation() |
| | | } |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | viewModel.configure(collectionView,needMore: false) |
| | | |
| | | locationTool.startLocation { [weak self] local in |
| | | locationTool.stopLocation() |
| | | self?.getStoreInfo() |
| | | } errorClouse: { [weak self] error in |
| | | alertError(msg: "定位获取失败") |
| | | self?.label_store.text = "定位获取失败" |
| | | self?.getStoreInfo() |
| | | } |
| | | startLocation() |
| | | |
| | | viewModel.dataSource.subscribe(onNext: {[weak self] data in |
| | | guard let weakSelf = self else { return } |
| | |
| | | let courseInfoVC = CourseInfoVC() |
| | | courseInfoVC.startClouseHomeModel = model |
| | | let clouseNav = BaseNav(rootViewController: courseInfoVC) |
| | | clouseNav.tabBarItem = UITabBarItem(title: "开始上课", image: UIImage(named: "tabbar_course"), selectedImage: UIImage(named: "tabbar_course_s")) |
| | | clouseNav.tabBarItem = UITabBarItem(title: "开始上课", image: UIImage(named: "tabbar_course"), selectedImage: UIImage(named: "tabbar_course_s")?.withRenderingMode(.alwaysOriginal)) |
| | | self?.tabBarController?.viewControllers![1] = clouseNav |
| | | }else { |
| | | if let vc = (self?.tabBarController?.viewControllers?[1] as? BaseNav)?.topViewController as? CourseVC{ |
| | |
| | | private func getStoreInfo(){ |
| | | Services.homeInfo().subscribe(onNext: {[weak self] data in |
| | | if let m = data.data{ |
| | | self?.storeModel = m |
| | | self?.label_store.text = m.name.isEmpty ? "门店获取失败":m.name |
| | | var text = "欢迎来到 快乐运动俱乐部" |
| | | if m.isVip == 0{text.append("\n加入我们 成为会员")} |
| | |
| | | } |
| | | collectionView.reloadData() |
| | | } |
| | | |
| | | private func startLocation(){ |
| | | locationTool.startLocation { [weak self] local in |
| | | locationTool.stopLocation() |
| | | self?.getStoreInfo() |
| | | } errorClouse: { [weak self] error in |
| | | alertError(msg: "定位获取失败") |
| | | self?.label_store.text = "定位获取失败" |
| | | self?.getStoreInfo() |
| | | } |
| | | } |
| | | |
| | | @IBAction func joinMemberAction(_ sender: UIButton) { |
| | | let joinMemberVC = JoinMemberIntroduceVC() |
| | |
| | | |
| | | |
| | | @IBAction func chooseStoresAction(_ sender: TapBtn) { |
| | | StoresChooseView.show { [weak self] storeId in |
| | | StoresChooseView.show { [weak self] storeId,storeName in |
| | | self?.viewModel.storeId.accept(storeId) |
| | | self?.label_store.text = storeName |
| | | self?.viewModel.beginRefresh() |
| | | } |
| | | } |
| | |
| | | let vc = WelfareWeeklyListVC() |
| | | push(vc: vc) |
| | | case .wisdomCourt: |
| | | let vc = WelfareWeeklyListVC() |
| | | push(vc: vc) |
| | | break |
| | | // let vc = WelfareWeeklyListVC() |
| | | // push(vc: vc) |
| | | case .welfare: |
| | | if viewModel.storeId.value != 0{ |
| | | Services.queryStoreFreeBenefit(id: viewModel.storeId.value).subscribe(onNext: {[weak self] data in |
| | |
| | | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeCCell", for: indexPath) as! HomeCCell |
| | | let item = items[indexPath.row] |
| | | cell.img.sd_setImage(with: URL(string: item.backgroundImage), placeholderImage: item.type.defaultImg, options: .highPriority) |
| | | cell.img.cornerRadius = 10 |
| | | return cell |
| | | } |
| | | |
| | |
| | | func waterFlowLayout(_ waterFlowLayout: WaterFallFlowLayout, itemHeight indexPath: IndexPath) -> CGFloat { |
| | | let item = items[indexPath.row] |
| | | |
| | | if (item.radio ?? 0) >= 0.8{ |
| | | if indexPath.row % 2 != 0{ |
| | | return 185 |
| | | }else{ |
| | | return 288 |
| | |
| | | didSet{ |
| | | if let m = couponInfoModel{ |
| | | label_info.text = m.useCondition |
| | | label_price.text = m.favorable |
| | | label_price.text = m.favorable.currency() |
| | | label_duetime.text = "有效期至:" + m.effectiveTime |
| | | label_title.text = m.type.rawTitle |
| | | } |
| | |
| | | private var storesModel = [CityProfileModel]() |
| | | |
| | | |
| | | private var clouse:((Int)->Void)! |
| | | private var clouse:((Int,String)->Void)! |
| | | private let disposeBag = DisposeBag() |
| | | |
| | | override func awakeFromNib() { |
| | |
| | | layoutIfNeeded() |
| | | } |
| | | |
| | | static func show(_ clouse:@escaping (Int)->Void){ |
| | | static func show(_ clouse:@escaping (Int,String)->Void){ |
| | | let storesView = StoresChooseView.jq_loadNibView() |
| | | storesView.clouse = clouse |
| | | storesView.frame = screnDelegate?.window?.frame ?? .zero |
| | |
| | | } |
| | | |
| | | close() |
| | | clouse?(storeModel!.id) |
| | | clouse?(storeModel!.id,storeModel!.name) |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | viewModel.configure(tableView,needMore: false) |
| | | viewModel.beginRefresh() |
| | | tableView.jq_setEmptyView() |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | @IBOutlet weak var banner_collectionView: UICollectionView! |
| | | @IBOutlet weak var label_empty: UILabel! |
| | | @IBOutlet weak var view_container: UIView! |
| | | @IBOutlet weak var cons_CollectionAspect: NSLayoutConstraint! |
| | | |
| | | private var models = [StartClouseExploreModel]() |
| | | private lazy var mapView:MAMapView = { |
| | |
| | | self?.models = models |
| | | self?.loadMap() |
| | | self?.banner_collectionView.reloadData() |
| | | } |
| | | }else{ |
| | | |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | extension SearchVC:MAMapViewDelegate{ |
| | | func mapViewDidStopLocatingUser(_ mapView: MAMapView!) { |
| | | print("--->停止") |
| | | } |
| | | |
| | | func mapView(_ mapView: MAMapView!, didUpdate userLocation: MAUserLocation!, updatingLocation: Bool) { |
| | | print("--->更新") |
| | | } |
| | | |
| | | func mapViewWillStartLocatingUser(_ mapView: MAMapView!) { |
| | | print("--->开始") |
| | | } |
| | | |
| | | func mapView(_ mapView: MAMapView!, viewFor annotation: MAAnnotation!) -> MAAnnotationView! { |
| | | if annotation is MAPointAnnotation{ |
| | |
| | | |
| | | case .cashAndCoin: |
| | | label_price.attributedText = AttributedStringbuilder.build().add(string: "\(recordsModel.integral)", withFont: UIFont.systemFont(ofSize: 18, weight: .medium), withColor: Def_ThemeColor).add(string: "积分+", withFont: UIFont.systemFont(ofSize: 12, weight: .medium), withColor: Def_ThemeColor).add(string: recordsModel.cash.currency(), withFont: UIFont.systemFont(ofSize: 18, weight: .medium), withColor: Def_ThemeColor).mutableAttributedString |
| | | } |
| | | case .cash: |
| | | label_price.attributedText = AttributedStringbuilder.build().add(string: recordsModel.cash.currency(), withFont: UIFont.systemFont(ofSize: 18, weight: .medium), withColor: Def_ThemeColor).mutableAttributedString |
| | | } |
| | | } |
| | | } |
| | | @IBOutlet weak var label_title: UILabel! |
| | |
| | | let search = BehaviorRelay<String?>(value: nil) |
| | | |
| | | override func api() -> (Observable<BaseResponse<[MarketMdoel]>>)? { |
| | | Services.mallList(goodsType: goodsType.value, rank: rank.value, search: search.value) |
| | | Services.mallList(page:page,goodsType: goodsType.value, rank: rank.value, search: search.value) |
| | | } |
| | | } |
| | | |
| | |
| | | flowLayout.minimumLineSpacing = 0 |
| | | flowLayout.minimumInteritemSpacing = 0 |
| | | flowLayout.itemSize = CGSize(width: CellW, height: CellH) |
| | | flowLayout.headerReferenceSize = CGSize(width: JQ_ScreenW, height: JQ_ScreenW * 0.5564) |
| | | flowLayout.sectionHeadersPinToVisibleBounds = true |
| | | |
| | | let collect = BaseCollectionView(frame: .zero, collectionViewLayout: flowLayout) |
| | | collect.delegate = self |
| | | collect.dataSource = self |
| | | collect.contentInset = UIEdgeInsets(top: 0, left:0, bottom: 14, right: 0) |
| | | collect.register(UINib(nibName: "CoinStoreCCell", bundle: nil), forCellWithReuseIdentifier: "_CoinStoreCCell") |
| | | collect.register(UINib(nibName: "CoinStoreHeadView", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "_CoinStoreHeadView") |
| | | collect.backgroundColor = .white |
| | | return collect |
| | | }() |
| | | |
| | | private var headView:CoinStoreHeadView = { |
| | | let head = CoinStoreHeadView.jq_loadNibView() |
| | | return head |
| | | }() |
| | | |
| | | |
| | | var benefitHomeModel:BenefitHomeModel? |
| | | |
| | |
| | | super.viewDidLoad() |
| | | title = "积分商城" |
| | | |
| | | viewModel.configure(collectionView,needMore: false) |
| | | headView.viewModel = viewModel |
| | | viewModel.configure(collectionView) |
| | | collectionView.jq_setEmptyView() |
| | | viewModel.beginRefresh() |
| | | |
| | | |
| | | if let model = benefitHomeModel{ |
| | | headView.label_coin.text = "\(model.userIntegral)积分" |
| | | headView.label_username.text = model.userName |
| | | headView.img_cover.sd_setImage(with: URL(string: model.userHeadImg)) |
| | | headView.tf_search.rx.text.orEmpty.bind(to: viewModel.search).disposed(by: disposeBag) |
| | | headView.integral = model.userIntegral |
| | | } |
| | | } |
| | | |
| | | override func setUI() { |
| | | view.addSubview(headView) |
| | | headView.snp.makeConstraints { make in |
| | | make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top) |
| | | make.left.right.equalToSuperview() |
| | | make.height.equalTo(JQ_ScreenW * 0.5564) |
| | | } |
| | | view.addSubview(collectionView) |
| | | collectionView.snp.makeConstraints { make in |
| | | make.edges.equalToSuperview() |
| | | make.top.equalTo(headView.snp.bottom) |
| | | make.left.right.bottom.equalToSuperview() |
| | | } |
| | | } |
| | | } |
| | |
| | | push(vc: vc) |
| | | } |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { |
| | | let headView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "_CoinStoreHeadView", for: indexPath) as! CoinStoreHeadView |
| | | headView.innerView = self.view |
| | | headView.viewModel = viewModel |
| | | headView.label_coin.text = "\(benefitHomeModel?.userIntegral ?? 0)积分" |
| | | headView.label_username.text = benefitHomeModel?.userName ?? "" |
| | | headView.img_cover.sd_setImage(with: URL(string: benefitHomeModel?.userHeadImg)) |
| | | headView.tf_search.rx.text.orEmpty.bind(to: viewModel.search).disposed(by: disposeBag) |
| | | headView.integral = benefitHomeModel?.userIntegral ?? 0 |
| | | |
| | | return headView |
| | | } |
| | | // func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { |
| | | // let headView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "_CoinStoreHeadView", for: indexPath) as! CoinStoreHeadView |
| | | // headView.innerView = self.view |
| | | // headView.viewModel = viewModel |
| | | // headView.label_coin.text = "\(benefitHomeModel?.userIntegral ?? 0)积分" |
| | | // headView.label_username.text = benefitHomeModel?.userName ?? "" |
| | | // headView.img_cover.sd_setImage(with: URL(string: benefitHomeModel?.userHeadImg)) |
| | | // headView.tf_search.rx.text.orEmpty.bind(to: viewModel.search).disposed(by: disposeBag) |
| | | // headView.integral = benefitHomeModel?.userIntegral ?? 0 |
| | | // |
| | | // return headView |
| | | // } |
| | | } |
| | | |
| | | extension CoinStoreCenterVC:UICollectionViewDataSource{ |
| | |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | override func viewDidLayoutSubviews() { |
| | | super.viewDidLayoutSubviews() |
| | | let colors = [UIColor(hexStr: "#FD8C02").cgColor, |
| | | UIColor(hexStr: "#FD7202").cgColor,] |
| | | view_topBg.jq_gradientColor(colorArr: colors,bounds: CGRect(x: 0, y: 0, width: JQ_ScreenW, height: JQ_ScreenW * 0.5923)) |
| | | btn_rechange.jq_gradientNibColor(colorArr: colors, cornerRadius: 20) |
| | | } |
| | | |
| | | override func setUI() { |
| | | let colors = [UIColor(hexStr: "#FD8C02").cgColor, |
| | | UIColor(hexStr: "#FD7202").cgColor,] |
| | | view_topBg.jq_gradientColor(colorArr: colors,bounds: CGRect(x: 0, y: 0, width: JQ_ScreenW, height: JQ_ScreenW * 0.5923)) |
| | | btn_rechange.jq_gradientNibColor(colorArr: colors, cornerRadius: 20) |
| | | |
| | | |
| | | |
| | | let attribute = AttributedStringbuilder() |
| | | attribute.add(string: "储值说明?", withFont: UIFont.systemFont(ofSize: 14), withColor: Def_ThemeColor) |
| | |
| | | |
| | | |
| | | @IBAction func introAction(_ sender: UIButton) { |
| | | let vc = JQ_CommonWebViewController(htmlText: "说明。。。。", baseURL: nil) |
| | | present(vc, animated: true) |
| | | Services.rechargeDescription().subscribe(onNext: {[weak self] data in |
| | | if let string = data.data{ |
| | | let vc = JQ_CommonWebViewController(htmlText: string, baseURL: nil) |
| | | self?.present(vc, animated: true) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | |
| | | |
| | | @IBAction func rechargeAction(_ sender: UIButton) { |
| | | let item = items[selectIndex] |
| | | PaymentView.show(money: (ali:item.money,wx:item.money,coin:nil,course:nil)) { type in |
| | | |
| | | // let result:PaymentResultVC.PaymentResult = status ? .success:.fail |
| | | // let vc = PaymentResultVC(result: result, objType: .activityApply) |
| | | // vc.modalPresentationStyle = .fullScreen |
| | | // self.present(vc, animated: true) |
| | | PaymentView.show(money: (ali:item.money,wx:item.money,coin:nil,course:nil)) {[weak self] type in |
| | | guard let weakSelf = self else { return } |
| | | Services.useBenefitPayment(amount: item.money, payType:type).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | switch type { |
| | | case .aliPay: |
| | | YYPaymentManager.shared.sendPaymentRequest(YYAlipayRequest(orderString: m.orderString)) {[weak self] result in |
| | | guard let weakSelf = self else { return } |
| | | switch result { |
| | | case .success: |
| | | let vc = PaymentResultVC(result: .success, objType: .activityApply) |
| | | vc.modalPresentationStyle = .fullScreen |
| | | weakSelf.present(vc, animated: true) |
| | | case .cancel: |
| | | alert(msg: "交易已取消") |
| | | case .failure(let error): |
| | | alertError(msg: error.localizedDescription) |
| | | } |
| | | } |
| | | case .wechat:break |
| | | default:break |
| | | } |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | } |
| | | } |
| | |
| | | override func setUI() { |
| | | btn_filter.imagePosition = .right |
| | | btn_filter.spacingBetweenImageAndTitle = 3 |
| | | let colors = [UIColor(hexStr: "#FD8C02").cgColor, |
| | | UIColor(hexStr: "#FD7202").cgColor,] |
| | | view_topBg.jq_gradientColor(colorArr: colors,bounds: CGRect(x: 0, y: 0, width: JQ_ScreenW, height: JQ_ScreenW * 0.5923)) |
| | | btn_rechange.jq_gradientNibColor(colorArr: colors, cornerRadius: 20) |
| | | view_container.jq_addShadows(shadowColor: UIColor(hexStr: "#D5D5D5").withAlphaComponent(0.5), corner: 10, radius: 4, offset: CGSize(width: 0, height: 2), opacity: 1) |
| | | |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.separatorStyle = .none |
| | | tableView.register(UINib(nibName: "BillInfoTCell", bundle: nil), forCellReuseIdentifier:"_BillInfoTCell") |
| | | tableView.jq_setEmptyView() |
| | | |
| | | viewModel.yearMonth.accept(Date().jq_format("yyyy-MM")) |
| | | btn_date.setTitle("\(Date().jq_format("yyyy年MM月"))>", for: .normal) |
| | | viewModel.configure(tableView) |
| | | } |
| | | |
| | | override func viewDidLayoutSubviews() { |
| | | super.viewDidLayoutSubviews() |
| | | let colors = [UIColor(hexStr: "#FD8C02").cgColor, |
| | | UIColor(hexStr: "#FD7202").cgColor,] |
| | | view_topBg.jq_gradientColor(colorArr: colors,bounds: CGRect(x: 0, y: 0, width: JQ_ScreenW, height: JQ_ScreenW * 0.5923)) |
| | | btn_rechange.jq_gradientNibColor(colorArr: colors, cornerRadius: 20) |
| | | } |
| | | |
| | | @IBAction func datetimeAction(_ sender: UIButton) { |
| | | CommonDatePickerView.show(before: 3, after: 0, type: .YM) {[weak self] year, month, day,_,_ in |
| | | self?.btn_date.setTitle(String(format: "%ld年%02ld月>", year!,month!), for: .normal) |
| | |
| | | super.viewDidLoad() |
| | | title = "我的账单" |
| | | viewModel.configure(tableView,needMore: false) |
| | | viewModel.yearMonth.accept(Date().jq_format("yyyy年MM月")) |
| | | viewModel.yearMonth.accept(Date().jq_format("yyyy-MM")) |
| | | viewModel.beginRefresh() |
| | | } |
| | | |
| | |
| | | self?.label_price.text = "\(model.integral)积分" |
| | | case .cashAndCoin: |
| | | self?.label_price.text = String(format: "%ld积分+%@", model.integral,model.cash.currency()) |
| | | case .cash: |
| | | self?.label_price.text = model.cash.currency() |
| | | } |
| | | |
| | | self?.img_state.isHidden = model.useType == .unUsed |
| | |
| | | @IBOutlet weak var label_storeName: UILabel! |
| | | @IBOutlet weak var cons_webHei: NSLayoutConstraint! |
| | | @IBOutlet weak var btn_exchange: UIButton! |
| | | |
| | | @IBOutlet weak var view_students: UIView! |
| | | |
| | | private var bannerView:CommonBannerView = { |
| | | let banner = CommonBannerView() |
| | | return banner |
| | |
| | | self?.exchangeGoodsModel = model |
| | | self?.label_title.text = model.goodName |
| | | self?.label_limit.text = String(format: "%@|%@", model.belongsScope.strTitle,model.exchangeAddrType.titleRaw) |
| | | self?.label_cost.text = String(format: "价值:%ld", model.cost) |
| | | self?.label_cost.isHidden = model.cost == 0 |
| | | self?.label_cost.text = String(format: "价值:%@", model.cost.currency()) |
| | | self?.label_redeemedNum.text = "\(model.redeemedNum)" |
| | | self?.label_residueNum.text = "\(model.residueNum)" |
| | | self?.label_perLimit.text = "\(model.perLimit)" |
| | |
| | | self?.label_courseHours.text = "\(model.courseHours)课时" |
| | | self?.view_courseHours.isHidden = model.courseHours == 0 |
| | | self?.view_exchangeStore.isHidden = model.exchangeAddrType != .store |
| | | self?.view_students.isHidden = model.goodType != .course |
| | | |
| | | switch model.exchangeType{ |
| | | case .coin: |
| | | self?.label_exchange.text = String(format: "%ld积分", model.integral) |
| | | case .cashAndCoin: |
| | | self?.label_exchange.text = String(format: "%ld积分+%@", model.integral,model.cash.currency()) |
| | | case .cash: |
| | | self?.label_exchange.text = model.cash.currency() |
| | | } |
| | | |
| | | |
| | |
| | | }else{ |
| | | self?.webView.loadHTMLString(model.contents.jq_wrapHtml(), baseURL: nil) |
| | | } |
| | | |
| | | self?.bannerView.setImages(images: model.pics, type: .URL) { index in |
| | | |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | bannerView.setImages(images: exchangeGoodsModel?.pics ?? [], type: .URL) { index in |
| | | |
| | | } |
| | | |
| | | updateStudenTable() |
| | | } |
| | |
| | | override func setUI() { |
| | | btn_student.imagePosition = .right |
| | | btn_store.imagePosition = .right |
| | | webView.scrollView.isScrollEnabled = false |
| | | |
| | | btn_student.spacingBetweenImageAndTitle = 3 |
| | | btn_store.spacingBetweenImageAndTitle = 3 |
| | |
| | | @IBAction func exchangeAction(_ sender: UIButton) { |
| | | guard exchangeGoodsModel != nil else {return} |
| | | guard exchangeGoodsModel!.residueNum != 0 else {alert(msg: "已兑换光啦");return} |
| | | guard studentModels.count != 0 else {alert(msg: "请选择学员");return} |
| | | |
| | | if exchangeGoodsModel!.goodType == .course{ |
| | | guard studentModels.count != 0 else {alert(msg: "请选择学员");return} |
| | | } |
| | | |
| | | // var mpower = max(1,studentModels.count) //倍率 |
| | | |
| | | ChooseNumberView.show(maxNumber: exchangeGoodsModel!.perLimit) {[weak self] num in |
| | | guard let weakSelf = self else { return } |
| | | let attribute = AttributedStringbuilder() |
| | | attribute.add(string: "确认消耗", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: .black.withAlphaComponent(0.9)) |
| | | |
| | | if weakSelf.exchangeGoodsModel!.exchangeType == .coin{ |
| | | attribute.add(string: "\(weakSelf.exchangeGoodsModel!.cost * weakSelf.studentModels.count)积分", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8)) |
| | | }else{ |
| | | attribute.add(string: String(format: "%ld积分和%@", weakSelf.exchangeGoodsModel!.integral * weakSelf.studentModels.count,(weakSelf.exchangeGoodsModel!.cash * Double(weakSelf.studentModels.count)).currency()), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8)) |
| | | } |
| | | switch weakSelf.exchangeGoodsModel!.exchangeType{ |
| | | case .cash: |
| | | attribute.add(string: (weakSelf.exchangeGoodsModel!.cash * Double(num)).currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8)) |
| | | case .cashAndCoin: |
| | | attribute.add(string: String(format: "%ld积分和%@", weakSelf.exchangeGoodsModel!.integral * num,(weakSelf.exchangeGoodsModel!.cash * Double(num)).currency()), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8)) |
| | | case .coin: |
| | | attribute.add(string: "\(weakSelf.exchangeGoodsModel!.integral * num)积分", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8)) |
| | | } |
| | | |
| | | attribute.add(string: "兑换此商品吗?", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: .black.withAlphaComponent(0.9)) |
| | | CommonAlertView.show(title: "兑换商品", attribute: attribute.mutableAttributedString) { state in |
| | | guard state else {return} |
| | | |
| | | if weakSelf.exchangeGoodsModel!.exchangeType == .coin{ |
| | | Services.exchangeOperation(exchangeType: .coin, goodsId: weakSelf.exchangeGoodsModel!.goodId, goodsType: weakSelf.exchangeGoodsModel!.goodType, num: num, payType: nil, stuIds: weakSelf.studentModels.map({"\($0.id)"}).joined(separator: ",")).subscribe(onNext: {data in |
| | | Services.exchangeOperation(exchangeType: .coin, goodsId: weakSelf.exchangeGoodsModel!.goodId, goodsType: weakSelf.exchangeGoodsModel!.goodType, num: num, payType: nil, stuIds: weakSelf.studentModels.map({"\($0.id)"}).joined(separator: ","),storeId: weakSelf.selectStoreModel?.storeId).subscribe(onNext: {data in |
| | | alertSuccess(msg: "兑换成功") |
| | | weakSelf.exchangeSuccessUI() |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | }else { |
| | | |
| | | //支付金额 |
| | | let cash = weakSelf.exchangeGoodsModel!.cash |
| | | PaymentView.show(money: (ali:cash,wx:cash,coin:nil,course:nil)) { payType in |
| | | Services.exchangeOperation(exchangeType: .cashAndCoin, goodsId: weakSelf.exchangeGoodsModel!.goodId, goodsType: weakSelf.exchangeGoodsModel!.goodType, num: num, payType: payType, stuIds: weakSelf.studentModels.map({"\($0.id)"}).joined(separator: ",")).subscribe(onNext: {data in |
| | | Services.exchangeOperation(exchangeType: weakSelf.exchangeGoodsModel!.exchangeType, goodsId: weakSelf.exchangeGoodsModel!.goodId, goodsType: weakSelf.exchangeGoodsModel!.goodType, num: num, payType: payType, stuIds: weakSelf.studentModels.map({"\($0.id)"}).joined(separator: ","), storeId: weakSelf.selectStoreModel?.storeId).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | switch payType { |
| | | case .aliPay: |
| | |
| | | <outlet property="view_banner" destination="Qqf-lq-tQb" id="nPC-xS-Gbj"/> |
| | | <outlet property="view_courseHours" destination="FLV-Kf-Avt" id="oDU-BH-bZj"/> |
| | | <outlet property="view_exchangeStore" destination="PF8-aV-ew9" id="x4R-3l-zbD"/> |
| | | <outlet property="view_students" destination="0QQ-kQ-0an" id="cy7-oc-Uw9"/> |
| | | <outlet property="webView" destination="tQn-lc-7cb" id="xcY-cg-bKR"/> |
| | | </connections> |
| | | </placeholder> |
| | |
| | | self?.img_userProfile.sd_setImage(with: URL(string: model.userHeadImg)) |
| | | self?.label_username.text = model.userName.isEmpty ? "未命名":model.userName |
| | | self?.btn_vip.isHidden = model.isMember != "年度会员" |
| | | self?.label_coin.text = "\(model.wpCoin)" |
| | | self?.label_coin.text = model.wpCoin.currencyNotPrefix() |
| | | self?.label_score.text = "\(model.userIntegral)" |
| | | self?.coinCollectionView.reloadData() |
| | | |
| | |
| | | self?.btn_todayFree.sd_setImage(with: URL(string: todayFree), for: .normal, placeholderImage: nil, context: nil) |
| | | } |
| | | |
| | | if model.commodities.count > 0{ |
| | | if model.commodities.count > 5{ |
| | | self?.autoScroll() |
| | | } |
| | | } |
| | |
| | | if timer != nil{ |
| | | recoverTimer() |
| | | }else{ |
| | | autoScroll() |
| | | if (benefitHomeModel?.commodities.count ?? 0) > 5{ |
| | | autoScroll() |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | <nil key="highlightedColor"/> |
| | | </label> |
| | | <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_score" translatesAutoresizingMaskIntoConstraints="NO" id="fYH-IU-RDd"> |
| | | <rect key="frame" x="197" y="119" width="16" height="16"/> |
| | | <rect key="frame" x="197.33333333333334" y="119" width="16" height="16"/> |
| | | </imageView> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="会员积分" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ft0-mn-MrN"> |
| | | <rect key="frame" x="219" y="119.33333333333334" width="53.333333333333314" height="15.666666666666657"/> |
| | | <rect key="frame" x="219.33333333333334" y="119.33333333333334" width="53.333333333333343" height="15.666666666666657"/> |
| | | <fontDescription key="fontDescription" type="system" pointSize="13"/> |
| | | <color key="textColor" red="0.18823529410000001" green="0.3294117647" blue="0.38823529410000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <nil key="highlightedColor"/> |
| | | </label> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FKV-jp-n9Z"> |
| | | <rect key="frame" x="277.33333333333331" y="119.33333333333334" width="8.3333333333333144" height="15.666666666666657"/> |
| | | <rect key="frame" x="277.66666666666669" y="119.33333333333334" width="8.3333333333333144" height="15.666666666666657"/> |
| | | <fontDescription key="fontDescription" type="system" pointSize="13"/> |
| | | <color key="textColor" red="0.18823529410000001" green="0.3294117647" blue="0.38823529410000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <nil key="highlightedColor"/> |
| | |
| | | </connections> |
| | | </button> |
| | | <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cWO-5E-szA"> |
| | | <rect key="frame" x="290.66666666666669" y="116" width="52" height="22"/> |
| | | <rect key="frame" x="291" y="116" width="52" height="22"/> |
| | | <constraints> |
| | | <constraint firstAttribute="width" constant="52" id="Tto-xt-EoC"/> |
| | | <constraint firstAttribute="height" constant="22" id="gzD-OM-r2g"/> |
| | |
| | | <constraint firstItem="3uF-Kg-Gaz" firstAttribute="top" secondItem="7GZ-X8-dwC" secondAttribute="top" constant="1" id="FH5-nz-jhD"/> |
| | | <constraint firstAttribute="trailing" secondItem="3uF-Kg-Gaz" secondAttribute="trailing" constant="14" id="JeX-JH-xyP"/> |
| | | <constraint firstItem="joc-Xf-ULn" firstAttribute="leading" secondItem="qtJ-Db-Js8" secondAttribute="leading" constant="9" id="P1h-6D-VD6"/> |
| | | <constraint firstItem="fYH-IU-RDd" firstAttribute="leading" secondItem="qtJ-Db-Js8" secondAttribute="leading" constant="197" id="Pnz-Bg-I7i"/> |
| | | <constraint firstItem="fYH-IU-RDd" firstAttribute="leading" secondItem="bgn-Mv-nv3" secondAttribute="trailing" constant="55" id="QAx-Oz-Ejw"/> |
| | | <constraint firstItem="5GZ-Mz-c7r" firstAttribute="centerY" secondItem="joc-Xf-ULn" secondAttribute="centerY" id="Qon-HQ-zKH"/> |
| | | <constraint firstItem="joc-Xf-ULn" firstAttribute="top" secondItem="7GZ-X8-dwC" secondAttribute="bottom" constant="35" id="Rmv-lE-vuc"/> |
| | | <constraint firstItem="KrQ-RG-f2e" firstAttribute="leading" secondItem="7GZ-X8-dwC" secondAttribute="leading" id="SNL-FM-adG"/> |
| | |
| | | @IBOutlet weak var btn_handle: UIButton! |
| | | |
| | | private var id:Int! |
| | | private var weeklyItemDetailModel:WeeklyItemDetailModel? |
| | | |
| | | required init(id:Int) { |
| | | super.init(nibName: nil, bundle: nil) |
| | |
| | | Services.weekBenefitDetail(id: id).subscribe(onNext: {[weak self] data in |
| | | guard let weakSelf = self else { return } |
| | | if let model = data.data{ |
| | | weakSelf.weeklyItemDetailModel = model |
| | | weakSelf.img_cover.sd_setImage(with: URL(string: model.coverDrawing)) |
| | | weakSelf.label_name.text = model.coursePackageName |
| | | weakSelf.btn_address.setTitle(model.storeNameAddr, for: .normal) |
| | |
| | | |
| | | } |
| | | @IBAction func applyAction(_ sender: UIButton) { |
| | | guard let id = weeklyItemDetailModel?.coursePackageDiscountId else{return} |
| | | Services.queryCourseInfo(id: id).subscribe(onNext: {[weak self] data in |
| | | if let m = data.data{ |
| | | let vc = CourseDetailApplyVC(detailModel: m) |
| | |
| | | import RxSwift |
| | | import RxRelay |
| | | |
| | | class CoinStoreHeadView: UICollectionReusableView { |
| | | class CoinStoreHeadView: UICollectionReusableView,JQNibView { |
| | | |
| | | @IBOutlet weak var btn_sort: QMUIButton! |
| | | @IBOutlet weak var btn_type: QMUIButton! |
| | |
| | | |
| | | // item |
| | | pageMenu.spacing = 20.0 |
| | | pageMenu.permutationWay = .notScrollAdaptContent |
| | | pageMenu.permutationWay = .scrollAdaptContent |
| | | pageMenu.setItems(["全部","待核销","已核销","已过期","已取消","待支付"], selectedItemIndex: 0) |
| | | |
| | | // 字体 |
| | |
| | | @IBAction func couponAction(_ sender: UIButton) { |
| | | CouponChooseView.show(coupons, defaultModel: selectCouponModel) { [weak self] m in |
| | | self?.selectCouponModel = m |
| | | let string = m == nil ? "去选择":"-\(m?.favorable ?? "")" |
| | | let string = m == nil ? "去选择":"-\(m!.favorable.currency())" |
| | | self?.btn_coupon.setTitle(string, for: .normal) |
| | | } |
| | | } |
| | |
| | | let price = Double(a.count) * weakSelf.siteDetailModel.cashPrice |
| | | let coin = a.count * weakSelf.siteDetailModel.playPaiCoin |
| | | |
| | | let prefix = a.first?.time.components(separatedBy: "-").first |
| | | let suffix = a.last?.time.components(separatedBy: "-").last |
| | | let times = String(format: "%@ %@-%@", YardDetailDateManager.shared().dates.value.keys.first!,prefix!,suffix!) |
| | | var datetimes = [String]() |
| | | let key = YardDetailDateManager.shared().dates.value.keys.first! |
| | | for value in YardDetailDateManager.shared().dates.value.values.first!{ |
| | | datetimes.append(String(format: "%@ %@", key,value.time)) |
| | | } |
| | | |
| | | |
| | | PaymentView.show(money: (ali:price,wx:price,coin:coin,course:nil)) { [weak self] type in |
| | | guard let weakSelf = self else { return } |
| | | Services.reservationSite(booker: weakSelf.tf_person.text!, couponId: weakSelf.selectCouponModel?.id, id: weakSelf.siteDetailModel.id, payType: type, phone: weakSelf.tf_phone.text!, times: times).subscribe(onNext: { data in |
| | | Services.reservationSite(booker: weakSelf.tf_person.text!, couponId: weakSelf.selectCouponModel?.id, id: weakSelf.siteDetailModel.id, payType: type, phone: weakSelf.tf_phone.text!, times: datetimes.joined(separator: ";")).subscribe(onNext: { data in |
| | | if let m = data.data{ |
| | | switch type { |
| | | case .aliPay: |
| | |
| | | |
| | | import UIKit |
| | | import SVProgressHUD |
| | | import JQTools |
| | | |
| | | class SceneDelegate: UIResponder, UIWindowSceneDelegate { |
| | | |
| | |
| | | if UserViewModel.getToken() != nil{ |
| | | app.registerAndLoginSuccess() |
| | | }else{ |
| | | app.needLogin() |
| | | let loginVC = LoginVC() |
| | | window?.rootViewController = loginVC |
| | | window?.makeKeyAndVisible() |
| | | } |
| | | |
| | | SVProgressHUD.setContainerView(window) |
| | | SVProgressHUD.setDefaultStyle(.dark) |
| | | SVProgressHUD.setContainerView(window) |
| | | SVProgressHUD.setDefaultStyle(.dark) |
| | | SVProgressHUD.setDefaultMaskType(.gradient) //禁止交互 |
| | | SVProgressHUD.setMinimumDismissTimeInterval(1.5) |
| | | SVProgressHUD.setMaximumDismissTimeInterval(30.0) |
| | | |
| | |
| | | } |
| | | |
| | | api()?.subscribe(onNext: { data in |
| | | if let datas = data.data,datas.count > 0{ |
| | | if let datas = data.data{ |
| | | switch status{ |
| | | case .refresh: |
| | | self.dataSource.accept(datas) |
| | | self.refreshSubject.onNext(.completedRefresh) |
| | | case .load: |
| | | self.dataSource.accept(self.dataSource.value + datas) |
| | | self.refreshSubject.onNext(.completedLoad) |
| | | if datas.count == 0{ |
| | | self.refreshSubject.onNext(.completedLoadWithNoMoreData) |
| | | }else{ |
| | | self.refreshSubject.onNext(.completedLoad) |
| | | } |
| | | } |
| | | }else{ |
| | | self.refreshSubject.onNext(.completedLoadWithNoMoreData) |