|
@@ -28,32 +28,42 @@ const { data: indexConfigsData, run: setIndexConfigsData } = useRequest(
|
|
() => getSetIndexConfigs(),
|
|
() => getSetIndexConfigs(),
|
|
{ initialData: { list: [] } },
|
|
{ initialData: { list: [] } },
|
|
)
|
|
)
|
|
-const indexVideoContexts = ref([])
|
|
|
|
|
|
+const swiperData = ref<{ data: any; videoContext: UniNamespace.VideoContext; playing: boolean }[]>()
|
|
|
|
+const swiperCurrent = ref(0)
|
|
|
|
|
|
onShow(async () => {
|
|
onShow(async () => {
|
|
await run()
|
|
await run()
|
|
- console.log(circlesData.value)
|
|
|
|
})
|
|
})
|
|
onLoad(async () => {
|
|
onLoad(async () => {
|
|
await setIndexConfigsData()
|
|
await setIndexConfigsData()
|
|
- console.log(indexConfigsData.value)
|
|
|
|
- indexVideoContexts.value = indexConfigsData.value.list.map((it) =>
|
|
|
|
- uni.createVideoContext(`video-${it.id}`, instance),
|
|
|
|
- )
|
|
|
|
- console.log(indexVideoContexts.value)
|
|
|
|
|
|
+ swiperData.value = indexConfigsData.value.list.map((it) => ({
|
|
|
|
+ data: it,
|
|
|
|
+ videoContext: uni.createVideoContext(`video-${it.id}`, instance),
|
|
|
|
+ playing: false,
|
|
|
|
+ }))
|
|
})
|
|
})
|
|
const toAbout = () => {
|
|
const toAbout = () => {
|
|
uni.navigateTo({ url: '/pages/home/about/index' })
|
|
uni.navigateTo({ url: '/pages/home/about/index' })
|
|
}
|
|
}
|
|
|
|
+const handleSwiperChange = ({ detail: { current } }) => {
|
|
|
|
+ swiperCurrent.value = current
|
|
|
|
+}
|
|
|
|
+const handlePlay = () => {
|
|
|
|
+ swiperData.value[swiperCurrent.value].videoContext.play()
|
|
|
|
+ swiperData.value[swiperCurrent.value].playing = true
|
|
|
|
+}
|
|
onShareAppMessage(() => ({}))
|
|
onShareAppMessage(() => ({}))
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
<view class="">
|
|
<view class="">
|
|
<view class="bg-black w-full relative aspect-[1.26/1]">
|
|
<view class="bg-black w-full relative aspect-[1.26/1]">
|
|
- <swiper>
|
|
|
|
|
|
+ <swiper @change="handleSwiperChange">
|
|
<template
|
|
<template
|
|
- v-for="{ id, coverVideoImage, indexPromotionalVideoImage } of indexConfigsData.list"
|
|
|
|
|
|
+ v-for="{
|
|
|
|
+ data: { id, coverVideoImage, indexPromotionalVideoImage },
|
|
|
|
+ playing,
|
|
|
|
+ } of swiperData"
|
|
:key="id"
|
|
:key="id"
|
|
>
|
|
>
|
|
<swiper-item>
|
|
<swiper-item>
|
|
@@ -63,10 +73,11 @@ onShareAppMessage(() => ({}))
|
|
:id="`video-${id}`"
|
|
:id="`video-${id}`"
|
|
:src="indexPromotionalVideoImage"
|
|
:src="indexPromotionalVideoImage"
|
|
></video>
|
|
></video>
|
|
- <div class="absolute left-0 top-0 w-full h-full bg-black">
|
|
|
|
|
|
+ <div v-if="!playing" class="absolute left-0 top-0 w-full h-full bg-black">
|
|
<wd-img width="100%" height="100%" :src="coverVideoImage" />
|
|
<wd-img width="100%" height="100%" :src="coverVideoImage" />
|
|
</div>
|
|
</div>
|
|
<div
|
|
<div
|
|
|
|
+ v-if="!playing"
|
|
class="w-[375px] h-[90px] bg-gradient-to-t from-black to-black/0 absolute left-0 bottom-0 w-full flex items-center"
|
|
class="w-[375px] h-[90px] bg-gradient-to-t from-black to-black/0 absolute left-0 bottom-0 w-full flex items-center"
|
|
>
|
|
>
|
|
<view class="mx-7">
|
|
<view class="mx-7">
|
|
@@ -74,6 +85,7 @@ onShareAppMessage(() => ({}))
|
|
plain
|
|
plain
|
|
custom-class="bg-transparent! border-white! text-white!"
|
|
custom-class="bg-transparent! border-white! text-white!"
|
|
icon="play"
|
|
icon="play"
|
|
|
|
+ @click="handlePlay"
|
|
>
|
|
>
|
|
02:30
|
|
02:30
|
|
</wd-button>
|
|
</wd-button>
|