From 3ee9f5d2d1212ad64d5fe798fcd065e10d8d4f2c Mon Sep 17 00:00:00 2001 From: MengYX Date: Thu, 6 Feb 2020 16:01:35 +0800 Subject: [PATCH] Split App.vue --- src/App.vue | 291 +++++++++++--------------------------- src/component/preview.vue | 71 ++++++++++ src/component/upload.vue | 82 +++++++++++ src/component/util.js | 26 ++++ src/decrypt/common.js | 8 +- 5 files changed, 263 insertions(+), 215 deletions(-) create mode 100644 src/component/preview.vue create mode 100644 src/component/upload.vue create mode 100644 src/component/util.js diff --git a/src/App.vue b/src/App.vue index 972aef3..743a4f5 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,151 +1,77 @@ @@ -285,15 +160,9 @@ font-size: small; } - /*noinspection CssUnusedSymbol*/ - .el-upload-dragger { - width: 80vw !important; - } - #app-control { padding-top: 1em; padding-bottom: 1em; } - diff --git a/src/component/preview.vue b/src/component/preview.vue new file mode 100644 index 0000000..4ef6f33 --- /dev/null +++ b/src/component/preview.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/src/component/upload.vue b/src/component/upload.vue new file mode 100644 index 0000000..43c6a42 --- /dev/null +++ b/src/component/upload.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/src/component/util.js b/src/component/util.js new file mode 100644 index 0000000..dcc671b --- /dev/null +++ b/src/component/util.js @@ -0,0 +1,26 @@ +export function DownloadBlobMusic(data, format) { + const a = document.createElement('a'); + a.href = data.file; + switch (format) { + case "1": + a.download = data.title + "." + data.ext; + break; + case "2": + a.download = data.artist + " - " + data.title + "." + data.ext; + break; + case "3": + a.download = data.title + " - " + data.artist + "." + data.ext; + break; + default: + a.download = data.filename; + break; + } + document.body.append(a); + a.click(); + a.remove(); +} + +export function RemoveBlobMusic(data) { + URL.revokeObjectURL(data.file); + URL.revokeObjectURL(data.picture); +} diff --git a/src/decrypt/common.js b/src/decrypt/common.js index 6371847..16d9d07 100644 --- a/src/decrypt/common.js +++ b/src/decrypt/common.js @@ -42,9 +42,9 @@ export async function CommonDecrypt(file) { default: rt_data = {status: false, message: "不支持此文件格式",} } - if (rt_data.status) { - rt_data.rawExt = raw_ext; - rt_data.rawFilename = raw_filename; - } + + rt_data.rawExt = raw_ext; + rt_data.rawFilename = raw_filename; + return rt_data; }