kaifain_v2.vue 1.1 KB

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