2019-07-03 14:50:04 +00:00
|
|
|
|
<template>
|
2019-07-05 07:05:11 +00:00
|
|
|
|
|
2020-02-06 08:01:35 +00:00
|
|
|
|
<el-container id="app">
|
|
|
|
|
<el-main>
|
2020-03-01 15:36:16 +00:00
|
|
|
|
<x-upload v-on:handle_error="showFail" v-on:handle_finish="showSuccess"></x-upload>
|
2020-02-06 08:01:35 +00:00
|
|
|
|
|
2020-04-05 04:28:59 +00:00
|
|
|
|
<div id="app-control">
|
2020-02-06 08:01:35 +00:00
|
|
|
|
<el-row style="padding-bottom: 1em; font-size: 14px">
|
|
|
|
|
歌曲命名格式:
|
2020-02-23 05:45:30 +00:00
|
|
|
|
<el-radio label="1" name="format" v-model="download_format">歌手-歌曲名</el-radio>
|
|
|
|
|
<el-radio label="2" name="format" v-model="download_format">歌曲名</el-radio>
|
|
|
|
|
<el-radio label="3" name="format" v-model="download_format">歌曲名-歌手</el-radio>
|
|
|
|
|
<el-radio label="4" name="format" v-model="download_format">同原文件名</el-radio>
|
2019-07-05 07:05:11 +00:00
|
|
|
|
</el-row>
|
2020-02-23 05:41:39 +00:00
|
|
|
|
<el-row>
|
|
|
|
|
<el-button @click="handleDownloadAll" icon="el-icon-download" plain>下载全部</el-button>
|
2020-04-05 04:28:59 +00:00
|
|
|
|
<el-button @click="handleDeleteAll" icon="el-icon-delete" plain type="danger">清除全部</el-button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-tooltip class="item" effect="dark" placement="top-start">
|
|
|
|
|
<div slot="content">
|
|
|
|
|
当您使用此工具进行大量文件解锁的时候,建议开启此选项。<br/>
|
|
|
|
|
开启后,解锁结果将不会存留于浏览器中,防止内存不足。
|
|
|
|
|
</div>
|
|
|
|
|
<el-checkbox border style="margin-left: 1em" v-model="instant_download">立即保存</el-checkbox>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
|
|
|
|
|
|
2020-02-23 05:41:39 +00:00
|
|
|
|
</el-row>
|
2020-04-05 04:28:59 +00:00
|
|
|
|
</div>
|
2020-02-06 08:01:35 +00:00
|
|
|
|
<audio :autoplay="playing_auto" :src="playing_url" controls/>
|
|
|
|
|
|
2020-03-01 15:36:16 +00:00
|
|
|
|
<x-preview :download_format="download_format" :table-data="tableData"
|
2020-02-06 08:01:35 +00:00
|
|
|
|
v-on:music_changed="changePlaying"></x-preview>
|
|
|
|
|
|
|
|
|
|
</el-main>
|
|
|
|
|
<el-footer id="app-footer">
|
|
|
|
|
<el-row>
|
2020-02-23 05:41:39 +00:00
|
|
|
|
<a href="https://github.com/ix64/unlock-music" target="_blank">音乐解锁</a>(v<span
|
|
|
|
|
v-text="version"></span>):移除已购音乐的加密保护。
|
2020-02-06 08:01:35 +00:00
|
|
|
|
<a href="https://github.com/ix64/unlock-music/wiki/使用提示" target="_blank">使用提示</a>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
2020-02-23 05:41:39 +00:00
|
|
|
|
目前支持网易云音乐(ncm)、QQ音乐(qmc, mflac, mgg, tkm)以及
|
|
|
|
|
<a href="https://github.com/ix64/unlock-music/blob/master/README.md" target="_blank">其他格式</a>。
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<span>Copyright © 2019</span> MengYX
|
2020-02-06 08:01:35 +00:00
|
|
|
|
音乐解锁使用
|
|
|
|
|
<a href="https://github.com/ix64/unlock-music/blob/master/LICENSE" target="_blank">MIT许可协议</a>
|
2020-02-23 05:41:39 +00:00
|
|
|
|
开放源代码
|
2020-02-06 08:01:35 +00:00
|
|
|
|
</el-row>
|
|
|
|
|
</el-footer>
|
|
|
|
|
</el-container>
|
2019-07-05 07:05:11 +00:00
|
|
|
|
|
2019-07-03 14:50:04 +00:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-02-06 08:01:35 +00:00
|
|
|
|
|
|
|
|
|
import upload from "./component/upload"
|
|
|
|
|
import preview from "./component/preview"
|
|
|
|
|
import {DownloadBlobMusic, RemoveBlobMusic} from "./component/util"
|
2020-02-23 05:44:19 +00:00
|
|
|
|
import config from "../package"
|
2019-07-05 07:05:11 +00:00
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'app',
|
2020-02-06 08:01:35 +00:00
|
|
|
|
components: {
|
|
|
|
|
xUpload: upload,
|
|
|
|
|
xPreview: preview
|
|
|
|
|
},
|
2019-07-05 07:05:11 +00:00
|
|
|
|
data() {
|
|
|
|
|
return {
|
2020-02-23 05:44:19 +00:00
|
|
|
|
version: config.version,
|
2019-07-05 07:05:11 +00:00
|
|
|
|
activeIndex: '1',
|
|
|
|
|
tableData: [],
|
|
|
|
|
playing_url: "",
|
|
|
|
|
playing_auto: false,
|
2020-02-23 05:45:30 +00:00
|
|
|
|
download_format: '1',
|
2020-02-06 08:01:35 +00:00
|
|
|
|
instant_download: false,
|
2019-07-05 07:05:11 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2020-02-06 08:01:35 +00:00
|
|
|
|
created() {
|
2019-07-05 07:05:11 +00:00
|
|
|
|
this.$nextTick(function () {
|
|
|
|
|
this.finishLoad();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2020-02-23 05:44:19 +00:00
|
|
|
|
async finishLoad() {
|
2020-02-06 08:01:35 +00:00
|
|
|
|
const mask = document.getElementById("loader-mask");
|
|
|
|
|
if (!!mask) mask.remove();
|
2020-02-23 05:44:19 +00:00
|
|
|
|
let updateInfo;
|
|
|
|
|
try {
|
|
|
|
|
const resp = await fetch("https://stats.ixarea.com/collect/music/app-version", {
|
|
|
|
|
method: "POST", headers: {"Content-Type": "application/json"},
|
|
|
|
|
body: JSON.stringify({Version: this.version})
|
|
|
|
|
});
|
|
|
|
|
updateInfo = await resp.json();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
}
|
2020-03-01 15:34:24 +00:00
|
|
|
|
if (!!updateInfo && !!updateInfo.Found) {
|
2020-02-23 05:44:19 +00:00
|
|
|
|
this.$notify.warning({
|
|
|
|
|
title: '发现更新',
|
|
|
|
|
message: '发现新版本 v' + updateInfo.Version +
|
|
|
|
|
'<br/>更新详情:' + updateInfo.Detail +
|
|
|
|
|
'<br/><a target="_blank" href="' + updateInfo.URL + '">获取更新</a>',
|
|
|
|
|
dangerouslyUseHTMLString: true,
|
|
|
|
|
duration: 15000,
|
|
|
|
|
position: 'top-left'
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.$notify.info({
|
|
|
|
|
title: '离线使用',
|
|
|
|
|
message: '我们使用PWA技术,无网络也能使用' +
|
2020-03-04 01:30:48 +00:00
|
|
|
|
'<br/>最近更新:' + config.updateInfo +
|
2020-02-23 05:44:19 +00:00
|
|
|
|
'<br/><a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>',
|
|
|
|
|
dangerouslyUseHTMLString: true,
|
|
|
|
|
duration: 10000,
|
|
|
|
|
position: 'top-left'
|
|
|
|
|
});
|
|
|
|
|
}
|
2019-07-05 07:05:11 +00:00
|
|
|
|
},
|
2020-02-06 08:01:35 +00:00
|
|
|
|
showSuccess(data) {
|
|
|
|
|
if (data.status) {
|
|
|
|
|
if (this.instant_download) {
|
|
|
|
|
DownloadBlobMusic(data, this.download_format);
|
|
|
|
|
RemoveBlobMusic(data);
|
2019-07-05 07:05:11 +00:00
|
|
|
|
} else {
|
2020-02-06 08:01:35 +00:00
|
|
|
|
this.tableData.push(data);
|
|
|
|
|
this.$notify.success({
|
|
|
|
|
title: '解锁成功',
|
|
|
|
|
message: '成功解锁 ' + data.title,
|
|
|
|
|
duration: 3000
|
2019-07-05 07:05:11 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
2020-02-07 12:17:45 +00:00
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
let _rp_data = [data.title, data.artist, data.album];
|
|
|
|
|
window._paq.push(["trackEvent", "Unlock", data.rawExt + "," + data.mime, JSON.stringify(_rp_data)]);
|
|
|
|
|
}
|
2020-02-06 08:01:35 +00:00
|
|
|
|
} else {
|
2020-02-06 08:18:40 +00:00
|
|
|
|
this.showFail(data.message, data.rawFilename + "." + data.rawExt)
|
2020-02-04 17:53:58 +00:00
|
|
|
|
}
|
2019-07-05 07:05:11 +00:00
|
|
|
|
},
|
2020-02-06 08:01:35 +00:00
|
|
|
|
showFail(errInfo, filename) {
|
|
|
|
|
this.$notify.error({
|
|
|
|
|
title: '出现问题',
|
|
|
|
|
message: errInfo + "," + filename +
|
|
|
|
|
',参考<a target="_blank" href="https://github.com/ix64/unlock-music/wiki/使用提示">使用提示</a>',
|
|
|
|
|
dangerouslyUseHTMLString: true,
|
|
|
|
|
duration: 6000
|
|
|
|
|
});
|
2020-02-07 12:17:45 +00:00
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
window._paq.push(["trackEvent", "Error", errInfo, filename]);
|
|
|
|
|
}
|
2020-03-10 01:31:48 +00:00
|
|
|
|
console.error(errInfo, filename);
|
2020-02-06 08:01:35 +00:00
|
|
|
|
},
|
|
|
|
|
changePlaying(url) {
|
|
|
|
|
this.playing_url = url;
|
|
|
|
|
this.playing_auto = true;
|
2019-11-23 10:56:45 +00:00
|
|
|
|
},
|
2019-07-05 07:05:11 +00:00
|
|
|
|
handleDeleteAll() {
|
|
|
|
|
this.tableData.forEach(value => {
|
2020-02-06 08:01:35 +00:00
|
|
|
|
RemoveBlobMusic(value);
|
2019-07-05 07:05:11 +00:00
|
|
|
|
});
|
|
|
|
|
this.tableData = [];
|
|
|
|
|
},
|
|
|
|
|
handleDownloadAll() {
|
|
|
|
|
let index = 0;
|
|
|
|
|
let c = setInterval(() => {
|
|
|
|
|
if (index < this.tableData.length) {
|
2020-02-06 08:01:35 +00:00
|
|
|
|
DownloadBlobMusic(this.tableData[index], this.download_format);
|
2019-07-05 07:05:11 +00:00
|
|
|
|
index++;
|
|
|
|
|
} else {
|
|
|
|
|
clearInterval(c);
|
|
|
|
|
}
|
2020-02-06 08:01:35 +00:00
|
|
|
|
}, 300);
|
2019-07-05 07:05:11 +00:00
|
|
|
|
}
|
2020-02-06 08:01:35 +00:00
|
|
|
|
},
|
|
|
|
|
|
2019-07-05 07:05:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-03 14:50:04 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
2019-07-05 07:05:11 +00:00
|
|
|
|
#app {
|
|
|
|
|
font-family: "Helvetica Neue", Helvetica, "PingFang SC",
|
|
|
|
|
"Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
|
|
|
|
|
-webkit-font-smoothing: antialiased;
|
|
|
|
|
-moz-osx-font-smoothing: grayscale;
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: #2c3e50;
|
|
|
|
|
padding-top: 30px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#app-footer a {
|
2020-01-27 04:50:24 +00:00
|
|
|
|
padding-left: 0.2em;
|
|
|
|
|
padding-right: 0.2em;
|
2019-07-05 07:05:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#app-footer {
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: small;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#app-control {
|
|
|
|
|
padding-top: 1em;
|
|
|
|
|
padding-bottom: 1em;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-03 14:50:04 +00:00
|
|
|
|
</style>
|