更换元数据读取库
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
<body>
|
||||
<div class="layui-layout layui-layout-admin">
|
||||
<div id="header"></div>
|
||||
|
||||
<div class="layui-body" style="left: 200px;">
|
||||
<div id="side"></div>
|
||||
|
||||
@@ -19,20 +20,29 @@
|
||||
<img src="/assets/defaultPlayImg.jpg" id="img" style="height: 200px; width: 200px"/>
|
||||
|
||||
<div style="display:inline-block;">
|
||||
<div id="title">title</div>
|
||||
<div id="artist">by</div>
|
||||
<div id="album">album</div>
|
||||
<div id="composer">composer</div>
|
||||
<div id="title">标题:</div>
|
||||
<div id="artist">艺术家:</div>
|
||||
<div id="album">专辑:</div>
|
||||
<div id="composer">作曲家</div>
|
||||
</div>
|
||||
|
||||
<div id="audioWrap"></div>
|
||||
|
||||
</div>
|
||||
<table id="playlist" lay-filter="music" ></table>
|
||||
<ul class="layui-nav layui-bg-cyan" lay-filter="menus" style="margin-right: 10px;">
|
||||
<div style="margin-top: 10px;">
|
||||
<span id="menu" class="layui-breadcrumb" lay-separator="/"
|
||||
style="visibility: visible;">
|
||||
<a href="javascript:onMenuClick('root');">主目录</a>
|
||||
</span>
|
||||
</div>
|
||||
</ul>
|
||||
<table id="playlist" lay-filter="music"></table>
|
||||
</div>
|
||||
|
||||
<div id="footer"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script src="/layui/layui.js"></script>
|
||||
<script src="/js/jquery-3.2.1.js"></script>
|
||||
@@ -42,13 +52,14 @@
|
||||
<script src="/js/AudioPlayer.js"></script>
|
||||
<script>
|
||||
//let localhost="http://192.168.31.88:8000";
|
||||
let localhost="";
|
||||
layui.use('table', function () {
|
||||
let localhost = "";
|
||||
layui.use(['table', 'element'], function () {
|
||||
let table = layui.table;
|
||||
let element = layui.element;
|
||||
table.render({
|
||||
elem: '#playlist'
|
||||
, height: 312
|
||||
, url: localhost+'/nas/music/all.do' //数据接口
|
||||
, url: localhost + '/nas/music/all.do' //数据接口
|
||||
, page: true //开启分页
|
||||
, cols: [[
|
||||
{field: 'title', title: '标题', width: 400}
|
||||
@@ -58,12 +69,16 @@
|
||||
, {field: 'track', title: '音轨号', width: 100}
|
||||
]]
|
||||
})
|
||||
table.on('rowDouble(music)', function(obj){
|
||||
table.on('rowDouble(music)', function (obj) {
|
||||
//obj 同上
|
||||
console.log(obj.data.file) //得到当前行元素对象
|
||||
play(obj.data.file)
|
||||
});
|
||||
element.on('nav(menus)', function (elem) {
|
||||
console.log(elem); //得到当前点击的DOM对象
|
||||
});
|
||||
});
|
||||
|
||||
$.get("/login/check.do", function (data) {
|
||||
let json = JSON.parse(data);
|
||||
if (json.code !== 0) {
|
||||
@@ -80,7 +95,7 @@
|
||||
, endedCallback: function () {
|
||||
console.log('播放完成')
|
||||
random()
|
||||
},canplayCallback:function () {
|
||||
}, canplayCallback: function () {
|
||||
console.log("点击播放")
|
||||
}
|
||||
});
|
||||
@@ -92,12 +107,16 @@
|
||||
random()
|
||||
});
|
||||
|
||||
function onMenuClick(that) {
|
||||
console.log(that)
|
||||
}
|
||||
|
||||
function random() {
|
||||
$.get(localhost+"/nas/music/random.do", function (data) {
|
||||
$.get(localhost + "/nas/music/random.do", function (data) {
|
||||
let json = JSON.parse(data)
|
||||
if (json.code === 1) {
|
||||
player.updateSource({
|
||||
source: localhost+"/nas/music/play.do?random=false&filePath=" + json.data
|
||||
source: localhost + "/nas/music/play.do?random=false&filePath=" + json.data
|
||||
});
|
||||
update(json.data)
|
||||
player.play()
|
||||
@@ -107,16 +126,18 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function play(file) {
|
||||
let filePath=escape(new Base64().encode(file))
|
||||
let filePath = escape(new Base64().encode(file))
|
||||
player.updateSource({
|
||||
source:localhost+"/nas/music/play.do?random=false&filePath=" +filePath
|
||||
source: localhost + "/nas/music/play.do?random=false&filePath=" + filePath
|
||||
});
|
||||
update(filePath)
|
||||
player.play()
|
||||
}
|
||||
|
||||
function update(fileName) {
|
||||
$.get(localhost+'/nas/music/find/file.do?path=' + fileName, function (data) {
|
||||
$.get(localhost + '/nas/music/find/file.do?path=' + fileName, function (data) {
|
||||
let json = JSON.parse(data);
|
||||
if (json.code === 0) {
|
||||
layer.msg(json.msg);
|
||||
@@ -127,7 +148,7 @@
|
||||
$('#album').html("专辑:" + json.data.album)
|
||||
$('#composer').html("作曲:" + json.data.composer)
|
||||
})
|
||||
$.get(localhost+"/nas/music/image.do?fileName=" + fileName, function (data) {
|
||||
$.get(localhost + "/nas/music/image.do?fileName=" + fileName, function (data) {
|
||||
let json = JSON.parse(data);
|
||||
if (json.code === 0) {
|
||||
layer.msg(json.msg);
|
||||
|
||||
Reference in New Issue
Block a user