Commit 518398eb93a30a5548fa301a83ab869a5ddc666f
1 parent
f2d87c2b
实时热榜
Showing
9 changed files
with
153 additions
and
19 deletions
metaCode/Classes/Main/HomePage/Controller/DownSlideController/CNUpSlideDetailViewController.swift
| @@ -75,7 +75,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | @@ -75,7 +75,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | ||
| 75 | let frame = self.view.bounds | 75 | let frame = self.view.bounds |
| 76 | let view = CNUpSlideDetailScrollView(frame: frame) | 76 | let view = CNUpSlideDetailScrollView(frame: frame) |
| 77 | view.callBack = {(contentMdl:CNLiveDownSlideContentsModel)->Void in | 77 | view.callBack = {(contentMdl:CNLiveDownSlideContentsModel)->Void in |
| 78 | - CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl.model, contentId: contentMdl.contentId, pid: contentMdl.pid, shareUrl: contentMdl.shareUrl, thirdUrl: contentMdl.thirdUrl, title: contentMdl.title, s_to: contentMdl.s_to, trailerId: contentMdl.trailerId, controller: self) | 78 | + CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl.model, contentId: contentMdl.contentId, pid: contentMdl.pid, shareUrl: contentMdl.shareUrl, thirdUrl: contentMdl.thirdUrl, title: contentMdl.title, s_to: contentMdl.s_to, trailerId: contentMdl.trailerId, controller: self, slideModel: nil) |
| 79 | } | 79 | } |
| 80 | view.delegate = self | 80 | view.delegate = self |
| 81 | return view | 81 | return view |
| @@ -313,7 +313,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | @@ -313,7 +313,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | ||
| 313 | } | 313 | } |
| 314 | cell.albumModel = albumModel | 314 | cell.albumModel = albumModel |
| 315 | cell.enterBlock = { albumModel in | 315 | cell.enterBlock = { albumModel in |
| 316 | - CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: albumModel.model, contentId: albumModel.contentId, pid: albumModel.pid, shareUrl: albumModel.shareUrl, thirdUrl: albumModel.thirdUrl, title: albumModel.title, s_to: albumModel.s_to, trailerId: albumModel.trailerId, controller: self) | 316 | + CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: albumModel.model, contentId: albumModel.contentId, pid: albumModel.pid, shareUrl: albumModel.shareUrl, thirdUrl: albumModel.thirdUrl, title: albumModel.title, s_to: albumModel.s_to, trailerId: albumModel.trailerId, controller: self, slideModel: nil) |
| 317 | } | 317 | } |
| 318 | return cell | 318 | return cell |
| 319 | } | 319 | } |
| @@ -347,7 +347,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | @@ -347,7 +347,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | ||
| 347 | //大图课程,跳转h5 | 347 | //大图课程,跳转h5 |
| 348 | } | 348 | } |
| 349 | }else{ | 349 | }else{ |
| 350 | - CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: albumModel.model, contentId: albumModel.contentId, pid: albumModel.pid, shareUrl: albumModel.shareUrl, thirdUrl: albumModel.thirdUrl, title: albumModel.title, s_to: albumModel.s_to, trailerId: albumModel.trailerId, controller: self) | 350 | + CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: albumModel.model, contentId: albumModel.contentId, pid: albumModel.pid, shareUrl: albumModel.shareUrl, thirdUrl: albumModel.thirdUrl, title: albumModel.title, s_to: albumModel.s_to, trailerId: albumModel.trailerId, controller: self, slideModel: nil) |
| 351 | } | 351 | } |
| 352 | } | 352 | } |
| 353 | 353 |
metaCode/Classes/Main/HomePage/Controller/GoodsDetail/CNLiveShopGoodsDetailsViewController.swift
| @@ -36,7 +36,7 @@ class CNLiveShopGoodsDetailsViewController:CNLiveBaseViewController,UITableViewD | @@ -36,7 +36,7 @@ class CNLiveShopGoodsDetailsViewController:CNLiveBaseViewController,UITableViewD | ||
| 36 | var shareCircleBgView:CNLiveRoundedRectView? | 36 | var shareCircleBgView:CNLiveRoundedRectView? |
| 37 | var shareImageView:YYAnimatedImageView? | 37 | var shareImageView:YYAnimatedImageView? |
| 38 | 38 | ||
| 39 | - var CSV_playerView :CNLivePlayerView? | 39 | + var CSV_playerView:CNLivePlayerView? |
| 40 | 40 | ||
| 41 | weak var cycleScrollView :BKCycleScrollView? = { | 41 | weak var cycleScrollView :BKCycleScrollView? = { |
| 42 | let cycleScrollView = BKCycleScrollView() | 42 | let cycleScrollView = BKCycleScrollView() |
| @@ -192,6 +192,7 @@ class CNLiveShopGoodsDetailsViewController:CNLiveBaseViewController,UITableViewD | @@ -192,6 +192,7 @@ class CNLiveShopGoodsDetailsViewController:CNLiveBaseViewController,UITableViewD | ||
| 192 | // MARK: - UIScrollViewDelegate | 192 | // MARK: - UIScrollViewDelegate |
| 193 | func scrollViewDidScroll(_ scrollView: UIScrollView) { | 193 | func scrollViewDidScroll(_ scrollView: UIScrollView) { |
| 194 | if self.tableView == scrollView{ | 194 | if self.tableView == scrollView{ |
| 195 | + | ||
| 195 | if self.tableView.contentOffset.y < 0{ | 196 | if self.tableView.contentOffset.y < 0{ |
| 196 | self.topNavView.backgroundColor = UIColor(white: 1, alpha: 0) | 197 | self.topNavView.backgroundColor = UIColor(white: 1, alpha: 0) |
| 197 | self.leftCircleBgView?.alpha = 1 | 198 | self.leftCircleBgView?.alpha = 1 |
metaCode/Classes/Main/HomePage/View/VerticalViews/DownSlide/CNDownSlideSingleCourseCell.swift
| @@ -431,7 +431,8 @@ class CNDownSlideSingleCourseCell: UITableViewCell, UICollectionViewDelegate, UI | @@ -431,7 +431,8 @@ class CNDownSlideSingleCourseCell: UITableViewCell, UICollectionViewDelegate, UI | ||
| 431 | } | 431 | } |
| 432 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { | 432 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| 433 | if let contentMdl = self.realHotArr[indexPath.row] as? CNLiveDownSlideContentsModel{ | 433 | if let contentMdl = self.realHotArr[indexPath.row] as? CNLiveDownSlideContentsModel{ |
| 434 | - CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl.model , contentId: contentMdl.contentId , pid: contentMdl.pid , shareUrl: contentMdl.shareUrl , thirdUrl: contentMdl.thirdUrl , title: contentMdl.title , s_to: contentMdl.s_to ,trailerId: contentMdl.trailerId , controller: nil) | 434 | + //实时热榜点击短剧 |
| 435 | + CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl.model , contentId: contentMdl.contentId , pid: contentMdl.pid , shareUrl: contentMdl.shareUrl , thirdUrl: contentMdl.thirdUrl , title: contentMdl.title , s_to: contentMdl.s_to ,trailerId: contentMdl.trailerId , controller: nil, slideModel: self.slideModel) | ||
| 435 | } | 436 | } |
| 436 | } | 437 | } |
| 437 | 438 | ||
| @@ -518,16 +519,16 @@ class CNDownSlideSingleCourseCell: UITableViewCell, UICollectionViewDelegate, UI | @@ -518,16 +519,16 @@ class CNDownSlideSingleCourseCell: UITableViewCell, UICollectionViewDelegate, UI | ||
| 518 | let tag = sender.tag | 519 | let tag = sender.tag |
| 519 | if self.myCurriculum?.list.count ?? 0 > 0{ | 520 | if self.myCurriculum?.list.count ?? 0 > 0{ |
| 520 | let albumMdl = self.myCurriculum?.list[tag] | 521 | let albumMdl = self.myCurriculum?.list[tag] |
| 521 | - CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: albumMdl?.model ?? "", contentId: albumMdl?.contentId ?? "", pid: albumMdl?.pid ?? "", shareUrl: albumMdl?.shareUrl ?? "", thirdUrl: albumMdl?.thirdUrl ?? "", title: albumMdl?.title ?? "", s_to: albumMdl?.s_to ?? "",trailerId: albumMdl?.trailerId ?? "", controller: nil) | 522 | + CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: albumMdl?.model ?? "", contentId: albumMdl?.contentId ?? "", pid: albumMdl?.pid ?? "", shareUrl: albumMdl?.shareUrl ?? "", thirdUrl: albumMdl?.thirdUrl ?? "", title: albumMdl?.title ?? "", s_to: albumMdl?.s_to ?? "",trailerId: albumMdl?.trailerId ?? "", controller: nil, slideModel: nil) |
| 522 | }else if self.slideModel?.contents.count ?? 0 > 0{ | 523 | }else if self.slideModel?.contents.count ?? 0 > 0{ |
| 523 | let contentMdl = self.slideModel?.contents[tag] | 524 | let contentMdl = self.slideModel?.contents[tag] |
| 524 | - CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl?.model ?? "", contentId: contentMdl?.contentId ?? "", pid: contentMdl?.pid ?? "", shareUrl: contentMdl?.shareUrl ?? "", thirdUrl: contentMdl?.thirdUrl ?? "", title: contentMdl?.title ?? "", s_to: contentMdl?.s_to ?? "",trailerId: contentMdl?.trailerId ?? "", controller: nil) | 525 | + CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl?.model ?? "", contentId: contentMdl?.contentId ?? "", pid: contentMdl?.pid ?? "", shareUrl: contentMdl?.shareUrl ?? "", thirdUrl: contentMdl?.thirdUrl ?? "", title: contentMdl?.title ?? "", s_to: contentMdl?.s_to ?? "",trailerId: contentMdl?.trailerId ?? "", controller: nil, slideModel: nil) |
| 525 | } | 526 | } |
| 526 | } | 527 | } |
| 527 | @objc func pushWebAction(ges: UITapGestureRecognizer){ | 528 | @objc func pushWebAction(ges: UITapGestureRecognizer){ |
| 528 | let imageView = ges.view as! UIImageView | 529 | let imageView = ges.view as! UIImageView |
| 529 | let i = imageView.tag | 530 | let i = imageView.tag |
| 530 | let contentMdl = (self.slideModel?.contents[i])! | 531 | let contentMdl = (self.slideModel?.contents[i])! |
| 531 | - CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl.model , contentId: contentMdl.contentId , pid: contentMdl.pid , shareUrl: contentMdl.shareUrl , thirdUrl: contentMdl.thirdUrl , title: contentMdl.title , s_to: contentMdl.s_to ,trailerId: contentMdl.trailerId , controller: nil) | 532 | + CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl.model , contentId: contentMdl.contentId , pid: contentMdl.pid , shareUrl: contentMdl.shareUrl , thirdUrl: contentMdl.thirdUrl , title: contentMdl.title , s_to: contentMdl.s_to ,trailerId: contentMdl.trailerId , controller: nil, slideModel: nil) |
| 532 | } | 533 | } |
| 533 | } | 534 | } |
metaCode/Classes/Main/HomePage/View/VerticalViews/DownSlide/CNLiveDownSlideRecommendCell.swift
| @@ -19,6 +19,12 @@ let DownSlideTwoDuanJuImageW: CGFloat = (KSreenWidth-DownSlideRecommendLeftGap*5 | @@ -19,6 +19,12 @@ let DownSlideTwoDuanJuImageW: CGFloat = (KSreenWidth-DownSlideRecommendLeftGap*5 | ||
| 19 | let DownSlideTwoDuanJuH: CGFloat = 15+17+30+15+217/150.0*DownSlideRecommendWH+10+20+3+33+25+10 | 19 | let DownSlideTwoDuanJuH: CGFloat = 15+17+30+15+217/150.0*DownSlideRecommendWH+10+20+3+33+25+10 |
| 20 | ///type7 实时热榜的高 | 20 | ///type7 实时热榜的高 |
| 21 | let DownSlideRealHotListH: CGFloat = CGFloat(DownSlideSingleCourseW*140/345.0)+154 | 21 | let DownSlideRealHotListH: CGFloat = CGFloat(DownSlideSingleCourseW*140/345.0)+154 |
| 22 | +//播放页 实时热榜的高 | ||
| 23 | +let DownSlideRealHotListDetaiImgH: CGFloat = CGFloat(KSreenWidth*152/375.0) | ||
| 24 | +let DownSlideRealHotListDetaiCollectCellH: CGFloat = CGFloat(KSreenWidth*154/375.0) | ||
| 25 | +let DownSlideRealHotListDetaiCoverH: CGFloat = CGFloat(KSreenWidth*(152-65)/375.0)//cellectCell盖住图片的高 | ||
| 26 | +//实时热榜详情页总高 | ||
| 27 | +let DownSlideRealHotListDetaiH: CGFloat = DownSlideRealHotListDetaiImgH+DownSlideRealHotListDetaiCollectCellH-DownSlideRealHotListDetaiCoverH | ||
| 22 | 28 | ||
| 23 | 29 | ||
| 24 | 30 | ||
| @@ -95,7 +101,7 @@ class CNLiveDownSlideRecommendCell: UITableViewCell { | @@ -95,7 +101,7 @@ class CNLiveDownSlideRecommendCell: UITableViewCell { | ||
| 95 | let imageView = ges.view as! UIImageView | 101 | let imageView = ges.view as! UIImageView |
| 96 | let i = imageView.tag | 102 | let i = imageView.tag |
| 97 | let contentMdl = (self.slideModel?.contents[i])! | 103 | let contentMdl = (self.slideModel?.contents[i])! |
| 98 | - CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl.model , contentId: contentMdl.contentId , pid: contentMdl.pid , shareUrl: contentMdl.shareUrl , thirdUrl: contentMdl.thirdUrl , title: contentMdl.title , s_to: contentMdl.s_to ,trailerId: contentMdl.trailerId , controller: nil) | 104 | + CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl.model , contentId: contentMdl.contentId , pid: contentMdl.pid , shareUrl: contentMdl.shareUrl , thirdUrl: contentMdl.thirdUrl , title: contentMdl.title , s_to: contentMdl.s_to ,trailerId: contentMdl.trailerId , controller: nil, slideModel: nil) |
| 99 | } | 105 | } |
| 100 | 106 | ||
| 101 | } | 107 | } |
metaCode/Classes/Main/HomePage/View/VerticalViews/DownSlide/CNLiveDownSlideTodayRecommendCell.swift
| @@ -66,6 +66,6 @@ class CNLiveDownSlideTodayRecommendCell: UITableViewCell { | @@ -66,6 +66,6 @@ class CNLiveDownSlideTodayRecommendCell: UITableViewCell { | ||
| 66 | let imageView = ges.view as! UIImageView | 66 | let imageView = ges.view as! UIImageView |
| 67 | let i = imageView.tag | 67 | let i = imageView.tag |
| 68 | let contentMdl = self.slideModel?.contents[i] | 68 | let contentMdl = self.slideModel?.contents[i] |
| 69 | - CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl?.model ?? "", contentId: contentMdl?.contentId ?? "", pid: contentMdl?.pid ?? "", shareUrl: contentMdl?.shareUrl ?? "", thirdUrl: contentMdl?.thirdUrl ?? "", title: contentMdl?.title ?? "", s_to: contentMdl?.s_to ?? "",trailerId: contentMdl?.trailerId ?? "", controller: nil) | 69 | + CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl?.model ?? "", contentId: contentMdl?.contentId ?? "", pid: contentMdl?.pid ?? "", shareUrl: contentMdl?.shareUrl ?? "", thirdUrl: contentMdl?.thirdUrl ?? "", title: contentMdl?.title ?? "", s_to: contentMdl?.s_to ?? "",trailerId: contentMdl?.trailerId ?? "", controller: nil, slideModel: nil) |
| 70 | } | 70 | } |
| 71 | } | 71 | } |
metaCode/Classes/Main/HomePages/View/HomepageDetail/CNLiveAlbumCell.swift
| @@ -157,7 +157,7 @@ class CNLiveAlbumCell:UITableViewCell{ | @@ -157,7 +157,7 @@ class CNLiveAlbumCell:UITableViewCell{ | ||
| 157 | self.enterBlock!(self.albumModel!) | 157 | self.enterBlock!(self.albumModel!) |
| 158 | }else if self.albumModel?.model == kCNDownSlideContentsModelModelAlbum_ugc{ | 158 | }else if self.albumModel?.model == kCNDownSlideContentsModelModelAlbum_ugc{ |
| 159 | //短剧-跳转短剧播放页 | 159 | //短剧-跳转短剧播放页 |
| 160 | - CNLiveDownSlideTool.pushShortVideoController(contentId: aid, navigationVC: navigationViewController().visibleViewController?.navigationController) | 160 | + CNLiveDownSlideTool.pushShortVideoController(contentId: aid, navigationVC: navigationViewController().visibleViewController?.navigationController, slideModel: nil) |
| 161 | }else if self.albumModel?.model == kCNDownSlideContentsModelModelAlbum_video{ | 161 | }else if self.albumModel?.model == kCNDownSlideContentsModelModelAlbum_video{ |
| 162 | //课程-跳转h5视频专辑页 | 162 | //课程-跳转h5视频专辑页 |
| 163 | self.enterBlock!(self.albumModel!) | 163 | self.enterBlock!(self.albumModel!) |
| @@ -166,7 +166,7 @@ class CNLiveAlbumCell:UITableViewCell{ | @@ -166,7 +166,7 @@ class CNLiveAlbumCell:UITableViewCell{ | ||
| 166 | } | 166 | } |
| 167 | }else if (self.albumMsgModel != nil){ | 167 | }else if (self.albumMsgModel != nil){ |
| 168 | //短剧-跳转短剧播放页 | 168 | //短剧-跳转短剧播放页 |
| 169 | - CNLiveDownSlideTool.pushShortVideoController(contentId: aid, navigationVC: navigationViewController().visibleViewController?.navigationController) | 169 | + CNLiveDownSlideTool.pushShortVideoController(contentId: aid, navigationVC: navigationViewController().visibleViewController?.navigationController, slideModel: nil) |
| 170 | 170 | ||
| 171 | } | 171 | } |
| 172 | 172 |
metaCode/Classes/Main/HomePages/View/HomepageDetail/CNLiveDuanJuDetailCell.swift
| @@ -85,6 +85,7 @@ class CNLiveDuanJuDetailCell:UITableViewCell{ | @@ -85,6 +85,7 @@ class CNLiveDuanJuDetailCell:UITableViewCell{ | ||
| 85 | titleLabel.textColor = HexColor("#999999") | 85 | titleLabel.textColor = HexColor("#999999") |
| 86 | titleLabel.textAlignment = .left | 86 | titleLabel.textAlignment = .left |
| 87 | titleLabel.font = Font_12 | 87 | titleLabel.font = Font_12 |
| 88 | + titleLabel.numberOfLines = 2 | ||
| 88 | titleLabel.text = "" | 89 | titleLabel.text = "" |
| 89 | return titleLabel | 90 | return titleLabel |
| 90 | }() | 91 | }() |
metaCode/Classes/Main/Util/CNLiveDownSlideTool.swift
| @@ -9,7 +9,7 @@ import Foundation | @@ -9,7 +9,7 @@ import Foundation | ||
| 9 | import CNLiveShareToolKit | 9 | import CNLiveShareToolKit |
| 10 | 10 | ||
| 11 | class CNLiveDownSlideTool:NSObject{ | 11 | class CNLiveDownSlideTool:NSObject{ |
| 12 | - class func pushWebVCWithContentsMdl(model:String,contentId:String,pid:String,shareUrl:String,thirdUrl:String,title:String,s_to:String,trailerId:String,controller:UIViewController?){//contentMdl:CNLiveDownSlideContentsModel | 12 | + class func pushWebVCWithContentsMdl(model:String,contentId:String,pid:String,shareUrl:String,thirdUrl:String,title:String,s_to:String,trailerId:String,controller:UIViewController?,slideModel:CNLiveDownSlideModel?){//contentMdl:CNLiveDownSlideContentsModel |
| 13 | 13 | ||
| 14 | if (model == kCNDownSlideContentsModelModel1) { | 14 | if (model == kCNDownSlideContentsModelModel1) { |
| 15 | 15 | ||
| @@ -84,7 +84,7 @@ class CNLiveDownSlideTool:NSObject{ | @@ -84,7 +84,7 @@ class CNLiveDownSlideTool:NSObject{ | ||
| 84 | } | 84 | } |
| 85 | }else if (model == kCNDownSlideContentsModelModelAlbum_ugc){ | 85 | }else if (model == kCNDownSlideContentsModelModelAlbum_ugc){ |
| 86 | showLoading(message: "") | 86 | showLoading(message: "") |
| 87 | - self.pushShortVideoController(contentId: contentId, navigationVC: navigationViewController().visibleViewController?.navigationController) | 87 | + self.pushShortVideoController(contentId: contentId, navigationVC: navigationViewController().visibleViewController?.navigationController, slideModel: slideModel) |
| 88 | }else if model == kCNDownSlideContentsModelModelServing{ | 88 | }else if model == kCNDownSlideContentsModelModelServing{ |
| 89 | //跳转微信小程序 | 89 | //跳转微信小程序 |
| 90 | if let data = s_to.data(using: .utf8) { | 90 | if let data = s_to.data(using: .utf8) { |
| @@ -105,7 +105,7 @@ class CNLiveDownSlideTool:NSObject{ | @@ -105,7 +105,7 @@ class CNLiveDownSlideTool:NSObject{ | ||
| 105 | } | 105 | } |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | - class func pushShortVideoController(contentId:String,navigationVC:UINavigationController?){ | 108 | + class func pushShortVideoController(contentId:String,navigationVC:UINavigationController?,slideModel:CNLiveDownSlideModel?){ |
| 109 | //请求getAlbumMsg获取上次播放集数 | 109 | //请求getAlbumMsg获取上次播放集数 |
| 110 | //获取专辑详情(简介等) | 110 | //获取专辑详情(简介等) |
| 111 | CNLiveHomePageViewModel.getAlbumMsg(aid: contentId) { result, status in | 111 | CNLiveHomePageViewModel.getAlbumMsg(aid: contentId) { result, status in |
| @@ -114,7 +114,7 @@ class CNLiveDownSlideTool:NSObject{ | @@ -114,7 +114,7 @@ class CNLiveDownSlideTool:NSObject{ | ||
| 114 | let model = result as! CNLiveAlbumMsgModel | 114 | let model = result as! CNLiveAlbumMsgModel |
| 115 | //短剧-跳转短剧播放页 | 115 | //短剧-跳转短剧播放页 |
| 116 | let toIndex = model.episodeLast-1 <= 0 ? 0 : model.episodeLast-1 | 116 | let toIndex = model.episodeLast-1 <= 0 ? 0 : model.episodeLast-1 |
| 117 | - navigationVC?.pushViewController( CNLiveShortVideoViewController(aid: contentId, currentIndex: toIndex), animated: pushAnimated) | 117 | + navigationVC?.pushViewController( CNLiveShortVideoViewController(aid: contentId, currentIndex: toIndex, slideModel: slideModel), animated: pushAnimated) |
| 118 | }else{ | 118 | }else{ |
| 119 | //短剧-跳转短剧播放页 | 119 | //短剧-跳转短剧播放页 |
| 120 | navigationVC?.pushViewController(CNLiveShortVideoViewController(aid: contentId), animated: pushAnimated) | 120 | navigationVC?.pushViewController(CNLiveShortVideoViewController(aid: contentId), animated: pushAnimated) |
metaCode/Classes/Main/VideoPage/Controller/CNLiveShortVideoViewController.swift
| @@ -13,9 +13,42 @@ import MJRefresh | @@ -13,9 +13,42 @@ import MJRefresh | ||
| 13 | import CNLiveBusinessTools | 13 | import CNLiveBusinessTools |
| 14 | import CNLiveShareToolKit | 14 | import CNLiveShareToolKit |
| 15 | 15 | ||
| 16 | -class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, CNLiveShortVideoListTableViewCellDelegate, EmptyDataSetSource, EmptyDataSetDelegate { | 16 | +class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, CNLiveShortVideoListTableViewCellDelegate, EmptyDataSetSource, EmptyDataSetDelegate, UICollectionViewDelegate, UICollectionViewDataSource { |
| 17 | 17 | ||
| 18 | var player: ZFPlayerController! | 18 | var player: ZFPlayerController! |
| 19 | + //热榜 | ||
| 20 | + lazy var hotListView :UIView = { | ||
| 21 | + let hotListView = UIView(frame: CGRect(x: 0, y: -DownSlideRealHotListDetaiH, width: KSreenWidth, height: DownSlideRealHotListDetaiH)) | ||
| 22 | + return hotListView | ||
| 23 | + }() | ||
| 24 | + lazy var hotListImgView :UIImageView = { | ||
| 25 | + let hotListImgView = UIImageView(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: DownSlideRealHotListDetaiImgH)) | ||
| 26 | + hotListImgView.contentMode = .scaleAspectFill | ||
| 27 | + hotListImgView.clipsToBounds = true | ||
| 28 | + return hotListImgView | ||
| 29 | + }() | ||
| 30 | + //实时热榜的列表 | ||
| 31 | + lazy var realHotArr: NSMutableArray = { | ||
| 32 | + var realHotArr = NSMutableArray() | ||
| 33 | + return realHotArr | ||
| 34 | + }() | ||
| 35 | + let kRealHotListCollectionViewCellIdentifier = "kRealHotListCollectionViewCellIdentifier" | ||
| 36 | + lazy var realHotCollectionView: UICollectionView = { | ||
| 37 | + let layout = UICollectionViewFlowLayout() | ||
| 38 | + layout.scrollDirection = .horizontal | ||
| 39 | + layout.itemSize = CGSizeMake(69, 100+24) | ||
| 40 | + layout.sectionInset = .init(top: 0, left: DownSlideRecommendLeftGap, bottom: 0, right: 0) | ||
| 41 | + layout.minimumLineSpacing = 6 | ||
| 42 | + let cv = UICollectionView(frame: .zero, collectionViewLayout: layout) | ||
| 43 | + cv.delegate = self | ||
| 44 | + cv.dataSource = self | ||
| 45 | + cv.backgroundColor = .white | ||
| 46 | + cv.layer.cornerRadius = 12 | ||
| 47 | + cv.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner] | ||
| 48 | + cv.register(CNLiveDownSlideRealHotListCell.self, forCellWithReuseIdentifier: kRealHotListCollectionViewCellIdentifier) | ||
| 49 | + return cv | ||
| 50 | + }() | ||
| 51 | + | ||
| 19 | let kVideoBodyListViewCellIdentifier = "kVideoBodyListViewCellIdentifier" | 52 | let kVideoBodyListViewCellIdentifier = "kVideoBodyListViewCellIdentifier" |
| 20 | lazy var tableView : UITableView = { | 53 | lazy var tableView : UITableView = { |
| 21 | let tableView = UITableView(frame: .zero, style: .plain) | 54 | let tableView = UITableView(frame: .zero, style: .plain) |
| @@ -50,6 +83,19 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -50,6 +83,19 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 50 | button.addTarget(self, action: #selector(backClick(_:)), for: .touchUpInside) | 83 | button.addTarget(self, action: #selector(backClick(_:)), for: .touchUpInside) |
| 51 | return button | 84 | return button |
| 52 | }() | 85 | }() |
| 86 | + lazy var hotListBtn: UIButton = { | ||
| 87 | + let button = UIButton(type: .custom) | ||
| 88 | + button.backgroundColor = HexColor("#000000", alpha: 0.3) | ||
| 89 | + button.setTitle("上滑查看完整视频", for: .normal) | ||
| 90 | + button.setTitle("查看实时热榜", for: .selected) | ||
| 91 | + button.setTitleColor(.white, for: .normal) | ||
| 92 | + button.titleLabel?.font = Font_13 | ||
| 93 | + button.layer.cornerRadius = 14 | ||
| 94 | + button.clipsToBounds = true | ||
| 95 | + button.addTarget(self, action: #selector(hotListBtnClick(_:)), for: .touchUpInside) | ||
| 96 | + return button | ||
| 97 | + }() | ||
| 98 | + | ||
| 53 | 99 | ||
| 54 | lazy var controlView: CNLiveShortVideoControlView = { | 100 | lazy var controlView: CNLiveShortVideoControlView = { |
| 55 | let controlView = CNLiveShortVideoControlView.init(frame: CGRectZero) | 101 | let controlView = CNLiveShortVideoControlView.init(frame: CGRectZero) |
| @@ -75,12 +121,14 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -75,12 +121,14 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 75 | 121 | ||
| 76 | var aid: String! = "" | 122 | var aid: String! = "" |
| 77 | var pageNum: NSInteger! = 1//页数 | 123 | var pageNum: NSInteger! = 1//页数 |
| 124 | + var slideModel:CNLiveDownSlideModel? | ||
| 78 | var isSelectable: Bool! = false | 125 | var isSelectable: Bool! = false |
| 79 | var currentIndex: NSInteger! = 0//播放集数 | 126 | var currentIndex: NSInteger! = 0//播放集数 |
| 80 | var pickerView: CNLiveShortVideoContentListView! | 127 | var pickerView: CNLiveShortVideoContentListView! |
| 81 | var footerRefreshView: CNLiveFooterRefresh! | 128 | var footerRefreshView: CNLiveFooterRefresh! |
| 82 | // var playerManager = ZFIJKPlayerManager.init() | 129 | // var playerManager = ZFIJKPlayerManager.init() |
| 83 | var playerManager = ZFAVPlayerManager.init() | 130 | var playerManager = ZFAVPlayerManager.init() |
| 131 | + var previousOffset:CGFloat = 50000.0 | ||
| 84 | 132 | ||
| 85 | /// 初始化播放器 | 133 | /// 初始化播放器 |
| 86 | /// - Parameters: | 134 | /// - Parameters: |
| @@ -111,7 +159,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -111,7 +159,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 111 | 159 | ||
| 112 | /// 初始化播放器,第多少集 | 160 | /// 初始化播放器,第多少集 |
| 113 | /// - Parameter aid: 专辑 id ,第多少集 | 161 | /// - Parameter aid: 专辑 id ,第多少集 |
| 114 | - init(aid: String,currentIndex: NSInteger) { | 162 | + init(aid: String,currentIndex: NSInteger,slideModel:CNLiveDownSlideModel?) { |
| 115 | self.aid = aid | 163 | self.aid = aid |
| 116 | self.isSelectable = false | 164 | self.isSelectable = false |
| 117 | self.currentIndex = currentIndex | 165 | self.currentIndex = currentIndex |
| @@ -121,6 +169,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -121,6 +169,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 121 | page = 1 | 169 | page = 1 |
| 122 | } | 170 | } |
| 123 | self.pageNum = page | 171 | self.pageNum = page |
| 172 | + self.slideModel = slideModel | ||
| 124 | 173 | ||
| 125 | } | 174 | } |
| 126 | 175 | ||
| @@ -152,7 +201,17 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -152,7 +201,17 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 152 | super.viewDidLoad() | 201 | super.viewDidLoad() |
| 153 | view.backgroundColor = .black | 202 | view.backgroundColor = .black |
| 154 | view.addSubview(tableView) | 203 | view.addSubview(tableView) |
| 204 | + view.addSubview(hotListView) | ||
| 205 | + hotListView.addSubview(self.hotListImgView) | ||
| 206 | + self.hotListImgView.kf.setImage(with: URL(string: self.slideModel!.background)) | ||
| 207 | + hotListView.addSubview(self.realHotCollectionView) | ||
| 155 | view.addSubview(backBtn) | 208 | view.addSubview(backBtn) |
| 209 | + view.addSubview(hotListBtn) | ||
| 210 | + self.realHotCollectionView.frame = CGRect(x: 0, y: DownSlideRealHotListDetaiH-DownSlideRealHotListDetaiCollectCellH, width: KSreenWidth, height: DownSlideRealHotListDetaiCollectCellH) | ||
| 211 | + self.realHotArr = NSMutableArray(array: self.slideModel!.contents) | ||
| 212 | + self.realHotCollectionView.reloadData() | ||
| 213 | + | ||
| 214 | + self.updateHotListView(isShow: self.slideModel == nil ? false : true) | ||
| 156 | 215 | ||
| 157 | if self.dataArray.count == 0 { | 216 | if self.dataArray.count == 0 { |
| 158 | requestData {noMore in } | 217 | requestData {noMore in } |
| @@ -211,6 +270,52 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -211,6 +270,52 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 211 | NotificationCenter.default.addObserver(self, selector: #selector(removePlayerAction), name: Notification.Name.PlayerManage.kPlayerDestroyNotification, object: nil) | 270 | NotificationCenter.default.addObserver(self, selector: #selector(removePlayerAction), name: Notification.Name.PlayerManage.kPlayerDestroyNotification, object: nil) |
| 212 | } | 271 | } |
| 213 | 272 | ||
| 273 | + func updateHotListView(isShow:Bool){ | ||
| 274 | + if let model = self.slideModel{ | ||
| 275 | + if isShow{//展示热榜 | ||
| 276 | + UIView.animate(withDuration: 0.25) { | ||
| 277 | + self.hotListView.top = 0 | ||
| 278 | + self.tableView.top = self.hotListView.bottom | ||
| 279 | + } | ||
| 280 | + self.hotListBtn.isSelected = false | ||
| 281 | + }else{ | ||
| 282 | + //隐藏热榜 | ||
| 283 | + UIView.animate(withDuration: 0.25) { | ||
| 284 | + self.hotListView.top = -self.hotListView.height | ||
| 285 | + self.tableView.top = self.hotListView.bottom | ||
| 286 | + } | ||
| 287 | + self.hotListBtn.isSelected = true | ||
| 288 | + } | ||
| 289 | + }else{ | ||
| 290 | + //隐藏热榜 | ||
| 291 | + UIView.animate(withDuration: 0.25) { | ||
| 292 | + self.hotListView.top = -self.hotListView.height | ||
| 293 | + self.tableView.top = self.hotListView.bottom | ||
| 294 | + } | ||
| 295 | + self.hotListBtn.isSelected = true | ||
| 296 | + } | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + // MARK: - 实时热榜里横向列表 | ||
| 300 | + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { | ||
| 301 | + self.realHotArr.count | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { | ||
| 305 | + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kRealHotListCollectionViewCellIdentifier, for: indexPath) as! CNLiveDownSlideRealHotListCell | ||
| 306 | + cell.num = indexPath.row+1 | ||
| 307 | + // 加载和设置图片到 cell.imageView | ||
| 308 | + cell.contentsModel = self.realHotArr[indexPath.row] as? CNLiveDownSlideContentsModel | ||
| 309 | + return cell | ||
| 310 | + | ||
| 311 | + } | ||
| 312 | + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { | ||
| 313 | + if let contentMdl = self.realHotArr[indexPath.row] as? CNLiveDownSlideContentsModel{ | ||
| 314 | + //实时热榜点击短剧 | ||
| 315 | + CNLiveDownSlideTool.pushWebVCWithContentsMdl(model: contentMdl.model , contentId: contentMdl.contentId , pid: contentMdl.pid , shareUrl: contentMdl.shareUrl , thirdUrl: contentMdl.thirdUrl , title: contentMdl.title , s_to: contentMdl.s_to ,trailerId: contentMdl.trailerId , controller: nil, slideModel: self.slideModel) | ||
| 316 | + } | ||
| 317 | + } | ||
| 318 | + | ||
| 214 | func addRefreshView() { | 319 | func addRefreshView() { |
| 215 | self.tableView.refreshControl = headerRefreshView | 320 | self.tableView.refreshControl = headerRefreshView |
| 216 | footerRefreshView = CNLiveFooterRefresh(refreshingBlock: { [weak self] in | 321 | footerRefreshView = CNLiveFooterRefresh(refreshingBlock: { [weak self] in |
| @@ -242,7 +347,8 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -242,7 +347,8 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 242 | 347 | ||
| 243 | override func viewWillLayoutSubviews() { | 348 | override func viewWillLayoutSubviews() { |
| 244 | super.viewWillLayoutSubviews() | 349 | super.viewWillLayoutSubviews() |
| 245 | - self.backBtn.frame = CGRectMake(15, KStatusBarHeight + 15, 45, 45) | 350 | + self.backBtn.frame = CGRectMake(15, KStatusBarHeight + 5, 45, 45) |
| 351 | + self.hotListBtn.frame = CGRectMake((KSreenWidth-144)/2.0, self.hotListView.bottom+19, 144, 28) | ||
| 246 | } | 352 | } |
| 247 | 353 | ||
| 248 | func requestData(resultBlock: @escaping (_ noMore: Bool) -> Void) { | 354 | func requestData(resultBlock: @escaping (_ noMore: Bool) -> Void) { |
| @@ -337,6 +443,15 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -337,6 +443,15 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 337 | @objc func backClick(_ sender: UIButton) { | 443 | @objc func backClick(_ sender: UIButton) { |
| 338 | self.navigationController?.popViewController(animated: true) | 444 | self.navigationController?.popViewController(animated: true) |
| 339 | } | 445 | } |
| 446 | + @objc func hotListBtnClick(_ sender: UIButton) { | ||
| 447 | + if sender.isSelected == false{ | ||
| 448 | + //隐藏热榜 | ||
| 449 | + self.updateHotListView(isShow: false) | ||
| 450 | + }else{ | ||
| 451 | + //查看热榜 | ||
| 452 | + self.updateHotListView(isShow: true) | ||
| 453 | + } | ||
| 454 | + } | ||
| 340 | 455 | ||
| 341 | func playVideo(at indexPath: IndexPath) { | 456 | func playVideo(at indexPath: IndexPath) { |
| 342 | let data: CNLiveAlbumListModel = dataArray[indexPath.row] as! CNLiveAlbumListModel | 457 | let data: CNLiveAlbumListModel = dataArray[indexPath.row] as! CNLiveAlbumListModel |
| @@ -500,6 +615,16 @@ extension CNLiveShortVideoViewController { | @@ -500,6 +615,16 @@ extension CNLiveShortVideoViewController { | ||
| 500 | 615 | ||
| 501 | func scrollViewDidScroll(_ scrollView: UIScrollView) { | 616 | func scrollViewDidScroll(_ scrollView: UIScrollView) { |
| 502 | scrollView.zf_scrollViewDidScroll() | 617 | scrollView.zf_scrollViewDidScroll() |
| 618 | + if previousOffset != 50000.0{ | ||
| 619 | + if self.tableView.contentOffset.y < previousOffset { | ||
| 620 | + // 向下滑动 | ||
| 621 | + } else if self.tableView.contentOffset.y > previousOffset { | ||
| 622 | + // 向上滑动 | ||
| 623 | + self.updateHotListView(isShow: false) | ||
| 624 | + print("TableView is scrolling down") | ||
| 625 | + } | ||
| 626 | + } | ||
| 627 | + previousOffset = self.tableView.contentOffset.y | ||
| 503 | } | 628 | } |
| 504 | 629 | ||
| 505 | func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { | 630 | func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { |