页面稍微适配下移动端

新增登陆验证码一分钟内只能尝试三次
This commit is contained in:
yutou 2021-02-23 11:16:56 +08:00
parent f93ae1e20e
commit f4cabd1155
6 changed files with 77 additions and 59 deletions

View File

@ -9,7 +9,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ToolsApplication {
public static final String version="1.0.17";
public static final String version="1.0.18";
public static void main(String[] args) {
System.out.println("当前版本号:"+version);

View File

@ -124,8 +124,22 @@ public class userController {
@RequestMapping(value = "/login/login.do", method = RequestMethod.POST)
@ResponseBody
public String login(HttpServletResponse response, String code) {
public String login(HttpServletRequest request,HttpServletResponse response, String code) {
JSONObject json = new JSONObject();
String ip=Tools.getRemoteAddress(request);
if(RedisTools.get(ip)==null||"-999".equals(ip)){
RedisTools.set(ip,"1",60);
}else{
int i=Integer.parseInt(RedisTools.get(ip));
if(i!=3){
i++;
RedisTools.set(ip,i+"",60);
}else{
json.put("code", -2);
json.put("msg", "请求频繁,请稍后再试");
return json.toJSONString();
}
}
String secret= (String) ConfigTools.load(ConfigTools.DATA,"secret");
if(StringUtils.isEmpty(secret)){
secret= (String) ConfigTools.load(ConfigTools.DATA,"secret_tmp");

View File

@ -32,7 +32,7 @@
$('#side').load("/html/body/nas/side.html");
$.get("/login/check.do", function (data) {
let json = JSON.parse(data);
if (json.code != 0) {
if (json.code !== 0) {
window.location.href = "/"
}
})

View File

@ -12,7 +12,7 @@
<div id="header"></div>
<div class="layui-body" style="left: 200px;">
<div id="side"></div>
<!-- <div id="side"></div>-->
<div style="margin-left: 2%; margin-top: 2%;">
<div>

View File

@ -1,7 +1,7 @@
<div class="layui-side layui-bg-black" id='myside'>
<div class="layui-side-scroll side-bg" id="myside_div" >
<div class="layui-side-scroll side-bg" id="myside_div">
<!-- 左侧导航区域可配合layui已有的垂直导航 -->
<ul class="layui-nav layui-nav-tree side-bg" lay-filter="test" >
<ul class="layui-nav layui-nav-tree side-bg" lay-filter="test">
<li class="layui-nav-item">
<a class="" href="javascript:;">本体管理</a>
<dl class="layui-nav-child">
@ -25,12 +25,13 @@
</div>
<script>
$(document).ready(function () {
let mobile = navigator.userAgent.toLowerCase().match(/android/i) === "android" || navigator.userAgent.toLowerCase().match(/iphone os/i) === "iphone os";
let mobile = layui.device().mobile;
if (mobile) {
$('#myside').removeClass('layui-side')
$('#myside_div').removeClass('layui-side-scroll')
$('#myside').addClass('layui-header')
$('#myside').css('height','100%')
$('#myside').css('height', '100%')
} else {
$('#myside').removeClass('layui-header')
@ -40,7 +41,7 @@
})
</script>
<style>
.side-bg{
.side-bg {
background-color: #2983BB;
}
</style>

View File

@ -7,7 +7,7 @@
</head>
<body>
<div class="layui-header">
<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;">
@ -28,7 +28,7 @@
<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>
<dd><a href="/html/body/nas/music.html">NAS音乐播放器</a></dd>
</dl>
</li>
<li class="layui-nav-item" id='icon'>
@ -39,7 +39,7 @@
</dl>
</li>
</ul>
</div>
</div>
</body>
<script src="/js/qrcode.min.js"></script>
<script>
@ -56,33 +56,35 @@
return;
}
$.post('/login/sendCaptcha.do', function (data) {
let json=JSON.parse(data);
if(json.code===1){
let json = JSON.parse(data);
if (json.code === 1) {
layer.open({
title:"使用Google身份验证器绑定",
content:"<div id=\"qrcode\"></div>",
success:function () {
title: "使用Google身份验证器绑定",
content: "<div id=\"qrcode\"></div>",
success: function () {
new QRCode(document.getElementById("qrcode"), json.data);
},
yes:function (index) {
yes: function (index) {
layer.close(index)
openLoginCode();
}
})
}else{
} else {
openLoginCode();
}
})
function openLoginCode() {
layer.prompt({
title: '安全登录码'
}, function (value, index, elem) {
$.post('/login/login.do', { code: value }, function (data) {
$.post('/login/login.do', {code: value}, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg)
layer.msg(json.msg, function () {
window.location.reload()
})
});
layer.close(index);
})
@ -97,26 +99,27 @@
});
$('#open_pc').click(function () {
layer.open({
title:"远程开机",
title: "远程开机",
content: "确定开机?",
yes:function (index) {
yes: function (index) {
$.post("/tools/openpc.do");
layer.close(index)
}
})
})
$(document).ready(function () {
let mobile = navigator.userAgent.toLowerCase().match(/android/i) === "android" || navigator.userAgent.toLowerCase().match(/iphone os/i) === "iphone os";
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>