IDEA簡(jiǎn)單實(shí)現(xiàn)登錄注冊(cè)頁(yè)面
application.yml
spring: datasource: username: root password: 123456 url: jdbc:mysql://localhost:3306/bd1906?serverTimezone=GMT%2B8 driver-class-name: com.mysql.cj.jdbc.Driver server: port: 8080
Controller層
@Controller
public class loginController {
@Autowired
private JdbcTemplate jdbcTemplate;
@RequestMapping("/index")
public String border(){
return "/index.html";
}
@RequestMapping("/login")
public String getUserFront(){
return "/login.html";
}
@RequestMapping(value = "/log",method = RequestMethod.POST)
@ResponseBody
public String log(String name,String psd){
String sql = "select * from user where username = '"+ name +"' and password = '"+psd+"'";
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
if(list.size() == 0){
return "0";
}
else{
return "1";
}
}
}
登錄頁(yè)面
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="./js/jquery-3.4.1.min.js"></script>
<title>login</title>
<style>
html,body{
width: 100%;height: 100%;margin: 0;padding: 0;
}
body{
background-image: url('./img/bg1.jpg');
background-size: 100% 100%;
background-repeat: no-repeat;
}
/* 標(biāo)題 */
.head{color: whitesmoke;font-size: 30px;text-align: center;margin-top: 10px;margin-bottom: 10px;}
/* 刀盤圖片 */
.cutter{text-align: center;margin-bottom: 10px;}
body .login_fields {
margin-top: 40px;
margin-left: 45%;
height: 208px;
position: absolute;
left: 0;
}
body .login_fields .icon {
position: absolute;
z-index: 1;
left: 36px;
top: 8px;
opacity: .5;
}
body .login_fields input[type='password'],body .login_fields input[type='text'] {
color: #61BFFF !important;
}
body .login_fields input[type='text'], body .login_fields input[type='password'] {
color: #afb1be;
width: 190px;
margin-top: -2px;
background: rgba(57, 61, 82, 0);
left: 0;
padding: 10px 65px;
border-top: 2px solid rgba(57, 61, 82, 0);
border-bottom: 2px solid rgba(57, 61, 82, 0);
border-right: none;
border-left: none;
outline: none;
font-family: 'Gudea', sans-serif;
box-shadow: none;
}
body .login_fields__user, body .login_fields__password {
position: relative;
}
body .login_fields__submit {
position: relative;
top: 17px;
left: 0;
width: 80%;
right: 0;
margin: auto;
}
body .login_fields__submit .forgot a {
color: #606479;
}
body .login_fields__submit input {
border-radius: 50px;
background: transparent;
padding: 10px 50px;
border: 2px solid #4FA1D9;
color: #4FA1D9;
text-transform: uppercase;
font-size: 11px;
-webkit-transition-property: background,color;
transition-property: background,color;
-webkit-transition-duration: .2s;
transition-duration: .2s;
}
body .login_fields__submit input:focus {
box-shadow: none;
outline: none;
}
body .login_fields__submit input:hover {
color: white;
background: #4FA1D9;
cursor: pointer;
-webkit-transition-property: background,color;
transition-property: background,color;
-webkit-transition-duration: .2s;
transition-duration: .2s;
}
</style>
</head>
<body>
<div class="head">
智能互聯(lián)裝備協(xié)同管理平臺(tái)
</div>
<div class="cutter">
<img src="./img/cutter.png" alt="" id="img" width="450px" height="450px">
</div>
<div class='login_fields'>
<div class='login_fields__user'>
<div class='icon' >
<img alt="" src='./img/user.png'>
</div>
<input id="userName" name="userName" placeholder='請(qǐng)輸入用戶名' maxlength="16" type='text' autocomplete="off" >
</div>
<div class='login_fields__password'>
<div class='icon' >
<img alt="" src='./img/lock.png'>
</div>
<input id="userPsd" name="userPsd" placeholder='請(qǐng)輸入密碼' maxlength="16" type='text' autocomplete="off" >
</div>
<div class='login_fields__submit'>
<input type='button' value='登錄' id="btLogin">
</div>
</div>
</body>
</html>
<script type="text/javascript">
//刀盤旋轉(zhuǎn)
var rotateVal = 0 // 旋轉(zhuǎn)角度
var InterVal // 定時(shí)器
window.onload = function () {
// 網(wǎng)頁(yè)加載完成后即運(yùn)行rotate函數(shù)
rotate()
}
// 設(shè)置定時(shí)器
function rotate () {
InterVal = setInterval(function () {
var img = document.getElementById('img')
rotateVal += 1
// 設(shè)置旋轉(zhuǎn)屬性(順時(shí)針)
img.style.transform = 'rotate(' + rotateVal + 'deg)'
// 設(shè)置旋轉(zhuǎn)時(shí)的動(dòng)畫(huà) 勻速0.1s
img.style.transition = '0.1s linear'
}, 100)
}
//判斷及請(qǐng)求
$(function () {
$("#btLogin").click(function () {
var name = $("#userName").val();
var psd = $("#userPsd").val();
console.log(name,psd);
if (name == "" || name == null){
alert("用戶名不能為空!")
return;
}
if (psd == "" || psd == null){
alert("密碼不能為空!")
return;
}
$.ajax({
type: "post",
url: "/log",
data: {name: name,psd: psd},
success:function(data){
if(data == "1"){
window.location.href="./index" rel="external nofollow" ;
}else{
alert("登錄失敗,賬號(hào)密碼不匹配!")
}
}
})
})
})
</script>
到此這篇關(guān)于IDEA簡(jiǎn)單實(shí)現(xiàn)登錄注冊(cè)頁(yè)面的文章就介紹到這了,更多相關(guān)idea實(shí)現(xiàn)登錄頁(yè)面內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Java簡(jiǎn)單實(shí)現(xiàn)session保存到redis的方法示例
這篇文章主要介紹了Java簡(jiǎn)單實(shí)現(xiàn)session保存到redis的方法,結(jié)合實(shí)例形式分析了Java將session存入redis緩存服務(wù)器的相關(guān)設(shè)置、實(shí)現(xiàn)技巧與操作注意事項(xiàng),需要的朋友可以參考下2018-05-05
使用dom4j遞歸解析節(jié)點(diǎn)內(nèi)還含有多個(gè)節(jié)點(diǎn)的xml
這篇文章主要介紹了使用dom4j遞歸解析節(jié)點(diǎn)內(nèi)還含有多個(gè)節(jié)點(diǎn)的xml,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-09-09
Springboot中整合knife4j接口文檔的過(guò)程詳解
knife4j就swagger的升級(jí)版API文檔的一個(gè)框架,但是用起來(lái)比swagger方便多了,UI更加豐富,這篇文章主要介紹了Springboot中整合knife4j接口文檔,需要的朋友可以參考下2022-04-04
關(guān)于spring 掃描不到j(luò)ar中class文件的原因分析及解決
這篇文章主要介紹了關(guān)于spring 掃描不到j(luò)ar中class文件的原因分析及解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-08-08
SpringBoot3整合mybatis-plus的實(shí)現(xiàn)
MyBatis-Plus是一個(gè)MyBatis的增強(qiáng)工具,在MyBatis的基礎(chǔ)上只做增強(qiáng)不做改變,本文主要介紹了Mybatis-Plus3.x的具體使用,具有一定的參考價(jià)值,感興趣的可以了解一下2023-10-10

