2024-10-31 18:23:39 +08:00
|
|
|
<head>
|
|
|
|
<link rel="stylesheet" href="/layui/css/layui.css">
|
|
|
|
<style>
|
|
|
|
.layui-form-label {
|
|
|
|
width: 120px !important;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
2024-10-30 18:27:37 +08:00
|
|
|
|
|
|
|
<body>
|
|
|
|
<input id="value" value="" type="hidden" />
|
2024-10-31 18:23:39 +08:00
|
|
|
<form class="layui-form layui-form-pane" action="" lay-filter="form-filter">
|
2024-10-30 18:27:37 +08:00
|
|
|
<div class="layui-form-item">
|
|
|
|
<label class="layui-form-label">直播房间地址</label>
|
2024-10-31 18:23:39 +08:00
|
|
|
<div class="layui-input-inline" style="width: 60%;">
|
|
|
|
<input type="text" id="url" name="url" autocomplete="off" placeholder="https://live.bilibili.com/xxxxx"
|
2024-10-30 18:27:37 +08:00
|
|
|
lay-verify="required" class="layui-input">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="layui-form-item" pane>
|
|
|
|
<label class="layui-form-label">录制弹幕</label>
|
|
|
|
<div class="layui-input-block">
|
2024-10-31 18:23:39 +08:00
|
|
|
<input type="checkbox" name="recordDanmu" lay-skin="switch" lay-filter="switchTest" title="启用|禁用">
|
2024-10-30 18:27:37 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="layui-form-item" pane>
|
|
|
|
<label class="layui-form-label">录制视频</label>
|
|
|
|
<div class="layui-input-block">
|
2024-10-31 18:23:39 +08:00
|
|
|
<input type="checkbox" name="recordLive" lay-skin="switch" lay-filter="switchTest" title="启用|禁用">
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-11-28 17:54:26 +08:00
|
|
|
<div class="layui-form-item" pane>
|
|
|
|
<label class="layui-form-label">录制视频时<br>同步录制弹幕</label>
|
|
|
|
<div class="layui-input-block"><br>
|
|
|
|
<input type="checkbox" name="syncDanmuForLive" lay-skin="switch" lay-filter="switchSync" title="启用|禁用">
|
|
|
|
<i class="layui-icon layui-icon-help layui-text-em " onclick="timeTips2(this)"></i>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
2024-10-31 18:23:39 +08:00
|
|
|
<div class="layui-form-item" pane>
|
|
|
|
<label class="layui-form-label">录制日期</label>
|
|
|
|
<div class="layui-input-block">
|
2024-11-28 17:54:26 +08:00
|
|
|
<input type="checkbox" name="week_1" title="周一" lay-skin="tag">
|
|
|
|
<input type="checkbox" name="week_2" title="周二" lay-skin="tag">
|
|
|
|
<input type="checkbox" name="week_3" title="周三" lay-skin="tag">
|
|
|
|
<input type="checkbox" name="week_4" title="周四" lay-skin="tag">
|
|
|
|
<input type="checkbox" name="week_5" title="周五" lay-skin="tag">
|
|
|
|
<input type="checkbox" name="week_6" title="周六" lay-skin="tag">
|
|
|
|
<input type="checkbox" name="week_7" title="周日" lay-skin="tag">
|
2024-10-30 18:27:37 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
2024-10-31 18:23:39 +08:00
|
|
|
<label class="layui-form-label">弹幕录制时间</label>
|
2024-10-30 18:27:37 +08:00
|
|
|
<div class="layui-input-inline">
|
2024-11-01 00:15:12 +08:00
|
|
|
<input type="text" name="recordDanmuDate" id="recordDanmuDate" value="00:00:00 - 23:59:59"
|
|
|
|
lay-verify="required" autocomplete="off" class="layui-input">
|
2024-10-30 18:27:37 +08:00
|
|
|
</div>
|
2024-11-01 18:21:57 +08:00
|
|
|
<div class="layui-form-mid layui-text-em" onclick="timeTips(false,this)"><i
|
2024-10-30 18:27:37 +08:00
|
|
|
class="layui-icon layui-icon-help"></i> </div>
|
|
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
2024-10-31 18:23:39 +08:00
|
|
|
<label class="layui-form-label">视频录制时间</label>
|
2024-10-30 18:27:37 +08:00
|
|
|
<div class="layui-input-inline">
|
2024-11-01 00:15:12 +08:00
|
|
|
<input type="text" name="recordLiveDate" id="recordLiveDate" value="00:00:00 - 23:59:59"
|
|
|
|
lay-verify="required" autocomplete="off" class="layui-input">
|
2024-10-30 18:27:37 +08:00
|
|
|
</div>
|
2024-11-01 18:21:57 +08:00
|
|
|
<div class="layui-form-mid layui-text-em" onclick="timeTips(true,this)"><i
|
2024-10-30 18:27:37 +08:00
|
|
|
class="layui-icon layui-icon-help"></i> </div>
|
|
|
|
</div>
|
|
|
|
<div class="layui-inline">
|
|
|
|
<label class="layui-form-label">录制绑定用户</label>
|
|
|
|
<div id="selects" class="layui-input-inline">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
|
|
|
<button class="layui-btn" lay-submit lay-filter="submit-form">确认</button>
|
2024-10-31 18:23:39 +08:00
|
|
|
<button id="btn_reset" type="reset" class="layui-btn layui-btn-primary">重置</button>
|
2024-10-30 18:27:37 +08:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
<script id="selectUser" type="text/html">
|
2024-10-31 18:23:39 +08:00
|
|
|
<select id="recordUid" name="recordUid" lay-search>
|
|
|
|
<option value="">不登陆</option>
|
2024-10-30 18:27:37 +08:00
|
|
|
{{# layui.each(d.data, function(index, item){ }}
|
|
|
|
<option value="{{= item.uid}}">[{{=item.uid}}]{{= item.uname}}</option>
|
|
|
|
{{# }); }}
|
|
|
|
</select>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script src="/layui/layui.js"></script>
|
|
|
|
<script src="/js/jquery-3.2.1.js"></script>
|
|
|
|
<script src="/js/httpUtils.js"></script>
|
2024-10-31 18:23:39 +08:00
|
|
|
<script src="/js/CommonConfig.js"></script>
|
2024-10-30 18:27:37 +08:00
|
|
|
<script>
|
2024-11-27 17:39:02 +08:00
|
|
|
function timeTips(isLive, that) {
|
|
|
|
if (isLive) {
|
2024-11-01 18:21:57 +08:00
|
|
|
layer.tips('是从开始到结束时间范围内,主播开播会启动录制,超过结束范围不会中断正在录制的任务', that);
|
2024-11-27 17:39:02 +08:00
|
|
|
} else {
|
2024-11-01 18:21:57 +08:00
|
|
|
layer.tips('仅在当前时间范围内录制,如遇到正在直播,则延迟到下播时停止录制', that);
|
|
|
|
}
|
2024-11-27 17:39:02 +08:00
|
|
|
|
2024-11-28 17:54:26 +08:00
|
|
|
}
|
|
|
|
function timeTips2(that) {
|
|
|
|
layer.tips('启用后,录制视频时会同步录制弹幕,下播后会同步停止录制.同时上面录制弹幕按钮将失效', that);
|
|
|
|
|
2024-10-30 18:27:37 +08:00
|
|
|
}
|
2024-10-31 18:23:39 +08:00
|
|
|
var roomId = getParam("roomId");
|
2024-11-27 17:39:02 +08:00
|
|
|
var editArray = getParam("array")
|
2024-10-31 18:23:39 +08:00
|
|
|
|
|
|
|
layui.use(['form', 'laytpl', 'laydate'], function () {
|
2024-10-30 18:27:37 +08:00
|
|
|
var form = layui.form;
|
|
|
|
var layer = layui.layer;
|
2024-10-31 18:23:39 +08:00
|
|
|
var laytpl = layui.laytpl;
|
|
|
|
var laydate = layui.laydate;
|
|
|
|
var windowsIndex;
|
|
|
|
form.render();
|
2024-10-30 18:27:37 +08:00
|
|
|
// 提交事件
|
|
|
|
form.on('submit(submit-form)', function (data) {
|
|
|
|
var field = data.field; // 获取表单字段值
|
2024-10-31 18:23:39 +08:00
|
|
|
windowsIndex = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe 层的索引
|
2024-10-30 18:27:37 +08:00
|
|
|
// 显示填写结果,仅作演示用
|
|
|
|
|
|
|
|
// 此处可执行 Ajax 等操作
|
|
|
|
// …
|
2024-11-01 00:15:12 +08:00
|
|
|
var weeks = [
|
|
|
|
]
|
|
|
|
for (let i = 1; i <= 7; i++) {
|
|
|
|
if (field[`week_${i}`] === 'on') {
|
|
|
|
weeks.push(i.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
field.weeks = weeks;
|
2024-10-31 18:23:39 +08:00
|
|
|
console.log(field)
|
2024-11-27 17:39:02 +08:00
|
|
|
if (editArray === null) {
|
2024-11-28 17:54:26 +08:00
|
|
|
var loadIndex = showLoadingDialog();
|
2024-11-27 17:39:02 +08:00
|
|
|
addRoomConfig(field)
|
|
|
|
.then(json => {
|
|
|
|
layer.close(loadIndex)
|
|
|
|
layer.msg(json.message, function () {
|
|
|
|
if (json.status == 100) {
|
|
|
|
close()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
var array = []
|
|
|
|
editArray.split(',').forEach(element => {
|
|
|
|
array.push(element)
|
|
|
|
});
|
2024-11-28 17:54:26 +08:00
|
|
|
var loadIndex = showLoadingDialog();
|
2024-11-27 17:39:02 +08:00
|
|
|
setArrayRoomConfig(array, field)
|
|
|
|
.then(json => {
|
|
|
|
layer.close(loadIndex)
|
|
|
|
layer.msg(json.message, function () {
|
|
|
|
if (json.status == 100) {
|
|
|
|
close()
|
|
|
|
}
|
|
|
|
})
|
2024-11-01 00:15:12 +08:00
|
|
|
})
|
2024-11-27 17:39:02 +08:00
|
|
|
}
|
2024-10-31 18:23:39 +08:00
|
|
|
|
|
|
|
|
2024-10-30 18:27:37 +08:00
|
|
|
return false; // 阻止默认 form 跳转
|
|
|
|
});
|
|
|
|
|
2024-10-31 18:23:39 +08:00
|
|
|
function close() {
|
|
|
|
parent.layer.close(windowsIndex);
|
2024-10-30 18:27:37 +08:00
|
|
|
}
|
2024-10-31 18:23:39 +08:00
|
|
|
laydate.render({
|
|
|
|
elem: '#recordDanmuDate',
|
|
|
|
type: 'time',
|
|
|
|
range: true
|
|
|
|
});
|
|
|
|
laydate.render({
|
|
|
|
elem: '#recordLiveDate',
|
|
|
|
type: 'time',
|
|
|
|
range: true
|
|
|
|
});
|
2024-11-28 17:54:26 +08:00
|
|
|
form.on('switch(switchSync)', function (data) {
|
|
|
|
if (form.val('form-filter').syncDanmuForLive === 'on') {
|
|
|
|
$("[name='recordDanmu']").prop("disabled", true);
|
|
|
|
} else {
|
|
|
|
$("[name='recordDanmu']").prop("disabled", false);
|
|
|
|
}
|
|
|
|
form.render();
|
|
|
|
});
|
2024-10-31 18:23:39 +08:00
|
|
|
function init() {
|
|
|
|
getUserInfo();
|
|
|
|
if (roomId !== null) {
|
|
|
|
$('#btn_reset').get(0).disabled = true;
|
|
|
|
editRoom()
|
|
|
|
}
|
2024-11-27 17:39:02 +08:00
|
|
|
if (editArray !== null) {
|
|
|
|
editArrayRoom()
|
|
|
|
}
|
2024-10-31 18:23:39 +08:00
|
|
|
}
|
|
|
|
function getUserInfo() {
|
|
|
|
getBiliAllUser()
|
|
|
|
.then(data => {
|
|
|
|
var view = $("#selects").get(0);
|
|
|
|
laytpl($('#selectUser').get(0).innerHTML).render(data, function (html) {
|
|
|
|
view.innerHTML = html
|
|
|
|
form.render('select');
|
|
|
|
});
|
2024-10-30 18:27:37 +08:00
|
|
|
|
2024-10-31 18:23:39 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
function editRoom() {
|
|
|
|
getRoomConfig(roomId)
|
|
|
|
.then(data => {
|
|
|
|
if (data.status === 100) {
|
|
|
|
var json = data.data;
|
2024-11-01 00:15:12 +08:00
|
|
|
var result = {
|
2024-10-31 18:23:39 +08:00
|
|
|
'url': 'https://live.bilibili.com/' + json.live_room_id,
|
|
|
|
'recordLive': json.recordLive,
|
|
|
|
'recordDanmu': json.recordDanmu,
|
|
|
|
'recordDanmuDate': json.recordDanmuDate,
|
2024-11-01 00:15:12 +08:00
|
|
|
'recordLiveDate': json.recordLiveDate,
|
2024-11-28 17:54:26 +08:00
|
|
|
'syncDanmuForLive': json.syncDanmuForLive,
|
2024-11-01 00:15:12 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
for (let i = 0; i < json.weeks.length; i++) {
|
|
|
|
result[`week_${json.weeks[i]}`] = true;
|
|
|
|
}
|
2024-11-27 17:39:02 +08:00
|
|
|
form.val('form-filter', result);
|
2024-11-28 17:54:26 +08:00
|
|
|
if (json.syncDanmuForLive) {
|
|
|
|
$("[name='recordDanmu']").prop("disabled", true);
|
|
|
|
} else {
|
|
|
|
$("[name='recordDanmu']").prop("disabled", false);
|
|
|
|
}
|
2024-10-31 18:23:39 +08:00
|
|
|
$('#url').get(0).disabled = true;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2024-11-27 17:39:02 +08:00
|
|
|
function editArrayRoom() {
|
|
|
|
$('#btn_reset').get(0).disabled = true;
|
|
|
|
$('#url').get(0).disabled = true;
|
|
|
|
var result = {
|
|
|
|
'url': editArray
|
|
|
|
};
|
|
|
|
form.val('form-filter', result);
|
|
|
|
}
|
2024-10-31 18:23:39 +08:00
|
|
|
init();
|
2024-10-30 18:27:37 +08:00
|
|
|
});
|
|
|
|
</script>
|