杨锴
2024-10-09 1f08239dd60c05f1eb6eb9b3122aa23cd700348b
fix bug
17个文件已修改
1591 ■■■■ 已修改文件
WanPai.xcodeproj/project.pbxproj 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Common/VC/CommonScanQRCodeVC.swift 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Config/TransitionUtil.swift 250 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Config/WeChatTools.swift 324 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Activity/VC/ActivityDetailApplyVC.swift 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/AddStudentVC.swift 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseDetailVC.swift 382 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/View/CourseUnAssignView.swift 210 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Games/TCell/GamesTCell.swift 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Home/VC/HomeVC.swift 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Other/View/CommonDatePickerView.swift 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Search/VC/WorldCupContentVC.swift 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Search/VC/WorldCupRecordVC.swift 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Welfare/VC/WelfareExchangeRecordSubListVC.swift 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Yard/VC/YardBookingDetailVC.swift 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Yard/VC/YardBookingListVC.swift 170 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Yard/VC/YardBookingSubListVC.swift 144 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai.xcodeproj/project.pbxproj
@@ -2193,7 +2193,7 @@
                CODE_SIGN_ENTITLEMENTS = WanPai/WanPaiDebug.entitlements;
                "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
                CODE_SIGN_STYLE = Manual;
                CURRENT_PROJECT_VERSION = 12;
                CURRENT_PROJECT_VERSION = 13;
                DEVELOPMENT_TEAM = "";
                "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 2MWV8K39DV;
                FRAMEWORK_SEARCH_PATHS = (
@@ -2222,7 +2222,7 @@
                    "$(inherited)",
                    "$(PROJECT_DIR)/WanPai/YYPaymentManager/WeChatPay",
                );
                MARKETING_VERSION = 2.0.2;
                MARKETING_VERSION = 2.0.3;
                OTHER_LDFLAGS = (
                    "$(inherited)",
                    "-ObjC",
@@ -2357,7 +2357,7 @@
                CODE_SIGN_ENTITLEMENTS = WanPai/WanPaiRelease.entitlements;
                "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
                CODE_SIGN_STYLE = Manual;
                CURRENT_PROJECT_VERSION = 12;
                CURRENT_PROJECT_VERSION = 13;
                DEVELOPMENT_TEAM = "";
                "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 2MWV8K39DV;
                FRAMEWORK_SEARCH_PATHS = (
@@ -2386,7 +2386,7 @@
                    "$(inherited)",
                    "$(PROJECT_DIR)/WanPai/YYPaymentManager/WeChatPay",
                );
                MARKETING_VERSION = 2.0.2;
                MARKETING_VERSION = 2.0.3;
                OTHER_LDFLAGS = (
                    "$(inherited)",
                    "-ObjC",
WanPai/Common/VC/CommonScanQRCodeVC.swift
@@ -86,48 +86,6 @@
                                                                self.navigationController?.popViewController()
                                                }
                                }
                                //        if(!checkCameraAuth()){
                                //
                                //            let authStatus = AVCaptureDevice.authorizationStatus(for: AVMediaType.video)
                                //            if authStatus == AVAuthorizationStatus.notDetermined {
                                //                AVCaptureDevice.requestAccess(for: AVMediaType.video) {[weak self] (granted) in
                                //                    if granted{
                                //                        self?.setupCaptureSession()
                                //                        self?.addSubviews()
                                //                        self?.scanTimer = Timer.scheduledTimer(timeInterval: 3.0, target: self, selector: #selector(startAnimation), userInfo: nil, repeats: true)
                                //                    }
                                //                }
                                //            } else if authStatus == AVAuthorizationStatus.restricted || authStatus == AVAuthorizationStatus.denied {
                                //                let alertController = UIAlertController(title: nil,message: "请在iphone的“设置-隐私-相机”选项中,允许应用访问你的相机", preferredStyle: .alert)
                                //                let cancelAction = UIAlertAction(title: "取消", style: .cancel, handler: { action in
                                //                    self.navigationController?.popViewController(animated: true)
                                //                })
                                //
                                //                let okAction = UIAlertAction(title: "前往", style: .default, handler: {action in
                                //                    let settingUrl = NSURL(string: UIApplication.openSettingsURLString)!
                                //                    if UIApplication.shared.canOpenURL(settingUrl as URL){
                                //                        if #available(iOS 10.0, *) {
                                //                            UIApplication.shared.open(settingUrl as URL, options: [:], completionHandler: nil)
                                //                        } else {
                                //                            UIApplication.shared.openURL(settingUrl as URL)
                                //                        }
                                //                    }
                                //                })
                                //
                                //                alertController.addAction(cancelAction)
                                //                alertController.addAction(okAction)
                                //                self.present(alertController, animated: true, completion: nil)
                                //            } else {
                                //
                                //            }
                                //
                                //        }else{
                                //            setupCaptureSession()
                                //            addSubviews()
                                //            scanTimer = Timer.scheduledTimer(timeInterval: 3.0, target: self, selector: #selector(startAnimation), userInfo: nil, repeats: true)
                                //        }
                }
                private func limitSuccess(){
@@ -201,15 +159,6 @@
                func addSubviews() {
                                let _: CGFloat = (UIScreen.main.bounds.size.width - borderWidth) * 0.5
                                //
                                //        let coverImageView = UIImageView(frame: CGRect(x: 0, y: 64, width: UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height - 64))
                                //        coverImageView.backgroundColor = UIColor.clear
                                //        coverImageView.image = self.getCoverView(left: leftMargin, top: topMargin)
                                //        view.addSubview(coverImageView)
                                //扫描边框
                                borderView!.frame = CGRect.init(x: (UIScreen.main.bounds.size.width-(self.view.center.x+30))/2, y: (UIScreen.main.bounds.size.height-(self.view.center.x + 30))/2, width: self.view.center.x + 30, height: self.view.center.x + 30)
WanPai/Config/TransitionUtil.swift
@@ -1,165 +1,165 @@
    //
    //  TransitionUtil.swift
    //  WanPai
    //
    //  Created by 无故事王国 on 2023/11/23.
    //
//
//  TransitionUtil.swift
//  WanPai
//
//  Created by 无故事王国 on 2023/11/23.
//
import Foundation
    ///通用转场工具类
///通用转场工具类
class TransitionUtil: NSObject {
        ///转场类型
    var transitionType: TransitionType?
        //交互转场
    var interactive = false
    let interactionTransition = UIPercentDrivenInteractiveTransition()
                ///转场类型
                var transitionType: TransitionType?
                //交互转场
                var interactive = false
                let interactionTransition = UIPercentDrivenInteractiveTransition()
    override init() {
        super.init()
                override init() {
                                super.init()
    }
        //MARK:  ------------  不同类型的转场  ------------
    private func transitionAnimation(transitionContext: UIViewControllerContextTransitioning) {
            //获得容器视图(转场动画发生的地方)
        let containerView = transitionContext.containerView
            //动画执行时间
        let duration = self.transitionDuration(using: transitionContext)
            //fromVC (即将消失的视图)
        let fromVC = transitionContext.viewController(forKey: .from)!
        let fromView = fromVC.view!
            //toVC (即将出现的视图)
        let toVC = transitionContext.viewController(forKey: .to)!
        let toView = toVC.view!
        var offset = containerView.frame.width
        var fromTransform = CGAffineTransform.identity
        var toTransform = CGAffineTransform.identity
        switch transitionType {
            case .modal(let operation):
                offset = containerView.frame.height
                let fromY = operation == .presentation ? 0 : offset
                fromTransform = CGAffineTransform(translationX: 0, y: fromY)
                let toY = operation == .presentation ? offset : 0
                toTransform = CGAffineTransform(translationX: 0, y: toY)
                if operation == .presentation {
                    containerView.addSubview(toView)
                }
            case .navigation(let operation):
                offset = operation == .push ? offset : -offset
                fromTransform = CGAffineTransform(translationX: -offset, y: 0)
                toTransform = CGAffineTransform(translationX: offset, y: 0)
                containerView.insertSubview(toView, at: 0)
                    //containerView.addSubview(toView)
                //MARK:  ------------  不同类型的转场  ------------
            case .tabBar(let direction):
                offset = direction == .left ? offset : -offset
                fromTransform = CGAffineTransform(translationX: offset, y: 0)
                toTransform = CGAffineTransform(translationX: -offset, y: 0)
                containerView.addSubview(toView)
                private func transitionAnimation(transitionContext: UIViewControllerContextTransitioning) {
                                //获得容器视图(转场动画发生的地方)
                                let containerView = transitionContext.containerView
                                //动画执行时间
                                let duration = self.transitionDuration(using: transitionContext)
            case nil:
                break
        }
                                //fromVC (即将消失的视图)
                                let fromVC = transitionContext.viewController(forKey: .from)!
                                let fromView = fromVC.view!
                                //toVC (即将出现的视图)
                                let toVC = transitionContext.viewController(forKey: .to)!
                                let toView = toVC.view!
        toView.transform = toTransform
        UIView.animate(withDuration: duration, animations: {
            fromView.transform = fromTransform
            toView.transform = .identity
        }) { (finished) in
            fromView.transform = .identity
            toView.transform = .identity
                //考虑到转场中途可能取消的情况,转场结束后,恢复视图状态。(通知是否完成转场)
            let wasCancelled = transitionContext.transitionWasCancelled
            transitionContext.completeTransition(!wasCancelled)
        }
    }
                                var offset = containerView.frame.width
                                var fromTransform = CGAffineTransform.identity
                                var toTransform = CGAffineTransform.identity
                                switch transitionType {
                                                case .modal(let operation):
                                                                offset = containerView.frame.height
                                                                let fromY = operation == .presentation ? 0 : offset
                                                                fromTransform = CGAffineTransform(translationX: 0, y: fromY)
                                                                let toY = operation == .presentation ? offset : 0
                                                                toTransform = CGAffineTransform(translationX: 0, y: toY)
                                                                if operation == .presentation {
                                                                                containerView.addSubview(toView)
                                                                }
                                                case .navigation(let operation):
                                                                offset = operation == .push ? offset : -offset
                                                                fromTransform = CGAffineTransform(translationX: -offset, y: 0)
                                                                toTransform = CGAffineTransform(translationX: offset, y: 0)
                                                                containerView.insertSubview(toView, at: 0)
                                                                //containerView.addSubview(toView)
                                                case .tabBar(let direction):
                                                                offset = direction == .left ? offset : -offset
                                                                fromTransform = CGAffineTransform(translationX: offset, y: 0)
                                                                toTransform = CGAffineTransform(translationX: -offset, y: 0)
                                                                containerView.addSubview(toView)
                                                case nil:
                                                                break
                                }
                                toView.transform = toTransform
                                UIView.animate(withDuration: duration, animations: {
                                                fromView.transform = fromTransform
                                                toView.transform = .identity
                                }) { (finished) in
                                                fromView.transform = .identity
                                                toView.transform = .identity
                                                //考虑到转场中途可能取消的情况,转场结束后,恢复视图状态。(通知是否完成转场)
                                                let wasCancelled = transitionContext.transitionWasCancelled
                                                transitionContext.completeTransition(!wasCancelled)
                                }
                }
}
    ///转场类型
///转场类型
enum TransitionType {
        //导航栏
    case navigation(_ operation: UINavigationController.Operation)
        //tabBar切换
    case tabBar(_ direction: TabBarOperationDirection)
        //模态跳转
    case modal(_ operation: ModalOperation)
                //导航栏
                case navigation(_ operation: UINavigationController.Operation)
                //tabBar切换
                case tabBar(_ direction: TabBarOperationDirection)
                //模态跳转
                case modal(_ operation: ModalOperation)
}
enum TabBarOperationDirection {
    case left
    case right
                case left
                case right
}
enum ModalOperation {
    case presentation
    case dismissal
                case presentation
                case dismissal
}
    ///自定义模态转场动画时使用
///自定义模态转场动画时使用
extension TransitionUtil: UIViewControllerTransitioningDelegate {
    func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        self.transitionType = .modal(.presentation)
        return self
    }
                func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
                                self.transitionType = .modal(.presentation)
                                return self
                }
    func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        self.transitionType = .modal(.dismissal)
        return self
    }
                func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
                                self.transitionType = .modal(.dismissal)
                                return self
                }
        //interactive false:非交互转场, true: 交互转场
    func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
        return interactive ? self.interactionTransition : nil
    }
                //interactive false:非交互转场, true: 交互转场
                func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
                                return interactive ? self.interactionTransition : nil
                }
        //interactive false:非交互转场, true: 交互转场
    func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
        return interactive ? self.interactionTransition : nil
    }
                //interactive false:非交互转场, true: 交互转场
                func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
                                return interactive ? self.interactionTransition : nil
                }
}
    /// 自定义navigation转场动画时使用
