From ecc5079c63e86dd6caba6753b51ed480022bf89b Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期一, 05 二月 2024 19:19:01 +0800 Subject: [PATCH] 添加api拦截 --- src/components/layout/components/appsidebar/index.vue | 82 +++++++++++++++++++++++++++-------------- 1 files changed, 54 insertions(+), 28 deletions(-) diff --git a/src/components/layout/components/appsidebar/index.vue b/src/components/layout/components/appsidebar/index.vue index 8c38700..89b72f6 100644 --- a/src/components/layout/components/appsidebar/index.vue +++ b/src/components/layout/components/appsidebar/index.vue @@ -4,41 +4,39 @@ <div class="box"> <el-menu router + unique-opened :default-active="$route.path" class="el-menu-vertical-demo" @select="handleOpen" @close="handleClose" - background-color="#545c64" - text-color="#fff" - active-text-color="#ffd04b" + background-color="#314255" + text-color="#bfcbd9" + active-text-color="#fff" > - <el-submenu index=""> + <el-submenu v-for="item in menus" :key="item.id" :index="item.id.toString()" > + <template slot="title"> + <i class="el-icon-money icon"></i> + <span>{{ item.title }}</span> + </template> + <el-menu-item v-for="itm in item.children" :key="itm.id" :index="itm.path">{{ itm.title }}</el-menu-item> + + <!-- <el-menu-item index="/client/salesLead">閿�鍞嚎绱�</el-menu-item> + <el-menu-item index="/client/clientManage">瀹㈡埛绠$悊</el-menu-item> + <el-menu-item index="/client/contacts">鑱旂郴浜�</el-menu-item> + <el-menu-item index="/client/followupRecords">璺熻繘璁板綍</el-menu-item> --> + </el-submenu> + + + <!-- <el-submenu index="4"> <template slot="title"> <i class="el-icon-location"></i> - <span>瀹㈡埛绠$悊</span> + <span>鍚庡彴閰嶇疆</span> </template> - <el-menu-item index="/custom/salesLead">閿�鍞嚎绱�</el-menu-item> - <el-menu-item index="/custom/customManage">瀹㈡埛绠$悊</el-menu-item> - <el-menu-item index="/custom/contacts">鑱旂郴浜�</el-menu-item> - <el-menu-item index="/custom/followupRecords">璺熻繘璁板綍</el-menu-item> - </el-submenu> - <el-submenu index="2"> - <template slot="title"> - <i class="el-icon-location"></i> - <span>閿�鍞鐞�</span> - </template> - </el-submenu> - <el-submenu index="3"> - <template slot="title"> - <i class="el-icon-location"></i> - <span>鏈嶅姟绠$悊</span> - </template> - <el-menu-item index="/service/serviceContract">鏈嶅姟鍚堝悓</el-menu-item> - <el-menu-item index="/service/orderManage">宸ュ崟绠$悊</el-menu-item> - <el-menu-item index="/service/serviceFollowup">鏈嶅姟鍥炶鍗�</el-menu-item> - <el-menu-item index="/service/serviceFeeManage">鏈嶅姟鏀惰垂绠$悊</el-menu-item> - </el-submenu> + <el-menu-item index="/backgroundConfig/memberManage">鎴愬憳绠$悊</el-menu-item> + <el-menu-item index="/backgroundConfig/rolePermssion">瑙掕壊鏉冮檺</el-menu-item> + </el-submenu> --> </el-menu> + <el-empty v-if="this.menus===null||this.menus===undefined||this.menus.length===0" :image-size="130" description="娌℃湁渚ф爮鑿滃崟"></el-empty> </div> </div> </template> @@ -48,7 +46,9 @@ name: "AppSidebar", props: {}, data() { - return {} + return { + menus:[] + } }, watch: { // $route: { @@ -58,14 +58,33 @@ }, created() { this.initNavMenu() + this.getMenuTreeByRole() }, methods: { + getMenuTreeByRole(){ + let newList=this.$store.state.menus + console.log(newList,"newList") + // 闅愯棌浜� 鐢熸垚璁″垝 鍜� 鏈嶅姟鏀惰垂绠$悊妯″潡 + if(newList[1]){ + const found = newList[1].children.find(obj => obj.title === "鐢熸垚璁″垝") + if(found){ + newList[1].children=[...newList[1].children.slice(0, -1)]; + } + } + if(newList[2]){ + const found1 = newList[2].children.find(obj => obj.title === "鏈嶅姟鏀惰垂绠$悊") + if(found1){ + newList[2].children=[...newList[2].children.slice(0, -1)]; + } + } + this.menus=newList + }, // 鐩戝惉璺敱 initNavMenu() { // console.log(this.$route.name) }, handleOpen(index) { - console.log("aaa", index) + console.log(index) }, handleClose() {} } @@ -75,4 +94,11 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> @import "./index.scss"; +::v-deep .el-empty{ + .el-empty__description{ + p{ + color: #dddd; + } + } +} </style> -- Gitblit v1.8.0