注册修复
This commit is contained in:
1 parent
1d57502fa2
commit
8364607d7b
2 files changed
+19
-21
No files matched your search
@@ -183,11 +183,8 @@ form.addEventListener('submit', async function (e) {
|
||||
throw new Error(result.message || `注册失败(HTTP ${res.status})`);
|
||||
}
|
||||
|
||||
if (result.code === 0) {
|
||||
if (!result.data || !result.data.username) {
|
||||
throw new Error('注册成功,但服务器返回的数据不完整');
|
||||
}
|
||||
alert(`${result.message},账号:${result.data.username}`);
|
||||
if (result.success) {
|
||||
alert('注册成功');
|
||||
form.reset();
|
||||
sendCode = '';
|
||||
codeTarget = '';
|
||||
@@ -196,6 +193,7 @@ form.addEventListener('submit', async function (e) {
|
||||
}
|
||||
|
||||
alert(result.message || '注册失败');
|
||||
|
||||
} catch (err) {
|
||||
console.error('注册请求异常:', err);
|
||||
alert(err.message || '接口请求失败,请检查后端服务是否启动');
|
||||
|
||||
+16
-16
@@ -1,32 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
|
||||
<title>注册页面</title>
|
||||
<style>
|
||||
.tip-red {color:red;}
|
||||
.tip-yellow {color: orange;}
|
||||
.tip-green {color: greenyellow;}
|
||||
<title>注册页面</title>
|
||||
<style>
|
||||
.tip-red {color:red;}
|
||||
.tip-yellow {color: orange;}
|
||||
.tip-green {color: greenyellow;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>注册页面</h2>
|
||||
<body>
|
||||
<h2>注册页面</h2>
|
||||
<form id="form">
|
||||
<div>
|
||||
<label>用户名/推荐邮箱:</label>
|
||||
<input type="text" id="regusername" placeholder="请输入用户名">
|
||||
<span id="msgTip" ></span>
|
||||
<br>
|
||||
<label>邮箱号:</label>
|
||||
<div>
|
||||
<label>用户名/推荐邮箱:</label>
|
||||
<input type="text" id="regusername" placeholder="请输入用户名">
|
||||
<span id="msgTip" ></span>
|
||||
<br>
|
||||
<label>邮箱号:</label>
|
||||
<input type="email" id="regemail" placeholder="请输入邮箱号">
|
||||
<div class="code-box">验证码:
|
||||
<input type="text" id="code" placeholder="请输入6位验证码" inputmode="numeric" maxlength="6">
|
||||
<input type="button" id="getCode" value="获取验证码">
|
||||
<span id="codeTip"></span>
|
||||
</div>
|
||||
<span id="emlTip"></span>
|
||||
<br>
|
||||
<span id="emlTip"></span>
|
||||
<br>
|
||||
<label>密码:</label>
|
||||
<input type="password" id="regpsw" placeholder="密码至少6位">
|
||||
<label>验证密码:</label>
|
||||
|
||||
Reference in new issue
Block a user