diff --git a/dist.zip b/dist.zip
index 8ef03ec..993d8bb 100644
--- a/dist.zip
+++ b/dist.zip
Binary files differ
diff --git a/dist.zip b/dist.zip
index 8ef03ec..993d8bb 100644
--- a/dist.zip
+++ b/dist.zip
Binary files differ
diff --git a/src/components/LED/LEDConfig.vue b/src/components/LED/LEDConfig.vue
index b7edc4f..9bd2ad7 100644
--- a/src/components/LED/LEDConfig.vue
+++ b/src/components/LED/LEDConfig.vue
@@ -26,7 +26,7 @@
- 查询
+ 查询
新增
分组管理
diff --git a/dist.zip b/dist.zip
index 8ef03ec..993d8bb 100644
--- a/dist.zip
+++ b/dist.zip
Binary files differ
diff --git a/src/components/LED/LEDConfig.vue b/src/components/LED/LEDConfig.vue
index b7edc4f..9bd2ad7 100644
--- a/src/components/LED/LEDConfig.vue
+++ b/src/components/LED/LEDConfig.vue
@@ -26,7 +26,7 @@
- 查询
+ 查询
新增
分组管理
diff --git a/src/components/index.vue b/src/components/index.vue
index 8aca331..ba27fe9 100644
--- a/src/components/index.vue
+++ b/src/components/index.vue
@@ -234,6 +234,7 @@
// this.LoadMenu();
// this.loadLoginName();
localStorage.setItem("USERNO", "Admin");
+ sessionStorage.setItem("powerHandle", ["RolesAdd1", "RolesAdd3"]);
}
};
diff --git a/dist.zip b/dist.zip
index 8ef03ec..993d8bb 100644
--- a/dist.zip
+++ b/dist.zip
Binary files differ
diff --git a/src/components/LED/LEDConfig.vue b/src/components/LED/LEDConfig.vue
index b7edc4f..9bd2ad7 100644
--- a/src/components/LED/LEDConfig.vue
+++ b/src/components/LED/LEDConfig.vue
@@ -26,7 +26,7 @@
- 查询
+ 查询
新增
分组管理
diff --git a/src/components/index.vue b/src/components/index.vue
index 8aca331..ba27fe9 100644
--- a/src/components/index.vue
+++ b/src/components/index.vue
@@ -234,6 +234,7 @@
// this.LoadMenu();
// this.loadLoginName();
localStorage.setItem("USERNO", "Admin");
+ sessionStorage.setItem("powerHandle", ["RolesAdd1", "RolesAdd3"]);
}
};
diff --git a/src/main.js b/src/main.js
index fa21384..52be63a 100644
--- a/src/main.js
+++ b/src/main.js
@@ -31,6 +31,35 @@
Viewer.setDefaults({
zIndexInline: 9999
})
+
+
+
+/** 权限指令,对按钮权限的控制 **/
+Vue.directive('has', {
+ inserted: function(el, binding) {
+ if (!Vue.prototype.$_has(binding.value)) {
+ el.parentNode.removeChild(el)
+ }
+ }
+})
+
+// 权限检查方法(且把该方法添加到vue原型中)
+Vue.prototype.$_has = function(value) {
+ let isExist = false
+ // 从浏览器缓存中获取权限数组(该数组在登入成功后拉取用户的权限信息时保存在浏览器的缓存中)
+ var buttonpermsStr = sessionStorage.getItem('powerHandle')
+ if (buttonpermsStr === undefined || buttonpermsStr == null) {
+ return false
+ }
+ if (buttonpermsStr.indexOf(value) >= 0) {
+ // 若在按钮中定义的权限字段能在后端返回的权限数组中能找到,则该按钮可显示
+ isExist = true
+ }
+ return isExist
+}
+
+
+
/* eslint-disable no-new */
const vue = new Vue({
el: '#app',