Commit 07f2d4d1a19473edd23a1b9cfa800e1da9ca0b9f

Authored by “张旭”
1 parent d7630ab6

幼教中国我的课程 , webView视频没有关闭问题

metaCode/Classes/Main/HomePage/Controller/DownSlideController/CNUpSlideDetailViewController.swift
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 // metaCode 3 // metaCode
4 // 4 //
5 // Created by zx on 2023/10/16. 5 // Created by zx on 2023/10/16.
6 -// 认证-下滑页原生页--课程 大图课程详情页/全部课程详情页 6 +// 认证-下滑页原生页-课程 大图课程详情页/全部课程详情页/我的课程详情页
7 // 首页原生页--短剧 大图详情页 7 // 首页原生页--短剧 大图详情页
8 8
9 import Foundation 9 import Foundation
@@ -18,6 +18,8 @@ enum CNLiveHomePageCellType { @@ -18,6 +18,8 @@ enum CNLiveHomePageCellType {
18 case playlet 18 case playlet
19 ///短剧控制器->课程 19 ///短剧控制器->课程
20 case playletToCourse 20 case playletToCourse
  21 + ///课程控制器->我的课程
  22 + case courseToMyCurriculum
21 } 23 }
22 24
23 let allCourseCellHeight:CGFloat = 75 25 let allCourseCellHeight:CGFloat = 75
@@ -31,7 +33,17 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou @@ -31,7 +33,17 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou
31 _slideModel 33 _slideModel
32 } 34 }
33 set{ 35 set{
34 - _slideModel = newValue! 36 + _slideModel = newValue
  37 + }
  38 + }
  39 + //albumModel
  40 + var _albumModel : CNLiveAlbumBaseModel?
  41 + var albumModel : CNLiveAlbumBaseModel? {
  42 + get{
  43 + _albumModel
  44 + }
  45 + set{
  46 + _albumModel = newValue
35 } 47 }
36 } 48 }
37 49
@@ -71,16 +83,21 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou @@ -71,16 +83,21 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou
71 return btn 83 return btn
72 }() 84 }()
73 85
74 - init(cell: CNDownSlideSingleCourseCell,slideModel:CNLiveDownSlideModel,cellType:CNLiveHomePageCellType) { 86 + init(cell: CNDownSlideSingleCourseCell,slideModel:CNLiveDownSlideModel?,albumModel:CNLiveAlbumBaseModel?,cellType:CNLiveHomePageCellType) {
75 self.cellType = cellType 87 self.cellType = cellType
76 self.pageNum = 1 88 self.pageNum = 1
77 self.cell = cell 89 self.cell = cell
78 super.init(nibName: nil, bundle: nil) 90 super.init(nibName: nil, bundle: nil)
79 self.slideModel = slideModel 91 self.slideModel = slideModel
  92 + self.albumModel = albumModel
80 self.setupTranstion() 93 self.setupTranstion()
81 setNeedsStatusBarAppearanceUpdate() 94 setNeedsStatusBarAppearanceUpdate()
82 } 95 }
83 96
  97 + deinit {
  98 + print("CNUPSlideDetailViewController-deinit")
  99 + }
  100 +
84 private func setupTranstion() { 101 private func setupTranstion() {
85 modalPresentationStyle = .custom 102 modalPresentationStyle = .custom
86 transitioningDelegate = self 103 transitioningDelegate = self
@@ -93,7 +110,11 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou @@ -93,7 +110,11 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou
93 override func viewDidLoad() { 110 override func viewDidLoad() {
94 super.viewDidLoad() 111 super.viewDidLoad()
95 setupUI() 112 setupUI()
96 - self.getBlockContents(page: 1) 113 + if self.cellType == .courseToMyCurriculum{
  114 + self.getYjzgMyCurriculum(page: 1)
  115 + }else{
  116 + self.getBlockContents(page: 1)
  117 + }
97 } 118 }
98 119
99 private func setupUI() { 120 private func setupUI() {
@@ -219,30 +240,41 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou @@ -219,30 +240,41 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou
219 cell.iconImgView.image = self.cell.bgImageView.image 240 cell.iconImgView.image = self.cell.bgImageView.image
220 cell.titleLabel.text = self.cell.slideModel?.contents[0].title ?? "" 241 cell.titleLabel.text = self.cell.slideModel?.contents[0].title ?? ""
221 return cell 242 return cell
222 - }else if self.cellType == .course || self.cellType == .playletToCourse{  
223 -  
224 - if self.slideModel?.type == SlideModelTypeAllCourse12{  
225 - //全部课程 243 + }else if self.cellType == .course || self.cellType == .playletToCourse || self.cellType == .courseToMyCurriculum{
  244 + if self.cellType == .courseToMyCurriculum{
  245 + //我的课程
226 guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveCourseTitleCellIdentifier) as? CNLiveDuanjuTitleCell 246 guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveCourseTitleCellIdentifier) as? CNLiveDuanjuTitleCell
227 else { 247 else {
228 let cell = CNLiveDuanjuTitleCell() 248 let cell = CNLiveDuanjuTitleCell()
229 return cell 249 return cell
230 } 250 }
231 - cell.cellType = .course  
232 - cell.blockName = self.slideModel?.blockName 251 + cell.cellType = .courseToMyCurriculum
  252 + cell.blockName = "我的课程"
233 return cell 253 return cell
234 -  
235 - }else if self.slideModel?.type == SlideModelTypeOneCourse75{  
236 - //大图课程  
237 - guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveAlbumImageCellIdentifier) as? CNLiveAlbumImageCell  
238 - else {  
239 - let cell = CNLiveAlbumImageCell() 254 + }else{
  255 + if self.slideModel?.type == SlideModelTypeAllCourse12{
  256 + //全部课程
  257 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveCourseTitleCellIdentifier) as? CNLiveDuanjuTitleCell
  258 + else {
  259 + let cell = CNLiveDuanjuTitleCell()
  260 + return cell
  261 + }
  262 + cell.cellType = .course
  263 + cell.blockName = self.slideModel?.blockName
240 return cell 264 return cell
  265 +
  266 + }else if self.slideModel?.type == SlideModelTypeOneCourse75{
  267 + //大图课程
  268 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveAlbumImageCellIdentifier) as? CNLiveAlbumImageCell
  269 + else {
  270 + let cell = CNLiveAlbumImageCell()
  271 + return cell
  272 + }
  273 + cell.iconImgView.image = self.cell.bgImageView.image
  274 + cell.titleLabel.text = self.cell.slideModel?.contents[0].title ?? ""
  275 + return cell
  276 +
241 } 277 }
242 - cell.iconImgView.image = self.cell.bgImageView.image  
243 - cell.titleLabel.text = self.cell.slideModel?.contents[0].title ?? ""  
244 - return cell  
245 -  
246 } 278 }
247 } 279 }
248 280
@@ -304,6 +336,43 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou @@ -304,6 +336,43 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou
304 } 336 }
305 } 337 }
306 338
  339 + // MARK: - 我的课程 -- 获取全部课程列表
  340 + func getYjzgMyCurriculum(page:NSInteger){
  341 + showLoading(message: "")
  342 + CNLiveDownSlideViewModel.getYjzgMyCurriculum(page: page) {[weak self] result, status in
  343 + hiddenLoading()
  344 + if status == .success{
  345 + let albumBaseModel = result as! CNLiveAlbumBaseModel
  346 + if self!.pageNum > 1 && albumBaseModel.list.count > 0 {
  347 + self!.dataArray.addObjects(from: albumBaseModel.list)
  348 + }
  349 + if self!.pageNum == 1 {
  350 + self!.dataArray.removeAllObjects()
  351 + self!.dataArray.addObjects(from: albumBaseModel.list)
  352 + if self!.dataArray.count > 0 && self!.tableView.mj_header == nil && self!.tableView.mj_footer == nil {
  353 + self!.addRefreshView()
  354 + }
  355 + }
  356 +
  357 + self!.tableView.mj_header?.endRefreshing()
  358 +
  359 + self!.tableView.reloadData()
  360 + if albumBaseModel.hasNextPage{
  361 + self!.tableView.mj_footer?.endRefreshing()
  362 + }else{
  363 + self!.tableView.mj_footer?.endRefreshingWithNoMoreData()
  364 + }
  365 +
  366 + }else if (status == .noNetwork) {
  367 + self!.network_type = .noNetwork
  368 + self!.tableView.reloadEmptyDataSet()
  369 + } else {
  370 + self!.network_type = .failed
  371 + self!.tableView.reloadEmptyDataSet()
  372 + }
  373 + }
  374 + }
  375 +
