younger_times
2023-07-18 a2589f9891509d85a873192d56e785885513e780
新增
27个文件已修改
1031 ■■■■ 已修改文件
WanPai/Common/View/CommonBannerView.swift 374 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Model/CommonModels.swift 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Network/Services.swift 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/CCell/CourseOnlineCCell.swift 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/CCell/CourseOnlineCCell.xib 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/TCell/CourseExerciseTCell.swift 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/TCell/CourseOnlineTCell.swift 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/TCell/CourseOnlineTCell.xib 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseDetailApplyVC.swift 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseDetailVC.swift 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseInfoVC.swift 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseOnlineListVC.swift 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseOnlineSubListVC.swift 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseOnlineSubListVC.xib 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseVideoDetailVC.swift 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/VC/CourseVideoDetailVC.xib 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/View/CourseOnlineHeadView.swift 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/View/CourseOnlineHeadView.xib 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/View/CourseOnlineSearchView.swift 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Course/View/CourseOnlineSearchView.xib 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Home/VC/HomeVC.swift 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Welfare/TCell/WelfareWeeklyTCell.swift 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Welfare/TCell/WelfareWeeklyTCell.xib 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.swift 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.xib 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Welfare/VC/WelfareWeeklyListVC.swift 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Root/Welfare/VC/WelfareWeeklySubListVC.swift 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WanPai/Common/View/CommonBannerView.swift
@@ -8,192 +8,192 @@
import UIKit
import SDWebImage
//class CommonBannerView: UIView,UIScrollViewDelegate {
//
//        //图⽚⽔平放置到scrollView上
//    private var scrollView:UIScrollView = UIScrollView()
//        //⼩圆点标识
//    private var pageControl:UIPageControl = UIPageControl()
//    private var imageViews:Array = Array<UIImageView>()
//
//
//        //图⽚集合
//    private var images:Array<String> = []
//    private var type:ImageType?
//
class CommonBannerView: UIView,UIScrollViewDelegate {
        //图⽚⽔平放置到scrollView上
    private var scrollView:UIScrollView = UIScrollView()
        //⼩圆点标识
    private var pageControl:UIPageControl = UIPageControl()
    private var imageViews:Array = Array<UIImageView>()
        //图⽚集合
    private var images:Array<String> = []
    private var type:ImageType?
//    private var width:CGFloat = 0
//    private var height:CGFloat = 0
//
//    private var currIndex = 0
//    private var clickBlock :(Int)->Void = {index in}
//
//    private var timer:Timer?
//
//        // 默认⾃动播放 设置为false只能⼿动滑动
//    var isAuto = true
//        // 轮播间隔时间 默认6秒可以⾃⼰修改
//    var interval:Double = 6
//
//    private var startOffsetX:CGFloat = 0
//
//    override func layoutSubviews() {
//        super.layoutSubviews()
//    }
//
//    public func setImages(images:Array<String>,type:ImageType
//                          = .Image,imageClickBlock:@escaping (Int) -> Void) {
//        self.type = type
//        self.images = images
//        self.clickBlock = imageClickBlock
//        self.initLayout()
//    }
//
//    private func initLayout(){
//        if(self.images.count == 0){
//            return
//        }
//
//        width = self.bounds.width
//        height = self.bounds.height
//
//        scrollView.frame = self.bounds
//        scrollView.contentSize = CGSize(width:width * CGFloat(images.count +
//                                                              2),height:height)
//        scrollView.contentOffset = CGPoint(x:width,y:0)
//        scrollView.isUserInteractionEnabled = true
//        scrollView.isPagingEnabled = true
//        scrollView.showsHorizontalScrollIndicator = false
//        scrollView.delegate = self
//        self.addSubview(scrollView)
//
//        var image = UIImageView()
//        image.frame = CGRect(x:0,y:0,width:width,height:height)
//        image.contentMode = .scaleToFill
//        image.isUserInteractionEnabled = true
//        setImage(image: image, index: images.count - 1)
//        scrollView.addSubview(image)
//        for i in 1 ... images.count{
//            let image = UIImageView()
//            image.frame = CGRect(x:width *
//                                 CGFloat(i),y:0,width:width,height:height)
//            image.contentMode = .scaleToFill
//            image.isUserInteractionEnabled = true
//            scrollView.addSubview(image)
//            setImage(image: image, index: i - 1)
//            addTapGesWithImage(image: image)
//        }
//        image = UIImageView()
//        image.frame = CGRect(x:width * CGFloat(images.count +
//                                               1),y:0,width:width,height:height)
//        image.contentMode = .scaleToFill
//        image.isUserInteractionEnabled = true
//        scrollView.addSubview(image)
//        setImage(image: image, index: 0)
//
//        pageControl.center = CGPoint(x:width/2,y:height - CGFloat(15))
//        pageControl.isEnabled = true
//        pageControl.numberOfPages = images.count
//        pageControl.currentPageIndicatorTintColor = UIColor.green
//        pageControl.pageIndicatorTintColor = UIColor.gray
//        pageControl.isUserInteractionEnabled = false
//        self.addSubview(pageControl)
//
//            //当前显示的只有 center_image 其他两个只是⽤来增加滑动时效果⽽已,不
//            //addTapGesWithImage(image: center_image)
//        if(isAuto){
//            openTimer()
//        }
//        setCurrent(currIndex: 0)
//    }
//
//    private func setImage(image:UIImageView,index:Int){
//        if(type == .Image){
//            image.image = UIImage.init(named:images[index])
//        }else{
//            image.sd_setImage(with: URL(string: images[index]))
//        }
//    }
//
//    func setCurrent(currIndex:Int) {
//        if(currIndex < 0){
//            self.currIndex = images.count - 1
//        }else{
//            self.currIndex = currIndex
//        }
//        pageControl.currentPage = self.currIndex
//        scrollView.setContentOffset(CGPoint(x:width * CGFloat(self.currIndex +
//                                                              1),y:0), animated: false)
//    }
//
//        //给图⽚添加点击⼿势
//    private func addTapGesWithImage(image:UIImageView) {
//        let tap = UITapGestureRecognizer(target: self, action: #selector(tap(_:)))
//        image.isUserInteractionEnabled = true //让控件可以触发交互事件
//        image.contentMode = .scaleToFill
//            // image.clipsToBounds = true //超出⽗控件的部分不显示
//        image.addGestureRecognizer(tap)
//    }
//
//        //点击图⽚,调⽤block
//    @objc func tap(_ ges:UITapGestureRecognizer) {
//        clickBlock((ges.view?.tag)!)
//    }
//
//    func scrollViewDidScroll(_ scrollView: UIScrollView) {
//
//    }
//
//    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
//        startOffsetX = scrollView.contentOffset.x
//        closeTimer()
//    }
//
//    func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate
//                                  decelerate: Bool) {
//    }
//
//    func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
//        if(scrollView.contentOffset.x > startOffsetX){
//            currIndex = (currIndex + 1) % images.count
//        }else{
//            currIndex = (currIndex - 1) % images.count
//        }
//        setCurrent(currIndex: currIndex)
//        openTimer()
//    }
//
//    func openTimer(){
//        if(isAuto){
//            closeTimer()
//            timer = Timer.scheduledTimer(timeInterval: interval, target: self, selector:
//                                            #selector(startAutoScroll), userInfo: nil, repeats: true)
//        }
//    }
//
//    func closeTimer(){
//        if(timer != nil){
//            timer?.invalidate()
//            timer = nil
//        }
//    }
//
//
//    @objc func startAutoScroll(){
//        if(isDisplayInScreen()){
//            setCurrent(currIndex: (currIndex + 1) % images.count)
//        }
//    }
//
//    func isDisplayInScreen() -> Bool{
//        if(self.window == nil){
//            return false
//        }
//        return true
//    }
//
//}
//enum ImageType{
//    case Image //本地图⽚
//    case URL //URL
//
//}
    private var currIndex = 0
    private var clickBlock :(Int)->Void = {index in}
    private var timer:Timer?
        // 默认⾃动播放 设置为false只能⼿动滑动
    var isAuto = true
        // 轮播间隔时间 默认6秒可以⾃⼰修改
    var interval:Double = 6
    private var startOffsetX:CGFloat = 0
    override func layoutSubviews() {
        super.layoutSubviews()
    }
    public func setImages(images:Array<String>,type:ImageType
                          = .Image,imageClickBlock:@escaping (Int) -> Void) {
        self.type = type
        self.images = images
        self.clickBlock = imageClickBlock
        self.initLayout()
    }
    private func initLayout(){
        if(self.images.count == 0){
            return
        }
        width = self.bounds.width
        height = self.bounds.height
        scrollView.frame = self.bounds
        scrollView.contentSize = CGSize(width:width * CGFloat(images.count +
                                                              2),height:height)
        scrollView.contentOffset = CGPoint(x:width,y:0)
        scrollView.isUserInteractionEnabled = true
        scrollView.isPagingEnabled = true
        scrollView.showsHorizontalScrollIndicator = false
        scrollView.delegate = self
        self.addSubview(scrollView)
        var image = UIImageView()
        image.frame = CGRect(x:0,y:0,width:width,height:height)
        image.contentMode = .scaleToFill
        image.isUserInteractionEnabled = true
        setImage(image: image, index: images.count - 1)
        scrollView.addSubview(image)
        for i in 1 ... images.count{
            let image = UIImageView()
            image.frame = CGRect(x:width *
                                 CGFloat(i),y:0,width:width,height:height)
            image.contentMode = .scaleToFill
            image.isUserInteractionEnabled = true
            scrollView.addSubview(image)
            setImage(image: image, index: i - 1)
            addTapGesWithImage(image: image)
        }
        image = UIImageView()
        image.frame = CGRect(x:width * CGFloat(images.count +
                                               1),y:0,width:width,height:height)
        image.contentMode = .scaleToFill
        image.isUserInteractionEnabled = true
        scrollView.addSubview(image)
        setImage(image: image, index: 0)
        pageControl.center = CGPoint(x:width/2,y:height - CGFloat(15))
        pageControl.isEnabled = true
        pageControl.numberOfPages = images.count
        pageControl.currentPageIndicatorTintColor = UIColor.green
        pageControl.pageIndicatorTintColor = UIColor.gray
        pageControl.isUserInteractionEnabled = false
        self.addSubview(pageControl)
            //当前显示的只有 center_image 其他两个只是⽤来增加滑动时效果⽽已,不
            //addTapGesWithImage(image: center_image)
        if(isAuto){
            openTimer()
        }
        setCurrent(currIndex: 0)
    }
    private func setImage(image:UIImageView,index:Int){
        if(type == .Image){
            image.image = UIImage.init(named:images[index])
        }else{
            image.sd_setImage(with: URL(string: images[index]))
        }
    }
    func setCurrent(currIndex:Int) {
        if(currIndex < 0){
            self.currIndex = images.count - 1
        }else{
            self.currIndex = currIndex
        }
        pageControl.currentPage = self.currIndex
        scrollView.setContentOffset(CGPoint(x:width * CGFloat(self.currIndex +
                                                              1),y:0), animated: false)
    }
        //给图⽚添加点击⼿势
    private func addTapGesWithImage(image:UIImageView) {
        let tap = UITapGestureRecognizer(target: self, action: #selector(tap(_:)))
        image.isUserInteractionEnabled = true //让控件可以触发交互事件
        image.contentMode = .scaleToFill
            // image.clipsToBounds = true //超出⽗控件的部分不显示
        image.addGestureRecognizer(tap)
    }
        //点击图⽚,调⽤block
    @objc func tap(_ ges:UITapGestureRecognizer) {
        clickBlock((ges.view?.tag)!)
    }
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
    }
    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
        startOffsetX = scrollView.contentOffset.x
        closeTimer()
    }
    func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate
                                  decelerate: Bool) {
    }
    func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
        if(scrollView.contentOffset.x > startOffsetX){
            currIndex = (currIndex + 1) % images.count
        }else{
            currIndex = (currIndex - 1) % images.count
        }
        setCurrent(currIndex: currIndex)
        openTimer()
    }
    func openTimer(){
        if(isAuto){
            closeTimer()
            timer = Timer.scheduledTimer(timeInterval: interval, target: self, selector:
                                            #selector(startAutoScroll), userInfo: nil, repeats: true)
        }
    }
    func closeTimer(){
        if(timer != nil){
            timer?.invalidate()
            timer = nil
        }
    }
    @objc func startAutoScroll(){
        if(isDisplayInScreen()){
            setCurrent(currIndex: (currIndex + 1) % images.count)
        }
    }
    func isDisplayInScreen() -> Bool{
        if(self.window == nil){
            return false
        }
        return true
    }
}
enum ImageType{
    case Image //本地图⽚
    case URL //URL
}
WanPai/Model/CommonModels.swift
@@ -148,3 +148,62 @@
    var code = ""
    var name = ""
}
struct BannerModel:HandyJSON{
    var id = 0
    var img = ""
    var jumpPage = ""
}
struct VideosModel:HandyJSON{
    var id:Int = 0
    var list = [VideoDetailModel]()
    var name:String = ""
}
struct VideoDetailModel:HandyJSON {
    var cover: String = ""
    var id:Int = 0
    var integral: Int = 0
    var introduce: String = ""
    var name: String = ""
    ///学习状态(0=未学习,1=已学习)
    var study: Int = 0
    var courseVideo:String = ""
    var introductionDrawing = ""
}
struct WeeklyItemModel:HandyJSON {
    var courseHours: Int = 0
    var coursePackageDiscountId: Int = 0
    var coursePackageName: String = ""
    var dataTime: String = ""
    var date: String = ""
    var discountPrice: Double = 0
    var donateHours: Int = 0
    var image: String = ""
    var originalPrice: Double = 0
    ///状态(1=查看详情 2=暂未开始)
    var status: Int = 0
    var storeDistance: Double = 0
}
struct WeeklyItemDetailModel:HandyJSON {
    var classHours: Int = 0
    var costPrice: Double = 0
    var coursePackageDiscountId:Int = 0
    var coursePackageName: String = ""
    var coverDrawing:String = ""
    ///折扣价/会员价
    var discountPrice:Double = 0
    var distance:Double = 0
    var freeClassHours:Int = 0
    var introduceDrawing:String = ""
    var storeNameAddr:String = ""
    var time: String = ""
    var wanpaiGold:Int = 0
    var weekTime: String = ""
    var vipPrice:Double = 0
}
WanPai/Network/Services.swift
@@ -28,10 +28,21 @@
        return NetworkRequest.request(params: params, method: .post, progress: false)
    }
        /// 主页配置
    class func homeStoreConfig(storeId:Int)->Observable<BaseResponse<[HomeStoreConfigModel]>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/other/base/store/queryStoreConfig")
            .append(key: "storeId", value: storeId)
        return NetworkRequest.request(params: params, method: .post, progress: false)
    }
        /// 获取banner图
        /// - Parameter position: 位置(1=首页,2=首页底部,3=线上课得积分,4=看视频得奖励,5=常见问题)
    class func bannerList(position:Int)->Observable<BaseResponse<[BannerModel]>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/other/base/banner/queryBannerList")
            .append(key: "position", value: position)
        return NetworkRequest.request(params: params, method: .post, progress: false)
    }
}
@@ -180,6 +191,64 @@
            .append(key: "id", value: id)
        return NetworkRequest.request(params: params, method: .post, progress: true)
    }
        /// 本周福利
    class func weekLimitedBenefit(discountType:Int)->Observable<BaseResponse<[WeeklyItemModel]>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/course/api/useBenefit/weekLimitedBenefit")
            .append(key: "discountType", value: discountType)
            .append(key: "lat", value: locationTool.currentLocation?.coordinate.latitude.string)
            .append(key: "lon", value: locationTool.currentLocation?.coordinate.longitude.string)
        return NetworkRequest.request(params: params, method: .post, progress: false)
    }
        /// 本周福利详情
    class func weekBenefitDetail(id:Int)->Observable<BaseResponse<WeeklyItemDetailModel>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/course/api/useBenefit/discountCourseDatas")
            .append(key: "coursePackageDiscountId", value: id)
            .append(key: "lat", value: locationTool.currentLocation?.coordinate.latitude.string)
            .append(key: "lon", value: locationTool.currentLocation?.coordinate.longitude.string)
        return NetworkRequest.request(params: params, method: .post, progress: true)
    }
}
    // MARK: -- Activity
