feat: 实现可编辑已有的实验

This commit is contained in:
2025-08-13 16:11:06 +08:00
parent 76342553ad
commit 7a59c29e06
7 changed files with 578 additions and 593 deletions

View File

@@ -2,7 +2,10 @@
<div class="flex items-center justify-center min-h-screen bg-base-200">
<div class="relative w-full max-w-md">
<!-- Login Card -->
<div v-if="!showSignUp" class="card card-dash h-80 w-100 shadow-xl bg-base-100">
<div
v-if="!showSignUp"
class="card card-dash h-80 w-100 shadow-xl bg-base-100"
>
<div class="card-body">
<h1 class="card-title place-self-center my-3 text-2xl">用户登录</h1>
<div class="flex flex-col w-full h-full">
@@ -44,7 +47,10 @@
</div>
<!-- Sign Up Card -->
<div v-if="showSignUp" class="card card-dash h-96 w-100 shadow-xl bg-base-100">
<div
v-if="showSignUp"
class="card card-dash h-96 w-100 shadow-xl bg-base-100"
>
<div class="card-body">
<h1 class="card-title place-self-center my-3 text-2xl">用户注册</h1>
<div class="flex flex-col w-full h-full">
@@ -122,7 +128,7 @@ const isSignUpLoading = ref(false);
const signUpData = ref({
username: "",
email: "",
password: ""
password: "",
});
// 登录处理函数
@@ -149,7 +155,7 @@ const handleLogin = async () => {
// 短暂延迟后跳转到project页面
setTimeout(async () => {
await router.push("/project");
router.go(-1);
}, 1000);
} catch (error: any) {
console.error("Login error:", error);
@@ -180,7 +186,7 @@ const handleRegister = () => {
signUpData.value = {
username: "",
email: "",
password: ""
password: "",
};
};
@@ -227,13 +233,13 @@ const handleSignUp = async () => {
const result = await dataClient.signUpUser(
signUpData.value.username.trim(),
signUpData.value.email.trim(),
signUpData.value.password.trim()
signUpData.value.password.trim(),
);
if (result) {
// 注册成功
alertStore?.show("注册成功!请登录", "success", 2000);
// 延迟后返回登录页面
setTimeout(() => {
backToLogin();
@@ -271,7 +277,7 @@ const checkExistingToken = async () => {
const isValid = await AuthManager.verifyToken();
if (isValid) {
// 如果token仍然有效直接跳转到project页面
await router.push("/project");
router.go(-1);
}
} catch (error) {
// token无效或验证失败继续显示登录页面