|
@@ -17,11 +17,12 @@ import useRequest from '../../hooks/useRequest'
|
|
|
import dayjs from 'dayjs'
|
|
|
import Menus from './components/menus.vue'
|
|
|
import ScheduleCard from './components/schedule-card.vue'
|
|
|
-import { getCircles } from '../../core/libs/requests'
|
|
|
+import { getCircles, getSetIndexConfigs } from '../../core/libs/requests'
|
|
|
|
|
|
defineOptions({
|
|
|
name: 'Home',
|
|
|
})
|
|
|
+const instance = getCurrentInstance()
|
|
|
// 测试 uni API 自动引入
|
|
|
const { data } = useRequest(async () => ({ code: 0, msg: '', data: {} }) as IResData<any>, {
|
|
|
initialData: {
|
|
@@ -94,29 +95,62 @@ const { data } = useRequest(async () => ({ code: 0, msg: '', data: {} }) as IRes
|
|
|
},
|
|
|
})
|
|
|
const { data: circlesData, run } = useRequest(() => getCircles({}), { initialData: { list: [] } })
|
|
|
-console.log(data.value)
|
|
|
+const { data: indexConfigsData, run: setIndexConfigsData } = useRequest(
|
|
|
+ () => getSetIndexConfigs(),
|
|
|
+ { initialData: { list: [] } },
|
|
|
+)
|
|
|
+const indexVideoContexts = ref([])
|
|
|
+
|
|
|
onShow(async () => {
|
|
|
await run()
|
|
|
console.log(circlesData.value)
|
|
|
})
|
|
|
-onLoad(() => {})
|
|
|
+onLoad(async () => {
|
|
|
+ await setIndexConfigsData()
|
|
|
+ console.log(indexConfigsData.value)
|
|
|
+ indexVideoContexts.value = indexConfigsData.value.list.map((it) =>
|
|
|
+ uni.createVideoContext(`video-${it.id}`, instance),
|
|
|
+ )
|
|
|
+ console.log(indexVideoContexts.value)
|
|
|
+})
|
|
|
onShareAppMessage(() => ({}))
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<view class="">
|
|
|
- <view class="bg-black w-full pos-relative aspect-[1.26/1]">
|
|
|
- <wd-img custom-class="w-[375px] h-[297px]" src="https://via.placeholder.com/375x297" />
|
|
|
- <div
|
|
|
- class="w-[375px] h-[90px] bg-gradient-to-t from-black to-black/0 absolute left-0 bottom-0 w-full flex items-center"
|
|
|
- >
|
|
|
- <!-- <div class="w-[82px] h-[33px] rounded-[60px] border border-white"></div> -->
|
|
|
- <view class="mx-7">
|
|
|
- <wd-button plain custom-class="bg-transparent! border-white! text-white!">
|
|
|
- 02:30
|
|
|
- </wd-button>
|
|
|
- </view>
|
|
|
- </div>
|
|
|
+ <view class="bg-black w-full relative aspect-[1.26/1]">
|
|
|
+ <swiper>
|
|
|
+ <template
|
|
|
+ v-for="{ id, coverVideoImage, indexPromotionalVideoImage } of indexConfigsData.list"
|
|
|
+ :key="id"
|
|
|
+ >
|
|
|
+ <swiper-item>
|
|
|
+ <div class="w-full h-full relative">
|
|
|
+ <video
|
|
|
+ class="w-full h-full"
|
|
|
+ :id="`video-${id}`"
|
|
|
+ :src="indexPromotionalVideoImage"
|
|
|
+ ></video>
|
|
|
+ <div class="absolute left-0 top-0 w-full h-full bg-black">
|
|
|
+ <wd-img width="100%" height="100%" :src="coverVideoImage" />
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ 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">
|
|
|
+ <wd-button
|
|
|
+ plain
|
|
|
+ custom-class="bg-transparent! border-white! text-white!"
|
|
|
+ icon="play"
|
|
|
+ >
|
|
|
+ 02:30
|
|
|
+ </wd-button>
|
|
|
+ </view>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </swiper-item>
|
|
|
+ </template>
|
|
|
+ </swiper>
|
|
|
</view>
|
|
|
<view class="bg-[#f6f6f6] relative bottom-4 rounded-t-2xl py-1">
|
|
|
<ScheduleCard custom-class="my-6 mx-3.5"></ScheduleCard>
|