extension Services{
        /// 获取视频列表
        /// - Parameter position: 位置(1=线上课得积分,2=看视频得奖励)
    class func benefitsVideoList(position:Int,search:String)->Observable<BaseResponse<[VideosModel]>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/activity/api/benefitsVideo/queryClassificationBenefitsVideosList")
            .append(key: "position", value: position)
            .append(key: "search", value: search)
        return NetworkRequest.request(params: params, method: .post, progress: false)
    }
        /// 获取视频列表
    class func benefitsVideoSubList(classificationId:Int,pageNo:Int,pageSize:Int,search:String)->Observable<BaseResponse<[VideoDetailModel]>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/activity/api/benefitsVideo/queryBenefitsVideosList")
            .append(key: "classificationId", value: classificationId)
            .append(key: "pageNo", value: pageNo)
            .append(key: "pageSize", value: pageSize)
            .append(key: "search", value: search)
        return NetworkRequest.request(params: params, method: .post, progress: false)
    }
        /// 获取视频详情
    class func benefitsVideoDetail(id:Int)->Observable<BaseResponse<VideoDetailModel>>{
        let params = ParamsAppender.build(url: All_Url)
            .interface(url: "/activity/api/benefitsVideo/queryBenefitsVideosInfo")
            .append(key: "id", value: id)
        return NetworkRequest.request(params: params, method: .post, progress: true)
    }
}
// MARK: -- 活动赛事相关
WanPai/Root/Course/CCell/CourseOnlineCCell.swift
@@ -9,6 +9,17 @@
class CourseOnlineCCell: UICollectionViewCell {
    var videoDetailModel:VideoDetailModel!{
        didSet{
            img_cover.sd_setImage(with: URL(string: videoDetailModel.cover))
            label_title.text = videoDetailModel.name
            label_content.text = videoDetailModel.introduce
        }
    }
    @IBOutlet weak var img_cover: UIImageView!
    @IBOutlet weak var label_title: UILabel!
    @IBOutlet weak var label_content: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
WanPai/Root/Course/CCell/CourseOnlineCCell.xib
@@ -58,6 +58,11 @@
                <constraint firstItem="khx-ne-Kjz" firstAttribute="top" secondItem="it5-1w-YIk" secondAttribute="bottom" constant="3" id="z9m-CD-mCP"/>
            </constraints>
            <size key="customSize" width="287" height="428"/>
            <connections>
                <outlet property="img_cover" destination="tJW-ca-CTV" id="FP9-X0-foF"/>
                <outlet property="label_content" destination="khx-ne-Kjz" id="K89-K9-rxZ"/>
                <outlet property="label_title" destination="it5-1w-YIk" id="4XF-iy-hdB"/>
            </connections>
            <point key="canvasLocation" x="319.84732824427482" y="152.81690140845072"/>
        </collectionViewCell>
    </objects>
WanPai/Root/Course/TCell/CourseExerciseTCell.swift
@@ -16,7 +16,7 @@
    }
    @IBAction func detailAction(_ sender: UIButton) {
        let vc = CourseVideoDetailVC()
        let vc = CourseVideoDetailVC(id: 0)
        vc.title = "课后练习"
        JQ_currentViewController().jq_push(vc: vc)
    }
