This commit is contained in:
zoujiandong
2025-11-20 10:29:35 +08:00
parent 76e619b85d
commit f4b1ef932d
10 changed files with 173 additions and 96 deletions
+39 -8
View File
@@ -115,9 +115,10 @@
</view>
<!-- 底部区域:信息页为下载条,评论页为上传图片+输入+发送 -->
<!-- <view v-if="activeTab === 'info'" class="bottom-download" @click="onDownload">
<text class="download-text">点击下载(限时<text class="discount">5</text>折,仅需{{videoInfo.point}}积分)</text>
</view> -->
<view v-if="activeTab === 'info'" class="bottom-download" @click="onDownload">
<text class="download-text" v-if="!hasDownload">点击下载<text v-if="!isVideoDownloadRecord">(限时<text class="discount">5</text>折,仅需{{videoInfo.point}}积分)</text></text>
<text class="download-text" v-else>查看缓存</text>
</view>
<view v-if="activeTab !== 'info'" class="bottom-comment">
<input
class="comment-input"
@@ -205,6 +206,10 @@ const notEnoughContent = ref("");
const welfareNum = ref(0);
const showVideo = ref(false);
const videoWidth = ref(375);
const hasDownload = ref(false);
let downList = uni.getStorageSync('downLoadVideo') || [];
const downLoadList = ref(downList);
//import DomVideoPlayer from 'uniapp-video-player'
const notEnoughConfirm = () => {
notEnoughVisible.value = false;
@@ -226,6 +231,7 @@ const toCollection = () => {
const networkConfirm = () => {
networkVisible.value = false;
pointVisible.value = true;
downAndSave(videoSrc.value,video_uuid.value);
};
const addVideoWatchRecord = async () => {
const res = await api.addVideoWatchRecord({
@@ -253,7 +259,7 @@ const videoDetail = async () => {
if (res.code == 200) {
const userInfo = uni.getStorageSync("userInfo");
videoInfo.value = res.video;
hasDownload.value = downLoadList.value.includes(video_uuid.value);
let vid = res.video.polyv_uuid;
let uuid = vid.substring(0, 10);
let index = vid.lastIndexOf("_");
@@ -294,9 +300,27 @@ const VideoDownloadRecord = async () => {
const res = await api.isVideoDownloadRecord({ video_uuid: video_uuid.value });
if (res.code == 200) {
isVideoDownloadRecord.value = res.result == 0 ? false : true;
console.log(isVideoDownloadRecord.value);
}
};
const downAndSave = (url,uuid) => {
//let url='https://view.xdocin.com/view?src='+encodeURIComponent(pdfUrl);
uni.downloadFile({
url: url,
success: (res) => {
if (res.statusCode === 200) {
let index = downLoadList.value.find(cell => uuid == cell);
if (!index) {
downLoadList.value.push(item.uuid);
uni.setStorageSync('downLoadVideo', downLoadList.value);
};
}
},
});
};
const getWelfareNum = async () => {
const res = await api.getWelfareNum({
type: 1,
@@ -329,6 +353,7 @@ onShow(() => {
}
videoDetail();
uni.hideLoading();
});
const shareRef = ref();
@@ -545,6 +570,7 @@ const payVideoDownload = async () => {
notEnoughContent.value = `您的积分不足,是否购买积分?`;
}
};
const onDownload = () => {
console.log(isVideoDownloadRecord.value);
if (!isVideoDownloadRecord.value) {
@@ -563,9 +589,14 @@ const onDownload = () => {
},
});
} else {
navTo({
url: "/pages_app/myDownLoad/myDownLoad",
});
if(hasDownload.value) {
navTo({
url: "/pages_app/myDownLoad/myDownLoad",
});
} else {
downAndSave(videoSrc.value,video_uuid.value);
}
}
};
@@ -752,7 +783,7 @@ overflow-y: scroll;
}
.intro {
// background: #fff;
padding: 24rpx 28rpx 40rpx;
padding: 24rpx 28rpx 100rpx;
// margin-top: calc(var(--status-bar-height) + 44px + 220px + 88rpx);
// height: calc(100vh - var(--status-bar-height) - 44px - 220px - 88rpx);
// overflow-y: scroll;