copyright-official-website/src/components/Register.html

847 lines
22 KiB
HTML
Raw Normal View History

2024-06-03 09:43:48 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/svg+xml" href="./assets/AImzhu.svg">
<title>注册界面</title>
</head>
<link rel="stylesheet" href="./style.css">
<!-- <link rel="stylesheet" href="./layer/layer.css"> -->
<link rel="stylesheet" href="./layui/css/layui.css">
<link rel="stylesheet" href="./assets/font/iconfont.css">
<style>
.register-page {
position: relative;
width: 100vw;
height: 100vh;
background: url(./assets/img/login-register-bj.png) no-repeat;
background-size: cover;
}
.nav {
display: flex;
justify-content: space-between;
position: relative;
width: 100%;
padding: 0, 10px;
}
.sign {
display: flex;
/* position: absolute; */
width: 500px;
height: 80px;
}
.sign h2 {
width: 180px;
height: 60px;
line-height: 60px;
text-align: center;
/* padding: auto 20px auto 50px; */
font-size: 36px;
margin: auto 20px auto 50px;
}
.sign p {
width: 180px;
height: 30px;
line-height: 30px;
font-size: 14px;
margin: auto 0;
/* height: 20px; */
padding: 0 25px;
border-left: 2px solid rgba(0, 0, 0, .2);
}
.sign a {
width: 260px;
height: 46px;
margin-left: 50px;
margin-top: 17px;
}
.go-page {
display: flex;
justify-content: end;
/* position: absolute; */
width: 260px;
height: 80px;
/* border: 2px solid red; */
font-size: 16px;
/* right: 0; */
}
.go-page #login {
height: 30px;
line-height: 30px;
margin: auto 0;
margin-right: 20px;
padding: 0 20px;
border-radius: 20px;
/* border: none; */
background-color: rgba(255, 255, 255, .4);
color: #42210B;
}
.go-page #back-homepage {
height: 30px;
line-height: 30px;
margin: auto 0;
margin-right: 40px;
padding: 0 20px;
border-radius: 20px;
border: none;
/* background-color: rgba(255, 255, 255, .3); */
background-color: #42210B;
color: #FFF;
}
#login:hover {
background-color: #42210B;
color: #FFF;
font-weight: 700;
cursor: pointer;
}
#back-homepage:hover {
background-color: #332817;
color: #FFF;
font-weight: 700;
cursor: pointer;
}
#zcbd {
width: 420px;
margin: 50px auto;
}
ul {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
/* width: 380px; */
/* margin: auto; */
padding: 20px 40px;
border-radius: 20px;
background-color: #fff;
}
ul li {
display: flex;
margin: auto;
width: 340px;
height: 38px;
margin-bottom: 20px;
}
ul li input,
ul li select {
width: 340px;
height: 36px;
padding-left: 20px;
border: 1.25px solid #CCCCCC;
border-radius: 3px;
background-color: #fff;
}
input:-webkit-autofill {
background: transparent;
transition: background-color 50000s ease-in-out 0s;
-webkit-text-fill-color: unset;
}
input::-webkit-input-placeholder {
color: #999999
}
ul li input:focus {
border: 0.5px solid #fa911e;
}
ul li input:hover {
border: 0.25px solid #fa911e;
}
ul li:nth-child(1) {
display: flex;
flex-direction: column;
height: 50px;
}
ul li:nth-child(1) h4 {
/* width: 100px; */
height: 30px;
line-height: 30px;
/* text-align: center; */
font-size: 18px;
font-weight: 700;
/* border-bottom: 5px solid #fda633; */
margin: auto 10px;
margin-bottom: 5px;
}
ul li:nth-child(1) span {
height: 5px;
width: 50px;
margin-left: 35px;
background-color: #fda633;
}
/* ul li:nth-child(3) #yzm:hover {
cursor: pointer;
color: #333;
font-weight: 550;
-webkit-box-shadow: 0 0 10px #fda633;
-moz-box-shadow: 0 0 10px #fda633;
box-shadow: 0 0 10px #fda633;
} */
ul li:nth-child(3) {
position: relative;
}
ul li:nth-child(3) #yzm {
position: absolute;
right: 10px;
font-size: 14px;
line-height: 36px;
color: #0095ff;
cursor: pointer;
background-color: transparent;
border: none;
}
ul li:nth-child(3) #yzm:hover {
opacity: 0.6;
}
ul li:nth-child(4) {
position: relative;
}
ul li:nth-child(4) span {
position: absolute;
top: 11px;
right: 5px;
width: 16px;
height: 16px;
/* border: 1px solid red; */
}
ul li:nth-child(4) span:hover {
color: #007bff;
}
/* ul li:nth-child(5) #userRole {
color: #333;
} */
ul li:nth-child(5) {
height: 26px;
/* line-height: 16px; */
font-size: 12px;
margin-bottom: 10px;
margin-top: 10px;
}
ul li:nth-child(5) .row {
display: flex;
position: relative;
width: 340px;
}
ul li:nth-child(5) #chec {
/* display: flex; */
position: absolute;
bottom: 5px;
width: 16px;
height: 16px;
/* margin-left: 10px; */
}
ul li:nth-child(5) p {
/* display: flex; */
position: absolute;
bottom: 6px;
height: 16px;
margin-left: 24px;
}
ul li:nth-child(5) p a:hover {
color: #007bff;
}
ul li:nth-child(6) button {
width: 340px;
height: 40px;
border: none;
border-radius: 6px;
background-color: #fda633;
color: #FFF;
font-size: 16px;
}
ul li:nth-child(6) button:hover {
cursor: pointer;
font-size: 18px;
-webkit-box-shadow: 0 0 10px #fda633;
-moz-box-shadow: 0 0 10px #fda633;
box-shadow: 0 0 10px #fda633;
}
ul li:nth-child(7) {
font-size: 14px;
margin-bottom: 0;
justify-content: flex-end;
}
ul li:nth-child(7) a {
color: #007bff;
}
ul li:nth-child(7) a:hover {
opacity: 0.6;
}
.custom-bg-color {
background-color: rgba(8, 195, 237, 0.3) !important;
}
.custom-font-size {
font-size: 20px !important;
}
.custom-bold-font {
font-weight: bold !important;
}
.custom-color {
color: #FFF !important;
}
.custom-border {
border: 2px solid red !important;
}
</style>
<body>
<div class="register-page">
<div class="nav">
<div class="sign">
<!-- <h2><a href="http://121.36.71.250:58040/src/components/#/HomePage">腾狮科技</a></h2>
<p>AI人工智能软著申请</p> -->
<a href="https://www.aimzhu.com">
<img src="./assets/img/headicon2.png" alt="logo图标">
</a>
</div>
<div class="go-page">
<a id="login" href="https://www.aimzhu.com/operator/">登录</a>
<a id="back-homepage" href="https://www.aimzhu.com">返回首页</a>
</div>
</div>
<!-- 注册框 -->
<form action="" id="zcbd" class="register">
<ul class="register_box">
<!-- 1 标题 -->
<li>
<h4>平台账号注册</h4>
<span></span>
</li>
<!-- 2 手机号输入框 -->
<li>
<input id="phone" type="text" placeholder="请输入您的真实手机号" onfocus="getphone()" onblur="losephone()">
</li>
<!-- 3 点击获取验证码 -->
<!-- <li>
<input id="yzm" type="button" value="点击获取验证码">
</li> -->
<!-- 3 输入短信验证码 -->
<li>
<input id="inputyzm" type="text" placeholder="请输入短信验证码" onfocus="getinputyzm()" onblur="loseinputyzm()">
<button type="button" id="yzm">获取验证码</button>
</li>
<!-- 4. 设置密码 -->
<li>
<input id="password" type="password" placeholder="请输入8~16位密码区分大小写" onfocus="getpassword()"
onblur="losepassword()">
<span id="passwordeye" class="iconfont icon-xianshiyincang1"></span>
</li>
<!-- 5. 选择用户角色 -->
<!-- <li>
<select id="userRole" name="userRole">
<option selected disabled value="">普通用户/代理商</option>
<option value="606f85bc-63fd-407e-8e2e-6ce48178b70a">普通用户</option>
<option value="d67bf05f-4d1c-43c1-bd15-41730c1dd117">代理商</option>
</select>
</li> -->
<!-- 5. 勾选用户协议 -->
<li>
<div class="row" id="row123">
<input id="chec" type="checkbox">
<p>我同意平台
<!-- <a id="openUserAgreement" class="layer-btn"
href="J:\project\Ai_Softness\src\components\UserAgreement.html" target="_blank">《用户服务协议》</a> -->
2024-06-03 17:29:08 +08:00
<a id="openUserAgreement" class="layer-btn" href="https://www.aimzhu.com/UserAgreement.html"
target="_blank">《用户服务协议》</a><a href="https://www.aimzhu.com/PrivacyPolicy.html"
target="_blank">《隐私条款》</a>
2024-06-03 09:43:48 +08:00
<!-- <a id="openUserAgreement" class="layer-btn" onclick="xieyiPage()">《用户服务协议》</a> -->
</p>
</div>
</li>
<!-- 6. 点击注册 -->
<li>
<button type="button" id="register" class="stopbtn" onclick="usersubmit()">注册</button>
</li>
<!-- 7. 已有账号,立即登录 -->
<li>
<!-- <p>已有账号?<a href="http://192.168.0.115:8091/operator/route/systemuser/login">立即登录</a></p> -->
<p>已有账号?<a href="https://www.aimzhu.com/operator/">立即登录</a></p>
</li>
</ul>
</form>
</div>
<script src="./jquery.min.js"></script>
<script src="./layui/layui.js"></script>
<!-- <script src="./layer/layer.js"></script> -->
<script src="./Register.js"></script>
<script src="https://g.alicdn.com/AWSC/AWSC/awsc.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
// 2. 验证手机号
function getphone() {
layer.tips('请输入您的真实手机号', '#phone', {
// id: 'tips1',
shadeClose: false,
tips: [2, '#30a6f5'],
time: 0,
area: ['auto', '36px'],
show: true
})
}
//手机号失去焦点
function losephone() {
var phone = document.getElementById('phone');
var reg = /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/
if (phone.value == '') {
layer.tips('X 请您填写手机号', '#phone', {
// id: 'tips1-1',
shadeClose: false,
tips: [2, 'red'],
time: 0,
area: ['auto', '36px'],
show: true
})
return false;
} else {
if (!reg.test(phone.value)) {
layer.tips('X 请输入正确的手机号', '#phone', {
// id: 'tips1-2',
shadeClose: false,
tips: [2, 'red'],
time: 0,
area: ['auto', '36px'],
show: true
})
return false;
} else {
layer.tips('√', '#phone', {
// id: 'tips1-3',
shadeClose: false,
tips: [2, 'green'],
time: 0,
area: ['auto', '36px'],
show: true
})
return true;
}
return true;
}
}
// 4. 验证输入短信验证码
function getinputyzm() {
layer.tips('请输入验证码', '#inputyzm', {
// id: 'tips2',
shadeClose: false,
tips: [2, '#30a6f5'],
time: 0,
area: ['auto', '36px']
})
}
function loseinputyzm() {
var inputyzm = document.querySelector('#inputyzm')
var yzmcode = /^[0-9]\d{5}$/;
if (inputyzm.value == '') {
layer.tips('X 请您填写验证码', '#inputyzm', {
// id: 'tips2-1',
tips: [2, 'red'],
time: 0,
area: ['auto', '36px'],
show: true
})
return false;
} else {
if (!yzmcode.test(inputyzm.value)) {
//验证不成功
layer.tips('X 请您正确填写验证码', '#inputyzm', {
// id: 'tips2-2',
tips: [2, 'red'],
time: 0,
area: ['auto', '36px'],
show: true
})
return false;
} else {
//验证成功
layer.tips('√', '#inputyzm', {
// id: 'tips2-3',
tips: [2, 'green'],
time: 0,
area: ['auto', '36px'],
show: true
})
return true;
}
return true;
}
}
// 5.密码验证
function getpassword() {
layer.tips('请输入8~16位密码区分大小写', '#password', {
// id: 'tips3',
shadeClose: false,
tips: [2, '#30a6f5'],
time: 0,
area: ['auto', '36px']
})
}
function losepassword() {
var password = document.querySelector('#password').value
var pwdyz = /^[A-Za-z0-9!@#$%^&*()_+{}\[\]:;<>,.?\/~`-]{8,16}$/
if (password.value = '') {
layer.tips('X 请您填写密码(8-16位区分大小写)', '#password', {
// id: 'tips3-1',
tips: [2, 'red'],
time: 0,
area: ['auto', '36px'],
show: true
})
return false;
} else {
if (!pwdyz.test(password)) {
//验证不成功
layer.tips('X 请您正确填写密码(8-16位区分大小写)', '#password', {
// id: 'tips3-2',
tips: [2, 'red'],
time: 0,
area: ['auto', '36px'],
show: true
})
return false;
} else {
//验证成功
layer.tips('√', '#password', {
// id: 'tips3-3',
tips: [2, 'green'],
time: 0,
area: ['auto', '36px'],
show: true
})
return true;
}
return true;
}
}
// 点击注册按钮验证所填内容与是否勾选同意并遵守《用户服务协议》
function usersubmit() {
var chec = document.querySelector('#chec')
// var myselect = document.querySelector('#userRole')
// var index = myselect.selectedIndex
var userchecked = false;
// console.log(myselect.options[index].value);
var phone = losephone()
if (phone === false) {
return
}
var yzm11 = loseinputyzm()
if (yzm11 === false) {
return
}
var pwd = losepassword()
if (pwd === false) {
return
}
// if (myselect.options[index].value === '') {
// layer.tips('请选择注册为普通用户或代理商', '#userRole', {
// tips: [2, 'red'],
// time: 0,
// area: ['auto', '36px'],
// show: true
// })
// return
// } else {
// layer.tips('√', '#userRole', {
// tips: [2, 'green'],
// time: 0,
// area: ['auto', '36px'],
// show: true
// })
// }
if (chec.checked == true) {
userchecked = true
layer.tips('√', '#row123', {
tips: [2, 'green'],
time: 0,
area: ['auto', '36px'],
show: true
})
} else {
layer.tips('请阅读并同意《用户服务协议》和《隐私条款》', '#row123', {
tips: [2, 'red'],
time: 0,
area: ['auto', '36px'],
show: true
})
return
// userchecked = false;
}
DoSomething()
}
// 显示隐藏密码
switchPwd()
function switchPwd() {
var passwordeye = $('#passwordeye')
var showPwd = $('#password')
passwordeye.off('click').on('click', function () {
if (passwordeye.hasClass('icon-xianshiyincang1')) {
// 密码可见
passwordeye.removeClass('icon-xianshiyincang1').addClass('icon-xianshiyincang')
showPwd.prop('type', 'text')
} else {
passwordeye.removeClass('icon-xianshiyincang').addClass('icon-xianshiyincang1')
showPwd.prop('type', 'password')
}
})
}
$("#yzm").click(function (e) {
let phoneVal = $("#phone").val()
if (phoneVal === '') {
layer.msg('请填写手机号', {
icon: 2,
time: 2000,
offset: '50px',
})
} else {
let phoneResult = `https://www.aimzhu.com/operator/api/systemuser/check-exists/` + phoneVal
axios.get(phoneResult).then(response => {
console.log(response.data);
let jieguo = response.data
if (jieguo) {
layer.msg('用户已经存在,请更换手机号', {
icon: 2,
time: 2000,
offset: '50px',
})
} else {
$.ajax({
type: "GET",
dataType: 'json',
url: "https://www.aimzhu.com/operator/app/sms/verify-code/" + phoneVal,
success: function (msg) {
// alert('验证码已发送')
layer.msg('注册验证码已经发送到手机上有效时间2分钟', {
icon: 1,
time: 6000,
offset: '50px',
// shade: [0.5, '#000'],
// skin: ['custom-bg-color']
})
// 启动倒计时
startCountdown()
},
error: function (data) {
console.log(data);
document.getElementById('yzm').disabled = false;
document.getElementById('yzm').innerText = '获取验证码';
layer.msg('获取验证码失败,请不要在验证码有效期内重新获取', {
icon: 2,
time: 2000,
offset: '50px',
// skin: ['custom-bg-color']
// shade: [0.5, '#000'],
})
}
});
}
})
// if (phoneResult.value) {
// layer.msg('用户已经存在,请更换手机号', {
// icon: 2,
// time: 2000,
// })
// } else {
// $.ajax({
// type: "GET",
// dataType: 'json',
// url: "http://121.36.71.250:58085/operator/app/sms/verify-code/" + phoneVal,
// success: function (msg) {
// // alert('验证码已发送')
// layer.msg('注册验证码已经发送到手机上有效时间2分钟', {
// icon: 1,
// time: 6000,
// offset: ['50px', '600px'],
// // shade: [0.5, '#000'],
// skin: ['custom-bg-color']
// })
// // 启动倒计时
// startCountdown()
// },
// error: function (data) {
// console.log(data);
// document.getElementById('yzm').disabled = false;
// document.getElementById('yzm').innerText = '获取验证码';
// layer.msg('获取验证码失败,请不要在验证码有效期内重新获取', {
// icon: 2,
// time: 2000,
// // offset: ['50px', '700px'],
// // shade: [0.5, '#000'],
// })
// }
// });
// }
}
});
function startCountdown() {
remainingTime = 120;
document.getElementById('yzm').disabled = true;
countdownTimer = setInterval(() => {
remainingTime--;
if (remainingTime <= 0) {
clearInterval(countdownTimer);
document.getElementById('yzm').disabled = false;
document.getElementById('yzm').innerText = '获取验证码';
} else {
document.getElementById('yzm').innerText = `重新获取(${remainingTime}秒)`;
}
}, 1000);
}
function DoSomething(e) {
var phoneVal = $("#phone").val();
var inputyzm = $("#inputyzm").val();
var password = $("#password").val();
var password2 = $("#password").val();
var userRole = "606f85bc-63fd-407e-8e2e-6ce48178b70a";
var data = {
password: password,
passwordSame: password,
phone: phoneVal,
verifyCode: inputyzm
}
console.log('data', data);
$('#register').attr('disabled', 'disabled')
$('#register').css('cursor', 'no-drop')
$.ajax({
type: "POST",
data: JSON.stringify(data),
contentType: "application/json;charset=utf-8",
url: "https://www.aimzhu.com/operator/app/register/phone-password?userRole=" + userRole,
success: function (data) {
// $('#register').attr('disabled', 'disabled')
// $('#register').css('cursor', 'no-drop')
// alert("注册成功");
layer.msg('注册成功', {
time: 2000,
icon: 6,
shadeClose: false,
shift: 1,
offset: '50px',
}, function () {
// 当消息关闭后执行的回调函数
startCountdown()
})
console.log('success', data);
function startCountdown() {
// 设置倒计时 5s
var countdownSeconds = 3
// 每秒更新倒计时
var countdownInterval = setInterval(function () {
countdownSeconds--;
// 显示倒计时信息
layer.msg(countdownSeconds + '秒后跳转到登录页', {
time: 3000,
shadeClose: false,
icon: 6
})
if (countdownSeconds <= 0) {
clearInterval(countdownInterval)
// 跳转到登录页
window.location.href = 'https://www.aimzhu.com/operator/'
}
}, 1000)
}
},
error: function (data, code) {
// alert("注册失败")
$('#register').removeAttr('disabled')
$('#register').css('cursor', 'pointer')
layer.msg(data.responseJSON.msg, {
icon: 5,
time: 3000,
})
// const errmsg = data.responseJSON.msg
// alert(data.responseJSON.msg)
console.log('error', data);
console.log('error', code);
}
});
}
</script>
</body>
</html>