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