From 37efa3e1a1a008f3c7312046c7826bb9a0a272b1 Mon Sep 17 00:00:00 2001
From: zhangxiaoxu123 <819527061@qq.com>
Date: 星期五, 15 七月 2022 11:38:37 +0800
Subject: [PATCH] '菜单权限管理功能'
---
components/common/popup-menu/popup-menu.vue | 79 +++++++++++++++++++++++++++++++++++++--
1 files changed, 74 insertions(+), 5 deletions(-)
diff --git a/components/common/popup-menu/popup-menu.vue b/components/common/popup-menu/popup-menu.vue
index 6091533..6ac376e 100644
--- a/components/common/popup-menu/popup-menu.vue
+++ b/components/common/popup-menu/popup-menu.vue
@@ -7,23 +7,38 @@
isLink
url="/pages/home/home" style="color:blue"
>
- <image src="@/static/menuIcon/menu-home.png" slot="icon" size="32" name="search"/></u-cell>
+ <image src="@/static/menuIcon/menu-home.png" slot="icon" size="32" name="search"/>
+ </u-cell>
<u-cell
+ v-if="shenqingMenu"
title="鎴戠殑鐢宠"
isLink
url="/pages/my-application/my-application"
>
- <image src="@/static/menuIcon/menu-application.png" slot="icon" size="32" name="search"/></u-cell></u-cell>
+ <image src="@/static/menuIcon/menu-application.png" slot="icon" size="32" name="search"/>
+ </u-cell>
<u-cell
title="鎴戠殑寰呭姙"
isLink
url="/pages/my-todo/my-todo"
- > <image src="@/static/menuIcon/menu-todo.png" slot="icon" size="32" name="search"/></u-cell></u-cell>
+ >
+ <image src="@/static/menuIcon/menu-todo.png" slot="icon" size="32" name="search"/>
+ </u-cell>
<u-cell
title="鎴戠殑宸插姙"
isLink
url="/pages/my-have-todo/my-have-todo"
- > <image src="@/static/menuIcon/menu-havedo.png" slot="icon" size="32" name="search"/></u-cell></u-cell>
+ >
+ <image src="@/static/menuIcon/menu-havedo.png" slot="icon" size="32" name="search"/>
+ </u-cell>
+ <u-cell
+ v-if="rijihuaMenu"
+ title="鏃ュ彂杩愯鍒�"
+ isLink
+ url="/pages/jihua/jihua" style="color:blue"
+ >
+ <image src="@/static/menuIcon/menu-home.png" slot="icon" size="32" name="search"/>
+ </u-cell>
</u-cell-group>
<u-button text="閫�鍑�" type="primary" @click="menuPopupClick"></u-button>
</u-popup>
@@ -48,16 +63,70 @@
// },
data() {
return {
- menuShow:false
+ menuShow:false,
+ rijihuaMenu:false,
+ shenqingMenu:false,
};
},
+ onShow() {
+ alert(111)
+ },
methods: {
+ checkRijihua(data) {
+ let labelArry = []
+ let newObj = data.filter(e => e.label == '鍦伴攢璁¢噺')
+ newObj && newObj.forEach(e => {
+ if(e.children.length > 0) {
+ e.children.forEach(item => {
+ labelArry.push(item.label)
+ })
+ }else{
+ this.rijihuaMenu = false
+ }
+ })
+ if(labelArry.indexOf('姹借溅鏃ュ彂杩愯鍒掔鐞�') > -1) {
+ this.rijihuaMenu = true
+ }else {
+ this.rijihuaMenu = false
+ }
+ },
+ checkShenqing(data) {
+ let labelArry = []
+ let newObj = data.filter(e => e.label == '宸ヤ綔瀹℃壒')
+ newObj && newObj.forEach(e => {
+ if(e.children.length > 0) {
+ e.children.forEach(item => {
+ labelArry.push(item.label)
+ })
+ }else{
+ this.shenqingMenu = false
+ }
+ })
+ if(labelArry.indexOf('鎴戠殑鐢宠') > -1) {
+ this.shenqingMenu = true
+ }else {
+ this.shenqingMenu = false
+ }
+ },
+ menu() {
+ // 鏉冮檺鍒ゆ柇
+ this.$reqGet('menu').then(res => {
+ if(res.data == null) {
+ this.rijihuaMenu = false
+ this.shenqingMenu = false
+ }else {
+ this.checkRijihua(res.data)
+ this.checkShenqing(res.data)
+ }
+ })
+ },
menuClick(){
this.menuShow = !this.menuShow
this.$emit('menuShow',this.menuShow)
},
open() {
console.log('open');
+ this.menu()
},
close() {
this.menuShow = false;
--
Gitblit v1.9.1