web_toolset/web/html/body/nas/bilidown.html
2020-10-21 18:05:33 +08:00

139 lines
5.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>NAS</title>
<link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div id="header"></div>
<div class="layui-body" style="left: 200px;">
<div id="side"></div>
<blockquote class="layui-elem-quote"><span id="ip">B站直播下载器</span></blockquote>
<button type="button" id='add' class="layui-btn layui-btn-normal" style="margin-left: 10px;">新增</button>
<table id="address" lay-filter="listTools"></table>
<div id="footer"></div>
</div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script type="text/html" id="listTools">
<a class="layui-btn layui-btn-xs" lay-event="set">设置</a>
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
$('#header').load("/html/header.html");
$('#footer').load("/html/footer.html");
$('#side').load("/html/body/nas/side.html");
$.get("/login/check.do", function (data) {
let json = JSON.parse(data);
if (json.code != 0) {
window.location.href = "/"
}
})
layui.use(['layer', 'form', 'element', 'table'], function () {
var layer = layui.layer
, form = layui.form
, table = layui.table;
table.render({
elem: "#address"
, url: '/bili/live/get/url.do'
, page: true
, cols: [[
{ field: "id", title: "id", width: 80, sort: true, fixed: 'left' }
, { field: 'title', title: '直播间', width: 200 }
, { field: 'cid', title: 'cid', width: 100 }
, { field: 'url', title: 'url', width: 400 }
, { field: 'status', title: '状态', width: 80 }
, { field: "right", width: 200, toolbar: '#listTools' }
]]
});
table.on('tool(listTools)', function (obj) {
let data = obj.data;
if (obj.event === 'set') {
layer.open({
title: '设置'
, content: '切换状态'
, btn: ['启动', '关闭']
, yes: function (index, obj) {
$.post('/bili/live/set/update.do', { id: data.id, status: '1' }, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg);
table.reload('address')
})
layer.close(index)
},
btn2: function (index, obj) {
$.post('/bili/live/set/update.do', { id: data.id, status: '0' }, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg);
table.reload('address')
})
table.reload('address')
layer.close(index)
}
})
} else if (obj.event === 'edit') {
layer.prompt({
title: "请输入链接或cid"
}, function (value, index) {
$.post('/bili/live/set/update.do', { id: data.id, url: value }, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg);
table.reload('address')
})
table.reload('address')
layer.close(index)
})
} else {
layer.open({
title: "删除提示"
, content: "确认删除?"
, btn: ['确认', '取消']
, yes: function (index, layero) {
$.post('bili/live/set/delete.do', { id: data.id }, function () {
table.reload('address')
});
layer.close(index)
},
btn2: function (index, layero) {
layer.close(index)
}
})
}
})
});
$.ajax({ cache: false })
$('#add').click(function () {
layer.prompt({
title: "填写url或cid"
}, function (value, index) {
$.post("/bili/live/add/url.do", { url: value }, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg);
layer.close(index)
});
})
});
</script>
<style>
#icon {
float: right;
}
.body {
bottom: 0;
}
</style>
</body>
</html>