HomeLease/unpackage/dist/dev/mp-weixin/utils/router.js
2025-08-12 15:38:25 +08:00

66 lines
1.9 KiB
JavaScript

"use strict";
const common_vendor = require("../common/vendor.js");
const PAGE_ROUTES = {
// 主要功能页面
MONK: "/pages/monk/monk",
MONK_DETAIL: "/pages/monk/monkDetail",
WALK_INTO: "/pages/walkInto/walkInto",
INSTITUTIONAL_STRUCTURE: "/pages/institutionalStructure/institutionalStructure",
ACTIVITY: "/pages/activity/activity",
PRAY: "/pages/pray/pray",
// 待开发页面
NEWS: "/pages/news/news",
ABBOT: "/pages/abbot/abbot",
ANCIENT: "/pages/ancient/ancient",
FUTURE: "/pages/future/future",
// 其他页面
LOGIN: "/pages/login/login",
INDEX: "/pages/nearbystores/index",
MY: "/pages/my/my",
MY_ORDER: "/pages/myorder/index",
MY_ORDER_RETURNED: "/pages/myorder/returned/index"
};
const PAGE_TYPE_MAP = {
"monk": PAGE_ROUTES.MONK,
"monkDetail": PAGE_ROUTES.MONK_DETAIL,
"walkInto": PAGE_ROUTES.WALK_INTO,
"institutionalStructure": PAGE_ROUTES.INSTITUTIONAL_STRUCTURE,
"activity": PAGE_ROUTES.ACTIVITY,
"news": PAGE_ROUTES.NEWS,
"abbot": PAGE_ROUTES.ABBOT,
"ancient": PAGE_ROUTES.ANCIENT,
"future": PAGE_ROUTES.FUTURE,
"index": PAGE_ROUTES.INDEX,
"pray": PAGE_ROUTES.PRAY
};
function navigateToPage(pageType, options = {}) {
try {
common_vendor.index.hideLoading();
} catch (error) {
common_vendor.index.__f__("warn", "at utils/router.js:58", "清除loading失败:", error);
}
const targetPage = PAGE_TYPE_MAP[pageType];
if (!targetPage) {
common_vendor.index.showToast({
title: "页面配置错误",
icon: "none"
});
return;
}
const defaultOptions = {
url: targetPage,
fail: (err) => {
common_vendor.index.showToast({
title: "页面开发中",
icon: "none"
});
}
};
common_vendor.index.navigateTo({
...defaultOptions,
...options
});
}
exports.navigateToPage = navigateToPage;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/router.js.map