WanPai/Root/Course/TCell/CourseOnlineTCell.swift
@@ -1,14 +1,42 @@
//
//  CourseOnlineTCell.swift
//  WanPai
//
//  Created by 无故事王国 on 2023/6/16.
//
    //
    //  CourseOnlineTCell.swift
    //  WanPai
    //
    //  Created by 无故事王国 on 2023/6/16.
    //
import UIKit
class CourseOnlineTCell: UITableViewCell {
    var videoDetailModel:VideoDetailModel!{
        didSet{
            img_cover.sd_setImage(with: URL(string: videoDetailModel.cover))
            label_content.text = videoDetailModel.introduce
            label_title.text = videoDetailModel.name
            label_coin.text = "\(videoDetailModel.integral)积分"
            label_coinTitle.isHidden = videoDetailModel.study == 1
            label_coin.isHidden = videoDetailModel.study == 1
            switch videoDetailModel.study{
                case 1:
                    btn_state.setTitle("已学习", for: .normal)
                    btn_state.backgroundColor = UIColor(hexStr: "#ADA9A9")
                default:
                    btn_state.setTitle("查看详情", for: .normal)
                    btn_state.backgroundColor = Def_ThemeColor
            }
        }
    }
    @IBOutlet weak var label_title: UILabel!
    @IBOutlet weak var label_content: UILabel!
    @IBOutlet weak var label_coin: UILabel!
    @IBOutlet weak var label_coinTitle: UILabel!
    @IBOutlet weak var btn_state: UIButton!
    @IBOutlet weak var img_cover: UIImageView!
    override func awakeFromNib() {
        super.awakeFromNib()
        selectionStyle = .none
WanPai/Root/Course/TCell/CourseOnlineTCell.xib
@@ -18,7 +18,7 @@
                <rect key="frame" x="0.0" y="0.0" width="468" height="139"/>
                <autoresizingMask key="autoresizingMask"/>
                <subviews>
                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="PxT-nX-Lp5">
                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="PxT-nX-Lp5">
                        <rect key="frame" x="15" y="13" width="110" height="110"/>
                        <constraints>
                            <constraint firstAttribute="height" constant="110" id="9WP-U5-R0w"/>
@@ -105,12 +105,20 @@
                </constraints>
            </tableViewCellContentView>
            <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
            <connections>
                <outlet property="btn_state" destination="BbO-Ve-6Ru" id="uTv-2Z-Uri"/>
                <outlet property="img_cover" destination="PxT-nX-Lp5" id="9ch-c7-qzY"/>
                <outlet property="label_coin" destination="zTl-3I-CmB" id="hAO-gE-Wgh"/>
                <outlet property="label_coinTitle" destination="R4u-Yo-mQ2" id="Ykd-bW-inZ"/>
                <outlet property="label_content" destination="ipR-Qm-467" id="KWD-d7-Zl8"/>
                <outlet property="label_title" destination="sRF-Wi-a0T" id="slv-mF-Ww5"/>
            </connections>
            <point key="canvasLocation" x="68.702290076335871" y="53.169014084507047"/>
        </tableViewCell>
    </objects>
    <resources>
        <namedColor name="FE6E0D">
            <color red="0.99599999189376831" green="0.4309999942779541" blue="0.050999999046325684" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
            <color red="0.99199998378753662" green="0.53299999237060547" blue="0.0080000003799796104" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
        </namedColor>
    </resources>
</document>
WanPai/Root/Course/VC/CourseDetailApplyVC.swift
@@ -171,7 +171,7 @@
                //原价
            if let originPrice =  subM.originalPrice{
                let attribute = AttributedStringbuilder.build().add(string: (originPrice * Double(studentModels.count)).currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).underLine(color: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58))
                let attribute = AttributedStringbuilder.build().add(string: (originPrice * Double(studentModels.count)).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
            }
WanPai/Root/Course/VC/CourseDetailVC.swift
@@ -56,7 +56,7 @@
                    //原价
                if let originPrice =  subM.originalPrice{
                    let attribute = AttributedStringbuilder.build().add(string: originPrice.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).underLine(color: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58))
                    let attribute = AttributedStringbuilder.build().add(string: originPrice.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
                }
WanPai/Root/Course/VC/CourseInfoVC.swift
@@ -233,7 +233,7 @@
            let vc = StudentMentalListVC()
            push(vc: vc)
        }else{
            let vc = CourseVideoDetailVC()
            let vc = CourseVideoDetailVC(id: 0)
            vc.title = "课后练习"
            push(vc: vc)
        }
WanPai/Root/Course/VC/CourseOnlineListVC.swift
@@ -8,8 +8,24 @@
import UIKit
import JQTools
import MJRefresh
import RxCocoa
import RxSwift
import QMUIKit
class VideoViewModel:RefreshModel<VideosModel>{
    let position = BehaviorRelay<Int>(value: 1)
    let search = BehaviorRelay<String>(value: "")
    override func api() -> (Observable<BaseResponse<[VideosModel]>>)? {
        return Services.benefitsVideoList(position: position.value, search: search.value)
    }
}
class CourseOnlineListVC: BaseVC {
    private var viewModel = VideoViewModel()
    lazy var searchView:CourseOnlineSearchView = {
        let searchV = CourseOnlineSearchView.jq_loadNibView()
@@ -18,10 +34,31 @@
        return searchV
    }()
    var collectionView:UICollectionView!
    var collectionView:BaseCollectionView!
   required init(position:Int){
        super.init(nibName: nil, bundle: nil)
        self.viewModel.position.accept(position)
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        Services.bannerList(position: 3).subscribe(onNext: {[weak self] data in
            if let models = data.data{
                self?.searchView.bannerView.setImages(images: models.map({$0.img}),type: .URL, imageClickBlock: { index in
                })
            }
        }).disposed(by: disposeBag)
        viewModel.configure(collectionView,needMore: false)
        viewModel.beginRefresh()
        collectionView.jq_setEmptyView()
    }
    override func setUI() {
@@ -32,7 +69,7 @@
        flowlayout.minimumLineSpacing = 22
//        flowlayout.sectionHeadersPinToVisibleBounds = true
        flowlayout.headerReferenceSize = CGSize(width: JQ_ScreenW, height: 52)
        collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowlayout)
        collectionView = BaseCollectionView(frame: .zero, collectionViewLayout: flowlayout)
        collectionView.register(UINib(nibName: "CourseOnlineCCell", bundle: nil), forCellWithReuseIdentifier: "_CourseOnlineCCell")
        collectionView.register(UINib(nibName: "CourseOnlineHeadView", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "_CourseOnlineHeadView")
        collectionView.delegate = self
@@ -48,6 +85,17 @@
        }
        view.addSubview(searchView)
        searchView.btn_search.addTarget(self, action: #selector(beginSearch), for: .touchUpInside)
        searchView.tf_search.delegate = self
    }
    override func setRx() {
        searchView.tf_search.rx.text.orEmpty.bind(to: viewModel.search).disposed(by: disposeBag)
    }
    @objc func beginSearch(){
        searchView.tf_search.resignFirstResponder()
        viewModel.beginRefresh()
    }
@@ -58,41 +106,56 @@
}
extension CourseOnlineListVC:UICollectionViewDelegate{
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        let model = viewModel.dataSource.value[indexPath.section].list[indexPath.row]
        let vc = CourseVideoDetailVC(id: model.id)
        vc.title = title ?? ""
        push(vc: vc)
    }
}
extension CourseOnlineListVC:UICollectionViewDataSource{
    func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
        if kind == UICollectionView.elementKindSectionHeader{
            let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "_CourseOnlineHeadView", for: indexPath) as! CourseOnlineHeadView
            headerView.indexPath = indexPath
            headerView.moreClouse = { [weak self] index in
                let vc = CourseOnlineSubListVC()
                let id = self?.viewModel.dataSource.value[index.section].id
                let vc = CourseOnlineSubListVC(classificationId: id!)
                vc.title = self?.title ?? ""
                self?.push(vc: vc)
            }
            headerView.label_name.text = viewModel.dataSource.value[indexPath.section].name
            return headerView
        }
        return UICollectionReusableView()
    }
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let model = viewModel.dataSource.value[indexPath.section].list[indexPath.row]
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_CourseOnlineCCell", for: indexPath) as! CourseOnlineCCell
        cell.videoDetailModel = model
        return cell
    }
    func numberOfSections(in collectionView: UICollectionView) -> Int {
        return 3
        return viewModel.dataSource.value.count
    }
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 4
        return viewModel.dataSource.value[section].list.count
    }
}
class OnlineLayout:UICollectionViewFlowLayout{
}
extension CourseOnlineListVC:QMUITextFieldDelegate{
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        textField.resignFirstResponder()
        viewModel.beginRefresh()
        return true
    }
}
WanPai/Root/Course/VC/CourseOnlineSubListVC.swift
@@ -6,28 +6,72 @@
//
import UIKit
import JQTools
import RxCocoa
import RxSwift
import QMUIKit
class CourseOnlineViewModel:RefreshModel<VideoDetailModel>{
    let classificationId = BehaviorRelay<Int>(value: 0)
    let search = BehaviorRelay<String>(value: "")
    override func api() -> (Observable<BaseResponse<[VideoDetailModel]>>)? {
        Services.benefitsVideoSubList(classificationId: classificationId.value, pageNo: page, pageSize: pageSize, search: search.value)
    }
}
class CourseOnlineSubListVC: BaseVC {
    @IBOutlet weak var tableView: UITableView!
    private var classificationId:Int?
    private var position:Int?
    @IBOutlet weak var tableView: BaseTableView!
    @IBOutlet weak var tf_search: QMUITextField!
    private let viewModel = CourseOnlineViewModel()
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
            viewModel.configure(tableView)
            viewModel.beginRefresh()
            viewModel.classificationId.accept(classificationId!)
        tableView.jq_setEmptyView()
    }
    init(classificationId:Int) {
        super.init(nibName: nil, bundle: nil)
        self.classificationId = classificationId
    }
    override func setRx() {
        tf_search.rx.text.orEmpty.bind(to: viewModel.search).disposed(by: disposeBag)
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func setUI() {
        tableView.delegate = self
        tableView.dataSource = self
        tableView.register(UINib(nibName: "CourseOnlineTCell", bundle: nil), forCellReuseIdentifier: "_CourseOnlineTCell")
        tableView.separatorStyle = .none
        tf_search.delegate = self
    }
    @IBAction func searchAction(_ sender: UIButton) {
        viewModel.beginRefresh()
    }
}
extension CourseOnlineSubListVC:UITableViewDelegate{
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
         let vc = CourseVideoDetailVC()
        let model = viewModel.dataSource.value[indexPath.row]
        let vc = CourseVideoDetailVC(id: model.id)
        vc.title = title
        push(vc: vc)
    }
