123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <script setup>
- import Container from "../../components/Container/Container.vue";
- import { onShow } from "@dcloudio/uni-app";
- import { request } from "../../utils/request";
- import { getRoute } from "../../utils/router";
- import uvParse from "../../uni_modules/uv-parse/components/uv-parse/uv-parse.vue";
- import { ref } from "vue";
- const replaceImageDimensions = (str) =>
- str
- .replace(
- /<img([^>]*?)style="([^"]*?)width:\s*[^;]+;\s*height:\s*[^;]+;([^"]*?)"([^>]*?)\/?>/g,
- '<img$1style="$2width:100%;height:100%;$3"$4/>'
- )
- .replace(
- /<img([^>]*?)width="[^"]*"([^>]*?)height="[^"]*"([^>]*?)\/?>/g,
- '<img$1width="100%"$2height="100%"$3/>'
- );
- const context = ref("");
- const titles = ref("");
- onShow(() => {
- /**
- * service_rights=会员服务权益,
- * automatic_renewal_agreement=自动续费协议
- * examination_countdown=倒计时,
- * challenge_activities=奖学金挑战信息
- */
- const { title, content_code } = getRoute().params;
- if (title) {
- titles.value = title;
- }
- request("api/question_bank/question_reception/common_config/detail", {
- content_code,
- }).then((res) => {
- context.value = res.data.content_detail || "";
- });
- });
- </script>
- <template>
- <Container :title="titles">
- <uvParse class="text" :content="replaceImageDimensions(context)"></uvParse>
- </Container>
- </template>
- <style scoped lang="scss">
- .text {
- line-height: 2;
- }
- </style>
|