页面稍微适配下移动端

新增登陆验证码一分钟内只能尝试三次
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 @SpringBootApplication
public class ToolsApplication { 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) { public static void main(String[] args) {
System.out.println("当前版本号:"+version); System.out.println("当前版本号:"+version);

View File

@ -124,8 +124,22 @@ public class userController {
@RequestMapping(value = "/login/login.do", method = RequestMethod.POST) @RequestMapping(value = "/login/login.do", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public String login(HttpServletResponse response, String code) { public String login(HttpServletRequest request,HttpServletResponse response, String code) {
JSONObject json = new JSONObject(); 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"); String secret= (String) ConfigTools.load(ConfigTools.DATA,"secret");
if(StringUtils.isEmpty(secret)){ if(StringUtils.isEmpty(secret)){
secret= (String) ConfigTools.load(ConfigTools.DATA,"secret_tmp"); secret= (String) ConfigTools.load(ConfigTools.DATA,"secret_tmp");

View File

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

View File

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

View File

@ -25,8 +25,9 @@
</div> </div>
<script> <script>
$(document).ready(function () { $(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) { if (mobile) {
$('#myside').removeClass('layui-side') $('#myside').removeClass('layui-side')
$('#myside_div').removeClass('layui-side-scroll') $('#myside_div').removeClass('layui-side-scroll')
$('#myside').addClass('layui-header') $('#myside').addClass('layui-header')

View File

@ -75,14 +75,16 @@
} }
}) })
function openLoginCode() { function openLoginCode() {
layer.prompt({ layer.prompt({
title: '安全登录码' title: '安全登录码'
}, function (value, index, elem) { }, 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); let json = JSON.parse(data);
layer.msg(json.msg) layer.msg(json.msg, function () {
window.location.reload() window.location.reload()
})
}); });
layer.close(index); layer.close(index);
}) })
@ -106,17 +108,18 @@
}) })
}) })
$(document).ready(function () { $(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) { if (mobile) {
$('.layui-body').css('left', '0') $('.layui-body').css('left', '0')
$('.layui-body').css('top', '150px') $('.layui-body').css('top', '150px')
$('.layui-body').css('height', '200%') $('.layui-body').css('height', '200%')
$('#icon').css('float', 'none') $('#icon').css('float', 'none')
$('.layui-body').css('position','absolute')
} else { } else {
$('.layui-body').css('padding-right', '100px') $('.layui-body').css('padding-right', '100px')
$('#icon').css('float', 'right') $('#icon').css('float', 'right')
$('.layui-body').css('position','fixed')
} }
}) })
</script> </script>