This commit is contained in:
DengDai
2025-12-09 13:08:38 +08:00
commit 02ecea06f8
36 changed files with 5876 additions and 0 deletions

32
static/js/register.js Normal file
View File

@@ -0,0 +1,32 @@
$(document).ready(function() {
$('#register-form').submit(function(e) {
e.preventDefault();
const password = $('#password').val();
const confirmPassword = $('#confirm-password').val();
if (password !== confirmPassword) {
alert('两次密码不一致');
return;
}
$.ajax({
url: '/api/register',
method: 'POST',
contentType: 'application/json',
data: JSON.stringify({
username: $('#username').val(),
email: $('#email').val(),
uid: $('#uid').val(),
password: password
}),
success: function(data) {
alert(data.message);
window.location.href = '/';
},
error: function(xhr) {
alert(xhr.responseJSON?.error || '注册失败');
}
});
});
});