修复下载功能

This commit is contained in:
2025-05-20 10:34:02 +08:00
parent 7542d76d39
commit 16d2fe4520
13 changed files with 2249 additions and 69 deletions
+9 -15
View File
@@ -203,6 +203,11 @@
margin: 30px 0;
}
.program-navigation a{
color: #333;
text-decoration: none;
}
.prev-program,
.next-program {
max-width: 45%;
@@ -464,22 +469,11 @@
})
.then(response => response.json())
.then(data => {
if (data.code === 1) {
const downloadsElement = document.getElementById('programDownloads');
let downloads = parseInt(downloadsElement.textContent);
downloadsElement.textContent = downloads + 1;
// 获取当前域名
const domain = window.location.origin;
// 拼接完整的下载地址
if (data.data && data.data.fileurl) {
const downloadUrl = domain + data.data.fileurl;
window.location.href = downloadUrl;
} else {
alert('下载地址不存在');
}
if (data.code === 1 && data.data && data.data.fileurl) {
const downloadUrl = window.location.origin + data.data.fileurl;
window.location.href = downloadUrl;
} else {
alert('下载失败:' + data.msg);
alert('下载地址不存在');
}
})
.catch(error => {