<route lang="json">
{
  "style": {
    "navigationBarTitleText": "活动图片",
    "navigationBarBackgroundColor": "#ffffff"
  }
}
</route>
<script setup lang="ts">
import { getPhotoList } from '../../../../core/libs/requests'

const id = ref()
const type = ref()
const { data, run: setData } = useRequest(
  () =>
    getPhotoList({
      bizId: id.value,
      bizType: { studyTour: '2', activity: '1' }[type.value],
      pageSize: -1,
    }),
  { initialData: { list: [], total: 0 } },
)
onLoad(async (query: { id: string; type: 'activity' | 'studyTour'; title: string }) => {
  uni.setNavigationBarTitle({ title: query.title })
  id.value = query.id
  type.value = query.type
  await setData()
})
</script>
<template>
  <div class="flex flex-col flex-grow p-4 bg-white gap-4">
    <template v-for="(it, i) in data.list" :key="i">
      <template v-for="(video, index) in it.video" :key="index">
        <video class="w-full" :src="video"></video>
      </template>
      <template v-for="(img, index) in it.picture" :key="index">
        <wd-img width="100%" mode="widthFix" :src="img" />
      </template>
    </template>
  </div>
</template>
