This commit is contained in:
Esacpe 2025-05-21 10:39:48 +08:00
parent 2f9762a1fa
commit 34a2984a00

View File

@ -109,25 +109,24 @@ const loading = ref(false);
const loginFromRef = ref(null);
const router = useRouter();
const handleLogin = () => {
loginFromRef.value.validate((valid) => {
if (!valid) return false;
loading.value = true;
store.dispatch("user/login", loginForm.value).then((res) => {
loading.value = false;
//
if (res.deptList.length === 1) {
window.location.href = '/'
// loginFromRef.value.validate((valid) => {
// if (!valid) return false;
// loading.value = true;
// store.dispatch("user/login", loginForm.value).then((res) => {
// loading.value = false;
// //
// if (res.deptList.length === 1) {
// window.location.href = '/'
// } else {
// deptList.value = [...res.deptList];
// loginDialog.value = true;
// authorization.value = res.jwtToken;
// ElNotification({title: "",message: "",duration: 3000});
// }
// }).catch(() => {
// loading.value = false;
// });
// });
} else {
deptList.value = [...res.deptList];
loginDialog.value = true;
authorization.value = res.jwtToken;
ElNotification({title: "提示",message: "请选择部门",duration: 3000});
}
}).catch(() => {
loading.value = false;
});
});
};
const logout = () => {
store.dispatch("user/logout");