From a2386e559babca48004d45bf885032f470e37f4f Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期一, 08 九月 2025 15:31:30 +0800 Subject: [PATCH] 移除取消订单按钮 --- pages/video/home-page.vue | 181 +++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 164 insertions(+), 17 deletions(-) diff --git a/pages/video/home-page.vue b/pages/video/home-page.vue index 4aebb07..5580ded 100644 --- a/pages/video/home-page.vue +++ b/pages/video/home-page.vue @@ -50,15 +50,24 @@ > 浣滃搧{{`(${videoTotal})`}} </view> - <view + <view class="tab-item" - :class="{active: currentTab === 'likes'}" - @click="switchTab('likes')" + :class="{active: currentTab === 'collect'}" + @click="switchTab('collect')" > - 鍠滄 + 鏀惰棌 </view> + <view + class="tab-item" + :class="{active: currentTab === 'likes'}" + @click="switchTab('likes')" + > + 鍠滄 + </view> </view> - + + + <!-- 瑙嗛鍒楄〃 --> <scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'works' && videoList.length > 0"> <view class="video-container"> @@ -67,7 +76,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"> @@ -88,7 +106,10 @@ </view> </view> </scroll-view> - <scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'likes' && collectVideoList.length > 0"> + <view> + <mycollect v-show ="currentTab ==='collect'"></mycollect> + </view> + <!-- <scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'collect' && collectVideoList.length > 0"> <view class="video-container"> <view class="video-item" @@ -96,7 +117,42 @@ :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> + + + <view class="video-info"> + <view class="video-stats"> + <view class="stat"> + <uni-icons type="heart" size="16" color="#fff"></uni-icons> + <text>{{item.collectNum}}</text> + </view> + </view> + </view> + </view> + </view> + </scroll-view> --> + <scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'likes' && likeVideoList.length > 0"> + <view class="video-container"> + <view + class="video-item" + v-for="(item, index) in likeVideoList" + :key="item.id" + @click="playLikeVideo(index)" + > + <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"> @@ -115,7 +171,12 @@ <text class="empty-text">杩樻湭鍙戝竷浣滃搧鍝</text> </view> <!-- 绌虹姸鎬� --> - <view class="empty-state" v-if="collectVideoList.length === 0 && currentTab === 'likes'"> + <view class="empty-state" v-if="collectVideoList.length === 0 && currentTab === 'collect'"> + <!-- <image src="/static/images/empty.png" mode="aspectFit" class="empty-image"></image> --> + <text class="empty-text">杩樻病鏈夋敹钘忎綔鍝佸摝~</text> + </view> + <!-- 绌虹姸鎬� --> + <view class="empty-state" v-if="likeVideoList.length === 0 && currentTab === 'likes'"> <!-- <image src="/static/images/empty.png" mode="aspectFit" class="empty-image"></image> --> <text class="empty-text">杩樻病鏈夌偣璧炰綔鍝佸摝~</text> </view> @@ -135,12 +196,14 @@ </template> <script> -import DropdownMenu from '@/components/dropdown-menu.vue' +import DropdownMenu from '@/pages/video/dropdown-menu.vue' -import {getAuthorInfo, getAuthorVideoPage, getAuthorCollectVideoPage} from '@/api/user.js' +import {getAuthorInfo, getAuthorVideoPage, getAuthorCollectVideoPage, getAuthorLikeVideoPage} from '@/api/user.js' import {subscribe, unSubscribe, delVideo, updateVideo, userDownVideo} from '@/api/video.js' +import mycollect from '@/pages/video/myCollect.vue' export default { - components: {DropdownMenu}, + components: {DropdownMenu, + mycollect}, data() { return { options: [ @@ -175,22 +238,52 @@ pageNumber: 1, pageSize: 10 }, + likeVideoQuery: { + authorId: '', + pageNumber: 1, + pageSize: 10 + }, videoTotal: 0, videoList: [], // 浣滃搧 collectVideoList: [], // 鏀惰棌 + likeVideoList: [], // 鐐硅禐 nomoreVideo: false, - nomoreCollectVideo: false + nomoreCollectVideo: false, + nomoreLikeVideo: false, } }, onShow() { - this.getAuthorInfo(); + 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: '', @@ -261,7 +354,7 @@ this.videoQuery.pageNumber += 1; } }) - } else if(this.currentTab === 'likes') { + } else if(this.currentTab === 'collect') { if(this.nomoreCollectVideo) { return; } @@ -280,6 +373,27 @@ this.nomoreCollectVideo = true; } else { this.collectVideoQuery.pageNumber += 1; + } + }) + } else if(this.currentTab === 'likes') { + if(this.nomoreLikeVideo) { + return; + } + getAuthorLikeVideoPage(this.likeVideoQuery).then(res => { + if(this.likeVideoQuery.pageNumber === 1) { + this.likeVideoList = res.data.data + } else { + this.likeVideoList = [ + ...this.likeVideoList, + ...res.data.data.filter( + (newItem) => !this.likeVideoList.some((oldItem) => oldItem.id === newItem.id) + ), + ]; + } + if(res.data.data.length < this.likeVideoQuery.pageSize) { + this.nomoreLikeVideo = true; + } else { + this.likeVideoQuery.pageNumber += 1; } }) } @@ -333,14 +447,34 @@ this.currentTab = tab; if(tab === 'works') { this.collectVideoList = [] + this.likeVideoList = [] this.videoQuery.pageNumber = 1 + this.nomoreVideo = false this.getAuthorVideoPage() + } else if(tab === 'collect') { + this.videoList = [] + this.likeVideoList = [] + this.collectVideoQuery.pageNumber = 1 + this.nomoreCollectVideo = false + this.getAuthorCollectVideoPage() } else if(tab === 'likes') { this.videoList = [] - this.collectVideoQuery.pageNumber = 1 - this.getAuthorCollectVideoPage() + this.collectVideoList = [] + this.likeVideoQuery.pageNumber = 1 + this.nomoreLikeVideo = false + this.getAuthorLikeVideoPage() } }, + // 鑾峰彇浣滆�呭枩娆㈢殑瑙嗛 + async getAuthorLikeVideoPage() { + this.likeVideoQuery.authorId = this.authorId + getAuthorLikeVideoPage(this.likeVideoQuery).then(res => { + this.likeVideoList = res.data.data + if(res.data.data.length < this.likeVideoQuery.pageSize) { + this.nomoreLikeVideo = true; + } + }) + }, // 鑾峰彇浣滆�呯殑鏀惰棌瑙嗛 async getAuthorCollectVideoPage() { this.collectVideoQuery.authorId = this.authorId @@ -377,6 +511,19 @@ url: `/pages/video/video-play?authorId=${this.authorId}&videoFrom=collect` }); }, + // 鎾斁鐐硅禐瑙嗛 + playLikeVideo(index) { + const playInfo = { + videoList: this.likeVideoList, + nomore: this.nomoreLikeVideo, + pageNumber: this.likeVideoQuery.pageNumber, + playIndex: index + } + uni.setStorageSync("playInfo", playInfo) + uni.navigateTo({ + url: `/pages/video/video-play?authorId=${this.authorId}&videoFrom=like` + }); + }, // 缂栬緫涓汉璧勬枡 editInfo() { uni.navigateTo({ -- Gitblit v1.8.0