| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- <template>
- <div>
- <el-row :class="[{'shortnav':isCollapse},{'longNav':!isCollapse}]">
- <el-col :span="24">
- <el-menu
- default-active="2"
- class="el-menu-vertical-demo"
- @open="handleOpen"
- @close="handleClose"
- @select="handleSelect"
- background-color="#545c64"
- text-color="#fff"
- active-text-color="#ffd04b"
- router
- :collapse="isCollapse"
- >
- <!--<el-menu-item class="el-submenu" index="1" route="/" title="系统首页">-->
- <!--<i class="icon-home"></i>-->
- <!--<span slot="title">系统首页</span>-->
- <!--</el-menu-item>-->
- <el-submenu :index="nav.clmid" :route="nav.clmurl" v-for="nav in navs">
- <template slot="title">
- <i :class="nav.icon"></i>
- <span>{{nav.clmname}}</span>
- </template>
- <el-menu-item-group v-for="(child,j) in nav.childs">
- <el-menu-item :index="child.clmid" :route="child.clmurl">{{child.clmname}}
- </el-menu-item>
- </el-menu-item-group>
- </el-submenu>
- <el-submenu index="99">
- <template slot="title">
- <i class="icon-logout"></i>
- <span>退出登陆</span>
- </template>
- <el-menu-item-group>
- <el-menu-item @click="clickLogout">退出登陆
- </el-menu-item>
- </el-menu-item-group>
- </el-submenu>
- </el-menu>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import Navs from '../api/Navs';
- import {SignOut} from '../api/getApiRes.js'
- let qs = require('qs');
- export default {
- data() {
- return {
- wildState: 0,
- navs: [],
- }
- },
- props: ['isCollapse'],
- mounted() {
- this.getTableQuery();
- },
- methods: {
- handleSelect(i, s, t) {
- this.$emit('TabsAdd', i);//触发事件
- },
- getTableQuery() {
- // 菜单
- this.navs = Navs;
- },
- handleOpen(key, keyPath) {
- // console.log(key, keyPath);
- },
- handleClose(key, keyPath) {
- // console.log(key, keyPath);
- },
- clickLogout() {
- let that = this;
- let param = {
- token: localStorage.token
- };
- let postdata = qs.stringify(param);
- this.$confirm('此操作将退出当前账号, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- SignOut(postdata).then(res => {
- that.$message({
- showClose: true,
- message: '用户已退出!',
- type: 'success'
- });
- localStorage.usercode = '';
- localStorage.token = '';
- that.$router.push({path: '/login', query: {status: 1}});
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消用户退出'
- });
- })
- }
- }
- }
- </script>
- <style scoped>
- .shortnav {
- position: absolute;
- width: 65px;
- top: 48px;
- bottom: 0;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- height: 100%;
- }
- .longNav {
- position: absolute;
- width: 320px;
- top: 48px;
- bottom: 0;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- height: 100%;
- }
- .el-col, .el-menu {
- height: 100%;
- border-right: 0;
- }
- /deep/ .el-menu-item {
- background-color: rgba(255, 255, 255, 0) !important;
- }
- /deep/ .el-menu {
- background-color: rgba(255, 255, 255, 0.1) !important;
- }
- /deep/ .el-submenu__title {
- background: rgba(255, 255, 255, 0) !important;
- }
- .el-menu li:hover {
- background: #00599A;
- }
- /deep/ .el-menu-item:hover {
- background: #00599A !important;
- }
- .logout {
- color: #fff;
- font-size: 14px;
- cursor: pointer;
- height: 56px;
- /*line-height: 56px;*/
- }
- .logout:hover {
- background: rgb(67, 74, 80);
- }
- .littleLogo {
- float: left;
- }
- .icon-home {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/icon/home.png") top center no-repeat;
- background-size: 100%;
- }
- .icon-location {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/icon/location.png") top center no-repeat;
- background-size: 100%;
- }
- .icon-list {
- width: 18px;
- height: 22px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/icon/list.png") top center no-repeat;
- background-size: 100% 100%;
- }
- .icon-equip {
- width: 18px;
- height: 22px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/icon/equip.png") top center no-repeat;
- background-size: 100%;
- }
- .icon-qrcode {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/icon/qrcode.png") top center no-repeat;
- background-size: 100%;
- }
- .icon-setting {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/icon/setting.png") top center no-repeat;
- background-size: 100%;
- }
- .icon-logout {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/icon/logout.png") top center no-repeat;
- background-size: 100%;
- }
- /deep/ .el-menu-item-group .el-menu-item {
- height: 25px !important;
- line-height: 25px !important;
- }
- /deep/ .el-menu-item {
- height: 30px;
- line-height: 20px;
- }
- </style>
|