biliob/Web/html/ui/createConfig.html

175 lines
6.7 KiB
HTML
Raw Normal View History

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>
<div class="layui-form-item" pane>
<label class="layui-form-label">录制日期</label>
<div class="layui-input-block">
<input type="checkbox" name="2" title="周一" lay-skin="tag">
<input type="checkbox" name="3" title="周二" lay-skin="tag">
<input type="checkbox" name="4" title="周三" lay-skin="tag">
<input type="checkbox" name="5" title="周四" lay-skin="tag">
<input type="checkbox" name="6" title="周五" lay-skin="tag">
<input type="checkbox" name="7" title="周六" lay-skin="tag">
<input type="checkbox" name="1" 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-10-31 18:23:39 +08:00
<input type="text" name="recordDanmuDate" id="recordDanmuDate" lay-verify="required" autocomplete="off"
class="layui-input">
2024-10-30 18:27:37 +08:00
</div>
<div class="layui-form-mid layui-text-em" onclick="timeTips(this)"><i
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-10-31 18:23:39 +08:00
<input type="text" name="recordLiveDate" id="recordLiveDate" lay-verify="required"
autocomplete="off" class="layui-input">
2024-10-30 18:27:37 +08:00
</div>
<div class="layui-form-mid layui-text-em" onclick="timeTips(this)"><i
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>
function timeTips(that) {
layer.tips('填写[分钟][小时][星期],空格分割,例如预定每周6晚上8点之后才开始录制则填写:* 8 6', that);
}
2024-10-31 18:23:39 +08:00
var roomId = getParam("roomId");
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-10-31 18:23:39 +08:00
console.log(field)
// addRoomConfig(field)
// .then(json => {
// layer.msg(json.message, function () {
// if (json.status == 100) {
// close()
// }
// })
// })
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
});
function init() {
getUserInfo();
if (roomId !== null) {
$('#btn_reset').get(0).disabled = true;
editRoom()
}
}
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;
form.val('form-filter', {
'url': 'https://live.bilibili.com/' + json.live_room_id,
'recordLive': json.recordLive,
'recordDanmu': json.recordDanmu,
'recordDanmuDate': json.recordDanmuDate,
'recordLiveDate': json.recordLiveDate
});
$('#url').get(0).disabled = true;
}
})
}
init();
2024-10-30 18:27:37 +08:00
});
</script>