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
| <template>
| <div id="app">
| <router-view></router-view>
| </div>
| </template>
|
| <script>
| import userService from './components/service/UserService'
| export default {
| name: 'app',
| data(){
| return {
| isLogin: false,
| userInfo: { //保存用户信息
| nick: null,
| ulevel: null,
| uid: null,
| portrait: null
| }
| }
| },
| created() {
| if (userService.getToken() == null){
| //如果没有登录状态则跳转到登录页
| this.$router.push('/login');
| }
| },
| //监听路由检查登录
| watch:{
| "$route" : 'checkLogin'
| },
| mounted(){
| //组件开始挂载时获取用户信息
| // this.getUserInfo();
| },
| methods: {
| checkLogin(){
| //检查是否存在session
| if (userService.getToken() == null){
| //如果没有登录状态则跳转到登录页
| // this.$router.push('/login');
| }
|
| },
| },
| components: {}
| };
| </script>
|
| <style>
| html,
| body,
| #app {
| margin: 0 0;
| background-color: #e9eef3;
| height: 100%;
| }
| .el-header,
| .el-footer {
| /* background-color: #b3c0d1; */
| color: #333;
| text-align: center;
| line-height: 60px;
| }
| .el-main {
| background-color: #f0f2f5;
| color: #333;
| text-align: center;
| padding-top: 0px !important;
| }
|
| /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
| ::-webkit-scrollbar {
| width: 8px;
| height: 8px;
| }
|
| /*定义滚动条轨道 内阴影+圆角*/
| ::-webkit-scrollbar-track {
| border-radius: 4px;
| background-color: #F5F5F5;
| }
|
| /*定义滑块 内阴影+圆角*/
| ::-webkit-scrollbar-thumb {
| border-radius: 4px;
| background-color: #c8c8c8;
| box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
| -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
| }
| .table-header {
| color: #727272;
| font-weight: 600;
| }
| </style>
|
|