nav.vue
2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<template>
<el-container>
<el-aside width="10%">
<el-menu :default-active="$route.path" class="el-menu-vertical-demo" router :collapse="false">
<div style="height:20%;text-align:center">
<img src="../assets/logo.png" alt="" style="width:100%;height:63%">
</div>
<el-menu-item index="/nav/search">
<i class="el-icon-search"></i>
<span slot="title">检索合同</span>
</el-menu-item>
<el-menu-item index="/nav/contract/0">
<i class="el-icon-plus"></i>
<span slot="title">合同信息</span>
</el-menu-item>
<el-menu-item index="/nav/manage" v-show="management">
<i class="el-icon-setting"></i>
<span slot="title">后台管理</span>
</el-menu-item>
<el-menu-item index="" @click="exit">
<i class="el-icon-back"></i>
<span slot="title">退出</span>
</el-menu-item>
<el-menu-item index="" style="position:absolute;bottom:50px">
<span slot="title">{{department}} : {{username}}</span>
</el-menu-item>
</el-menu>
</el-aside>
<el-main>
<keep-alive include="search">
<router-view></router-view>
</keep-alive>
</el-main>
</el-container>
</template>
<script>
export default {
name: "HelloWorld",
data() {
return {
management: false,
username: "",
department: "",
collapse: true
};
},
methods: {
exit() {
this.$confirm("确认退出?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
sessionStorage.removeItem("username");
sessionStorage.removeItem("loginCheck");
this.$router.push({ path: "/" });
})
.catch(() => {});
}
},
beforeCreate() {
if (!sessionStorage.getItem("loginCheck")) {
alert("请登录");
this.$router.push({ path: "/" });
}
},
created() {
this.username = sessionStorage.getItem("user_name");
var roles = JSON.parse(sessionStorage.getItem("user_roles"));
for (let i = 0; i < roles.length; i++) {
const e = roles[i];
if (e.role_unid == "91d5185d47e3bad099e17570b0dd0ed2") {
this.management = true;
}
this.department = e.name;
}
}
};
</script>
<style>
.el-main {
text-align: center;
}
.el-container,
.el-aside {
height: 100%;
}
.el-menu {
height: 100%;
}
</style>