indexPolicyPreview.vue 699 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <div class="tos-container">
  3. <el-card>
  4. <div v-html="tosContent"></div>
  5. </el-card>
  6. </div>
  7. </template>
  8. <script setup lang="ts">
  9. import { ref, onMounted } from 'vue';
  10. import DOMPurify from 'dompurify';
  11. import { getPrivacyPolicyListMax } from '@/api/system/business/policy';
  12. const tosContent = ref('');
  13. const language = ref('zh-CN');
  14. onMounted(() => {
  15. fetchTos();
  16. });
  17. const fetchTos = async () => {
  18. try {
  19. const res = await getPrivacyPolicyListMax();
  20. tosContent.value = DOMPurify.sanitize(res.data.content);
  21. } catch (error) {
  22. console.error('获取服务条款失败', error);
  23. }
  24. };
  25. </script>
  26. <style scoped>
  27. .tos-container {
  28. padding: 20px;
  29. }
  30. </style>