代码拉取完成,页面将自动刷新
同步操作将从 xpzll/keshihua96 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>登录</title>
<link rel="stylesheet" href="./bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="./bootstrap/bootstrap-icons.css" />
<link rel="stylesheet" href="./css/common.css" />
<link rel="stylesheet" href="./css/login.css" />
</head>
<body class="application application-offset">
<div class="container-fluid container-application">
<div class="main-content position-relative">
<!-- Page content -->
<div class="page-content">
<div class="min-vh-100 py-5 d-flex align-items-center">
<div class="w-100">
<div class="row justify-content-center">
<div class="col-sm-8 col-lg-4">
<div class="card shadow zindex-100 mb-0">
<div class="card-body px-md-5 py-5">
<div class="mb-5">
<h6 class="h3">传智教育-注册</h6>
</div>
<span class="clearfix"></span>
<form role="form" autocomplete="off">
<div class="form-group">
<label class="form-control-label">账号</label>
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text"
><i class="bi bi-person"></i
></span>
</div>
<input
name="username"
type="text"
class="form-control"
id="input-email"
placeholder="请输入账号"
/>
</div>
</div>
<div class="form-group mb-4">
<div
class="d-flex align-items-center justify-content-between"
>
<div>
<label class="form-control-label">密码</label>
</div>
<div class="mb-2">
<a
href="javascript:;"
class="small text-muted text-underline--dashed border-primary"
>忘记密码</a
>
</div>
</div>
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text"
><i class="bi bi-key"></i
></span>
</div>
<input
name="password"
type="password"
class="form-control"
id="input-password"
placeholder="请输入密码"
/>
<div class="input-group-append">
<span class="input-group-text">
<a
href="javascript:;"
data-toggle="password-text"
data-target="#input-password"
>
<i class="bi bi-eye-fill text-blue"></i>
</a>
</span>
</div>
</div>
</div>
<div class="mt-4">
<button
id="btn-register"
type="button"
class="btn btn-sm btn-info btn-icon btn-blue rounded-pill"
>
<span class="btn-inner--text">注册</span>
<span class="btn-inner--icon"
><i class="bi bi-arrow-right"></i
></span>
</button>
</div>
</form>
</div>
<div class="card-footer px-md-5">
<small>已经注册?</small>
<a
href="./login.html"
class="small font-weight-bold text-blue"
>去登录吧</a
>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- toast -->
<div
class="position-fixed top-0 start-50 pt-4"
style="z-index: 999; transform: translateX(-50%)"
>
<div id="myToast" class="toast bg-rgba">
<div class="toast-body">提示消息</div>
</div>
</div>
<script src="./bootstrap/bootstrap.min.js"></script>
<script src="./lib/form-serialize.js"></script>
<script src="./lib/axios.js"></script>
<script src="./js/common.js"></script>
<script>
// 给按钮加点击事件
document
.querySelector('#btn-register')
.addEventListener('click', async function () {
// 1. 拿到页面所有内容
const data = serialize(document.querySelector('form'), { hash: true })
// 2. 非空判断 -- 如果data没有username就代表没有输入账号
// 如果data没有password就代表没有输入密码
if (!data.username) return tip('请输入账号')
if (!data.password) return tip('请输入密码')
// 3. 合法性判断
if (data.username.length < 2 || data.username.length > 30) {
return tip('账号只能在2-30位之间')
}
if (data.password.length < 6 || data.password.length > 30) {
return tip('密码只能在6-30位之间')
}
// 4. 发请求做注册
try {
const res = await axios({
url: '/register',
method: 'post',
data
})
console.log(res)
tip('注册成功!')
setTimeout(() => {
// 跳转到登录页
location.href = './login.html'
}, 1000)
} catch (err) {
// 提示出服务器返回的错误
tip(err.response.data.message)
}
})
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。