Commit e82e1e30b86f5e140ead95fc7b6214eec98aa603
1 parent
715aa40e
适配h5播放直播的参数 , 跳转工具优化方法
Showing
7 changed files
with
57 additions
and
146 deletions
metaCode/Classes/Main/HomePage/Controller/DownSlideController/CNUpSlideDetailViewController.swift
| @@ -69,7 +69,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | @@ -69,7 +69,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | ||
| 69 | let frame = self.view.bounds | 69 | let frame = self.view.bounds |
| 70 | let view = CNUpSlideDetailScrollView(frame: frame) | 70 | let view = CNUpSlideDetailScrollView(frame: frame) |
| 71 | view.callBack = {(contentMdl:CNLiveDownSlideContentsModel)->Void in | 71 | view.callBack = {(contentMdl:CNLiveDownSlideContentsModel)->Void in |
| 72 | - CNLiveDownSlideTool.detailPushWebVCWithContentsMdl(contentMdl: contentMdl, viewController: self) | 72 | + 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) |
| 73 | } | 73 | } |
| 74 | view.delegate = self | 74 | view.delegate = self |
| 75 | return view | 75 | return view |
| @@ -289,7 +289,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | @@ -289,7 +289,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | ||
| 289 | } | 289 | } |
| 290 | cell.albumModel = albumModel | 290 | cell.albumModel = albumModel |
| 291 | cell.enterBlock = { albumModel in | 291 | cell.enterBlock = { albumModel in |
| 292 | - CNLiveDownSlideTool.pushWebVCWithCNLiveAlbumMdl(albumModel: albumModel,controller: self) | 292 | + 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) |
| 293 | } | 293 | } |
| 294 | return cell | 294 | return cell |
| 295 | } | 295 | } |
| @@ -328,11 +328,10 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | @@ -328,11 +328,10 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou | ||
| 328 | 328 | ||
| 329 | }else if self.slideModel?.type == SlideModelTypeOneCourse75{ | 329 | }else if self.slideModel?.type == SlideModelTypeOneCourse75{ |
| 330 | //大图课程,跳转h5 | 330 | //大图课程,跳转h5 |
| 331 | -// CNLiveDownSlideTool.pushWebVCWithCNLiveAlbumMdl(albumModel: albumModel,controller: self) | ||
| 332 | } | 331 | } |
| 333 | } | 332 | } |
| 334 | }else{ | 333 | }else{ |
| 335 | - CNLiveDownSlideTool.pushWebVCWithCNLiveAlbumMdl(albumModel: albumModel,controller: self) | 334 | + 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) |
| 336 | } | 335 | } |
| 337 | } | 336 | } |
| 338 | 337 |
metaCode/Classes/Main/HomePage/View/VerticalViews/DownSlide/CNDownSlideSingleCourseCell.swift
| @@ -320,11 +320,10 @@ class CNDownSlideSingleCourseCell: UITableViewCell { | @@ -320,11 +320,10 @@ class CNDownSlideSingleCourseCell: UITableViewCell { | ||
| 320 | let tag = sender.tag | 320 | let tag = sender.tag |
| 321 | if self.myCurriculum?.list.count ?? 0 > 0{ | 321 | if self.myCurriculum?.list.count ?? 0 > 0{ |
| 322 | let albumMdl = self.myCurriculum?.list[tag] | 322 | let albumMdl = self.myCurriculum?.list[tag] |
| 323 | - 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 ?? "") | ||
| 324 | - | 323 | + 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) |
| 325 | }else if self.slideModel?.contents.count ?? 0 > 0{ | 324 | }else if self.slideModel?.contents.count ?? 0 > 0{ |
| 326 | let contentMdl = self.slideModel?.contents[tag] | 325 | let contentMdl = self.slideModel?.contents[tag] |
| 327 | - 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 ?? "") | 326 | + 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) |
| 328 | } | 327 | } |
| 329 | } | 328 | } |
| 330 | } | 329 | } |
metaCode/Classes/Main/HomePage/View/VerticalViews/DownSlide/CNLiveDownSlideRecommendCell.swift
| @@ -86,7 +86,7 @@ class CNLiveDownSlideRecommendCell: UITableViewCell { | @@ -86,7 +86,7 @@ class CNLiveDownSlideRecommendCell: UITableViewCell { | ||
| 86 | let imageView = ges.view as! UIImageView | 86 | let imageView = ges.view as! UIImageView |
| 87 | let i = imageView.tag | 87 | let i = imageView.tag |
| 88 | let contentMdl = (self.slideModel?.contents[i])! | 88 | let contentMdl = (self.slideModel?.contents[i])! |
| 89 | - 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 ?? "") | 89 | + 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) |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | } | 92 | } |
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 ?? "") | 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) |
| 70 | } | 70 | } |
| 71 | } | 71 | } |
metaCode/Classes/Main/HomePages/Model/CNLiveAlbumModel.swift
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | // 全部专辑列表数据 | 6 | // 全部专辑列表数据 |
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | - | 9 | +///contentApi/getBlockContent |
| 10 | class CNLiveAlbumBaseModel:BaseModel{ | 10 | class CNLiveAlbumBaseModel:BaseModel{ |
| 11 | var endRow = 0 | 11 | var endRow = 0 |
| 12 | var firstPage = 0 | 12 | var firstPage = 0 |
| @@ -38,16 +38,18 @@ class CNLiveAlbumModel:BaseModel{ | @@ -38,16 +38,18 @@ class CNLiveAlbumModel:BaseModel{ | ||
| 38 | var tag = "" | 38 | var tag = "" |
| 39 | var model = ""//1,2,3,4课程 album_ugc短剧 ,album_video专辑h5 | 39 | var model = ""//1,2,3,4课程 album_ugc短剧 ,album_video专辑h5 |
| 40 | var thirdUrl = "" | 40 | var thirdUrl = "" |
| 41 | + //model2 直播时用 | ||
| 42 | + var trailerId = "" | ||
| 41 | var publishTime = "" | 43 | var publishTime = "" |
| 42 | var shareUrl = "" | 44 | var shareUrl = "" |
| 43 | var spIcon = "" | 45 | var spIcon = "" |
| 44 | var product:CNLiveAlbumProductModel? | 46 | var product:CNLiveAlbumProductModel? |
| 45 | ///小程序地址和小程序id {"path":"page/login_hint/login_hint","id":"gh_234d4ed615a3"} | 47 | ///小程序地址和小程序id {"path":"page/login_hint/login_hint","id":"gh_234d4ed615a3"} |
| 46 | - var s_to: String? | 48 | + var s_to = "" |
| 47 | ///103时为微信小程序 | 49 | ///103时为微信小程序 |
| 48 | - var s_type: String? | 50 | + var s_type = "" |
| 49 | ///"weixin://dl/business/?t=NnvptiuER3k" | 51 | ///"weixin://dl/business/?t=NnvptiuER3k" |
| 50 | - var s_showType: String? | 52 | + var s_showType = "" |
| 51 | //还有部分属性没写 | 53 | //还有部分属性没写 |
| 52 | } | 54 | } |
| 53 | class CNLiveAlbumProductModel:BaseModel{ | 55 | class CNLiveAlbumProductModel:BaseModel{ |
metaCode/Classes/Main/Model/CNLiveDownSlideModel.swift
| @@ -31,6 +31,8 @@ class CNLiveDownSlideModel: BaseModel { | @@ -31,6 +31,8 @@ class CNLiveDownSlideModel: BaseModel { | ||
| 31 | var rowNum: Int = 0 | 31 | var rowNum: Int = 0 |
| 32 | ///具体内容 title subTitle poster thirdUrl或者shareUrl | 32 | ///具体内容 title subTitle poster thirdUrl或者shareUrl |
| 33 | var contents = [CNLiveDownSlideContentsModel]() | 33 | var contents = [CNLiveDownSlideContentsModel]() |
| 34 | + | ||
| 35 | + | ||
| 34 | ///cell高度 | 36 | ///cell高度 |
| 35 | var cellH: Float = 0 | 37 | var cellH: Float = 0 |
| 36 | 38 | ||
| @@ -67,6 +69,8 @@ class CNLiveDownSlideContentsModel: BaseModel { | @@ -67,6 +69,8 @@ class CNLiveDownSlideContentsModel: BaseModel { | ||
| 67 | var model: String = "" | 69 | var model: String = "" |
| 68 | ///model为1,2时 | 70 | ///model为1,2时 |
| 69 | var shareUrl: String = "" | 71 | var shareUrl: String = "" |
| 72 | + ///model为2时 直播用 | ||
| 73 | + var trailerId: String = "" | ||
| 70 | ///model为3,4时跳转url | 74 | ///model为3,4时跳转url |
| 71 | var thirdUrl: String = "" | 75 | var thirdUrl: String = "" |
| 72 | ///小程序地址和小程序id {"path":"page/login_hint/login_hint","id":"gh_234d4ed615a3"} | 76 | ///小程序地址和小程序id {"path":"page/login_hint/login_hint","id":"gh_234d4ed615a3"} |
| @@ -75,4 +79,6 @@ class CNLiveDownSlideContentsModel: BaseModel { | @@ -75,4 +79,6 @@ class CNLiveDownSlideContentsModel: BaseModel { | ||
| 75 | var s_type: String = "" | 79 | var s_type: String = "" |
| 76 | ///"weixin://dl/business/?t=NnvptiuER3k" | 80 | ///"weixin://dl/business/?t=NnvptiuER3k" |
| 77 | var s_showType: String = "" | 81 | var s_showType: String = "" |
| 82 | + | ||
| 83 | + | ||
| 78 | } | 84 | } |
metaCode/Classes/Main/Util/CNLiveDownSlideTool.swift
| @@ -9,9 +9,9 @@ import Foundation | @@ -9,9 +9,9 @@ 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){//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?){//contentMdl:CNLiveDownSlideContentsModel |
| 13 | 13 | ||
| 14 | - if (model == kCNDownSlideContentsModelModel1) || (model == kCNDownSlideContentsModelModel2){ | 14 | + if (model == kCNDownSlideContentsModelModel1) { |
| 15 | 15 | ||
| 16 | let queryItem = URLQueryItem(name: "contentId", value: contentId) | 16 | let queryItem = URLQueryItem(name: "contentId", value: contentId) |
| 17 | let queryItem1 = URLQueryItem(name: "videoId", value: pid) | 17 | let queryItem1 = URLQueryItem(name: "videoId", value: pid) |
| @@ -20,11 +20,35 @@ class CNLiveDownSlideTool:NSObject{ | @@ -20,11 +20,35 @@ class CNLiveDownSlideTool:NSObject{ | ||
| 20 | let regURL = urlComponents.url | 20 | let regURL = urlComponents.url |
| 21 | let webVC = CNWebViewController() | 21 | let webVC = CNWebViewController() |
| 22 | webVC.url = regURL | 22 | webVC.url = regURL |
| 23 | - navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) | 23 | + if controller != nil{ |
| 24 | + controller!.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 25 | + }else{ | ||
| 26 | + navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 27 | + } | ||
| 28 | + }else if (model == kCNDownSlideContentsModelModel2){ | ||
| 29 | + | ||
| 30 | + let queryItem = URLQueryItem(name: "contentId", value: contentId) | ||
| 31 | + let queryItem1 = URLQueryItem(name: "activityId", value: pid) | ||
| 32 | + let queryItem2 = URLQueryItem(name: "pid", value: pid) | ||
| 33 | + let queryItem3 = URLQueryItem(name: "trailerId", value: trailerId) | ||
| 34 | + let urlComponents = NSURLComponents(string: shareUrl)! | ||
| 35 | + urlComponents.queryItems = [queryItem, queryItem1, queryItem2, queryItem3] | ||
| 36 | + let regURL = urlComponents.url | ||
| 37 | + let webVC = CNWebViewController() | ||
| 38 | + webVC.url = regURL | ||
| 39 | + if controller != nil{ | ||
| 40 | + controller!.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 41 | + }else{ | ||
| 42 | + navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 43 | + } | ||
| 24 | }else if (model == kCNDownSlideContentsModelModel3) || (model == kCNDownSlideContentsModelModel4){ | 44 | }else if (model == kCNDownSlideContentsModelModel3) || (model == kCNDownSlideContentsModelModel4){ |
| 25 | let webVC = CNWebViewController() | 45 | let webVC = CNWebViewController() |
| 26 | webVC.url = URL(string: thirdUrl) | 46 | webVC.url = URL(string: thirdUrl) |
| 27 | - navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) | 47 | + if controller != nil{ |
| 48 | + controller!.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 49 | + }else{ | ||
| 50 | + navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 51 | + } | ||
| 28 | }else if (model == kCNDownSlideContentsModelModelAlbum){ | 52 | }else if (model == kCNDownSlideContentsModelModelAlbum){ |
| 29 | 53 | ||
| 30 | let urlString = "http://wjjh5.cnlive.com/cnYmAlbumVideoList.html" | 54 | let urlString = "http://wjjh5.cnlive.com/cnYmAlbumVideoList.html" |
| @@ -35,7 +59,11 @@ class CNLiveDownSlideTool:NSObject{ | @@ -35,7 +59,11 @@ class CNLiveDownSlideTool:NSObject{ | ||
| 35 | let regURL = urlComponents?.url | 59 | let regURL = urlComponents?.url |
| 36 | let webVC = CNWebViewController() | 60 | let webVC = CNWebViewController() |
| 37 | webVC.url = regURL | 61 | webVC.url = regURL |
| 38 | - navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) | 62 | + if controller != nil{ |
| 63 | + controller!.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 64 | + }else{ | ||
| 65 | + navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 66 | + } | ||
| 39 | }else if (model == kCNDownSlideContentsModelModelAlbum_video){ | 67 | }else if (model == kCNDownSlideContentsModelModelAlbum_video){ |
| 40 | let urlString = "http://wjjh5.cnlive.com/cnYjzgAlbumVideo.html" | 68 | let urlString = "http://wjjh5.cnlive.com/cnYjzgAlbumVideo.html" |
| 41 | let queryItem = URLQueryItem(name: "aid", value: contentId) | 69 | let queryItem = URLQueryItem(name: "aid", value: contentId) |
| @@ -48,7 +76,11 @@ class CNLiveDownSlideTool:NSObject{ | @@ -48,7 +76,11 @@ class CNLiveDownSlideTool:NSObject{ | ||
| 48 | let regURL = urlComponents?.url | 76 | let regURL = urlComponents?.url |
| 49 | let webVC = CNWebViewController() | 77 | let webVC = CNWebViewController() |
| 50 | webVC.url = regURL | 78 | webVC.url = regURL |
| 51 | - navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) | 79 | + if controller != nil{ |
| 80 | + controller!.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 81 | + }else{ | ||
| 82 | + navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 83 | + } | ||
| 52 | }else if (model == kCNDownSlideContentsModelModelAlbum_ugc){ | 84 | }else if (model == kCNDownSlideContentsModelModelAlbum_ugc){ |
| 53 | 85 | ||
| 54 | //短剧-跳转短剧播放页 | 86 | //短剧-跳转短剧播放页 |
| @@ -72,131 +104,4 @@ class CNLiveDownSlideTool:NSObject{ | @@ -72,131 +104,4 @@ class CNLiveDownSlideTool:NSObject{ | ||
| 72 | return | 104 | return |
| 73 | } | 105 | } |
| 74 | } | 106 | } |
| 75 | - class func pushWebVCWithCNLiveAlbumMdl(albumModel:CNLiveAlbumModel,controller:UIViewController){ | ||
| 76 | - | ||
| 77 | - if (albumModel.model == kCNDownSlideContentsModelModel1) || (albumModel.model == kCNDownSlideContentsModelModel2){ | ||
| 78 | - | ||
| 79 | - let queryItem = URLQueryItem(name: "contentId", value: albumModel.contentId) | ||
| 80 | - let queryItem1 = URLQueryItem(name: "videoId", value: albumModel.pid) | ||
| 81 | - let urlComponents = NSURLComponents(string: (albumModel.shareUrl))! | ||
| 82 | - urlComponents.queryItems = [queryItem, queryItem1] | ||
| 83 | - let regURL = urlComponents.url | ||
| 84 | - let webVC = CNWebViewController() | ||
| 85 | - webVC.url = regURL | ||
| 86 | - controller.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 87 | - }else if (albumModel.model == kCNDownSlideContentsModelModel3) || (albumModel.model == kCNDownSlideContentsModelModel4){ | ||
| 88 | - let webVC = CNWebViewController() | ||
| 89 | - webVC.url = URL(string: (albumModel.thirdUrl)) | ||
| 90 | - controller.navigationController?.pushViewController(webVC, animated: pushAnimated) | ||
| 91 | - }else if albumModel.model == kCNDownSlideContentsModelModelAlbum{ | ||
| 92 | - | ||
| 93 | - let urlString = "http://wjjh5.cnlive.com/cnYmAlbumVideoList.html" | ||
| 94 | - let queryItem = URLQueryItem(name: "aid", value: albumModel.contentId) | ||
| 95 | - let queryItem1 = URLQueryItem(name: "title", value: albumModel.title) | ||
| 96 | - let urlComponents = NSURLComponents(string: urlString) | ||
| 97 | - urlComponents!.queryItems = [queryItem, queryItem1] | ||
| 98 | - let regURL = urlComponents?.url | ||
| 99 | - let webVC = CNWebViewController() | ||
| 100 | - webVC.url = regURL | ||
| 101 | - controller.navigationController?.pushViewController(webVC, animated: true) | ||
| 102 | - }else if (albumModel.model == kCNDownSlideContentsModelModelAlbum_video){ | ||
| 103 | - let urlString = "http://wjjh5.cnlive.com/cnYjzgAlbumVideo.html" | ||
| 104 | - let queryItem = URLQueryItem(name: "aid", value: albumModel.contentId) | ||
| 105 | - let queryItem1 = URLQueryItem(name: "title", value: albumModel.title) | ||
| 106 | - let queryItem2 = URLQueryItem(name: "channelName", value: "yjzg") | ||
| 107 | - let queryItem3 = URLQueryItem(name: "isShowTitle", value: "true") | ||
| 108 | - let queryItem4 = URLQueryItem(name: "isWjjReport", value: "true") | ||
| 109 | - let urlComponents = NSURLComponents(string: urlString) | ||
| 110 | - urlComponents!.queryItems = [queryItem, queryItem1,queryItem2,queryItem3,queryItem4] | ||
| 111 | - let regURL = urlComponents?.url | ||
| 112 | - let webVC = CNWebViewController() | ||
| 113 | - webVC.url = regURL | ||
| 114 | - controller.navigationController?.pushViewController(webVC, animated: true) | ||
| 115 | - }else if (albumModel.model == kCNDownSlideContentsModelModelAlbum_ugc){ | ||
| 116 | - //短剧-跳转短剧播放页 | ||
| 117 | - navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: albumModel.contentId), animated: pushAnimated) | ||
| 118 | - | ||
| 119 | - }else if albumModel.model == kCNDownSlideContentsModelModelServing{ | ||
| 120 | - //跳转微信小程序 | ||
| 121 | - if let data = (albumModel.s_to ?? "").data(using: .utf8) { | ||
| 122 | - do { | ||
| 123 | - let jsonResult = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] | ||
| 124 | - let miniAppId = jsonResult!["id"] as! String | ||
| 125 | - let miniPath = jsonResult!["path"] as! String | ||
| 126 | - CNLiveShareImageManager.pushWeChatMiniProgrem(withMiniAppId: miniAppId, path: miniPath, extMsg: "", extDic: [:]) | ||
| 127 | - | ||
| 128 | - } catch { | ||
| 129 | - print("JSON 解析错误") | ||
| 130 | - } | ||
| 131 | - } else { | ||
| 132 | - print("无法将字符串转换为数据") | ||
| 133 | - } | ||
| 134 | - }else{ | ||
| 135 | - return | ||
| 136 | - } | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - class func detailPushWebVCWithContentsMdl(contentMdl:CNLiveDownSlideContentsModel,viewController:UIViewController){ | ||
| 140 | - | ||
| 141 | - if (contentMdl.model == kCNDownSlideContentsModelModel1) || (contentMdl.model == kCNDownSlideContentsModelModel2){ | ||
| 142 | - | ||
| 143 | - let queryItem = URLQueryItem(name: "contentId", value: contentMdl.contentId) | ||
| 144 | - let queryItem1 = URLQueryItem(name: "videoId", value: contentMdl.pid) | ||
| 145 | - let urlComponents = NSURLComponents(string: (contentMdl.shareUrl))! | ||
| 146 | - urlComponents.queryItems = [queryItem, queryItem1] | ||
| 147 | - let regURL = urlComponents.url | ||
| 148 | - let webVC = CNWebViewController() | ||
| 149 | - webVC.url = regURL | ||
| 150 | - viewController.navigationController?.pushViewController(webVC, animated: true) | ||
| 151 | - | ||
| 152 | - }else if (contentMdl.model == kCNDownSlideContentsModelModel3) || (contentMdl.model == kCNDownSlideContentsModelModel4){ | ||
| 153 | - let webVC = CNWebViewController() | ||
| 154 | - webVC.url = URL(string: (contentMdl.thirdUrl)) | ||
| 155 | - viewController.navigationController?.pushViewController(webVC, animated: true) | ||
| 156 | - }else if (contentMdl.model == kCNDownSlideContentsModelModelAlbum){ | ||
| 157 | - | ||
| 158 | - let urlString = "http://wjjh5.cnlive.com/cnYmAlbumVideoList.html" | ||
| 159 | - let queryItem = URLQueryItem(name: "aid", value: contentMdl.contentId) | ||
| 160 | - let queryItem1 = URLQueryItem(name: "title", value: contentMdl.title) | ||
| 161 | - let urlComponents = NSURLComponents(string: urlString) | ||
| 162 | - urlComponents!.queryItems = [queryItem, queryItem1] | ||
| 163 | - let regURL = urlComponents?.url | ||
| 164 | - let webVC = CNWebViewController() | ||
| 165 | - webVC.url = regURL | ||
| 166 | - viewController.navigationController?.pushViewController(webVC, animated: true) | ||
| 167 | - }else if (contentMdl.model == kCNDownSlideContentsModelModelAlbum_video){ | ||
| 168 | - let urlString = "http://wjjh5.cnlive.com/cnYjzgAlbumVideo.html" | ||
| 169 | - let queryItem = URLQueryItem(name: "aid", value: contentMdl.contentId) | ||
| 170 | - let queryItem1 = URLQueryItem(name: "title", value: contentMdl.title) | ||
| 171 | - let queryItem2 = URLQueryItem(name: "channelName", value: "yjzg") | ||
| 172 | - let queryItem3 = URLQueryItem(name: "isShowTitle", value: "true") | ||
| 173 | - let queryItem4 = URLQueryItem(name: "isWjjReport", value: "true") | ||
| 174 | - let urlComponents = NSURLComponents(string: urlString) | ||
| 175 | - urlComponents!.queryItems = [queryItem, queryItem1,queryItem2,queryItem3,queryItem4] | ||
| 176 | - let regURL = urlComponents?.url | ||
| 177 | - let webVC = CNWebViewController() | ||
| 178 | - webVC.url = regURL | ||
| 179 | - viewController.navigationController?.pushViewController(webVC, animated: true) | ||
| 180 | - }else if (contentMdl.model == kCNDownSlideContentsModelModelAlbum_ugc){ | ||
| 181 | - //短剧-跳转短剧播放页 | ||
| 182 | - navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: contentMdl.contentId), animated: pushAnimated) | ||
| 183 | - }else if contentMdl.model == kCNDownSlideContentsModelModelServing{ | ||
| 184 | - //跳转微信小程序 | ||
| 185 | - if let data = (contentMdl.s_to ?? "").data(using: .utf8) { | ||
| 186 | - do { | ||
| 187 | - let jsonResult = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] | ||
| 188 | - let miniAppId = jsonResult!["id"] as! String | ||
| 189 | - let miniPath = jsonResult!["path"] as! String | ||
| 190 | - CNLiveShareImageManager.pushWeChatMiniProgrem(withMiniAppId: miniAppId, path: miniPath, extMsg: "", extDic: [:]) | ||
| 191 | - | ||
| 192 | - } catch { | ||
| 193 | - print("JSON 解析错误") | ||
| 194 | - } | ||
| 195 | - } else { | ||
| 196 | - print("无法将字符串转换为数据") | ||
| 197 | - } | ||
| 198 | - }else{ | ||
| 199 | - return | ||
| 200 | - } | ||
| 201 | - } | ||
| 202 | } | 107 | } |