修复音乐播放器图片不显示的问题

修复音乐播放器播放文件夹不播放的问题
This commit is contained in:
yutou 2020-12-24 18:36:28 +08:00
parent 6bb84c374a
commit 7300b5e3b7
2 changed files with 29 additions and 11 deletions

View File

@ -54,7 +54,10 @@ public class APIFilter implements Filter {
String tmp = request.getRequestURI(); String tmp = request.getRequestURI();
try { try {
url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0]; url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0];
} catch (Exception ignored) { } catch (Exception e) {
e.printStackTrace();
System.out.println("无权限请求:"+tmp);
return;
} }
UKey key = list.get(0); UKey key = list.get(0);

View File

@ -73,7 +73,7 @@
} catch (e) { } catch (e) {
localhost = "" localhost = ""
} }
//localhost = "http://192.168.31.88:8000"; // localhost = "http://113.109.23.240:8000";
layui.use(['table', 'element'], function () { layui.use(['table', 'element'], function () {
let table = layui.table; let table = layui.table;
let element = layui.element; let element = layui.element;
@ -126,15 +126,30 @@
window.open(localhost + "/nas/music/play.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&random=false&filePath=" + new Base64().encode(data.file)) window.open(localhost + "/nas/music/play.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&random=false&filePath=" + new Base64().encode(data.file))
} }
} else if (obj.event === 'play') { } else if (obj.event === 'play') {
$.post(localhost + "/nas/music/list.do", {type: false, path: data.file}, function (obj) { $.ajax({
let json = JSON.parse(obj); type: "POST",
url:localhost + "/nas/music/list.do",
contentType: "application/json; charset=utf-8",
data:JSON.stringify({type: true, path: data.file}),
dataType: "json",
success:function (json){
try {
if (json.code === 0) { if (json.code === 0) {
playIndex = 0; playIndex = 0;
musicLib = json.data; musicLib=[]
for (let datum of json.data) {
if(datum.isdir===0){
musicLib.push(datum)
}
}
isRandom = false; isRandom = false;
playNext() playNext()
} }
}catch (e){
}
}
}) })
} }
}); });
@ -263,7 +278,7 @@
}); });
} }
}) })
$('#img').attr("src",'/nas/music/web/image.do?fileName='+fileName); $('#img').attr("src",localhost+'/nas/music/web/image.do?fileName='+fileName);
} }
</script> </script>