<script setup lang='ts'>

// import { DynamicApi } from "@/api/api/dynamic/index";
// import { showToast } from "vant";

const router = useRouter()
// const route = useRoute()




export type dynamicDetailType = {
  id: number
  title: string
  thebm: string
  abstract: string
  mainBody: string
  videos: string[]
  releaseTime: string
}

const dynamicDetail = ref({} as dynamicDetailType)



onBeforeMount(async () => {
  // 获取活动详情
  // const res: any = await DynamicApi.getDetailById(Number(route.params.id))
  // if (res.code == 0) {
  //   dynamicDetail.value = res.data

  // } else {
  //   showToast('活动信息获取失败')
  // }

  dynamicDetail.value = {
    id: 7,
    title: '宁国博物馆开放日',
    thebm: 'https://n.sinaimg.cn/sinakd20112/0/w2048h1152/20220428/03e8-399a8decd0e38baf901f375ef9a4c050.jpg',
    abstract: '这是摘要这是摘要',
    mainBody: '<p><span style="color:#000000"><span style="font-size:14px"><span style="background-color:#ffffff">完成任一环节（浇水，施肥，除虫，修剪）均可得分</span></span></span></p><p><span style="color:#000000"><span style="font-size:14px"><span style="background-color:#ffffff">每天只可游玩一次，每天凌晨重置，重置后可再次游玩</span></span></span></p><div class="media-wrap image-wrap"><img class="media-wrap image-wrap" src="/prize/img/20240110_1200510961.png"/></div><p></p><p></p><p></p><p></p><p></p>',
    videos: [
      'https://wxfalangchang.4dage.com/national/1687243969660/thumb/20230710_094753323140.mp4'
    ],
    releaseTime: '2023-12-27'
  }

})
</script>

<template>
  <div class='detail-box'>
    <img class="themb-box" :src="dynamicDetail.thebm" alt="">
    <div class="content-box">
      <div class="title-box">{{ dynamicDetail.title }}</div>
      <div class="time-box">发布时间：{{ dynamicDetail.releaseTime }}</div>
      <div class="abstract-box">{{ dynamicDetail.abstract }}</div>
      <div class="mainbody-box" v-html="dynamicDetail.mainBody"></div>
      <div class="video-box">
        <video :src="item" controls v-for="(item, index) in dynamicDetail.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%;

  .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;
    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';


    }

    .mainbody-box {
      white-space: pre;
      margin-bottom: 10px;
      padding: 0 10px;


    }

    .video-box {
      width: 100%;

      video {
        width: 100%;
        margin-bottom: 10px;
      }

    }

  }


  .back-icon {
    width: 40px;
    position: fixed;
    right: 10px;
    bottom: 10vh;
  }
}
</style>