feat: 更新视频播放功能

This commit is contained in:
2026-09-10 18:58:31 +08:00
parent f7220fd98c
commit d43d61e6fb
3 changed files with 18 additions and 8 deletions

View File

@@ -20,7 +20,8 @@
border border
> >
<wd-form-item title="内容"> <wd-form-item title="内容">
<wd-textarea v-model="recordStore.recordForm.content" :maxlength="200" clearable show-word-limit placeholder="请输入内容" /> <wd-textarea v-model="recordStore.recordForm.content" :maxlength="200"
auto-height clearable show-word-limit placeholder="请输入内容" />
</wd-form-item> </wd-form-item>
<wd-form-item title="图片"> <wd-form-item title="图片">

View File

@@ -33,8 +33,9 @@
> >
<wd-img <wd-img
:src="`${appStore.baseUrl}/${url}`" :src="`${appStore.baseUrl}/${url}`"
height="35vh"
width="100%" width="100%"
mode="widthFix" mode="aspectFill"
lazy-load lazy-load
:radius="8" :radius="8"
/> />
@@ -46,11 +47,16 @@
v-for="(url, i) in item.video_list" v-for="(url, i) in item.video_list"
:key="i" :key="i"
class="relative w-full overflow-hidden rounded-lg bg-black" class="relative w-full overflow-hidden rounded-lg bg-black"
@click="playVideo(url)"
> >
<view class="w-full h-[360rpx] flex items-center justify-center"> <video
<wd-icon name="play-circle-fill" size="40px" color="#fff" /> :id="`video-${item.id}-${i}`"
</view> :src="`${appStore.baseUrl}/${url}`"
:autoplay="false"
:loop="false"
:show-mute-btn="true"
:enable-play-gesture="true"
:object-fit="'cover'"
/>
</view> </view>
</view> </view>
</view> </view>
@@ -97,7 +103,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref } from 'vue' import { computed, ref, watch } from 'vue'
import { useAppStore } from "@/store/app"; import { useAppStore } from "@/store/app";
import { useRecordStore } from "@/store/record"; import { useRecordStore } from "@/store/record";
import { useUserStore } from "@/store/user"; import { useUserStore } from "@/store/user";
@@ -163,6 +169,8 @@ const paging = ref(null)
// v-model绑定的这个变量不要在分页请求结束中自己赋值直接使用即可 // v-model绑定的这个变量不要在分页请求结束中自己赋值直接使用即可
const dataList = ref([]) const dataList = ref([])
watch(() => recordStore.isRefresh, () => paging.value.reload())
function queryList(pageNo, pageSize) { function queryList(pageNo, pageSize) {
recordStore.getRecordListByPageApi(pageNo, pageSize).then(res => { recordStore.getRecordListByPageApi(pageNo, pageSize).then(res => {
paging.value.complete(res.records); paging.value.complete(res.records);

View File

@@ -14,6 +14,7 @@ export const useRecordStore = defineStore('record', {
} as IRecordForm, } as IRecordForm,
currentRecordId: 0, currentRecordId: 0,
showRecordPopup: false, showRecordPopup: false,
isRefresh: false,
recordApiType: 'ADD' as 'ADD' | 'UPDATE' | 'DELETE', recordApiType: 'ADD' as 'ADD' | 'UPDATE' | 'DELETE',
imageFileList: [] as UploadFile[], imageFileList: [] as UploadFile[],
videoFileList: [] as UploadFile[], videoFileList: [] as UploadFile[],
@@ -28,7 +29,7 @@ export const useRecordStore = defineStore('record', {
await this.deleteRecordApi() await this.deleteRecordApi()
} }
await this.refreshRecord() this.isRefresh = !this.isRefresh
}, },
async refreshRecord() { async refreshRecord() {
this.recordList = await this.getRecordListApi() this.recordList = await this.getRecordListApi()