307 // MARK: - 在追短剧--获取全部专辑列表 376 // MARK: - 在追短剧--获取全部专辑列表
308 func getBlockContents(page:NSInteger){ 377 func getBlockContents(page:NSInteger){
309 showLoading(message: "") 378 showLoading(message: "")
metaCode/Classes/Main/HomePage/Controller/DownSlideController/CNUpSlideViewController.swift
@@ -24,6 +24,9 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa @@ -24,6 +24,9 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
24 let kCNLiveDownSlideTodayRecommendCellIdentifier = "kCNLiveDownSlideTodayRecommendCellIdentifier" 24 let kCNLiveDownSlideTodayRecommendCellIdentifier = "kCNLiveDownSlideTodayRecommendCellIdentifier"
25 let kCNLiveDownSlideSingleCourseCellIdentifier = "kCNLiveDownSlideSingleCourseCellIdentifier" 25 let kCNLiveDownSlideSingleCourseCellIdentifier = "kCNLiveDownSlideSingleCourseCellIdentifier"
26 26
  27 + //我的课程cellID
  28 + let kCNLiveDownSlideMyCurriculumCellIdentifier = "kCNLiveDownSlideMyCurriculumCellIdentifier"
  29 +
27 var totolNum = 0//一共显示多少行cell 30 var totolNum = 0//一共显示多少行cell
28 31
29 var selectedCell: CNDownSlideSingleCourseCell? 32 var selectedCell: CNDownSlideSingleCourseCell?
@@ -46,10 +49,6 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa @@ -46,10 +49,6 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
46 } 49 }
47 set{ 50 set{
48 _idModel = newValue 51 _idModel = newValue
49 - if _idModel?.id == 6{  
50 - //幼教中国,请求我的课程接口  
51 - self.getYjzgMyCurriculumApi()  
52 - }  
53 } 52 }
54 53
55 } 54 }
@@ -71,6 +70,16 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa @@ -71,6 +70,16 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
71 return dataArray 70 return dataArray
72 }() 71 }()
73 72
  73 + // 我的课程 index
  74 + var myCurriculumIndex = -1
  75 + //是否第一个展示'我的课程'
  76 + var isFirstMyCurriculum = false
  77 + ///我的课程数据源
  78 + lazy var myCurriculumDataArray: NSMutableArray = {
  79 + var myCurriculumDataArray = NSMutableArray()
  80 + return myCurriculumDataArray
  81 + }()
  82 +
74 override func viewWillAppear(_ animated: Bool) { 83 override func viewWillAppear(_ animated: Bool) {
75 super.viewWillAppear(animated) 84 super.viewWillAppear(animated)
76 self.updateStatusBarAndTabbarFrame(visible: true) 85 self.updateStatusBarAndTabbarFrame(visible: true)
@@ -111,45 +120,58 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa @@ -111,45 +120,58 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
111 } 120 }
112 121
113 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 122 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
114 -  
115 - let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel  
116 123
117 - //type=4一排两个 推荐课程&推荐活动; 74今日推荐; 12列表全部课程; 75单课程大图  
118 - if slideModel.type == SlideModelTypeRecommend4{  
119 - guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideRecommendCellIdentifier) as? CNLiveDownSlideRecommendCell 124 + if indexPath.row == self.myCurriculumIndex{
  125 + //我的课程cell
  126 + let myCurriculumModel = self.dataArray[indexPath.row] as! CNLiveAlbumBaseModel
  127 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideAllCourseCellIdentifier) as? CNDownSlideSingleCourseCell
120 else { 128 else {
121 - return CNLiveDownSlideRecommendCell() 129 + let cell = CNDownSlideSingleCourseCell()
  130 + return cell
122 } 131 }
123 - cell.slideModel = slideModel 132 + cell.myCurriculum = myCurriculumModel
124 return cell 133 return cell
125 - }else if slideModel.type == SlideModelTypeTodayRecommend74{  
126 - guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideTodayRecommendCellIdentifier) as? CNLiveDownSlideTodayRecommendCell  
127 - else {  
128 - let cell = CNLiveDownSlideTodayRecommendCell() 134 + }else{
  135 +
  136 + let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel
  137 +
  138 + //type=4一排两个 推荐课程&推荐活动; 74今日推荐; 12列表全部课程; 75单课程大图
  139 + if slideModel.type == SlideModelTypeRecommend4{
  140 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideRecommendCellIdentifier) as? CNLiveDownSlideRecommendCell
  141 + else {
  142 + return CNLiveDownSlideRecommendCell()
  143 + }
129 cell.slideModel = slideModel 144 cell.slideModel = slideModel
130 return cell 145 return cell
131 - }  
132 - cell.slideModel = slideModel  
133 - return cell  
134 - }else if slideModel.type == SlideModelTypeAllCourse12{  
135 - guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideAllCourseCellIdentifier) as? CNDownSlideSingleCourseCell  
136 - else {  
137 - let cell = CNDownSlideSingleCourseCell() 146 + }else if slideModel.type == SlideModelTypeTodayRecommend74{
  147 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideTodayRecommendCellIdentifier) as? CNLiveDownSlideTodayRecommendCell
  148 + else {
  149 + let cell = CNLiveDownSlideTodayRecommendCell()
  150 + cell.slideModel = slideModel
  151 + return cell
  152 + }