/// 自定义navigation转场动画时使用
extension TransitionUtil: UINavigationControllerDelegate {
    func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationController.Operation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        self.transitionType = .navigation(operation)
        return self
    }
                func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationController.Operation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
                                self.transitionType = .navigation(operation)
                                return self
                }
    func navigationController(_ navigationController: UINavigationController, interactionControllerFor animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
        return interactive ? self.interactionTransition : nil
    }
                func navigationController(_ navigationController: UINavigationController, interactionControllerFor animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
                                return interactive ? self.interactionTransition : nil
                }
}
    /// 自定义tab转场动画时使用
/// 自定义tab转场动画时使用
extension TransitionUtil: UITabBarControllerDelegate {
    func tabBarController(_ tabBarController: UITabBarController, animationControllerForTransitionFrom fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        let fromIndex = tabBarController.viewControllers?.firstIndex(of: fromVC) ?? 0
        let toIndex = tabBarController.viewControllers?.firstIndex(of: toVC) ?? 0
        let direction: TabBarOperationDirection = fromIndex < toIndex ? .right : .left
        self.transitionType = .tabBar(direction)
        return self
    }
                func tabBarController(_ tabBarController: UITabBarController, animationControllerForTransitionFrom fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
                                let fromIndex = tabBarController.viewControllers?.firstIndex(of: fromVC) ?? 0
                                let toIndex = tabBarController.viewControllers?.firstIndex(of: toVC) ?? 0
                                let direction: TabBarOperationDirection = fromIndex < toIndex ? .right : .left
                                self.transitionType = .tabBar(direction)
                                return self
                }
    func tabBarController(_ tabBarController: UITabBarController, interactionControllerFor animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
        return interactive ? self.interactionTransition : nil
    }
                func tabBarController(_ tabBarController: UITabBarController, interactionControllerFor animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
                                return interactive ? self.interactionTransition : nil
                }
}
extension TransitionUtil: UIViewControllerAnimatedTransitioning {
        //控制转场动画执行时间
    func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
        return 0.5
    }
                //控制转场动画执行时间
                func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
                                return 0.5
                }
        //执行动画的地方,最核心的方法。
    func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
        transitionAnimation(transitionContext: transitionContext)
    }
                //执行动画的地方,最核心的方法。
                func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
                                transitionAnimation(transitionContext: transitionContext)
                }
}
WanPai/Config/WeChatTools.swift
@@ -12,194 +12,194 @@
typealias WechatUserClosure = (WechatUserInfoModel?)->(Void)
struct WechatModel:HandyJSON{
    var access_token = ""
    var expires_in = 0
    var openid = ""
    var refresh_token = ""
    var scope = ""
    var unionid = ""
                var access_token = ""
                var expires_in = 0
                var openid = ""
                var refresh_token = ""
                var scope = ""
                var unionid = ""
}
struct WechatUserInfoModel:HandyJSON{
    var openid = ""
    var nickname = ""
    var sex = 1
    var province = ""
    var city = ""
    var country = ""
    var headimgurl = ""
    var privilege = ""
    var unionid = ""
                var openid = ""
                var nickname = ""
                var sex = 1
                var province = ""
                var city = ""
                var country = ""
                var headimgurl = ""
                var privilege = ""
                var unionid = ""
}
class WeChatTools{
    static func register(appid:String,link:String){
        WXApi.registerApp(appid, universalLink: link)
    }
        /// 授权登录
    static func sendAuthRequest(){
        let sendAuthReq = SendAuthReq()
        sendAuthReq.scope = "snsapi_userinfo"
        sendAuthReq.state = "WeParkLife_iOS"
        WXApi.send(sendAuthReq)
    }
        /// 完成授权登录,获取token
    static func getAccessToken(_ resp:SendAuthResp, loginInfo:WeachatClosure?){
        guard resp.code != nil else {
            return
        }
        let url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=\(WeChatAPPID)&secret=\(WeChatSecrect)&code=\(resp.code!)&grant_type=authorization_code"
        let Url = URL(string: url)
        let session = URLSession.shared
        let task = session.dataTask(with: Url!) { (data, response, error) in
            if error != nil{
                return
            }
            do{
                if let dataAsJSON = try JSONSerialization.jsonObject(with: data!) as? Dictionary<String, Any>{
                    let model = WechatModel.deserialize(from: dataAsJSON)
                    loginInfo?(model)
                }else{
                    loginInfo?(nil)
                static func register(appid:String,link:String){
                                WXApi.registerApp(appid, universalLink: link)
                }
            }catch{
                loginInfo?(nil)
            }
        }
        task.resume()
    }
        /// 获取用资料
    static func getUserInfo(access_token:String,openId:String,userInfo:WechatUserClosure?){
        guard !access_token.isEmpty else {
            return
        }
        guard !openId.isEmpty else {
            return
        }
        let url = "https://api.weixin.qq.com/sns/userinfo?access_token=\(access_token)&openid=\(openId)"
        let Url = URL(string: url)
        let session = URLSession.shared
        let task = session.dataTask(with: Url!) { (data, response, error) in
            if error != nil{
                return
            }
            do{
                if let dataAsJSON = try JSONSerialization.jsonObject(with: data!) as? Dictionary<String, Any>{
                    let model = WechatUserInfoModel.deserialize(from: dataAsJSON)
                    userInfo?(model)
                }else{
                    userInfo?(nil)
                /// 授权登录
                static func sendAuthRequest(){
                                let sendAuthReq = SendAuthReq()
                                sendAuthReq.scope = "snsapi_userinfo"
                                sendAuthReq.state = "WeParkLife_iOS"
                                WXApi.send(sendAuthReq)
                }
            }catch{
                userInfo?(nil)
            }
        }
        task.resume()
    }
        /// 分享文本
    static func shareText(_ text:String,scene:WXScene = WXSceneSession){
        let req = SendMessageToWXReq()
        req.bText = true
        req.text = text
        req.scene = Int32(scene.rawValue)
        WXApi.send(req)
    }
                /// 完成授权登录,获取token
                static func getAccessToken(_ resp:SendAuthResp, loginInfo:WeachatClosure?){
                                guard resp.code != nil else {
                                                return
                                }
                                let url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=\(WeChatAPPID)&secret=\(WeChatSecrect)&code=\(resp.code!)&grant_type=authorization_code"
                                let Url = URL(string: url)
                                let session = URLSession.shared
                                let task = session.dataTask(with: Url!) { (data, response, error) in
                                                if error != nil{
                                                                return
                                                }
                                                do{
                                                                if let dataAsJSON = try JSONSerialization.jsonObject(with: data!) as? Dictionary<String, Any>{
                                                                                let model = WechatModel.deserialize(from: dataAsJSON)
                                                                                loginInfo?(model)
                                                                }else{
                                                                                loginInfo?(nil)
                                                                }
                                                }catch{
                                                                loginInfo?(nil)
                                                }
                                }
                                task.resume()
                }
        /// 分享图片
    static func sharePic(_ img:UIImage,thumb:UIImage,scale:CGFloat = 0.6,scene:WXScene = WXSceneTimeline){
                /// 获取用资料
                static func getUserInfo(access_token:String,openId:String,userInfo:WechatUserClosure?){
                                guard !access_token.isEmpty else {
                                                return
                                }
        let imageObject = WXImageObject()
        imageObject.imageData = img.jpegData(compressionQuality: scale)!
                                guard !openId.isEmpty else {
                                                return
                                }
        let mediaMessage = WXMediaMessage()
        mediaMessage.thumbData = thumb.jpegData(compressionQuality: scale)
        mediaMessage.mediaObject = imageObject
                                let url = "https://api.weixin.qq.com/sns/userinfo?access_token=\(access_token)&openid=\(openId)"
                                let Url = URL(string: url)
                                let session = URLSession.shared
                                let task = session.dataTask(with: Url!) { (data, response, error) in
                                                if error != nil{
                                                                return
                                                }
                                                do{
                                                                if let dataAsJSON = try JSONSerialization.jsonObject(with: data!) as? Dictionary<String, Any>{
                                                                                let model = WechatUserInfoModel.deserialize(from: dataAsJSON)
                                                                                userInfo?(model)
                                                                }else{
                                                                                userInfo?(nil)
                                                                }
                                                }catch{
                                                                userInfo?(nil)
                                                }
                                }
                                task.resume()
                }
        let req = SendMessageToWXReq()
        req.bText = false
        req.message = mediaMessage
        req.scene = Int32(scene.rawValue)
        WXApi.send(req)
    }
                /// 分享文本
                static func shareText(_ text:String,scene:WXScene = WXSceneSession){
                                let req = SendMessageToWXReq()
                                req.bText = true
                                req.text = text
                                req.scene = Int32(scene.rawValue)
                                WXApi.send(req)
                }
        /// 分享音乐
    static func shareMusic(_ musicUrl:String,musicLowBandUrl:String,title:String,desc:String,thumb:UIImage,scene:WXScene = WXSceneSession){
        let musicObject = WXMusicObject()
        musicObject.musicUrl = musicUrl
        musicObject.musicLowBandUrl = musicLowBandUrl
                /// 分享图片
                static func sharePic(_ img:UIImage,thumb:UIImage,scale:CGFloat = 0.6,scene:WXScene = WXSceneTimeline){
        let mediaMessage  = WXMediaMessage()
        mediaMessage.title = title
        mediaMessage.description = desc
        mediaMessage.setThumbImage(thumb)
        mediaMessage.mediaObject = musicObject
                                let imageObject = WXImageObject()
                                imageObject.imageData = img.jpegData(compressionQuality: scale)!
        let req = SendMessageToWXReq()
        req.bText = false
        req.message = mediaMessage
        req.scene = Int32(scene.rawValue)
        WXApi.send(req)
    }
                                let mediaMessage = WXMediaMessage()
                                mediaMessage.thumbData = thumb.jpegData(compressionQuality: scale)
                                mediaMessage.mediaObject = imageObject
        /// 分享音乐
    static func shareMusic(_ musicData:String,musicLowBandData:String,title:String,desc:String,thumb:UIImage,scene:WXScene = WXSceneSession){
        let musicObject = WXMusicObject()
        musicObject.musicDataUrl = musicData
        musicObject.musicLowBandUrl = musicLowBandData
                                let req = SendMessageToWXReq()
                                req.bText = false
                                req.message = mediaMessage
                                req.scene = Int32(scene.rawValue)
                                WXApi.send(req)
                }
        let mediaMessage  = WXMediaMessage()
        mediaMessage.title = title
        mediaMessage.description = desc
        mediaMessage.setThumbImage(thumb)
        mediaMessage.mediaObject = musicObject
                /// 分享音乐
                static func shareMusic(_ musicUrl:String,musicLowBandUrl:String,title:String,desc:String,thumb:UIImage,scene:WXScene = WXSceneSession){
                                let musicObject = WXMusicObject()
                                musicObject.musicUrl = musicUrl
                                musicObject.musicLowBandUrl = musicLowBandUrl
        let req = SendMessageToWXReq()
        req.bText = false
        req.message = mediaMessage
        req.scene = Int32(scene.rawValue)
        WXApi.send(req)
    }
                                let mediaMessage  = WXMediaMessage()
                                mediaMessage.title = title
                                mediaMessage.description = desc
                                mediaMessage.setThumbImage(thumb)
                                mediaMessage.mediaObject = musicObject
    static func shareUrl(_ url:String,title:String,desc:String,thumb:UIImage,scene:WXScene = WXSceneSession){
                                let req = SendMessageToWXReq()
                                req.bText = false
                                req.message = mediaMessage
                                req.scene = Int32(scene.rawValue)
                                WXApi.send(req)
                }
        let webpageObject  = WXWebpageObject()
        webpageObject.webpageUrl = url
                /// 分享音乐
                static func shareMusic(_ musicData:String,musicLowBandData:String,title:String,desc:String,thumb:UIImage,scene:WXScene = WXSceneSession){
                                let musicObject = WXMusicObject()
                                musicObject.musicDataUrl = musicData
                                musicObject.musicLowBandUrl = musicLowBandData
        let mediaMessage  = WXMediaMessage()
        mediaMessage.title = title
        mediaMessage.description = desc
        mediaMessage.setThumbImage(thumb)
        mediaMessage.mediaObject = webpageObject
                                let mediaMessage  = WXMediaMessage()
                                mediaMessage.title = title
                                mediaMessage.description = desc
                                mediaMessage.setThumbImage(thumb)
                                mediaMessage.mediaObject = musicObject
        let req = SendMessageToWXReq()
        req.bText = false
        req.message = mediaMessage
        req.scene = Int32(scene.rawValue)
        WXApi.send(req)
    }
                                let req = SendMessageToWXReq()
                                req.bText = false
                                req.message = mediaMessage
                                req.scene = Int32(scene.rawValue)
                                WXApi.send(req)
                }
    static func shareVideo(_ url:String,videoLowBandUrl:String,title:String,desc:String,thumb:UIImage, scene:WXScene = WXSceneSession){
        let videoObject = WXVideoObject()
        videoObject.videoUrl = url
        videoObject.videoLowBandUrl = videoLowBandUrl
                static func shareUrl(_ url:String,title:String,desc:String,thumb:UIImage,scene:WXScene = WXSceneSession){
        let mediaMessage  = WXMediaMessage()
        mediaMessage.title = title
        mediaMessage.description = desc
        mediaMessage.setThumbImage(thumb)
        mediaMessage.mediaObject = videoObject
                                let webpageObject  = WXWebpageObject()
                                webpageObject.webpageUrl = url
        let req = SendMessageToWXReq()
        req.bText = false
        req.message = mediaMessage
        req.scene = Int32(scene.rawValue)
        WXApi.send(req)
    }
                                let mediaMessage  = WXMediaMessage()
                                mediaMessage.title = title
                                mediaMessage.description = desc
                                mediaMessage.setThumbImage(thumb)
                                mediaMessage.mediaObject = webpageObject
                                let req = SendMessageToWXReq()
                                req.bText = false
                                req.message = mediaMessage
                                req.scene = Int32(scene.rawValue)
                                WXApi.send(req)
                }
                static func shareVideo(_ url:String,videoLowBandUrl:String,title:String,desc:String,thumb:UIImage, scene:WXScene = WXSceneSession){
                                let videoObject = WXVideoObject()
                                videoObject.videoUrl = url
                                videoObject.videoLowBandUrl = videoLowBandUrl
                                let mediaMessage  = WXMediaMessage()
                                mediaMessage.title = title
                                mediaMessage.description = desc
                                mediaMessage.setThumbImage(thumb)
                                mediaMessage.mediaObject = videoObject
                                let req = SendMessageToWXReq()
                                req.bText = false
                                req.message = mediaMessage
                                req.scene = Int32(scene.rawValue)
                                WXApi.send(req)
                }
}
WanPai/Root/Activity/VC/ActivityDetailApplyVC.swift
@@ -223,7 +223,20 @@
                                                                                                                                                self?.push(vc: vc)
                                                                                                                }
                                                                                                }
                                                                                case .wechat:break
                                                                                case .wechat:
                                                                                                let req = YYWeChatPayRequest(partnerId: m.partnerid, prepayId: m.prepayid, package: m.package, nonceStr: m.noncestr, timeStamp: m.timestamp, sign: m.sign)
                                                                                                YYPaymentManager.shared.sendPaymentRequest(req) { result in
                                                                                                                switch result {
                                                                                                                                case .success:
                                                                                                                                                let vc = PaymentResultVC(result: .success, objType: .activityApply)
                                                                                                                                                self?.push(vc: vc)
                                                                                                                                case .cancel:
                                                                                                                                                alert(msg: "已取消")
                                                                                                                                case .failure(_):
                                                                                                                                                let vc = PaymentResultVC(result: .fail("支付失败",0), objType: .activityApply)
                                                                                                                                                self?.push(vc: vc)
                                                                                                                }
                                                                                                }
                                                                                case .coin,.free:
                                                                                                let vc = PaymentResultVC(result: .success, objType: .activityApply)
                                                                                                self?.push(vc: vc)
