|
@@ -7,18 +7,32 @@
|
|
|
}
|
|
|
</route>
|
|
|
<script setup lang="ts">
|
|
|
-import { getPhotoList } from '../../../../core/libs/requests'
|
|
|
+import { getPhotoList, getPhotoList2 } from '../../../../core/libs/requests'
|
|
|
import SectionHeading from '@/components/section-heading.vue'
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
|
const id = ref()
|
|
|
const type = ref()
|
|
|
+const img = ref()
|
|
|
+const pageNo = ref(1)
|
|
|
+const imgList = ref([])
|
|
|
+const more = ref(false)
|
|
|
const { data, run: setData } = useRequest(
|
|
|
() =>
|
|
|
getPhotoList({
|
|
|
bizId: id.value,
|
|
|
bizType: { studyTour: '2', activity: '1' }[type.value],
|
|
|
- pageSize: -1,
|
|
|
+ pageSize: 10,
|
|
|
+ }),
|
|
|
+ { initialData: { list: [], total: 0 } },
|
|
|
+)
|
|
|
+const { data: imgData, run: setImgData } = useRequest(
|
|
|
+ () =>
|
|
|
+ getPhotoList2({
|
|
|
+ id: img.value?.id,
|
|
|
+ bizType: { studyTour: '2', activity: '1' }[type.value],
|
|
|
+ pageNo:pageNo.value,
|
|
|
+ pageSize: 10,
|
|
|
}),
|
|
|
{ initialData: { list: [], total: 0 } },
|
|
|
)
|
|
@@ -29,25 +43,53 @@ const previewImg = (i,index) => {
|
|
|
current:index
|
|
|
})
|
|
|
}
|
|
|
+const previewImgNew = (i) => {
|
|
|
+ console.log(data)
|
|
|
+ uni.previewImage({
|
|
|
+ urls:[i]
|
|
|
+ })
|
|
|
+}
|
|
|
+onReachBottom(async ()=>{
|
|
|
+ console.log("11111")
|
|
|
+ if(!more.value){
|
|
|
+ pageNo.value ++
|
|
|
+ let imgInfo = await setImgData()
|
|
|
+ imgList.value = imgList.value.concat(imgInfo.list)
|
|
|
+ if(imgList.value.length >= imgInfo.total){
|
|
|
+ more.value = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+})
|
|
|
onLoad(async (query: { id: string; type: 'activity' | 'studyTour'; title: string }) => {
|
|
|
await uni.setNavigationBarTitle({ title: query.title })
|
|
|
id.value = query.id
|
|
|
type.value = query.type
|
|
|
- await setData()
|
|
|
+ let res = await setData();
|
|
|
+ console.log(res.list)
|
|
|
+ if(res.list.length > 0){
|
|
|
+ img.value = res.list[0]
|
|
|
+ let imgInfo = await setImgData()
|
|
|
+ imgList.value = imgInfo.list
|
|
|
+ if(imgList.value.length >= imgInfo.total){
|
|
|
+ more.value = true
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
</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="(it, i) in imgList" :key="i">
|
|
|
<SectionHeading
|
|
|
- :title="'第' + Number(i + 1) + '天 ' + dayjs(it.travelDate).format('YYYY-MM-DD')"
|
|
|
+ :title="'第' + Number(i + 1) + '天 ' + dayjs(img.travelDate).format('YYYY-MM-DD')"
|
|
|
></SectionHeading>
|
|
|
- <template v-for="(video, index) in it.video" :key="index">
|
|
|
+ <video v-if="it.type=='1'" class="w-full" :src="it.url"></video>
|
|
|
+ <wd-img v-else width="100%" mode="widthFix" :src="it.url" @click="previewImgNew(it.url)" />
|
|
|
+ <!-- <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" @click="previewImg(i,index)" />
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
</template>
|
|
|
</div>
|
|
|
</template>
|