feat: 完成前端业务闭环与后端联调
This commit is contained in:
@@ -233,6 +233,17 @@ const runUniNavigation = (
|
||||
return promise;
|
||||
};
|
||||
|
||||
const runUniNavigationAfterCurrent = (key, invoke) => {
|
||||
if (!navigationInFlight) return runUniNavigation(key, invoke);
|
||||
if (navigationInFlight.key === key) return navigationInFlight.promise;
|
||||
|
||||
const currentPromise = navigationInFlight.promise;
|
||||
return currentPromise.then(
|
||||
() => runUniNavigationAfterCurrent(key, invoke),
|
||||
() => runUniNavigationAfterCurrent(key, invoke),
|
||||
);
|
||||
};
|
||||
|
||||
const asNavigationPromise = (execute) => {
|
||||
try {
|
||||
return execute();
|
||||
@@ -494,6 +505,18 @@ export const goRoot = (routeKey, params = {}) =>
|
||||
uni.reLaunch({ url, ...callbacks }));
|
||||
});
|
||||
|
||||
export const recoverToAuthRoot = () =>
|
||||
asNavigationPromise(() => {
|
||||
const route = getRoute("A01");
|
||||
const url = buildValidatedRouteUrl("A01", route, Object.freeze({}));
|
||||
if (isCurrentTarget("A01", {})) return Promise.resolve(false);
|
||||
|
||||
// 401 可能在上一场页面转场仍持锁时返回。普通点击可以被去重,登录恢复不能
|
||||
// 被静默丢弃,因此等待当前转场收尾后再重置页面栈。
|
||||
return runUniNavigationAfterCurrent(`recovery-root:${url}`, (callbacks) =>
|
||||
uni.reLaunch({ url, ...callbacks }));
|
||||
});
|
||||
|
||||
export const openNoticeTarget = (targetType, params, sourceKey = "N02") =>
|
||||
asNavigationPromise(() => {
|
||||
assertScalarString("通知目标类型", targetType);
|
||||
|
||||
@@ -72,7 +72,7 @@ export const ROUTES = Object.freeze({
|
||||
kind: "flow",
|
||||
parent: "G06",
|
||||
requiredParams: ["genealogyId"],
|
||||
optionalParams: ["source"],
|
||||
optionalParams: ["source", "genealogyName"],
|
||||
allowedSources: ["G01", "G05", "G06", "G09"],
|
||||
}),
|
||||
G09: defineRoute({
|
||||
@@ -108,6 +108,13 @@ export const ROUTES = Object.freeze({
|
||||
kind: "page",
|
||||
parent: "G05",
|
||||
requiredParams: ["genealogyId"],
|
||||
allowedSources: ["G01", "G05"],
|
||||
}),
|
||||
G14: defineRoute({
|
||||
path: "/pages/genealogy/capability-center",
|
||||
kind: "page",
|
||||
parent: "G05",
|
||||
requiredParams: ["genealogyId"],
|
||||
allowedSources: ["G05"],
|
||||
}),
|
||||
T01: defineRoute({
|
||||
@@ -316,7 +323,7 @@ export const ROUTES = Object.freeze({
|
||||
kind: "page",
|
||||
parent: "F01",
|
||||
requiredParams: ["genealogyId"],
|
||||
optionalParams: ["memoId"],
|
||||
optionalParams: ["memoId", "memoType"],
|
||||
allowedSources: ["F01", "N02"],
|
||||
}),
|
||||
R11: defineRoute({
|
||||
@@ -326,6 +333,13 @@ export const ROUTES = Object.freeze({
|
||||
requiredParams: ["genealogyId"],
|
||||
allowedSources: ["F01"],
|
||||
}),
|
||||
R12: defineRoute({
|
||||
path: "/pages/records/person-documents",
|
||||
kind: "page",
|
||||
parent: "G05",
|
||||
requiredParams: ["genealogyId"],
|
||||
allowedSources: ["G05"],
|
||||
}),
|
||||
N01: defineRoute({
|
||||
path: "/pages/notification/message-center",
|
||||
kind: "page",
|
||||
@@ -399,6 +413,13 @@ export const ROUTES = Object.freeze({
|
||||
parent: "M01",
|
||||
allowedSources: ["M01"],
|
||||
}),
|
||||
F11: defineRoute({
|
||||
path: "/pages/family/platform-videos",
|
||||
kind: "page",
|
||||
parent: "F01",
|
||||
optionalParams: ["placement", "videoId"],
|
||||
allowedSources: ["F10", "G01"],
|
||||
}),
|
||||
M11: defineRoute({
|
||||
path: "/pages/profile/ceremony-invitations",
|
||||
kind: "page",
|
||||
@@ -416,7 +437,7 @@ export const ROUTES = Object.freeze({
|
||||
kind: "page",
|
||||
parent: "M10",
|
||||
requiredParams: ["documentKey"],
|
||||
allowedSources: ["M10"],
|
||||
allowedSources: ["A01", "A04", "M10"],
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user