| | |
| | | INFOPLIST_FILE = WanPai/Info.plist; |
| | | INFOPLIST_KEY_CFBundleDisplayName = "玩湃生活"; |
| | | INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.sports"; |
| | | INFOPLIST_KEY_NSCameraUsageDescription = "$(PRODUCT_NAME)需要使用使用使用相机,来上传学员头像、评论图片"; |
| | | INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "$(PRODUCT_NAME)需要使用使用定位,来推荐、搜索您附近的门店"; |
| | | INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "$(PRODUCT_NAME)需要使用使用使用相册,来上传学员头像、评论图片"; |
| | | INFOPLIST_KEY_NSCameraUsageDescription = "WanPai需要使用使用使用相机,来上传学员头像、评论图片"; |
| | | INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "WanPai需要使用使用定位,来推荐、搜索您附近的门店"; |
| | | INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "WanPai需要使用使用使用相册,来上传学员头像、评论图片"; |
| | | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
| | | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; |
| | | INFOPLIST_KEY_UIMainStoryboardFile = Main; |
| | |
| | | INFOPLIST_FILE = WanPai/Info.plist; |
| | | INFOPLIST_KEY_CFBundleDisplayName = "玩湃生活"; |
| | | INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.sports"; |
| | | INFOPLIST_KEY_NSCameraUsageDescription = "$(PRODUCT_NAME)需要使用使用使用相机,来上传学员头像、评论图片"; |
| | | INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "$(PRODUCT_NAME)需要使用使用定位,来推荐、搜索您附近的门店"; |
| | | INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "$(PRODUCT_NAME)需要使用使用使用相册,来上传学员头像、评论图片"; |
| | | INFOPLIST_KEY_NSCameraUsageDescription = "WanPai需要使用使用使用相机,来上传学员头像、评论图片"; |
| | | INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "WanPai需要使用使用定位,来推荐、搜索您附近的门店"; |
| | | INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "WanPai需要使用使用使用相册,来上传学员头像、评论图片"; |
| | | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
| | | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; |
| | | INFOPLIST_KEY_UIMainStoryboardFile = Main; |
| | |
| | | YYPaymentManager.shared.configuredAlipay(appScheme: APPScheme) |
| | | AMapServices.shared().enableHTTPS = true |
| | | AMapServices.shared().apiKey = AMapKey |
| | | |
| | | return true |
| | | } |
| | | |
| | |
| | | func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { |
| | | 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) |
| | |
| | | |
| | | 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){ |
| | |
| | | |
| | | let SHAKEY = "BT7NPhA0f775uzcUuftWjCE1TYZlWmHZ" |
| | | let WechatUniversalLinks = "https://www.weparklife.com/app/" |
| | | let WeChatAPPID = "WX41D32F362BA0F911" |
| | | let WeChatSecrect = "" |
| | | let WeChatAPPID = "wx41d32f362ba0f911" |
| | | let WeChatSecrect = "cf0ebf950f5926a69041a0e2bbe20f3e" |
| | | let APPScheme = "weparklife" |
| | | let AMapKey = "a2aff8a000be5543e410555c548793b8" |
| | | let WeChatMinProgram = "gh_fea25aea0fc8" // |
| | |
| | | } |
| | | |
| | | /// 支付方式 |
| | | enum PayType:Int{ |
| | | enum PayType:Int,HandyJSONEnum{ |
| | | case wechat = 1 |
| | | case aliPay = 2 |
| | | case wechat = 1 |
| | | case coin = 3 |
| | | case courseNum = 4 |
| | | } |
| | |
| | | var defaultImg:UIImage{ |
| | | switch self { |
| | | case .none: |
| | | return UIImage() |
| | | return UIImage(named: "placeholder_1")! |
| | | case .course: |
| | | return UIImage(named: "b_1")! |
| | | case .booking: |
| | |
| | | return UIImage(named: "b_3")! |
| | | case .wisdomCourt: |
| | | return UIImage(named: "b_7")! |
| | | } |
| | | } |
| | | var defaultHeight:Double { |
| | | switch self { |
| | | case .none: |
| | | return 185 |
| | | case .course: |
| | | return 288 |
| | | case .booking: |
| | | return 288 |
| | | case .activity: |
| | | return 185 |
| | | case .welfare: |
| | | return 185 |
| | | case .coin: |
| | | return 185 |
| | | case .ticket: |
| | | return 185 |
| | | case .video: |
| | | return 288 |
| | | case .wisdomCourt: |
| | | return 288 |
| | | } |
| | | } |
| | | } |
| | |
| | | enum ScanType:Int{ |
| | | case games = 1000 //游戏 |
| | | case course = 1001 //课程 |
| | | case yard = 1002 //场地 |
| | | } |
| | |
| | | |
| | | class WeChatTools{ |
| | | |
| | | static func register(appid:String,link:String){ |
| | | WXApi.registerApp(appid, universalLink: link) |
| | | } |
| | | |
| | | /// 授权登录 |
| | | static func sendAuthRequest(){ |
| | | let sendAuthReq = SendAuthReq() |
| | |
| | | <string>Editor</string> |
| | | <key>CFBundleURLSchemes</key> |
| | | <array> |
| | | <string>WX41D32F362BA0F911</string> |
| | | <string>wx41d32f362ba0f911</string> |
| | | </array> |
| | | </dict> |
| | | </array> |
| | |
| | | var storeLon: String = "" |
| | | var storeName: String = "" |
| | | var phone:String = "" |
| | | var payType:PayType = .aliPay |
| | | |
| | | required init() {} |
| | | } |
| | |
| | | var payMoney: Double = 0.0 |
| | | var payOrderNo: String = "" |
| | | var payTime: Int = 0 |
| | | var payType: Int = 0 |
| | | var payType: PayType = .coin |
| | | var payUserId: String = "" |
| | | var phone: String = "" |
| | | var province: String = "" |
| | |
| | | |
| | | struct GameListModel:HandyJSON { |
| | | var id = 0 |
| | | var cash:Double = 0 |
| | | var gameId:Int = 0 |
| | | var img = "" |
| | | var name = "" |
| | | var icon = "" |
| | | var integral = 0 |
| | | var otherId = 0 |
| | | var playCoin = 0 |
| | | } |
| | | |
| | | struct DoorModel:HandyJSON{ |
| | |
| | | } |
| | | |
| | | struct OpenDoorModel:HandyJSON{ |
| | | var sid:Int? //场地ID |
| | | var rid = [Int]() //区域ID |
| | | var sid:Int? //场馆ID,全国通用值为0 |
| | | var rid = [Int]() //区域ID,单场馆和多场馆都可以放入,全国可以为空数组 |
| | | var uid:Int? //用户ID |
| | | var time = [OpenDoorTimeModel]() //时间 |
| | | var type = 2 //固定 |
| | | } |
| | | |
| | | struct OpenDoorTimeModel:HandyJSON { |
| | | var start_time:TimeInterval = 0 |
| | | var end_time:TimeInterval = 0 |
| | | var start_time:TimeInterval = 0 //开始时间 |
| | | var end_time:TimeInterval = 0 //结束时间 |
| | | } |
| | | |
| | |
| | | extension Services{ |
| | | |
| | | /// 本地离线游戏 |
| | | class func game_gameList(spaceId:String,sutuId:String)->Observable<BaseResponse<[GameListModel]>>{ |
| | | let params = ParamsAppender.build(url: Game_Url) |
| | | .interface(url: "/v7/user_api/general/gameList") |
| | | .append(key: "space_id", value: spaceId) |
| | | .append(key: "sutu_id", value: sutuId) |
| | | .append(key: "sign", value: "0DB011836143EEE2C2E072967C9F4E4B") |
| | | return NetworkRequest.request(params: params, method: .post, encoding: JSONEncoding.default, progress: false) |
| | | class func game_gameList(spaceId:Int,storeId:Int)->Observable<BaseResponse<[GameListModel]>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/other/api/game/queryGameList") |
| | | .append(key: "siteId", value: spaceId) |
| | | .append(key: "storeId", value: storeId) |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | | //支付游戏 |
| | | class func payGame(configId:Int,gameId:Int,spaceId:Int,sutuId:Int,type:PayType)->Observable<BaseResponse<PaymentModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/other/api/game/payGame") |
| | | .append(key: "configId", value: configId) |
| | | .append(key: "gameId", value: gameId) |
| | | .append(key: "spaceId", value: spaceId) |
| | | .append(key: "sutuId", value: sutuId) |
| | | .append(key: "type", value: type.rawValue) |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | | /// 启动本地游戏 |
| | | class func game_gameStart(gameId:Int,spaceId:String,sutuId:String,userID:Int)->Observable<BaseResponse<SimpleModel>>{ |
| | | class func game_gameStart(gameId:Int,spaceId:Int,sutuId:Int,userID:Int)->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: Game_Url) |
| | | .interface(url: "/v7/user_api/general/gameStart") |
| | | .append(key: "space_id", value: spaceId) |
| | |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | | class func homeInfo2(storeId:Int)->Observable<BaseResponse<HomeStoreModel>>{ |
| | | class func homeStoreConfig2(storeId:Int)->Observable<BaseResponse<[HomeStoreConfigModel]>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/other/base/store/queryIndexSet") |
| | | .append(key: "id", value: storeId) |
| | |
| | | <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="dq4-Ry-HOa"> |
| | | <rect key="frame" x="90.666666666666657" y="14" width="292.33333333333337" height="20"/> |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="20" id="Z5A-jd-BbS"/> |
| | | <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="Z5A-jd-BbS"/> |
| | | </constraints> |
| | | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
| | | <nil key="textColor"/> |
| | |
| | | let StartGame_Noti = Notification.Name.init("StartGame_Noti") |
| | | |
| | | struct QRCodeModel:HandyJSON { |
| | | // var scan_type:ScanType? //扫码类型:1000:游戏,10001:课程 |
| | | var space_id:String? //场地ID |
| | | var sutu_id:String? //设备ID |
| | | var course_id:Int? //课程ID |
| | | var scan_type:ScanType? //扫码类型 |
| | | var space_id:Int? //场地ID |
| | | var sutu_id:Int? //设备ID |
| | | var id:Int? //课程/场地/游戏 |
| | | } |
| | | |
| | | class GamesVC: BaseVC { |
| | | |
| | | private var codeModel:QRCodeModel! |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "智慧球场" |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | override func setRx() { |
| | | NotificationCenter.default.rx.notification(StartGame_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] noti in |
| | | guard let weakSelf = self else { return } |
| | | if let gameId = noti.object as? Int{ |
| | | Services.userDetails().subscribe(onNext: {[weak self] data in |
| | | guard let weakSelf = self else { return } |
| | | if let model = data.data{ |
| | | Services.game_gameStart(gameId: gameId, spaceId: weakSelf.codeModel.space_id!, sutuId: weakSelf.codeModel.sutu_id!, userID: model.userId).subscribe(onNext: { _ in |
| | | alertSuccess(msg: "启动成功") |
| | | }) { error in |
| | | |
| | | }.disposed(by: weakSelf.disposeBag) |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | // NotificationCenter.default.rx.notification(StartGame_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] noti in |
| | | // guard let weakSelf = self else { return } |
| | | // if let gameId = noti.object as? Int{ |
| | | // Services.userDetails().subscribe(onNext: {[weak self] data in |
| | | // guard let weakSelf = self else { return } |
| | | // if let model = data.data{ |
| | | // Services.game_gameStart(gameId: gameId, spaceId: weakSelf.codeModel.space_id!, sutuId: weakSelf.codeModel.sutu_id!, userID: model.userId).subscribe(onNext: { _ in |
| | | // alertSuccess(msg: "启动成功") |
| | | // }) { error in |
| | | // |
| | | // }.disposed(by: weakSelf.disposeBag) |
| | | // } |
| | | // }).disposed(by: weakSelf.disposeBag) |
| | | // } |
| | | // }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | @IBAction func scanAction(_ sender: UIButton) { |
| | |
| | | @IBOutlet weak var img_icon: UIImageView! |
| | | @IBOutlet weak var label_gameName: UILabel! |
| | | var QRCodeModel:QRCodeModel! |
| | | var spaceId = 0 |
| | | var sutuId = 0 |
| | | var storeId = 0 |
| | | |
| | | var gameListModel:GameListModel!{ |
| | | didSet{ |
| | | img_icon.sd_setImage(with: URL(string: gameListModel.icon)) |
| | | img_icon.sd_setImage(with: URL(string: gameListModel.img)) |
| | | label_gameName.text = gameListModel.name |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @IBAction func launchGameAction(_ sender: UIButton) { |
| | | Services.userDetails().subscribe(onNext: {[weak self] data in |
| | | GamesPayView.show(price: gameListModel.cash, coin: gameListModel.integral) {[weak self] () in |
| | | guard let weakSelf = self else { return } |
| | | if let model = data.data{ |
| | | Services.game_gameStart(gameId: weakSelf.gameListModel.id, spaceId: weakSelf.QRCodeModel.space_id!, sutuId: weakSelf.QRCodeModel.sutu_id!, userID: model.userId).subscribe(onNext: { _ in |
| | | alertSuccess(msg: "启动成功") |
| | | PaymentView.show(money: (ali: weakSelf.gameListModel.cash, wx: weakSelf.gameListModel.cash, coin: weakSelf.gameListModel.integral, course: nil)) { [weak self] payType in |
| | | guard let weakSelf = self else { return } |
| | | Services.payGame(configId: weakSelf.gameListModel.id, gameId: weakSelf.gameListModel.gameId, spaceId: weakSelf.spaceId, sutuId: weakSelf.sutuId, type: payType).subscribe(onNext: {data in |
| | | if data.code == 200{ |
| | | switch payType { |
| | | case .wechat:break |
| | | case .aliPay: |
| | | YYPaymentManager.shared.sendPaymentRequest(YYAlipayRequest(orderString: data.data?.orderString ?? "")) { result in |
| | | switch result { |
| | | case .success:alertSuccess(msg: "支付成功") |
| | | case .cancel:alert(msg: "支付已取消") |
| | | case .failure(let error):alert(msg: error.localizedDescription) |
| | | } |
| | | } |
| | | default:alert(msg: "启动成功") |
| | | } |
| | | }else{ |
| | | alert(msg: data.msg) |
| | | } |
| | | }) { error in |
| | | |
| | | alert(msg: error.localizedDescription) |
| | | }.disposed(by: weakSelf.disposeBag) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | // Services.userDetails().subscribe(onNext: {[weak self] data in |
| | | // guard let weakSelf = self else { return } |
| | | // if let model = data.data{ |
| | | // Services.game_gameStart(gameId: weakSelf.gameListModel.id, spaceId: weakSelf.QRCodeModel.space_id!, sutuId: weakSelf.QRCodeModel.sutu_id!, userID: model.userId).subscribe(onNext: { _ in |
| | | // alertSuccess(msg: "启动成功") |
| | | // }) { error in |
| | | // |
| | | // }.disposed(by: weakSelf.disposeBag) |
| | | // } |
| | | // }).disposed(by: disposeBag) |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | class GamesOffLineViewModel:RefreshModel<GameListModel>{ |
| | | let spaceId = BehaviorRelay<String>(value: "") |
| | | let sutuId = BehaviorRelay<String>(value: "") |
| | | let spaceId = BehaviorRelay<Int>(value: 0) |
| | | let sutuId = BehaviorRelay<Int>(value: 0) |
| | | let storeId = BehaviorRelay<Int>(value: 0) |
| | | |
| | | override func api() -> (Observable<BaseResponse<[GameListModel]>>)? { |
| | | return Services.game_gameList(spaceId: spaceId.value, sutuId: sutuId.value) |
| | | return Services.game_gameList(spaceId: spaceId.value, storeId: storeId.value) |
| | | } |
| | | } |
| | | |
| | |
| | | private var model:QRCodeModel! |
| | | |
| | | private let offLineViewModel = GamesOffLineViewModel() |
| | | |
| | | private var tableView:UITableView! |
| | | private var homeStoreModel:HomeStoreModel! |
| | | private var tableView:BaseTableView! |
| | | |
| | | init(type:GamesSubType,model:QRCodeModel) { |
| | | super.init(nibName: nil, bundle: nil) |
| | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | if type == .offline{ |
| | | offLineViewModel.spaceId.accept(model.space_id!) |
| | | offLineViewModel.sutuId.accept(model.sutu_id!) |
| | | offLineViewModel.configure(tableView, needMore: false) |
| | | offLineViewModel.beginRefresh() |
| | | } |
| | | if let storeStr = UserDefaults.standard.object(forKey: "CurrentStore") as? String{ |
| | | if let deserModel = HomeStoreModel.deserialize(from: storeStr){ |
| | | offLineViewModel.storeId.accept(deserModel.storeId) |
| | | |
| | | if type == .offline{ |
| | | offLineViewModel.spaceId.accept(model.space_id!) |
| | | offLineViewModel.sutuId.accept(model.sutu_id!) |
| | | offLineViewModel.configure(tableView, needMore: false) |
| | | offLineViewModel.beginRefresh() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | override func setUI() { |
| | | tableView = UITableView(frame: .zero, style: .plain) |
| | | tableView = BaseTableView(frame: .zero, style: .plain) |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.register(UINib(nibName: "GamesTCell", bundle: nil), forCellReuseIdentifier: "_GamesTCell") |
| | |
| | | tableView.snp.makeConstraints { make in |
| | | make.edges.equalToSuperview() |
| | | } |
| | | |
| | | tableView.jq_setEmptyView() |
| | | } |
| | | } |
| | | |
| | |
| | | if type == .offline{ |
| | | cell.gameListModel = offLineViewModel.dataSource.value[indexPath.row] |
| | | cell.QRCodeModel = model |
| | | cell.spaceId = offLineViewModel.spaceId.value |
| | | cell.storeId = offLineViewModel.storeId.value |
| | | cell.sutuId = offLineViewModel.sutuId.value |
| | | } |
| | | return cell |
| | | } |
| | |
| | | var lat:Double = 0 |
| | | } |
| | | |
| | | class HomeStoreConfigModel:HandyJSON { |
| | | class HomeStoreConfigModel:HandyJSON { |
| | | |
| | | required init() {} |
| | | |
| | |
| | | var isOpen:Int = 0 |
| | | var sort:Int = 0 |
| | | var backgroundImage:String = "" |
| | | var defaultImg:UIImage? |
| | | var radio:Double? |
| | | // var defaultImg:UIImage? |
| | | var radio:Double = 1.0 |
| | | } |
| | | |
| | | struct NormalSimpleModel:HandyJSON{ |
| | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | viewModel.configure(collectionView,needMore: false) |
| | | |
| | | startLocation() |
| | | |
| | | 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() |
| | | |
| | | Services.homeInfo2(storeId: weakSelf.viewModel.storeId.value).subscribe(onNext: {data in |
| | | |
| | | }) { error in |
| | | |
| | | }.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) |
| | | |
| | | Services.startCourseHome().subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | |
| | | }) { 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) |
| | | |
| | | } |
| | | |
| | |
| | | self?.label_vipInfo.text = text |
| | | } |
| | | self?.viewModel.beginRefresh() |
| | | }else{ |
| | | self?.defaultData() |
| | | } |
| | | } |
| | | }) { [weak self] error in |
| | | self?.label_store.text = "门店获取失败" |
| | | self?.defaultData() |
| | | }.disposed(by: disposeBag) |
| | | } |
| | | |
| | | private func defaultData(){ |
| | | for index in 1...8{ |
| | | let type = HomeItemType(rawValue: index)! |
| | | let m = HomeStoreConfigModel() |
| | | m.type = type |
| | | m.isOpen = 1 |
| | | m.sort = index |
| | | m.radio = type.defaultImg.size.width / type.defaultImg.size.height |
| | | items.append(m) |
| | | } |
| | | collectionView.reloadData() |
| | | } |
| | | |
| | | private func startLocation(){ |
| | |
| | | let vc = WelfareWeeklyListVC() |
| | | push(vc: vc) |
| | | case .wisdomCourt: |
| | | guard viewModel.storeId.value != 0 else {alert(msg: "请先选择门店");return} |
| | | let vc = GamesVC() |
| | | push(vc: vc) |
| | | case .welfare: |
| | |
| | | |
| | | extension HomeVC: WaterFallLayoutDelegate{ |
| | | func waterFlowLayout(_ waterFlowLayout: WaterFallFlowLayout, itemHeight indexPath: IndexPath) -> CGFloat { |
| | | if indexPath.row % 2 != 0{ |
| | | return 185 |
| | | }else{ |
| | | return 288 |
| | | } |
| | | let item = items[indexPath.row] |
| | | let w = (view.frame.width - 68 - waterFlowLayout.minimumLineSpacing) / Double(waterFlowLayout.cols) |
| | | return w / item.radio |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | CommonAlertView.show(title: "提示", content: "即将打开小程序,是否继续?") { status in |
| | | if status{ |
| | | let miniProgam = WXLaunchMiniProgramReq() |
| | | let miniProgam = WXLaunchMiniProgramReq.object() |
| | | miniProgam.userName = WeChatMinProgram |
| | | // miniProgam.path = WeChatMinProgramPath |
| | | #if DEBUG |
| | | miniProgam.miniProgramType = .preview |
| | | #else |
| | | miniProgam.miniProgramType = .release |
| | | #endif |
| | | miniProgam.path = WeChatMinProgramPath |
| | | WXApi.send(miniProgam) { s in |
| | | if !s{ |
| | | alert(msg: "打开失败") |
| | |
| | | label_name.text = yardBookingModel.name |
| | | label_typeName.text = yardBookingModel.siteTypeName |
| | | label_address.text = String(format: "%@(%@)",yardBookingModel.storeName, yardBookingModel.storeAddress) |
| | | label_price.text = yardBookingModel.payMoney.currency() |
| | | label_status.text = yardBookingModel.status.titleRaw |
| | | label_bookingTime.text = String(format: "预约时间:%@", yardBookingModel.appointment) |
| | | btn_detail.isHidden = yardBookingModel.status == .cancel |
| | |
| | | self.btn_payment.isHidden = true |
| | | // self.btn_cancel.isHidden = true |
| | | } |
| | | |
| | | switch yardBookingModel.payType { |
| | | case .aliPay,.wechat: |
| | | label_price.text = yardBookingModel.payMoney.currency() |
| | | case .coin: |
| | | label_price.text = yardBookingModel.payMoney.int.string + "币" |
| | | default:break |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | private func getData(){ |
| | | Services.siteDetail(id: yardBookingModel.id).subscribe(onNext: {[weak self] data in |
| | | guard let weakSelf = self else { return } |
| | | if let model = data.data?.data{ |
| | | self?.yardBookingDetailDataModel = model |
| | | self?.label_yardName.text = model.nextName |
| | |
| | | self?.label_halfYardName.text = model.halfName |
| | | self?.label_bookingPerson.text = model.booker |
| | | self?.label_contact.text = model.phone |
| | | self?.label_paymentPrice.text = model.payMoney.currency() |
| | | |
| | | switch model.payType { |
| | | case .aliPay,.wechat: |
| | | self?.label_paymentPrice.text = model.payMoney.currency() |
| | | case .courseNum: |
| | | self?.label_paymentPrice.text = model.payMoney.string + "课时" |
| | | case .coin: |
| | | self?.label_paymentPrice.text = model.payMoney.int.string + "币" |
| | | } |
| | | |
| | | self?.label_bookingTime.text = Date.jq_format(TimeInterval(model.startTime / 1000), formatter: "yyyy-MM-dd") |
| | | |
| | | switch model.state { |