138 cell.slideModel = slideModel 153 cell.slideModel = slideModel
139 return cell 154 return cell
140 - }  
141 - cell.slideModel = slideModel  
142 - return cell  
143 - }else if slideModel.type == SlideModelTypeOneCourse75{  
144 - guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideSingleCourseCellIdentifier) as? CNDownSlideSingleCourseCell  
145 - else {  
146 - let cell = CNDownSlideSingleCourseCell() 155 + }else if slideModel.type == SlideModelTypeAllCourse12{
  156 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideAllCourseCellIdentifier) as? CNDownSlideSingleCourseCell
  157 + else {
  158 + let cell = CNDownSlideSingleCourseCell()
  159 + cell.slideModel = slideModel
  160 + return cell
  161 + }
  162 + cell.slideModel = slideModel
  163 + return cell
  164 + }else if slideModel.type == SlideModelTypeOneCourse75{
  165 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideSingleCourseCellIdentifier) as? CNDownSlideSingleCourseCell
  166 + else {
  167 + let cell = CNDownSlideSingleCourseCell()
  168 + return cell
  169 + }
  170 + cell.slideModel = slideModel
147 return cell 171 return cell
  172 + }else{
  173 + return UITableViewCell()
148 } 174 }
149 - cell.slideModel = slideModel  
150 - return cell  
151 - }else{  
152 - return UITableViewCell()  
153 } 175 }
154 } 176 }
155 177
@@ -169,54 +191,78 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa @@ -169,54 +191,78 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
169 } 191 }
170 192
171 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 193 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
172 -  
173 - let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel  
174 var cellType:CNLiveHomePageCellType = .course 194 var cellType:CNLiveHomePageCellType = .course
175 - ///model  
176 - ///(1) 1,2时跳转:sharelUrl后面拼接 ?contentId=contentId&videoId=pid  
177 - ///(2) 3,4时跳转:thirdUrl  
178 - ///(3)“album”,“album_video”,“album_ugc” -> http://wjjh5.cnlive.com/cnYmAlbumVideoList.html?aid=contentId&title=titlle  
179 - if slideModel.contents.first?.model ?? "0" == "1" || slideModel.contents.first?.model ?? "0" == "2" || slideModel.contents.first?.model ?? "0" == "3" || slideModel.contents.first?.model ?? "0" == "4"{  
180 - cellType = .course  
181 - }else if slideModel.contents.first?.model ?? "0" == kCNDownSlideContentsModelModelAlbum_ugc{  
182 - cellType = .playlet  
183 - }else{  
184 - //新类型  
185 - }  
186 -  
187 - //type=4一排两个 推荐课程&推荐活动; 74今日推荐; 12列表全部课程; 75单课程大图  
188 - if slideModel.type == SlideModelTypeRecommend4{  
189 -  
190 - }else if slideModel.type == SlideModelTypeTodayRecommend74{  
191 -  
192 - }else if slideModel.type == SlideModelTypeAllCourse12{ 195 +
  196 + if indexPath.row == self.myCurriculumIndex{
  197 + //我的课程cell
  198 + let myCurriculumModel = self.dataArray[indexPath.row] as! CNLiveAlbumBaseModel
  199 + cellType = .courseToMyCurriculum
193 guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return } 200 guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return }
194 selectedCell = cell 201 selectedCell = cell
195 - let detailVC = CNSlideBaseNavigationController(rootViewController: CNUpSlideDetailViewController(cell: cell,slideModel: slideModel, cellType: cellType), cellType: cellType) 202 + let detailVC = CNSlideBaseNavigationController(rootViewController: CNUpSlideDetailViewController(cell: cell,slideModel: nil, albumModel: myCurriculumModel, cellType: cellType), cellType: cellType)
196 detailVC.dismissClosure = { [weak self] in 203 detailVC.dismissClosure = { [weak self] in
197 guard let StrongSelf = self else { return } 204 guard let StrongSelf = self else { return }
198 StrongSelf.updateStatusBarAndTabbarFrame(visible: true) 205 StrongSelf.updateStatusBarAndTabbarFrame(visible: true)
199 } 206 }
200 updateStatusBarAndTabbarFrame(visible: false) 207 updateStatusBarAndTabbarFrame(visible: false)
201 present(detailVC, animated: true, completion: nil) 208 present(detailVC, animated: true, completion: nil)
202 - }else if slideModel.type == SlideModelTypeOneCourse75{  
203 - guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return }  
204 - selectedCell = cell  
205 -  
206 - let detailVC = CNSlideBaseNavigationController(rootViewController: CNUpSlideDetailViewController(cell: cell,slideModel: slideModel, cellType: cellType), cellType: cellType)  
207 -  
208 - detailVC.dismissClosure = { [weak self] in  
209 - guard let StrongSelf = self else { return }  
210 - StrongSelf.updateStatusBarAndTabbarFrame(visible: true) 209 + }else{
  210 + let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel
  211 + ///model
  212 + ///(1) 1,2时跳转:sharelUrl后面拼接 ?contentId=contentId&videoId=pid
  213 + ///(2) 3,4时跳转:thirdUrl
  214 + ///(3)“album”,“album_video”,“album_ugc” -> http://wjjh5.cnlive.com/cnYmAlbumVideoList.html?aid=contentId&title=titlle
  215 + if slideModel.contents.first?.model ?? "0" == kCNDownSlideContentsModelModel1 || slideModel.contents.first?.model ?? "0" == kCNDownSlideContentsModelModel2 || slideModel.contents.first?.model ?? "0" == kCNDownSlideContentsModelModel3 || slideModel.contents.first?.model ?? "0" == kCNDownSlideContentsModelModel4{
  216 + cellType = .course
  217 + }else if slideModel.contents.first?.model ?? "0" == kCNDownSlideContentsModelModelAlbum_ugc{
  218 + cellType = .playlet
  219 + }else{
  220 + //新类型
  221 + }
  222 + //type=4一排两个 推荐课程&推荐活动; 74今日推荐; 12列表全部课程; 75单课程大图
  223 + if slideModel.type == SlideModelTypeAllCourse12{
  224 + guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return }
  225 + selectedCell = cell
  226 + let detailVC = CNSlideBaseNavigationController(rootViewController: CNUpSlideDetailViewController(cell: cell,slideModel: slideModel, albumModel: nil, cellType: cellType), cellType: cellType)
  227 + detailVC.dismissClosure = { [weak self] in
  228 + guard let StrongSelf = self else { return }
  229 + StrongSelf.updateStatusBarAndTabbarFrame(visible: true)
  230 + }
  231 + updateStatusBarAndTabbarFrame(visible: false)
  232 + present(detailVC, animated: true, completion: nil)
  233 + }else if slideModel.type == SlideModelTypeOneCourse75{
  234 + guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return }
  235 + selectedCell = cell
  236 +
  237 + let detailVC = CNSlideBaseNavigationController(rootViewController: CNUpSlideDetailViewController(cell: cell,slideModel: slideModel, albumModel: nil, cellType: cellType), cellType: cellType)
  238 +
  239 + detailVC.dismissClosure = { [weak self] in
  240 + guard let StrongSelf = self else { return }
  241 + StrongSelf.updateStatusBarAndTabbarFrame(visible: true)
  242 + }
  243 + updateStatusBarAndTabbarFrame(visible: false)
  244 + present(detailVC, animated: true, completion: nil)
