|
@@ -75,6 +75,15 @@ class MVHomeController: MVBaseController {
|
|
|
collectionView.delaysContentTouches = false
|
|
|
return collectionView
|
|
|
}()
|
|
|
+ //网络错误提示
|
|
|
+ lazy var emptyRemindView: PQEmptyRemindView = {
|
|
|
+ let emptyRemindView = PQEmptyRemindView(frame: CGRect(x: 0, y: 0, width: cScreenWidth, height: cScreenHeigth - 120 - cAKSafeAreaHeight))
|
|
|
+ emptyRemindView.fullRefreshBloc = { [weak self] _, _ in
|
|
|
+ self?.getData()
|
|
|
+
|
|
|
+ }
|
|
|
+ return emptyRemindView
|
|
|
+ }()
|
|
|
|
|
|
var mVideos: Array = Array<MVHotVideoModel>.init()
|
|
|
|
|
@@ -133,13 +142,33 @@ class MVHomeController: MVBaseController {
|
|
|
MVHomeViewModel.getHomeHotVideos { [weak self] hotVideos, _ in
|
|
|
BFLog(message: "hotVideos count is :\(hotVideos.count)")
|
|
|
PQLoadingHUB.shared.dismissHUB(superView:(self?.view)!)
|
|
|
- let cacheData = MVHotVideoModel.getCacheData()
|
|
|
+
|
|
|
self?.refreshData(hotVideos: hotVideos)
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //显示网络未连接提示
|
|
|
+ func showNetworkError(isHidden:Bool) {
|
|
|
+
|
|
|
+ emptyRemindView.isHidden = isHidden
|
|
|
+
|
|
|
+ emptyRemindView.remindLab.textColor = .black
|
|
|
+ emptyRemindView.remindLab.text = "网络错误"
|
|
|
+ emptyRemindView.remindLab.font = UIFont.boldSystemFont(ofSize: 20)
|
|
|
+ emptyRemindView.imageView.image = nil
|
|
|
+ emptyRemindView.remindSubLab.text = "请检查网络后重试"
|
|
|
+ emptyRemindView.remindSubLab.isHidden = false
|
|
|
+ emptyRemindView.refreshBtn.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
|
|
|
+ if(isHidden){
|
|
|
+ emptyRemindView.removeFromSuperview()
|
|
|
+ }else{
|
|
|
+ view.addSubview(emptyRemindView)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
func refreshData( hotVideos:Array<MVHotVideoModel>) {
|
|
|
|
|
|
mVideos = hotVideos
|
|
@@ -183,9 +212,14 @@ class MVHomeController: MVBaseController {
|
|
|
manager?.listener = { [weak self] status in
|
|
|
if status == .reachable(.wwan) || status == .reachable(.ethernetOrWiFi) {
|
|
|
BFLog(message: "来网了")
|
|
|
+ self?.showNetworkError(isHidden: true)
|
|
|
+
|
|
|
self?.getData()
|
|
|
} else {
|
|
|
- cShowHUB(superView: nil, msg: "没有网络连接")
|
|
|
+ if(MVHotVideoModel.getCacheData().count == 0){
|
|
|
+ self?.showNetworkError(isHidden: false)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|