@@ -35,11 +79,21 @@
extension CourseOnlineSubListVC:UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
         return 5
        viewModel.dataSource.value.count
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let model = viewModel.dataSource.value[indexPath.row]
        let cell = tableView.dequeueReusableCell(withIdentifier: "_CourseOnlineTCell") as! CourseOnlineTCell
        cell.videoDetailModel = model
        return cell
    }
}
extension CourseOnlineSubListVC:QMUITextFieldDelegate{
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        textField.resignFirstResponder()
        viewModel.beginRefresh()
        return true
    }
}
WanPai/Root/Course/VC/CourseOnlineSubListVC.xib
@@ -13,6 +13,7 @@
        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CourseOnlineSubListVC" customModule="WanPai" customModuleProvider="target">
            <connections>
                <outlet property="tableView" destination="zwx-yl-L8l" id="Pxd-r8-4pt"/>
                <outlet property="tf_search" destination="PDm-tU-THg" id="BuQ-a5-kQ5"/>
                <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
            </connections>
        </placeholder>
@@ -64,6 +65,9 @@
                            <state key="normal" title="搜索">
                                <color key="titleColor" name="FE6E0D"/>
                            </state>
                            <connections>
                                <action selector="searchAction:" destination="-1" eventType="touchUpInside" id="QP7-oe-46k"/>
                            </connections>
                        </button>
                    </subviews>
                    <color key="backgroundColor" systemColor="systemBackgroundColor"/>
