From 8a2d6949a4525f90e0e75f2f3f83c13b8830a758 Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期五, 08 八月 2025 17:37:50 +0800 Subject: [PATCH] 修改商品广场和购物车 --- pages/video/home-page.vue | 68 +++++++++++++++++++++++++-------- 1 files changed, 51 insertions(+), 17 deletions(-) diff --git a/pages/video/home-page.vue b/pages/video/home-page.vue index b9a7b49..de28ae4 100644 --- a/pages/video/home-page.vue +++ b/pages/video/home-page.vue @@ -74,7 +74,16 @@ v-for="(item, index) in videoList" :key="item.id" > - <image class="video-cover" @click="playAuthorVideo(index)" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image> + <image v-if="item.videoContentType === 'img'" class="video-cover" @click="playAuthorVideo(index)" :src="item.imgs[0]" mode="aspectFill"></image> + <!-- <image class="video-cover" @click="playAuthorVideo(index)" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image> --> + <video v-else :src="item.videoUrl" + :poster-for-crawler='item.coverUrl' + object-fit='"cover"' + :show-fullscreen-btn='false' + :show-play-btn='false' + :show-center-play-btn='false' + :enable-progress-gesture='false' + class="video-cover" @click="playAuthorVideo(index)"></video> <view class="video-info"> <view class="video-stats"> <view class="stat"> @@ -103,7 +112,16 @@ :key="item.id" @click="playCollectVideo(index)" > - <image class="video-cover" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image> + <image v-if="tem.videoContentType === 'img'" class="video-cover" :src="item.imgs[0]" mode="aspectFill"></image> + <video v-else class="video-cover" + :src="item.videoUrl" + initial-time='0.01' + muted + :controls="false" + :show-center-play-btn="false" + object-fit="cover"></video> + + <!-- <image class="video-cover" :src="getCoverUrl(item)"></image> --> <view class="video-info"> <view class="video-stats"> <view class="stat"> @@ -123,7 +141,13 @@ :key="item.id" @click="playLikeVideo(index)" > - <image class="video-cover" :src="item.videoContentType === 'video' ? item.coverUrl : item.imgs[0]" mode="aspectFill"></image> + <video class="video-cover" + :src="item.videoContentType === 'video' ? item.videoUrl : item.imgs[0]" mode="aspectFill" + initial-time='0.01' + muted + :controls="false" + :show-center-play-btn="false" + object-fit="cover"></video> <view class="video-info"> <view class="video-stats"> <view class="stat"> @@ -167,7 +191,7 @@ </template> <script> -import DropdownMenu from '@/components/dropdown-menu.vue' +import DropdownMenu from '@/pages/video/dropdown-menu.vue' import {getAuthorInfo, getAuthorVideoPage, getAuthorCollectVideoPage, getAuthorLikeVideoPage} from '@/api/user.js' import {subscribe, unSubscribe, delVideo, updateVideo, userDownVideo} from '@/api/video.js' @@ -222,27 +246,37 @@ } }, onShow() { - this.getAuthorInfo(); - if (this.currentTab === 'works') { - this.videoQuery.pageNumber = 1 - this.nomoreVideo = false - this.getAuthorVideoPage(); - } else if (this.currentTab === 'collect') { - this.collectVideoQuery.pageNumber = 1 - this.nomoreCollectVideo = false - this.getAuthorCollectVideoPage() - } else if (this.currentTab === 'likes') { - this.likeVideoQuery.pageNumber = 1 - this.nomoreLikeVideo = false - this.getAuthorLikeVideoPage() + if (this.authorId) { + this.getAuthorInfo(); + if (this.currentTab === 'works') { + this.videoQuery.pageNumber = 1 + this.nomoreVideo = false + this.getAuthorVideoPage(); + } else if (this.currentTab === 'collect') { + this.collectVideoQuery.pageNumber = 1 + this.nomoreCollectVideo = false + this.getAuthorCollectVideoPage() + } else if (this.currentTab === 'likes') { + this.likeVideoQuery.pageNumber = 1 + this.nomoreLikeVideo = false + this.getAuthorLikeVideoPage() + } } }, onLoad(option) { + console.log("鏀跺埌鍙傛暟", option); this.authorId = option.authorId; this.getAuthorInfo(); this.getAuthorVideoPage(); }, methods: { + getCoverUrl(item) { + if (item.videoContentType === 'video') { + // OSS瑙嗛灏侀潰鍙傛暟锛堝畬鏁存牸寮忥級 + return `${item.videoUrl}?x-oss-process=video/snapshot,t_1000,f_jpg,m_fast` + } + return item.imgs?.[0] + }, dialogClose() { this.opVideo = { id: '', -- Gitblit v1.8.0