Browse Source

Fix Download Button

20230320
MengYX 5 years ago
parent
commit
2266ca2cf1
No known key found for this signature in database GPG Key ID: E63F9C7303E8F604
  1. 32
      src/App.vue
  2. 2
      src/plugins/mflac.js

32
src/App.vue

@ -51,14 +51,9 @@
<el-button @click="handlePlay(scope.$index, scope.row)" <el-button @click="handlePlay(scope.$index, scope.row)"
circle icon="el-icon-video-play" type="success"> circle icon="el-icon-video-play" type="success">
</el-button> </el-button>
<el-button @click="handleDownload(scope.row)"
<el-button circle> circle icon="el-icon-download">
<el-link :download="scope.row.filename" :href="scope.row.file"
:underline="false" icon="el-icon-download">
</el-link>
</el-button> </el-button>
<el-button @click="handleDelete(scope.$index, scope.row)" <el-button @click="handleDelete(scope.$index, scope.row)"
circle icon="el-icon-delete" type="danger"> circle icon="el-icon-delete" type="danger">
</el-button> </el-button>
@ -164,16 +159,13 @@
} else { } else {
this.$notify.error({ this.$notify.error({
title: '出现问题', title: '出现问题',
message: data.message + ',参考<a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>', message: data.message + "," + file.name +
',参考<a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>',
dangerouslyUseHTMLString: true dangerouslyUseHTMLString: true
}); });
window._paq.push(["trackEvent", "Unlock", "Error", file.name]); window._paq.push(["trackEvent", "Unlock", "Error", file.name]);
} }
})(); })();
}, },
handlePlay(index, row) { handlePlay(index, row) {
this.playing_url = row.file; this.playing_url = row.file;
@ -185,6 +177,14 @@
URL.revokeObjectURL(row.picture); URL.revokeObjectURL(row.picture);
this.tableData.splice(index, 1); this.tableData.splice(index, 1);
}, },
handleDownload(row) {
let a = document.createElement('a');
a.href = row.file;
a.download = row.filename;
document.body.append(a);
a.click();
a.remove();
},
handleDeleteAll() { handleDeleteAll() {
this.tableData.forEach(value => { this.tableData.forEach(value => {
URL.revokeObjectURL(value.file); URL.revokeObjectURL(value.file);
@ -196,17 +196,11 @@
let index = 0; let index = 0;
let c = setInterval(() => { let c = setInterval(() => {
if (index < this.tableData.length) { if (index < this.tableData.length) {
let a = document.createElement('a'); this.handleDownload(this.tableData[index]);
a.href = this.tableData[index].file;
a.download = this.tableData[index].filename;
document.body.append(a);
a.click();
a.remove();
index++; index++;
} else { } else {
clearInterval(c); clearInterval(c);
} }
}, 1000); }, 1000);
} }

2
src/plugins/mflac.js

@ -31,7 +31,6 @@ async function Decrypt(file) {
// 导出 // 导出
const musicData = new Blob([audioData], {type: "audio/flac"}); const musicData = new Blob([audioData], {type: "audio/flac"});
const musicUrl = URL.createObjectURL(musicData); const musicUrl = URL.createObjectURL(musicData);
console.log(musicUrl);
// 读取Meta // 读取Meta
let tag = await musicMetadata.parseBlob(musicData); let tag = await musicMetadata.parseBlob(musicData);
@ -104,7 +103,6 @@ class Mask {
} }
if (!flag) continue; if (!flag) continue;
this.mask = mask; this.mask = mask;
console.log(mask);
return true; return true;
} }
return false; return false;

Loading…
Cancel
Save