@@ -89,7 +93,7 @@
                        </userDefinedRuntimeAttribute>
                    </userDefinedRuntimeAttributes>
                </view>
                <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="zwx-yl-L8l">
                <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="zwx-yl-L8l" customClass="BaseTableView" customModule="WanPai" customModuleProvider="target">
                    <rect key="frame" x="0.0" y="125" width="393" height="693"/>
                    <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                </tableView>
@@ -111,7 +115,7 @@
    <resources>
        <image name="icon_search" width="17" height="17"/>
        <namedColor name="FE6E0D">
            <color red="0.99599999189376831" green="0.4309999942779541" blue="0.050999999046325684" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
            <color red="0.99199998378753662" green="0.53299999237060547" blue="0.0080000003799796104" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
        </namedColor>
        <systemColor name="systemBackgroundColor">
            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
WanPai/Root/Course/VC/CourseVideoDetailVC.swift
@@ -6,11 +6,22 @@
//
import UIKit
import MediaPlayer
import AVKit
import SDWebImage
import JQTools
class CourseVideoDetailVC: BaseVC {
    @IBOutlet weak var view_videoContainer: UIView!
    private var id:Int!
    @IBOutlet weak var label_name: UILabel!
    @IBOutlet weak var label_introduce: UILabel!
    @IBOutlet weak var label_studyState: UILabel!
    @IBOutlet weak var img_introduceCover: UIImageView!
    @IBOutlet weak var label_coin: UILabel!
    @IBOutlet weak var cons_imgHei: NSLayoutConstraint!
    private lazy var playerVC:AVPlayerViewController = {
        let player = AVPlayerViewController()
@@ -19,10 +30,46 @@
        return player
    }()
   required init(id:Int) {
        super.init(nibName: nil, bundle: nil)
        self.id = id
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        playerVC.player = AVPlayer(url: URL(string: "https://media.w3.org/2010/05/sintel/trailer.mp4")!)
        playerVC.player?.play()
        Services.benefitsVideoDetail(id: id).subscribe(onNext: { [weak self] data in
            if let model = data.data{
                self?.playerVC.player = AVPlayer(url: URL(string: model.courseVideo)!)
                self?.playerVC.player?.play()
                self?.label_name.text = model.name
                self?.label_coin.text = "\(model.integral)积分"
                self?.label_introduce.text = model.introduce
                if model.study == 1{
                    self?.label_studyState.text = "已学习"
                    self?.label_studyState.backgroundColor = UIColor(hexStr: "#318C10").withAlphaComponent(0.29)
                    self?.label_studyState.textColor = UIColor(hexStr: "#318C10")
                }else{
                    self?.label_studyState.text = "未学习"
                    self?.label_studyState.backgroundColor = UIColor(hexStr: "#FD9331").withAlphaComponent(0.29)
                    self?.label_studyState.textColor = Def_ThemeColor
                }
                SDWebImageDownloader.shared.downloadImage(with: URL(string: model.introductionDrawing)) { image, data, error, state in
                    if let img = image{
                        self?.img_introduceCover.image = img
                        let radio = img.size.width / img.size.height
                        self?.cons_imgHei.constant = JQ_ScreenW * radio
                    }
                }
            }
        }).disposed(by: disposeBag)
    }
    override func setUI() {
WanPai/Root/Course/VC/CourseVideoDetailVC.xib
@@ -11,6 +11,12 @@
    <objects>
        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CourseVideoDetailVC" customModule="WanPai" customModuleProvider="target">
            <connections>
                <outlet property="cons_imgHei" destination="fgg-Sr-v3u" id="CrH-dx-V3W"/>
                <outlet property="img_introduceCover" destination="uQD-il-gSB" id="pRK-1s-nD3"/>
                <outlet property="label_coin" destination="9B3-fo-SmJ" id="AqD-H9-7FA"/>
                <outlet property="label_introduce" destination="otm-WL-Xfs" id="xzX-ZA-OF2"/>
                <outlet property="label_name" destination="QR3-va-22V" id="NWK-br-bDo"/>
                <outlet property="label_studyState" destination="lbO-Xs-cY6" id="xpG-fT-Pa7"/>
                <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
                <outlet property="view_videoContainer" destination="iUz-vy-vlj" id="bef-n3-npl"/>
            </connections>
WanPai/Root/Course/View/CourseOnlineHeadView.swift
@@ -10,6 +10,8 @@
class CourseOnlineHeadView: UICollectionReusableView{
    @IBOutlet weak var label_name: UILabel!
    var indexPath:IndexPath!
    var moreClouse:((IndexPath)->Void)!
WanPai/Root/Course/View/CourseOnlineHeadView.xib
@@ -41,12 +41,15 @@
                <constraint firstItem="Nbm-D2-GLo" firstAttribute="centerY" secondItem="8Ne-vR-uRX" secondAttribute="centerY" id="iyG-pN-w1z"/>
            </constraints>
            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
            <connections>
                <outlet property="label_name" destination="8Ne-vR-uRX" id="ZXx-Qb-Bwz"/>
            </connections>
            <point key="canvasLocation" x="93.89312977099236" y="-262.67605633802816"/>
        </view>
    </objects>
    <resources>
        <namedColor name="FE6E0D">
            <color red="0.99599999189376831" green="0.4309999942779541" blue="0.050999999046325684" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
            <color red="0.99199998378753662" green="0.53299999237060547" blue="0.0080000003799796104" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
        </namedColor>
        <systemColor name="systemBackgroundColor">
            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
WanPai/Root/Course/View/CourseOnlineSearchView.swift
@@ -7,11 +7,25 @@
import UIKit
import JQTools
import QMUIKit
class CourseOnlineSearchView: UIView,JQNibView{
    @IBOutlet weak var view_bannerBg: UIView!
    @IBOutlet weak var tf_search: QMUITextField!
    @IBOutlet weak var btn_search: UIButton!
    let bannerView = CommonBannerView()
    override func awakeFromNib() {
        super.awakeFromNib()
        view_bannerBg.addSubview(bannerView)
        bannerView.frame = CGRect(origin: .zero, size: CGSize(width: JQ_ScreenW, height: JQ_ScreenW * 0.564))
        bannerView.isAuto = true
    }
    override func layoutSubviews() {
        super.layoutSubviews()
    }
}
WanPai/Root/Course/View/CourseOnlineSearchView.xib
@@ -101,13 +101,18 @@
                <constraint firstAttribute="trailing" secondItem="3z4-ct-Aqb" secondAttribute="trailing" id="rbl-bG-VUt"/>
            </constraints>
            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
            <connections>
                <outlet property="btn_search" destination="2ok-8X-5rV" id="JGi-eQ-EDo"/>
                <outlet property="tf_search" destination="sT4-o4-OES" id="Iww-Lt-3pe"/>
                <outlet property="view_bannerBg" destination="3z4-ct-Aqb" id="TPP-uL-fqD"/>
            </connections>
            <point key="canvasLocation" x="142.74809160305344" y="-179.22535211267606"/>
        </view>
    </objects>
    <resources>
        <image name="icon_search" width="17" height="17"/>
        <namedColor name="FE6E0D">
            <color red="0.99599999189376831" green="0.4309999942779541" blue="0.050999999046325684" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
            <color red="0.99199998378753662" green="0.53299999237060547" blue="0.0080000003799796104" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
        </namedColor>
        <systemColor name="systemBackgroundColor">
            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
WanPai/Root/Home/VC/HomeVC.swift
@@ -171,14 +171,16 @@
                let vc = ActivityListVC()
                push(vc: vc)
            case .video:
                let vc = CourseOnlineListVC()
                let vc = CourseOnlineListVC(position: 2)
                vc.title = "看视频得奖励"
                push(vc: vc)
            case .coin:
                let vc = CourseOnlineListVC()
                let vc = CourseOnlineListVC(position: 1)
                vc.title = "线上课得积分"
                push(vc: vc)
            case .ticket:break
            case .ticket:
                let vc = WelfareWeeklyListVC()
                push(vc: vc)
            case .wisdomCourt:
                let vc = WelfareWeeklyListVC()
                push(vc: vc)
WanPai/Root/Welfare/TCell/WelfareWeeklyTCell.swift
@@ -6,9 +6,51 @@
//
import UIKit
import JQTools
class WelfareWeeklyTCell: UITableViewCell {
    @IBOutlet weak var img_cover: UIImageView!
    @IBOutlet weak var label_title: UILabel!
    @IBOutlet weak var label_courseNum: UILabel!
    @IBOutlet weak var label_giftCourseNum: UILabel!
    @IBOutlet weak var view_giftCourseNum: UIView!
    @IBOutlet weak var label_datetime: UILabel!
    @IBOutlet weak var label_distance: UILabel!
    @IBOutlet weak var label_price: UILabel!
    @IBOutlet weak var label_discountPrice: UILabel!
    @IBOutlet weak var btn_status: UIButton!
    var weeklyItemModel:WeeklyItemModel!{
        didSet{
            img_cover.sd_setImage(with: URL(string: weeklyItemModel.image))
            label_title.text = weeklyItemModel.coursePackageName
            label_courseNum.text = "\(weeklyItemModel.courseHours)课时"
            label_giftCourseNum.text = "\(weeklyItemModel.donateHours)课时"
            label_datetime.text = weeklyItemModel.dataTime
            label_distance.text = String(format: "%.2lfkm", weeklyItemModel.storeDistance)
            view_giftCourseNum.isHidden = weeklyItemModel.donateHours == 0
            label_discountPrice.isHidden = weeklyItemModel.discountPrice == 0
            if weeklyItemModel.discountPrice != 0{
                label_discountPrice.attributedText = AttributedStringbuilder.build().add(string:  weeklyItemModel.originalPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#C6C6C6")).delLine(color: UIColor(hexStr: "#C6C6C6")).mutableAttributedString
                label_price.text = weeklyItemModel.discountPrice.currency()
            }else{
                label_price.text = weeklyItemModel.originalPrice.currency()
            }
            if weeklyItemModel.status == 1{
                btn_status.setTitle("查看详情", for: .normal)
                btn_status.backgroundColor = Def_ThemeColor
            }else{
                btn_status.setTitle("未开始", for: .normal)
                btn_status.backgroundColor = UIColor(hexStr: "#A2A2A2")
            }
        }
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        selectionStyle = .none
WanPai/Root/Welfare/TCell/WelfareWeeklyTCell.xib
@@ -201,6 +201,18 @@
                </constraints>
            </tableViewCellContentView>
            <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
            <connections>
                <outlet property="btn_status" destination="Tyi-iF-uKa" id="9x8-XU-3FY"/>
                <outlet property="img_cover" destination="zmP-dy-2N0" id="Mge-Tw-dvB"/>
                <outlet property="label_courseNum" destination="2Gg-Wx-fks" id="Uog-Ig-F7Z"/>
                <outlet property="label_datetime" destination="5Ci-1B-NXO" id="BHr-Cf-1i2"/>
                <outlet property="label_discountPrice" destination="Pqd-Ff-XyA" id="xlm-aN-m1N"/>
                <outlet property="label_distance" destination="RQ7-n5-NbV" id="EIu-dL-3lj"/>
                <outlet property="label_giftCourseNum" destination="ZeA-le-LUZ" id="WqI-2a-Vrb"/>
                <outlet property="label_price" destination="UEa-W5-680" id="ZXM-gT-E99"/>
                <outlet property="label_title" destination="CvQ-a2-im1" id="y4W-gw-i0J"/>
                <outlet property="view_giftCourseNum" destination="1zU-5c-0z4" id="STo-m7-Qzr"/>
            </connections>
            <point key="canvasLocation" x="219.84732824427479" y="71.478873239436624"/>
        </tableViewCell>
    </objects>
WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.swift
@@ -1,21 +1,100 @@
//
//  WelfareWeeklyDetailVC.swift
//  WanPai
//
//  Created by 无故事王国 on 2023/6/21.
//
    //
    //  WelfareWeeklyDetailVC.swift
    //  WanPai
    //
    //  Created by 无故事王国 on 2023/6/21.
    //
import UIKit
import QMUIKit
import JQTools
import SDWebImage
class WelfareWeeklyDetailVC: BaseVC {
    @IBOutlet weak var img_cover: UIImageView!
    @IBOutlet weak var label_name: UILabel!
    @IBOutlet weak var btn_address: QMUIButton!
    @IBOutlet weak var label_distance: UILabel!
    @IBOutlet weak var label_courseNum: UILabel!
    @IBOutlet weak var label_giftCourseNum: UILabel!
    @IBOutlet weak var view_giftCourseNum: UIView!
    @IBOutlet weak var label_attendWeeks: UILabel!
    @IBOutlet weak var label_datetime: UILabel!
    @IBOutlet weak var img_intro: UIImageView!
    @IBOutlet weak var cons_imgIntroHei: NSLayoutConstraint!
    @IBOutlet weak var img_intro2: UIImageView!
    @IBOutlet weak var cons_imgIntro2Hei: NSLayoutConstraint!
    @IBOutlet weak var label_price: UILabel!
    @IBOutlet weak var label_originPrice: UILabel!
    @IBOutlet weak var label_coin: UILabel!
    @IBOutlet weak var label_vip: UILabel!
    @IBOutlet weak var btn_handle: UIButton!
    private var id:Int!
    required init(id:Int) {
        super.init(nibName: nil, bundle: nil)
        self.id = id
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "课程详情"
        Services.weekBenefitDetail(id: id).subscribe(onNext: {[weak self] data in
            guard let weakSelf = self else { return }
            if let model = data.data{
                weakSelf.img_cover.sd_setImage(with: URL(string: model.coverDrawing))
                weakSelf.label_name.text = model.coursePackageName
                weakSelf.btn_address.setTitle(model.storeNameAddr, for: .normal)
                weakSelf.label_courseNum.text = "\(model.classHours)课时"
                weakSelf.label_giftCourseNum.text = "\(model.freeClassHours)课时"
                weakSelf.view_giftCourseNum.isHidden = model.freeClassHours == 0
                weakSelf.label_attendWeeks.text = model.weekTime
                weakSelf.label_datetime.text = model.time
                weakSelf.label_distance.text = String(format: "%.2lfkm", model.distance)
                weakSelf.label_vip.isHidden  = model.discountPrice == 0
                weakSelf.label_coin.isHidden = model.wanpaiGold == 0
                weakSelf.label_originPrice.isHidden = model.costPrice == 0
                if model.discountPrice > 0{
                    weakSelf.label_price.text = model.discountPrice.currency()
                    weakSelf.label_originPrice.attributedText =  AttributedStringbuilder.build().add(string: model.costPrice.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#C6C6C6"))
                        .delLine(color: UIColor(hexStr: "#C6C6C6")).mutableAttributedString
                }else{
                    weakSelf.label_price.text = model.costPrice.currency()
                }
                weakSelf.label_vip.attributedText = AttributedStringbuilder.build().add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")).add(string: model.vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString
                weakSelf.label_coin.attributedText = AttributedStringbuilder.build().add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")).add(string: "\(model.wanpaiGold)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString
                SDWebImageDownloader.shared.downloadImage(with: URL(string: model.introduceDrawing)) { [weak self] image, data, error, status in
                    if let img = image{
                        self?.img_intro.image = img
                        let radio = img.size.width / img.size.height
                        self?.cons_imgIntroHei.constant = JQ_ScreenW * radio
                    }
                }
            }
        }).disposed(by: disposeBag)
        
    }
    @IBAction func applyAction(_ sender: UIButton) {
        let vc = CourseDetailApplyVC(detailModel: CourseDetailModel())
        push(vc: vc)
        Services.queryCourseInfo(id: id).subscribe(onNext: {[weak self] data in
            if let m = data.data{
                let vc = CourseDetailApplyVC(detailModel: m)
                self?.push(vc: vc)
            }
        }).disposed(by: disposeBag)
    }
}
WanPai/Root/Welfare/VC/WelfareWeeklyDetailVC.xib
@@ -12,7 +12,25 @@
    <objects>
        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="WelfareWeeklyDetailVC" customModule="WanPai" customModuleProvider="target">
            <connections>
                <outlet property="btn_address" destination="W0q-KT-0kw" id="vaT-JY-9T2"/>
                <outlet property="btn_handle" destination="fo2-mD-30Z" id="cWq-FD-kkO"/>
                <outlet property="cons_imgIntro2Hei" destination="XcJ-9a-vwU" id="Oxh-8m-dZA"/>
                <outlet property="cons_imgIntroHei" destination="LTT-Lg-ST4" id="ISY-yQ-jZX"/>
                <outlet property="img_cover" destination="N0o-wc-kbY" id="FHX-0M-qxy"/>
                <outlet property="img_intro" destination="9fb-wg-pcf" id="CHi-xu-9ip"/>
                <outlet property="img_intro2" destination="rkq-O0-4a4" id="WTa-Wh-SEu"/>
                <outlet property="label_attendWeeks" destination="oZw-he-MSe" id="BMD-YM-tz3"/>
                <outlet property="label_coin" destination="ecn-wz-vwc" id="79x-GY-7Ib"/>
                <outlet property="label_courseNum" destination="Itx-UU-SPB" id="3eo-G9-llz"/>
                <outlet property="label_datetime" destination="gCN-9v-2nh" id="CTX-rf-x72"/>
                <outlet property="label_distance" destination="bev-p1-KjK" id="Au9-gO-faX"/>
                <outlet property="label_giftCourseNum" destination="mQE-9m-7Uc" id="EeH-5e-5Oe"/>
                <outlet property="label_name" destination="IRe-jL-GtL" id="uEh-DB-qmI"/>
                <outlet property="label_originPrice" destination="xCq-BR-M7r" id="6DX-lv-1qc"/>
                <outlet property="label_price" destination="Wps-ww-7sF" id="p7d-7a-V6K"/>
                <outlet property="label_vip" destination="7KS-mD-pbb" id="Nhg-8r-gdk"/>
                <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
                <outlet property="view_giftCourseNum" destination="He4-gs-Axl" id="8ou-GW-KLc"/>
            </connections>
        </placeholder>
        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
@@ -61,7 +79,7 @@
                                            <nil key="textColor"/>
                                            <nil key="highlightedColor"/>
                                        </label>
                                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="leading" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="W0q-KT-0kw" customClass="QMUIButton">
                                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="W0q-KT-0kw" customClass="QMUIButton">
                                            <rect key="frame" x="14" y="46" width="223" height="18"/>
                                            <constraints>
                                                <constraint firstAttribute="height" constant="18" id="7qi-vi-rmt"/>
WanPai/Root/Welfare/VC/WelfareWeeklyListVC.swift
@@ -93,7 +93,7 @@
    func pageViewController(_ pageViewConteoller: FFPageViewController, controllerForPage page: Int) -> UIViewController {
        return WelfareWeeklySubListVC()
        return WelfareWeeklySubListVC(type: page + 1)
    }
}
WanPai/Root/Welfare/VC/WelfareWeeklySubListVC.swift
@@ -6,18 +6,43 @@
//
import UIKit
import RxRelay
import RxSwift
class WealfareViewModel:RefreshModel<WeeklyItemModel>{
    var type = BehaviorRelay<Int>(value:1)
    override func api() -> (Observable<BaseResponse<[WeeklyItemModel]>>)? {
        return Services.weekLimitedBenefit(discountType: type.value)
    }
}
class WelfareWeeklySubListVC: BaseVC {
    lazy private var tableView:UITableView = {
        let table = UITableView(frame: .zero, style: .plain)
        table.separatorStyle = .none
    private let viewModel = WealfareViewModel()
    lazy private var tableView:BaseTableView = {
        let table = BaseTableView(frame: .zero, style: .plain)
        return table
    }()
        /// 默认显示 限时折扣 (1限时折扣 2赠送课时)
    init(type:Int){
        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()
        tableView.jq_setEmptyView()
    }
    override func setUI() {
@@ -34,18 +59,21 @@
extension WelfareWeeklySubListVC:UITableViewDelegate{
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let vc = WelfareWeeklyDetailVC()
        let model = viewModel.dataSource.value[indexPath.row]
        let vc = WelfareWeeklyDetailVC(id: model.coursePackageDiscountId)
        push(vc: vc)
    }
}
extension WelfareWeeklySubListVC:UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
         return 5
        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: "_WelfareWeeklyTCell") as! WelfareWeeklyTCell
        cell.weeklyItemModel = model
        return cell
    }