WanPai/Root/Course/VC/AddStudentVC.swift
@@ -187,6 +187,7 @@
                                studentModel.phone = tf_phone.text!
                                studentModel.idCard = tf_idCard.text!
                                studentModel.name = tf_name.text!
                                studentModel.birthday = tf_birthday.text!
                                if profileImg != nil{
                                                showHUD("正在上传头像")
WanPai/Root/Course/VC/CourseDetailVC.swift
@@ -11,218 +11,218 @@
class CourseDetailVC: BaseVC {
    @IBOutlet weak var view_banner: CommonBannerView!
    @IBOutlet weak var label_title: UILabel!
    @IBOutlet weak var label_local: UILabel!
    @IBOutlet weak var label_distance: UILabel!
    @IBOutlet weak var label_listenWeek: UILabel!
    @IBOutlet weak var view_listen: UIView!
    @IBOutlet weak var label_listenTime: UILabel!
    @IBOutlet weak var img_1: UIImageView!
    @IBOutlet weak var cons_img1Height: NSLayoutConstraint!
    @IBOutlet weak var label_courseType: UILabel!
    @IBOutlet weak var label_vaildTime: UILabel!
    @IBOutlet weak var view_vaildTime: UIView!
    @IBOutlet weak var view_handle: UIView!
    @IBOutlet weak var label_price: UILabel!
    @IBOutlet weak var label_originPrice: UILabel!
    @IBOutlet weak var label_vipPrice: UILabel!
    @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
                @IBOutlet weak var view_banner: CommonBannerView!
                @IBOutlet weak var label_title: UILabel!
                @IBOutlet weak var label_local: UILabel!
                @IBOutlet weak var label_distance: UILabel!
                @IBOutlet weak var label_listenWeek: UILabel!
                @IBOutlet weak var view_listen: UIView!
                @IBOutlet weak var label_listenTime: UILabel!
                @IBOutlet weak var img_1: UIImageView!
                @IBOutlet weak var cons_img1Height: NSLayoutConstraint!
                @IBOutlet weak var label_courseType: UILabel!
                @IBOutlet weak var label_vaildTime: UILabel!
                @IBOutlet weak var view_vaildTime: UIView!
                @IBOutlet weak var view_handle: UIView!
    private var signUpCourseModel:SignUpCourseItemDetailModel?
    private var detailModel:CourseDetailModel?{
        didSet{
                @IBOutlet weak var label_price: UILabel!
                @IBOutlet weak var label_originPrice: UILabel!
                @IBOutlet weak var label_vipPrice: UILabel!
                @IBOutlet weak var label_coin: UILabel!
                @IBOutlet weak var cons_handleHei: NSLayoutConstraint!
                @IBOutlet weak var btn_enroll: UIButton!
                @IBOutlet weak var view_tag: UIView!
            if let m = detailModel{
                label_title.text = m.name
                label_distance.text = String(format: "距离我%.2lfkm", m.distance)
                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
                private var id = 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))
                label_courseType.layoutIfNeeded()
                private var signUpCourseModel:SignUpCourseItemDetailModel?
                private var detailModel:CourseDetailModel?{
                                didSet{
                img_1.sd_setImage(with: URL(string: m.introduceDrawing)) { image, error, type, url in
                    let radio = image!.size.width / image!.size.height
                    self.cons_img1Height.constant = JQ_ScreenW / radio
                }
                                                if let m = detailModel{
                                                                label_title.text = m.name
                                                                label_distance.text = String(format: "距离我%.2lfkm", m.distance)
                                                                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
                let imgs = m.detailDrawing.components(separatedBy: ",")
                var items = [CommonBannerModel]()
                for (index,img) in imgs.enumerated(){
                    items.append(CommonBannerModel(index: index,resource: img,mediaType: .imageUrl))
                }
                view_banner.setItems(items: items)
                                                                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))
                                                                label_courseType.layoutIfNeeded()
                var tempSub = m.list.first
                if signUpCourseModel?.chooseHours != nil{
                    for v in m.list{
                        if v.classHours == signUpCourseModel?.chooseHours{
                            tempSub = v;break
                        }
                    }
                }
                                                                img_1.sd_setImage(with: URL(string: m.introduceDrawing)) { image, error, type, url in
                                                                                let radio = image!.size.width / image!.size.height
                                                                                self.cons_img1Height.constant = JQ_ScreenW / radio
                                                                }
                if let subM = tempSub {
                    switch subM.payType {
                        case .coin:
                            label_price.text = ""
                            label_price.isHidden = true
                            label_originPrice.isHidden = true
                            label_vipPrice.isHidden = true
                            label_coin.isHidden = false
                            //玩湃币
                            label_coin.attributedText = AttributedStringbuilder.build()
                                .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                                .add(string: "\(subM.playPaiCoin )币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString
                                                                let imgs = m.detailDrawing.components(separatedBy: ",")
                                                                var items = [CommonBannerModel]()
                                                                for (index,img) in imgs.enumerated(){
                                                                                items.append(CommonBannerModel(index: index,resource: img,mediaType: .imageUrl))
                                                                }
                                                                view_banner.setItems(items: items)
                        case .cash:
                            fallthrough
                        case .cashCoin:
                            if subM.originalPrice == 0 || subM.originalPrice == subM.paymentPrice{
                                label_originPrice.isHidden = true
                            }else{
                                label_originPrice.isHidden = false
                            }
                            label_coin.isHidden = subM.payType == .cash
                                //玩湃币
                            label_coin.attributedText = AttributedStringbuilder.build()
                                .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                                .add(string: "\(subM.playPaiCoin )币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString
                                                                var tempSub = m.list.first
                                                                if signUpCourseModel?.chooseHours != nil{
                                                                                for v in m.list{
                                                                                                if v.classHours == signUpCourseModel?.chooseHours{
                                                                                                                tempSub = v;break
                                                                                                }
                                                                                }
                                                                }
                                //原价
                            let attribute = AttributedStringbuilder.build().add(string: subM.originalPrice.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).delLine(color: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58))
                            label_originPrice.attributedText = attribute.mutableAttributedString
                                                                if let subM = tempSub {
                                                                                switch subM.payType {
                                                                                                case .coin:
                                                                                                                label_price.text = ""
                                                                                                                label_price.isHidden = true
                                                                                                                label_originPrice.isHidden = true
                                                                                                                label_vipPrice.isHidden = true
                                                                                                                label_coin.isHidden = false
                                                                                                                //玩湃币
                                                                                                                label_coin.attributedText = AttributedStringbuilder.build()
                                                                                                                                .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                                                                                                                                .add(string: "\(subM.playPaiCoin )币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString
                            if UserInfoModel.get()?.isVip == 1{
                                if subM.payType != .coin{
                                        //会员
                                    label_vipPrice.isHidden = true
                                        //优惠价比会员价更优惠
                                    if subM.paymentPrice < subM.vipPrice && subM.paymentPrice != 0{
                                        label_price.text = subM.paymentPrice.currency()
                                    }
                                        //会员价比优惠价更优惠
                                    else if subM.vipPrice < subM.paymentPrice && subM.vipPrice != 0{
                                        label_price.text = subM.vipPrice.currency()
                                    }else if subM.vipPrice != 0 && subM.paymentPrice != 0{
                                            //会员价和优惠价一样
                                        label_price.text = min(subM.vipPrice,subM.paymentPrice).currency()
                                    }else{
                                        label_price.text = subM.paymentPrice.currency()
                                    }
                                                                                                case .cash:
                                                                                                                fallthrough
                                                                                                case .cashCoin:
                                                                                                                if subM.originalPrice == 0 || subM.originalPrice == subM.paymentPrice{
                                                                                                                                label_originPrice.isHidden = true
                                                                                                                }else{
                                                                                                                                label_originPrice.isHidden = false
                                                                                                                }
                                                                                                                label_coin.isHidden = subM.payType == .cash
                                                                                                                //玩湃币
                                                                                                                label_coin.attributedText = AttributedStringbuilder.build()
                                                                                                                                .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                                                                                                                                .add(string: "\(subM.playPaiCoin )币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString
                                                                                                                //原价
                                                                                                                let attribute = AttributedStringbuilder.build().add(string: subM.originalPrice.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).delLine(color: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58))
                                                                                                                label_originPrice.attributedText = attribute.mutableAttributedString
                                                                                                                if UserInfoModel.get()?.isVip == 1{
                                                                                                                                if subM.payType != .coin{
                                                                                                                                                //会员
                                                                                                                                                label_vipPrice.isHidden = true
                                                                                                                                                //优惠价比会员价更优惠
                                                                                                                                                if subM.paymentPrice < subM.vipPrice && subM.paymentPrice != 0{
                                                                                                                                                                label_price.text = subM.paymentPrice.currency()
                                                                                                                                                }
                                                                                                                                                //会员价比优惠价更优惠
                                                                                                                                                else if subM.vipPrice < subM.paymentPrice && subM.vipPrice != 0{
                                                                                                                                                                label_price.text = subM.vipPrice.currency()
                                                                                                                                                }else if subM.vipPrice != 0 && subM.paymentPrice != 0{
                                                                                                                                                                //会员价和优惠价一样
                                                                                                                                                                label_price.text = min(subM.vipPrice,subM.paymentPrice).currency()
                                                                                                                                                }else{
                                                                                                                                                                label_price.text = subM.paymentPrice.currency()
                                                                                                                                                }
                                                                                                                                }
                                                                                                                }else{
                                                                                                                                if subM.payType != .coin{
                                                                                                                                                //非会员
                                                                                                                                                label_vipPrice.isHidden = subM.vipPrice == 0 || subM.vipPrice == subM.paymentPrice
                                                                                                                                                let vipAttribute = AttributedStringbuilder.build()
                                                                                                                                                                .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                                                                                                                                                                .add(string: subM.vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
                                                                                                                                                label_vipPrice.attributedText = vipAttribute.mutableAttributedString
                                                                                                                                                if subM.originalPrice != 0 && subM.paymentPrice == 0{
                                                                                                                                                                label_price.text = subM.originalPrice.currency()
                                                                                                                                                }else if subM.originalPrice == 0 && subM.paymentPrice != 0{
                                                                                                                                                                label_price.text = subM.paymentPrice.currency()
                                                                                                                                                }else if subM.originalPrice != 0 && subM.paymentPrice != 0{
                                                                                                                                                                label_price.text = min(subM.originalPrice,subM.paymentPrice).currency()
                                                                                                                                                }else{
                                                                                                                                                                label_price.text = subM.originalPrice.currency()
                                                                                                                                                }
                                                                                                                                }
                                                                                                                }
                                                                                }
                                                                }
                                                                if m.type == .experience{
                                                                                if  m.list.first?.paymentPrice != 0{
                                                                                                label_price.text = (m.list.first!.paymentPrice).currency()
                                                                                                label_price.isHidden = false
                                                                                }
                                                                                label_vaildTime.text = "购买当天有效"
                                                                                label_originPrice.isHidden = true
                                                                                label_vipPrice.isHidden = true
                                                                                view_listen.isHidden = true
                                                                                //                    label_price.isHidden = (m.list.first?.paymentPrice ?? 0) == 0
                                                                }
                                                                //体验课,假期课不展示
                                                                if m.type != .normal && signUpCourseModel != nil{
                                                                                view_handle.isHidden = true
                                                                                cons_handleHei.constant = 0
                                                                }
                                                                //                if label_originPrice.isHidden && label_vipPrice.isHidden && label_coin.isHidden{
                                                                //                    label_coin.alpha = 0
                                                                //                }
                                                }
                                }
                            }else{
                                if subM.payType != .coin{
                                        //非会员
                                    label_vipPrice.isHidden = subM.vipPrice == 0 || subM.vipPrice == subM.paymentPrice
                                    let vipAttribute = AttributedStringbuilder.build()
                                        .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                                        .add(string: subM.vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
                                    label_vipPrice.attributedText = vipAttribute.mutableAttributedString
                }
                required init(id:Int,signUpCourseModel:SignUpCourseItemDetailModel? = nil) {
                                super.init(nibName: nil, bundle: nil)
                                self.id = id
                                self.signUpCourseModel = signUpCourseModel
                }
                                    if subM.originalPrice != 0 && subM.paymentPrice == 0{
                                        label_price.text = subM.originalPrice.currency()
                                    }else if subM.originalPrice == 0 && subM.paymentPrice != 0{
                                        label_price.text = subM.paymentPrice.currency()
                                    }else if subM.originalPrice != 0 && subM.paymentPrice != 0{
                                        label_price.text = min(subM.originalPrice,subM.paymentPrice).currency()
                                    }else{
                                        label_price.text = subM.originalPrice.currency()
                                    }
                required init?(coder: NSCoder) {
                                fatalError("init(coder:) has not been implemented")
                }
                override func viewDidLoad() {
                                super.viewDidLoad()
                                title = "运动营详情"
                                if signUpCourseModel?.payStatus == .unPayment{
                                                btn_enroll.setTitle("待支付", for: .normal)
                                }else if signUpCourseModel?.payStatus == .paymented{
                                                btn_enroll.setTitle("续课", for: .normal)
                                }
                            }
                    }
                                Services.queryCourseInfo(id: id).subscribe(onNext: { data in
                                                if let m = data.data{
                                                                self.detailModel = m
                                                }
                                }).disposed(by: disposeBag)
                }
                if m.type == .experience{
                override func setUI() {
                    if  m.list.first?.paymentPrice != 0{
                        label_price.text = (m.list.first!.paymentPrice).currency()
                        label_price.isHidden = false
                    }
                    label_vaildTime.text = "购买当天有效"
                    label_originPrice.isHidden = true
                    label_vipPrice.isHidden = true
                    view_listen.isHidden = true
//                    label_price.isHidden = (m.list.first?.paymentPrice ?? 0) == 0
                }
                    //体验课,假期课不展示
                if m.type != .normal && signUpCourseModel != nil{
                    view_handle.isHidden = true
                    cons_handleHei.constant = 0
                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)
                }
//                if label_originPrice.isHidden && label_vipPrice.isHidden && label_coin.isHidden{
//                    label_coin.alpha = 0
//                }
            }
        }
    }
                @IBAction func applyAction(_ sender: UIButton) {
                                if let m = detailModel{
                                                let vc = CourseDetailApplyVC(detailModel: m,signUpModel: signUpCourseModel)
                                                push(vc: vc)
                                }
                }
    required init(id:Int,signUpCourseModel:SignUpCourseItemDetailModel? = nil) {
        super.init(nibName: nil, bundle: nil)
        self.id = id
        self.signUpCourseModel = signUpCourseModel
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "运动营详情"
        if signUpCourseModel?.payStatus == .unPayment{
            btn_enroll.setTitle("待支付", for: .normal)
        }else if signUpCourseModel?.payStatus == .paymented{
            btn_enroll.setTitle("续课", for: .normal)
        }
        Services.queryCourseInfo(id: id).subscribe(onNext: { data in
            if let m = data.data{
                self.detailModel = m
            }
        }).disposed(by: disposeBag)
    }
    override func setUI() {
    }
    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) {
        if let m = detailModel{
            let vc = CourseDetailApplyVC(detailModel: m,signUpModel: signUpCourseModel)
           push(vc: vc)
        }
    }
    @IBAction func localAction(_ sender: UIButton) {
        if let m = detailModel{
            JQ_MapNavigationTool.startNav(CLLocationCoordinate2D(latitude: m.lat.toDouble, longitude: m.lon.toDouble), distanceName: m.storeAddress, scheme: "weparklife")
        }
    }
                @IBAction func localAction(_ sender: UIButton) {
                                if let m = detailModel{
                                                JQ_MapNavigationTool.startNav(CLLocationCoordinate2D(latitude: m.lat.toDouble, longitude: m.lon.toDouble), distanceName: m.storeAddress, scheme: "weparklife")
                                }
                }
}
WanPai/Root/Course/View/CourseUnAssignView.swift
@@ -11,115 +11,115 @@
import RxSwift
class CourseUnAssignView: UIView,JQNibView{
    @IBOutlet weak var view_container: UIView!
    @IBOutlet weak var tableView: UITableView!
    @IBOutlet weak var cons_tableHei: NSLayoutConstraint!
    @IBOutlet weak var label_num: UILabel!
    private var selectIndex:Int?
    private var list = [StartClouseListModel]()
    private let disposeBag = DisposeBag()
    override func awakeFromNib() {
        super.awakeFromNib()
        view_container.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
        alpha = 0
        layoutIfNeeded()
        tableView.delegate = self
        tableView.dataSource = self
        tableView.separatorStyle = .none
        cons_tableHei.constant = 45 * 5
    }
    static func show(_ list:[StartClouseListModel],num:Int){
        let unassignView = CourseUnAssignView.jq_loadNibView()
        unassignView.frame = sceneDelegate?.window?.frame ?? .zero
        unassignView.label_num.text = "未分配课时数:\(num)"
        unassignView.list = list.filter({$0.isAble == 1})
        sceneDelegate?.window?.addSubview(unassignView)
        UIView.animate(withDuration: 0.5) {
            unassignView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
            unassignView.alpha = 1
        }
        unassignView.tableView.reloadData()
    }
    @IBAction func closeAction(_ sender: UIButton) {
        UIView.animate(withDuration: 0.5) {
            self.view_container.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
            self.alpha = 0
        } completion: { _ in
            self.removeFromSuperview()
        }
    }
    @IBAction func completeAction(_ sender: UIButton) {
        guard selectIndex != nil else {
            alert(msg: "请选择要分配的课时");return
        }
        let m = list[selectIndex!]
        Services.weeksOfAddHours(packetId: m.id).subscribe(onNext: { data in
            UIView.animate(withDuration: 0.5) {
                self.view_container.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
                self.alpha = 0
            } completion: { _ in
                self.removeFromSuperview()
                NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil)
            }
        }) { error in
        }.disposed(by: disposeBag)
    }
                @IBOutlet weak var view_container: UIView!
                @IBOutlet weak var tableView: UITableView!
                @IBOutlet weak var cons_tableHei: NSLayoutConstraint!
                @IBOutlet weak var label_num: UILabel!
                private var selectIndex:Int?
                private var list = [StartClouseListModel]()
                private let disposeBag = DisposeBag()
                override func awakeFromNib() {
                                super.awakeFromNib()
                                view_container.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
                                alpha = 0
                                layoutIfNeeded()
                                tableView.delegate = self
                                tableView.dataSource = self
                                tableView.separatorStyle = .none
                                cons_tableHei.constant = 45 * 5
                }
                static func show(_ list:[StartClouseListModel],num:Int){
                                let unassignView = CourseUnAssignView.jq_loadNibView()
                                unassignView.frame = sceneDelegate?.window?.frame ?? .zero
                                unassignView.label_num.text = "未分配课时数:\(num)"
                                unassignView.list = list.filter({$0.isAble == 1})
                                sceneDelegate?.window?.addSubview(unassignView)
                                UIView.animate(withDuration: 0.5) {
                                                unassignView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
                                                unassignView.alpha = 1
                                }
                                unassignView.tableView.reloadData()
                }
                @IBAction func closeAction(_ sender: UIButton) {
                                UIView.animate(withDuration: 0.5) {
                                                self.view_container.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
                                                self.alpha = 0
                                } completion: { _ in
                                                self.removeFromSuperview()
                                }
                }
                @IBAction func completeAction(_ sender: UIButton) {
                                guard selectIndex != nil else {
                                                alert(msg: "请选择要分配的课时");return
                                }
                                let m = list[selectIndex!]
                                Services.weeksOfAddHours(packetId: m.id).subscribe(onNext: { data in
                                                UIView.animate(withDuration: 0.5) {
                                                                self.view_container.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
                                                                self.alpha = 0
                                                } completion: { _ in
                                                                self.removeFromSuperview()
                                                                NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil)
                                                }
                                }) { error in
                                }.disposed(by: disposeBag)
                }
}
extension CourseUnAssignView:UITableViewDelegate{
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        selectIndex = indexPath.row
        tableView.reloadData()
    }
                func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
                                selectIndex = indexPath.row
                                tableView.reloadData()
                }
}
extension CourseUnAssignView:UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return list.count
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        var cell = tableView.dequeueReusableCell(withIdentifier: "_cell\(indexPath.row)")
        if cell == nil{
            cell = UITableViewCell(style: .default, reuseIdentifier: "_cell\(indexPath.row)")
            let btn = QMUIButton(type: .custom)
            btn.tag = 1100 + indexPath.row
            btn.isUserInteractionEnabled = false
            btn.setTitle("运动营", for: .normal)
            btn.setTitleColor(.black, for: .normal)
            btn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .medium)
            btn.setImage(UIImage(named: "btn_choose"), for: .normal)
            btn.setImage(UIImage(named: "btn_choose_s"), for: .selected)
            btn.imageView?.size = CGSize(width: 20, height: 20)
            btn.imagePosition = .left
            btn.spacingBetweenImageAndTitle = 13
            cell?.contentView.addSubview(btn)
            btn.snp.makeConstraints { make in
                make.center.equalToSuperview()
            }
        }
        if let btnTag = cell!.viewWithTag(1100 + indexPath.row) as? QMUIButton{
            btnTag.setTitle(list[indexPath.row].courseName, for: .normal)
            if selectIndex == indexPath.row{
                btnTag.isSelected = true
            }else{
                btnTag.isSelected = false
            }
        }
        cell!.selectionStyle = .none
        return cell!
    }
                func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
                                return list.count
                }
                func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
                                var cell = tableView.dequeueReusableCell(withIdentifier: "_cell\(indexPath.row)")
                                if cell == nil{
                                                cell = UITableViewCell(style: .default, reuseIdentifier: "_cell\(indexPath.row)")
                                                let btn = QMUIButton(type: .custom)
                                                btn.tag = 1100 + indexPath.row
                                                btn.isUserInteractionEnabled = false
                                                btn.setTitle("运动营", for: .normal)
                                                btn.setTitleColor(.black, for: .normal)
                                                btn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .medium)
                                                btn.setImage(UIImage(named: "btn_choose"), for: .normal)
                                                btn.setImage(UIImage(named: "btn_choose_s"), for: .selected)
                                                btn.imageView?.size = CGSize(width: 20, height: 20)
                                                btn.imagePosition = .left
                                                btn.spacingBetweenImageAndTitle = 13
                                                cell?.contentView.addSubview(btn)
                                                btn.snp.makeConstraints { make in
                                                                make.center.equalToSuperview()
                                                }
                                }
                                if let btnTag = cell!.viewWithTag(1100 + indexPath.row) as? QMUIButton{
                                                btnTag.setTitle(list[indexPath.row].courseName, for: .normal)
                                                if selectIndex == indexPath.row{
                                                                btnTag.isSelected = true
                                                }else{
                                                                btnTag.isSelected = false
                                                }
                                }
                                cell!.selectionStyle = .none
                                return cell!
                }
}
WanPai/Root/Games/TCell/GamesTCell.swift
@@ -41,7 +41,7 @@
                                                guard let weakSelf = self else { return }
                                                PaymentView.show(enumType:.game,money: (ali: weakSelf.gameListModel.cash, wx: weakSelf.gameListModel.cash, coin: weakSelf.gameListModel.playCoin, course: nil,integral:weakSelf.gameListModel.integral)) { [weak self] payType in
                                                                guard let weakSelf = self else { return }
                                                                Services.payGame(configId: weakSelf.gameListModel.id, gameId: weakSelf.gameListModel.gameId, spaceId: weakSelf.storeId, sutuId: weakSelf.sutuId, type: payType,gameType: weakSelf.gameListModel.gameType).subscribe(onNext: {data in
                Services.payGame(configId: weakSelf.gameListModel.id, gameId: weakSelf.gameListModel.gameId, spaceId: weakSelf.spaceId, sutuId: weakSelf.sutuId, type: payType,gameType: weakSelf.gameListModel.gameType).subscribe(onNext: {data in
                                                                                if let m = data.data{
                                                                                                if m.isStaff{
WanPai/Root/Home/VC/HomeVC.swift
@@ -235,6 +235,27 @@
                }
                @IBAction func scanAction(_ sender: UIButton) {
        if let model = QRCodeModel.deserialize(from: "{\"scan_type\": 1000, \"space_id\": 27, \"sutu_id\": 1036}"){
            if model.scan_type == .games{
                let gamesListVC = GamesListVC(model: model)
                self.push(vc: gamesListVC)
            }else if model.scan_type == .yard{
                let vc = YardDetailVC(id: model.id!)
                self.push(vc: vc)
            }else if model.scan_type == .course{
                let vc = CourseDetailVC(id: model.id!)
                self.push(vc: vc)
            }
        }else{
            alertError(msg: "识别失败")
        }
return
                                let codeVC = CommonScanQRCodeVC {[weak self] text, status in
                                                if status{
                                                                if let model = QRCodeModel.deserialize(from: text){
WanPai/Root/Other/View/CommonDatePickerView.swift
@@ -183,8 +183,11 @@
                                                switch type{
                                                                case .YMD:
                                                                                let year = years[pickerView.selectedRow(inComponent: 0)]
                                                                                let month = months[pickerView.selectedRow(inComponent: 1)]
                                                                                var month = months[pickerView.selectedRow(inComponent: 1)]
                                                                                if year == Date().jq_nowYear(){
                                                                                                month = Date().jq_nowMonth() - pickerView.selectedRow(inComponent: 1)
                                                                                }
                                                                                if year == Date().jq_nowYear() && month == Date().jq_nowMonth(){
                                                                                                return Date().jq_nowDay()
                                                                                }else{
@@ -221,8 +224,9 @@
                                if component == 1{
                                                switch type{
                                                                case .YM,.YMD:
                                                                                let nowMonth = Date().jq_nowMonth()
                                                                                if pickerView.selectedRow(inComponent: 0) == 0{
                                                                                                return "\(11 - Date().jq_nowMonth() - row - 1)月"
                                                                                                return "\(nowMonth - row)月"
                                                                                }
                                                                                return "\(months[row])月"
                                                                case .HHmm:return String(format: "%02ld分", minutes[row])
WanPai/Root/Search/VC/WorldCupContentVC.swift
@@ -9,6 +9,7 @@
import RxSwift
import RxRelay
import RxDataSources
import SnapKit
let WorldCupRefresh_Noti = Notification.Name.init("WorldCupRefresh_Noti")
WanPai/Root/Search/VC/WorldCupRecordVC.swift
@@ -8,6 +8,7 @@
import UIKit
import RxSwift
import RxCocoa
import SnapKit
class WorldCupRecordViewModel:RefreshInnerModel<WorldCupMatchRecordDataModel>{
WanPai/Root/Welfare/VC/WelfareExchangeRecordSubListVC.swift
@@ -8,6 +8,7 @@
import UIKit
import RxRelay
import RxSwift
import SnapKit
class RecordsViewModel:RefreshModel<RecordsModel>{
    let goodsType = BehaviorRelay<ExchangeType?>(value: nil)
WanPai/Root/Yard/VC/YardBookingDetailVC.swift
@@ -263,6 +263,7 @@
                                                                                                                                                YYPaymentManager.shared.sendPaymentRequest(YYAlipayRequest(orderString: m.orderString)) { result in
                                                                                                                                                                switch result {
                                                                                                                                                                                case .success:
                                                                                                                                                                                                self?.getData()
                                                                                                                                                                                                let vc = PaymentResultVC(result: .success, objType: .activityApply)
                                                                                                                                                                                                self?.push(vc: vc)
                                                                                                                                                                                case .cancel:
@@ -276,6 +277,7 @@
                                                                                                                                                YYPaymentManager.shared.sendPaymentRequest(YYWeChatPayRequest(partnerId: m.partnerid, prepayId: m.prepayid, package: m.package, nonceStr: m.noncestr, timeStamp: m.timestamp, sign: m.sign)) { result in
                                                                                                                                                                switch result {
                                                                                                                                                                                case .success:
                                                                                                                                                                                                self?.getData()
                                                                                                                                                                                                let vc = PaymentResultVC(result: .success, objType: .activityApply)
                                                                                                                                                                                                self?.push(vc: vc)
                                                                                                                                                                                case .cancel:
WanPai/Root/Yard/VC/YardBookingListVC.swift
@@ -12,114 +12,114 @@
class YardBookingListVC: BaseVC {
    private var pageMenu:SPPageMenu = {
        let pageMenu = SPPageMenu(frame: .zero, trackerStyle: .line)
        // 追踪线
        pageMenu.trackerWidth = 56
        pageMenu.setTrackerHeight(3, cornerRadius: 1.5)
        pageMenu.tracker.backgroundColor = UIColor(hexStr: "#FF9D2E")
        pageMenu.trackerFollowingMode = .always
        pageMenu.contentInset = UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 14)
                private var pageMenu:SPPageMenu = {
                                let pageMenu = SPPageMenu(frame: .zero, trackerStyle: .line)
                                // 追踪线
                                pageMenu.trackerWidth = 56
                                pageMenu.setTrackerHeight(3, cornerRadius: 1.5)
                                pageMenu.tracker.backgroundColor = UIColor(hexStr: "#FF9D2E")
                                pageMenu.trackerFollowingMode = .always
                                pageMenu.contentInset = UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 14)
        // 分割线
        pageMenu.dividingLine.backgroundColor = .clear
        pageMenu.dividingLineHeight = 1
                                // 分割线
                                pageMenu.dividingLine.backgroundColor = .clear
                                pageMenu.dividingLineHeight = 1
        // item
        pageMenu.spacing = 20.0
        pageMenu.permutationWay = .scrollAdaptContent
        pageMenu.setItems(["全部","待核销","已核销","已过期","已取消","待支付"], selectedItemIndex: 0)
                                // item
                                pageMenu.spacing = 20.0
                                pageMenu.permutationWay = .scrollAdaptContent
                                pageMenu.setItems(["全部","待核销","已核销","已过期","已取消","待支付"], selectedItemIndex: 0)
        // 字体
        pageMenu.selectedItemTitleFont = UIFont.systemFont(ofSize: 14, weight: .semibold)
        pageMenu.unSelectedItemTitleFont = UIFont.systemFont(ofSize: 14,weight: .medium)
        // 颜色
        pageMenu.selectedItemTitleColor = .black.withAlphaComponent(0.8)
        pageMenu.unSelectedItemTitleColor = .black.withAlphaComponent(0.6)
                                // 字体
                                pageMenu.selectedItemTitleFont = UIFont.systemFont(ofSize: 14, weight: .semibold)
                                pageMenu.unSelectedItemTitleFont = UIFont.systemFont(ofSize: 14,weight: .medium)
                                // 颜色
                                pageMenu.selectedItemTitleColor = .black.withAlphaComponent(0.8)
                                pageMenu.unSelectedItemTitleColor = .black.withAlphaComponent(0.6)
        return pageMenu
    }()
                                return pageMenu
                }()
    lazy var pageViewController:FFPageViewController = {
        let pageVC = FFPageViewController()
        pageVC.view.backgroundColor = .clear
        pageVC.scrollview.backgroundColor = .clear
                lazy var pageViewController:FFPageViewController = {
                                let pageVC = FFPageViewController()
                                pageVC.view.backgroundColor = .clear
                                pageVC.scrollview.backgroundColor = .clear
        pageVC.scrollview.bounces = false
        return pageVC
    }()
                                pageVC.scrollview.bounces = false
                                return pageVC
                }()
    private var toPage:Int?
                private var toPage:Int?
    init(page:Int? = nil) {
        super.init(nibName: nil, bundle: nil)
        self.toPage = page
                init(page:Int? = nil) {
                                super.init(nibName: nil, bundle: nil)
                                self.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
                required init?(coder: NSCoder) {
                                fatalError("init(coder:) has not been implemented")
                }
        if let page = toPage{
            DispatchQueue.main.asyncAfter(deadline: .now()+0.5) {
                self.pageMenu.selectedItemIndex = page
                self.pageViewController.scroll(toPage: page, animation: true)
            }
        }
    }
                override func viewDidLoad() {
                                super.viewDidLoad()
                                title = "我的预约"
    override func setUI() {
        pageMenu.frame = CGRect(x: 0, y: view.safeAreaInsets.top + JQ_NavBarHeight + 9, width: JQ_ScreenW, height: 45)
        pageMenu.layer.shadowColor = UIColor(hexStr: "#EFEEEE").withAlphaComponent(0.5).cgColor
        pageMenu.layer.shadowOffset = CGSize(width: 0, height: 2)
        pageMenu.layer.shadowOpacity = 1
        view.addSubview(pageMenu)
        view.backgroundColor = .white
                                pageMenu.delegate = self
                                pageViewController.delegate = self
        addChild(pageViewController)
        view.insertSubview(pageViewController.view, at: 0)
        pageViewController.didMove(toParent: self)
                                if let page = toPage{
                                                DispatchQueue.main.asyncAfter(deadline: .now()+0.5) {
                                                                self.pageMenu.selectedItemIndex = page
                                                                self.pageViewController.scroll(toPage: page, animation: true)
                                                }
                                }
                }
        pageViewController.view.frame = CGRect(x: 0, y: view.safeAreaInsets.top + JQ_NavBarHeight + 9 + 45, width: JQ_ScreenW, height: JQ_ScreenH - view.safeAreaInsets.top - JQ_NavBarHeight - 9 - 45)
    }
                override func setUI() {
                                pageMenu.frame = CGRect(x: 0, y: view.safeAreaInsets.top + JQ_NavBarHeight + 9, width: JQ_ScreenW, height: 45)
                                pageMenu.layer.shadowColor = UIColor(hexStr: "#EFEEEE").withAlphaComponent(0.5).cgColor
                                pageMenu.layer.shadowOffset = CGSize(width: 0, height: 2)
                                pageMenu.layer.shadowOpacity = 1
                                view.addSubview(pageMenu)
                                view.backgroundColor = .white
                                addChild(pageViewController)
                                view.insertSubview(pageViewController.view, at: 0)
                                pageViewController.didMove(toParent: self)
                                pageViewController.view.frame = CGRect(x: 0, y: view.safeAreaInsets.top + JQ_NavBarHeight + 9 + 45, width: JQ_ScreenW, height: JQ_ScreenH - view.safeAreaInsets.top - JQ_NavBarHeight - 9 - 45)
                }
}
extension YardBookingListVC:SPPageMenuDelegate{
    func pageMenu(_ pageMenu: SPPageMenu, itemSelectedAt index: Int) {
        pageViewController.scroll(toPage: index, animation: true)
    }
                func pageMenu(_ pageMenu: SPPageMenu, itemSelectedAt index: Int) {
                                pageViewController.scroll(toPage: index, animation: true)
                }
}
extension YardBookingListVC:FFPageViewControllerDelegate{
    func pageViewController(_ pageViewController: FFPageViewController, currentPageChanged currentPage: Int) {
        pageMenu.selectedItemIndex = currentPage
    }
                func pageViewController(_ pageViewController: FFPageViewController, currentPageChanged currentPage: Int) {
                                pageMenu.selectedItemIndex = currentPage
                }
    func totalPagesOfpageViewController(_ pageViewConteoller: FFPageViewController) -> UInt {
        return 6
    }
                func totalPagesOfpageViewController(_ pageViewConteoller: FFPageViewController) -> UInt {
                                return 6
                }
    func pageViewController(_ pageViewConteoller: FFPageViewController, controllerForPage page: Int) -> UIViewController {
                func pageViewController(_ pageViewConteoller: FFPageViewController, controllerForPage page: Int) -> UIViewController {
        var index:YardBookingType?
        switch page{
            case 1:index = .pending
            case 2:index = .inStore
            case 3:index = .overdue
            case 4:index = .cancel
            case 5:index = .waitPayment
            default:break
        }
        return YardBookingSubListVC(type: index)
    }
                                var index:YardBookingType?
                                switch page{
                                                case 1:index = .pending
                                                case 2:index = .inStore
                                                case 3:index = .overdue
                                                case 4:index = .cancel
                                                case 5:index = .waitPayment
                                                default:break
                                }
                                return YardBookingSubListVC(type: index)
                }
}
WanPai/Root/Yard/VC/YardBookingSubListVC.swift
@@ -13,93 +13,93 @@
class YardBookingViewModel:RefreshModel<YardBookingModel>{
    let type = BehaviorRelay<YardBookingType?>(value:nil)
    override func api() -> (Observable<BaseResponse<[YardBookingModel]>>)? {
        return Services.queryMySite(page: page, status: type.value)
    }
                let type = BehaviorRelay<YardBookingType?>(value:nil)
                override func api() -> (Observable<BaseResponse<[YardBookingModel]>>)? {
                                return Services.queryMySite(page: page, status: type.value)
                }
}
class YardBookingSubListVC: BaseVC {
    private var viewModel = YardBookingViewModel()
                private var viewModel = YardBookingViewModel()
    lazy private var tableView:BaseTableView = {
        let table = BaseTableView(frame: .zero, style: .plain)
        table.separatorStyle = .none
        table.delegate = self
        table.dataSource = self
        table.register(UINib(nibName: "YardBookingTCell", bundle: nil), forCellReuseIdentifier: "_YardBookingTCell")
        return table
    }()
                lazy private var tableView:BaseTableView = {
                                let table = BaseTableView(frame: .zero, style: .plain)
                                table.separatorStyle = .none
                                table.delegate = self
                                table.dataSource = self
                                table.register(UINib(nibName: "YardBookingTCell", bundle: nil), forCellReuseIdentifier: "_YardBookingTCell")
                                return table
                }()
    required init(type:YardBookingType?) {
        super.init(nibName: nil, bundle: nil)
        self.viewModel.type.accept(type)
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        viewModel.configure(tableView)
        viewModel.beginRefresh()
    }
    override func setUI() {
        view.addSubview(tableView)
        tableView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
//        tableView.jq_setEmptyView()
    }
    override func setRx() {
        NotificationCenter.default.rx.notification(RefreshBooking_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] noti in
            guard let weakSelf = self else { return }
            if let indexPath = noti.object as? IndexPath{
                weakSelf.tableView.beginUpdates()
                if weakSelf.viewModel.type.value == nil{
                    weakSelf.viewModel.dataSource.value[indexPath.row].status = .cancel
                    weakSelf.tableView.reloadRows(at: [indexPath], with: .automatic)
                }else{
                    var tempValue = weakSelf.viewModel.dataSource.value
                    tempValue.remove(at: indexPath.row)
                    weakSelf.viewModel.dataSource.accept(tempValue)
                    weakSelf.tableView.deleteRows(at: [indexPath], with: .automatic)
                required init(type:YardBookingType?) {
                                super.init(nibName: nil, bundle: nil)
                                self.viewModel.type.accept(type)
                }
                weakSelf.tableView.endUpdates()
                weakSelf.tableView.reloadData()
            }else{
                weakSelf.viewModel.beginRefresh()
            }
        }).disposed(by: disposeBag)
    }
                required init?(coder: NSCoder) {
                                fatalError("init(coder:) has not been implemented")
                }
                override func viewDidLoad() {
                                super.viewDidLoad()
                                viewModel.configure(tableView)
                                viewModel.beginRefresh()
                }
                override func setUI() {
                                view.addSubview(tableView)
                                tableView.snp.makeConstraints { make in
                                                make.edges.equalToSuperview()
                                }
                                //        tableView.jq_setEmptyView()
                }
                override func setRx() {
                                NotificationCenter.default.rx.notification(RefreshBooking_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] noti in
                                                guard let weakSelf = self else { return }
                                                if let indexPath = noti.object as? IndexPath{
                                                                weakSelf.tableView.beginUpdates()
                                                                if weakSelf.viewModel.type.value == nil{
                                                                                weakSelf.viewModel.dataSource.value[indexPath.row].status = .cancel
                                                                                weakSelf.tableView.reloadRows(at: [indexPath], with: .automatic)
                                                                }else{
                                                                                var tempValue = weakSelf.viewModel.dataSource.value
                                                                                tempValue.remove(at: indexPath.row)
                                                                                weakSelf.viewModel.dataSource.accept(tempValue)
                                                                                weakSelf.tableView.deleteRows(at: [indexPath], with: .automatic)
                                                                }
                                                                weakSelf.tableView.endUpdates()
                                                                weakSelf.tableView.reloadData()
                                                }else{
                                                                weakSelf.viewModel.beginRefresh()
                                                }
                                }).disposed(by: disposeBag)
                }
}
extension YardBookingSubListVC:UITableViewDelegate{
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//        let model = viewModel.dataSource.value
                func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
                                //        let model = viewModel.dataSource.value
    }
                }
}
extension YardBookingSubListVC:UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return viewModel.dataSource.value.count
    }
                func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
                                return viewModel.dataSource.value.count
                }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let model = viewModel.dataSource.value[indexPath.row]
        let cell = tableView.dequeueReusableCell(withIdentifier: "_YardBookingTCell") as! YardBookingTCell
        cell.indexPath = indexPath
        cell.yardBookingModel = model
        return cell
    }
                func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
                                let model = viewModel.dataSource.value[indexPath.row]
                                let cell = tableView.dequeueReusableCell(withIdentifier: "_YardBookingTCell") as! YardBookingTCell
                                cell.indexPath = indexPath
                                cell.yardBookingModel = model
                                return cell
                }
}