#19 Add Download Type: Origin Filename

remotes/origin/HEAD
MengYX 5 years ago
parent 9fd7177ebb
commit 984b549448
No known key found for this signature in database
GPG Key ID: E63F9C7303E8F604

@ -7,10 +7,10 @@
<el-row id="app-control"> <el-row id="app-control">
<el-row style="padding-bottom: 1em; font-size: 14px"> <el-row style="padding-bottom: 1em; font-size: 14px">
歌曲命名格式 歌曲命名格式
<el-radio name="format" v-model="download_format" label="1"></el-radio> <el-radio label="1" name="format" v-model="download_format">-</el-radio>
<el-radio name="format" v-model="download_format" label="2">-</el-radio> <el-radio label="2" name="format" v-model="download_format"></el-radio>
<el-radio name="format" v-model="download_format" label="3">-</el-radio> <el-radio label="3" name="format" v-model="download_format">-</el-radio>
<el-checkbox v-model="instant_download" border>立即保存</el-checkbox> <el-radio label="4" name="format" v-model="download_format"></el-radio>
</el-row> </el-row>
<el-row> <el-row>
<el-button @click="handleDownloadAll" icon="el-icon-download" plain>下载全部</el-button> <el-button @click="handleDownloadAll" icon="el-icon-download" plain>下载全部</el-button>
@ -65,7 +65,7 @@
tableData: [], tableData: [],
playing_url: "", playing_url: "",
playing_auto: false, playing_auto: false,
download_format: '2', download_format: '1',
instant_download: false, instant_download: false,
} }
}, },

@ -2,16 +2,19 @@ export function DownloadBlobMusic(data, format) {
const a = document.createElement('a'); const a = document.createElement('a');
a.href = data.file; a.href = data.file;
switch (format) { switch (format) {
default:
case "1": case "1":
a.download = data.title + "." + data.ext; a.download = data.artist + " - " + data.title + "." + data.ext;
break; break;
default:
case "2": case "2":
a.download = data.artist + " - " + data.title + "." + data.ext; a.download = data.title + "." + data.ext;
break; break;
case "3": case "3":
a.download = data.title + " - " + data.artist + "." + data.ext; a.download = data.title + " - " + data.artist + "." + data.ext;
break; break;
case "4":
a.download = data.rawFilename + "." + data.ext;
break;
} }
document.body.append(a); document.body.append(a);
a.click(); a.click();

Loading…
Cancel
Save