kaifain_v2.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 source = window.location.href
  30. let target
  31. if (/\/(s|d)\/[0-9a-f]+/.test(source)) {
  32. target = source.replace(location.host, MOB_HOST)
  33. } else {
  34. target = `https://${MOB_HOST}/`
  35. }
  36. window.location.replace(target)
  37. }
  38. }
  39. },
  40. beforeMount() {
  41. resetRem()
  42. }
  43. }
  44. </script>
  45. <style lang="scss">
  46. :root {
  47. font-size: 16px;
  48. }
  49. </style>