modify(login): 修改登录返回对象,新增返回用户信息

This commit is contained in:
2025-12-28 22:01:24 +08:00
parent 82652efed7
commit 62642ee86a
87 changed files with 2730 additions and 755 deletions
File diff suppressed because it is too large Load Diff
+23 -2
View File
@@ -23,9 +23,11 @@
</div>
<form @submit.prevent="handleLogin">
<IconInput class="input" placeholder="请输入用户名" lab="用户名 / 邮箱" type="text" icon-name="user" v-model="form.username"/>
<IconInput class="input"
placeholder="请输入用户名" lab="用户名 / 邮箱" type="text" icon-name="user" v-model="form.username"/>
<IconInput class="input" placeholder="请输入密码" lab="密码" type="password" icon-name="user" v-model="form.password"/>
<IconInput class="input"
placeholder="请输入密码" lab="密码" type="password" icon-name="user" v-model="form.password"/>
<MyButton class="loginBtn" :loading="loading">
登录
@@ -48,6 +50,9 @@ import { useMessage } from '@/components/messages/useAlert'
import { authService } from '@/services/auth'
import { useRouter } from 'vue-router'
import feather from 'feather-icons'
import IconInput from '@/components/IconInput.vue'
import { required, email, maxLength, minLength, helpers } from '@vuelidate/validators'
import useVuelidate from '@vuelidate/core'
const message = useMessage()
const router = useRouter()
@@ -58,7 +63,23 @@ const form = reactive({
password: ''
})
const rules = {
username:{
required:helpers.withMessage('用户名不能为空', required),
maxLength:helpers.withMessage('用户名最大20字符', maxLength(20))
},
password:{
required:helpers.withMessage('密码不能为空', required),
maxLength:helpers.withMessage('密码最大50字符', maxLength(50))
}
};
const v$ = useVuelidate(rules,form);
const handleLogin = async () => {
if(!(await v$.value.$validate())){
message.error(v$.value.$errors[0].$message)
return;
}
try{
loading.value = true;
const res = await authService.login(form);