Browse Source

代码审查

yingp 7 years ago
parent
commit
a28564895b

+ 2 - 11
frontend/saas-web/app/view/main/Main.js

@@ -160,7 +160,7 @@ Ext.define('saas.view.main.Main', {
                         html:'<img class="x-img x-box-item x-toolbar-item x-img-header" style="height:35px;width:35px;margin-top: 6px;margin-left: 14px;" src="{avatarUrl}" alt="">'
                         html:'<img class="x-img x-box-item x-toolbar-item x-img-header" style="height:35px;width:35px;margin-top: 6px;margin-left: 14px;" src="{avatarUrl}" alt="">'
                     }, 
                     }, 
                     menu: {
                     menu: {
-                        height: 132,
+                        // height: 132,
                         cls:'x-main-menu2 sa-nav-menu', 
                         cls:'x-main-menu2 sa-nav-menu', 
                         items: [ {  
                         items: [ {  
                             text: '账户中心',
                             text: '账户中心',
@@ -179,21 +179,12 @@ Ext.define('saas.view.main.Main', {
                             handler:'feedbackMsg'
                             handler:'feedbackMsg'
                         }, {  
                         }, {  
                             text: '加入申请',
                             text: '加入申请',
-                            hidden:true,
                             name:'join',
                             name:'join',
                             iconCls:'x-fa fa-handshake-o sa-navicon',
                             iconCls:'x-fa fa-handshake-o sa-navicon',
                             handler:function(b){
                             handler:function(b){
                                 saas.util.BaseUtil.openTab('sys-invitation-datalist','申请列表', 'sys-invitation-datalist');
                                 saas.util.BaseUtil.openTab('sys-invitation-datalist','申请列表', 'sys-invitation-datalist');
                             },
                             },
-                            listeners:{
-                                afterrender:function(b){
-                                    if(b.ownerCt.ownerCmp.ownerCt.ownerCt.isAdmin){
-                                        b.show();
-                                    }else{
-                                        b.ownerCt.el.dom.style.height = "100px"
-                                    }
-                                }
-                            }
+                            bind: {hidden: '{!isAdmin}'}
                         }, {
                         }, {
                             text: '退出',
                             text: '退出',
                             iconCls:'x-fa fa-power-off sa-navicon',
                             iconCls:'x-fa fa-power-off sa-navicon',

+ 13 - 0
frontend/saas-web/app/view/viewport/ViewportModel.js

@@ -16,6 +16,19 @@ Ext.define('saas.view.viewport.ViewportModel', {
         avatarUrl: function (get) {
         avatarUrl: function (get) {
             var account = get('account');
             var account = get('account');
             return (account && account.avatarUrl) || 'resources/images/default/user-icon.png'
             return (account && account.avatarUrl) || 'resources/images/default/user-icon.png'
+        },
+        isAdmin: function(get) {
+            var account = get('account');
+            if (0 == account.type) {
+                return true;
+            }
+            if (account.rolesMap) {
+                var roles = account.rolesMap[account.companyId];
+                return roles && roles.some(function(r){
+                    return 0 == r.type;
+                });
+            }
+            return false;
         }
         }
     }    
     }    
 });
 });

+ 1 - 1
frontend/saas-web/electron/package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "UsoftchinaSaasClient",
   "name": "UsoftchinaSaasClient",
-  "version": "0.0.1",
+  "version": "0.0.2",
   "description": "saas在线进销存系统",
   "description": "saas在线进销存系统",
   "main": "./main.js",
   "main": "./main.js",
   "scripts": {
   "scripts": {