biliob/Web/html/body/video.html

182 lines
6.9 KiB
HTML
Raw Normal View History

2024-10-29 18:29:56 +08:00
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>视频管理</title>
<link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>
<div id="header"></div>
2024-10-30 18:27:37 +08:00
<table class="layui-hide" id="roomList" lay-filter="roomTable"></table>
2024-10-29 18:29:56 +08:00
</body>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
2024-10-30 18:27:37 +08:00
<button class="layui-btn layui-btn-sm" onclick="createRoom()">添加新房间</button>
<button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
2024-10-29 18:29:56 +08:00
</div>
</script>
<script type="text/html" id="toolDemo">
<div class="layui-clear-space">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-xs" lay-event="more">
更多
<i class="layui-icon layui-icon-down"></i>
</a>
</div>
</script>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script src="/js/CommonConfig.js"></script>
2024-10-30 18:27:37 +08:00
<script src="/js/httpUtils.js"></script>
2024-10-29 18:29:56 +08:00
<script>
headerModel = 1;
$('#header').load("/html/header.html");
</script>
<script>
2024-10-30 18:27:37 +08:00
function showImage(url, imgElement) {
getHttpImage(url)
.then(imageUrl => {
imgElement.src = imageUrl;
})
.catch(error => {
console.error("Error loading image:", error);
// 可以在这里设置一个默认图片或者显示错误信息
imgElement.src = 'default-image.jpg';
});
}
function createRoom() {
layer.open({
type: 2,
title:"添加新房间",
area: ['500px', '400px'],
content: '/html/ui/createConfig.html'
});
// createUi("/html/ui/createConfig.html")
// .then(html => {
// layer.open({
// type: 1,
// area: ['500px', '300px'],
// content: '/html/ui/createConfig.html'
// });
// })
}
</script>
<script>
layui.use(['table', 'dropdown'], function () {
2024-10-29 18:29:56 +08:00
var table = layui.table;
var dropdown = layui.dropdown;
// 创建渲染实例
table.render({
2024-10-30 18:27:37 +08:00
elem: '#roomList',
url: '/live/config/all',
2024-10-29 18:29:56 +08:00
toolbar: '#toolbarDemo',
2024-10-30 18:27:37 +08:00
2024-10-29 18:29:56 +08:00
totalRow: true, // 开启合计行
page: true,
response: {
statusCode: 100 // 重新规定成功的状态码为 200table 组件默认为 0
},
parseData: function (res) {
return {
"code": res.status, //解析接口状态
"msg": res.message, //解析提示文本
"data": res.data, //解析数据列表
2024-10-30 18:27:37 +08:00
"count": res.count
2024-10-29 18:29:56 +08:00
};
},
cols: [[
2024-10-30 18:27:37 +08:00
{ type: 'checkbox', fixed: 'left' },
2024-10-29 18:29:56 +08:00
{ field: 'anchorUid', title: 'UID', width: 80, sort: true, fixed: 'left' },
{ field: 'anchorName', title: '用户名', width: 100, fixed: 'left' },
2024-10-30 18:27:37 +08:00
{ field: 'anchorFace', title: '头像', width: 80, templet: '<div><image src="" onerror="showImage(\'{{= d.anchorFace }}\',this);" style="width: 30px;height: 30px;"></div>' },
2024-10-29 18:29:56 +08:00
{ field: 'live_room_id', title: '房间号', width: 80 },
{ field: 'recordPath', title: '保存路径', width: 120 },
{ field: 'recordDanmu', title: '录制弹幕', width: 120, sort: true },
{ field: 'recordLive', title: '录制视频', width: 120, sort: true },
{ field: 'recordDanmuDate', title: '弹幕录制预定时间', width: 170, sort: true },
{ field: 'recordLiveDate', title: '视频录制预定时间', width: 170, sort: true },
{ field: 'recordUid', title: '录制账号', width: 120, sort: true },
{ field: 'recordDanmu', title: '录制弹幕', width: 120, sort: true },
{ field: 'sql_time', title: '添加时间', width: 100 },
{ fixed: "right", title: "操作", width: 190, align: "center", toolbar: "#toolDemo" }
]],
done: function () {
2024-10-30 18:27:37 +08:00
done();
2024-10-29 18:29:56 +08:00
},
error: function (res, msg) {
console.log(res, msg)
}
});
2024-10-30 18:27:37 +08:00
function done() {
// 工具栏事件
table.on('toolbar(roomTable)', function (obj) {
var id = obj.config.id;
var checkStatus = table.checkStatus(id);
var othis = lay(this);
switch (obj.event) {
case 'getCheckData':
var data = checkStatus.data;
layer.alert(layui.util.escape(JSON.stringify(data)));
break;
};
});
// 触发单元格工具事件
table.on('tool(roomTable)', function (obj) { // 双击 toolDouble
var data = obj.data; // 获得当前行数据
// console.log(obj)
if (obj.event === 'edit') {
layer.open({
title: '编辑 - id:' + data.id,
type: 1,
area: ['80%', '80%'],
content: '<div style="padding: 16px;">自定义表单元素</div>'
});
} else if (obj.event === 'more') {
// 更多 - 下拉菜单
dropdown.render({
elem: this, // 触发事件的 DOM 对象
show: true, // 外部事件触发即显示
data: [{
title: '查看',
id: 'detail'
}, {
title: '删除',
id: 'del'
}],
click: function (menudata) {
if (menudata.id === 'detail') {
layer.msg('查看操作,当前行 ID:' + data.id);
} else if (menudata.id === 'del') {
layer.confirm('真的删除行 [id: ' + data.id + '] 么', function (index) {
obj.del(); // 删除对应行tr的DOM结构
layer.close(index);
// 向服务端发送删除指令
});
}
},
align: 'right', // 右对齐弹出
style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' // 设置额外样式
})
2024-10-29 18:29:56 +08:00
}
2024-10-30 18:27:37 +08:00
});
}
2024-10-29 18:29:56 +08:00
});
</script>
<style>
</style>
</html>