WanPai.xcodeproj/project.pbxproj
@@ -25,6 +25,8 @@ 130E40262A4EC029003A3D75 /* SearchStoreDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 130E40242A4EC029003A3D75 /* SearchStoreDetailVC.swift */; }; 130E402A2A4EC33C003A3D75 /* SearchStoreDetailHeadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 130E40292A4EC33C003A3D75 /* SearchStoreDetailHeadView.swift */; }; 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 */; }; 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 */; }; @@ -311,6 +313,8 @@ 130E40242A4EC029003A3D75 /* SearchStoreDetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchStoreDetailVC.swift; sourceTree = "<group>"; }; 130E40292A4EC33C003A3D75 /* SearchStoreDetailHeadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchStoreDetailHeadView.swift; sourceTree = "<group>"; }; 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>"; }; 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>"; }; @@ -1030,6 +1034,8 @@ 8D8400E82A2F14A3003AF6A2 /* LoginVC.xib */, 8DFA9B742A316E9A00E99281 /* LoginRegOrForgotVC.swift */, 8DFA9B752A316E9A00E99281 /* LoginRegOrForgotVC.xib */, 130EC17B2AD3905F003CA9BA /* BindPhoneVC.swift */, 130EC17C2AD3905F003CA9BA /* BindPhoneVC.xib */, ); path = VC; sourceTree = "<group>"; @@ -1483,6 +1489,7 @@ 13B640C12A54108B00EA33ED /* UploadImgCCell.xib in Resources */, 8D8DEDF32A31DDC500F2C7FA /* CouponCCell.xib in Resources */, 138D8B8F2A3FFE36009DCA9E /* YardListVC.xib in Resources */, 130EC17E2AD3905F003CA9BA /* BindPhoneVC.xib in Resources */, 8D4905AE2A31AE7100E38513 /* JoinMemberIntroduceVC.xib in Resources */, 13EC6DDD2A493D23009FC09A /* WelfareCoinCCell.xib in Resources */, 8DF184452A332CCD0095687B /* StudentInfoTCell.xib in Resources */, @@ -1762,6 +1769,7 @@ 8D79A5932A395BF40029874B /* ActivityStudentListVC.swift in Sources */, 13FB93B92A5C028D009F558A /* FinanceTrafer.swift in Sources */, 8D6E54D12A381CB000D750CE /* ActivityDetailVC.swift in Sources */, 130EC17D2AD3905F003CA9BA /* BindPhoneVC.swift in Sources */, 8D5C15062A31861D00A8BCC9 /* TapBtn.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; WanPai/AppDelegate.swift
@@ -11,7 +11,7 @@ import AMapFoundationKit @main class AppDelegate: UIResponder, UIApplicationDelegate,WXApiDelegate { class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var orientation:UIInterfaceOrientationMask = .portrait @@ -19,11 +19,17 @@ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Services.startNetworkMonitor() // WXApi.startLog(by: .normal) { text in // print("LOGO====>\(text)\n") // } YYPaymentManager.shared.configuredWeChat(appID: WeChatAPPID, universalLink: WechatUniversalLinks) YYPaymentManager.shared.configuredAlipay(appScheme: APPScheme) AMapServices.shared().enableHTTPS = true AMapServices.shared().apiKey = AMapKey // WXApi.checkUniversalLinkReady { step, result in // print("====>\(step.rawValue):\(result.errorInfo)====\(result.suggestion)\n") // // } return true } @@ -50,28 +56,27 @@ } func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { print("---->") return YYPaymentManager.shared.handleApplication(application, open: url, sourceApplication: sourceApplication, annotation: annotation) } func application(_ application: UIApplication, handleOpen url: URL) -> Bool { if ((url.scheme?.contains("wechat")) != nil){ return WXApi.handleOpen(url, delegate: self) } print("---->1") return YYPaymentManager.shared.handleApplication(application, handleOpen: url) } // NOTE: 9.0以后使用新API接口 func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { if ((url.scheme?.contains("wechat")) != nil){ return WXApi.handleOpen(url, delegate: self) } print("---->2") return YYPaymentManager.shared.handleApplication(app, open: url, options: options) } func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { return WXApi.handleOpenUniversalLink(userActivity, delegate: self) print("---->3") return YYPaymentManager.shared.handleApplication(userActivity) } } extension AppDelegate{ @@ -109,15 +114,5 @@ loginNav.modalPresentationStyle = .fullScreen JQ_currentViewController().present(loginNav, animated: true) } } extension AppDelegate{ func onReq(_ req: BaseReq) { } func onResp(_ resp: BaseResp) { } } WanPai/Assets.xcassets/Bg/b_1.imageset/1@2x.png
WanPai/Assets.xcassets/Bg/b_1.imageset/1@3x.png
WanPai/Assets.xcassets/Bg/b_1.imageset/Contents.json
@@ -5,12 +5,12 @@ "scale" : "1x" }, { "filename" : "b_1@2x.png", "filename" : "1@2x.png", "idiom" : "universal", "scale" : "2x" }, { "filename" : "b_1@3x.png", "filename" : "1@3x.png", "idiom" : "universal", "scale" : "3x" } WanPai/Assets.xcassets/Bg/b_1.imageset/b_1@2x.pngBinary files differ
WanPai/Assets.xcassets/Bg/b_1.imageset/b_1@3x.pngBinary files differ
WanPai/Assets.xcassets/Bg/b_5.imageset/1备份 2@2x.pngWanPai/Assets.xcassets/Bg/b_5.imageset/1备份 2@3x.png
WanPai/Assets.xcassets/Bg/b_5.imageset/Contents.json
@@ -5,12 +5,12 @@ "scale" : "1x" }, { "filename" : "b_5@2x.png", "filename" : "1备份 2@2x.png", "idiom" : "universal", "scale" : "2x" }, { "filename" : "b_5@3x.png", "filename" : "1备份 2@3x.png", "idiom" : "universal", "scale" : "3x" } WanPai/Assets.xcassets/Bg/b_5.imageset/b_5@3x.pngBinary files differ
WanPai/Assets.xcassets/Bg/b_8.imageset/Contents.json
@@ -5,12 +5,12 @@ "scale" : "1x" }, { "filename" : "b_7@2x.png", "filename" : "编组 2备份 3@2x.png", "idiom" : "universal", "scale" : "2x" }, { "filename" : "b_7@3x.png", "filename" : "编组 2备份 3@3x.png", "idiom" : "universal", "scale" : "3x" } WanPai/Assets.xcassets/Bg/b_8.imageset/b_7@2x.pngBinary files differ
WanPai/Assets.xcassets/Bg/b_8.imageset/b_7@3x.pngBinary files differ
WanPai/Assets.xcassets/Bg/b_8.imageset/编组 2备份 3@2x.png
WanPai/Assets.xcassets/Bg/b_8.imageset/编组 2备份 3@3x.png
WanPai/Common/Layout/WaterFallFlowLayout.swift
@@ -16,8 +16,9 @@ weak var delegate: WaterFallLayoutDelegate? // 列数 var cols = 4 var itemCount:Int = 0 // 布局数组 fileprivate var layoutAttributeArray: [UICollectionViewLayoutAttributes] = [] var layoutAttributeArray: [UICollectionViewLayoutAttributes] = [] // 高度数组 fileprivate lazy var yArray: [CGFloat] = Array(repeating: self.sectionInset.top, count: cols) @@ -28,7 +29,7 @@ // 计算每个 Cell 的宽度 let itemWidth = (collectionView!.bounds.width - sectionInset.left - sectionInset.right - minimumInteritemSpacing * CGFloat(cols - 1)) / CGFloat(cols) // Cell 数量 let itemCount = collectionView!.numberOfItems(inSection: 0) // let itemCount = collectionView!.numberOfItems(inSection: 0) // 最小高度索引 var minHeightIndex = 0 // 遍历 item 计算并缓存属性 WanPai/Config/Def.swift
@@ -12,7 +12,7 @@ import QMUIKit let SHAKEY = "BT7NPhA0f775uzcUuftWjCE1TYZlWmHZ" let WechatUniversalLinks = "https://www.weparklife.com/app/" let WechatUniversalLinks = "https://www.weparklife.com/" let WeChatAPPID = "wx41d32f362ba0f911" let WeChatSecrect = "cf0ebf950f5926a69041a0e2bbe20f3e" let APPScheme = "weparklife" @@ -84,3 +84,10 @@ SVProgressHUD.dismiss() } } 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) } } WanPai/Config/Enums.swift
@@ -50,6 +50,7 @@ case register = 2 case updatePwd = 3 case forgotPwd = 4 case bindPhone = 5 var titleStr:String{ switch self { @@ -61,6 +62,8 @@ return "修改密码" case .forgotPwd: return "忘记密码" case .bindPhone: return "绑定手机号" } } } WanPai/Info.plist
@@ -20,6 +20,12 @@ <string>wx41d32f362ba0f911</string> </array> </dict> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array/> </dict> </array> <key>LSApplicationQueriesSchemes</key> <array> WanPai/Network/Services.swift
@@ -120,6 +120,15 @@ return NetworkRequest.request(params: params, method: .post, progress: true) } class func wxLogin(openId:String,nickname:String,headimgurl:String)->Observable<BaseResponse<SimpleModel>>{ let params = ParamsAppender.build(url: All_Url) .interface(url: "/account/base/appUser/loginWeChat") .append(key: "openId", value: openId) .append(key: "nickname", value: nickname) .append(key: "headimgurl", value: headimgurl) return NetworkRequest.request(params: params, method: .post, progress: true) } class func getSMSCode(phone:String,type:GetSMSCodeType)->Observable<BaseResponse<SimpleModel>>{ let params = ParamsAppender.build(url: All_Url) .interface(url: "/account/base/appUser/getSMSCode") @@ -186,7 +195,7 @@ let params = ParamsAppender.build(url: All_Url) .interface(url: "/other/base/store/queryIndexSet") .append(key: "id", value: storeId) return NetworkRequest.request(params: params, method: .post, progress: false) return NetworkRequest.request(params: params, method: .post, progress: true) } /// 主页配置 @@ -194,7 +203,7 @@ let params = ParamsAppender.build(url: All_Url) .interface(url: "/other/base/store/queryStoreConfig") .append(key: "storeId", value: storeId) return NetworkRequest.request(params: params, method: .post, progress: false) return NetworkRequest.request(params: params, method: .post, progress: true) } WanPai/Root/Course/VC/CourseInfoVC.swift
@@ -298,18 +298,21 @@ private func getSelectDayData(){ if let model = startClouseHomeModel{ let currentStoreId = UserDefaults.standard.value(forKey: "Current_StoreID") Services.weeksOfCourseDetails(stuId: model.stuId, time: currentDate,storeId: currentStoreId as! Int).subscribe(onNext: {[weak self] data in if let model = data.data{ self?.weeklyCourseModel = model self?.cons_tableHei.constant = 58 + 70 * Double(model.data.count) UIView.animate(withDuration: 0.3) { self?.view.layoutIfNeeded() self?.viewDidLayoutSubviews() } self?.tableView.reloadData() } }).disposed(by: disposeBag) if let storeStr = UserDefaults.standard.object(forKey: "CurrentStore") as? String{ if let deserModel = HomeStoreModel.deserialize(from: storeStr){ Services.weeksOfCourseDetails(stuId: model.stuId, time: currentDate,storeId: deserModel.storeId).subscribe(onNext: {[weak self] data in if let model = data.data{ self?.weeklyCourseModel = model self?.cons_tableHei.constant = 58 + 70 * Double(model.data.count) UIView.animate(withDuration: 0.3) { self?.view.layoutIfNeeded() self?.viewDidLayoutSubviews() } self?.tableView.reloadData() } }).disposed(by: disposeBag) } } } } WanPai/Root/Home/Model/HomeModel.swift
@@ -25,7 +25,7 @@ var sort:Int = 0 var backgroundImage:String = "" // var defaultImg:UIImage? var radio:Double = 1.0 var cellHeight:Double = 270 } struct NormalSimpleModel:HandyJSON{ WanPai/Root/Home/VC/HomeVC.swift
@@ -15,34 +15,20 @@ //http://vjs.zencdn.net/v/oceans.mp4 //https://media.w3.org/2010/05/sintel/trailer.mp4 class HomeViewModel:RefreshModel<HomeStoreConfigModel>{ let storeId = BehaviorRelay<Int>(value: 0) override func api() -> (Observable<BaseResponse<[HomeStoreConfigModel]>>)? { return Services.homeStoreConfig(storeId: storeId.value) } } class HomeVC: BaseVC{ @IBOutlet weak var collectionView: BaseCollectionView! @IBOutlet weak var label_vipInfo: UILabel! @IBOutlet weak var view_banner: CommonBannerView! private var layout:WaterFallFlowLayout! @IBOutlet weak var label_store: UILabel! private var items = Array<HomeStoreConfigModel>() private var storeModel:HomeStoreModel? var viewModel = HomeViewModel() override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if storeModel == nil{ startLocation() } } private var storeId:Int? private var currentLocal:CLLocation? override func viewDidLoad() { super.viewDidLoad() viewModel.configure(collectionView,needMore: false) startLocation() Services.startCourseHome().subscribe(onNext: {[weak self] data in @@ -60,60 +46,17 @@ } } }).disposed(by: disposeBag) } override func setRx() { viewModel.storeId.subscribe(onNext: { id in UserDefaults.standard.set(id, forKey: "Current_StoreID") UserDefaults.standard.synchronize() Services.bannerList(position: .homeTop).subscribe(onNext: {[weak self] data in if let models = data.data{ let imgs = models.compactMap({$0.img}) self?.view_banner.setImages(images: imgs, type: .URL) { index in } } }) { error in }.disposed(by: disposeBag) viewModel.dataSource.subscribe(onNext: {[weak self] data in guard let weakSelf = self else { return } guard data.count != 0 else {return} weakSelf.items = data let group = DispatchGroup() let queue = DispatchQueue(label: "imgRadio") queue.async(group: group){ group.enter() Services.homeStoreConfig2(storeId: weakSelf.viewModel.storeId.value).subscribe(onNext: { data in if let items = data.data{ weakSelf.items.append(contentsOf: items) var i = 0 for (_,model) in weakSelf.items.enumerated(){ SDWebImageDownloader.shared.downloadImage(with: URL(string: model.backgroundImage)) { image, data, error, status in if let i = image{ model.radio = i.size.width / i.size.height }else{ model.radio = model.type.defaultImg.size.width / model.type.defaultImg.size.height } i += 1 if i == weakSelf.items.count - 1{ group.leave() } } } } }) { error in group.leave() }.disposed(by: weakSelf.disposeBag) } group.notify(queue: .main){ //重置Layout,不然不更新 self!.layout = WaterFallFlowLayout() self!.layout.cols = 2 self!.layout.sectionInset = UIEdgeInsets(top: 14, left: 34, bottom: 14, right: 34) self!.layout.delegate = self self!.collectionView.collectionViewLayout = self!.layout self!.collectionView.reloadData() } }).disposed(by: disposeBag) } @@ -140,21 +83,21 @@ if let storeStr = UserDefaults.standard.object(forKey: "CurrentStore") as? String{ if let deserModel = HomeStoreModel.deserialize(from: storeStr){ self?.label_store.text = deserModel.name.isEmpty ? "门店获取失败":deserModel.name self?.viewModel.storeId.accept(deserModel.storeId) self?.storeModel = deserModel self?.storeId = deserModel.storeId if deserModel.isVip == 0{text.append("\n加入我们 成为会员")} self?.label_vipInfo.text = text } }else{ self?.viewModel.storeId.accept(m.storeId) self?.label_store.text = m.name.isEmpty ? "门店获取失败":m.name UserDefaults.standard.set(m.toJSONString(), forKey: "CurrentStore") UserDefaults.standard.synchronize() self?.storeModel = m self?.storeId = m.storeId if m.isVip == 0{text.append("\n加入我们 成为会员")} self?.label_vipInfo.text = text } self?.viewModel.beginRefresh() self?.getStoreItemList() } } }) { [weak self] error in @@ -162,14 +105,74 @@ }.disposed(by: disposeBag) } private func getStoreItemList(){ showHUD() items.removeAll() let group = DispatchGroup() let queue = DispatchQueue(label: "imgRadio") queue.async(group: group){[weak self] () in guard let weakSelf = self else { return } group.enter() Services.homeStoreConfig(storeId: weakSelf.storeId!).subscribe(onNext: {[weak self] data in self?.items.append(contentsOf: (data.data ?? []).filter({$0.isOpen == 1})) Services.homeStoreConfig2(storeId: weakSelf.storeId!).subscribe(onNext: {[weak self] data in self?.items.append(contentsOf: (data.data ?? [])) group.leave() }) { error in group.leave() }.disposed(by: weakSelf.disposeBag) }) { error in group.leave() }.disposed(by: weakSelf.disposeBag) } group.notify(queue: .main){[weak self] () in guard let weakSelf = self else { return } var i = 0 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 } completed: { image, data, error, status in if let img = image{ 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) } 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() } } } } } private func startLocation(){ locationTool.startLocation { [weak self] local in locationTool.stopLocation() self?.getStoreInfo() guard self!.currentLocal != nil else { self!.currentLocal = local self!.getStoreInfo() locationTool.stopLocation() return } } errorClouse: { [weak self] error in alertError(msg: "定位获取失败") self?.label_store.text = "定位获取失败" self?.getStoreInfo() } } @@ -190,14 +193,10 @@ @IBAction func chooseStoresAction(_ sender: TapBtn) { StoresChooseView.show { [weak self] storeId,storeName in guard let weakSelf = self else { return } weakSelf.viewModel.storeId.accept(storeId) weakSelf.storeId = storeId weakSelf.label_store.text = storeName weakSelf.layout = WaterFallFlowLayout() weakSelf.layout.cols = 2 weakSelf.layout.sectionInset = UIEdgeInsets(top: 14, left: 34, bottom: 14, right: 34) weakSelf.layout.delegate = self! weakSelf.collectionView.collectionViewLayout = weakSelf.layout weakSelf.viewModel.beginRefresh() weakSelf.items.removeAll() weakSelf.getStoreItemList() } } @@ -208,13 +207,6 @@ extension HomeVC:UICollectionViewDelegate{ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { // let vc = JQ_CommonWebViewController(url: "http://192.168.110.103:8080/#/packageA/shares/index") // vc.modalPresentationStyle = .fullScreen // present(vc, animated: true) // push(vc: vc) // return let item = items[indexPath.row] switch item.type{ @@ -239,12 +231,12 @@ let vc = WelfareWeeklyListVC() push(vc: vc) case .wisdomCourt: guard viewModel.storeId.value != 0 else {alert(msg: "请先选择门店");return} guard storeId != 0 else {alert(msg: "请先选择门店");return} let vc = GamesVC() push(vc: vc) case .welfare: if viewModel.storeId.value != 0{ Services.queryStoreFreeBenefit(id: viewModel.storeId.value).subscribe(onNext: {[weak self] data in 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) @@ -263,7 +255,7 @@ 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: .highPriority) cell.img.sd_setImage(with: URL(string: item.backgroundImage), placeholderImage: item.type.defaultImg, options: .lowPriority) cell.img.cornerRadius = 10 return cell } @@ -277,8 +269,8 @@ extension HomeVC: WaterFallLayoutDelegate{ func waterFlowLayout(_ waterFlowLayout: WaterFallFlowLayout, itemHeight indexPath: IndexPath) -> CGFloat { let item = items[indexPath.row] let w = (view.frame.width - 68 - waterFlowLayout.minimumLineSpacing) / Double(waterFlowLayout.cols) return w / item.radio print("===\(item.cellHeight)") return item.cellHeight } } WanPai/Root/Home/VC/HomeVC.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="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"/> @@ -15,6 +15,7 @@ <outlet property="label_store" destination="VD5-cz-3Fs" id="azK-up-VpY"/> <outlet property="label_vipInfo" destination="Y4w-3W-3I4" id="Daq-hU-gwK"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view_banner" destination="pid-yy-hW2" id="rTZ-ed-R4u"/> </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> @@ -31,6 +32,9 @@ <constraint firstAttribute="width" secondItem="l0X-uU-o8F" secondAttribute="height" multiplier="1:0.605" id="zJ9-xI-msc"/> </constraints> </imageView> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pid-yy-hW2" customClass="CommonBannerView" customModule="WanPai" customModuleProvider="target"> <rect key="frame" x="0.0" y="0.0" width="393" height="237.66666666666666"/> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="CWt-Cn-ccL" customClass="TapBtn" customModule="WanPai" customModuleProvider="target"> <rect key="frame" x="38" y="207.66666666666666" width="317" height="59.999999999999972"/> <subviews> @@ -88,7 +92,7 @@ <action selector="chooseStoresAction:" destination="-1" eventType="touchUpInside" id="vqn-zH-FF6"/> </connections> </view> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y4w-3W-3I4"> <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y4w-3W-3I4"> <rect key="frame" x="18" y="126.66666666666669" width="206.33333333333334" height="43"/> <string key="text">欢迎来到 快乐运动俱乐部 加入我们 成为会员</string> @@ -96,7 +100,7 @@ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Welcome!" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Rlx-Vs-UDB"> <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Welcome!" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Rlx-Vs-UDB"> <rect key="frame" x="18.999999999999993" y="89.666666666666671" width="102.33333333333331" height="31"/> <constraints> <constraint firstAttribute="height" constant="31" id="uJ5-bz-dlr"/> @@ -105,7 +109,7 @@ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="poJ-Yp-Ex1"> <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="poJ-Yp-Ex1"> <rect key="frame" x="18" y="126.66666666666669" width="206.33333333333334" height="43"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <connections> @@ -136,10 +140,14 @@ <constraint firstAttribute="trailing" secondItem="CWt-Cn-ccL" secondAttribute="trailing" constant="38" id="W35-gE-yoZ"/> <constraint firstAttribute="width" secondItem="WGQ-UH-Uvg" secondAttribute="height" multiplier="1:0.7384" id="ayQ-vi-dn2"/> <constraint firstItem="poJ-Yp-Ex1" firstAttribute="top" secondItem="Y4w-3W-3I4" secondAttribute="top" id="c2v-L3-vtt"/> <constraint firstItem="pid-yy-hW2" firstAttribute="top" secondItem="WGQ-UH-Uvg" secondAttribute="top" id="ezY-cl-VFO"/> <constraint firstItem="CWt-Cn-ccL" firstAttribute="leading" secondItem="WGQ-UH-Uvg" secondAttribute="leading" constant="38" id="fMC-5l-99c"/> <constraint firstItem="Y4w-3W-3I4" firstAttribute="top" secondItem="Rlx-Vs-UDB" secondAttribute="bottom" constant="6" id="jcE-MI-qgw"/> <constraint firstItem="CWt-Cn-ccL" firstAttribute="top" secondItem="pid-yy-hW2" secondAttribute="bottom" constant="-30" id="kIg-Gs-q0g"/> <constraint firstItem="CWt-Cn-ccL" firstAttribute="top" secondItem="l0X-uU-o8F" secondAttribute="bottom" constant="-30" id="qe2-5A-ExK"/> <constraint firstItem="CWt-Cn-ccL" firstAttribute="top" secondItem="Y4w-3W-3I4" secondAttribute="bottom" constant="38" id="vwl-2A-Xaa"/> <constraint firstAttribute="trailing" secondItem="pid-yy-hW2" secondAttribute="trailing" id="x87-cv-usz"/> <constraint firstItem="pid-yy-hW2" firstAttribute="leading" secondItem="WGQ-UH-Uvg" secondAttribute="leading" id="y7p-rN-LaS"/> </constraints> </view> <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="ysy-N3-BCh" customClass="BaseCollectionView" customModule="WanPai" customModuleProvider="target"> WanPai/Root/Login/VC/BindPhoneVC.swift
New file @@ -0,0 +1,46 @@ // // BindPhoneVC.swift // WanPai // // Created by 无故事王国 on 2023/10/9. // import UIKit import QMUIKit import JQTools class BindPhoneVC: BaseVC { @IBOutlet weak var tf_phone: QMUITextField! @IBOutlet weak var tf_code: QMUITextField! @IBOutlet weak var btn_code: UIButton! override func viewDidLoad() { super.viewDidLoad() title = "绑定手机号" } @IBAction func getCodeAction(_ sender: UIButton) { guard tf_phone.text!.jq_isPhone else { alert(msg: "请输入正确的手机号码");return } Services.getSMSCode(phone: tf_phone.text!, type: .bindPhone).subscribe(onNext: {result in sender.jq_openCountDown() }) { error in alertError(msg: error.localizedDescription) }.disposed(by: disposeBag) } @IBAction func bindAction(_ sender: UIButton) { guard tf_phone.text!.jq_isPhone else { alert(msg: "请输入正确的手机号码");return } guard !tf_code.text!.isEmpty else { alert(msg: "请输入验证码");return } } } WanPai/Root/Login/VC/BindPhoneVC.xib
New file @@ -0,0 +1,164 @@ <?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="Named colors" minToolsVersion="9.0"/> <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" customClass="BindPhoneVC" customModule="WanPai" customModuleProvider="target"> <connections> <outlet property="btn_code" destination="HBj-1e-rHP" id="aVH-jy-57q"/> <outlet property="tf_code" destination="uLi-4i-BeV" id="U7P-Sg-0pn"/> <outlet property="tf_phone" destination="38t-oZ-Tdy" id="fBc-VT-npA"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> <rect key="frame" x="0.0" y="0.0" width="393" height="852"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_LOGO" translatesAutoresizingMaskIntoConstraints="NO" id="7pY-Sh-GDo"> <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"/> <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"/> </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"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <textInputTraits key="textInputTraits" keyboardType="numberPad"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="number" keyPath="maximumTextLength"> <integer key="value" value="11"/> </userDefinedRuntimeAttribute> <userDefinedRuntimeAttribute type="color" keyPath="placeholderColor"> <color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.40000000000000002" colorSpace="custom" customColorSpace="sRGB"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </textField> </subviews> <color key="backgroundColor" red="0.96470588239999999" green="0.96470588239999999" blue="0.96470588239999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstItem="Uoj-6E-rpY" firstAttribute="centerY" secondItem="WPl-pn-8JJ" secondAttribute="centerY" id="4J2-H5-ZEH"/> <constraint firstItem="Uoj-6E-rpY" firstAttribute="leading" secondItem="WPl-pn-8JJ" secondAttribute="leading" constant="31" id="CCG-0u-7YD"/> <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 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"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7iL-m6-Iwb"> <rect key="frame" x="40" y="241" width="313" height="40"/> <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"/> </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"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <textInputTraits key="textInputTraits" spellCheckingType="no" keyboardType="numberPad" enablesReturnKeyAutomatically="YES" secureTextEntry="YES" smartQuotesType="no"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="number" keyPath="maximumTextLength"> <integer key="value" value="6"/> </userDefinedRuntimeAttribute> <userDefinedRuntimeAttribute type="color" keyPath="placeholderColor"> <color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.40000000000000002" colorSpace="custom" customColorSpace="sRGB"/> </userDefinedRuntimeAttribute> </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"/> <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="获取验证码"> <color key="titleColor" red="0.38823529410000002" green="0.74117647060000003" blue="0.85882352939999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </state> <connections> <action selector="getCodeAction:" destination="-1" eventType="touchUpInside" id="t9p-aX-hWc"/> </connections> </button> </subviews> <color key="backgroundColor" red="0.96470588239999999" green="0.96470588239999999" blue="0.96470588239999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="bottom" secondItem="uLi-4i-BeV" secondAttribute="bottom" id="9Mf-8a-tKC"/> <constraint firstItem="uLi-4i-BeV" firstAttribute="top" secondItem="7iL-m6-Iwb" secondAttribute="top" id="GAv-ft-2sv"/> <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 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"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="E2r-yp-uyh"> <rect key="frame" x="40" y="768" width="313" height="40"/> <color key="backgroundColor" name="FE6E0D"/> <constraints> <constraint firstAttribute="height" constant="40" id="kGD-cK-owa"/> </constraints> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="确认绑定"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="boolean" keyPath="ld_maskToBoundsXIB" value="YES"/> <userDefinedRuntimeAttribute type="number" keyPath="ld_cornerRadiusXIB"> <real key="value" value="20"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> <connections> <action selector="bindAction:" destination="-1" eventType="touchUpInside" id="FDP-to-B1Y"/> </connections> </button> </subviews> <viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/> <constraints> <constraint firstItem="WPl-pn-8JJ" firstAttribute="top" secondItem="7pY-Sh-GDo" secondAttribute="bottom" constant="30" id="0pd-fR-HyH"/> <constraint firstItem="7iL-m6-Iwb" firstAttribute="top" secondItem="WPl-pn-8JJ" secondAttribute="bottom" constant="20" id="EUo-p4-szH"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="E2r-yp-uyh" secondAttribute="trailing" constant="40" id="VGa-zn-Nhc"/> <constraint firstItem="WPl-pn-8JJ" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="40" id="a84-vJ-qRX"/> <constraint firstItem="7pY-Sh-GDo" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="20" id="bSg-Zi-eW3"/> <constraint firstItem="E2r-yp-uyh" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="40" id="fKj-JO-wQI"/> <constraint firstItem="7iL-m6-Iwb" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="40" id="iCb-l2-b9e"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="WPl-pn-8JJ" secondAttribute="trailing" constant="40" id="qSE-TR-Ja9"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="E2r-yp-uyh" secondAttribute="bottom" constant="10" id="tWf-9w-2cf"/> <constraint firstItem="7pY-Sh-GDo" firstAttribute="centerX" secondItem="fnl-2z-Ty3" secondAttribute="centerX" id="uYe-yB-GjD"/> <constraint firstAttribute="trailing" secondItem="7iL-m6-Iwb" secondAttribute="trailing" constant="40" id="uno-ol-igV"/> </constraints> <point key="canvasLocation" x="136.64122137404578" y="20.422535211267608"/> </view> </objects> <resources> <image name="icon_LOGO" width="148" height="72"/> <image name="icon_login_code" width="15" height="18"/> <image name="icon_login_phone" width="16" height="18"/> <namedColor name="FE6E0D"> <color red="0.99199998378753662" green="0.53299999237060547" blue="0.0080000003799796104" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </namedColor> <systemColor name="systemBackgroundColor"> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> </systemColor> </resources> </document> WanPai/Root/Login/VC/LoginVC.swift
@@ -52,6 +52,8 @@ attribute.addAttributes([.paragraphStyle:paragraphStyle], range: _NSRange(location: 0, length: content.count)) self.textView_treaty.attributedText = attribute self.textView_treaty.delegate = self btn_login.localGradientColor(cornerRadius: 20) } override func setRx() { @@ -92,6 +94,11 @@ UIView.animate(withDuration: 0.4) { self.view.layoutIfNeeded() self.btn_login.setTitle(str, for: .normal) if self.btn_pwdLogin.isSelected{ self.btn_login.localGradientColor(cornerRadius: 20,bounds: CGRect(x: 0, y: 0, width: 144, height: 40)) }else{ self.btn_login.localGradientColor(cornerRadius: 20,bounds: CGRect(x: 0, y: 0, width: 189, height: 40)) } } completion: { _ in self.tf_verify.text = "" self.view.endEditing(false) @@ -153,17 +160,11 @@ } @IBAction func wechatLoginAcion(_ sender: QMUIButton) { // let req = SendAuthReq() // req.scope = "snsapi_userinfo" // req.state = "weparkLife_iOS" // WXApi.send(req) CommonAlertView.show(title: "提示", content: "账号权限正在审核中") { _ in } guard btn_reader.isSelected else {alert(msg: "请先仔细阅读并同意协议");return} let vc = BindPhoneVC() vc.modalPresentationStyle = .fullScreen push(vc: vc) // WeChatTools.sendAuthRequest() } WanPai/Root/Yard/VC/YardDetailVC.swift
@@ -86,6 +86,7 @@ private var siteDetailModel:SiteDetailModel! private var siteDetailDateTimeModel:SiteDetailDateTimeModel! private let banner = CommonBannerView() private var id:Int! private var cellW:Double! @@ -144,7 +145,7 @@ weakSelf.web_introduce.loadHTMLString(model.introduce.jq_wrapHtml(), baseURL: nil) weakSelf.view_banner.frame = CGRect(origin: .zero, size: CGSize(width: JQ_ScreenW, height: JQ_ScreenW * 0.56)) weakSelf.view_banner.setImages(images: model.imgs.components(separatedBy: ",")) { index in weakSelf.view_banner.setImages(images: model.imgs.components(separatedBy: ","),type: .URL) { index in } } WanPai/SceneDelegate.swift
@@ -34,13 +34,32 @@ SVProgressHUD.setMaximumDismissTimeInterval(30.0) if #available(iOS 13.0, *) { self.window?.overrideUserInterfaceStyle = .light window?.overrideUserInterfaceStyle = .light } } func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { WXApi.handleOpenUniversalLink(userActivity, delegate: app) print("---->4") YYPaymentManager.shared.handleApplication(userActivity) } func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { if let code = URLContexts.first?.url.jq_params?["code"]{ let resp = SendAuthResp() resp.code = code WeChatTools.getAccessToken(resp) { model in if let m = model{ WeChatTools.getUserInfo(access_token: m.access_token, openId: m.openid) { userInfoModel in } } } } if URLContexts.first!.url.host == "resendContextReqByScheme"{ WXApi.handleOpen(URLContexts.first!.url, delegate: YYPaymentManager.shared) } } func sceneDidDisconnect(_ scene: UIScene) { @@ -48,7 +67,7 @@ } func sceneDidBecomeActive(_ scene: UIScene) { } func sceneWillResignActive(_ scene: UIScene) { WanPai/ViewModel/RefreshModel.swift
@@ -43,6 +43,7 @@ lazy var refreshSubject = PublishSubject<RefreshState>() var page:Int = 0 var pageSize:Int = 20 private var needRefreshData:Bool = true lazy var dataSource = BehaviorRelay<[T]>(value: []) func configure(_ scrollView:UITableView,needMore:Bool = true){ @@ -54,7 +55,8 @@ handle = scrollView } func configure(_ scrollView:UICollectionView,needMore:Bool = true){ func configure(_ scrollView:UICollectionView,needMore:Bool = true,needRefreshData:Bool = true){ self.needRefreshData = needRefreshData scrollView.mj_header = CustomRefreshHeaer.refreshing(with: refreshData()) if needMore{ scrollView.mj_footer = CustomRefreshFooter.refreshing(with: loadMoreData()) WanPai/WanPaiDebug.entitlements
@@ -4,7 +4,7 @@ <dict> <key>com.apple.developer.associated-domains</key> <array> <string>applinks:www.weparklife.com</string> <string>webcredentials:www.weparklife.com/</string> </array> </dict> </plist> WanPai/YYPaymentManager/YYPaymentManager.swift
@@ -32,6 +32,8 @@ /// 微信AppID private var weChat_appID: String? private var weChat_Mini:String? private var didReceivePaymentInfos: ((_ result: YYPaymentResult) -> Void)? } @@ -49,9 +51,10 @@ /// 配置微信AppID /// /// - Parameter appID: 微信AppID func configuredWeChat(appID: String,universalLink:String) { func configuredWeChat(appID: String,universalLink:String,weChat_Mini:String? = nil) { weChat_appID = appID self.weChat_Mini = weChat_Mini WXApi.registerApp(appID, universalLink: universalLink) } } @@ -80,25 +83,25 @@ } } // /// 拉起小程序支付 // func sendWXPaymentRequest(_ request: YYWeChatMiniProgramPayRequest,didReceive result: @escaping (YYPaymentResult) -> Void) { // // guard WXApi.isWXAppInstalled() else { // self.delegate?.paymentManager(self, didReceivePayment: .failure(NSError(domain: "com.paymentManager.error", code: -9999, userInfo: [NSLocalizedDescriptionKey: "未安装微信"]))) // result(.failure(NSError(domain: "com.paymentManager.error", code: -9999, userInfo: [NSLocalizedDescriptionKey: "未安装微信"]))) // return // } // let launchMiniProgramReq = WXLaunchMiniProgramReq.object() // // /拉起的小程序的username-原始ID // launchMiniProgramReq.userName = "gh_33e52f44fac0" // // 拉起小程序页面的可带参路径,不填默认拉起小程序首页 // launchMiniProgramReq.path = "/pages/appPay/appPay?orderId=\(request.orderId ?? 0)&orderType=\(request.orderType ?? 0)&type=\(request.type)&uid=\(request.uid)&userType=\(request.userType)&content=\(request.content ?? "")" // launchMiniProgramReq.miniProgramType = .release //// launchMiniProgramReq.extMsg = request.toJSONString() // WXApi.send(launchMiniProgramReq) { (success) in // // } // } /// 拉起小程序支付 func sendWXPaymentRequest(_ request: YYWeChatMiniProgramPayRequest,didReceive result: @escaping (YYPaymentResult) -> Void) { guard WXApi.isWXAppInstalled() else { self.delegate?.paymentManager(self, didReceivePayment: .failure(NSError(domain: "com.paymentManager.error", code: -9999, userInfo: [NSLocalizedDescriptionKey: "未安装微信"]))) result(.failure(NSError(domain: "com.paymentManager.error", code: -9999, userInfo: [NSLocalizedDescriptionKey: "未安装微信"]))) return } let launchMiniProgramReq = WXLaunchMiniProgramReq.object() // /拉起的小程序的username-原始ID launchMiniProgramReq.userName = weChat_Mini ?? "" // 拉起小程序页面的可带参路径,不填默认拉起小程序首页 launchMiniProgramReq.path = "/pages/appPay/appPay?orderId=\(request.orderId ?? 0)&orderType=\(request.orderType ?? 0)&type=\(request.type)&uid=\(request.uid)&userType=\(request.userType)&content=\(request.content ?? "")" launchMiniProgramReq.miniProgramType = .release // launchMiniProgramReq.extMsg = request.toJSONString() WXApi.send(launchMiniProgramReq) { (success) in } } /// 发送微信支付请求 /// @@ -158,6 +161,11 @@ return handle(open: url) } @discardableResult func handleApplication(_ userActivity: NSUserActivity)->Bool{ return WXApi.handleOpenUniversalLink(userActivity, delegate: self) } private func handle(open url: URL) -> Bool { if url.host == "safepay" { @@ -238,5 +246,10 @@ } } } func onReq(_ req: BaseReq) { } }