agreement.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <layout :bgImgName="null" :bgHeight="null" :bgColor="null" @goBack="goBack" forceShowNavBar>
  3. <div v-html="html"></div>
  4. </layout>
  5. </template>
  6. <script>
  7. import layout from './components/layout.vue';
  8. export default {
  9. name: 'agreement',
  10. data() {
  11. return {
  12. html: '',
  13. };
  14. },
  15. auth: false,
  16. head: {
  17. title: '相关协议',
  18. },
  19. components: {
  20. layout,
  21. },
  22. mounted() {
  23. this.getAgreement();
  24. },
  25. methods: {
  26. getAgreement() {
  27. this.$toast.loading({
  28. message: '加载中...',
  29. forbidClick: true,
  30. duration: 0,
  31. });
  32. this.$axios
  33. .$get('public/v4/agreement/content', {
  34. params: {
  35. agreementCoding: this.$route.query.agreementCoding,
  36. },
  37. })
  38. .then((res) => {
  39. if (res.success) {
  40. const html = res.data.content;
  41. const rx = /<body[^>]*>([\s\S]+?)<\/body>/i;
  42. let m = rx.exec(html);
  43. if (m) {
  44. m = m[1];
  45. }
  46. this.html = m;
  47. }
  48. })
  49. .catch((error) => {
  50. this.$toast(error.message);
  51. })
  52. .finally(() => {
  53. this.$toast.clear();
  54. });
  55. },
  56. goBack() {
  57. sessionStorage.setItem('isAgreementBool', 1);
  58. this.$router.go(-1);
  59. },
  60. },
  61. };
  62. </script>
  63. <style lang="less" scoped></style>