chore: 同步完整版代码

This commit is contained in:
xiaoxian521
2024-04-23 11:05:13 +08:00
parent e25f4bcf39
commit e29340422a
10 changed files with 252 additions and 247 deletions

View File

@@ -38,23 +38,26 @@ const ruleForm = reactive({
});
const onLogin = async (formEl: FormInstance | undefined) => {
loading.value = true;
if (!formEl) return;
await formEl.validate((valid, fields) => {
if (valid) {
loading.value = true;
useUserStoreHook()
.loginByUsername({ username: ruleForm.username, password: "admin123" })
.then(res => {
if (res.success) {
// 获取后端路由
initRouter().then(() => {
router.push(getTopMenu(true).path);
message("登录成功", { type: "success" });
return initRouter().then(() => {
router.push(getTopMenu(true).path).then(() => {
message("登录成功", { type: "success" });
});
});
} else {
message("登录失败", { type: "error" });
}
});
})
.finally(() => (loading.value = false));
} else {
loading.value = false;
return fields;
}
});