From a1ac0f1634ff0bd8f04259fc4cf7ebabd8c8c82d Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期二, 10 十月 2023 16:40:52 +0800 Subject: [PATCH] 修复BUG --- WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/shaixuan@3x.png | 0 WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/Contents.json | 4 WanPai/Common/View/CommonAlertView.swift | 15 WanPai/Root/Search/TCell/CustomerContentTCell.swift | 6 WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/路径@2x.png | 0 WanPai/Network/Services.swift | 2 WanPai/Root/Course/TCell/CourseTCell.swift | 8 WanPai/Root/Course/VC/CourseDetailApplyVC.swift | 27 + WanPai/Root/Home/VC/HomeVC.swift | 167 +++++-- WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/shaixuan@2x.png | 0 WanPai/Root/Home/Model/HomeModel.swift | 17 WanPai/Root/Search/TCell/CustomerContentQATCell.swift | 2 WanPai/Root/Login/VC/LoginRegOrForgotVC.xib | 40 WanPai/Common/View/CommonAlertSheetView.xib | 73 +++ WanPai/Root/Search/VC/CustomerSubListVC.swift | 29 + WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/路径@2x.png | 0 WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.swift | 12 WanPai/Root/Other/TCell/Common_1_TCell.xib | 10 WanPai/Root/Login/VC/LoginVC.swift | 26 WanPai/Root/Welfare/VC/CoinStoreCenterVC.swift | 17 WanPai/Config/Def.swift | 155 +++++++ WanPai/Common/VC/CommonWebVC.swift | 1 WanPai/Network/NetworkRequest.swift | 5 WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/路径@3x.png | 0 WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/Contents.json | 4 WanPai/Root/Course/VC/CourseListVC.swift | 24 + WanPai/Common/VC/CommonWebVC.xib | 8 WanPai/Root/Login/VC/BindPhoneVC.swift | 6 WanPai/Common/View/CommonAlertSheetView.swift | 125 +++++ WanPai/Root/Course/VC/CourseDetailVC.swift | 35 WanPai/Root/Search/VC/CustomerContentDetailVC.xib | 24 WanPai/Root/Search/VC/CustomerContentDetailVC.swift | 38 + WanPai/Root/Activity/VC/ActivityListVC.swift | 4 WanPai/Root/Course/VC/CourseListVC.xib | 25 WanPai/Root/Login/VC/BindPhoneVC.xib | 22 WanPai/Root/Other/View/StoresChooseView.xib | 71 +- WanPai/Assets.xcassets/Icons/.DS_Store | 0 WanPai/Common/View/CommonAlertView.xib | 6 WanPai/Root/Course/VC/CourseDetailVC.xib | 11 WanPai/Model/CommonModels.swift | 9 WanPai/Root/Welfare/VC/WelfareWeeklyListVC.swift | 14 WanPai/Config/Enums.swift | 2 WanPai.xcodeproj/project.pbxproj | 8 WanPai/Root/Course/VC/CourseDetailApplyVC.xib | 10 WanPai/Root/Login/VC/LoginRegOrForgotVC.swift | 3 WanPai/Root/Other/View/StoresChooseView.swift | 9 WanPai/Root/Search/VC/CustomerListVC.swift | 37 /dev/null | 0 WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/路径@3x.png | 0 WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/Contents.json | 4 WanPai/Root/Search/VC/SearchVC.swift | 9 WanPai/Root/Search/VC/SearchVC.xib | 16 WanPai/Root/Login/VC/LoginVC.xib | 48 +- WanPai/Root/Yard/VC/YardListVC.swift | 23 54 files changed, 931 insertions(+), 280 deletions(-) diff --git a/WanPai.xcodeproj/project.pbxproj b/WanPai.xcodeproj/project.pbxproj index c2603ba..ec68f2d 100644 --- a/WanPai.xcodeproj/project.pbxproj +++ b/WanPai.xcodeproj/project.pbxproj @@ -27,6 +27,8 @@ 130E402C2A4EC342003A3D75 /* SearchStoreDetailHeadView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 130E402B2A4EC342003A3D75 /* SearchStoreDetailHeadView.xib */; }; 130EC17D2AD3905F003CA9BA /* BindPhoneVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 130EC17B2AD3905F003CA9BA /* BindPhoneVC.swift */; }; 130EC17E2AD3905F003CA9BA /* BindPhoneVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 130EC17C2AD3905F003CA9BA /* BindPhoneVC.xib */; }; + 130EC1802AD3F6AF003CA9BA /* CommonAlertSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 130EC17F2AD3F6AF003CA9BA /* CommonAlertSheetView.swift */; }; + 130EC1822AD3F6C0003CA9BA /* CommonAlertSheetView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 130EC1812AD3F6C0003CA9BA /* CommonAlertSheetView.xib */; }; 131732B72A405DED00F722AF /* YardDetailDateTimeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 131732B62A405DED00F722AF /* YardDetailDateTimeVC.swift */; }; 131732BA2A405EF800F722AF /* CalendarDateTimeTCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 131732B82A405EF800F722AF /* CalendarDateTimeTCell.swift */; }; 131732BB2A405EF800F722AF /* CalendarDateTimeTCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 131732B92A405EF800F722AF /* CalendarDateTimeTCell.xib */; }; @@ -315,6 +317,8 @@ 130E402B2A4EC342003A3D75 /* SearchStoreDetailHeadView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SearchStoreDetailHeadView.xib; sourceTree = "<group>"; }; 130EC17B2AD3905F003CA9BA /* BindPhoneVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BindPhoneVC.swift; sourceTree = "<group>"; }; 130EC17C2AD3905F003CA9BA /* BindPhoneVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BindPhoneVC.xib; sourceTree = "<group>"; }; + 130EC17F2AD3F6AF003CA9BA /* CommonAlertSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommonAlertSheetView.swift; sourceTree = "<group>"; }; + 130EC1812AD3F6C0003CA9BA /* CommonAlertSheetView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CommonAlertSheetView.xib; sourceTree = "<group>"; }; 131732B62A405DED00F722AF /* YardDetailDateTimeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YardDetailDateTimeVC.swift; sourceTree = "<group>"; }; 131732B82A405EF800F722AF /* CalendarDateTimeTCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarDateTimeTCell.swift; sourceTree = "<group>"; }; 131732B92A405EF800F722AF /* CalendarDateTimeTCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CalendarDateTimeTCell.xib; sourceTree = "<group>"; }; @@ -927,6 +931,8 @@ 136E0EEA2AB30DDA00EDBB8F /* QRPreview.xib */, 1394023C2AB456D3003CF61E /* PaymentCourseView.swift */, 1394023E2AB456DB003CF61E /* PaymentCourseView.xib */, + 130EC17F2AD3F6AF003CA9BA /* CommonAlertSheetView.swift */, + 130EC1812AD3F6C0003CA9BA /* CommonAlertSheetView.xib */, ); path = View; sourceTree = "<group>"; @@ -1521,6 +1527,7 @@ 137B866B2AB3F03F00C4D01B /* GamesVC.xib in Resources */, 13CCC4BD2A4A820100DEDF19 /* StudentCourseDetailHeadView.xib in Resources */, 8D5C150D2A31885B00A8BCC9 /* AgreentView.xib in Resources */, + 130EC1822AD3F6C0003CA9BA /* CommonAlertSheetView.xib in Resources */, 1304B8562A4EAA81000D4F2E /* CustomerContentDetailVC.xib in Resources */, 137801A42A3C644200414959 /* CourseVideoDetailVC.xib in Resources */, 8D630BF92A31801300F0B7A8 /* SearchVC.xib in Resources */, @@ -1608,6 +1615,7 @@ 13AFABC42A4AE492001FEA16 /* StudentRemarkTCell.swift in Sources */, 13D7BA9B2A4BDF0A0007E4B7 /* WelfareCouponsTCell.swift in Sources */, 8D4905AD2A31AE7100E38513 /* JoinMemberIntroduceVC.swift in Sources */, + 130EC1802AD3F6AF003CA9BA /* CommonAlertSheetView.swift in Sources */, 13D7D6232A4EBBCF000136BD /* SearchStoreTCell.swift in Sources */, 8DC3BE112A3803B500C91B7F /* ActivityListVC.swift in Sources */, 1378018A2A3B08A600414959 /* CourseOnlineListVC.swift in Sources */, diff --git a/WanPai/Assets.xcassets/Icons/.DS_Store b/WanPai/Assets.xcassets/Icons/.DS_Store index 51f723b..5fb0615 100644 --- a/WanPai/Assets.xcassets/Icons/.DS_Store +++ b/WanPai/Assets.xcassets/Icons/.DS_Store Binary files differ diff --git a/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/Contents.json b/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/Contents.json index 560695d..a11403f 100644 --- a/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/Contents.json +++ b/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "icon_down_arrow@2x.png", + "filename" : "路径@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "icon_down_arrow@3x.png", + "filename" : "路径@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/icon_down_arrow@2x.png b/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/icon_down_arrow@2x.png deleted file mode 100644 index b4e5862..0000000 --- a/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/icon_down_arrow@2x.png +++ /dev/null Binary files differ diff --git a/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/icon_down_arrow@3x.png b/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/icon_down_arrow@3x.png deleted file mode 100644 index 96a3543..0000000 --- a/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/icon_down_arrow@3x.png +++ /dev/null Binary files differ diff --git "a/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/\350\267\257\345\276\204@2x.png" "b/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/\350\267\257\345\276\204@2x.png" new file mode 100644 index 0000000..e3fc237 --- /dev/null +++ "b/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/\350\267\257\345\276\204@2x.png" Binary files differ diff --git "a/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/\350\267\257\345\276\204@3x.png" "b/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/\350\267\257\345\276\204@3x.png" new file mode 100644 index 0000000..566d63e --- /dev/null +++ "b/WanPai/Assets.xcassets/Icons/icon_down_arrow.imageset/\350\267\257\345\276\204@3x.png" Binary files differ diff --git a/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/Contents.json b/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/Contents.json index 61c2bae..a11403f 100644 --- a/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/Contents.json +++ b/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "icon_down_arrow_s@2x.png", + "filename" : "路径@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "icon_down_arrow_s@3x.png", + "filename" : "路径@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/icon_down_arrow_s@2x.png b/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/icon_down_arrow_s@2x.png deleted file mode 100644 index 6eb6845..0000000 --- a/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/icon_down_arrow_s@2x.png +++ /dev/null Binary files differ diff --git a/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/icon_down_arrow_s@3x.png b/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/icon_down_arrow_s@3x.png deleted file mode 100644 index 736b60b..0000000 --- a/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/icon_down_arrow_s@3x.png +++ /dev/null Binary files differ diff --git "a/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/\350\267\257\345\276\204@2x.png" "b/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/\350\267\257\345\276\204@2x.png" new file mode 100644 index 0000000..9520fe5 --- /dev/null +++ "b/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/\350\267\257\345\276\204@2x.png" Binary files differ diff --git "a/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/\350\267\257\345\276\204@3x.png" "b/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/\350\267\257\345\276\204@3x.png" new file mode 100644 index 0000000..010efb5 --- /dev/null +++ "b/WanPai/Assets.xcassets/Icons/icon_down_arrow_s.imageset/\350\267\257\345\276\204@3x.png" Binary files differ diff --git a/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/Contents.json b/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/Contents.json index 1885130..89f7c69 100644 --- a/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/Contents.json +++ b/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "icon_sort_normal@2x.png", + "filename" : "shaixuan@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "icon_sort_normal@3x.png", + "filename" : "shaixuan@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/icon_sort_normal@2x.png b/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/icon_sort_normal@2x.png deleted file mode 100644 index c4a7d29..0000000 --- a/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/icon_sort_normal@2x.png +++ /dev/null Binary files differ diff --git a/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/icon_sort_normal@3x.png b/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/icon_sort_normal@3x.png deleted file mode 100644 index b007f45..0000000 --- a/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/icon_sort_normal@3x.png +++ /dev/null Binary files differ diff --git a/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/shaixuan@2x.png b/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/shaixuan@2x.png new file mode 100644 index 0000000..a658f87 --- /dev/null +++ b/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/shaixuan@2x.png Binary files differ diff --git a/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/shaixuan@3x.png b/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/shaixuan@3x.png new file mode 100644 index 0000000..d8535ac --- /dev/null +++ b/WanPai/Assets.xcassets/Icons/icon_sort_normal.imageset/shaixuan@3x.png Binary files differ diff --git a/WanPai/Common/VC/CommonWebVC.swift b/WanPai/Common/VC/CommonWebVC.swift index 69ba517..9e127ee 100644 --- a/WanPai/Common/VC/CommonWebVC.swift +++ b/WanPai/Common/VC/CommonWebVC.swift @@ -41,6 +41,7 @@ @IBAction func readAction(_ sender: UIButton) { UserDefaults.standard.set(object: true, forKey: type.titleStr) UserDefaults.standard.synchronize() + navigationController?.popViewController() } override var preferredStatusBarStyle: UIStatusBarStyle{ diff --git a/WanPai/Common/VC/CommonWebVC.xib b/WanPai/Common/VC/CommonWebVC.xib index d18eb2e..b4e192f 100644 --- a/WanPai/Common/VC/CommonWebVC.xib +++ b/WanPai/Common/VC/CommonWebVC.xib @@ -3,7 +3,7 @@ <device id="retina6_12" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22129"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/> <capability name="Named colors" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> @@ -25,14 +25,14 @@ <rect key="frame" x="0.0" y="59" width="393" height="759"/> <subviews> <wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mq2-Pw-XgV"> - <rect key="frame" x="0.0" y="0.0" width="393" height="711"/> + <rect key="frame" x="0.0" y="0.0" width="393" height="759"/> <wkWebViewConfiguration key="configuration"> <audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/> <wkPreferences key="preferences"/> </wkWebViewConfiguration> </wkWebView> - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1aa-Yc-u90"> - <rect key="frame" x="0.0" y="711" width="393" height="48"/> + <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1aa-Yc-u90"> + <rect key="frame" x="0.0" y="0.0" width="393" height="48"/> <color key="backgroundColor" name="FE6E0D"/> <constraints> <constraint firstAttribute="height" constant="48" id="q68-5p-h44"/> diff --git a/WanPai/Common/View/CommonAlertSheetView.swift b/WanPai/Common/View/CommonAlertSheetView.swift new file mode 100644 index 0000000..ae553a7 --- /dev/null +++ b/WanPai/Common/View/CommonAlertSheetView.swift @@ -0,0 +1,125 @@ + // + // CommonAlertSheetView.swift + // WanPai + // + // Created by 无故事王国 on 2023/10/9. + // + +import UIKit +import JQTools + +class CommonAlertSheetView: UIView,JQNibView { + + @IBOutlet weak var view_container: UIView! + @IBOutlet weak var tableView: UITableView! + @IBOutlet weak var cons_tableHei: NSLayoutConstraint! + @IBOutlet weak var cons_viewBottom: NSLayoutConstraint! + + private var items = [String]() + private var clouse:((Int)->Void)! + + override func awakeFromNib() { + super.awakeFromNib() + alpha = 0 + cons_viewBottom.constant = -JQ_ScreenW + layoutIfNeeded() + tableView.delegate = self + tableView.dataSource = self + tableView.separatorStyle = .none + tableView.register(CommonAlertSheetTCell.self, forCellReuseIdentifier: "TCell") + } + + static func show(items:[String],clouse:@escaping (Int)->Void){ + let alertView = CommonAlertSheetView.jq_loadNibView() + alertView.frame = sceneDelegate?.window?.frame ?? .zero + alertView.cons_tableHei.constant = CGFloat(items.count * 50) + sceneDelegate?.window?.addSubview(alertView) + alertView.cons_viewBottom.constant = 0 + alertView.items = items + alertView.clouse = clouse + + UIView.animate(withDuration: 0.4) { + alertView.layoutIfNeeded() + alertView.alpha = 1 + } completion: { _ in + + } + } + + override func layoutSubviews() { + super.layoutSubviews() + let totalH = Double(items.count * 50) + UIDevice.jq_safeEdges.bottom + 50 + view_container.jq_addCorners(corner: [.topLeft,.topRight], radius: 20,height: totalH) + } + + private func hidden(){ + self.cons_viewBottom.constant = -JQ_ScreenW + UIView.animate(withDuration: 0.4) { + self.alpha = 0 + self.layoutIfNeeded() + } completion: { _ in + self.removeFromSuperview() + } + } + + @IBAction func hiddenAction(_ sender: UIButton) { + hidden() + } +} + +extension CommonAlertSheetView:UITableViewDelegate{ + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + clouse(indexPath.row) + hidden() + } +} + +extension CommonAlertSheetView:UITableViewDataSource{ + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return items.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "TCell") as! CommonAlertSheetTCell + cell.label_content.text = items[indexPath.row] + return cell + } + + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 50 + } +} + +fileprivate class CommonAlertSheetTCell:UITableViewCell{ + + var label_content:UILabel! + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + + selectionStyle = .none + label_content = UILabel() + label_content.text = "123" + label_content.font = UIFont.systemFont(ofSize: 16, weight: .medium) + label_content.textColor = .black.withAlphaComponent(0.8) + + contentView.addSubview(label_content) + label_content.snp.makeConstraints { make in + make.center.equalToSuperview() + } + + let lineView = UIView() + lineView.backgroundColor = UIColor(hexStr: "#DBDBE7") + contentView.addSubview(lineView) + lineView.snp.makeConstraints { make in + make.left.equalTo(15) + make.right.equalTo(-15) + make.height.equalTo(0.5) + make.bottom.equalToSuperview() + } + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/WanPai/Common/View/CommonAlertSheetView.xib b/WanPai/Common/View/CommonAlertSheetView.xib new file mode 100644 index 0000000..da07b0c --- /dev/null +++ b/WanPai/Common/View/CommonAlertSheetView.xib @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> + <device id="retina6_12" orientation="portrait" appearance="light"/> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/> + <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="System colors in document resources" minToolsVersion="11.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <objects> + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> + <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="CommonAlertSheetView" customModule="WanPai" customModuleProvider="target"> + <rect key="frame" x="0.0" y="0.0" width="393" height="852"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZCi-js-xyb"> + <rect key="frame" x="0.0" y="678" width="393" height="174"/> + <subviews> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5zv-r1-Tbh"> + <rect key="frame" x="0.0" y="100" width="393" height="32"/> + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> + <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> + <state key="normal" title="取消"> + <color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="0.40000000000000002" colorSpace="custom" customColorSpace="sRGB"/> + </state> + <connections> + <action selector="hiddenAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="ngJ-yG-9b2"/> + </connections> + </button> + <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="G6i-xu-rUK"> + <rect key="frame" x="0.0" y="0.0" width="393" height="100"/> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstAttribute="height" constant="100" id="g8g-XN-qDa"/> + </constraints> + </tableView> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstItem="5zv-r1-Tbh" firstAttribute="top" secondItem="G6i-xu-rUK" secondAttribute="bottom" id="9nv-QU-lZP"/> + <constraint firstItem="G6i-xu-rUK" firstAttribute="leading" secondItem="ZCi-js-xyb" secondAttribute="leading" id="CDM-qJ-EpR"/> + <constraint firstAttribute="trailing" secondItem="G6i-xu-rUK" secondAttribute="trailing" id="CXj-DB-txN"/> + <constraint firstItem="5zv-r1-Tbh" firstAttribute="leading" secondItem="ZCi-js-xyb" secondAttribute="leading" id="GTh-3u-KPb"/> + <constraint firstAttribute="trailing" secondItem="5zv-r1-Tbh" secondAttribute="trailing" id="sac-WK-U2U"/> + <constraint firstAttribute="bottomMargin" secondItem="5zv-r1-Tbh" secondAttribute="bottom" id="t8S-hN-Jjh"/> + <constraint firstItem="G6i-xu-rUK" firstAttribute="top" secondItem="ZCi-js-xyb" secondAttribute="top" id="u2B-VM-PMP"/> + </constraints> + </view> + </subviews> + <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/> + <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.69999999999999996" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <constraint firstAttribute="bottom" secondItem="ZCi-js-xyb" secondAttribute="bottom" id="0uK-bT-T9v"/> + <constraint firstItem="ZCi-js-xyb" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="b8O-bZ-2o6"/> + <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="ZCi-js-xyb" secondAttribute="trailing" id="nT1-me-SnE"/> + </constraints> + <connections> + <outlet property="cons_tableHei" destination="g8g-XN-qDa" id="dhx-xA-6hC"/> + <outlet property="cons_viewBottom" destination="0uK-bT-T9v" id="Dcm-l0-a8b"/> + <outlet property="tableView" destination="G6i-xu-rUK" id="afR-iG-9IN"/> + <outlet property="view_container" destination="ZCi-js-xyb" id="Mk8-7J-xes"/> + </connections> + <point key="canvasLocation" x="139.69465648854961" y="20.422535211267608"/> + </view> + </objects> + <resources> + <systemColor name="systemBackgroundColor"> + <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + </systemColor> + </resources> +</document> diff --git a/WanPai/Common/View/CommonAlertView.swift b/WanPai/Common/View/CommonAlertView.swift index fb0bcef..62efd30 100644 --- a/WanPai/Common/View/CommonAlertView.swift +++ b/WanPai/Common/View/CommonAlertView.swift @@ -13,7 +13,9 @@ @IBOutlet weak var view_container: UIView! @IBOutlet weak var label_title: UILabel! @IBOutlet weak var label_content: UILabel! - + @IBOutlet weak var btn_cancel: UIButton! + @IBOutlet weak var btn_complete: UIButton! + private var title:String! private var content:String! private var clouse:((Bool)->Void)! @@ -26,10 +28,11 @@ } - static func show(title:String,content:String, clouse:@escaping (Bool)->Void){ + static func show(title:String,content:String,isSingle:Bool = false, clouse:@escaping (Bool)->Void){ let alertView = CommonAlertView.jq_loadNibView() alertView.label_title.text = title alertView.label_content.text = content + alertView.btn_cancel.isHidden = isSingle alertView.clouse = clouse alertView.frame = sceneDelegate?.window?.frame ?? .zero sceneDelegate?.window?.addSubview(alertView) @@ -39,9 +42,10 @@ } } - static func show(title:String,attribute:NSMutableAttributedString, clouse:@escaping (Bool)->Void){ + static func show(title:String,attribute:NSMutableAttributedString,isSingle:Bool = false, clouse:@escaping (Bool)->Void){ let alertView = CommonAlertView.jq_loadNibView() alertView.label_title.text = title + alertView.btn_cancel.isHidden = isSingle alertView.label_content.attributedText = attribute alertView.clouse = clouse alertView.frame = sceneDelegate?.window?.frame ?? .zero @@ -52,6 +56,11 @@ } } + override func layoutSubviews() { + super.layoutSubviews() + btn_complete.localGradientColor(cornerRadius: 20) + } + @IBAction func closeAction(_ sender: UIButton) { UIView.animate(withDuration: 0.4) { diff --git a/WanPai/Common/View/CommonAlertView.xib b/WanPai/Common/View/CommonAlertView.xib index d46006a..97d9bee 100644 --- a/WanPai/Common/View/CommonAlertView.xib +++ b/WanPai/Common/View/CommonAlertView.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_12" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/> <capability name="Named colors" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> @@ -109,6 +109,8 @@ <constraint firstItem="MnH-T0-9ye" firstAttribute="centerX" secondItem="vUN-kp-3ea" secondAttribute="centerX" id="yAL-tj-KsX"/> </constraints> <connections> + <outlet property="btn_cancel" destination="x3p-KY-6M2" id="w1r-K8-3Ep"/> + <outlet property="btn_complete" destination="LFA-NB-5g9" id="ac1-Fq-hJo"/> <outlet property="label_content" destination="raL-bN-qOz" id="Q9R-w7-I7r"/> <outlet property="label_title" destination="8x2-bB-pNn" id="HQr-lE-rhB"/> <outlet property="view_container" destination="MnH-T0-9ye" id="6dr-Ul-VK3"/> diff --git a/WanPai/Config/Def.swift b/WanPai/Config/Def.swift index dd9ab18..45e9f3a 100644 --- a/WanPai/Config/Def.swift +++ b/WanPai/Config/Def.swift @@ -88,6 +88,159 @@ extension UIButton { func localGradientColor(cornerRadius:Double,bounds:CGRect? = nil){ self.layer.sublayers?.removeAll(where: {$0 is CAGradientLayer}) - self.jq_gradientColor(colorArr: [UIColor(hexStr: "#FD8802").cgColor,UIColor(hexStr: "#FD8802").cgColor], cornerRadius: cornerRadius, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1), bounds: bounds) + self.jq_gradientColor(colorArr: [UIColor(hexStr: "#FD8802").cgColor,UIColor(hexStr: "#FE7703").cgColor], cornerRadius: cornerRadius, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1), bounds: bounds) + } + + public func openCountDown(_ t:Int = 59,defultTitle:String = "获取验证码"){ + var time = t //倒计时时间 + let queue = DispatchQueue.global() + let timer = DispatchSource.makeTimerSource(flags: [], queue: queue) + timer.schedule(wallDeadline: DispatchWallTime.now(), repeating: .seconds(1)); + timer.setEventHandler(handler: { + if time <= 0 { + timer.cancel() + DispatchQueue.main.async(execute: { + self.setTitle(defultTitle, for: .normal) + self.setTitleColor(UIColor(hexStr: "#63BDDB"), for: .normal) + self.isUserInteractionEnabled = true + }); + }else { + DispatchQueue.main.async(execute: { + self.setTitle("\(time)s", for: .normal) + self.setTitleColor(UIColor.gray, for: .normal) + self.isUserInteractionEnabled = false + }); + } + time -= 1 + }); + timer.resume() + } +} + +func jumpPage(name:String,page:String = "",type:String = "",id:Int? = nil){ + + var storeModel:NormalSimpleModel? + if let storeStr = UserDefaults.standard.object(forKey: "CurrentStore") as? String{ + if let deserModel = HomeStoreModel.deserialize(from: storeStr){ + storeModel = NormalSimpleModel(id: deserModel.storeId, name: deserModel.name) + } + } + + switch name { + case "加入玩湃": + if page == "主页"{ + + } + if page == "课程列表"{ + if type == "详情"{ + JQ_currentViewController().jq_push(vc: CourseDetailVC(id:id ?? 0)) + }else{ + JQ_currentViewController().jq_push(vc: CourseListVC(selectStore: storeModel)) + } + } + + if page == "赛事活动列表"{ + if type == "详情"{ + JQ_currentViewController().jq_push(vc: ActivityDetailVC(id: id ?? 0)) + }else{ + JQ_currentViewController().jq_push(vc: ActivityListVC()) + } + } + + if page == "线上课得积分"{ + if type == "详情"{ + + }else{ + let vc = CourseOnlineListVC(position: 1) + vc.title = page + JQ_currentViewController().jq_push(vc: vc) + } + } + + if page == "看视频得奖励"{ + if type == "详情"{ + let vc = CourseVideoDetailVC(id: id ?? 0) + vc.title = page + }else{ + let vc = CourseOnlineListVC(position: 2) + vc.title = page + JQ_currentViewController().jq_push(vc: vc) + } + } + + if page == "预约场地"{ + if type == "详情"{ + JQ_currentViewController().jq_push(vc: YardDetailVC(id: id ?? 0)) + }else{ + JQ_currentViewController().jq_push(vc: YardListVC(selectStore: storeModel)) + } + } + + if page == "智慧球场"{ + JQ_currentViewController().jq_push(vc: GamesVC()) + } + + if page == "成为会员"{ + JQ_currentViewController().jq_push(vc: JoinMemberIntroduceVC()) + } + + case "开始课程": + if page == "主页"{ + + } + + case "使用福利": + if page == "主页"{ + + } + + if page == "充值中心"{ + JQ_currentViewController().jq_push(vc: RechargeCenterVC()) + } + + if page == "积分商城"{ + if type == "主页"{ + JQ_currentViewController().jq_push(vc: CoinStoreCenterVC()) + } + if type == "指定商品"{ + JQ_currentViewController().jq_push(vc: WelfareRedeemGoodsDetailVC(commodityId: id ?? 0, goodsType: .goods)) + } + } + + if page == "本周福利"{ + if type == "限时折扣"{ + JQ_currentViewController().jq_push(vc: WelfareWeeklyListVC(page: 0)) + } + if type == "赠送课时"{ + JQ_currentViewController().jq_push(vc: WelfareWeeklyListVC(page: 1)) + } + if type == "指定折扣"{ + JQ_currentViewController().jq_push(vc: WelfareWeeklyDetailVC(id: id ?? 0)) + } + } + + case "探索玩湃": + if page == "门店列表"{ + + } + + if page == "常见问题"{ + if type == "列表"{ + JQ_currentViewController().jq_push(vc: CustomerListVC(page: 1)) + } + if type == "详情"{ + JQ_currentViewController().jq_push(vc: CustomerContentDetailVC(id: id ?? 0, type: .QA)) + } + } + + if page == "公告发布"{ + if type == "列表"{ + JQ_currentViewController().jq_push(vc: CustomerListVC(page: 0)) + } + if type == "详情"{ + JQ_currentViewController().jq_push(vc: CustomerContentDetailVC(id: id ?? 0, type: .notice)) + } + } + default:break } } diff --git a/WanPai/Config/Enums.swift b/WanPai/Config/Enums.swift index 9d3755b..f16120c 100644 --- a/WanPai/Config/Enums.swift +++ b/WanPai/Config/Enums.swift @@ -138,6 +138,8 @@ } } + + enum SortType:String{ case asc = "asc" case desc = "desc" diff --git a/WanPai/Model/CommonModels.swift b/WanPai/Model/CommonModels.swift index e76c9c4..b311777 100644 --- a/WanPai/Model/CommonModels.swift +++ b/WanPai/Model/CommonModels.swift @@ -68,6 +68,7 @@ var weeks = [String]() var type:CourseType = .normal var time = "" + var isVip = 0 //是否是会员:1:是 0:否 } struct CourseDetailListModel:HandyJSON { @@ -77,7 +78,7 @@ var paymentPrice:Double = 0 var payType: PaymentType = .cash var playPaiCoin:Int? - var vipPrice:Double? + var vipPrice:Double = 0 } struct CourseDetailStudentModel:HandyJSON { @@ -272,6 +273,7 @@ var wanpaiGold:Int = 0 var weekTime: String = "" var vipPrice:Double = 0 + var detailDrawing = "" } struct SiteItemModel:HandyJSON{ @@ -405,6 +407,11 @@ var noticeId = 0 var noticeTitle = "" var noticeTime = "" + + var quesId = 0 + var quesTitle = "" + var quesContents = "" + var quesTime = "" } struct SearchStoreDetailModel:HandyJSON{ diff --git a/WanPai/Network/NetworkRequest.swift b/WanPai/Network/NetworkRequest.swift index 54a4a81..695c576 100644 --- a/WanPai/Network/NetworkRequest.swift +++ b/WanPai/Network/NetworkRequest.swift @@ -231,6 +231,11 @@ LogInfo("返回数据:\(jsonString)") switch next.code{ case 200:ob.onNext(next) + case 501: + CommonAlertView.show(title: "提示", content: next.msg,isSingle: true) { _ in + + } + ob.onError(NetRequestError.InvaildSession) case 600:alertError(msg: "登录失效,请重新登录");ob.onError(NetRequestError.InvaildSession) app.needLogin() default:alertError(msg: "\(next.msg)");ob.onError(NetRequestError.Other(next.msg)) diff --git a/WanPai/Network/Services.swift b/WanPai/Network/Services.swift index 78943ec..13568cc 100644 --- a/WanPai/Network/Services.swift +++ b/WanPai/Network/Services.swift @@ -201,7 +201,7 @@ return NetworkRequest.request(params: params, method: .post, progress: false) } - class func homeStoreConfig2(storeId:Int)->Observable<BaseResponse<[HomeStoreConfigModel]>>{ + class func homeStoreConfig2(storeId:Int)->Observable<BaseResponse<[HomeStoreTopBannerModel]>>{ let params = ParamsAppender.build(url: All_Url) .interface(url: "/other/base/store/queryIndexSet") .append(key: "id", value: storeId) diff --git a/WanPai/Root/Activity/VC/ActivityListVC.swift b/WanPai/Root/Activity/VC/ActivityListVC.swift index 43dcdb0..0ced0a7 100644 --- a/WanPai/Root/Activity/VC/ActivityListVC.swift +++ b/WanPai/Root/Activity/VC/ActivityListVC.swift @@ -72,6 +72,7 @@ } @IBAction func holdCityAction(_ sender: QMUIButton) { + view.endEditing(true) guard !sender.isSelected else {return} hiddenMenu() sender.isSelected = true @@ -86,6 +87,7 @@ } @IBAction func signupConditionAction(_ sender: QMUIButton) { + view.endEditing(true) guard !sender.isSelected else {return} hiddenMenu() sender.isSelected = true @@ -105,6 +107,7 @@ } @IBAction func hotFliterAction(_ sender: UIButton) { + view.endEditing(true) sender.isSelected = !sender.isSelected let sortType = sender.isSelected ? SortType.desc:SortType.asc sender.setImage(sortType.img, for: .normal) @@ -113,6 +116,7 @@ } @IBAction func signupAction(_ sender: UIButton) { + view.endEditing(true) let vc = ActivitySignupListVC() push(vc: vc) } diff --git a/WanPai/Root/Course/TCell/CourseTCell.swift b/WanPai/Root/Course/TCell/CourseTCell.swift index 01c558f..d821d24 100644 --- a/WanPai/Root/Course/TCell/CourseTCell.swift +++ b/WanPai/Root/Course/TCell/CourseTCell.swift @@ -25,19 +25,13 @@ didSet{ label_originPrice.isHidden = courseItemModel.originalPrice == nil label_vipPrice.text = "会员价:\(courseItemModel.vipPrice.currency())" - + stackView_vipPrice.isHidden = courseItemModel.vipPrice == 0 img_cover.sd_setImage(with: URL(string: courseItemModel.coverDrawing),placeholderImage: UIImage(named: "placeholder_1")) label_title.text = String(format: "%@(%@)", courseItemModel.name,courseItemModel.storeName) label_teachTime.text = String(format: "上课时间:%@", courseItemModel.classStartTime.jq_max(size: 2).joined(separator: "|")) label_enrollNumber.text = String(format: "已报名:%ld人", courseItemModel.applicantsNumber) label_distance.text = String(format: "%.2lfkm", courseItemModel.distance) stack_teachTime.isHidden = courseItemModel.classStartTime.count == 0 - -// if courseItemModel.payType == .cash{ -// label_price.text = courseItemModel.paymentPrice.currency() -// }else if courseItemModel.payType == .coin{ -// label_price.text = "玩湃币 " + "\(courseItemModel.playPaiCoin)" -// } if courseItemModel.paymentPrice != 0{ label_price.text = courseItemModel.paymentPrice.currency() diff --git a/WanPai/Root/Course/VC/CourseDetailApplyVC.swift b/WanPai/Root/Course/VC/CourseDetailApplyVC.swift index 20c5ed7..7127fe4 100644 --- a/WanPai/Root/Course/VC/CourseDetailApplyVC.swift +++ b/WanPai/Root/Course/VC/CourseDetailApplyVC.swift @@ -57,7 +57,7 @@ if let m = detailModel{ img_cover.sd_setImage(with: URL(string: m.coverDrawing)) label_title.text = m.name - label_listenWeek.text = m.weeks.joined(separator: "、") + label_listenWeek.text = "每" + m.weeks.joined(separator: "、") label_listenTime.text = m.times.joined(separator: "|") label_store.text = m.storeName label_address.text = m.storeAddress @@ -158,8 +158,21 @@ guard let weakSelf = self else { return } if status{ if let model = weakSelf.detailModel?.list[weakSelf.selectClassIndex]{ - let price = (model.vipPrice == nil ? (model.originalPrice ?? 0) : model.vipPrice!) * Double(weakSelf.studentModels.count) + + var price:Double = 0 + //是否是会员 + if weakSelf.detailModel?.isVip == 1 && model.vipPrice != 0{ + price = model.vipPrice + }else{ + price = model.paymentPrice + } + + //计算人数总价 + price = price * 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 @@ -224,10 +237,11 @@ studentCount = Double(studentModels.count) } + label_price.isHidden = subM.paymentPrice == 0 label_price.text = (subM.paymentPrice * studentCount - (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 + label_vipPrice.isHidden = subM.vipPrice == 0 //原价 if let originPrice = subM.originalPrice{ @@ -244,10 +258,10 @@ } //会员价 - if let vipPrice = subM.vipPrice{ + if subM.vipPrice != 0{ let vipAttribute = AttributedStringbuilder.build() .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) - .add(string: (vipPrice * studentCount).currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) + .add(string: (subM.vipPrice * studentCount).currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) label_vipPrice.attributedText = vipAttribute.mutableAttributedString } @@ -286,7 +300,8 @@ override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() - label_courseType.jq_addCorners(corner: [.topLeft,.bottomLeft], radius: 4, width: 58, height: 25) + let w = String.jq_getWidth(text: detailModel?.type.strTitle ?? "", height: 25, font: 14) + 16 + label_courseType.jq_addCorners(corner: [.topLeft,.bottomLeft], radius: 4, width: w, height: 25) } } diff --git a/WanPai/Root/Course/VC/CourseDetailApplyVC.xib b/WanPai/Root/Course/VC/CourseDetailApplyVC.xib index 09b328d..88c2397 100644 --- a/WanPai/Root/Course/VC/CourseDetailApplyVC.xib +++ b/WanPai/Root/Course/VC/CourseDetailApplyVC.xib @@ -123,8 +123,9 @@ </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="wrX-zM-oQd"> - <rect key="frame" x="14" y="14" width="71.666666666666671" height="20"/> + <rect key="frame" x="14" y="14" width="72" height="20"/> <constraints> + <constraint firstAttribute="width" constant="72" id="Egf-DI-p8P"/> <constraint firstAttribute="height" constant="20" id="dbh-fs-MIm"/> </constraints> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/> @@ -132,7 +133,7 @@ <nil key="highlightedColor"/> </label> <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="z0j-zm-BuW"> - <rect key="frame" x="90.666666666666671" y="14" width="128.66666666666663" height="20"/> + <rect key="frame" x="90.999999999999986" y="14" width="128.66666666666663" height="20"/> <constraints> <constraint firstAttribute="height" constant="20" id="GlH-i5-93x"/> </constraints> @@ -140,8 +141,8 @@ <nil key="textColor"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00 - 24:00" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gAj-GU-kf7"> - <rect key="frame" x="90.666666666666657" y="42" width="93.666666666666657" height="17"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00 - 24:00" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gAj-GU-kf7"> + <rect key="frame" x="91" y="42" width="292" height="17"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/> <color key="textColor" name="FE6E0D"/> <nil key="highlightedColor"/> @@ -151,6 +152,7 @@ <constraints> <constraint firstItem="wrX-zM-oQd" firstAttribute="leading" secondItem="0ER-xO-h01" secondAttribute="leading" constant="14" id="Ed0-LT-ZHy"/> <constraint firstItem="gAj-GU-kf7" firstAttribute="top" secondItem="z0j-zm-BuW" secondAttribute="bottom" constant="8" id="Rbr-2f-FSN"/> + <constraint firstAttribute="trailing" secondItem="gAj-GU-kf7" secondAttribute="trailing" constant="10" id="Syf-RF-tNj"/> <constraint firstItem="wrX-zM-oQd" firstAttribute="top" secondItem="0ER-xO-h01" secondAttribute="top" constant="14" id="Vvu-lU-g8E"/> <constraint firstItem="zYh-CH-Ib2" firstAttribute="top" secondItem="gAj-GU-kf7" secondAttribute="bottom" constant="14" id="dOR-sZ-QFt"/> <constraint firstAttribute="trailing" secondItem="zYh-CH-Ib2" secondAttribute="trailing" id="e9R-ZM-Gff"/> diff --git a/WanPai/Root/Course/VC/CourseDetailVC.swift b/WanPai/Root/Course/VC/CourseDetailVC.swift index 2a03f03..a01277c 100644 --- a/WanPai/Root/Course/VC/CourseDetailVC.swift +++ b/WanPai/Root/Course/VC/CourseDetailVC.swift @@ -33,6 +33,7 @@ @IBOutlet weak var label_coin: UILabel! @IBOutlet weak var cons_handleHei: NSLayoutConstraint! @IBOutlet weak var btn_enroll: UIButton! + @IBOutlet weak var view_tag: UIView! private var id = 0 @@ -44,13 +45,14 @@ img_cover.sd_setImage(with: URL(string: m.coverDrawing)) label_title.text = m.name label_distance.text = String(format: "距离我%.2lfkm", m.distance) - label_local.text = m.storeAddress - label_listenWeek.text = m.weeks.joined(separator: "、") + label_local.text = String(format: "%@(%@)", m.storeName,m.storeAddress) + label_listenWeek.text = "每" + m.weeks.joined(separator: "、") label_listenTime.text = m.times.joined(separator: "|") label_vaildTime.text = m.time label_courseType.text = m.type.strTitle label_courseType.isHidden = m.type == .none view_vaildTime.isHidden = m.type == .normal + label_price.isHidden = (m.list.first?.paymentPrice ?? 0) == 0 let w = String.jq_getWidth(text: m.type.strTitle, height: 25, font: 14) label_courseType.jq_cornerPartWithNib(byRoundingCorners: [.topLeft,.bottomLeft], radii: 8, size: CGSize(width: w, height: 25)) @@ -89,10 +91,10 @@ } //会员价 - if let vipPrice = subM.vipPrice{ + if subM.vipPrice != 0{ let vipAttribute = AttributedStringbuilder.build() .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) - .add(string: vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) + .add(string: subM.vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) label_vipPrice.attributedText = vipAttribute.mutableAttributedString } } @@ -103,6 +105,7 @@ label_vipPrice.isHidden = true label_vaildTime.text = "购买当天有效" view_listen.isHidden = true + label_price.isHidden = (m.list.first?.paymentPrice ?? 0) == 0 } //体验课,假期课不展示 @@ -111,17 +114,17 @@ cons_handleHei.constant = 0 } - if let m = signUpCourseModel{ - label_originPrice.isHidden = true -// label_vipPrice.isHidden = true - - let coinAttribute = AttributedStringbuilder.build() - .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) - .add(string: "\(m.wpGold)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) - label_coin.attributedText = coinAttribute.mutableAttributedString - label_price.text = m.paymentPrice.currency() - label_coin.alpha = m.wpGold == 0 ? 0:1 - } +// if let m = signUpCourseModel{ +// label_originPrice.isHidden = true +//// label_vipPrice.isHidden = true +// +// let coinAttribute = AttributedStringbuilder.build() +// .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) +// .add(string: "\(m.wpGold)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) +// label_coin.attributedText = coinAttribute.mutableAttributedString +// label_price.text = m.paymentPrice.currency() +// label_coin.alpha = m.wpGold == 0 ? 0:1 +// } } } } @@ -159,6 +162,8 @@ override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() + let w = String.jq_getWidth(text: detailModel?.type.strTitle ?? "", height: 25, font: 14) + 16 + view_tag.jq_addCorners(corner: [.topLeft,.bottomLeft], radius: 4, width: w, height: 25) } @IBAction func applyAction(_ sender: UIButton) { diff --git a/WanPai/Root/Course/VC/CourseDetailVC.xib b/WanPai/Root/Course/VC/CourseDetailVC.xib index ec366a6..f4aa8bc 100644 --- a/WanPai/Root/Course/VC/CourseDetailVC.xib +++ b/WanPai/Root/Course/VC/CourseDetailVC.xib @@ -33,6 +33,7 @@ <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view_handle" destination="wnC-bp-nci" id="udT-Ld-nz5"/> <outlet property="view_listen" destination="C7D-PZ-6fb" id="FjT-rY-bBt"/> + <outlet property="view_tag" destination="oog-Pm-lN5" id="aRC-N1-zxe"/> <outlet property="view_vaildTime" destination="sLV-d8-3f1" id="Xd7-mZ-oTl"/> </connections> </placeholder> @@ -163,16 +164,17 @@ </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="bD5-fy-zxF"> - <rect key="frame" x="14" y="14" width="71.666666666666671" height="20"/> + <rect key="frame" x="14" y="14" width="72" height="20"/> <constraints> <constraint firstAttribute="height" constant="20" id="FhX-6e-8yX"/> + <constraint firstAttribute="width" constant="72" id="SOF-ct-32M"/> </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="--" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="utV-MS-Xge"> - <rect key="frame" x="90.666666666666671" y="14" width="13" height="20"/> + <rect key="frame" x="91" y="14" width="13" height="20"/> <constraints> <constraint firstAttribute="height" constant="20" id="Tt8-AL-kD0"/> </constraints> @@ -180,8 +182,8 @@ <nil key="textColor"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="--" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6RN-lP-9js"> - <rect key="frame" x="90.666666666666671" y="42" width="13.333333333333329" height="17"/> + <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="6RN-lP-9js"> + <rect key="frame" x="91" y="42" width="292" height="17"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/> <color key="textColor" name="FE6E0D"/> <nil key="highlightedColor"/> @@ -192,6 +194,7 @@ <constraint firstItem="bD5-fy-zxF" firstAttribute="top" secondItem="C7D-PZ-6fb" secondAttribute="top" constant="14" id="Bli-OY-Oti"/> <constraint firstItem="Adp-3Y-2eN" firstAttribute="top" secondItem="6RN-lP-9js" secondAttribute="bottom" constant="14" id="GhN-yd-uT2"/> <constraint firstItem="6RN-lP-9js" firstAttribute="top" secondItem="utV-MS-Xge" secondAttribute="bottom" constant="8" id="P0o-QT-xw5"/> + <constraint firstAttribute="trailing" secondItem="6RN-lP-9js" secondAttribute="trailing" constant="10" id="VnR-Jx-wHJ"/> <constraint firstAttribute="bottom" secondItem="Adp-3Y-2eN" secondAttribute="bottom" id="eKU-vt-N8t"/> <constraint firstItem="bD5-fy-zxF" firstAttribute="leading" secondItem="C7D-PZ-6fb" secondAttribute="leading" constant="14" id="f9Q-V0-FMj"/> <constraint firstItem="6RN-lP-9js" firstAttribute="leading" secondItem="utV-MS-Xge" secondAttribute="leading" id="fnO-FO-e7w"/> diff --git a/WanPai/Root/Course/VC/CourseListVC.swift b/WanPai/Root/Course/VC/CourseListVC.swift index 8952824..2f01f81 100644 --- a/WanPai/Root/Course/VC/CourseListVC.swift +++ b/WanPai/Root/Course/VC/CourseListVC.swift @@ -59,7 +59,14 @@ private var viewModel = CourseListViewModel() private var showSubTypeView:CourseSubTypeView? - + + init(selectStore:NormalSimpleModel? = nil) { + super.init(nibName: nil, bundle: nil) + if selectStore != nil{ + viewModel.selectStore.accept(selectStore) + } + } + override func viewDidLoad() { super.viewDidLoad() title = "课程列表" @@ -77,7 +84,7 @@ btn_stores.spacingBetweenImageAndTitle = 5 btn_sales.spacingBetweenImageAndTitle = 5 btn_distance.spacingBetweenImageAndTitle = 5 - + tableView.delegate = self tableView.dataSource = self tableView.register(UINib(nibName: "CourseTCell", bundle: nil), forCellReuseIdentifier: "_CourseTCell") @@ -85,6 +92,7 @@ tf_search.delegate = self viewModel.configure(tableView,needMore: false) tableView.jq_setEmptyView() + btn_stores.setTitle(viewModel.selectStore.value?.name ?? "所在门店", for: .normal) } override func setRx() { @@ -106,6 +114,7 @@ } @IBAction func searchAction(_ sender: UIButton) { + view.endEditing(true) guard !tf_search.isEmpty else { alert(msg: "请输入搜索内容");return } @@ -114,12 +123,14 @@ @IBAction func enrolledAction(_ sender: UIButton) { + view.endEditing(true) let vc = SignUpCourseVC() push(vc: vc) } @IBAction func crouseTypeAction(_ sender: UIButton) { + view.endEditing(true) guard viewModel.packageTypeData.value != nil else { alertError(msg: "分类数据加载失败,请再试一次") viewModel.getDefaultData() @@ -145,6 +156,7 @@ } @IBAction func inStoresAction(_ sender: UIButton) { + view.endEditing(true) guard viewModel.storesData.value != nil else { alertError(msg: "分类数据加载失败,请再试一次") viewModel.getDefaultData() @@ -170,6 +182,7 @@ } @IBAction func saleAction(_ sender: UIButton) { + view.endEditing(true) sender.isSelected = !sender.isSelected let sortType = sender.isSelected ? SortType.desc:SortType.asc viewModel.salesRanking.accept(sortType) @@ -178,13 +191,18 @@ } @IBAction func distanceAction(_ sender: UIButton) { + view.endEditing(true) sender.isSelected = !sender.isSelected let sortType = sender.isSelected ? SortType.desc:SortType.asc viewModel.distanceSort.accept(sortType) sender.setImage(viewModel.distanceSort.value?.img, for: .normal) viewModel.beginRefresh() } - + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + } extension CourseListVC:UITableViewDelegate{ diff --git a/WanPai/Root/Course/VC/CourseListVC.xib b/WanPai/Root/Course/VC/CourseListVC.xib index 2eb9633..825ac6e 100644 --- a/WanPai/Root/Course/VC/CourseListVC.xib +++ b/WanPai/Root/Course/VC/CourseListVC.xib @@ -3,9 +3,10 @@ <device id="retina6_12" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22129"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/> <capability name="Named colors" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="Stack View standard spacing" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -74,11 +75,14 @@ <action selector="searchAction:" destination="-1" eventType="touchUpInside" id="LSD-oz-s7c"/> </connections> </button> - <stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" translatesAutoresizingMaskIntoConstraints="NO" id="Ibv-Ci-ENK"> + <stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="Ibv-Ci-ENK"> <rect key="frame" x="14" y="53" width="365" height="52"/> <subviews> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="t2I-Ui-tOU" customClass="QMUIButton"> - <rect key="frame" x="0.0" y="0.0" width="86" height="52"/> + <rect key="frame" x="0.0" y="0.0" width="79" height="52"/> + <constraints> + <constraint firstAttribute="width" relation="lessThanOrEqual" constant="100" id="mVd-f6-PFw"/> + </constraints> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="课程类型" image="icon_down_arrow"> @@ -92,7 +96,10 @@ </connections> </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nAn-MT-4zR" customClass="QMUIButton"> - <rect key="frame" x="110.33333333333331" y="0.0" width="86" height="52"/> + <rect key="frame" x="120" y="0.0" width="79" height="52"/> + <constraints> + <constraint firstAttribute="width" relation="lessThanOrEqual" constant="100" id="hHc-sk-rO6"/> + </constraints> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="所在门店" image="icon_down_arrow"> @@ -106,7 +113,7 @@ </connections> </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NcC-Kc-Iu6" customClass="QMUIButton"> - <rect key="frame" x="220.66666666666666" y="0.0" width="59.999999999999972" height="52"/> + <rect key="frame" x="240" y="0.0" width="42" height="52"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="销量" image="icon_sort_normal"> @@ -118,7 +125,7 @@ </connections> </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wS1-hG-Kg8" customClass="QMUIButton"> - <rect key="frame" x="305" y="0.0" width="60" height="52"/> + <rect key="frame" x="323" y="0.0" width="42" height="52"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="距离" image="icon_sort_normal"> @@ -195,10 +202,10 @@ </view> </objects> <resources> - <image name="icon_down_arrow" width="20" height="14"/> - <image name="icon_down_arrow_s" width="20" height="14"/> + <image name="icon_down_arrow" width="13" height="8"/> + <image name="icon_down_arrow_s" width="13" height="8"/> <image name="icon_search" width="17" height="17"/> - <image name="icon_sort_normal" width="27" height="30"/> + <image name="icon_sort_normal" width="9" height="12"/> <namedColor name="FE6E0D"> <color red="0.99199998378753662" green="0.53299999237060547" blue="0.0080000003799796104" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </namedColor> diff --git a/WanPai/Root/Home/Model/HomeModel.swift b/WanPai/Root/Home/Model/HomeModel.swift index 8a86bdf..445ad2f 100644 --- a/WanPai/Root/Home/Model/HomeModel.swift +++ b/WanPai/Root/Home/Model/HomeModel.swift @@ -24,7 +24,22 @@ var isOpen:Int = 0 var sort:Int = 0 var backgroundImage:String = "" -// var defaultImg:UIImage? + var cellHeight:Double = 270 + + +} + +class HomeStoreTopBannerModel:HandyJSON{ + + required init() {} + + var backgroundImage:String = "" + var name = "" //模块 + var page = "" //页面 + var type:String = "" //类型 + var turnId:Int? + + var cellHeight:Double = 270 } diff --git a/WanPai/Root/Home/VC/HomeVC.swift b/WanPai/Root/Home/VC/HomeVC.swift index fa5968c..62bc2a1 100644 --- a/WanPai/Root/Home/VC/HomeVC.swift +++ b/WanPai/Root/Home/VC/HomeVC.swift @@ -22,7 +22,7 @@ private var layout:WaterFallFlowLayout! @IBOutlet weak var label_store: UILabel! - private var items = Array<HomeStoreConfigModel>() + private var items = Array<Any>() private var storeModel:HomeStoreModel? private var storeId:Int? private var currentLocal:CLLocation? @@ -51,6 +51,7 @@ if let models = data.data{ let imgs = models.compactMap({$0.img}) self?.view_banner.setImages(images: imgs, type: .URL) { index in + //todo } } @@ -133,32 +134,49 @@ showHUD() let w = (weakSelf.view.frame.width - 78.0) / 2.0 for (_,model) in weakSelf.items.enumerated(){ - SDWebImageDownloader.shared.downloadImage(with: URL(string: model.backgroundImage), options: .useNSURLCache) { _, _,_ in + if let m = model as? HomeStoreConfigModel{ + SDWebImageDownloader.shared.downloadImage(with: URL(string: m.backgroundImage), options: .useNSURLCache) { _, _,_ in - } completed: { image, data, error, status in - if let img = image{ + } completed: {[weak self] image, data, error, status in + if let img = image{ + m.cellHeight = w / (img.size.width / img.size.height) + }else{ + m.cellHeight = w / (m.type.defaultImg.size.width / m.type.defaultImg.size.height) + } i += 1 - model.cellHeight = w / (img.size.width / img.size.height) - }else{ - i += 1 - model.cellHeight = w / (model.type.defaultImg.size.width / model.type.defaultImg.size.height) + if i == weakSelf.items.count{ + self?.updateUI() + } } + } - print("Height:\(model.cellHeight)===\(model.type.rawValue)\n") - if i == weakSelf.items.count{ - //重置Layout,不然不更新 - self!.layout = WaterFallFlowLayout() - self!.layout.itemCount = self!.items.count - self!.layout.delegate = self - self!.layout.cols = 2 - self!.layout.sectionInset = UIEdgeInsets(top: 14, left: 34, bottom: 14, right: 34) - self!.collectionView.collectionViewLayout = self!.layout - self!.collectionView.reloadData() - hiddenHUD() + if let m = model as? HomeStoreTopBannerModel{ + SDWebImageDownloader.shared.downloadImage(with: URL(string: m.backgroundImage), options: .useNSURLCache) { _, _,_ in + + } completed: {[weak self] image, data, error, status in + if let img = image{ + m.cellHeight = w / (img.size.width / img.size.height) + i += 1 + if i == weakSelf.items.count{ + self?.updateUI() + } + } } } } } + } + + private func updateUI(){ + //重置Layout,不然不更新 + layout = WaterFallFlowLayout() + layout.itemCount = items.count + layout.delegate = self + layout.cols = 2 + layout.sectionInset = UIEdgeInsets(top: 14, left: 34, bottom: 14, right: 34) + collectionView.collectionViewLayout = self.layout + collectionView.reloadData() + hiddenHUD() } private func startLocation(){ @@ -195,6 +213,7 @@ guard let weakSelf = self else { return } weakSelf.storeId = storeId weakSelf.label_store.text = storeName + weakSelf.storeModel = HomeStoreModel(isVip: 0, storeId: storeId, name: storeName, lon: 0, lat: 0) weakSelf.items.removeAll() weakSelf.getStoreItemList() } @@ -207,46 +226,57 @@ extension HomeVC:UICollectionViewDelegate{ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - let item = items[indexPath.row] - switch item.type{ - case .course: - let vc = CourseListVC() - push(vc: vc) - case .booking: - let vc = YardListVC() - push(vc: vc) - case .activity: - let vc = ActivityListVC() - push(vc: vc) - case .video: - let vc = CourseOnlineListVC(position: 2) - vc.title = "看视频得奖励" - push(vc: vc) - case .coin: - let vc = CourseOnlineListVC(position: 1) - vc.title = "线上课得积分" - push(vc: vc) - case .ticket: - let vc = WelfareWeeklyListVC() - push(vc: vc) - case .wisdomCourt: - guard storeId != 0 else {alert(msg: "请先选择门店");return} - let vc = GamesVC() - push(vc: vc) - case .welfare: - if storeId != 0{ - Services.queryStoreFreeBenefit(id: storeId!).subscribe(onNext: {[weak self] data in - if let m = data.data{ - let vc = WelfareFreeVC(m) - self?.push(vc: vc) - } - }).disposed(by: disposeBag) - }else{ - alertError(msg: "当前门店获取失败") - } - case .none:break - } + var simpleModel:NormalSimpleModel? + if storeModel != nil{ + simpleModel = NormalSimpleModel(id: storeModel!.storeId, name: storeModel!.name) + } + + let item = items[indexPath.row] + if let m = item as? HomeStoreConfigModel{ + switch m.type{ + case .course: + let vc = CourseListVC(selectStore: simpleModel) + push(vc: vc) + case .booking: + let vc = YardListVC(selectStore: simpleModel) + push(vc: vc) + case .activity: + let vc = ActivityListVC() + push(vc: vc) + case .video: + let vc = CourseOnlineListVC(position: 2) + vc.title = "看视频得奖励" + push(vc: vc) + case .coin: + let vc = CourseOnlineListVC(position: 1) + vc.title = "线上课得积分" + push(vc: vc) + case .ticket: + let vc = WelfareWeeklyListVC() + push(vc: vc) + case .wisdomCourt: + guard storeId != 0 else {alert(msg: "请先选择门店");return} + let vc = GamesVC() + push(vc: vc) + case .welfare: + if storeId != 0{ + Services.queryStoreFreeBenefit(id: storeId!).subscribe(onNext: {[weak self] data in + if let m = data.data{ + let vc = WelfareFreeVC(m) + self?.push(vc: vc) + } + }).disposed(by: disposeBag) + }else{ + alertError(msg: "当前门店获取失败") + } + case .none:break + } + } + + if let m = item as? HomeStoreTopBannerModel{ + jumpPage(name: m.name, page: m.page, type: m.type,id: m.turnId) + } } } @@ -255,7 +285,14 @@ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 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: .lowPriority) + + if let m = item as? HomeStoreConfigModel{ + cell.img.sd_setImage(with: URL(string: m.backgroundImage), placeholderImage: m.type.defaultImg, options: .lowPriority) + } + + if let m = item as? HomeStoreTopBannerModel{ + cell.img.sd_setImage(with: URL(string: m.backgroundImage), placeholderImage: nil, options: .lowPriority) + } cell.img.cornerRadius = 10 return cell } @@ -269,8 +306,16 @@ extension HomeVC: WaterFallLayoutDelegate{ func waterFlowLayout(_ waterFlowLayout: WaterFallFlowLayout, itemHeight indexPath: IndexPath) -> CGFloat { let item = items[indexPath.row] - print("===\(item.cellHeight)") - return item.cellHeight + + if let m = item as? HomeStoreConfigModel{ + return m.cellHeight + } + + if let m = item as? HomeStoreTopBannerModel{ + return m.cellHeight + } + + return 0 } } diff --git a/WanPai/Root/Login/VC/BindPhoneVC.swift b/WanPai/Root/Login/VC/BindPhoneVC.swift index 71c1509..e40d677 100644 --- a/WanPai/Root/Login/VC/BindPhoneVC.swift +++ b/WanPai/Root/Login/VC/BindPhoneVC.swift @@ -38,7 +38,7 @@ } Services.getSMSCode(phone: tf_phone.text!, type: .login).subscribe(onNext: {result in - sender.jq_openCountDown() + sender.openCountDown() }) { error in alertError(msg: error.localizedDescription) }.disposed(by: disposeBag) @@ -66,4 +66,8 @@ alertError(msg: error.localizedDescription) }.disposed(by: disposeBag) } + + override var preferredStatusBarStyle: UIStatusBarStyle{ + return .default + } } diff --git a/WanPai/Root/Login/VC/BindPhoneVC.xib b/WanPai/Root/Login/VC/BindPhoneVC.xib index cfd0a30..c10bdce 100644 --- a/WanPai/Root/Login/VC/BindPhoneVC.xib +++ b/WanPai/Root/Login/VC/BindPhoneVC.xib @@ -27,13 +27,13 @@ <rect key="frame" x="122.66666666666669" y="79" width="148" height="72"/> </imageView> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WPl-pn-8JJ"> - <rect key="frame" x="40" y="181" width="313" height="40"/> + <rect key="frame" x="40" y="181" width="313" height="50"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_login_phone" translatesAutoresizingMaskIntoConstraints="NO" id="Uoj-6E-rpY"> - <rect key="frame" x="31" y="11" width="16" height="18"/> + <rect key="frame" x="31" y="16" width="16" height="18"/> </imageView> <textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入手机号" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="38t-oZ-Tdy" customClass="QMUITextField"> - <rect key="frame" x="75" y="0.0" width="228" height="40"/> + <rect key="frame" x="75" y="0.0" width="228" height="50"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <textInputTraits key="textInputTraits" keyboardType="numberPad"/> <userDefinedRuntimeAttributes> @@ -53,24 +53,24 @@ <constraint firstAttribute="bottom" secondItem="38t-oZ-Tdy" secondAttribute="bottom" id="EaF-3a-QMN"/> <constraint firstItem="38t-oZ-Tdy" firstAttribute="leading" secondItem="Uoj-6E-rpY" secondAttribute="trailing" constant="28" id="FFg-7n-qFM"/> <constraint firstAttribute="trailing" secondItem="38t-oZ-Tdy" secondAttribute="trailing" constant="10" id="Feu-9s-5VF"/> - <constraint firstAttribute="height" constant="40" id="e4Z-wK-ULC"/> + <constraint firstAttribute="height" constant="50" id="e4Z-wK-ULC"/> <constraint firstItem="38t-oZ-Tdy" firstAttribute="top" secondItem="WPl-pn-8JJ" secondAttribute="top" id="hUA-4o-cn0"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="boolean" keyPath="ld_maskToBoundsXIB" value="YES"/> <userDefinedRuntimeAttribute type="number" keyPath="ld_cornerRadiusXIB"> - <real key="value" value="20"/> + <real key="value" value="25"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7iL-m6-Iwb"> - <rect key="frame" x="40" y="241" width="313" height="40"/> + <rect key="frame" x="40" y="251" width="313" height="50"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_login_code" translatesAutoresizingMaskIntoConstraints="NO" id="PYe-PG-LcZ"> - <rect key="frame" x="31" y="11" width="15" height="18"/> + <rect key="frame" x="31" y="16" width="15" height="18"/> </imageView> <textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入验证码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="uLi-4i-BeV" customClass="QMUITextField"> - <rect key="frame" x="74" y="0.0" width="98" height="40"/> + <rect key="frame" x="74" y="0.0" width="98" height="50"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <textInputTraits key="textInputTraits" spellCheckingType="no" keyboardType="numberPad" enablesReturnKeyAutomatically="YES" smartQuotesType="no"/> <userDefinedRuntimeAttributes> @@ -83,7 +83,7 @@ </userDefinedRuntimeAttributes> </textField> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HBj-1e-rHP"> - <rect key="frame" x="231" y="6.6666666666666572" width="62" height="27"/> + <rect key="frame" x="231" y="11.666666666666686" width="62" height="27"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="获取验证码"> @@ -101,14 +101,14 @@ <constraint firstItem="HBj-1e-rHP" firstAttribute="centerY" secondItem="7iL-m6-Iwb" secondAttribute="centerY" id="JOz-N1-HHf"/> <constraint firstItem="PYe-PG-LcZ" firstAttribute="centerY" secondItem="7iL-m6-Iwb" secondAttribute="centerY" id="OR8-fk-A5y"/> <constraint firstItem="uLi-4i-BeV" firstAttribute="leading" secondItem="PYe-PG-LcZ" secondAttribute="trailing" constant="28" id="RNG-pY-hjF"/> - <constraint firstAttribute="height" constant="40" id="TgR-JE-DzH"/> + <constraint firstAttribute="height" constant="50" id="TgR-JE-DzH"/> <constraint firstItem="PYe-PG-LcZ" firstAttribute="leading" secondItem="7iL-m6-Iwb" secondAttribute="leading" constant="31" id="aOy-EM-r9Q"/> <constraint firstAttribute="trailing" secondItem="HBj-1e-rHP" secondAttribute="trailing" constant="20" id="gZI-8l-CtF"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="boolean" keyPath="ld_maskToBoundsXIB" value="YES"/> <userDefinedRuntimeAttribute type="number" keyPath="ld_cornerRadiusXIB"> - <real key="value" value="20"/> + <real key="value" value="25"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> diff --git a/WanPai/Root/Login/VC/LoginRegOrForgotVC.swift b/WanPai/Root/Login/VC/LoginRegOrForgotVC.swift index 4f24d09..29f87de 100644 --- a/WanPai/Root/Login/VC/LoginRegOrForgotVC.swift +++ b/WanPai/Root/Login/VC/LoginRegOrForgotVC.swift @@ -30,6 +30,7 @@ override func viewDidLoad() { super.viewDidLoad() title = type.titleStr + tf_pwd.maximumTextLength = 18 } @IBAction func eyeAction(_ sender: UIButton) { @@ -79,7 +80,7 @@ guard !tf_phone.text!.isEmpty else {alertError(msg: tf_phone.placeholder!);return} guard tf_phone.text!.jq_isPhone else {alertError(msg: "请输入正确的手机号");return} Services.getSMSCode(phone: tf_phone.text!, type: type).subscribe(onNext: {result in - sender.jq_openCountDown() + sender.openCountDown() }).disposed(by: disposeBag) } diff --git a/WanPai/Root/Login/VC/LoginRegOrForgotVC.xib b/WanPai/Root/Login/VC/LoginRegOrForgotVC.xib index d301bab..602665f 100644 --- a/WanPai/Root/Login/VC/LoginRegOrForgotVC.xib +++ b/WanPai/Root/Login/VC/LoginRegOrForgotVC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_12" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/> <capability name="Named colors" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> @@ -27,13 +27,13 @@ <rect key="frame" x="122.66666666666669" y="79" width="148" height="72"/> </imageView> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="H0l-HL-WQ6"> - <rect key="frame" x="40" y="190" width="313" height="40"/> + <rect key="frame" x="40" y="190" width="313" height="50"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_login_phone" translatesAutoresizingMaskIntoConstraints="NO" id="ksw-uN-X0q"> - <rect key="frame" x="31" y="11" width="16" height="18"/> + <rect key="frame" x="31" y="16" width="16" height="18"/> </imageView> <textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入手机号" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="t2b-ES-vps" customClass="QMUITextField"> - <rect key="frame" x="75" y="0.0" width="228" height="40"/> + <rect key="frame" x="75" y="0.0" width="228" height="50"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <textInputTraits key="textInputTraits" keyboardType="numberPad"/> <userDefinedRuntimeAttributes> @@ -52,25 +52,25 @@ <constraint firstItem="ksw-uN-X0q" firstAttribute="leading" secondItem="H0l-HL-WQ6" secondAttribute="leading" constant="31" id="48W-7t-nKb"/> <constraint firstItem="t2b-ES-vps" firstAttribute="top" secondItem="H0l-HL-WQ6" secondAttribute="top" id="5Py-AC-nG8"/> <constraint firstAttribute="trailing" secondItem="t2b-ES-vps" secondAttribute="trailing" constant="10" id="8na-8U-eKt"/> - <constraint firstAttribute="height" constant="40" id="9z5-Qt-ZGg"/> + <constraint firstAttribute="height" constant="50" id="9z5-Qt-ZGg"/> <constraint firstItem="ksw-uN-X0q" firstAttribute="centerY" secondItem="H0l-HL-WQ6" secondAttribute="centerY" id="PiL-jy-PCF"/> <constraint firstAttribute="bottom" secondItem="t2b-ES-vps" secondAttribute="bottom" id="QcC-TC-rhR"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="boolean" keyPath="ld_maskToBoundsXIB" value="YES"/> <userDefinedRuntimeAttribute type="number" keyPath="ld_cornerRadiusXIB"> - <real key="value" value="20"/> + <real key="value" value="25"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AjG-PX-mug"> - <rect key="frame" x="40" y="250" width="313" height="40"/> + <rect key="frame" x="40" y="260" width="313" height="50"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_login_code" translatesAutoresizingMaskIntoConstraints="NO" id="GmS-FY-i5D"> - <rect key="frame" x="31" y="11" width="15" height="18"/> + <rect key="frame" x="31" y="16" width="15" height="18"/> </imageView> <textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入验证码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="gNj-6t-p9o" customClass="QMUITextField"> - <rect key="frame" x="74" y="0.0" width="98" height="40"/> + <rect key="frame" x="74" y="0.0" width="98" height="50"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <textInputTraits key="textInputTraits" spellCheckingType="no" keyboardType="numberPad" enablesReturnKeyAutomatically="YES" smartQuotesType="no"/> <userDefinedRuntimeAttributes> @@ -83,7 +83,7 @@ </userDefinedRuntimeAttributes> </textField> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8ND-Q2-rU3"> - <rect key="frame" x="231" y="6.6666666666666856" width="62" height="27"/> + <rect key="frame" x="231" y="11.666666666666686" width="62" height="27"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="获取验证码"> @@ -96,7 +96,7 @@ </subviews> <color key="backgroundColor" red="0.96470588239999999" green="0.96470588239999999" blue="0.96470588239999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> - <constraint firstAttribute="height" constant="40" id="A8Z-NM-OhZ"/> + <constraint firstAttribute="height" constant="50" id="A8Z-NM-OhZ"/> <constraint firstAttribute="trailing" secondItem="8ND-Q2-rU3" secondAttribute="trailing" constant="20" id="G90-A2-VBu"/> <constraint firstItem="GmS-FY-i5D" firstAttribute="leading" secondItem="AjG-PX-mug" secondAttribute="leading" constant="31" id="N5S-wR-Zed"/> <constraint firstItem="gNj-6t-p9o" firstAttribute="top" secondItem="AjG-PX-mug" secondAttribute="top" id="NEM-5g-CfC"/> @@ -108,18 +108,18 @@ <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="boolean" keyPath="ld_maskToBoundsXIB" value="YES"/> <userDefinedRuntimeAttribute type="number" keyPath="ld_cornerRadiusXIB"> - <real key="value" value="20"/> + <real key="value" value="25"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gqc-3H-F7Y"> - <rect key="frame" x="40" y="314" width="313" height="40"/> + <rect key="frame" x="40" y="334" width="313" height="50"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_login_pwd" translatesAutoresizingMaskIntoConstraints="NO" id="DwZ-DK-k3H"> - <rect key="frame" x="31" y="11" width="15" height="18"/> + <rect key="frame" x="31" y="16" width="15" height="18"/> </imageView> <textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入密码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="xxp-hE-Y3y" customClass="QMUITextField"> - <rect key="frame" x="74" y="0.0" width="190" height="40"/> + <rect key="frame" x="74" y="0.0" width="190" height="50"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <textInputTraits key="textInputTraits" spellCheckingType="no" keyboardType="alphabet" enablesReturnKeyAutomatically="YES" secureTextEntry="YES" smartQuotesType="no"/> <userDefinedRuntimeAttributes> @@ -132,7 +132,7 @@ </userDefinedRuntimeAttributes> </textField> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aTn-ag-HTb"> - <rect key="frame" x="274" y="9" width="22" height="22"/> + <rect key="frame" x="274" y="14" width="22" height="22"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" image="icon_login_eye_c"/> <state key="selected" image="icon_login_eye"/> @@ -151,17 +151,17 @@ <constraint firstItem="xxp-hE-Y3y" firstAttribute="top" secondItem="gqc-3H-F7Y" secondAttribute="top" id="cOG-RP-AOA"/> <constraint firstAttribute="trailing" secondItem="aTn-ag-HTb" secondAttribute="trailing" constant="17" id="mAG-ND-EAC"/> <constraint firstAttribute="bottom" secondItem="xxp-hE-Y3y" secondAttribute="bottom" id="mou-7K-ymd"/> - <constraint firstAttribute="height" constant="40" id="sMw-Ms-giP"/> + <constraint firstAttribute="height" constant="50" id="sMw-Ms-giP"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="boolean" keyPath="ld_maskToBoundsXIB" value="YES"/> <userDefinedRuntimeAttribute type="number" keyPath="ld_cornerRadiusXIB"> - <real key="value" value="20"/> + <real key="value" value="25"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vri-pP-hU6"> - <rect key="frame" x="100" y="393" width="193" height="40"/> + <rect key="frame" x="100" y="423" width="193" height="40"/> <color key="backgroundColor" name="FE6E0D"/> <constraints> <constraint firstAttribute="height" constant="40" id="9Zu-bi-eqQ"/> diff --git a/WanPai/Root/Login/VC/LoginVC.swift b/WanPai/Root/Login/VC/LoginVC.swift index bda8dc4..34a5ae7 100644 --- a/WanPai/Root/Login/VC/LoginVC.swift +++ b/WanPai/Root/Login/VC/LoginVC.swift @@ -26,6 +26,9 @@ @IBOutlet weak var cons_registerCenterX: NSLayoutConstraint! @IBOutlet weak var cons_loginCenterX: NSLayoutConstraint! @IBOutlet weak var btn_reader: UIButton! + @IBOutlet weak var cons_stackHei: NSLayoutConstraint! + @IBOutlet weak var stack_handleView: UIStackView! + @IBOutlet weak var cons_loginWidth: NSLayoutConstraint! private let loginType = BehaviorRelay<LoginType>(value: .pwd) @@ -43,10 +46,13 @@ textView_treaty.isEditable = false let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineBreakMode = NSLineBreakMode.byCharWrapping - + paragraphStyle.lineSpacing = 3 + let content = "我已阅读并同意《隐私协议》《用户协议》《运动安全告知书》" let attribute = NSMutableAttributedString(string: content) - attribute.addAttributes([NSAttributedString.Key.link:URL(string: "tip://treaty")!], range: content.jq_subRange("《隐私协议》")!) + attribute.addAttribute(.foregroundColor, value: UIColor.black.withAlphaComponent(0.6), range: NSRange(location: 0, length: content.count)) + attribute.addAttribute(.font, value: UIFont.systemFont(ofSize: 12, weight: .medium), range: NSRange(location: 0, length: content.count)) + attribute.addAttributes([NSAttributedString.Key.link:URL(string: "tip://treaty")!,.foregroundColor:UIColor(hexStr: "0078CD")], range: content.jq_subRange("《隐私协议》")!) attribute.addAttributes([NSAttributedString.Key.link:URL(string: "tip://user")!], range: content.jq_subRange("《用户协议》")!) attribute.addAttributes([NSAttributedString.Key.link:URL(string: "tip://sportSafety")!], range: content.jq_subRange("《运动安全告知书》")!) attribute.addAttributes([.paragraphStyle:paragraphStyle], range: _NSRange(location: 0, length: content.count)) @@ -66,7 +72,7 @@ case .pwd: weakSelf.tf_verify.isSecureTextEntry = !weakSelf.btn_eye.isSelected weakSelf.tf_verify.keyboardType = .default - weakSelf.tf_verify.maximumTextLength = 30 + weakSelf.tf_verify.maximumTextLength = 18 weakSelf.tf_verify.placeholder = "请输入密码" case .smsCode: weakSelf.tf_verify.isSecureTextEntry = false @@ -91,12 +97,16 @@ let str = btn_pwdLogin.isSelected ? "登录":"注册/登录" + self.cons_stackHei.constant = self.btn_pwdLogin.isSelected ? 25:0 + UIView.animate(withDuration: 0.4) { self.view.layoutIfNeeded() self.btn_login.setTitle(str, for: .normal) if self.btn_pwdLogin.isSelected{ + self.stack_handleView.alpha = 1 self.btn_login.localGradientColor(cornerRadius: 20,bounds: CGRect(x: 0, y: 0, width: 144, height: 40)) }else{ + self.stack_handleView.alpha = 0 self.btn_login.localGradientColor(cornerRadius: 20,bounds: CGRect(x: 0, y: 0, width: 189, height: 40)) } } completion: { _ in @@ -114,10 +124,10 @@ @IBAction func getCodeAction(_ sender: UIButton) { guard !tf_phone.text!.isEmpty else {alertError(msg: tf_phone.placeholder!);return} - guard tf_phone.text!.jq_isPhone else {alertError(msg: "请输入正确的手机号");return} + guard tf_phone.text!.jq_isPhone else {alertError(msg: "请输入正确的手机号");return} Services.getSMSCode(phone: tf_phone.text!, type: .login).subscribe(onNext: {data in if data.code == 200{ - sender.jq_openCountDown() + sender.openCountDown() }else{ alertError(msg: data.msg) } @@ -130,8 +140,9 @@ let type = loginType.value guard !tf_phone.text!.isEmpty else {alertError(msg: tf_phone.placeholder!);return} + guard tf_phone.text!.jq_isPhone else {alertError(msg: "请输入正确的手机号");return} guard !tf_verify.text!.isEmpty else {alertError(msg: tf_verify.placeholder!);return} - guard btn_reader.isSelected else {alert(msg: "请先仔细阅读并同意协议");return} + guard btn_reader.isSelected else {alert(msg: "请阅读并同意《隐私协议》《用户协议》《运动安全告知书》");return} Services.login(phone: tf_phone.text!, verity: tf_verify.text!, type: type).subscribe(onNext: {data in if let token = data.data{ @@ -154,6 +165,7 @@ } @IBAction func registerAction(_ sender: UIButton) { + guard btn_reader.isSelected else {alert(msg: "请阅读并同意《隐私协议》《用户协议》《运动安全告知书》");return} let vc = LoginRegOrForgotVC(type: .register) push(vc: vc) } @@ -164,7 +176,7 @@ } @IBAction func wechatLoginAcion(_ sender: QMUIButton) { - guard btn_reader.isSelected else {alert(msg: "请先仔细阅读并同意协议");return} + guard btn_reader.isSelected else {alert(msg: "请阅读并同意《隐私协议》《用户协议》《运动安全告知书》");return} showHUD() WeChatTools.sendAuthRequest() } diff --git a/WanPai/Root/Login/VC/LoginVC.xib b/WanPai/Root/Login/VC/LoginVC.xib index 7442588..14bc643 100644 --- a/WanPai/Root/Login/VC/LoginVC.xib +++ b/WanPai/Root/Login/VC/LoginVC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_12" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/> <capability name="Named colors" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> @@ -23,6 +23,8 @@ <outlet property="cons_loginCenterX" destination="J5m-nY-42E" id="2NA-d1-PIL"/> <outlet property="cons_loginWidth" destination="MTM-NH-2de" id="0Sc-uM-zMe"/> <outlet property="cons_registerCenterX" destination="kcA-1H-itW" id="Uhx-AG-p46"/> + <outlet property="cons_stackHei" destination="fsW-mR-FHo" id="OIT-Y0-q2V"/> + <outlet property="stack_handleView" destination="Ej3-Zy-UxP" id="Xv9-xM-5Yc"/> <outlet property="textView_treaty" destination="BqB-Az-Ez1" id="zWC-fQ-SsK"/> <outlet property="tf_phone" destination="dXR-3c-p7o" id="7Dm-0N-TNe"/> <outlet property="tf_verify" destination="yYG-aW-Yzi" id="v9Z-15-f29"/> @@ -80,7 +82,7 @@ </constraints> </stackView> <stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ej3-Zy-UxP"> - <rect key="frame" x="140.33333333333334" y="351" width="112.33333333333334" height="25"/> + <rect key="frame" x="140.33333333333334" y="376" width="112.33333333333334" height="25"/> <subviews> <button opaque="NO" contentMode="scaleToFill" selected="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hI1-WH-dqa"> <rect key="frame" x="0.0" y="0.0" width="50" height="25"/> @@ -122,13 +124,13 @@ </constraints> </stackView> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ixo-tJ-9cE"> - <rect key="frame" x="40" y="238" width="313" height="40"/> + <rect key="frame" x="40" y="243" width="313" height="50"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_login_phone" translatesAutoresizingMaskIntoConstraints="NO" id="HXD-J5-UNt"> - <rect key="frame" x="31" y="11" width="16" height="18"/> + <rect key="frame" x="31" y="16" width="16" height="18"/> </imageView> <textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入手机号" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="dXR-3c-p7o" customClass="QMUITextField"> - <rect key="frame" x="75" y="0.0" width="228" height="40"/> + <rect key="frame" x="75" y="0.0" width="228" height="50"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <textInputTraits key="textInputTraits" keyboardType="numberPad"/> <userDefinedRuntimeAttributes> @@ -143,7 +145,7 @@ </subviews> <color key="backgroundColor" red="0.96470588235294119" green="0.96470588235294119" blue="0.96470588235294119" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> - <constraint firstAttribute="height" constant="40" id="8k3-YG-84m"/> + <constraint firstAttribute="height" constant="50" id="8k3-YG-84m"/> <constraint firstItem="HXD-J5-UNt" firstAttribute="leading" secondItem="ixo-tJ-9cE" secondAttribute="leading" constant="31" id="LYf-PT-yCY"/> <constraint firstAttribute="trailing" secondItem="dXR-3c-p7o" secondAttribute="trailing" constant="10" id="crG-8x-lY4"/> <constraint firstItem="dXR-3c-p7o" firstAttribute="top" secondItem="ixo-tJ-9cE" secondAttribute="top" id="ctp-CL-yYd"/> @@ -154,18 +156,18 @@ <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="boolean" keyPath="ld_maskToBoundsXIB" value="YES"/> <userDefinedRuntimeAttribute type="number" keyPath="ld_cornerRadiusXIB"> - <real key="value" value="20"/> + <real key="value" value="25"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1LE-kf-RCn"> - <rect key="frame" x="40" y="298" width="313" height="40"/> + <rect key="frame" x="40" y="313" width="313" height="50"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_login_code" translatesAutoresizingMaskIntoConstraints="NO" id="0Nl-D8-jVF"> - <rect key="frame" x="31" y="11" width="15" height="18"/> + <rect key="frame" x="31" y="16" width="15" height="18"/> </imageView> <textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入密码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="yYG-aW-Yzi" customClass="QMUITextField"> - <rect key="frame" x="74" y="0.0" width="190" height="40"/> + <rect key="frame" x="74" y="0.0" width="190" height="50"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <textInputTraits key="textInputTraits" spellCheckingType="no" keyboardType="alphabet" enablesReturnKeyAutomatically="YES" secureTextEntry="YES" smartQuotesType="no"/> <userDefinedRuntimeAttributes> @@ -178,7 +180,7 @@ </userDefinedRuntimeAttributes> </textField> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bft-9v-fd2"> - <rect key="frame" x="274" y="9" width="22" height="22"/> + <rect key="frame" x="274" y="14" width="22" height="22"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" image="icon_login_eye_c"/> <state key="selected" image="icon_login_eye"/> @@ -187,7 +189,7 @@ </connections> </button> <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Peu-H2-2Bj"> - <rect key="frame" x="231" y="6.6666666666666856" width="62" height="27"/> + <rect key="frame" x="231" y="11.666666666666686" width="62" height="27"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="获取验证码"> @@ -206,7 +208,7 @@ <constraint firstAttribute="trailing" secondItem="Peu-H2-2Bj" secondAttribute="trailing" constant="20" id="G0A-B4-LL9"/> <constraint firstItem="bft-9v-fd2" firstAttribute="leading" secondItem="yYG-aW-Yzi" secondAttribute="trailing" constant="10" id="M9d-MT-Vu5"/> <constraint firstItem="yYG-aW-Yzi" firstAttribute="top" secondItem="1LE-kf-RCn" secondAttribute="top" id="NlC-lV-gcr"/> - <constraint firstAttribute="height" constant="40" id="Vlt-Kr-Hnl"/> + <constraint firstAttribute="height" constant="50" id="Vlt-Kr-Hnl"/> <constraint firstAttribute="trailing" secondItem="bft-9v-fd2" secondAttribute="trailing" constant="17" id="ZCV-Hr-1WF"/> <constraint firstItem="Peu-H2-2Bj" firstAttribute="centerY" secondItem="1LE-kf-RCn" secondAttribute="centerY" id="nLX-2P-LLJ"/> <constraint firstItem="0Nl-D8-jVF" firstAttribute="centerY" secondItem="1LE-kf-RCn" secondAttribute="centerY" id="nru-Vh-7U0"/> @@ -215,12 +217,12 @@ <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="boolean" keyPath="ld_maskToBoundsXIB" value="YES"/> <userDefinedRuntimeAttribute type="number" keyPath="ld_cornerRadiusXIB"> - <real key="value" value="20"/> + <real key="value" value="25"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="A58-cL-JDg"> - <rect key="frame" x="42.666666666666657" y="404" width="144" height="40"/> + <rect key="frame" x="42.666666666666657" y="429" width="144" height="40"/> <constraints> <constraint firstAttribute="height" constant="40" id="y9B-Xu-Q5i"/> </constraints> @@ -245,7 +247,7 @@ </connections> </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NQ0-2r-DbZ"> - <rect key="frame" x="206.66666666666663" y="404" width="144" height="40"/> + <rect key="frame" x="206.66666666666663" y="429" width="144" height="40"/> <color key="backgroundColor" name="FE6E0D"/> <constraints> <constraint firstAttribute="width" constant="144" id="MTM-NH-2de"/> @@ -266,9 +268,9 @@ </connections> </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jpR-VA-PYM"> - <rect key="frame" x="42" y="464" width="20" height="22"/> + <rect key="frame" x="42" y="489" width="20" height="20"/> <constraints> - <constraint firstAttribute="height" constant="22" id="2ZC-Li-D7d"/> + <constraint firstAttribute="height" constant="20" id="2ZC-Li-D7d"/> <constraint firstAttribute="width" constant="20" id="rRu-Ef-yCE"/> </constraints> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> @@ -317,10 +319,10 @@ </constraints> </view> <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="我已阅读并同意《隐私协议》《用户协议》《运动安全告知书》" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="BqB-Az-Ez1"> - <rect key="frame" x="64" y="459" width="287" height="35"/> + <rect key="frame" x="64" y="484" width="287" height="45"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/> <constraints> - <constraint firstAttribute="height" constant="35" id="rzR-7J-NJs"/> + <constraint firstAttribute="height" constant="45" id="rzR-7J-NJs"/> </constraints> <color key="textColor" systemColor="labelColor"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/> @@ -343,7 +345,7 @@ <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="BqB-Az-Ez1" secondAttribute="trailing" constant="42" id="MWC-RO-gsY"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="mZh-Vi-57o" secondAttribute="bottom" id="MWu-3v-W4I"/> <constraint firstItem="mZh-Vi-57o" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="T42-Uk-S6N"/> - <constraint firstItem="ixo-tJ-9cE" firstAttribute="top" secondItem="cAB-q2-f9Z" secondAttribute="bottom" constant="30" id="THc-e6-Bko"/> + <constraint firstItem="ixo-tJ-9cE" firstAttribute="top" secondItem="cAB-q2-f9Z" secondAttribute="bottom" constant="35" id="THc-e6-Bko"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="ixo-tJ-9cE" secondAttribute="trailing" constant="40" id="TzU-Nh-o64"/> <constraint firstItem="jpR-VA-PYM" firstAttribute="top" secondItem="A58-cL-JDg" secondAttribute="bottom" constant="20" id="Ujc-Kg-bWe"/> <constraint firstItem="1LE-kf-RCn" firstAttribute="top" secondItem="ixo-tJ-9cE" secondAttribute="bottom" constant="20" id="h5h-2F-FmM"/> @@ -377,7 +379,7 @@ <color red="0.99199998378753662" green="0.53299999237060547" blue="0.0080000003799796104" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </namedColor> <systemColor name="labelColor"> - <color red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> </systemColor> <systemColor name="systemBackgroundColor"> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> diff --git a/WanPai/Root/Other/TCell/Common_1_TCell.xib b/WanPai/Root/Other/TCell/Common_1_TCell.xib index 9aa11f8..7d72c2f 100644 --- a/WanPai/Root/Other/TCell/Common_1_TCell.xib +++ b/WanPai/Root/Other/TCell/Common_1_TCell.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_12" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -34,7 +34,11 @@ <nil key="highlightedColor"/> </label> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="btn_choose" translatesAutoresizingMaskIntoConstraints="NO" id="IsM-9J-Fsh"> - <rect key="frame" x="325" y="12.666666666666664" width="25" height="25"/> + <rect key="frame" x="330" y="15" width="20" height="20"/> + <constraints> + <constraint firstAttribute="height" constant="20" id="TGp-cD-Tdy"/> + <constraint firstAttribute="width" constant="20" id="kKy-cQ-WYQ"/> + </constraints> </imageView> </subviews> <constraints> diff --git a/WanPai/Root/Other/View/StoresChooseView.swift b/WanPai/Root/Other/View/StoresChooseView.swift index c6c8c6b..9c651bf 100644 --- a/WanPai/Root/Other/View/StoresChooseView.swift +++ b/WanPai/Root/Other/View/StoresChooseView.swift @@ -15,7 +15,8 @@ @IBOutlet weak var label_currently: UILabel! @IBOutlet weak var label_province: UILabel! @IBOutlet weak var label_city: UILabel! - + @IBOutlet weak var btn_complete: UIButton! + private var provinceModel:CityProfileModel? private var cityModel:CityProfileModel? @@ -77,6 +78,12 @@ } } + + override func layoutSubviews() { + super.layoutSubviews() + btn_complete.localGradientColor(cornerRadius: 20) + } + @IBAction func provinceAction(_ sender: TapBtn) { guard provincesModel.count != 0 else { alertError(msg: "省级获取失败,正在重新获取") diff --git a/WanPai/Root/Other/View/StoresChooseView.xib b/WanPai/Root/Other/View/StoresChooseView.xib index 9694317..ff9f3fd 100644 --- a/WanPai/Root/Other/View/StoresChooseView.xib +++ b/WanPai/Root/Other/View/StoresChooseView.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_12" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/> <capability name="Named colors" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> @@ -17,25 +17,25 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ea6-eG-h1P"> - <rect key="frame" x="45" y="256.66666666666669" width="303" height="364.00000000000006"/> + <rect key="frame" x="14" y="256" width="365" height="365"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="选择门店" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vnK-Bc-xWN"> - <rect key="frame" x="114.66666666666666" y="24" width="73.666666666666657" height="21.666666666666671"/> + <rect key="frame" x="145.66666666666666" y="24" width="73.666666666666657" height="21.666666666666671"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/> - <nil key="textColor"/> + <color key="textColor" red="0.34509803921568627" green="0.34509803921568627" blue="0.34509803921568627" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YCO-sD-KY4" customClass="TapBtn" customModule="WanPai" customModuleProvider="target"> - <rect key="frame" x="95.666666666666643" y="221" width="199.33333333333337" height="50"/> + <rect key="frame" x="100.66666666666666" y="222" width="256.33333333333337" height="50"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="选择门店" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sjM-7I-k3g"> - <rect key="frame" x="15" y="15.333333333333313" width="65.333333333333329" height="19.333333333333329"/> + <rect key="frame" x="14.999999999999986" y="15.333333333333313" width="65.333333333333329" height="19.333333333333329"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> - <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.60999999999999999" colorSpace="custom" customColorSpace="sRGB"/> + <color key="textColor" red="0.51372549019607838" green="0.51372549019607838" blue="0.51372549019607838" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_down_arrow" translatesAutoresizingMaskIntoConstraints="NO" id="ZlA-4r-lHH"> - <rect key="frame" x="167.33333333333334" y="18" width="20" height="14"/> + <rect key="frame" x="224.33333333333331" y="18" width="20" height="14"/> </imageView> </subviews> <color key="backgroundColor" systemColor="systemBackgroundColor"/> @@ -62,7 +62,7 @@ </connections> </view> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Gtx-K4-ldi"> - <rect key="frame" x="20.000000000000007" y="303.99999999999994" width="121.66666666666669" height="40"/> + <rect key="frame" x="51.000000000000007" y="305" width="121.66666666666669" height="40"/> <color key="backgroundColor" red="0.75294117647058822" green="0.75294117647058822" blue="0.75294117647058822" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="40" id="VNh-Ns-GXh"/> @@ -81,7 +81,7 @@ </connections> </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MK0-Fw-fiO"> - <rect key="frame" x="161.66666666666666" y="303.99999999999994" width="121.33333333333334" height="40"/> + <rect key="frame" x="192.66666666666666" y="305" width="121.33333333333334" height="40"/> <color key="backgroundColor" name="FE6E0D"/> <constraints> <constraint firstAttribute="height" constant="40" id="CGz-wa-xYW"/> @@ -100,22 +100,22 @@ </connections> </button> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="门店名称:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Iwt-0W-DTT"> - <rect key="frame" x="14" y="236.33333333333331" width="81.666666666666671" height="19.333333333333343"/> + <rect key="frame" x="14" y="237.33333333333331" width="81.666666666666671" height="19.333333333333314"/> <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/> - <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.81000000000000005" colorSpace="custom" customColorSpace="sRGB"/> + <color key="textColor" red="0.34509803921568627" green="0.34509803921568627" blue="0.34509803921568627" alpha="0.81000000000000005" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="A9R-Ja-bxD" customClass="TapBtn" customModule="WanPai" customModuleProvider="target"> - <rect key="frame" x="95.666666666666657" y="76.666666666666629" width="169.99999999999997" height="50"/> + <rect key="frame" x="100.66666666666669" y="76.666666666666686" width="227" height="50"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="选择省份" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LHk-zb-Nvv"> - <rect key="frame" x="15" y="15.333333333333369" width="65.333333333333329" height="19.333333333333329"/> + <rect key="frame" x="14.999999999999986" y="15.333333333333313" width="65.333333333333329" height="19.333333333333329"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> - <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.60999999999999999" colorSpace="custom" customColorSpace="sRGB"/> + <color key="textColor" red="0.51372549019607838" green="0.51372549019607838" blue="0.51372549019607838" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_down_arrow" translatesAutoresizingMaskIntoConstraints="NO" id="uVb-d4-a48"> - <rect key="frame" x="138.00000000000003" y="18" width="20" height="14"/> + <rect key="frame" x="195" y="18" width="20" height="14"/> </imageView> </subviews> <color key="backgroundColor" systemColor="systemBackgroundColor"/> @@ -142,28 +142,28 @@ </connections> </view> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="省" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TQ0-7y-gmP"> - <rect key="frame" x="276.66666666666669" y="92" width="16.333333333333314" height="19.333333333333329"/> + <rect key="frame" x="338.66666666666669" y="92" width="16.333333333333314" height="19.333333333333329"/> <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/> - <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.60999999999999999" colorSpace="custom" customColorSpace="sRGB"/> + <color key="textColor" red="0.51372549019607838" green="0.51372549019607838" blue="0.51372549019607838" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="所在城市:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="reI-TL-hMa"> - <rect key="frame" x="14" y="92" width="81.666666666666671" height="19"/> + <rect key="frame" x="14" y="92.333333333333314" width="81.666666666666671" height="19"/> <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/> - <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.81000000000000005" colorSpace="custom" customColorSpace="sRGB"/> + <color key="textColor" red="0.34509803921568627" green="0.34509803921568627" blue="0.34509803921568627" alpha="0.81000000000000005" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="s9M-HC-hay" customClass="TapBtn" customModule="WanPai" customModuleProvider="target"> - <rect key="frame" x="95.666666666666657" y="144.66666666666663" width="169.99999999999997" height="50"/> + <rect key="frame" x="100.66666666666669" y="144.66666666666669" width="227" height="50"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="选择城市" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="flf-S9-xVu"> - <rect key="frame" x="15" y="15.333333333333369" width="65.333333333333329" height="19.333333333333329"/> + <rect key="frame" x="14.999999999999986" y="15.333333333333313" width="65.333333333333329" height="19.333333333333329"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> - <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.60999999999999999" colorSpace="custom" customColorSpace="sRGB"/> + <color key="textColor" red="0.51372549019607838" green="0.51372549019607838" blue="0.51372549019607838" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_down_arrow" translatesAutoresizingMaskIntoConstraints="NO" id="p7S-Td-vXl"> - <rect key="frame" x="138.00000000000003" y="18" width="20" height="14"/> + <rect key="frame" x="195" y="18" width="20" height="14"/> </imageView> </subviews> <color key="backgroundColor" systemColor="systemBackgroundColor"/> @@ -190,9 +190,9 @@ </connections> </view> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="市" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bpE-eg-Ouo"> - <rect key="frame" x="276.66666666666669" y="160" width="16.333333333333314" height="19.333333333333343"/> + <rect key="frame" x="338.66666666666669" y="160" width="16.333333333333314" height="19.333333333333343"/> <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/> - <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.60999999999999999" colorSpace="custom" customColorSpace="sRGB"/> + <color key="textColor" red="0.51372549019607838" green="0.51372549019607838" blue="0.51372549019607838" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> </subviews> @@ -202,7 +202,7 @@ <constraint firstItem="A9R-Ja-bxD" firstAttribute="centerY" secondItem="reI-TL-hMa" secondAttribute="centerY" id="1nD-04-k7j"/> <constraint firstItem="bpE-eg-Ouo" firstAttribute="centerY" secondItem="s9M-HC-hay" secondAttribute="centerY" id="5ME-wE-s3r"/> <constraint firstItem="Iwt-0W-DTT" firstAttribute="leading" secondItem="ea6-eG-h1P" secondAttribute="leading" constant="14" id="LJ1-JK-oMp"/> - <constraint firstItem="A9R-Ja-bxD" firstAttribute="leading" secondItem="reI-TL-hMa" secondAttribute="trailing" id="NCp-A4-fbe"/> + <constraint firstItem="A9R-Ja-bxD" firstAttribute="leading" secondItem="reI-TL-hMa" secondAttribute="trailing" constant="5" id="NCp-A4-fbe"/> <constraint firstItem="MK0-Fw-fiO" firstAttribute="width" secondItem="Gtx-K4-ldi" secondAttribute="width" id="Nhf-NG-Bmn"/> <constraint firstItem="TQ0-7y-gmP" firstAttribute="leading" secondItem="A9R-Ja-bxD" secondAttribute="trailing" constant="11" id="O7C-da-RVS"/> <constraint firstAttribute="bottom" secondItem="MK0-Fw-fiO" secondAttribute="bottom" constant="20" id="R8O-yc-CxM"/> @@ -212,23 +212,23 @@ <constraint firstAttribute="trailing" secondItem="YCO-sD-KY4" secondAttribute="trailing" constant="8" id="Wh9-1t-F64"/> <constraint firstAttribute="bottom" secondItem="Gtx-K4-ldi" secondAttribute="bottom" constant="20" id="brJ-st-kuO"/> <constraint firstItem="reI-TL-hMa" firstAttribute="leading" secondItem="ea6-eG-h1P" secondAttribute="leading" constant="14" id="cAD-e4-anQ"/> + <constraint firstAttribute="width" secondItem="ea6-eG-h1P" secondAttribute="height" multiplier="1:1" id="cuM-Cc-QN6"/> <constraint firstItem="s9M-HC-hay" firstAttribute="top" secondItem="A9R-Ja-bxD" secondAttribute="bottom" constant="18" id="dWh-FY-cIf"/> - <constraint firstItem="YCO-sD-KY4" firstAttribute="leading" secondItem="Iwt-0W-DTT" secondAttribute="trailing" id="dih-tS-QhP"/> + <constraint firstItem="YCO-sD-KY4" firstAttribute="leading" secondItem="Iwt-0W-DTT" secondAttribute="trailing" constant="5" id="dih-tS-QhP"/> <constraint firstItem="MK0-Fw-fiO" firstAttribute="leading" secondItem="Gtx-K4-ldi" secondAttribute="trailing" constant="20" id="iiy-cI-0Cr"/> <constraint firstItem="Gtx-K4-ldi" firstAttribute="top" secondItem="YCO-sD-KY4" secondAttribute="bottom" constant="33" id="jEX-P7-jTU"/> - <constraint firstAttribute="height" constant="364" id="jRa-OG-3Na"/> - <constraint firstAttribute="trailing" secondItem="MK0-Fw-fiO" secondAttribute="trailing" constant="20" id="kKt-QK-ktq"/> + <constraint firstAttribute="trailing" secondItem="MK0-Fw-fiO" secondAttribute="trailing" constant="51" id="kKt-QK-ktq"/> <constraint firstAttribute="trailing" secondItem="bpE-eg-Ouo" secondAttribute="trailing" constant="10" id="ljo-a4-pHf"/> <constraint firstAttribute="trailing" secondItem="TQ0-7y-gmP" secondAttribute="trailing" constant="10" id="qMO-ac-jNi"/> <constraint firstItem="bpE-eg-Ouo" firstAttribute="leading" secondItem="s9M-HC-hay" secondAttribute="trailing" constant="11" id="rxk-cZ-TEc"/> <constraint firstItem="TQ0-7y-gmP" firstAttribute="centerY" secondItem="A9R-Ja-bxD" secondAttribute="centerY" id="u1V-GM-KFn"/> - <constraint firstItem="Gtx-K4-ldi" firstAttribute="leading" secondItem="ea6-eG-h1P" secondAttribute="leading" constant="20" id="wLW-ue-oaS"/> + <constraint firstItem="Gtx-K4-ldi" firstAttribute="leading" secondItem="ea6-eG-h1P" secondAttribute="leading" constant="51" id="wLW-ue-oaS"/> <constraint firstItem="YCO-sD-KY4" firstAttribute="centerY" secondItem="Iwt-0W-DTT" secondAttribute="centerY" id="zE5-0h-5Ug"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="boolean" keyPath="ld_maskToBoundsXIB" value="YES"/> <userDefinedRuntimeAttribute type="number" keyPath="ld_cornerRadiusXIB"> - <real key="value" value="20"/> + <real key="value" value="10"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> @@ -238,10 +238,11 @@ <constraints> <constraint firstItem="ea6-eG-h1P" firstAttribute="centerY" secondItem="vUN-kp-3ea" secondAttribute="centerY" id="NQB-Yk-deI"/> <constraint firstItem="ea6-eG-h1P" firstAttribute="centerX" secondItem="vUN-kp-3ea" secondAttribute="centerX" id="O4F-6H-Xnc"/> - <constraint firstItem="ea6-eG-h1P" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="45" id="nBX-7R-Vi3"/> - <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="ea6-eG-h1P" secondAttribute="trailing" constant="45" id="plg-Gp-drS"/> + <constraint firstItem="ea6-eG-h1P" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="14" id="nBX-7R-Vi3"/> + <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="ea6-eG-h1P" secondAttribute="trailing" constant="14" id="plg-Gp-drS"/> </constraints> <connections> + <outlet property="btn_complete" destination="MK0-Fw-fiO" id="tox-oF-9vT"/> <outlet property="label_city" destination="flf-S9-xVu" id="v3g-jV-5QT"/> <outlet property="label_currently" destination="sjM-7I-k3g" id="zoR-nM-OxD"/> <outlet property="label_province" destination="LHk-zb-Nvv" id="MLz-S0-HOJ"/> diff --git a/WanPai/Root/Search/TCell/CustomerContentQATCell.swift b/WanPai/Root/Search/TCell/CustomerContentQATCell.swift index a022e0b..5ba9fa5 100644 --- a/WanPai/Root/Search/TCell/CustomerContentQATCell.swift +++ b/WanPai/Root/Search/TCell/CustomerContentQATCell.swift @@ -12,7 +12,7 @@ var noticeItemModel:NoticeItemModel!{ didSet{ - label_content.text = noticeItemModel.noticeTitle + label_content.text = noticeItemModel.quesTitle } } diff --git a/WanPai/Root/Search/TCell/CustomerContentTCell.swift b/WanPai/Root/Search/TCell/CustomerContentTCell.swift index 32d5515..c500ca6 100644 --- a/WanPai/Root/Search/TCell/CustomerContentTCell.swift +++ b/WanPai/Root/Search/TCell/CustomerContentTCell.swift @@ -6,6 +6,7 @@ // import UIKit +import JQTools class CustomerContentTCell: UITableViewCell { @@ -17,7 +18,10 @@ didSet{ label_title.text = noticeItemModel.noticeTitle label_time.text = noticeItemModel.noticeTime - label_content.text = noticeItemModel.noticeContents + + let attribute = AttributedStringbuilder.build().add(string: noticeItemModel.noticeContents.jq_filterFromHTML_1(), withFont: .systemFont(ofSize: 13), withColor: UIColor(hexStr: "#3D3D3D"), lineSpace: 4).mutableAttributedString + label_content.attributedText = attribute + } } diff --git a/WanPai/Root/Search/VC/CustomerContentDetailVC.swift b/WanPai/Root/Search/VC/CustomerContentDetailVC.swift index 91bd525..2832b3a 100644 --- a/WanPai/Root/Search/VC/CustomerContentDetailVC.swift +++ b/WanPai/Root/Search/VC/CustomerContentDetailVC.swift @@ -13,7 +13,8 @@ @IBOutlet weak var label_title: UILabel! @IBOutlet weak var label_datetime: UILabel! @IBOutlet weak var webView: WKWebView! - + @IBOutlet weak var cons_webHei: NSLayoutConstraint! + private var id:Int! private var type:CustomerSubListVC.CustomerSubType! @@ -38,12 +39,37 @@ } Services.exploreNoticeDetail(id: id, type: type).subscribe(onNext: {[weak self] data in - self?.label_title.text = data.data?.noticeTitle - self?.label_datetime.text = data.data?.noticeTime - if let str = data.data?.noticeContents.jq_wrapHtml(){ - self?.webView.loadHTMLString(str, baseURL: nil) - } + if self?.type == .notice{ + self?.label_title.text = data.data?.noticeTitle + self?.label_datetime.text = data.data?.noticeTime + + if let str = data.data?.noticeContents.jq_wrapHtml(){ + self?.webView.loadHTMLString(str, baseURL: nil) + } + }else{ + self?.label_title.text = data.data?.quesTitle + self?.label_datetime.text = data.data?.quesTime + + if let str = data.data?.quesContents.jq_wrapHtml(){ + self?.webView.loadHTMLString(str, baseURL: nil) + } + } + }).disposed(by: disposeBag) } + + override func setRx() { + self.webView.scrollView.rx.observe(CGSize.self, "contentSize").map { (size) -> CGFloat? in + if let size = size{ + return size.height + } + return nil + }.subscribe(onNext: { [unowned self](height) in + if let height = height{ + self.cons_webHei.constant = height + } + }).disposed(by: disposeBag) + + } } diff --git a/WanPai/Root/Search/VC/CustomerContentDetailVC.xib b/WanPai/Root/Search/VC/CustomerContentDetailVC.xib index 1701e2e..a773924 100644 --- a/WanPai/Root/Search/VC/CustomerContentDetailVC.xib +++ b/WanPai/Root/Search/VC/CustomerContentDetailVC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="retina6_12" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> @@ -11,6 +11,7 @@ <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CustomerContentDetailVC" customModule="WanPai" customModuleProvider="target"> <connections> + <outlet property="cons_webHei" destination="oYe-Uw-ika" id="Wu3-Wt-tCb"/> <outlet property="label_datetime" destination="Djz-c0-gra" id="GQu-Lr-bvP"/> <outlet property="label_title" destination="kGn-Oc-Whe" id="3yp-CX-eR8"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> @@ -28,23 +29,29 @@ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Czw-Vk-ibj"> <rect key="frame" x="0.0" y="0.0" width="393" height="300"/> <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="标题" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kGn-Oc-Whe"> - <rect key="frame" x="175" y="20" width="43" height="29"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="标题" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kGn-Oc-Whe"> + <rect key="frame" x="20" y="20" width="353" height="29"/> <constraints> - <constraint firstAttribute="height" constant="29" id="iiz-B3-sh3"/> + <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="29" id="iiz-B3-sh3"/> </constraints> <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="21"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0000-00-00 00:00" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Djz-c0-gra"> - <rect key="frame" x="134" y="57" width="125" height="17"/> + <rect key="frame" x="134" y="57" width="125" height="25"/> + <constraints> + <constraint firstAttribute="height" constant="25" id="5Bx-Ig-3Pc"/> + </constraints> <fontDescription key="fontDescription" type="system" pointSize="14"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.40000000000000002" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="l7I-YB-nNr"> - <rect key="frame" x="0.0" y="92" width="393" height="208"/> + <rect key="frame" x="0.0" y="100" width="393" height="200"/> + <constraints> + <constraint firstAttribute="height" constant="200" id="oYe-Uw-ika"/> + </constraints> <wkWebViewConfiguration key="configuration"> <audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/> <wkPreferences key="preferences"/> @@ -58,9 +65,10 @@ <constraint firstAttribute="bottom" secondItem="l7I-YB-nNr" secondAttribute="bottom" id="8tA-CY-vTQ"/> <constraint firstItem="l7I-YB-nNr" firstAttribute="leading" secondItem="Czw-Vk-ibj" secondAttribute="leading" id="RCg-4C-Jjx"/> <constraint firstItem="l7I-YB-nNr" firstAttribute="top" secondItem="Djz-c0-gra" secondAttribute="bottom" constant="18" id="TwY-6Y-PJh"/> + <constraint firstItem="kGn-Oc-Whe" firstAttribute="leading" secondItem="Czw-Vk-ibj" secondAttribute="leading" constant="20" id="df6-bf-o0h"/> <constraint firstItem="kGn-Oc-Whe" firstAttribute="centerX" secondItem="Czw-Vk-ibj" secondAttribute="centerX" id="e2Q-5M-XYA"/> - <constraint firstAttribute="height" constant="300" id="frJ-0w-YdJ"/> <constraint firstItem="Djz-c0-gra" firstAttribute="top" secondItem="kGn-Oc-Whe" secondAttribute="bottom" constant="8" id="gFd-rf-Ccp"/> + <constraint firstAttribute="trailing" secondItem="kGn-Oc-Whe" secondAttribute="trailing" constant="20" id="nP3-H5-1M2"/> <constraint firstItem="Djz-c0-gra" firstAttribute="centerX" secondItem="kGn-Oc-Whe" secondAttribute="centerX" id="zY3-pn-xSJ"/> </constraints> </view> diff --git a/WanPai/Root/Search/VC/CustomerListVC.swift b/WanPai/Root/Search/VC/CustomerListVC.swift index 9e34763..c274b62 100644 --- a/WanPai/Root/Search/VC/CustomerListVC.swift +++ b/WanPai/Root/Search/VC/CustomerListVC.swift @@ -13,6 +13,8 @@ class CustomerListVC: BaseVC { + private var toPage:Int! + private var pageMenu:SPPageMenu = { let pageMenu = SPPageMenu(frame: .zero, trackerStyle: .line) // 追踪线 @@ -57,12 +59,24 @@ }() + init(page:Int = 0) { + super.init(nibName: nil, bundle: nil) + toPage = page + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override func viewDidLoad() { super.viewDidLoad() title = "客服中心" pageMenu.delegate = self pageViewController.delegate = self + + pageViewController.scroll(toPage: toPage, animation: false) + pageMenu.selectedItemIndex = toPage } @@ -97,26 +111,13 @@ } @objc func callPhoneAction(){ - - Services.customerPhone().subscribe(onNext: {[weak self] data in - guard let weakSelf = self else { return } - if let strings = data.data{ - - let vc = UIAlertController(title: "联系客服", message: nil, preferredStyle: .actionSheet) - for str in strings{ - vc.addAction(UIAlertAction(title: str, style: .default, handler: { _ in - UIApplication.shared.open(URL(string: "tell://\(str)")!, options: [:], completionHandler: nil) - })) - } - - vc.addAction(UIAlertAction(title: "取消", style: .cancel)) - vc.show() + Services.customerPhone().subscribe(onNext: { data in + if let phoneNumbers = data.data{ + CommonAlertSheetView.show(items: phoneNumbers) { index in + UIApplication.shared.open(URL(string: "tel://\(phoneNumbers[index])")!, options: [:], completionHandler: nil) + } } }).disposed(by: disposeBag) - - -// let url = URL(string: "tell://18111223301")! -// UIApplication.shared.open(url) } } diff --git a/WanPai/Root/Search/VC/CustomerSubListVC.swift b/WanPai/Root/Search/VC/CustomerSubListVC.swift index e2826af..ef2557e 100644 --- a/WanPai/Root/Search/VC/CustomerSubListVC.swift +++ b/WanPai/Root/Search/VC/CustomerSubListVC.swift @@ -51,10 +51,19 @@ super.viewDidLoad() if viewModel.type.value == .QA{ - let headView = UIView() - headView.backgroundColor = .jq_randomColor - headView.frame = CGRect(x: 0, y: 0, width: JQ_ScreenW, height: JQ_ScreenW * 0.564) - tableView.tableHeaderView = headView + + Services.bannerList(position: .qusition).subscribe(onNext: {[weak self]data in + if let models = data.data,models.count > 0{ + let bannberView = CommonBannerView(frame: CGRect(x: 0, y: 0, width: JQ_ScreenW, height: JQ_ScreenW * 0.564)) + self?.tableView.tableHeaderView = bannberView + bannberView.setImages(images: models.map({$0.img}), type: .URL) { index in + + } + self?.tableView.reloadData() + } + }) { error in + + }.disposed(by: disposeBag) } viewModel.configure(tableView,needMore: false) @@ -73,8 +82,16 @@ extension CustomerSubListVC:UITableViewDelegate{ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let model = viewModel.dataSource.value[indexPath.row] - let vc = CustomerContentDetailVC(id: model.noticeId, type: viewModel.type.value) - push(vc: vc) + + var id = 0 + if viewModel.type.value == .notice{ + id = model.noticeId + }else{ + id = model.quesId + } + + let vc = CustomerContentDetailVC(id: id, type: viewModel.type.value) + push(vc: vc) } } diff --git a/WanPai/Root/Search/VC/SearchVC.swift b/WanPai/Root/Search/VC/SearchVC.swift index 3605d06..18ef894 100644 --- a/WanPai/Root/Search/VC/SearchVC.swift +++ b/WanPai/Root/Search/VC/SearchVC.swift @@ -13,7 +13,8 @@ @IBOutlet weak var banner_collectionView: UICollectionView! @IBOutlet weak var label_empty: UILabel! @IBOutlet weak var view_container: UIView! -// @IBOutlet weak var cons_CollectionAspect: NSLayoutConstraint! + @IBOutlet weak var btn_special: UIButton! + // @IBOutlet weak var cons_CollectionAspect: NSLayoutConstraint! private var models = [StartClouseExploreModel]() private lazy var mapView:MAMapView = { @@ -81,6 +82,12 @@ push(vc: vc) } + @IBAction func privilegeAction(_ sender: UIButton) { + let vc = JoinMemberIntroduceVC() + push(vc: vc) + } + + @IBAction func aboutMinProgram(_ sender: Any) { CommonAlertView.show(title: "提示", content: "即将打开小程序,是否继续?") { status in diff --git a/WanPai/Root/Search/VC/SearchVC.xib b/WanPai/Root/Search/VC/SearchVC.xib index f0e7d2c..9435028 100644 --- a/WanPai/Root/Search/VC/SearchVC.xib +++ b/WanPai/Root/Search/VC/SearchVC.xib @@ -13,6 +13,7 @@ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SearchVC" customModule="WanPai" customModuleProvider="target"> <connections> <outlet property="banner_collectionView" destination="GVG-mQ-5A4" id="keS-lx-iWt"/> + <outlet property="btn_special" destination="5WV-eT-XUG" id="OzE-I1-cJB"/> <outlet property="label_empty" destination="FYv-6M-gC5" id="SA6-TH-Aqp"/> <outlet property="scrollView" destination="Jbe-CY-MmI" id="MM5-aA-VjT"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> @@ -52,18 +53,31 @@ <state key="normal" title="查看特权"> <color key="titleColor" name="FE6E0D"/> </state> + <connections> + <action selector="privilegeAction:" destination="-1" eventType="touchUpInside" id="Z4c-Kv-KQQ"/> + </connections> </button> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GgO-kO-a8k"> + <rect key="frame" x="163.66666666666666" y="115.33333333333333" width="66" height="1"/> + <color key="backgroundColor" name="FE6E0D"/> + <constraints> + <constraint firstAttribute="height" constant="1" id="5yd-wv-Of4"/> + </constraints> + </view> </subviews> <color key="backgroundColor" red="0.94901960784313721" green="0.95294117647058818" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstItem="uWB-gY-2cI" firstAttribute="centerX" secondItem="DGE-Vl-Na6" secondAttribute="centerX" id="1As-tk-5Wg"/> <constraint firstItem="DGE-Vl-Na6" firstAttribute="top" secondItem="EPq-uU-JgH" secondAttribute="top" id="2se-HH-eQh"/> + <constraint firstItem="5WV-eT-XUG" firstAttribute="leading" secondItem="GgO-kO-a8k" secondAttribute="leading" id="4Ik-Gv-p1R"/> <constraint firstAttribute="trailing" secondItem="DGE-Vl-Na6" secondAttribute="trailing" id="I9h-e1-P3P"/> <constraint firstAttribute="width" secondItem="EPq-uU-JgH" secondAttribute="height" multiplier="1:0.4974" id="JV4-yx-f0F"/> <constraint firstItem="uWB-gY-2cI" firstAttribute="top" secondItem="EPq-uU-JgH" secondAttribute="top" constant="65" id="Ljo-ro-H0i"/> <constraint firstItem="DGE-Vl-Na6" firstAttribute="leading" secondItem="EPq-uU-JgH" secondAttribute="leading" id="XMG-o9-rS5"/> <constraint firstItem="5WV-eT-XUG" firstAttribute="top" secondItem="uWB-gY-2cI" secondAttribute="bottom" constant="6" id="hcm-Wy-ZCQ"/> + <constraint firstItem="GgO-kO-a8k" firstAttribute="top" secondItem="5WV-eT-XUG" secondAttribute="bottom" constant="2" id="kGP-ew-4Ur"/> <constraint firstAttribute="bottom" secondItem="DGE-Vl-Na6" secondAttribute="bottom" id="qiC-fw-sLe"/> + <constraint firstItem="5WV-eT-XUG" firstAttribute="trailing" secondItem="GgO-kO-a8k" secondAttribute="trailing" id="sMv-ZJ-Lmf"/> <constraint firstItem="5WV-eT-XUG" firstAttribute="centerX" secondItem="uWB-gY-2cI" secondAttribute="centerX" id="zeI-yT-QNR"/> </constraints> </view> @@ -241,7 +255,7 @@ <constraint firstAttribute="trailing" secondItem="Jbe-CY-MmI" secondAttribute="trailing" id="OdW-Am-JXo"/> <constraint firstItem="Jbe-CY-MmI" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="rgC-is-DeR"/> </constraints> - <point key="canvasLocation" x="71" y="21"/> + <point key="canvasLocation" x="70.992366412213741" y="20.422535211267608"/> </view> </objects> <resources> diff --git a/WanPai/Root/Welfare/VC/CoinStoreCenterVC.swift b/WanPai/Root/Welfare/VC/CoinStoreCenterVC.swift index ed90f8b..dbac611 100644 --- a/WanPai/Root/Welfare/VC/CoinStoreCenterVC.swift +++ b/WanPai/Root/Welfare/VC/CoinStoreCenterVC.swift @@ -67,11 +67,26 @@ 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 + }else{ + Services.benefitHome().subscribe(onNext: {[weak self] data in + guard let weakSelf = self else { return } + if let model = data.data{ + self?.headView.label_coin.text = "\(model.userIntegral)积分" + self?.headView.label_username.text = model.userName + self?.headView.img_cover.sd_setImage(with: URL(string: model.userHeadImg)) + self?.headView.integral = model.userIntegral + } + }) { error in + + }.disposed(by: disposeBag) } } + override func setRx() { + headView.tf_search.rx.text.orEmpty.bind(to: viewModel.search).disposed(by: disposeBag) + } + override func setUI() { view.addSubview(headView) headView.snp.makeConstraints { make in diff --git a/WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.swift b/WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.swift index 88fc240..a657f5c 100644 --- a/WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.swift +++ b/WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.swift @@ -80,13 +80,23 @@ weakSelf.label_coin.attributedText = AttributedStringbuilder.build().add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")).add(string: "\(model.wanpaiGold)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString - weakSelf.img_intro.sd_setImage(with: URL(string: model.introduceDrawing)) {[weak self] image, error, type, url in + weakSelf.img_intro.sd_setImage(with: URL(string: model.detailDrawing)) {[weak self] image, error, type, url in if let img = image{ self?.img_intro.image = img let radio = img.size.width / img.size.height self?.cons_imgIntroHei.constant = JQ_ScreenW / radio } } + + weakSelf.img_intro2.sd_setImage(with: URL(string: model.introduceDrawing)) {[weak self] image, error, type, url in + if let img = image{ + self?.img_intro2.image = img + let radio = img.size.width / img.size.height + self?.cons_imgIntro2Hei.constant = JQ_ScreenW / radio + } + } + + } }).disposed(by: disposeBag) diff --git a/WanPai/Root/Welfare/VC/WelfareWeeklyListVC.swift b/WanPai/Root/Welfare/VC/WelfareWeeklyListVC.swift index 2026bdc..6e5f7e1 100644 --- a/WanPai/Root/Welfare/VC/WelfareWeeklyListVC.swift +++ b/WanPai/Root/Welfare/VC/WelfareWeeklyListVC.swift @@ -12,6 +12,8 @@ class WelfareWeeklyListVC: BaseVC { + private var toPage:Int! + private var pageMenu:SPPageMenu = { let pageMenu = SPPageMenu(frame: .zero, trackerStyle: .line) // 追踪线 @@ -49,6 +51,15 @@ return pageVC }() + init(page:Int = 0) { + super.init(nibName: nil, bundle: nil) + toPage = page + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override func viewDidLoad() { super.viewDidLoad() title = "本周福利" @@ -56,6 +67,9 @@ pageMenu.delegate = self pageViewController.delegate = self + pageViewController.scroll(toPage: toPage, animation: false) + pageMenu.selectedItemIndex = toPage + } override func setUI() { diff --git a/WanPai/Root/Yard/VC/YardListVC.swift b/WanPai/Root/Yard/VC/YardListVC.swift index 1395464..f7a6f2a 100644 --- a/WanPai/Root/Yard/VC/YardListVC.swift +++ b/WanPai/Root/Yard/VC/YardListVC.swift @@ -15,12 +15,12 @@ var startDate = BehaviorRelay<String?>(value:nil) var endDate = BehaviorRelay<String?>(value:nil) var siteType = BehaviorRelay<NormalSimpleModel?>(value:nil) - var inStore = BehaviorRelay<NormalSimpleModel?>(value:nil) + var selectStore = BehaviorRelay<NormalSimpleModel?>(value:nil) var city = BehaviorRelay<CityProfileModel?>(value:nil) override func api() -> (Observable<BaseResponse<[SiteItemModel]>>)? { - return Services.querySiteList(pageNum: page, pageSize: pageSize, siteTypeId: siteType.value?.id, cityCode: city.value?.code, storeId: inStore.value?.id, startTime: startDate.value, endTime: endDate.value) + return Services.querySiteList(pageNum: page, pageSize: pageSize, siteTypeId: siteType.value?.id, cityCode: city.value?.code, storeId: selectStore.value?.id, startTime: startDate.value, endTime: endDate.value) } } @@ -43,8 +43,14 @@ private var selectStoreModel:NormalSimpleModel? private let viewModel = YardListViewModel() - + init(selectStore:NormalSimpleModel? = nil) { + super.init(nibName: nil, bundle: nil) + if selectStore != nil{ + viewModel.selectStore.accept(selectStore) + } + } + override func viewDidLoad() { super.viewDidLoad() title = "预约场地" @@ -85,6 +91,7 @@ tableView.separatorStyle = .none tableView.register(UINib(nibName: "YardTCell", bundle: nil), forCellReuseIdentifier: "_YardTCell") tableView.jq_setEmptyView() + btn_stores.setTitle(viewModel.selectStore.value?.name ?? "所在门店", for: .normal) } override func setRx() { @@ -152,14 +159,14 @@ guard !sender.isSelected else {return} closeAction() sender.isSelected = true - inStoreView = CourseSubTypeView.show(inView: self.view, afterView: view_top, items: storeItems,selectModel: viewModel.inStore.value) { [weak self] m in + inStoreView = CourseSubTypeView.show(inView: self.view, afterView: view_top, items: storeItems,selectModel: viewModel.selectStore.value) { [weak self] m in sender.isSelected = false if m.id == 0{ sender.setTitle("所在门店", for: .normal) - self?.viewModel.inStore.accept(nil) + self?.viewModel.selectStore.accept(nil) }else{ sender.setTitle(m.name, for: .normal) - self?.viewModel.inStore.accept(m) + self?.viewModel.selectStore.accept(m) } self?.viewModel.beginRefresh() } closeClouse: { @@ -177,6 +184,10 @@ cityChooseSubTypeView?.removeFromSuperview() inStoreView?.removeFromSuperview() } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } } extension YardListVC:UITableViewDelegate{ -- Gitblit v1.7.1