| | |
| | | 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)"> |
| | | <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> |
| | | </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"> |
| | |
| | | |
| | | </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> |
| | |
| | | deleteHistoryListId, |
| | | myVideoHistory |
| | | } from "@/api/members.js"; |
| | | import storage from '@/utils/storage'; |
| | | |
| | | export default { |
| | | data() { |
| | |
| | | }, |
| | | |
| | | // 跳转到视频详情页 |
| | | 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}` |
| | | }, |
| | | |
| | | // 格式化日期 |
| | |
| | | }, |
| | | 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){ |
| | |
| | | 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) |
| | | ), |
| | | ]; |
| | | } |
| | | }) |
| | | } |
| | |
| | | * 删除足迹 |
| | | */ |
| | | 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 |
| | |
| | | |
| | | .video-item { |
| | | display: flex; |
| | | margin-bottom: 30rpx; |
| | | padding-bottom: 30rpx; |
| | | padding-bottom: 10rpx; |
| | | padding-left: 20rpx; |
| | | border-bottom: 1rpx solid #f5f5f5; |
| | | } |
| | | |