WanPai/Model/CommonModels.swift
@@ -299,6 +299,8 @@ var weekTime: String = "" var vipPrice:Double = 0 var detailDrawing = "" var holiTime:String = "" var type = 1 // 1:常规课,2:假期课 } struct SiteItemModel:HandyJSON{ @@ -392,6 +394,20 @@ var totalNums: Int = 0 var weight: Int = 0 var bodyStatus = "" func save(){ UserDefaults.standard.set(self.toJSONString(), forKey: "StartClouseHomeModel") UserDefaults.standard.synchronize() } static func get()->StartClouseHomeModel?{ if let string = UserDefaults.standard.string(forKey: "StartClouseHomeModel"){ return StartClouseHomeModel.deserialize(from: string) }else{ return nil } } } struct StartClouseListModel:HandyJSON{ @@ -482,7 +498,7 @@ var address: String = "" var birthday: String = "" var memberLifespan: String = "" var sex: GenderType = .man var sex: String = "" var userImage: String = "" var userName: String = "" var userPhone: String = "" WanPai/Network/Services.swift
@@ -556,6 +556,7 @@ .interface(url: "/account/api/startCource/queryStudentData") .append(key: "lat", value: locationTool.currentLocation?.coordinate.latitude.string) .append(key: "lon", value: locationTool.currentLocation?.coordinate.longitude.string) .append(key: "stuId", value: StartClouseHomeModel.get()?.stuId) return NetworkRequest.request(params: params, method: .post, progress: false) } @@ -595,6 +596,7 @@ .interface(url: "/course/api/startCource/afterSourceList") .append(key: "courseTypeId", value: courseTypeId) .append(key: "search", value: search) .append(key: "stuId", value: StartClouseHomeModel.get()?.stuId) return NetworkRequest.request(params: params, method: .post, progress: false) } @@ -700,6 +702,7 @@ .append(key: "num", value: num) .append(key: "oldCourseId", value: oldCourseId) .append(key: "time", value: time.joined(separator: ",").replacingOccurrences(of: ".", with: "-")) .append(key: "stuId", value: StartClouseHomeModel.get()?.stuId) return NetworkRequest.request(params: params, method: .post, progress: true) } WanPai/Root/Course/VC/CourseDetailApplyVC.swift
@@ -49,6 +49,7 @@ private var studentModels = [CourseDetailStudentModel]() private var couponModels = [CouponInfoModel]() private var selectCouponModel:CouponInfoModel? private var classHours:Int? override func viewDidLoad() { super.viewDidLoad() @@ -62,6 +63,13 @@ label_address.text = m.storeAddress label_vaild.text = m.time label_courseType.text = m.type.strTitle //默认选择传递过来的课时数 for (index,clas) in m.list.enumerated(){ if clas.classHours == classHours{ selectClassIndex = index;break } } switch m.type { case .vocation: @@ -130,10 +138,11 @@ btn_addStudent.spacingBetweenImageAndTitle = 3 } init(detailModel:CourseDetailModel,isExtend:Bool = false) { init(detailModel:CourseDetailModel,isExtend:Bool = false,classHours:Int? = nil) { super.init(nibName: nil, bundle: nil) self.detailModel = detailModel self.isExtend = isExtend self.classHours = classHours } required init?(coder: NSCoder) { @@ -296,7 +305,7 @@ label_originPrice.isHidden = false } // label_originPrice.isHidden = (subM.paymentPrice == subM.originalPrice && subM.paymentPrice != 0 && subM.originalPrice != 0) label_coin.isHidden = false label_coin.isHidden = subM.payType == .coin //玩湃币 label_coin.attributedText = AttributedStringbuilder.build() .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) WanPai/Root/Course/VC/CourseDetailVC.swift
@@ -87,7 +87,7 @@ }else{ label_originPrice.isHidden = false } label_coin.isHidden = false label_coin.isHidden = subM.payType == .coin //玩湃币 label_coin.attributedText = AttributedStringbuilder.build() .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) WanPai/Root/Course/VC/CourseInfoVC.swift
@@ -171,6 +171,7 @@ Services.startCourseHome().subscribe(onNext: {[weak self] data in if let model = data.data{ self?.startClouseHomeModel = model model.save() self?.updateData() } }).disposed(by: weakSelf.disposeBag) @@ -181,6 +182,7 @@ guard let weakSelf = self else { return } Services.startCourseHome().subscribe(onNext: {[weak self] data in if let model = data.data{ model.save() if model.isThere == 1{ let courseInfoVC = CourseInfoVC() courseInfoVC.startClouseHomeModel = model @@ -585,8 +587,8 @@ guard startClouseHomeModel != nil else {return} if let m = startClouseHomeModel?.courseList[index]{ label_totalNums.text = "总课时数\( m.totalNums)" label_deductedNums.text = "已扣学时数\( m.deductedNums)" label_remainingNums.text = "剩余学时数\( m.remainingNums)" label_deductedNums.text = "已扣课时数\( m.deductedNums)" label_remainingNums.text = "剩余课时数\( m.remainingNums)" } } } WanPai/Root/Course/VC/CourseVC.swift
@@ -47,6 +47,7 @@ Services.startCourseHome().subscribe(onNext: {[weak self] data in if let model = data.data{ if model.isThere == 1{ model.save() let courseInfoVC = CourseInfoVC() courseInfoVC.startClouseHomeModel = model let clouseNav = BaseNav(rootViewController: courseInfoVC) WanPai/Root/Home/VC/HomeVC.swift
@@ -39,6 +39,7 @@ Services.startCourseHome().subscribe(onNext: {[weak self] data in if let model = data.data{ model.save() if model.isThere == 1{ let courseInfoVC = CourseInfoVC() courseInfoVC.startClouseHomeModel = model WanPai/Root/Login/VC/LoginRegOrForgotVC.swift
@@ -20,9 +20,13 @@ @IBOutlet weak var tf_invitePhone: QMUITextField! @IBOutlet weak var view_invite: UIView! @IBOutlet weak var view_placeholder: UIView! required init(type:GetSMSCodeType) { private var force:String = "" required init(type:GetSMSCodeType,force:String = "") { super.init(nibName: nil, bundle: nil) self.type = type self.force = force } required init?(coder: NSCoder) { @@ -34,6 +38,8 @@ title = type.titleStr tf_pwd.maximumTextLength = 18 tf_phone.text = force if !force.isEmpty{alert(msg: "请修改密码")} view_invite.isHidden = type != .register view_placeholder.isHidden = type != .register } WanPai/Root/Login/VC/LoginVC.swift
@@ -152,11 +152,12 @@ guard let weakSelf = self else { return } if let token = data.data{ UserViewModel.saveToken(token) Services.userDetails().subscribe(onNext: {data in Services.userDetails().subscribe(onNext: {[weak self] data in guard let weakSelf = self else { return } if let m = data.data{ //需要修改密码 if m.needChange == 1{ let vc = LoginRegOrForgotVC(type: .updatePwd) let vc = LoginRegOrForgotVC(type: .updatePwd,force: weakSelf.tf_phone.text!) self?.push(vc: vc) }else{ m.save() WanPai/Root/Other/VC/ProfileVC.swift
@@ -33,7 +33,7 @@ if let model = data.data{ self?.tf_username.text = model.userName self?.label_contact.text = model.userPhone self?.tf_gender.text = model.sex == .man ? "男":"女" self?.tf_gender.text = model.sex self?.tf_birthday.text = model.birthday self?.label_address.text = model.address self?.label_vipDutime.text = model.memberLifespan WanPai/Root/Welfare/TCell/WelfareCouponsTCell.swift
@@ -62,7 +62,7 @@ img_footer.image = UIImage(named: "icon_coupon_footer")?.withTintColor(UIColor(hexStr: "#BEBEBE"),renderingMode: .alwaysOriginal) } btn_detail.isHidden = couponModel.useCondition == .nationwide btn_detail.isHidden = couponModel.useCondition != .nationwide label_info.text = couponModel.instructionsForUse switch couponModel.type { WanPai/Root/Welfare/TCell/WelfareWeeklyTCell.swift
@@ -12,7 +12,8 @@ @IBOutlet weak var img_cover: UIImageView! @IBOutlet weak var label_title: UILabel! @IBOutlet weak var label_courseNum: UILabel! @IBOutlet weak var view_courseNum: UIView! @IBOutlet weak var label_courseNum: UILabel! @IBOutlet weak var label_giftCourseNum: UILabel! @IBOutlet weak var view_giftCourseNum: UIView! @IBOutlet weak var label_datetime: UILabel! @@ -26,11 +27,12 @@ img_cover.sd_setImage(with: URL(string: weeklyItemModel.image)) label_title.text = weeklyItemModel.coursePackageName label_courseNum.text = "\(weeklyItemModel.courseHours)课时" view_courseNum.isHidden = weeklyItemModel.courseHours == 0 label_giftCourseNum.text = "\(weeklyItemModel.donateHours)课时" label_datetime.text = weeklyItemModel.dataTime label_distance.text = String(format: "%.2lfkm", weeklyItemModel.storeDistance) view_giftCourseNum.isHidden = weeklyItemModel.donateHours == 0 label_discountPrice.isHidden = weeklyItemModel.discountPrice == 0 label_discountPrice.isHidden = (weeklyItemModel.discountPrice == 0 || weeklyItemModel.discountPrice == weeklyItemModel.originalPrice) if weeklyItemModel.status == 1{ btn_status.setTitle("查看详情", for: .normal) btn_status.backgroundColor = Def_ThemeColor WanPai/Root/Welfare/TCell/WelfareWeeklyTCell.xib
@@ -212,6 +212,7 @@ <outlet property="label_giftCourseNum" destination="ZeA-le-LUZ" id="WqI-2a-Vrb"/> <outlet property="label_price" destination="UEa-W5-680" id="ZXM-gT-E99"/> <outlet property="label_title" destination="CvQ-a2-im1" id="y4W-gw-i0J"/> <outlet property="view_courseNum" destination="Vzz-sj-UyG" id="H4I-J1-7W9"/> <outlet property="view_giftCourseNum" destination="1zU-5c-0z4" id="STo-m7-Qzr"/> </connections> <point key="canvasLocation" x="219.84732824427479" y="71.478873239436624"/> WanPai/Root/Welfare/VC/WelfareRedeemGoodsDetailVC.swift
@@ -212,10 +212,6 @@ guard studentModels.count != 0 else {alert(msg: "请选择运动营成员");return} } // guard selectStoreModel != nil else {alert(msg: "请选择兑换门店");return} // var mpower = max(1,studentModels.count) //倍率 if exchangeGoodsModel!.perLimit > 1{ var n = exchangeGoodsModel!.perLimit if exchangeGoodsModel!.goodType == .course{ @@ -234,13 +230,23 @@ let attribute = AttributedStringbuilder() attribute.add(string: "确认消耗", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: .black.withAlphaComponent(0.9)) var coin = 0 var cash:Double = 0 if exchangeGoodsModel?.goodType == .course{ coin = exchangeGoodsModel!.integral * num * studentModels.count cash = (exchangeGoodsModel!.cash * Double(num) * Double(studentModels.count)) }else{ coin = exchangeGoodsModel!.integral * num cash = (exchangeGoodsModel!.cash * Double(num)) } switch exchangeGoodsModel!.exchangeType{ case .cash: attribute.add(string: (exchangeGoodsModel!.cash * Double(studentModels.count) * Double(num)).currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8)) attribute.add(string: cash.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8)) case .cashAndCoin: attribute.add(string: String(format: "%ld积分和%@", exchangeGoodsModel!.integral * num * studentModels.count,(exchangeGoodsModel!.cash * Double(num) * Double(studentModels.count)).currency()), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8)) attribute.add(string: String(format: "%ld积分和%@", coin,cash.currency()), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8)) case .coin: attribute.add(string: "\(exchangeGoodsModel!.integral * num * studentModels.count)积分", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexStr: "#E41818").withAlphaComponent(0.8)) attribute.add(string: "\(coin)积分", 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)) WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.swift
@@ -28,7 +28,9 @@ @IBOutlet weak var label_coin: UILabel! @IBOutlet weak var label_vip: UILabel! @IBOutlet weak var btn_handle: UIButton! @IBOutlet weak var label_periodOfValidity: UILabel! @IBOutlet weak var view_periodOfValidity: UIView! private var id:Int! private var weeklyItemDetailModel:WeeklyItemDetailModel? @@ -54,7 +56,7 @@ weakSelf.label_address.text = model.storeNameAddr weakSelf.label_courseNum.text = "\(model.classHours)课时" weakSelf.label_giftCourseNum.text = "\(model.freeClassHours)课时" weakSelf.view_courseNum.isHidden = model.classHours == 0 weakSelf.view_courseNum.isHidden = (model.classHours == 0 || model.type == 2) weakSelf.view_giftCourseNum.isHidden = model.freeClassHours == 0 weakSelf.label_attendWeeks.text = model.weekTime weakSelf.label_datetime.text = model.time @@ -65,6 +67,8 @@ weakSelf.label_originPrice.attributedText = AttributedStringbuilder.build().add(string: model.costPrice.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).delLine(color: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).mutableAttributedString weakSelf.label_price.text = model.discountPrice.currency() weakSelf.label_periodOfValidity.text = model.holiTime weakSelf.view_periodOfValidity.isHidden = model.holiTime.isEmpty weakSelf.img_intro.sd_setImage(with: URL(string: model.introduceDrawing)) {[weak self] image, error, type, url in if let img = image{ @@ -88,7 +92,7 @@ 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) let vc = CourseDetailApplyVC(detailModel: m,classHours: self?.weeklyItemDetailModel?.classHours) self?.push(vc: vc) } }).disposed(by: disposeBag) WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.xib
@@ -24,12 +24,14 @@ <outlet property="label_giftCourseNum" destination="mQE-9m-7Uc" id="EeH-5e-5Oe"/> <outlet property="label_name" destination="IRe-jL-GtL" id="uEh-DB-qmI"/> <outlet property="label_originPrice" destination="xCq-BR-M7r" id="6DX-lv-1qc"/> <outlet property="label_periodOfValidity" destination="bVb-n2-hDd" id="qRq-hs-FAA"/> <outlet property="label_price" destination="Wps-ww-7sF" id="p7d-7a-V6K"/> <outlet property="label_vip" destination="7KS-mD-pbb" id="Nhg-8r-gdk"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view_banner" destination="9x3-OB-26n" id="jxs-zv-kio"/> <outlet property="view_courseNum" destination="Evs-U2-JQo" id="L7j-9O-2wo"/> <outlet property="view_giftCourseNum" destination="He4-gs-Axl" id="8ou-GW-KLc"/> <outlet property="view_periodOfValidity" destination="sMM-yC-Gqf" id="8BU-ze-H3p"/> </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> @@ -41,7 +43,7 @@ <rect key="frame" x="0.0" y="59" width="393" height="684"/> <subviews> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Idk-Wv-zLx"> <rect key="frame" x="0.0" y="0.0" width="393" height="596.33333333333337"/> <rect key="frame" x="0.0" y="0.0" width="393" height="645.33333333333337"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9x3-OB-26n" customClass="CommonBannerView" customModule="WanPai" customModuleProvider="target"> <rect key="frame" x="0.0" y="0.0" width="393" height="221.66666666666666"/> @@ -148,11 +150,52 @@ <constraint firstItem="Gaj-iR-oGe" firstAttribute="top" secondItem="hIw-tK-g98" secondAttribute="bottom" constant="14" id="omw-rU-fgZ"/> </constraints> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="He4-gs-Axl"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sMM-yC-Gqf"> <rect key="frame" x="0.0" y="361.33333333333331" width="393" height="49"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Q7u-VG-gsT"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="i8f-Rx-ml6"> <rect key="frame" x="13" y="48" width="380" height="1"/> <color key="backgroundColor" red="0.59215686270000001" green="0.59215686270000001" blue="0.59215686270000001" alpha="0.22" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="1" id="9ns-BZ-SIf"/> </constraints> </view> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="课包有效期:" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Meb-ED-QHf"> <rect key="frame" x="14" y="14" width="86" height="20"/> <constraints> <constraint firstAttribute="height" constant="20" id="O44-OU-6MS"/> </constraints> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/> <nil key="textColor"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0课时" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bVb-n2-hDd"> <rect key="frame" x="105" y="14" width="37.333333333333343" height="20"/> <constraints> <constraint firstAttribute="height" constant="20" id="OET-lZ-XDM"/> </constraints> <fontDescription key="fontDescription" type="system" pointSize="14"/> <color key="textColor" red="0.87450980389999999" green="0.062745098040000002" blue="0.062745098040000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> </subviews> <color key="backgroundColor" systemColor="systemBackgroundColor"/> <constraints> <constraint firstItem="Meb-ED-QHf" firstAttribute="leading" secondItem="sMM-yC-Gqf" secondAttribute="leading" constant="14" id="6FL-YT-46k"/> <constraint firstAttribute="trailing" secondItem="i8f-Rx-ml6" secondAttribute="trailing" id="9r3-oO-rC4"/> <constraint firstAttribute="bottom" secondItem="i8f-Rx-ml6" secondAttribute="bottom" id="ICN-1Z-M1O"/> <constraint firstItem="bVb-n2-hDd" firstAttribute="centerY" secondItem="Meb-ED-QHf" secondAttribute="centerY" id="geO-q7-eO9"/> <constraint firstItem="i8f-Rx-ml6" firstAttribute="leading" secondItem="sMM-yC-Gqf" secondAttribute="leading" constant="13" id="hpx-ga-ebC"/> <constraint firstItem="Meb-ED-QHf" firstAttribute="top" secondItem="sMM-yC-Gqf" secondAttribute="top" constant="14" id="iwY-JH-2Jf"/> <constraint firstItem="i8f-Rx-ml6" firstAttribute="top" secondItem="Meb-ED-QHf" secondAttribute="bottom" constant="14" id="oZA-KO-Zzv"/> <constraint firstItem="bVb-n2-hDd" firstAttribute="leading" secondItem="Meb-ED-QHf" secondAttribute="trailing" constant="5" id="q6T-vh-MBA"/> </constraints> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="He4-gs-Axl"> <rect key="frame" x="0.0" y="410.33333333333331" width="393" height="49"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Q7u-VG-gsT"> <rect key="frame" x="13" y="48.000000000000057" width="380" height="1"/> <color key="backgroundColor" red="0.59215686270000001" green="0.59215686270000001" blue="0.59215686270000001" alpha="0.22" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="1" id="Ctc-XK-pWb"/> @@ -190,10 +233,10 @@ </constraints> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hQc-bT-aln"> <rect key="frame" x="0.0" y="410.33333333333331" width="393" height="86"/> <rect key="frame" x="0.0" y="459.33333333333337" width="393" height="86"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hrq-r5-1M6"> <rect key="frame" x="13" y="73.000000000000057" width="380" height="1"/> <rect key="frame" x="13" y="73" width="380" height="1"/> <color key="backgroundColor" red="0.59215686270000001" green="0.59215686270000001" blue="0.59215686270000001" alpha="0.22" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="1" id="ahK-DF-ojc"/> @@ -242,7 +285,7 @@ </constraints> </view> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="9fb-wg-pcf"> <rect key="frame" x="0.0" y="496.33333333333337" width="393" height="100"/> <rect key="frame" x="0.0" y="545.33333333333337" width="393" height="100"/> <constraints> <constraint firstAttribute="height" constant="100" id="LTT-Lg-ST4"/> </constraints>