Commit ce4df34d219b83891a7aa0bb9c04b6ffb14e8b08
1 parent
89c4d4af
Exists in
newLive
no message
Showing
3 changed files
with
30 additions
and
8 deletions
Show diff stats
YouerLiveVideo/YouerLiveVideo/controllers/HomePage/MainHomeTableViewController.swift
| ... | ... | @@ -108,6 +108,7 @@ class MainHomeTableViewController: UITableViewController { |
| 108 | 108 | } |
| 109 | 109 | */ |
| 110 | 110 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| 111 | + let user=AppDelegate.instance().accountManager | |
| 111 | 112 | if indexPath.row==0{ |
| 112 | 113 | //排行 |
| 113 | 114 | let vc = UIStoryboard(name: "HomePage", bundle: nil).instantiateViewController(withIdentifier: "RankingTableViewController") as! RankingTableViewController |
| ... | ... | @@ -118,7 +119,11 @@ class MainHomeTableViewController: UITableViewController { |
| 118 | 119 | self.tabBarController?.selectedIndex=2 |
| 119 | 120 | }else if indexPath.row==2{ |
| 120 | 121 | //资源 |
| 121 | - self.tabBarController?.selectedIndex=1 | |
| 122 | + if user.isOnline() && (user.roletype()==1 || user.roletype()==2 || user.roletype()==6){ | |
| 123 | + self.tabBarController?.selectedIndex=1 | |
| 124 | + }else{ | |
| 125 | + AppDelegate.instance().window?.makeToast("无权限查看资源") | |
| 126 | + } | |
| 122 | 127 | }else{ |
| 123 | 128 | //校园电视台 |
| 124 | 129 | self.tabBarController?.selectedIndex=3 |
| ... | ... | @@ -345,11 +350,15 @@ class HomeThirdTableViewCell: UITableViewCell,UICollectionViewDelegate,UICollect |
| 345 | 350 | } |
| 346 | 351 | } |
| 347 | 352 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| 353 | + let user=AppDelegate.instance().accountManager | |
| 348 | 354 | //点击下载并打开资源文档 |
| 349 | - let download = DownLoad.share | |
| 350 | - download.superVC = ((appRootViewController().childViewControllers[0] as! MViewController).selectedViewController as! UINavigationController).viewControllers[0] | |
| 351 | - download.downLoadWithUrl(url: dataSet[indexPath.row].f_ResourceUrl) | |
| 352 | - | |
| 355 | + if user.isOnline() && (user.roletype()==1 || user.roletype()==2 || user.roletype()==6){ | |
| 356 | + let download = DownLoad.share | |
| 357 | + download.superVC = ((appRootViewController().childViewControllers[0] as! MViewController).selectedViewController as! UINavigationController).viewControllers[0] | |
| 358 | + download.downLoadWithUrl(url: dataSet[indexPath.row].f_ResourceUrl) | |
| 359 | + }else{ | |
| 360 | + AppDelegate.instance().window?.makeToast("无权限查看资源") | |
| 361 | + } | |
| 353 | 362 | } |
| 354 | 363 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { |
| 355 | 364 | return CGSize(width: (getScreenWidth()-40)/3, height: (getScreenWidth()-40)/3+105.5) | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/LeadViewController.swift
| ... | ... | @@ -8,7 +8,8 @@ |
| 8 | 8 | |
| 9 | 9 | import UIKit |
| 10 | 10 | |
| 11 | -class LeadViewController: UIViewController { | |
| 11 | +class LeadViewController: UIViewController,UITabBarControllerDelegate { | |
| 12 | + let user=AppDelegate.instance().accountManager | |
| 12 | 13 | static var instance:LeadViewController! |
| 13 | 14 | override func viewDidLoad() { |
| 14 | 15 | super.viewDidLoad() |
| ... | ... | @@ -20,9 +21,22 @@ class LeadViewController: UIViewController { |
| 20 | 21 | // showLogin() |
| 21 | 22 | // } |
| 22 | 23 | } |
| 24 | + func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool { | |
| 25 | + if user.isOnline() && (user.roletype()==1 || user.roletype()==2 || user.roletype()==6){ | |
| 26 | + return true | |
| 27 | + }else{ | |
| 28 | + if viewController.title=="资源"{ | |
| 29 | + AppDelegate.instance().window?.makeToast("无权限查看资源") | |
| 30 | + return false | |
| 31 | + }else{ | |
| 32 | + return true | |
| 33 | + } | |
| 34 | + } | |
| 35 | + } | |
| 23 | 36 | func showMain() { |
| 24 | 37 | removeAll() |
| 25 | - let vc=Story.instantiateViewControllerWithIdentifier("MViewController", storyName: "Main")! | |
| 38 | + let vc=Story.instantiateViewControllerWithIdentifier("MViewController", storyName: "Main") as! MViewController | |
| 39 | + vc.delegate=self | |
| 26 | 40 | displayContentController(content: vc) |
| 27 | 41 | } |
| 28 | 42 | func showLogin() { | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/MViewController.swift