biliob/Web/index.html

141 lines
4.2 KiB
HTML
Raw Normal View History

2021-04-01 14:44:02 +08:00
<!DOCTYPE html>
2024-10-29 18:29:43 +08:00
<html lang="zh-CN">
2024-10-31 18:23:39 +08:00
2021-04-01 14:44:02 +08:00
<head>
2024-10-31 18:23:39 +08:00
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>DD监视器</title>
<link rel="stylesheet" href="/layui/css/layui.css">
2021-04-01 14:44:02 +08:00
</head>
<body>
2024-10-31 18:23:39 +08:00
<div id="header"></div>
<button id="btn" type="button" class="layui-btn" onclick="onButton()">默认按钮</button>
<div class="layui-row layui-col-space15">
<div id="card"></div>
</div>
</body>
<script id="liveCard" type="text/html">
{{# layui.each(d.data, function(index, item){ }}
<div class="layui-col-xs3">
<div class="layui-bg-gray" style="padding: 16px;">
<div class="layui-row layui-col-space15">
<div class="layui-card">
<div class="layui-card-header" ><img src="#" onerror="showImage('{{= item.anchorFace}}',this)" style="width: 40px; height: 40px;"/> {{= item.anchorName}}
<span style="float: right;">直播状态:
{{# if(item.live){ }}
<span class="layui-badge-dot layui-bg-green"></span>
{{# } else{ }}
<span class="layui-badge-dot"></span>
{{# }; }}
</span>
</div>
<div class="layui-card-body">
<img src="#" onerror="showImage('{{= item.cover}}',this)" style="width: 100%; height: 100%;"/><br>
{{= item.title}}<br>
直播录制状态:
{{# if(item.downloadVideo){ }}
<span style="color: #16b777" onclick="clickVideo('{{= item.roomId}}',true)">录制中</span>
{{# } else{ }}
<span style="color: #FD482C" onclick="clickVideo('{{= item.roomId}}',false)">监听中</span>
{{# }; }}<br>
弹幕录制状态:
{{# if(item.danmu){ }}
<span style="color: #16b777" onclick="clickDanmu('{{= item.roomId}}',true)">录制中</span>
{{# } else{ }}
<span style="color: #FD482C" onclick="clickDanmu('{{= item.roomId}}',false)">监听中</span>
{{# }; }}<br>
</div>
</div>
</div>
</div>
</div>
{{# }); }}
</script>
2021-04-01 14:44:02 +08:00
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
2024-10-29 18:29:43 +08:00
<script src="/js/CommonConfig.js"></script>
<script src="/js/httpUtils.js"></script>
2021-04-01 14:44:02 +08:00
<script>
2024-10-31 18:23:39 +08:00
headerModel = 0;
$('#header').load("/html/header.html");
function clickVideo(roomId, status) {
const title = "是否" + (status ? "停止" : "启动") + "录制视频?"
layer.confirm(title, { icon: 3 }, function () {
if (status) {
stopLiveVideo(roomId)
.then(data => {
layer.msg(data.message, { icon: (data.status == 100 ? 1 : 0) },function(){
location.reload();
});
})
} else {
startLiveVideo(roomId)
.then(data => {
layer.msg(data.message, { icon: (data.status == 100 ? 1 : 0) },function(){
location.reload();
});
})
}
}, function () {
});
}
function clickDanmu(roomId, status) {
const title = "是否" + (status ? "停止" : "启动") + "录制弹幕?"
layer.confirm(title, { icon: 3 }, function () {
if (status) {
stopLiveDanmu(roomId)
.then(data => {
layer.msg(data.message, { icon: (data.status == 100 ? 1 : 0) },function(){
location.reload();
});
})
} else {
startLiveDanmu(roomId)
.then(data => {
layer.msg(data.message, { icon: (data.status == 100 ? 1 : 0) },function(){
location.reload();
});
})
}
}, function () {
layer.msg('点击取消的回调');
});
}
2021-04-01 14:44:02 +08:00
</script>
2024-10-29 18:29:43 +08:00
<script>
2024-10-31 18:23:39 +08:00
layui.use(['laytpl'], function () {
var laytpl = layui.laytpl;
function initCard() {
getAllLive()
.then(data => {
2024-10-30 18:27:37 +08:00
console.log(data)
2024-10-31 18:23:39 +08:00
var view = $("#card").get(0);
laytpl($('#liveCard').get(0).innerHTML).render(data, function (html) {
view.innerHTML = html
});
2024-10-29 18:29:43 +08:00
})
2024-10-31 18:23:39 +08:00
}
function init() {
initCard()
}
init()
})
function onButton() {
}
2024-10-29 18:29:43 +08:00
</script>
2021-04-01 14:44:02 +08:00
<style>
2024-10-29 18:29:43 +08:00
2021-04-01 14:44:02 +08:00
</style>
2024-10-31 18:23:39 +08:00
2021-04-01 14:44:02 +08:00
</html>