fix page transition

This commit is contained in:
Timi
2026-10-28 15:26:36 +08:00
parent e25b9f5fcc
commit 7a0c1d2dc0
2 changed files with 21 additions and 10 deletions
+7 -1
View File
@@ -508,7 +508,13 @@ async function toEdit(): Promise<void> {
if (!customer.value?.id) {
return;
}
await router.push(`/management/customers/${customer.value.id}/edit`);
const queryDepth = Array.isArray(route.query.transitionDepth) ? route.query.transitionDepth[0] : route.query.transitionDepth;
const depth = Number(queryDepth);
await router.push({
name: "CustomerEdit",
params: { id: customer.value.id },
query: queryDepth && Number.isInteger(depth) && 0 <= depth ? { transitionDepth: String(depth + 1) } : {}
});
}
// ---------- 积分账户 ----------
+14 -9
View File
@@ -669,16 +669,21 @@ async function doSubmit(): Promise<void> {
const redirect = String(route.query.redirect || "");
await router.replace(redirect || "/management/customers");
return;
} else {
await CustomerAPI.update(payload);
Message.success("保存成功");
const redirect = String(route.query.redirect || "");
if (redirect) {
await router.replace(redirect);
return;
}
}
await router.replace("/management/customers");
await CustomerAPI.update(payload);
Message.success("保存成功");
const redirect = String(route.query.redirect || "");
if (redirect) {
await router.replace(redirect);
return;
}
const previousPath = window.history.state?.back;
const previousRoute = typeof previousPath === "string" ? router.resolve(previousPath) : undefined;
if (previousRoute?.name === "CustomerDetail" && previousRoute.params.id === route.params.id) {
await router.back();
return;
}
await router.replace({ name: "CustomerDetail", params: { id: route.params.id } });
} finally {
isSubmitting.value = false;
}