211 } 245 }
212 - updateStatusBarAndTabbarFrame(visible: false)  
213 - present(detailVC, animated: true, completion: nil)  
214 } 246 }
  247 +
215 } 248 }
216 249
217 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 250 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
218 - let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel  
219 - return CGFloat(slideModel.cellH) 251 + if indexPath.row == self.myCurriculumIndex{
  252 + let myCurriculumModel = self.dataArray[indexPath.row] as! CNLiveAlbumBaseModel
  253 + let contentsNum = myCurriculumModel.list.count
  254 + //总显示块数/循环数
  255 + let totalNum = (contentsNum >= 4) ? 4 : contentsNum
  256 + let cellH = DownSlideAllCourseTitleH + DownSlideAllCourseRowH * CGFloat(totalNum)+DownSlideRecommendLeftGap
  257 + return cellH
  258 + }else{
  259 + if self.dataArray[indexPath.row] is CNLiveDownSlideModel{
  260 + let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel
  261 + return CGFloat(slideModel.cellH)
  262 + }else{
  263 + return 50
  264 + }
  265 + }
220 } 266 }
221 267
222 func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { 268 func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
@@ -233,6 +279,7 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa @@ -233,6 +279,7 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
233 hiddenLoading() 279 hiddenLoading()
234 280
235 if status == .success{ 281 if status == .success{
  282 +
236 self.dataArray.removeAllObjects() 283 self.dataArray.removeAllObjects()
237 let array = result as! [Any] 284 let array = result as! [Any]
238 let newDataArray = NSMutableArray() 285 let newDataArray = NSMutableArray()
@@ -244,8 +291,19 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa @@ -244,8 +291,19 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
244 } 291 }
245 } 292 }
246 self.dataArray.addObjects(from: newDataArray as! [Any]) 293 self.dataArray.addObjects(from: newDataArray as! [Any])
  294 + if self.idModel?.id == 16{//后面改成6
  295 + //幼教中国,请求我的课程接口
  296 + self.getYjzgMyCurriculumApi()
  297 + let firMdl = self.dataArray.firstObject as! CNLiveDownSlideModel
  298 + if firMdl.type == SlideModelTypeTodayRecommend74{
  299 + self.isFirstMyCurriculum = false
  300 + }else{
  301 + self.isFirstMyCurriculum = true
  302 + }
  303 + }else{
  304 + self.tableView.reloadData()
  305 + }
