123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- <script setup lang='ts'>
- import { DynamicApi } from '@/api/api/dynamic';
- import { showToast } from 'vant';
- import { baseIMGUrl } from '@/api/request.ts'
- // import { DynamicApi } from "@/api/api/dynamic/index";
- // import { showToast } from "vant";
- // const router = useRouter()
- const route = useRoute()
- export type dynamicDetailType = {
- createTime: string,
- creatorId: number,
- creatorName: string,
- description: string,
- dirCode: string,
- fileIds: string,
- files: any,
- id: number,
- name: string,
- publishDate: string,
- rtf: string,
- thumb: string,
- type: string,
- updateTime: string
- }
- const dynamicDetail = ref({} as dynamicDetailType)
- const videos = ref([] as any)
- const getDetailById = async () => {
- // 获取活动详情
- const res: any = await DynamicApi.getDetailById(Number(route.params.id))
- if (res.code == 0) {
- dynamicDetail.value = res.data
- videos.value = res.data.files.filter((item: any) => {
- return item.filePath.includes('.mp4')
- })
- } else {
- showToast(res.msg)
- }
- }
- const formatrtf = computed(() => {
- return dynamicDetail.value.rtf.replace(
- /<img /g,
- '<img style="width: 100%;" '
- ).replace(
- /<p\b[^>]*>/g,
- '<p style="width: 100%; word-wrap: break-word;">'
- );
- })
- onBeforeMount(async () => {
- getDetailById()
- })
- </script>
- <template>
- <div class='detail-box'>
- <img class="themb-box" :src="baseIMGUrl + dynamicDetail.thumb" alt="">
- <div class="content-box">
- <div class="title-box">{{ dynamicDetail.name }}</div>
- <div class="time-box">发布时间:{{ dynamicDetail.publishDate }}</div>
- <div class="abstract-box">{{ dynamicDetail.description }}</div>
- <div class="mainbody-box" v-html="formatrtf"></div>
- <div class="video-box">
- <video :src="baseIMGUrl + item.filePath" controls v-for="(item, index) in videos" :key="index"></video>
- </div>
- </div>
- <!-- <img class="back-icon" @click="() => { router.back() }" src="@/assets/images/back.png" alt=""> -->
- </div>
- </template>
- <style lang='less' scoped>
- .detail-box {
- width: 100%;
- min-height: 100%;
- overflow: auto;
- .themb-box {
- width: 100%;
- height: 30vh;
- object-fit: cover;
- }
- .content-box {
- width: 100%;
- height: calc(70vh + 25px);
- background: #F7F3E8;
- border-radius: 20px 20px 0 0;
- margin-top: -30px;
- position: relative;
- z-index: 2;
- padding: 8% 15px 8% 15px 20% 15px;
- box-sizing: border-box;
- overflow: auto;
- .title-box {
- font-size: 1.4em;
- font-weight: bold;
- line-height: 1.5em;
- color: #333333;
- margin-bottom: 10px;
- padding: 0 10px;
- font-family: 'SourceHanSansCN-Medium';
- margin-bottom: 5px;
- }
- .time-box {
- color: #9D4F0B;
- font-size: 0.9em;
- margin-bottom: 15px;
- padding: 0 10px;
- font-family: 'SourceHanSansCN-Regular';
- }
- .abstract-box {
- color: #88866F;
- font-size: 1em;
- margin-bottom: 10px;
- padding: 0 10px;
- font-family: 'SourceHanSansCN-Medium';
- overflow-wrap: break-word;
- }
- .mainbody-box {
- width: 100%;
- // white-space: pre;
- margin-bottom: 10px;
- padding: 0 10px;
- }
- .video-box {
- width: 100%;
- video {
- width: 100%;
- height: 30vh;
- margin-bottom: 10px;
- }
- }
- }
- // .back-icon {
- // width: 40px;
- // position: fixed;
- // right: 10px;
- // bottom: 10vh;
- // }
- }
- </style>
|