App.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. excludeLoginCheck: ["/play/wasm", "/play/rtc"],
  14. userInfo: { //保存用户信息
  15. nick: null,
  16. ulevel: null,
  17. uid: null,
  18. portrait: null
  19. }
  20. }
  21. },
  22. created() {
  23. if (userService.getToken() == null){
  24. console.log(22222)
  25. console.log(this.$route.path)
  26. try {
  27. if (this.excludeLoginCheck && this.excludeLoginCheck.length > 0) {
  28. for (let i = 0; i < this.excludeLoginCheck.length; i++) {
  29. if (this.$route.path.startsWith(this.excludeLoginCheck[i])){
  30. return;
  31. }
  32. }
  33. }
  34. }catch (e) {
  35. console.error(e)
  36. }
  37. //如果没有登录状态则跳转到登录页
  38. this.$router.push('/login');
  39. }
  40. },
  41. mounted(){
  42. //组件开始挂载时获取用户信息
  43. // this.getUserInfo();
  44. },
  45. methods: {
  46. },
  47. components: {}
  48. };
  49. </script>
  50. <style>
  51. html,
  52. body,
  53. #app {
  54. margin: 0 0;
  55. background-color: #e9eef3;
  56. height: 100%;
  57. }
  58. .el-header,
  59. .el-footer {
  60. /* background-color: #b3c0d1; */
  61. color: #333;
  62. text-align: center;
  63. line-height: 60px;
  64. }
  65. .el-main {
  66. background-color: #f0f2f5;
  67. color: #333;
  68. text-align: center;
  69. padding-top: 0px !important;
  70. }
  71. /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
  72. ::-webkit-scrollbar {
  73. width: 8px;
  74. height: 8px;
  75. }
  76. /*定义滚动条轨道 内阴影+圆角*/
  77. ::-webkit-scrollbar-track {
  78. border-radius: 4px;
  79. background-color: #F5F5F5;
  80. }
  81. /*定义滑块 内阴影+圆角*/
  82. ::-webkit-scrollbar-thumb {
  83. border-radius: 4px;
  84. background-color: #c8c8c8;
  85. box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  86. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  87. }
  88. .table-header {
  89. color: #727272;
  90. font-weight: 600;
  91. }
  92. </style>