From 8364607d7bd467307fd8fb9d2e7ab01fca74f702 Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Tue, 21 Jul 2026 22:08:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/public/js/register.js | 8 +++----- static/public/register.html | 32 ++++++++++++++++---------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/static/public/js/register.js b/static/public/js/register.js index f5f5bd0..d170438 100644 --- a/static/public/js/register.js +++ b/static/public/js/register.js @@ -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 || '接口请求失败,请检查后端服务是否启动'); diff --git a/static/public/register.html b/static/public/register.html index 9213fce..82157fa 100644 --- a/static/public/register.html +++ b/static/public/register.html @@ -1,32 +1,32 @@ - + - 注册页面 - - -

注册页面

+ +

注册页面

-
- - - -
- +
+ + + +
+
验证码:
- -
+ +