web_toolset/web/html/header.html
yutou f4cabd1155 页面稍微适配下移动端
新增登陆验证码一分钟内只能尝试三次
2021-02-23 11:16:56 +08:00

128 lines
4.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div class="layui-header">
<ul class="layui-nav" lay-filter="" style="background-color: #1772B4;">
<li class="layui-nav-item"><a href="http://blog.yutou233.cn">博客</a></li>
<div id="admin" style="display: inline-block; font-size: 0px;">
<li class="layui-nav-item"><a href="/html/body/nas/index.html">NAS管理</a>
</li>
</div>
<li class="layui-nav-item">
<a href="javascript:;">工具集</a>
<dl class="layui-nav-child">
<dd><a href="/html/body/tools/password.html">密码管理器</a></dd>
<dd><a href="javascript:;" id="open_pc">远程开机</a></dd>
</dl>
</li>
<li class="layui-nav-item">
<a href="javascript:;">页面集</a>
<dl class="layui-nav-child">
<dd><a href="http://nas.yutou233.cn/" target="_blank">管理后台</a></dd>
<dd><a href="http://bt.yutou233.cn" target="_blank">BT下载</a></dd>
<dd><a href="http://tools.yutou233.cn/jellyfin.do" target="_blank">jellyfin</a></dd>
<dd><a href="/html/body/nas/music.html">NAS音乐播放器</a></dd>
</dl>
</li>
<li class="layui-nav-item" id='icon'>
<a href="javascript:;" id="login"><img src="/assets/defaultPlayImg.jpg" class="layui-nav-img"><span
id='login_text'>登录</span></a>
<dl class="layui-nav-child">
<dd><a href="javascript:;" id="logout">退了</a></dd>
</dl>
</li>
</ul>
</div>
</body>
<script src="/js/qrcode.min.js"></script>
<script>
let loginStatus = false;
$.get("/login/check.do", function (data) {
let json = JSON.parse(data);
if (json.code === 0) {
$('#login_text').text('已登录')
loginStatus = true;
}
})
$('#login').click(function () {
if (loginStatus) {
return;
}
$.post('/login/sendCaptcha.do', function (data) {
let json = JSON.parse(data);
if (json.code === 1) {
layer.open({
title: "使用Google身份验证器绑定",
content: "<div id=\"qrcode\"></div>",
success: function () {
new QRCode(document.getElementById("qrcode"), json.data);
},
yes: function (index) {
layer.close(index)
openLoginCode();
}
})
} else {
openLoginCode();
}
})
function openLoginCode() {
layer.prompt({
title: '安全登录码'
}, function (value, index, elem) {
$.post('/login/login.do', {code: value}, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg, function () {
window.location.reload()
})
});
layer.close(index);
})
}
})
$('#logout').click(function () {
$.post('/login/logout.do', function (data) {
let json = JSON.parse(data);
layer.msg(json.msg)
window.location.href = "/"
})
});
$('#open_pc').click(function () {
layer.open({
title: "远程开机",
content: "确定开机?",
yes: function (index) {
$.post("/tools/openpc.do");
layer.close(index)
}
})
})
$(document).ready(function () {
let mobile = layui.device().mobile;
if (mobile) {
$('.layui-body').css('left', '0')
$('.layui-body').css('top', '150px')
$('.layui-body').css('height', '200%')
$('#icon').css('float', 'none')
$('.layui-body').css('position','absolute')
} else {
$('.layui-body').css('padding-right', '100px')
$('#icon').css('float', 'right')
$('.layui-body').css('position','fixed')
}
})
</script>
<style>
</style>
</html>