add 新增了批量订阅 add
This commit is contained in:
115
Web/index.html
115
Web/index.html
@@ -11,12 +11,38 @@
|
||||
<body>
|
||||
<div id="header"></div>
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div id="follow">
|
||||
</div>
|
||||
<div id="card"></div>
|
||||
</div><br>
|
||||
<div id="page"></div>
|
||||
</body>
|
||||
|
||||
<script id="followStatus" type="text/html">
|
||||
{{# layui.each(d.data, function(index, item){ }}
|
||||
{{# if(item.status !== -1) { }}
|
||||
{{# var color = item.status === -100 ? "#16b777" : "#ffb800"; }}
|
||||
{{# var icon = item.status === -100 ? "layui-icon-ok-circle" : "layui-icon-flag"; }}
|
||||
{{# var isOver = item.status === -100; }}
|
||||
|
||||
<blockquote class="layui-elem-quote" style="border-left: 5px solid {{= color}}; margin-left: 5dvw; margin-top: 5dvh; margin-right: 5dvw;">
|
||||
<i class="layui-icon {{= icon }}" style="font-size: 20px; color: {{= color}};"></i>
|
||||
<span style="font-size: 16px;" id="{{= item.data}}">
|
||||
{{= item.message}}
|
||||
</span>
|
||||
{{# if(isOver) { }}
|
||||
<span style="float: right;">
|
||||
<button type="button" class="layui-btn layui-btn-sm" onclick="confirmFollow({{= item.data}})">确认</button>
|
||||
</span>
|
||||
{{# } else { }}
|
||||
<span style="float: right;">
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-bg-orange" onclick="confirmFollow({{= item.data}})">取消</button>
|
||||
</span>
|
||||
{{# } }}
|
||||
</blockquote>
|
||||
{{# } }}
|
||||
{{# }); }}
|
||||
</script>
|
||||
<script id="liveCard" type="text/html">
|
||||
{{# layui.each(d.data, function(index, item){ }}
|
||||
<div class="layui-col-xs3 layui-col-sm3 layui-col-md3">
|
||||
@@ -33,20 +59,21 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<img src="#" onerror="showTmpImage('{{= item.cover}}',this)" onclick="toLive('{{= item.roomId}}')" style="width: 100%; height: 100%;"/><br>
|
||||
<img src="#" onerror="showTmpImage('{{= item.cover}}',this)" onclick="toLive('{{= item.roomId}}')" style="width: 312px; height: 175px; object-fit: cover;"/><br>
|
||||
<!-- <img src="#" onerror="showImage('{{= item.cover}}',this)" onclick="toLive('{{= item.roomId}}')" style="width: 100%; height: 100%;"/><br> -->
|
||||
{{= item.title}}<br>
|
||||
<p>开播时长:{{= item.liveTime}}</p>
|
||||
直播录制状态:
|
||||
{{# if(item.downloadVideo){ }}
|
||||
<span style="color: #16b777" onclick="clickVideo('{{= item.roomId}}',true)">录制中</span>
|
||||
{{# } else{ }}
|
||||
<span style="color: #FD482C" onclick="clickVideo('{{= item.roomId}}',false)">监听中</span>
|
||||
<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>
|
||||
<span style="color: #FD482C" onclick="clickDanmu('{{= item.roomId}}',false)">待机中</span>
|
||||
{{# }; }}<br>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,9 +91,9 @@
|
||||
<script>
|
||||
headerModel = 0;
|
||||
$('#header').load("/html/header.html");
|
||||
function toLive(roomId){
|
||||
function toLive(roomId) {
|
||||
console.log(roomId)
|
||||
window.open("https://live.bilibili.com/"+roomId,'_blank')
|
||||
window.open("https://live.bilibili.com/" + roomId, '_blank')
|
||||
}
|
||||
function clickVideo(roomId, status) {
|
||||
const title = "是否" + (status ? "停止" : "启动") + "录制视频?"
|
||||
@@ -114,6 +141,12 @@
|
||||
layer.msg('点击取消的回调');
|
||||
});
|
||||
}
|
||||
function confirmFollow(userId) {
|
||||
confirmFollowStatus(userId)
|
||||
.then(data => {
|
||||
layer.msg(data.message)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
layui.use(['laytpl', 'laypage'], function () {
|
||||
@@ -121,9 +154,9 @@
|
||||
var laypage = layui.laypage;
|
||||
var pageIndex = 1;
|
||||
var pageMax = 16;
|
||||
var listCount=10;
|
||||
var listMax=pageMax;
|
||||
var initPage=true;
|
||||
var listCount = 10;
|
||||
var listMax = pageMax;
|
||||
var initPage = true;
|
||||
function initCard() {
|
||||
var loadIndex = layer.msg('加载中', {
|
||||
icon: 16,
|
||||
@@ -131,9 +164,9 @@
|
||||
});
|
||||
getAllLive(pageIndex, pageMax)
|
||||
.then(data => {
|
||||
listCount=data.count;
|
||||
if(initPage){
|
||||
initPage=false;
|
||||
listCount = data.count;
|
||||
if (initPage) {
|
||||
initPage = false;
|
||||
initPageView();
|
||||
}
|
||||
var view = $("#card").get(0);
|
||||
@@ -141,29 +174,53 @@
|
||||
view.innerHTML = html;
|
||||
layer.close(loadIndex)
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
function initFollowStatus(init) {
|
||||
checkFollowStatus('')
|
||||
.then(data => {
|
||||
var tmp = -1;
|
||||
data.data.forEach(element => {
|
||||
tmp = element.status;
|
||||
});
|
||||
if (tmp === -1) {
|
||||
return
|
||||
}
|
||||
if (init) {
|
||||
var view = $("#follow").get(0);
|
||||
laytpl($('#followStatus').get(0).innerHTML).render(data, function (html) {
|
||||
view.innerHTML = html;
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
initFollowStatus(true)
|
||||
}, 1000);
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
function init() {
|
||||
initCard()
|
||||
initCard();
|
||||
initFollowStatus(true);
|
||||
}
|
||||
function initPageView(){
|
||||
function initPageView() {
|
||||
laypage.render({
|
||||
elem: 'page',
|
||||
limit: 16,
|
||||
curr: pageIndex,
|
||||
limits: [4, 8, 16, 24, 32, 40],
|
||||
layout: ['prev', 'page', 'next', 'limit'],
|
||||
count: listCount, // 数据总数
|
||||
jump: function (obj, first) {
|
||||
listMax=obj.limit
|
||||
if (!first) {
|
||||
pageIndex =obj.curr;
|
||||
pageMax = obj.limit;
|
||||
initCard()
|
||||
}
|
||||
}
|
||||
});
|
||||
elem: 'page',
|
||||
limit: 16,
|
||||
curr: pageIndex,
|
||||
limits: [4, 8, 16, 24, 32, 40],
|
||||
layout: ['prev', 'page', 'next', 'limit'],
|
||||
count: listCount, // 数据总数
|
||||
jump: function (obj, first) {
|
||||
listMax = obj.limit
|
||||
if (!first) {
|
||||
pageIndex = obj.curr;
|
||||
pageMax = obj.limit;
|
||||
initCard()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
init()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user