App.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div id="app">
  3. <router-view></router-view>
  4. </div>
  5. </template>
  6. <script>
  7. import userService from './components/service/UserService'
  8. export default {
  9. name: 'app',
  10. data(){
  11. return {
  12. isLogin: false,
  13. userInfo: { //保存用户信息
  14. nick: null,
  15. ulevel: null,
  16. uid: null,
  17. portrait: null
  18. }
  19. }
  20. },
  21. created() {
  22. if (userService.getToken() == null){
  23. //如果没有登录状态则跳转到登录页
  24. this.$router.push('/login');
  25. }
  26. },
  27. //监听路由检查登录
  28. watch:{
  29. "$route" : 'checkLogin'
  30. },
  31. mounted(){
  32. //组件开始挂载时获取用户信息
  33. // this.getUserInfo();
  34. },
  35. methods: {
  36. checkLogin(){
  37. //检查是否存在session
  38. if (userService.getToken() == null){
  39. //如果没有登录状态则跳转到登录页
  40. // this.$router.push('/login');
  41. }
  42. },
  43. },
  44. components: {}
  45. };
  46. </script>
  47. <style>
  48. html,
  49. body,
  50. #app {
  51. margin: 0 0;
  52. background-color: #e9eef3;
  53. height: 100%;
  54. }
  55. .el-header,
  56. .el-footer {
  57. /* background-color: #b3c0d1; */
  58. color: #333;
  59. text-align: center;
  60. line-height: 60px;
  61. }
  62. .el-main {
  63. background-color: #f0f2f5;
  64. color: #333;
  65. text-align: center;
  66. padding-top: 0px !important;
  67. }
  68. /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
  69. ::-webkit-scrollbar {
  70. width: 8px;
  71. height: 8px;
  72. }
  73. /*定义滚动条轨道 内阴影+圆角*/
  74. ::-webkit-scrollbar-track {
  75. border-radius: 4px;
  76. background-color: #F5F5F5;
  77. }
  78. /*定义滑块 内阴影+圆角*/
  79. ::-webkit-scrollbar-thumb {
  80. border-radius: 4px;
  81. background-color: #c8c8c8;
  82. box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  83. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  84. }
  85. .table-header {
  86. color: #727272;
  87. font-weight: 600;
  88. }
  89. </style>