音乐播放界面新增分享按钮

修复音乐文件不存在时依旧分配token的问题
This commit is contained in:
2021-11-14 12:19:30 +08:00
parent bbaecbf976
commit 1a0d4498dd
2 changed files with 17 additions and 3 deletions

View File

@@ -27,6 +27,7 @@
<div id="composer">作曲家</div>
<a class="layui-btn layui-btn-normal" id="download">下载</a>
<a class="layui-btn layui-btn-normal" id="next">下一首</a>
<a class="layui-btn layui-btn-normal" id="play_share">分享</a>
</div>
<div id="audioWrap"></div>
@@ -68,6 +69,7 @@
$('#playlist').remove()
$('#reload').remove()
$('#next').remove()
$('#play_share').remove()
}
$.get("/nas/music/getlocalhost.do",{share:share}, function (obj) {
try {
@@ -215,6 +217,16 @@
$('#next').click(function () {
playNext()
});
$('#play_share').click(function (){
$.post('/nas/music/share.do',{file:new Base64().decode(decodeURIComponent(playNow))},function (json){
if(json.code===0){
layer.prompt({
title:"分享链接",
value:"http://"+window.location.host+"/html/body/nas/music.html?share="+json.data.token
})
}
})
})
$('#reload').click(function () {
$.post(localhost + "/nas/music/reload.do", function (obj) {
layer.msg("提交刷新请求成功,几分钟后生效")