From 4a800a8fc83c6bd1f86a8e847b079a51a7532c09 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期三, 20 七月 2022 15:05:58 +0800 Subject: [PATCH] 修复国标配置的bug --- src/pages/shuohuangMonitorAnalyze/components/leftNav.vue | 104 +++++++++++++++++++++++++++++++++++----------------- 1 files changed, 70 insertions(+), 34 deletions(-) diff --git a/src/pages/shuohuangMonitorAnalyze/components/leftNav.vue b/src/pages/shuohuangMonitorAnalyze/components/leftNav.vue index 0653bbd..9b605fd 100644 --- a/src/pages/shuohuangMonitorAnalyze/components/leftNav.vue +++ b/src/pages/shuohuangMonitorAnalyze/components/leftNav.vue @@ -1,92 +1,122 @@ <template> <div class="left-nav"> <h1> - <img class="icon" :src="`${publicPath}images/shuohuang/railroad.png`" style="height: 40px;" /> - <span v-show="!isCollapse" style="padding-left: 6px;">鏈旈粍閾佽矾鏈鸿締鍒嗗叕鍙�</span> + <img + class="icon" + :src="`${publicPath}images/shuohuang/railroad.png`" + style="height: 40px" + /> + <span v-show="!isCollapse" style="padding-left: 6px" + >鏈旈粍閾佽矾鏈鸿締鍒嗗叕鍙�</span + > </h1> <el-menu class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" :collapse="isCollapse" + :default-active="activeIndex" @select="handleSelect" > - <el-menu-item index="1"> - <i class="el-icon-menu"></i> + <el-menu-item index="guideIndex" v-show="isAdmin"> + <i class="iconfont iconshouye"></i> <span slot="title">棣栭〉</span> </el-menu-item> <el-menu-item index="searchForVideoAnalyze"> - <i class="el-icon-menu"></i> + <i class="iconfont iconshipin2"></i> <span slot="title">瑙嗛鍒嗘瀽妫�绱�</span> </el-menu-item> - <el-menu-item index="taskManage"> - <i class="el-icon-menu"></i> + <el-menu-item index="taskManage" v-if="isAdmin"> + <i class="iconfont iconrenwu1"></i> <span slot="title">浠诲姟绠$悊</span> </el-menu-item> - <el-menu-item index="memberManage"> - <i class="el-icon-menu"></i> + <el-menu-item index="memberManage" v-if="isAdmin"> + <i class="iconfont iconrenyuanguanli"></i> <span slot="title">浜哄憳绠$悊</span> </el-menu-item> - <el-menu-item index="configManage"> - <i class="el-icon-menu"></i> + <el-menu-item index="configManage" v-if="isAdmin"> + <i class="iconfont iconicon-test4"></i> <span slot="title">閰嶇疆绠$悊</span> </el-menu-item> <el-submenu index="6"> <template slot="title"> - <i class="el-icon-menu"></i> + <i class="iconfont iconcunchu"></i> <span slot="title">杞偍绠$悊</span> </template> <el-menu-item index="transferMemo">瑙嗛杞偍璁板綍</el-menu-item> <el-menu-item index="transferDeviceManage">杞偍璁惧绠$悊</el-menu-item> + <el-menu-item index="lkgManage">LKJ鏁版嵁绠$悊</el-menu-item> </el-submenu> - <el-submenu index="7"> + <el-submenu index="7" v-if="isAdmin"> <template slot="title"> - <i class="el-icon-menu"></i> + <i class="iconfont iconkeshihua"></i> <span slot="title">鍙鍖栧ぇ灞�</span> </template> - <el-menu-item index="7-1">浠诲姟澶у睆</el-menu-item> - <el-menu-item index="7-2">闅愭偅澶у睆</el-menu-item> + <el-menu-item index="taskscreen">浠诲姟澶у睆</el-menu-item> + <el-menu-item index="hiddendangerscreen">闅愭偅澶у睆</el-menu-item> </el-submenu> </el-menu> </div> </template> <script> - //import railroadImg from '/images/shuohuang/railroad.png'; export default { props: { isCollapse: { type: Boolean, - default: true + default: true, }, menuChange: { - type: Function - } + type: Function, + }, }, - data () { + computed: { + isAdmin() { + if ( + sessionStorage.getItem("userInfo") && + sessionStorage.getItem("userInfo") !== "" + ) { + let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username; + return loginName === "admin" || loginName === "basic"; + } + return false; + }, + }, + data() { return { publicPath: process.env.BASE_URL, - } + activeIndex: "guideIndex", + }; + }, + mounted() { + // if (this.isAdmin) { + // if (!!sessionStorage.getItem('leftNavAct')) { + // console.log("leftNavAct") + // this.activeIndex = sessionStorage.getItem('leftNavAct'); + // } + // } + this.activeIndex = this.isAdmin ? "guideIndex" : "searchForVideoAnalyze"; + + this.$emit("menuChange", this.activeIndex); }, methods: { - handleSelect(index,indePath){ - this.$emit('menuChange',index); + handleSelect(index, indePath) { + this.activeIndex = index; + sessionStorage.setItem("leftNavAct", this.activeIndex); + this.$emit("menuChange", index); }, - handleOpen () { - - }, - handleClose () { - - } - } -} + handleOpen() {}, + handleClose() {}, + }, +}; </script> <style lang="scss"> .left-nav { background: #fff; + height: 100vh; h1 { display: flex; align-items: center; @@ -95,13 +125,19 @@ border-bottom: 1px solid #eee; color: rgb(0, 150, 250); } - .el-menu-vertical-demo:not(.el-menu--collapse){ + .iconfont { + padding-right: 10px; + } + .el-menu-vertical-demo:not(.el-menu--collapse) { width: 250px; } .el-menu-item, .el-submenu__title { text-align: left; } - height: 100vh; + .el-menu-item.is-active { + color: #409eff; + background-color: #ecf0fc; + } } </style> \ No newline at end of file -- Gitblit v1.8.0