_code.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template lang="">
  2. <div class="agreement" :class="{ dark }">
  3. <!-- eslint-disable-next-line vue/no-v-html -->
  4. <div class="content-wrap p-4" v-html="content"></div>
  5. </div>
  6. </template>
  7. <script>
  8. export default {
  9. name: 'Agreement',
  10. auth: false,
  11. data() {
  12. return {
  13. data: {
  14. title: '',
  15. content: '',
  16. },
  17. dark: false,
  18. };
  19. },
  20. async fetch() {
  21. const agreementCoding = this.$route.params.code;
  22. if (this.$route.query.dark === 'true') {
  23. this.dark = true;
  24. }
  25. const res = await this.$axios.$get(
  26. '/public/v5/agreementApi/content/getContentByType',
  27. {
  28. params: {
  29. agreementCoding,
  30. type: 1,
  31. },
  32. },
  33. );
  34. this.data = res.data;
  35. },
  36. computed: {
  37. content() {
  38. return this.data.content
  39. .replace(/[\d\D]*<body>([\d\D]+)<\/body>[\d\D]*/i, '$1')
  40. .replace(/<div class="phone-container">([\d\D]+)<\/div>/g, '$1');
  41. },
  42. },
  43. };
  44. </script>
  45. <style lang="scss" scoped>
  46. .agreement {
  47. min-height: 100vh;
  48. box-sizing: border-box;
  49. padding-bottom: env(safe-area-inset-bottom, 0px);
  50. &.dark {
  51. background-color: #000;
  52. }
  53. }
  54. .content-wrap {
  55. }
  56. </style>