This commit is contained in:
2024-10-31 18:23:39 +08:00
parent 4b04c1863b
commit 34a41f50ac
31 changed files with 561 additions and 223 deletions

View File

@@ -37,35 +37,15 @@
$('#header').load("/html/header.html");
</script>
<script>
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() {
function createRoom(roomId) {
layer.open({
type: 2,
title:"添加新房间",
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'
// });
// })
}
content: '/html/ui/createConfig.html?roomId=' + roomId
});
}
</script>
<script>
layui.use(['table', 'dropdown'], function () {
@@ -93,16 +73,16 @@
},
cols: [[
{ type: 'checkbox', fixed: 'left' },
{ field: 'anchorUid', title: 'UID', width: 80, sort: true, fixed: 'left' },
{ field: 'anchorUid', title: 'UID', width: 100, sort: true, fixed: 'left', templet: '<div><a href="https://space.bilibili.com/{{= d.anchorUid}}" target="_blank">{{= d.anchorUid}}</a>' },
{ field: 'anchorName', title: '用户名', width: 100, fixed: 'left' },
{ field: 'anchorFace', title: '头像', width: 80, templet: '<div><image src="" onerror="showImage(\'{{= d.anchorFace }}\',this);" style="width: 30px;height: 30px;"></div>' },
{ field: 'live_room_id', title: '房间号', width: 80 },
{ field: 'live_room_id', title: '房间号', width: 80, templet: '<div><a href="https://live.bilibili.com/{{= d.live_room_id}}" target="_blank">{{= d.live_room_id}}</a>' },
{ 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: 'recordDanmuDate', title: '弹幕录制预定时间', width: 100, sort: true },
{ field: 'recordLiveDate', title: '视频录制预定时间', width: 100, sort: true },
{ field: 'recordUid', title: '录制账号', width: 120, sort: true, templet: '<div><a href="https://space.bilibili.com/{{= d.recordUid}}" target="_blank">{{= d.recordUid}}</a>' },
{ field: 'recordDanmu', title: '录制弹幕', width: 120, sort: true },
{ field: 'sql_time', title: '添加时间', width: 100 },
{ fixed: "right", title: "操作", width: 190, align: "center", toolbar: "#toolDemo" }
@@ -133,14 +113,9 @@
// 触发单元格工具事件
table.on('tool(roomTable)', function (obj) { // 双击 toolDouble
var data = obj.data; // 获得当前行数据
// console.log(obj)
console.log(obj)
if (obj.event === 'edit') {
layer.open({
title: '编辑 - id:' + data.id,
type: 1,
area: ['80%', '80%'],
content: '<div style="padding: 16px;">自定义表单元素</div>'
});
createRoom(obj.data.live_room_id)
} else if (obj.event === 'more') {
// 更多 - 下拉菜单
dropdown.render({
@@ -155,11 +130,18 @@
}],
click: function (menudata) {
if (menudata.id === 'detail') {
layer.msg('查看操作,当前行 ID:' + data.id);
layer.msg('查看操作,当前行 ID:' + data.live_room_id);
} else if (menudata.id === 'del') {
layer.confirm('真的删除行 [id: ' + data.id + '] 么', function (index) {
obj.del(); // 删除对应行tr的DOM结构
layer.close(index);
layer.confirm('真的删除行 [' + data.anchorName + '] 么', function (index) {
deleteRoomConfig(data.live_room_id)
.then(data => {
layer.msg(data.message)
if (data.status == 100) {
obj.del(); // 删除对应行tr的DOM结构
layer.close(index);
}
})
// 向服务端发送删除指令
});
}