kaifain_v2.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <nuxt />
  3. </template>
  4. <script>
  5. import Cookies from 'js-cookie'
  6. import Stats from '@/kaifain_v2/mixins/stats'
  7. const MOB_HOST = process.env.NODE_ENV === 'development' ? 'kaifain-m.test.proginn.com' : 'kaifain.m.proginn.com'
  8. const REM_RESET_STYLE = `font-size:16px !important;`
  9. const resetRem = () => {
  10. const _rem_mark = document.querySelector('#rootsize')
  11. if (_rem_mark) {
  12. _rem_mark.innerHTML = `html{${REM_RESET_STYLE}}`
  13. document.documentElement.style = REM_RESET_STYLE
  14. document.body.style = REM_RESET_STYLE
  15. }
  16. }
  17. export default {
  18. head() {
  19. return {
  20. bodyAttrs: {
  21. class: ['kaifain-view', 'non-rem']
  22. },
  23. ...Stats.head
  24. }
  25. },
  26. created() {
  27. if (process.client) {
  28. if (Cookies.get('x_app')) {
  29. const path = window.location.pathname
  30. let target
  31. if (/\/dashboard/.test(path)) {
  32. return
  33. } else if (/\/(s|d)\/[0-9a-f]+/.test(path)) {
  34. target = path.replace(location.host, MOB_HOST)
  35. } else {
  36. target = `https://${MOB_HOST}/`
  37. }
  38. window.location.replace(target)
  39. }
  40. }
  41. },
  42. beforeMount() {
  43. resetRem()
  44. }
  45. }
  46. </script>
  47. <style lang="scss">
  48. :root {
  49. font-size: 16px;
  50. }
  51. </style>