浏览代码

navbar

develop
Robin Thoni 9 年前
父节点
当前提交
2aabce2782
共有 2 个文件被更改,包括 18 次插入2 次删除
  1. 15
    0
      luticate/controllers/navbar.controller.js
  2. 3
    2
      luticate/views/navbar.html

+ 15
- 0
luticate/controllers/navbar.controller.js 查看文件

@@ -16,5 +16,20 @@ angular.module('luticate')
16 16
                 {
17 17
                     $state.go('login');
18 18
                 });
19
+            };
20
+
21
+            $scope.isLogged = function()
22
+            {
23
+                var user = luticateAuthCache.getUser();
24
+                return user != null && user.Id != 0;
25
+            };
26
+
27
+            $scope.getUsername = function()
28
+            {
29
+                var user = luticateAuthCache.getUser();
30
+                if (user != null) {
31
+                    return user.Username;
32
+                }
33
+                return "";
19 34
             }
20 35
         }]);

+ 3
- 2
luticate/views/navbar.html 查看文件

@@ -18,10 +18,11 @@
18 18
                 <li><a href="#/users" lu-show-permission="LU_USER_GET">Users</a></li>
19 19
                 <li><a href="#/groups" lu-show-permission="LU_GROUP_GET">Groups</a></li>
20 20
                 <li><a href="#/permissions" lu-show-permission="LU_PERM_GET">Permissions</a></li>
21
-                <li><a href="#/test" >Test</a></li>
21
+                <!--<li><a href="#/test" >Test</a></li>-->
22 22
             </ul>
23 23
             <ul class="nav navbar-nav navbar-right">
24
-                <li><a href="" ng-click="logout()">Logout</a></li>
24
+                <li ng-show="isLogged()"><a href="#/home">{{ getUsername() }}</a></li>
25
+                <li ng-show="isLogged()"><a href="" ng-click="logout()">Logout</a></li>
25 26
             </ul>
26 27
         </div>
27 28
         <!-- /.navbar-collapse -->

正在加载...
取消
保存