音乐播放器界面暴露到header.html
音乐播放器界面不需要登录即可使用
This commit is contained in:
parent
3d60754263
commit
76c064b14c
@ -44,85 +44,79 @@
|
|||||||
<script src="/js/AudioPlayer.js"></script>
|
<script src="/js/AudioPlayer.js"></script>
|
||||||
<script id="listTemplet">
|
<script id="listTemplet">
|
||||||
{{# if(d.dir){ }}
|
{{# if(d.dir){ }}
|
||||||
<div><i class="layui-icon"></i>{{d.title}}</div>
|
<div><i class="layui-icon"> </i>{{d.title}}</div>
|
||||||
{{# } else { }}
|
{{# } else { }}
|
||||||
<div><i class="layui-icon"></i>{{d.title}}</div>
|
<div><i class="layui-icon"> </i>{{d.title}}</div>
|
||||||
{{# } }}
|
{{# } }}
|
||||||
</script>
|
</script>
|
||||||
<script type="text/html" id="music">
|
<script type="text/html" id="music">
|
||||||
<a class="layui-btn layui-btn-xs" lay-event="download">下载</a>
|
<a class="layui-btn layui-btn-xs" lay-event="download">下载</a>
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
//let localhost="http://192.168.31.88:8000";
|
|
||||||
let localhost = "";
|
let localhost = "";
|
||||||
let musicLib=[]
|
let musicLib=[]
|
||||||
let isRandom=true;
|
let isRandom=true;
|
||||||
let playIndex=0;
|
let playIndex=0;
|
||||||
let playNow=""
|
let playNow=""
|
||||||
$.get("/nas/music/getlocalhost.do",function (obj){
|
$.get("/nas/music/getlocalhost.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk",function (obj){
|
||||||
/* let json=JSON.parse(obj);
|
let json=JSON.parse(obj);
|
||||||
localhost=json.data;*/
|
localhost=json.data;
|
||||||
// localhost="http://116.22.200.20:8000"
|
// localhost="http://116.22.200.20: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;
|
let listTable=table.render({
|
||||||
let listTable=table.render({
|
elem: '#playlist'
|
||||||
elem: '#playlist'
|
, url: localhost + '/nas/music/list.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk' //数据接口
|
||||||
, url: localhost + '/nas/music/list.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk' //数据接口
|
, page: true //开启分页
|
||||||
, page: true //开启分页
|
, cols: [[
|
||||||
, cols: [[
|
{field: 'title', title: '标题', width: 400,templet:"#listTemplet"}
|
||||||
{field: 'title', title: '标题', width: 400,templet:"#listTemplet"}
|
, {field: 'artist', title: '艺术家', width: 200}
|
||||||
, {field: 'artist', title: '艺术家', width: 200}
|
, {field: 'album', title: '专辑', width: 200}
|
||||||
, {field: 'album', title: '专辑', width: 200}
|
, {field: 'composer', title: '作曲', width: 200}
|
||||||
, {field: 'composer', title: '作曲', width: 200}
|
, {field: 'track', title: '音轨号', width: 100}
|
||||||
, {field: 'track', title: '音轨号', width: 100}
|
, {field: "right", width: 100, toolbar: '#music'}
|
||||||
, {field: "right", width: 100, toolbar: '#music'}
|
]]
|
||||||
]]
|
,done:function (res,curr,count){
|
||||||
,done:function (res,curr,count){
|
musicLib=res.data
|
||||||
musicLib=res.data
|
}
|
||||||
}
|
})
|
||||||
})
|
table.on('rowDouble(music)', function (obj) {
|
||||||
table.on('rowDouble(music)', function (obj) {
|
//obj 同上
|
||||||
//obj 同上
|
console.log(obj.data) //得到当前行元素对象
|
||||||
console.log(obj.data) //得到当前行元素对象
|
if(obj.data.dir){
|
||||||
if(obj.data.dir){
|
listTable.reload({
|
||||||
listTable.reload({
|
where:{
|
||||||
where:{
|
path:obj.data.file
|
||||||
path:obj.data.file
|
}
|
||||||
}
|
,page:{
|
||||||
,page:{
|
curr:1
|
||||||
curr:1
|
}
|
||||||
}
|
});
|
||||||
});
|
}else{
|
||||||
}else{
|
isRandom=false;
|
||||||
isRandom=false;
|
playIndex=obj.tr[0].dataset.index;
|
||||||
playIndex=obj.tr[0].dataset.index;
|
play(obj.data.file)
|
||||||
play(obj.data.file)
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
table.on('tool(music)', function (obj) {
|
|
||||||
let data = obj.data;
|
|
||||||
if(obj.event === 'download'){
|
|
||||||
if(!data.dir){
|
|
||||||
window.open(localhost+"/nas/music/play.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&random=false&filePath="+new Base64().encode(data.file))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
});
|
||||||
});
|
|
||||||
element.on('nav(menus)', function (elem) {
|
table.on('tool(music)', function (obj) {
|
||||||
console.log(elem); //得到当前点击的DOM对象
|
let data = obj.data;
|
||||||
});
|
if(obj.event === 'download'){
|
||||||
});
|
if(!data.dir){
|
||||||
|
window.open(localhost+"/nas/music/play.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&random=false&filePath="+new Base64().encode(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) {
|
|
||||||
window.location.href = "/"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
let player = $.AudioPlayer;
|
let player = $.AudioPlayer;
|
||||||
player.init({
|
player.init({
|
||||||
container: '#audioWrap'
|
container: '#audioWrap'
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
<dd><a href="http://nas.yutou233.cn/" target="_blank">管理后台</a></dd>
|
<dd><a href="http://nas.yutou233.cn/" target="_blank">管理后台</a></dd>
|
||||||
<dd><a href="http://bt.yutou233.cn" target="_blank">BT下载</a></dd>
|
<dd><a href="http://bt.yutou233.cn" target="_blank">BT下载</a></dd>
|
||||||
<dd><a href="http://tools.yutou233.cn/jellyfin.do" target="_blank">jellyfin</a></dd>
|
<dd><a href="http://tools.yutou233.cn/jellyfin.do" target="_blank">jellyfin</a></dd>
|
||||||
|
<dd><a href="/html/body/nas/music.html" >NAS音乐播放器</a></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
<li class="layui-nav-item" id='icon'>
|
<li class="layui-nav-item" id='icon'>
|
||||||
|
Loading…
Reference in New Issue
Block a user