Commit ce4df34d219b83891a7aa0bb9c04b6ffb14e8b08

Authored by 葛建军
1 parent 89c4d4af
Exists in newLive

no message

YouerLiveVideo/YouerLiveVideo/controllers/HomePage/MainHomeTableViewController.swift
@@ -108,6 +108,7 @@ class MainHomeTableViewController: UITableViewController { @@ -108,6 +108,7 @@ class MainHomeTableViewController: UITableViewController {
108 } 108 }
109 */ 109 */
110 override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 110 override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  111 + let user=AppDelegate.instance().accountManager
111 if indexPath.row==0{ 112 if indexPath.row==0{
112 //排行 113 //排行
113 let vc = UIStoryboard(name: "HomePage", bundle: nil).instantiateViewController(withIdentifier: "RankingTableViewController") as! RankingTableViewController 114 let vc = UIStoryboard(name: "HomePage", bundle: nil).instantiateViewController(withIdentifier: "RankingTableViewController") as! RankingTableViewController
@@ -118,7 +119,11 @@ class MainHomeTableViewController: UITableViewController { @@ -118,7 +119,11 @@ class MainHomeTableViewController: UITableViewController {
118 self.tabBarController?.selectedIndex=2 119 self.tabBarController?.selectedIndex=2
119 }else if indexPath.row==2{ 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 }else{ 127 }else{
123 //校园电视台 128 //校园电视台
124 self.tabBarController?.selectedIndex=3 129 self.tabBarController?.selectedIndex=3
@@ -345,11 +350,15 @@ class HomeThirdTableViewCell: UITableViewCell,UICollectionViewDelegate,UICollect @@ -345,11 +350,15 @@ class HomeThirdTableViewCell: UITableViewCell,UICollectionViewDelegate,UICollect
345 } 350 }
346 } 351 }
347 func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 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 func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { 363 func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
355 return CGSize(width: (getScreenWidth()-40)/3, height: (getScreenWidth()-40)/3+105.5) 364 return CGSize(width: (getScreenWidth()-40)/3, height: (getScreenWidth()-40)/3+105.5)
YouerLiveVideo/YouerLiveVideo/controllers/LeadViewController.swift
@@ -8,7 +8,8 @@ @@ -8,7 +8,8 @@
8 8
9 import UIKit 9 import UIKit
10 10
11 -class LeadViewController: UIViewController { 11 +class LeadViewController: UIViewController,UITabBarControllerDelegate {
  12 + let user=AppDelegate.instance().accountManager
12 static var instance:LeadViewController! 13 static var instance:LeadViewController!
13 override func viewDidLoad() { 14 override func viewDidLoad() {
14 super.viewDidLoad() 15 super.viewDidLoad()
@@ -20,9 +21,22 @@ class LeadViewController: UIViewController { @@ -20,9 +21,22 @@ class LeadViewController: UIViewController {
20 // showLogin() 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 func showMain() { 36 func showMain() {
24 removeAll() 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 displayContentController(content: vc) 40 displayContentController(content: vc)
27 } 41 }
28 func showLogin() { 42 func showLogin() {
YouerLiveVideo/YouerLiveVideo/controllers/MViewController.swift
@@ -22,7 +22,6 @@ class MViewController: UITabBarController { @@ -22,7 +22,6 @@ class MViewController: UITabBarController {
22 tabBar.barTintColor=UIColor.white 22 tabBar.barTintColor=UIColor.white
23 tabBarController?.tabBar.isHidden=true 23 tabBarController?.tabBar.isHidden=true
24 } 24 }
25 -  
26 override func didReceiveMemoryWarning() { 25 override func didReceiveMemoryWarning() {
27 super.didReceiveMemoryWarning() 26 super.didReceiveMemoryWarning()
28 } 27 }