|
@@ -11,19 +11,27 @@ import RxSwift
|
|
|
|
|
|
public enum DepartureVCType{
|
|
|
case personal // 个人中心
|
|
|
+ case hotVideos // 热门视频
|
|
|
case others
|
|
|
}
|
|
|
|
|
|
class CommunityVideoListController: BaseViewController {
|
|
|
|
|
|
// 内容Id
|
|
|
- var contentId: Int? {
|
|
|
+ var contentId: Int?
|
|
|
+ // 来源Vc
|
|
|
+ var departureVc : DepartureVCType? {
|
|
|
didSet {
|
|
|
- setupData()
|
|
|
+ if departureVc == .personal {
|
|
|
+ paraType = "one"
|
|
|
+ } else if departureVc == .hotVideos {
|
|
|
+ paraType = "hot"
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- // 来源Vc
|
|
|
- var departureVc : DepartureVCType = .others
|
|
|
+ var paraType: String?
|
|
|
+ // 单个话题id
|
|
|
+ var topicId: Int?
|
|
|
|
|
|
var videoItemList = Array<CommunityVideoItemModel>()
|
|
|
|
|
@@ -47,6 +55,7 @@ class CommunityVideoListController: BaseViewController {
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
setupViews()
|
|
|
+ setupData()
|
|
|
setUpAppStatusNotification()
|
|
|
statusBarStyle = .lightContent
|
|
|
}
|
|
@@ -328,7 +337,7 @@ extension CommunityVideoListController {
|
|
|
extension CommunityVideoListController {
|
|
|
/// 视频列表
|
|
|
func communityVideoListApi(page:Int = 1) {
|
|
|
- SwiftMoyaNetWorkServiceCommunity.shared().communityVideoListApi(id: contentId ?? 0, page:page) {
|
|
|
+ SwiftMoyaNetWorkServiceCommunity.shared().communityVideoListApi(id: contentId ?? 0, type: paraType ?? "", topicId: topicId ?? 0, page: page) {
|
|
|
[weak self] (communityVideoListModel) -> (Void) in
|
|
|
self?.videoListMdl = communityVideoListModel as? CommunityVideoListModel
|
|
|
if self?.videoListMdl?.pagination?.currentPage ?? 1 <= self?.videoListMdl?.pagination?.totalPages ?? 1 {
|
|
@@ -344,8 +353,27 @@ extension CommunityVideoListController {
|
|
|
}else {
|
|
|
self?.collectionView.endFooterNoMoreData()
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+// SwiftMoyaNetWorkServiceCommunity.shared().communityVideoListApi(id: contentId ?? 0, page:page) {
|
|
|
+// [weak self] (communityVideoListModel) -> (Void) in
|
|
|
+// self?.videoListMdl = communityVideoListModel as? CommunityVideoListModel
|
|
|
+// if self?.videoListMdl?.pagination?.currentPage ?? 1 <= self?.videoListMdl?.pagination?.totalPages ?? 1 {
|
|
|
+// if self?.videoListMdl?.pagination?.currentPage == 1{
|
|
|
+// self?.videoItemList.removeAll()
|
|
|
+// self?.collectionView.resetNoMoreData()
|
|
|
+// }
|
|
|
+// self?.videoItemList = self!.videoItemList + (self?.videoListMdl?.data!)!
|
|
|
+// self?.collectionView.reloadData()
|
|
|
+// if self?.videoListMdl?.pagination?.currentPage ?? 1 >= self?.videoListMdl?.pagination?.totalPages ?? 1 {
|
|
|
+// self?.collectionView.endFooterNoMoreData()
|
|
|
+// }
|
|
|
+// }else {
|
|
|
+// self?.collectionView.endFooterNoMoreData()
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
/// 阅读virue
|