Skip to content

Commit fc9a144

Browse files
committed
fix(UI): download song in home playlist
1 parent ae9792c commit fc9a144

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

backend/src/service/job_manager/index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ async function listJobs(uid) {
1414
const jobs = await getUserJobs(uid);
1515
for (const jobId in jobs) {
1616
const job = await getJob(uid, jobId);
17+
if (!job) {
18+
continue;
19+
}
1720
job.id = jobId;
1821
list.push(job);
1922
}
@@ -25,7 +28,11 @@ async function getJob(uid, jobId) {
2528
if (!await asyncFs.asyncFileExisted(jobFile)) {
2629
return null;
2730
}
28-
return JSON.parse(await asyncFs.asyncReadFile(jobFile));
31+
const fileText = await asyncFs.asyncReadFile(jobFile);
32+
if (fileText == "") {
33+
return null;
34+
}
35+
return JSON.parse(fileText);
2936
}
3037

3138
async function updateJob(uid, jobId, info) {

frontend/src/components/SearchResultTable.vue

+19
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@
102102
</el-button>
103103
</el-tooltip>
104104

105+
<el-tooltip
106+
:content="
107+
globalConfig.downloadPathExisted
108+
? '下载到服务器'
109+
: '下载到服务器(请先配置下载路径)'
110+
"
111+
placement="top"
112+
>
113+
<el-button
114+
type="primary"
115+
circle
116+
@click="downloadToLocalService(scope.row.url)"
117+
:disabled="!globalConfig.downloadPathExisted"
118+
class="operation-btn"
119+
>
120+
<i class="bi bi-download"></i>
121+
</el-button>
122+
</el-tooltip>
123+
105124
<el-tooltip content="在源站查看" placement="top">
106125
<el-button
107126
type="warning"

0 commit comments

Comments
 (0)