App.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div id="app">
  3. <router-view v-if="isRouterAlive" />
  4. </div>
  5. </template>
  6. <script>
  7. import Home from '@/views/Home'
  8. import tabers from '@/components/taber'
  9. import {getUserTaskComplete} from "@/api/user";
  10. export default {
  11. name: 'App',
  12. data() {
  13. return{
  14. isRouterAlive: true
  15. }
  16. },
  17. provide () {
  18. return {
  19. reload: this.reload
  20. }
  21. },
  22. created () {
  23. document.title = this.$t('common.GEIDcpTitleSeptember');
  24. let app=document.getElementById('app');
  25. if(this.$i18n.locale=='en'){
  26. app.style.fontFamily="Helvetica,neue,sans-serif"
  27. }else{
  28. app.style.fontFamily="Microsoft YaHei,Arial,helvetica,neue,sans-serif"
  29. }
  30. // window.localStorage.setItem("locale",'en');
  31. //在页面加载时读取sessionStorage里的状态信息
  32. if (window.localStorage.getItem("router") ) {
  33. // this.$store.replaceState(Object.assign({}, this.$store.state.user,JSON.parse(sessionStorage.getItem("user"))))
  34. this.$store.commit('modify', localStorage.getItem("routerItem")?localStorage.getItem("routerItem"):localStorage.getItem("router")?localStorage.getItem("router"):this.$route.path.substr(1));
  35. }
  36. },
  37. mounted () {
  38. this.$store.dispatch("user/SAVE_USER_TASK_COMPLETE")
  39. this.$store.dispatch("user/SAVE_USER_GRADES")
  40. this.$store.dispatch("user/SAVE_USER_RIGHTS")
  41. if ('-ms-scroll-limit' in document.documentElement.style &&
  42. '-ms-ime-align' in document.documentElement.style) {
  43. window.addEventListener('hashchange', () => {
  44. var currentPath = window.location.hash.slice(1)
  45. if (this.$route.path !== currentPath) {
  46. this.$router.push(currentPath)
  47. }
  48. }, false)
  49. }
  50. },
  51. watch:{
  52. '$i18n.locale'(){
  53. document.title = this.$t('common.GEIDcpTitleSeptember');
  54. let app=document.getElementById('app');
  55. if(this.$i18n.locale=='en'){
  56. app.style.fontFamily="Helvetica,neue,sans-serif"
  57. }else{
  58. app.style.fontFamily="Microsoft YaHei,Arial,helvetica,neue,sans-serif"
  59. }
  60. }
  61. },
  62. methods: {
  63. reload () {
  64. this.isRouterAlive = false;
  65. this.$nextTick(function () {
  66. this.isRouterAlive = true;
  67. })
  68. }
  69. }
  70. }
  71. </script>
  72. <style>
  73. #app {
  74. font-family: "Microsoft YaHei",Arial,helvetica,neue,sans-serif;
  75. -webkit-font-smoothing: antialiased;
  76. -moz-osx-font-smoothing: grayscale;
  77. text-align: left;
  78. color: #2c3e50;
  79. background-color: #f5f5f5;
  80. /* overflow: hidden; */
  81. }
  82. body {
  83. width: 100%;
  84. height: 100%;
  85. margin: 0;
  86. padding: 0;
  87. font-family: "Microsoft YaHei";
  88. }
  89. @media (max-width: 1199px){
  90. body{
  91. width: 1200px;
  92. overflow: scroll;
  93. }
  94. }
  95. input {font-family: "Microsoft YaHei";}
  96. ul {
  97. list-style-type: none;
  98. padding: 0;
  99. margin: 0;
  100. }
  101. .el-popover {
  102. max-height: 200px;
  103. overflow: hidden;overflow-y: scroll;
  104. }
  105. /* #bdSharePopup_selectshare1598520503574box{
  106. display: block !important;
  107. }
  108. .bdselect_share_head {
  109. display: none;
  110. } */
  111. </style>