对接接口和更新新增表单组件

This commit is contained in:
2025-04-22 19:03:28 +08:00
parent 95d84c3b06
commit 6c694b52d3
13 changed files with 305 additions and 556 deletions

View File

@ -66,8 +66,8 @@ const store = useStore();
const kaptchaUrl = ref("");
// 数据源
const loginForm = ref({
userName: "admin",
password: "111111",
userName: "",
password: "",
kaptcha: ""
});
const loginDialog = ref(false);
@ -111,24 +111,21 @@ const router = useRouter();
const handleLogin = () => {
loginFromRef.value.validate((valid) => {
if (!valid) return false;
setItem('token', '1255555888');
setItem('isOatuh', 0)
router.push("/");
// 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;
// });
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;
});
});
};
const logout = () => {