App.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <div>
  3. <router-view/>
  4. <global-message></global-message>
  5. </div>
  6. </template>
  7. <script>
  8. import GlobalMessage from '@/components/GlobalMessage'
  9. export default {
  10. components: { GlobalMessage },
  11. data () {
  12. return {
  13. userInfo: {}
  14. }
  15. },
  16. created () {
  17. // 在页面加载时读取sessionStorage里的状态信息
  18. if (sessionStorage.getItem('store')) {
  19. this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(sessionStorage.getItem('store'))))
  20. }
  21. // 在页面刷新时将vuex里的信息保存到sessionStorage里
  22. window.addEventListener('beforeunload', () => {
  23. sessionStorage.setItem('store', JSON.stringify(this.$store.state))
  24. })
  25. // getUserInfo().then(res => {
  26. // this.userInfo = res
  27. // this.$router.beforeEach((to, from, next) => {
  28. // if (to.meta.roles && to.meta.roles.includes(this.userInfo.type.toLowerCase())) {
  29. // next()
  30. // } else {
  31. // next({ path: '/login' })
  32. // }
  33. // })
  34. // })
  35. }
  36. }
  37. </script>
  38. <style lang="scss">
  39. @import "~@/style/reset.scss";
  40. @import "~@/style/theme.scss";
  41. @font-face {
  42. font-family: 'iconfont'; /* project id 1598214 */
  43. src: url('//at.alicdn.com/t/font_1598214_b0x6db1qad6.eot');
  44. src: url('//at.alicdn.com/t/font_1598214_b0x6db1qad6.eot?#iefix') format('embedded-opentype'),
  45. url('//at.alicdn.com/t/font_1598214_b0x6db1qad6.woff2') format('woff2'),
  46. url('//at.alicdn.com/t/font_1598214_b0x6db1qad6.woff') format('woff'),
  47. url('//at.alicdn.com/t/font_1598214_b0x6db1qad6.ttf') format('truetype'),
  48. url('//at.alicdn.com/t/font_1598214_b0x6db1qad6.svg#iconfont') format('svg');
  49. }
  50. body {
  51. color: #3a4a5a;
  52. }
  53. * {
  54. -webkit-tap-highlight-color: transparent;
  55. }
  56. .title {
  57. font-size: 28px;
  58. font-weight: 600;
  59. margin-bottom: 24px;
  60. }
  61. .sub-title {
  62. font-size: 22px;
  63. font-weight: 600;
  64. margin-bottom: 12px;
  65. }
  66. .no-content-warning {
  67. color: #aabaca;
  68. font-size: 20px;
  69. font-weight: bold;
  70. padding: 12px 0;
  71. height: 120px;
  72. display: flex;
  73. flex-direction: column;
  74. justify-content: center;
  75. line-height: 1.8;
  76. .no-content-warning-tip {
  77. padding: 24px 0;
  78. }
  79. }
  80. .tag {
  81. display: inline-block;
  82. position: relative;
  83. background-color: lighten($theme-blue, 30);
  84. color: $theme-blue;
  85. font-size: 12px;
  86. padding: 4px 12px;
  87. margin-left: 4px;
  88. border-radius: 8px;
  89. vertical-align: middle;
  90. bottom: 2px;
  91. }
  92. .full-width {
  93. width: 100%;
  94. }
  95. .mb-8 {
  96. margin-bottom: 8px;
  97. }
  98. .mb-12 {
  99. margin-bottom: 12px;
  100. }
  101. .mb-16 {
  102. margin-bottom: 16px;
  103. }
  104. .mt-16 {
  105. margin-top: 16px;
  106. }
  107. .mb-24 {
  108. margin-bottom: 24px;
  109. }
  110. .mb-32 {
  111. margin-bottom: 32px;
  112. }
  113. </style>