From 7ae4e27a487e282b60dc65d7836d1bcd86e7a464 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期一, 27 十月 2025 16:51:43 +0800
Subject: [PATCH] 主页页面,活动弹窗,图片适配
---
pages/mine/myTracks.vue | 103 ++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 76 insertions(+), 27 deletions(-)
diff --git a/pages/mine/myTracks.vue b/pages/mine/myTracks.vue
index bd4c2f3..2c955fe 100644
--- a/pages/mine/myTracks.vue
+++ b/pages/mine/myTracks.vue
@@ -30,23 +30,39 @@
v-for="(item, index) in videoHistory"
:key="index"
class="video-item"
- @click="goToVideoDetail(item)"
+ @click="goToVideoPlay(item, index)"
>
<u-swipe-action style="width: 100%;" :show="item.show" :index="index" :key="item.id"
- @click="delTracks" @open="open" :options="options">
- <image class="video-cover" :src="item.coverUrl" mode="aspectFill"></image>
- <view class="video-info">
- <view class="video-title">{{item.title}}</view>
- <view class="video-author">{{item.authorName}}</view>
- <view class="video-meta">
- <text>鎾斁鑷�: {{formatPlayTime(item.playAt)}}</text>
- <text class="separator">|</text>
- <text>{{formatDate(item.playTime)}}</text>
- </view>
+ @click="deleteVideoView(item.id)" @open="open" :options="options">
+ <view style="display: flex;" @click="goToVideoPlay(item, index)">
+ <video
+ class="video-cover"
+ :src="item.videoUrl"
+ controls="false"
+ :autoplay="false"
+ :loop="false"
+ :show-center-play-btn="false"
+ :show-play-btn="false"
+ :show-fullscreen-btn="false"
+ allow-fullscreen="false"
+ :disableProgressGesture="true"
+ :enablePlayGesture="false"
+ :show-background-playback-button="false"
+ ></video>
+ <view class="video-info">
+ <view class="video-title">{{item.title}}</view>
+ <view class="video-author">{{item.authorName}}</view>
+ <view class="video-meta">
+ <text>鎾斁鑷�: {{formatPlayTime(item.playAt)}}</text>
+ <text class="separator">|</text>
+ <text>{{formatDate(item.playTime)}}</text>
+ </view>
+ </view>
</view>
+
</u-swipe-action>
</view>
- <div @click="handleClickDeleteSelected" v-if="isEdit" class="submit">
+ <div @click="deleteVideoView(item.id)" v-if="isEdit" class="submit">
鍒犻櫎鎵�閫�
</div>
<view v-if="videoHistory.length === 0" class="empty-tip">
@@ -83,11 +99,11 @@
</view>
<view class="myTracks-divider"></view>
-
+ <div @click="handleClickDeleteSelected(item.id)" v-if="isEdit" class="submit">
+ 鍒犻櫎鎵�閫�
+ </div>
</view>
- <div @click="handleClickDeleteSelected" v-if="isEdit" class="submit">
- 鍒犻櫎鎵�閫�
- </div>
+
<view v-if="trackList.length === 0" class="empty-tip">
鏆傛棤鍟嗗搧娴忚璁板綍
</view>
@@ -104,6 +120,7 @@
deleteHistoryListId,
myVideoHistory
} from "@/api/members.js";
+import storage from '@/utils/storage';
export default {
data() {
@@ -149,20 +166,31 @@
// 鍒囨崲tab
switchTab(tab) {
this.activeTab = tab
+ if(this.activeTab ==="goods"){
+ this.getList()
+ }
},
// 璺宠浆鍒拌棰戣鎯呴〉
- goToVideoDetail(item) {
- uni.navigateTo({
- url: `/pages/video-detail/video-detail?id=${item.id}`
- })
+ goToVideoPlay(item, index) {
+ const playInfo = {
+ videoList: this.videoHistory,
+ nomore: true,
+ pageNumber: this.params.pageNumber,
+ playIndex: index
+ }
+ uni.setStorageSync("playInfo", playInfo)
+ uni.navigateTo({
+ url: `/pages/video/video-play?authorId=${storage.getUserInfo().id}&videoFrom=history`
+ })
},
// 鏍煎紡鍖栨挱鏀炬椂闂� (绉� -> 鍒�:绉�)
formatPlayTime(seconds) {
- const mins = Math.floor(seconds / 60)
- const secs = seconds % 60
- return `${mins}:${secs < 10 ? '0' + secs : secs}`
+ const secsInt = Math.floor(seconds); // 鍘绘帀灏忔暟閮ㄥ垎
+ const mins = Math.floor(secsInt / 60)
+ const secs = secsInt % 60
+ return `${mins}:${secs < 10 ? '0' + secs : secs}`
},
// 鏍煎紡鍖栨棩鏈�
@@ -191,6 +219,22 @@
},
checkboxChangeDP(val){
console.log(val)
+ },
+ // 鍒犻櫎瑙嗛娴忚璁板綍
+ deleteVideoView(id) {
+ deleteHistoryListId([id], 'video').then((res) => {
+ if (res.data.code == 200) {
+ this.videoHistory = [];
+ this.params.pageNumber = 1
+ this.getList();
+ } else {
+ uni.showToast({
+ title: res.data.message,
+ duration: 2000,
+ icon: "none",
+ });
+ }
+ });
},
// 鍒犻櫎鎵�閫夌殑鏁版嵁
handleClickDeleteSelected(val){
@@ -267,7 +311,12 @@
if (data.total == 0) {
this.whetherEmpty = true;
} else {
- this.videoHistory.push(...data);
+ this.videoHistory = [
+ ...this.videoHistory,
+ ...res.data.data.filter(
+ (newItem) => !this.videoHistory.some((oldItem) => oldItem.id === newItem.id)
+ ),
+ ];
}
})
}
@@ -277,7 +326,7 @@
* 鍒犻櫎瓒宠抗
*/
delTracks(index,ids) {
- deleteHistoryListId(ids || this.trackList[index].goodsId).then((res) => {
+ deleteHistoryListId(ids || this.trackList[index].goodsId, 'goods').then((res) => {
if (res.data.code == 200) {
this.trackList = [];
this.params.pageNumber = 1
@@ -456,8 +505,8 @@
.video-item {
display: flex;
- margin-bottom: 30rpx;
- padding-bottom: 30rpx;
+ padding-bottom: 10rpx;
+ padding-left: 20rpx;
border-bottom: 1rpx solid #f5f5f5;
}
--
Gitblit v1.8.0