rabin 2 years ago
parent
commit
6caafb8db8

+ 2 - 2
assets/layadmin/html/inc/nav.html

@@ -43,10 +43,10 @@
 
   <li class="layui-nav-item auth-top" lay-unselect>
     <a href="javascript:;">
-      <cite><span>222</span></cite>
+      <cite><span></span></cite>
     </a>
     <ul class="layui-nav-child">
-      <li><a lay-href="set/user/info.html">基本资料</a></li>
+      <li><a href="javascript:;">基本资料</a></li>
     </ul>
   </li>
 

+ 1 - 1
database/company.php

@@ -87,7 +87,7 @@ return array
 
         'getOld' => array
         (
-            'type' => 'one',
+            'type' => 'all',
             'option' => array
             (
                 'ids' => array('yes-id', 'in'),

+ 4 - 0
src/Auth.php

@@ -190,6 +190,7 @@ class Auth
         if (!$info) {
             return;
         }
+        Dever::config('base')->getAdmin = 1;
         if ($state == true && Dever::config('base')->getAdmin && $info && isset($info['id'])) {
             $admin = Dever::db('manage/admin')->one($info['id']);
             if ($admin['status'] != 1) {
@@ -198,6 +199,9 @@ class Auth
             if ($admin['top']) {
                 $info['top'] = $admin['top'];
             }
+            if ($admin['company']) {
+                $info['company'] = $admin['company'];
+            }
         }
 
 

+ 9 - 4
src/Company.php

@@ -2,7 +2,7 @@
 namespace Manage\Src;
 
 use Dever;
-use Manage\Src\Save;
+use Manage\Src\Lib\Save;
 
 class Company extends Save
 {
@@ -22,11 +22,12 @@ class Company extends Save
     # 设置公司权限
     public function set($company_id)
     {
+        $company_id = $company_id ? $company_id : Dever::input('company_id');
         $auth = $this->getAuth();
         if ($auth) {
             $auth = explode(',', $auth);
             if (in_array($company_id, $auth)) {
-                return $ths->_add('company', $company_id, 3600 * 24 * 365);
+                return $this->_add('company', $company_id, 3600 * 24 * 365);
             }
         }
         return false;
@@ -63,7 +64,7 @@ class Company extends Save
         $data = $this->getData();
 
         $result = array();
-        if ($data) {
+        if ($data && count($data) > 1) {
             foreach ($data as $k => $v) {
                 if ($company_id && $company_id != $v['id']) {
                     $result[] = $v;
@@ -79,7 +80,11 @@ class Company extends Save
     # 获取当前公司
     public function getCur()
     {
-        return $this->company;
+        //print_r($this->company);die;
+        if ($this->company) {
+            return $this->company['name'];
+        }
+        return false;
     }
 
     private function getData()

+ 20 - 0
template/layadmin/inc/nav.php

@@ -29,6 +29,26 @@ $view
 
 ->fetch('#front-url@style', 'manage/auth.config#front_display')
 
+->loop
+(
+    '.auth-top li',
+    'manage/company.getList',  
+    array
+    ( 
+        
+        'a' => array 
+        (
+            'html' => '$v.name',
+            'data-id' => '$v.id',
+            'onclick' => 'topCMenu($(this))',
+        )
+    )
+)
+
+->fetch('.auth-top span', 'manage/company.getCur', 'none')
+
+->fetch('.auth-top@style', '<{Dever::load("manage/company.getCur") ? "" : "display:none;"}>')
+
 
 # display
 ->display();

+ 2 - 1
template/layadmin/project/database/list.php

@@ -87,6 +87,7 @@ $view
 */
 
 # 项目列表
+/*
 ->fetch('.auth-top@style', 'display:none')
 
 ->loop
@@ -111,7 +112,7 @@ $view
             ),
         ),
     )
-)
+)*/
 
 
 # 数据结构