App.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <div id="app" :class="`theme${theme}`">
  3. <layout v-if="canUse"/>
  4. <div class="banbentips" v-else>
  5. <div>浏览器版内核版本过低,无法正常浏览网页,建议使用Chrome(谷歌)浏览器,Firefox(火狐)浏览器(版本号80或以上),360安全浏览器(版本10或以上)</div>
  6. <div>
  7. <p v-html="tips[0]"></p>
  8. <p v-html="tips[1]"></p>
  9. </div>
  10. <div>{{link}}</div>
  11. </div>
  12. <!-- <button @click="changeColor">改变颜色</button> -->
  13. </div>
  14. </template>
  15. <script>
  16. import '@/assets/style/reset.less'
  17. import '@/assets/style/public.less'
  18. import '@/assets/theme/color.less'
  19. import layout from '@/views/layout/index.vue'
  20. import {mapState} from 'vuex'
  21. import broswer from './config/broswer'
  22. import whatBrowser from './config/core'
  23. export default {
  24. components:{
  25. layout
  26. },
  27. data(){
  28. return {
  29. broswer,
  30. link: window.location.href,
  31. tips:[],
  32. canUse:false
  33. }
  34. },
  35. methods:{
  36. changeColor(){
  37. document.getElementById('app').className = 'theme2'
  38. }
  39. },
  40. // watch:{
  41. // '$route.name':{
  42. // deep:true,
  43. // handler:function (newVal) {
  44. // if (newVal != 'scene') {
  45. // if (window.player) {
  46. // window.player.sceneRenderer.suspend()
  47. // window.player.removeAllListeners()
  48. // window.player = ''
  49. // }
  50. // }
  51. // }
  52. // }
  53. // },
  54. mounted(){
  55. this.tips = whatBrowser()
  56. if(broswer.trident){
  57. return this.canUse = false
  58. }
  59. // 火狐
  60. else if(broswer.gecko){
  61. let version = broswer.firefoxCore[1].split(".")[0]
  62. if(Number(version)<80)
  63. return this.canUse = false
  64. }
  65. // 谷歌
  66. else if(broswer.webKit){
  67. let version = broswer.chromeCore[1].split(".")[0]
  68. if(Number(version)<69)
  69. return this.canUse = false
  70. }
  71. this.canUse = true
  72. },
  73. computed:{
  74. ...mapState({
  75. theme: state => state.common.theme
  76. })
  77. }
  78. }
  79. </script>
  80. <style lang="less">
  81. #app {
  82. text-align: center;
  83. color: #2c3e50;
  84. width: 100%;
  85. height: 100%;
  86. }
  87. .banbentips{
  88. color: #000;
  89. width: 100%;
  90. padding-top: 80px;
  91. line-height: 2;
  92. }
  93. </style>