fix login

This commit is contained in:
jxxghp
2023-06-24 16:11:58 +08:00
parent e595d47bdc
commit 6aa48f9673
+9 -1
View File
@@ -24,9 +24,15 @@ const authThemeMask = computed(() => {
}) })
const isPasswordVisible = ref(false) const isPasswordVisible = ref(false)
const errorMessage = ref('')
// 登录获取token事件 // 登录获取token事件
const login = () => { const login = () => {
errorMessage.value = ''
if (!form.value.username || !form.value.password) {
errorMessage.value = '请输入用户名和密码'
return
}
// 用户名密码 // 用户名密码
const formData = new FormData(); const formData = new FormData();
formData.append('username', form.value.username); formData.append('username', form.value.username);
@@ -43,7 +49,7 @@ const login = () => {
}) })
.catch((error: any) => { .catch((error: any) => {
// 登录失败,显示错误提示 // 登录失败,显示错误提示
alert(error) errorMessage.value = '登录失败,请检查用户名和密码是否正确'
}) })
} }
@@ -101,6 +107,8 @@ const login = () => {
required required
/> />
<div v-if="errorMessage" class="text-error mt-1">{{ errorMessage }}</div>
<!-- remember me checkbox --> <!-- remember me checkbox -->
<div class="d-flex align-center justify-space-between flex-wrap mt-1 mb-4"> <div class="d-flex align-center justify-space-between flex-wrap mt-1 mb-4">
<VCheckbox <VCheckbox