| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- <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-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: 54px;
- 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/navside/icon_home.png") top center no-repeat;
- background-size: 100%;
- }
- .icon_region {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_region.png") top center no-repeat;
- background-size: 100%;
- }
- .icon_signEquip {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_signEquip.png") top center no-repeat;
- background-size: 100%;
- }
- .icon_equip {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_equip.png") top center no-repeat;
- background-size: 100%;
- }
- .icon_record {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_record.png") top center no-repeat;
- background-size: 100%;
- }
- .icon_tactics {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_tactics.png") top center no-repeat;
- background-size: 100%;
- }
- .icon_plan {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_plan.png") top center no-repeat;
- background-size: 100%;
- }
- .icon_task {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_task.png") top center no-repeat;
- background-size: 100%;
- }
- .icon_statistics {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_statistics.png") top center no-repeat;
- background-size: 100%;
- }
- .icon_setting {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/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/navside/icon_logout.png") top center no-repeat;
- background-size: 100%;
- }
- li:hover .icon_home {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_home_w.png") top center no-repeat;
- background-size: 100%;
- }
- li:hover .icon_region {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_region_w.png") top center no-repeat;
- background-size: 100%;
- }
- li:hover .icon_signEquip {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_signEquip_w.png") top center no-repeat;
- background-size: 100%;
- }
- li:hover .icon_equip {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_equip_w.png") top center no-repeat;
- background-size: 100%;
- }
- li:hover .icon_record {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_record_w.png") top center no-repeat;
- background-size: 100%;
- }
- li:hover .icon_tactics {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_tactics_w.png") top center no-repeat;
- background-size: 100%;
- }
- li:hover .icon_plan {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_plan_w.png") top center no-repeat;
- background-size: 100%;
- }
- li:hover .icon_task {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_task_w.png") top center no-repeat;
- background-size: 100%;
- }
- li:hover .icon_statistics {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_statistics_w.png") top center no-repeat;
- background-size: 100%;
- }
- li:hover .icon_setting {
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_setting_w.png") top center no-repeat;
- background-size: 100%;
- }
- li:hover .icon_logout{
- width: 18px;
- height: 18px;
- float: left;
- margin-top: 20px;
- background: url("../assets/img/navside/icon_logout_w.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>
|