agreement.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <layout :bgImgName="null" :bgHeight="null" :bgColor="null" @goBack="goBack">
  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. components: {
  16. layout,
  17. },
  18. mounted() {
  19. this.getAgreement();
  20. },
  21. methods: {
  22. getAgreement() {
  23. this.$toast.loading({
  24. message: '加载中...',
  25. forbidClick: true,
  26. duration: 0,
  27. });
  28. this.$axios
  29. .$get('public/v4/agreement/content', {
  30. params: {
  31. agreementCoding: this.$route.query.agreementCoding,
  32. },
  33. })
  34. .then((res) => {
  35. if (res.success) {
  36. const html = res.data.content;
  37. const rx = /<body[^>]*>([\s\S]+?)<\/body>/i;
  38. let m = rx.exec(html);
  39. if (m) {
  40. m = m[1];
  41. }
  42. this.html = m;
  43. }
  44. })
  45. .catch((error) => {
  46. this.$toast(error.message);
  47. })
  48. .finally(() => {
  49. this.$toast.clear();
  50. });
  51. },
  52. goBack() {
  53. sessionStorage.setItem('isAgreementBool', 1)
  54. this.$router.go(-1)
  55. }
  56. },
  57. };
  58. </script>
  59. <style lang="less" scoped></style>