111
This commit is contained in:
74
login.html
74
login.html
@@ -4,7 +4,8 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="./css/login.css">
|
||||
<title>注册</title>
|
||||
<title>登录</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.19.0/js/md5.min.js"></script>
|
||||
</head>
|
||||
<!-- 嵌入头部 -->
|
||||
<script type="text/javascript" src="./js/jquery.js"></script>
|
||||
@@ -42,7 +43,7 @@
|
||||
</div>
|
||||
<div class="popup-content__item popup-content__item3" style="margin-left: 20px;">
|
||||
<input class="inputCode" type="text" placeholder="验证码" id="loginCode" />
|
||||
<div class="codeImage" style="background-color: #238BF0;margin-left: 30px;"><img id="codeImg1"
|
||||
<div class="codeImage" style="margin-left: 30px;"><img id="codeImg1"
|
||||
onclick="changeCodeImg1()" class="img" style="height: 56px;"></div>
|
||||
</div>
|
||||
|
||||
@@ -52,11 +53,11 @@
|
||||
onclick="login()">
|
||||
登录
|
||||
</div>
|
||||
<div style="display: flex;flex-direction: row; justify-content: space-between; width: 30.8rem !important;
|
||||
<div style="display: flex;flex-direction: row; justify-content: right; width: 30.8rem !important;
|
||||
margin-top: 5px;">
|
||||
<div style="color: #238BF0;text-decoration: underline; font-size: 18px;"
|
||||
onclick="openPopup()">注册账号>></div>
|
||||
<div style="color: #238BF0;font-size: 18px;" onclick="forgetPsw()">忘记密码?</div>
|
||||
<div style="color: #238BF0; font-size: 18px;cursor: pointer"
|
||||
onclick="openPopup()">注册</div>
|
||||
<!-- <div style="color: #238BF0;font-size: 18px;" onclick="forgetPsw()">忘记密码?</div>-->
|
||||
|
||||
</div>
|
||||
|
||||
@@ -127,19 +128,32 @@
|
||||
</body>
|
||||
|
||||
<script>
|
||||
var time1 = Date.now()
|
||||
|
||||
function hash(s) {
|
||||
try {
|
||||
// 1. 计算MD5哈希
|
||||
const md5Hash = md5(s);
|
||||
// 2. 返回结果(md5函数已经返回16进制字符串)
|
||||
return md5Hash;
|
||||
} catch (e) {
|
||||
console.error("加密失败:", e);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
var time1 = Date.now()
|
||||
|
||||
var time2 = ''
|
||||
|
||||
$('#codeImg1').attr('src', 'http://aos.yyundong.com/ycsafe/captcha/captchaImagetype=math×tamp=' + time1);
|
||||
$('#codeImg1').attr('src', 'http://aos.yyundong.com/ycsafe/captcha/captchaImage?type=math×tamp=' + time1);
|
||||
|
||||
function openPopup() {
|
||||
document.getElementById("popup").style.display = "block";
|
||||
document.getElementById("mask").style.display = "block";
|
||||
|
||||
var time2 = Date.now()
|
||||
time2 = Date.now()
|
||||
|
||||
$('#codeImg2').attr('src', 'http://aos.yyundong.com/ycsafe/captcha/captchaImagetype=math×tamp=' +
|
||||
$('#codeImg2').attr('src', 'http://aos.yyundong.com/ycsafe/captcha/captchaImage?type=math×tamp=' +
|
||||
time2);
|
||||
}
|
||||
|
||||
@@ -165,7 +179,7 @@
|
||||
function login() {
|
||||
let telephone = $('#loginPhone').val();
|
||||
let password = $('#loginPsw').val();
|
||||
let captcha = $('#registerCode').val();
|
||||
let captcha = $('#loginCode').val();
|
||||
|
||||
$("#loginPhone").blur(function() {
|
||||
if (!telephone) {
|
||||
@@ -197,27 +211,35 @@
|
||||
return;
|
||||
}
|
||||
|
||||
$.post('http://aos.yyundong.com/loulan/business/buy/9', {
|
||||
$.post('http://aos.yyundong.com/ycsafe/website/login', {
|
||||
'telephone': telephone,
|
||||
'password': password,
|
||||
'captcha': captcha
|
||||
'password': hash(password),
|
||||
'captcha': captcha,
|
||||
'timestamp': time1
|
||||
|
||||
}, function(resp) {
|
||||
|
||||
if (!!resp && !!resp.result) {
|
||||
alert('正在登录...');
|
||||
window.location.href = 'serve.html';
|
||||
//
|
||||
// // 存储数据
|
||||
// localStorage.setItem('userName', resp.result.enterpriseName);
|
||||
//
|
||||
// // 读取数据
|
||||
// const value = localStorage.getItem('token');
|
||||
// const sessionValue = sessionStorage.getItem('token');
|
||||
// const userName = sessionStorage.getItem('userName');
|
||||
|
||||
console.log("登录>>>", resp.result);
|
||||
|
||||
// window.location.href = 'login.html';
|
||||
var cook = document.cookie;
|
||||
// 存储数据
|
||||
localStorage.setItem('token', cook.substring(6, document.cookie.length));
|
||||
localStorage.setItem('userName', resp.enterpriseName+"");
|
||||
localStorage.setItem('isLogin', resp.result);
|
||||
} else {
|
||||
alert(resp.message);
|
||||
|
||||
console.log("登录>>>", resp.message);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 注册函数
|
||||
@@ -276,7 +298,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
$.post('http://aos.yyundong.com/ycsafe/ycsafe/website/register', {
|
||||
$.post('http://aos.yyundong.com/ycsafe/website/register', {
|
||||
'name': name,
|
||||
'password': password,
|
||||
'telephone': telephone,
|
||||
@@ -286,8 +308,8 @@
|
||||
}, function(resp) {
|
||||
|
||||
if (!!resp && !!resp.result) {
|
||||
alert('注册成功,正在登录...');
|
||||
console.log("注册>>>", resp.result);
|
||||
alert('注册成功');
|
||||
closePopup()
|
||||
} else {
|
||||
alert(resp.message);
|
||||
}
|
||||
@@ -309,4 +331,4 @@
|
||||
time2);
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user