247 306
248 - self.tableView.reloadData()  
249 }else if (status == .failed){ 307 }else if (status == .failed){
250 // self.NetApiStatus = .apiError 308 // self.NetApiStatus = .apiError
251 }else if (status == .noNetwork){ 309 }else if (status == .noNetwork){
@@ -262,8 +320,25 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa @@ -262,8 +320,25 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
262 CNLiveDownSlideViewModel.getYjzgMyCurriculum(page: 1) { result, status in 320 CNLiveDownSlideViewModel.getYjzgMyCurriculum(page: 1) { result, status in
263 hiddenLoading() 321 hiddenLoading()
264 if status == .success{ 322 if status == .success{
  323 + self.myCurriculumDataArray.removeAllObjects()
265 let albumBaseModel = result as! CNLiveAlbumBaseModel 324 let albumBaseModel = result as! CNLiveAlbumBaseModel
266 - 325 + self.myCurriculumDataArray.addObjects(from: [albumBaseModel])
  326 + self.myCurriculumIndex = -1
  327 + if self.myCurriculumDataArray.count>0{
  328 + //有我的课程
  329 + if self.isFirstMyCurriculum{
  330 + //第一个区块显示
  331 + self.myCurriculumIndex = 0
  332 + }else{
  333 + //第二个区块显示
  334 + self.myCurriculumIndex = 1
  335 + }
  336 + }else{
  337 + //没有我的课程
  338 + self.myCurriculumIndex = -1
  339 + }
  340 + self.dataArray.insert(albumBaseModel, at: self.myCurriculumIndex)
  341 + self.tableView.reloadData()
267 }else if (status == .failed){ 342 }else if (status == .failed){
268 // self.NetApiStatus = .apiError 343 // self.NetApiStatus = .apiError
269 }else if (status == .noNetwork){ 344 }else if (status == .noNetwork){
metaCode/Classes/Main/HomePage/Controller/WebController/CNWebViewController.swift
@@ -58,19 +58,32 @@ class CNWebViewController:CNLiveBaseViewController ,WKNavigationDelegate{ @@ -58,19 +58,32 @@ class CNWebViewController:CNLiveBaseViewController ,WKNavigationDelegate{
58 } 58 }
59 } 59 }
60 60
  61 + deinit {
  62 + self.webView.cnWebView.stopLoading()
  63 + self.webView.cnWebView.navigationDelegate = nil
  64 + self.webView.cnWebView.uiDelegate = nil
  65 + print("WKWebView dealloc")
  66 + }
  67 +
  68 + override func viewDidDisappear(_ animated: Bool) {
  69 + super.viewDidDisappear(animated)
  70 + self.h5StopVideoPlayer()
  71 + }
  72 +
  73 +
61 override func viewDidLoad() { 74 override func viewDidLoad() {
62 super.viewDidLoad() 75 super.viewDidLoad()
63 navigationBarHidden = false 76 navigationBarHidden = false
64 self.view.addSubview(self.webView) 77 self.view.addSubview(self.webView)
65 - self.webView.webControllerUpdateNavBlock = { isFinish , title,isDecidePolicy ,urlStr in 78 + self.webView.webControllerUpdateNavBlock = { [weak self] isFinish , title,isDecidePolicy ,urlStr in
66 if isFinish{ 79 if isFinish{
67 - self.titleName = title 80 + self!.titleName = title
68 }else if isDecidePolicy{ 81 }else if isDecidePolicy{
69 if urlStr.contains("&isWjjReport=true") || urlStr.contains("?isWjjReport=true"){ 82 if urlStr.contains("&isWjjReport=true") || urlStr.contains("?isWjjReport=true"){
70 - self.rightNavBtns = [self.moreNavBtn]  
71 - self.moreNavBtn.isHidden = false 83 + self!.rightNavBtns = [self!.moreNavBtn]
  84 + self!.moreNavBtn.isHidden = false
72 }else{ 85 }else{
73 - self.moreNavBtn.isHidden = true 86 + self!.moreNavBtn.isHidden = true
74 } 87 }
75 } 88 }
76 } 89 }
@@ -80,6 +93,14 @@ class CNWebViewController:CNLiveBaseViewController ,WKNavigationDelegate{ @@ -80,6 +93,14 @@ class CNWebViewController:CNLiveBaseViewController ,WKNavigationDelegate{
80 } 93 }
81 } 94 }
82 95
  96 + func h5StopVideoPlayer(){
  97 + // call h5停止播放视频
  98 + let data = ["stop": true]
  99 + self.bridge?.callHandler("wjjStopVideoPlayer", data: data, responseCallback: { responseData in
  100 + print("\(responseData ?? "")")
  101 + })
  102 + }
  103 +
83 //点击...分享获取h5参数oc call js 104 //点击...分享获取h5参数oc call js
84 func configBridgeCallHander() -> Void { 105 func configBridgeCallHander() -> Void {
85 self.webView.bridge?.callHandler("wjjClientGetShareParaFromJS", data: ["":""], responseCallback: { data in 106 self.webView.bridge?.callHandler("wjjClientGetShareParaFromJS", data: ["":""], responseCallback: { data in
metaCode/Classes/Main/HomePage/View/VerticalViews/DownSlide/CNDownSlideSingleCourseCell.swift
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 // metaCode 3 // metaCode
4 // 4 //
5 // Created by zx on 2023/10/16. 5 // Created by zx on 2023/10/16.
6 -// 单课程大图专辑 | 全部课程列表 6 +// 单课程大图专辑 | 全部课程列表 | 我的课程列表
7 7
8 8
9 import Foundation 9 import Foundation
@@ -64,6 +64,18 @@ class CNDownSlideSingleCourseCell: UITableViewCell { @@ -64,6 +64,18 @@ class CNDownSlideSingleCourseCell: UITableViewCell {
64 } 64 }
65 } 65 }
66 66
  67 + //myCurriculum
  68 + var _myCurriculum : CNLiveAlbumBaseModel?
  69 + var myCurriculum : CNLiveAlbumBaseModel? {
  70 + get{
  71 + _myCurriculum
  72 + }
  73 + set{
  74 + _myCurriculum = newValue!
  75 + self.setupMyCurriculumUI(model: _myCurriculum!)
  76 + }
  77 + }
  78 +
67 override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 79 override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
68 super.init(style: style, reuseIdentifier: reuseIdentifier) 80 super.init(style: style, reuseIdentifier: reuseIdentifier)
69 self.selectionStyle = .none 81 self.selectionStyle = .none
@@ -229,10 +241,90 @@ class CNDownSlideSingleCourseCell: UITableViewCell { @@ -229,10 +241,90 @@ class CNDownSlideSingleCourseCell: UITableViewCell {
229 } 241 }
230 } 242 }
231 243
  244 + func setupMyCurriculumUI(model:CNLiveAlbumBaseModel){
  245 + contentView.subviews.forEach { view in
  246 + view.removeFromSuperview()
  247 + }
  248 + bgBackView.subviews.forEach { view in
  249 + view.removeFromSuperview()
  250 + }
  251 + bgImageView.subviews.forEach { view in
  252 + view.removeFromSuperview()
  253 + }
  254 + //全部课程列表
  255 + contentView.addSubview(bgBackView)
  256 +
  257 + let contentsNum = model.list.count
  258 + //总显示块数/循环数
  259 + var totalNum = (contentsNum >= 4) ? 4 : contentsNum
  260 + var cellH = DownSlideAllCourseTitleH + DownSlideAllCourseRowH * CGFloat(totalNum)+DownSlideRecommendLeftGap
  261 +
  262 + bgBackView.frame = CGRect(x: DownSlideRecommendLeftGap, y: 0,width:DownSlideSingleCourseW , height:cellH-DownSlideRecommendLeftGap)
  263 + // 设置阴影效果
  264 + bgBackView.layer.masksToBounds = false
  265 + //定义view的阴影颜色
  266 + bgBackView.layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.1).cgColor
  267 + //定义view的阴影透明度,注意:如果view没有设置背景色阴影也是不会显示的
  268 + bgBackView.layer.shadowOpacity = 1
  269 + //定义view的阴影宽度,模糊计算的半径
  270 + bgBackView.layer.shadowRadius = 10.0
  271 + //阴影偏移量
  272 + bgBackView.layer.shadowOffset = CGSize(width: 0, height: 0)
  273 + bgBackView.layer.cornerRadius = 12
  274 + bgBackView.backgroundColor = .white
  275 +
  276 + var titleTop:CGFloat = DownSlideRecommendLeftGap
  277 + let titleLbl = UILabel(frame: CGRect(x: DownSlideRecommendLeftGap, y: titleTop, width: DownSlideSingleCourseW-DownSlideRecommendLeftGap*2, height: 30))
  278 + titleLbl.text = "我的课程"
  279 + titleLbl.font = BoldFont_21
  280 + titleLbl.textColor = HexColor("#333333")
  281 + bgBackView.addSubview(titleLbl)
  282 +
  283 + for i in 0..<totalNum{//i是第几行
  284 + let contentMdl = model.list[i]
  285 +
  286 + //小icon
  287 + let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap, titleLbl.bottom+DownSlideRecommendLeftGap+CGFloat(i)*(DownSlideAllCourseRowTopYGap+DownSlideAllCourseRowImageWH+DownSlideAllCourseRowBottomYGap), CGFloat(DownSlideAllCourseRowImageWH), CGFloat(DownSlideAllCourseRowImageWH)))
  288 + imageView.kf.setImage(with: URL(string:contentMdl.poster ))
  289 + imageView.layer.cornerRadius = 12
  290 + imageView.clipsToBounds = true
  291 + imageView.contentMode = .scaleAspectFill
  292 + bgBackView.addSubview(imageView)
  293 +
  294 + let titleLbl = UILabel(frame: CGRect(x: imageView.right+DownSlideRecommendLeftGap, y: imageView.top, width: DownSlideSingleCourseW-90-imageView.right, height: 21))
  295 + titleLbl.text = contentMdl.title
  296 + titleLbl.font = Font_15
  297 + titleLbl.textColor = HexColor("#333333")
  298 + bgBackView.addSubview(titleLbl)
  299 +
  300 + let subTitleLbl = UILabel(frame: CGRect(x: titleLbl.left, y:titleLbl.bottom+3 , width: titleLbl.width, height: 17))
  301 + subTitleLbl.text = contentMdl.subTitle
  302 + subTitleLbl.font = Font_12
  303 + subTitleLbl.textColor = HexColor("#999999")
  304 + bgBackView.addSubview(subTitleLbl)
  305 +
  306 + let enterBtn = UIButton(type: .custom)
  307 + enterBtn.frame = CGRect(x: bgBackView.right-25-65, y: 0, width: 65, height: 30)
  308 + enterBtn.centerY = imageView.centerY
  309 + enterBtn.setBackgroundImage(UIImage(named: "homepage_down_enter"), for: .normal)
  310 + enterBtn.setTitle("进入", for: .normal)
  311 + enterBtn.titleLabel?.font = BoldFont_13
  312 + enterBtn.setTitleColor(HexColor("#FFFFFF"), for: .normal)
  313 + enterBtn.addTarget(self, action: #selector(enterBtnAction(_:)), for: .touchUpInside)
  314 + enterBtn.tag = i
  315 + bgBackView.addSubview(enterBtn)
  316 + }
  317 + }
232 //MARK: - 事件 318 //MARK: - 事件
233 @objc func enterBtnAction(_ sender: UIButton){ 319 @objc func enterBtnAction(_ sender: UIButton){
234 let tag = sender.tag 320 let tag = sender.tag
235 - let contentMdl = self.slideModel?.contents[tag]  
236 - CNLiveDownSlideTool.pushWebVCWithContentsMdl(contentMdl: contentMdl!) 321 + if self.myCurriculum?.list.count ?? 0 > 0{
  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 +
  325 + }else if self.slideModel?.contents.count ?? 0 > 0{
  326 + 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 ?? "")
  328 + }
237 } 329 }
238 } 330 }
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(contentMdl: contentMdl) 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 ?? "")
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(contentMdl: contentMdl!) 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 ?? "")
70 } 70 }
71 } 71 }
metaCode/Classes/Main/HomePages/Controller/HomeController/CNLiveAuthViewController.swift
@@ -235,7 +235,7 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa @@ -235,7 +235,7 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa
235 guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return } 235 guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return }
236 selectedCell = cell 236 selectedCell = cell
237 237
238 - let detailVC = CNSlideBaseNavigationController(rootViewController: CNUpSlideDetailViewController(cell: cell,slideModel: slideModel, cellType: cellType), cellType: cellType) 238 + let detailVC = CNSlideBaseNavigationController(rootViewController: CNUpSlideDetailViewController(cell: cell,slideModel: slideModel, albumModel: nil, cellType: cellType), cellType: cellType)
239 detailVC.dismissClosure = { [weak self] in 239 detailVC.dismissClosure = { [weak self] in
240 guard let StrongSelf = self else { return } 240 guard let StrongSelf = self else { return }
241 StrongSelf.updateStatusBarAndTabbarFrame(visible: true) 241 StrongSelf.updateStatusBarAndTabbarFrame(visible: true)
@@ -246,7 +246,7 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa @@ -246,7 +246,7 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa
246 }else if slideModel.type == SlideModelTypeOneCourse75{ 246 }else if slideModel.type == SlideModelTypeOneCourse75{
247 guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return } 247 guard let cell = tableView.cellForRow(at: indexPath) as? CNDownSlideSingleCourseCell else { return }
248 selectedCell = cell 248 selectedCell = cell
249 - let detailViewC = CNUpSlideDetailViewController(cell: cell,slideModel: slideModel, cellType: cellType) 249 + let detailViewC = CNUpSlideDetailViewController(cell: cell,slideModel: slideModel, albumModel: nil, cellType: cellType)
250 let detailVC = CNSlideBaseNavigationController(rootViewController: detailViewC, cellType: cellType) 250 let detailVC = CNSlideBaseNavigationController(rootViewController: detailViewC, cellType: cellType)
251 251
252 detailVC.dismissClosure = { [weak self] in 252 detailVC.dismissClosure = { [weak self] in
metaCode/Classes/Main/HomePages/Model/CNLiveAlbumModel.swift
@@ -36,7 +36,7 @@ class CNLiveAlbumModel:BaseModel{ @@ -36,7 +36,7 @@ class CNLiveAlbumModel:BaseModel{
36 var contentId = "" 36 var contentId = ""
37 var pid = "" 37 var pid = ""
38 var tag = "" 38 var tag = ""
39 - var model = ""//1,2,3,4课程 album_ugc短剧 39 + var model = ""//1,2,3,4课程 album_ugc短剧 ,album_video专辑h5
40 var thirdUrl = "" 40 var thirdUrl = ""
41 var publishTime = "" 41 var publishTime = ""
42 var shareUrl = "" 42 var shareUrl = ""
metaCode/Classes/Main/HomePages/View/HomepageDetail/CNLiveAlbumCell.swift
@@ -103,7 +103,7 @@ class CNLiveAlbumCell:UITableViewCell{ @@ -103,7 +103,7 @@ class CNLiveAlbumCell:UITableViewCell{
103 fatalError("init(coder:) has not been implemented") 103 fatalError("init(coder:) has not been implemented")
104 } 104 }
105 func setupNewUI(model:CNLiveAlbumModel){ 105 func setupNewUI(model:CNLiveAlbumModel){
106 - if model.model == "1" || model.model == "2" || model.model == "3" || model.model == "4"{ 106 + if model.model == kCNDownSlideContentsModelModel1 || model.model == kCNDownSlideContentsModelModel2 || model.model == kCNDownSlideContentsModelModel3 || model.model == kCNDownSlideContentsModelModel4{
107 //课程-跳转h5网页 107 //课程-跳转h5网页
108 self.cellType = .course 108 self.cellType = .course
109 self.playBtn.setTitle("进入", for: .normal) 109 self.playBtn.setTitle("进入", for: .normal)
@@ -114,6 +114,11 @@ class CNLiveAlbumCell:UITableViewCell{ @@ -114,6 +114,11 @@ class CNLiveAlbumCell:UITableViewCell{
114 }else if model.model == kCNDownSlideContentsModelModelServing{ 114 }else if model.model == kCNDownSlideContentsModelModelServing{
115 self.cellType = .course 115 self.cellType = .course
116 self.playBtn.setTitle("进入", for: .normal) 116 self.playBtn.setTitle("进入", for: .normal)
  117 + }else if model.model == kCNDownSlideContentsModelModelAlbum_video{
  118 + self.cellType = .courseToMyCurriculum
  119 + self.playBtn.setTitle("进入", for: .normal)
  120 + }else{
  121 +
117 } 122 }
118 self.titleLabl.text = model.title 123 self.titleLabl.text = model.title
119 self.subTitleLabel.text = model.subTitle 124 self.subTitleLabel.text = model.subTitle
@@ -147,12 +152,17 @@ class CNLiveAlbumCell:UITableViewCell{ @@ -147,12 +152,17 @@ class CNLiveAlbumCell:UITableViewCell{
147 aid = "" 152 aid = ""
148 } 153 }
149 if (self.albumModel != nil){ 154 if (self.albumModel != nil){
150 - if (self.albumModel?.model == "1" || self.albumModel?.model == "2" || self.albumModel?.model == "3" || self.albumModel?.model == "4"){ 155 + if (self.albumModel?.model == kCNDownSlideContentsModelModel1 || self.albumModel?.model == kCNDownSlideContentsModelModel2 || self.albumModel?.model == kCNDownSlideContentsModelModel3 || self.albumModel?.model == kCNDownSlideContentsModelModel4){
151 //课程-跳转h5网页 156 //课程-跳转h5网页
152 self.enterBlock!(self.albumModel!) 157 self.enterBlock!(self.albumModel!)
153 }else if self.albumModel?.model == kCNDownSlideContentsModelModelAlbum_ugc{ 158 }else if self.albumModel?.model == kCNDownSlideContentsModelModelAlbum_ugc{
154 //短剧-跳转短剧播放页 159 //短剧-跳转短剧播放页
155 navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: aid), animated: pushAnimated) 160 navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: aid), animated: pushAnimated)
  161 + }else if self.albumModel?.model == kCNDownSlideContentsModelModelAlbum_video{
  162 + //课程-跳转h5视频专辑页
  163 + self.enterBlock!(self.albumModel!)
  164 + }else{
  165 +
156 } 166 }
157 }else if (self.albumMsgModel != nil){ 167 }else if (self.albumMsgModel != nil){
158 //短剧-跳转短剧播放页 168 //短剧-跳转短剧播放页
metaCode/Classes/Main/HomePages/View/HomepageDetail/CNLiveDuanjuTitleCell.swift
@@ -16,7 +16,7 @@ class CNLiveDuanjuTitleCell:UITableViewCell{ @@ -16,7 +16,7 @@ class CNLiveDuanjuTitleCell:UITableViewCell{
16 set{ 16 set{
17 _blockName = newValue! 17 _blockName = newValue!
18 18
19 - if self.cellType == .course || self.cellType == .playletToCourse{ 19 + if self.cellType == .course || self.cellType == .playletToCourse || self.cellType == .courseToMyCurriculum{
20 self.blockTitleLabl.text = _blockName ?? "全部课程" 20 self.blockTitleLabl.text = _blockName ?? "全部课程"
21 self.blockTitleLabl.top = (allCourseCellHeight-30)/2+get_system_statusBar_height() 21 self.blockTitleLabl.top = (allCourseCellHeight-30)/2+get_system_statusBar_height()
22 }else if self.cellType == .playlet{ 22 }else if self.cellType == .playlet{
metaCode/Classes/Main/Util/CNLiveDownSlideTool.swift
@@ -9,53 +9,53 @@ import Foundation @@ -9,53 +9,53 @@ import Foundation
9 import CNLiveShareToolKit 9 import CNLiveShareToolKit
10 10
11 class CNLiveDownSlideTool:NSObject{ 11 class CNLiveDownSlideTool:NSObject{
12 - class func pushWebVCWithContentsMdl(contentMdl:CNLiveDownSlideContentsModel){ 12 + class func pushWebVCWithContentsMdl(model:String,contentId:String,pid:String,shareUrl:String,thirdUrl:String,title:String,s_to:String){//contentMdl:CNLiveDownSlideContentsModel
13 13
14 - if (contentMdl.model == kCNDownSlideContentsModelModel1) || (contentMdl.model == kCNDownSlideContentsModelModel2){ 14 + if (model == kCNDownSlideContentsModelModel1) || (model == kCNDownSlideContentsModelModel2){
15 15
16 - let queryItem = URLQueryItem(name: "contentId", value: contentMdl.contentId)  
17 - let queryItem1 = URLQueryItem(name: "videoId", value: contentMdl.pid)  
18 - let urlComponents = NSURLComponents(string: (contentMdl.shareUrl)!)! 16 + let queryItem = URLQueryItem(name: "contentId", value: contentId)
  17 + let queryItem1 = URLQueryItem(name: "videoId", value: pid)
  18 + let urlComponents = NSURLComponents(string: shareUrl)!
19 urlComponents.queryItems = [queryItem, queryItem1] 19 urlComponents.queryItems = [queryItem, queryItem1]
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 navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated)
24 - }else if (contentMdl.model == kCNDownSlideContentsModelModel3) || (contentMdl.model == kCNDownSlideContentsModelModel4){ 24 + }else if (model == kCNDownSlideContentsModelModel3) || (model == kCNDownSlideContentsModelModel4){
25 let webVC = CNWebViewController() 25 let webVC = CNWebViewController()
26 - webVC.url = URL(string: (contentMdl.thirdUrl)!) 26 + webVC.url = URL(string: thirdUrl)
27 navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) 27 navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated)
28 - }else if (contentMdl.model == kCNDownSlideContentsModelModelAlbum){ 28 + }else if (model == kCNDownSlideContentsModelModelAlbum){
29 29
30 let urlString = "http://wjjh5.cnlive.com/cnYmAlbumVideoList.html" 30 let urlString = "http://wjjh5.cnlive.com/cnYmAlbumVideoList.html"
31 - let queryItem = URLQueryItem(name: "aid", value: contentMdl.contentId)  
32 - let queryItem1 = URLQueryItem(name: "title", value: contentMdl.title) 31 + let queryItem = URLQueryItem(name: "aid", value: contentId)
  32 + let queryItem1 = URLQueryItem(name: "title", value: title)
33 let urlComponents = NSURLComponents(string: urlString) 33 let urlComponents = NSURLComponents(string: urlString)
34 urlComponents!.queryItems = [queryItem, queryItem1] 34 urlComponents!.queryItems = [queryItem, queryItem1]
35 let regURL = urlComponents?.url 35 let regURL = urlComponents?.url
36 let webVC = CNWebViewController() 36 let webVC = CNWebViewController()
37 webVC.url = regURL 37 webVC.url = regURL
38 navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) 38 navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated)
39 - }else if (contentMdl.model == kCNDownSlideContentsModelModelAlbum_video){ 39 + }else if (model == kCNDownSlideContentsModelModelAlbum_video){
40 let urlString = "http://wjjh5.cnlive.com/cnYjzgAlbumVideo.html" 40 let urlString = "http://wjjh5.cnlive.com/cnYjzgAlbumVideo.html"
41 - let queryItem = URLQueryItem(name: "aid", value: contentMdl.contentId)  
42 - let queryItem1 = URLQueryItem(name: "title", value: contentMdl.title) 41 + let queryItem = URLQueryItem(name: "aid", value: contentId)
  42 + let queryItem1 = URLQueryItem(name: "title", value: title)
43 let queryItem2 = URLQueryItem(name: "channelName", value: "yjzg") 43 let queryItem2 = URLQueryItem(name: "channelName", value: "yjzg")
44 let queryItem3 = URLQueryItem(name: "isShowTitle", value: "true") 44 let queryItem3 = URLQueryItem(name: "isShowTitle", value: "true")
45 let queryItem4 = URLQueryItem(name: "isWjjReport", value: "true") 45 let queryItem4 = URLQueryItem(name: "isWjjReport", value: "true")
46 let urlComponents = NSURLComponents(string: urlString) 46 let urlComponents = NSURLComponents(string: urlString)
47 - urlComponents!.queryItems = [queryItem, queryItem1] 47 + urlComponents!.queryItems = [queryItem, queryItem1,queryItem2,queryItem3,queryItem4]
48 let regURL = urlComponents?.url 48 let regURL = urlComponents?.url
49 let webVC = CNWebViewController() 49 let webVC = CNWebViewController()
50 webVC.url = regURL 50 webVC.url = regURL
51 navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) 51 navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated)
52 - }else if (contentMdl.model == kCNDownSlideContentsModelModelAlbum_ugc){ 52 + }else if (model == kCNDownSlideContentsModelModelAlbum_ugc){
53 53
54 //短剧-跳转短剧播放页 54 //短剧-跳转短剧播放页
55 - navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: contentMdl.contentId ?? ""), animated: pushAnimated)  
56 - }else if contentMdl.model == kCNDownSlideContentsModelModelServing{ 55 + navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: contentId), animated: pushAnimated)
  56 + }else if model == kCNDownSlideContentsModelModelServing{
57 //跳转微信小程序 57 //跳转微信小程序
58 - if let data = (contentMdl.s_to ?? "").data(using: .utf8) { 58 + if let data = s_to.data(using: .utf8) {
59 do { 59 do {
60 let jsonResult = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] 60 let jsonResult = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]
61 let miniAppId = jsonResult!["id"] as! String 61 let miniAppId = jsonResult!["id"] as! String
@@ -98,7 +98,7 @@ class CNLiveDownSlideTool:NSObject{ @@ -98,7 +98,7 @@ class CNLiveDownSlideTool:NSObject{
98 let regURL = urlComponents?.url 98 let regURL = urlComponents?.url
99 let webVC = CNWebViewController() 99 let webVC = CNWebViewController()
100 webVC.url = regURL 100 webVC.url = regURL
101 - navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) 101 + controller.navigationController?.pushViewController(webVC, animated: true)
102 }else if (albumModel.model == kCNDownSlideContentsModelModelAlbum_video){ 102 }else if (albumModel.model == kCNDownSlideContentsModelModelAlbum_video){
103 let urlString = "http://wjjh5.cnlive.com/cnYjzgAlbumVideo.html" 103 let urlString = "http://wjjh5.cnlive.com/cnYjzgAlbumVideo.html"
104 let queryItem = URLQueryItem(name: "aid", value: albumModel.contentId) 104 let queryItem = URLQueryItem(name: "aid", value: albumModel.contentId)
@@ -107,11 +107,11 @@ class CNLiveDownSlideTool:NSObject{ @@ -107,11 +107,11 @@ class CNLiveDownSlideTool:NSObject{
107 let queryItem3 = URLQueryItem(name: "isShowTitle", value: "true") 107 let queryItem3 = URLQueryItem(name: "isShowTitle", value: "true")
108 let queryItem4 = URLQueryItem(name: "isWjjReport", value: "true") 108 let queryItem4 = URLQueryItem(name: "isWjjReport", value: "true")
109 let urlComponents = NSURLComponents(string: urlString) 109 let urlComponents = NSURLComponents(string: urlString)
110 - urlComponents!.queryItems = [queryItem, queryItem1] 110 + urlComponents!.queryItems = [queryItem, queryItem1,queryItem2,queryItem3,queryItem4]
111 let regURL = urlComponents?.url 111 let regURL = urlComponents?.url
112 let webVC = CNWebViewController() 112 let webVC = CNWebViewController()
113 webVC.url = regURL 113 webVC.url = regURL
114 - navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) 114 + controller.navigationController?.pushViewController(webVC, animated: true)
115 }else if (albumModel.model == kCNDownSlideContentsModelModelAlbum_ugc){ 115 }else if (albumModel.model == kCNDownSlideContentsModelModelAlbum_ugc){
116 //短剧-跳转短剧播放页 116 //短剧-跳转短剧播放页
117 navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: albumModel.contentId), animated: pushAnimated) 117 navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: albumModel.contentId), animated: pushAnimated)
@@ -172,11 +172,11 @@ class CNLiveDownSlideTool:NSObject{ @@ -172,11 +172,11 @@ class CNLiveDownSlideTool:NSObject{
172 let queryItem3 = URLQueryItem(name: "isShowTitle", value: "true") 172 let queryItem3 = URLQueryItem(name: "isShowTitle", value: "true")
173 let queryItem4 = URLQueryItem(name: "isWjjReport", value: "true") 173 let queryItem4 = URLQueryItem(name: "isWjjReport", value: "true")
174 let urlComponents = NSURLComponents(string: urlString) 174 let urlComponents = NSURLComponents(string: urlString)
175 - urlComponents!.queryItems = [queryItem, queryItem1] 175 + urlComponents!.queryItems = [queryItem, queryItem1,queryItem2,queryItem3,queryItem4]
176 let regURL = urlComponents?.url 176 let regURL = urlComponents?.url
177 let webVC = CNWebViewController() 177 let webVC = CNWebViewController()
178 webVC.url = regURL 178 webVC.url = regURL
179 - navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) 179 + viewController.navigationController?.pushViewController(webVC, animated: true)
180 }else if (contentMdl.model == kCNDownSlideContentsModelModelAlbum_ugc){ 180 }else if (contentMdl.model == kCNDownSlideContentsModelModelAlbum_ugc){
181 //短剧-跳转短剧播放页 181 //短剧-跳转短剧播放页
182 navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: contentMdl.contentId!), animated: pushAnimated) 182 navigationViewController().visibleViewController?.navigationController?.pushViewController(CNLiveShortVideoViewController(aid: contentMdl.contentId!), animated: pushAnimated)
metaCode/Classes/Main/Util/CNUpSlideAnimationTransition.swift
@@ -87,7 +87,7 @@ extension CNUpSlideAnimationTransition: UIViewControllerAnimatedTransitioning { @@ -87,7 +87,7 @@ extension CNUpSlideAnimationTransition: UIViewControllerAnimatedTransitioning {
87 }else{ 87 }else{
88 return 88 return
89 } 89 }
90 - }else if self.cellType == .course{ 90 + }else if self.cellType == .course || self.cellType == .courseToMyCurriculum{
91 //1.Get fromVC and toVC 91 //1.Get fromVC and toVC
92 guard let fromVC = transitionContext.viewController(forKey: .from) as? CNUpSlideViewController else { return } 92 guard let fromVC = transitionContext.viewController(forKey: .from) as? CNUpSlideViewController else { return }
93 guard let toNaviVC = transitionContext.viewController(forKey: .to) as? CNSlideBaseNavigationController else { return } 93 guard let toNaviVC = transitionContext.viewController(forKey: .to) as? CNSlideBaseNavigationController else { return }
@@ -181,7 +181,7 @@ extension CNUpSlideAnimationTransition: UIViewControllerAnimatedTransitioning { @@ -181,7 +181,7 @@ extension CNUpSlideAnimationTransition: UIViewControllerAnimatedTransitioning {
181 return 181 return
182 } 182 }
183 183
184 - }else if self.cellType == .course{ 184 + }else if self.cellType == .course || self.cellType == .courseToMyCurriculum{
185 guard let fromNaviVC = transitionContext.viewController(forKey: .from) as? CNSlideBaseNavigationController else { return } 185 guard let fromNaviVC = transitionContext.viewController(forKey: .from) as? CNSlideBaseNavigationController else { return }
186 guard let toVC = transitionContext.viewController(forKey: .to) as? CNUpSlideViewController else { return } 186 guard let toVC = transitionContext.viewController(forKey: .to) as? CNUpSlideViewController else { return }
187 guard let selectedCell = toVC.selectedCell else { return } 187 guard let selectedCell = toVC.selectedCell else { return }