|
@@ -29,16 +29,15 @@ import { useUserStore } from '../../store'
|
|
defineOptions({
|
|
defineOptions({
|
|
name: 'Home',
|
|
name: 'Home',
|
|
})
|
|
})
|
|
-const instance = getCurrentInstance()
|
|
|
|
const userStore = useUserStore()
|
|
const userStore = useUserStore()
|
|
const { userInfo } = storeToRefs(userStore)
|
|
const { userInfo } = storeToRefs(userStore)
|
|
-const { isLogined, isDesigner, features } = usePermissions()
|
|
|
|
|
|
+const { features } = usePermissions()
|
|
const pageHelperRef = ref<ComponentExposed<typeof PageHelper>>()
|
|
const pageHelperRef = ref<ComponentExposed<typeof PageHelper>>()
|
|
const { data: indexConfigsData, run: setIndexConfigsData } = useRequest(
|
|
const { data: indexConfigsData, run: setIndexConfigsData } = useRequest(
|
|
() => getSetIndexConfigs(),
|
|
() => getSetIndexConfigs(),
|
|
{ initialData: { list: [] } },
|
|
{ initialData: { list: [] } },
|
|
)
|
|
)
|
|
-const swiperData = ref<{ data: any; videoContext: UniNamespace.VideoContext; playing: boolean }[]>()
|
|
|
|
|
|
+const swiperData = ref<{ data: any }[]>()
|
|
const swiperCurrent = ref(0)
|
|
const swiperCurrent = ref(0)
|
|
|
|
|
|
onShow(async () => {
|
|
onShow(async () => {
|
|
@@ -48,8 +47,6 @@ onLoad(async () => {
|
|
await setIndexConfigsData()
|
|
await setIndexConfigsData()
|
|
swiperData.value = indexConfigsData.value.list.map((it) => ({
|
|
swiperData.value = indexConfigsData.value.list.map((it) => ({
|
|
data: it,
|
|
data: it,
|
|
- videoContext: uni.createVideoContext(`video-${it.id}`, instance),
|
|
|
|
- playing: false,
|
|
|
|
}))
|
|
}))
|
|
})
|
|
})
|
|
const toAbout = () => {
|
|
const toAbout = () => {
|
|
@@ -58,10 +55,6 @@ const toAbout = () => {
|
|
const handleSwiperChange = ({ detail: { current } }) => {
|
|
const handleSwiperChange = ({ detail: { current } }) => {
|
|
swiperCurrent.value = current
|
|
swiperCurrent.value = current
|
|
}
|
|
}
|
|
-const handlePlay = () => {
|
|
|
|
- swiperData.value[swiperCurrent.value].videoContext.play()
|
|
|
|
- swiperData.value[swiperCurrent.value].playing = true
|
|
|
|
-}
|
|
|
|
const handleLike = async (options) => {
|
|
const handleLike = async (options) => {
|
|
await handleUpvoteClick({
|
|
await handleUpvoteClick({
|
|
...options,
|
|
...options,
|
|
@@ -90,20 +83,11 @@ onShareAppMessage(async ({ from, target }) => {
|
|
<view class="bg-black w-full relative aspect-[1.26/1]">
|
|
<view class="bg-black w-full relative aspect-[1.26/1]">
|
|
<swiper @change="handleSwiperChange">
|
|
<swiper @change="handleSwiperChange">
|
|
<template
|
|
<template
|
|
- v-for="{
|
|
|
|
- data: { id, coverVideoImage, indexPromotionalVideoImage },
|
|
|
|
- videoContext,
|
|
|
|
- playing,
|
|
|
|
- } of swiperData"
|
|
|
|
|
|
+ v-for="{ data: { id, coverVideoImage, indexPromotionalVideoImage } } of swiperData"
|
|
:key="id"
|
|
:key="id"
|
|
>
|
|
>
|
|
<swiper-item>
|
|
<swiper-item>
|
|
- <HomeBanner
|
|
|
|
- :id="id"
|
|
|
|
- :url="indexPromotionalVideoImage"
|
|
|
|
- :cover="coverVideoImage"
|
|
|
|
- :playing="playing"
|
|
|
|
- />
|
|
|
|
|
|
+ <HomeBanner :id="id" :url="indexPromotionalVideoImage" :cover="coverVideoImage" />
|
|
<!-- <div class="w-full h-full relative">
|
|
<!-- <div class="w-full h-full relative">
|
|
<video
|
|
<video
|
|
class="w-full h-full"
|
|
class="w-full h-full"
|