Files
WorkBuddy 3c2b967274
CI/CD Pipeline / UI Contracts (source-structure gates) (push) Canceled after 0s
CI/CD Pipeline / E2E (live stack) (push) Canceled after 0s
CI/CD Pipeline / Backend Build & Test (push) Canceled after 0s
CI/CD Pipeline / Admin Web Build (push) Canceled after 0s
CI/CD Pipeline / Mini Program Compile Check (push) Canceled after 0s
CI/CD Pipeline / Migration Validation (push) Canceled after 0s
CI/CD Pipeline / Test Shell Guard (Phase 23 Gate) (push) Canceled after 0s
release: freeze 2026-10-15 validated release baseline
2026-10-15 09:47:31 +08:00

147 lines
5.9 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 路由名称常量(规范 §5 用户端路由命名 + §18 Tab 路由)
*
* 所有页面跳转必须使用本常量,禁止散落字符串。
* 带参数的页面只传 id(userId/activityId/serviceId/conversationId),
* 不在 URL 携带姓名、身份证、完整资料 JSON、敏感业务状态。
*/
// ============ Tab 路由(只能 switchTab) ============
exports.TAB = {
HOME: '/pages/index/index',
DISCOVER: '/pages/discover/discover',
MESSAGES: '/pages/messages/messages',
ACTIVITIES: '/pages/activity/activity',
MINE: '/pages/mine/mine',
};
// ============ 启动与身份类(规范 §4.1) ============
exports.AUTH = {
LOGIN: '/pages/login/login',
BIND_PHONE: '/pages/bind-phone/bind-phone',
VERIFICATION: '/pages/verification/verification',
};
// ============ 新手资料类(规范 §4.2,5 步固定顺序) ============
exports.ONBOARDING = {
PROFILE_BASIC: '/pages/profile-basic/profile-basic',
PROFILE_LIFESTYLE: '/pages/profile-lifestyle/profile-lifestyle',
PROFILE_PHOTOS: '/pages/profile-photos/profile-photos',
PROFILE_INTENT: '/pages/profile-intent/profile-intent',
PROFILE_PREFERENCE: '/pages/profile-preference/profile-preference',
PROFILE_CONFIRM: '/pages/profile-confirm/profile-confirm',
// 资料编辑入口(非首次填写)
PROFILE_INTRO: '/pages/profile-intro/profile-intro',
PROFILE_INTERESTS: '/pages/profile-interests/profile-interests',
};
// 首次资料填写步骤顺序(规范 §14)
exports.ONBOARDING_STEPS = [
exports.ONBOARDING.PROFILE_BASIC,
exports.ONBOARDING.PROFILE_LIFESTYLE,
exports.ONBOARDING.PROFILE_PHOTOS,
exports.ONBOARDING.PROFILE_INTENT,
exports.ONBOARDING.PROFILE_PREFERENCE,
];
// ============ 审核状态类(规范 §4.3) ============
exports.REVIEW = {
PENDING: '/pages/review-pending/review-pending',
REJECTED: '/pages/review-rejected/review-rejected',
ACCOUNT_STATUS: '/pages/account-status/account-status',
ACCOUNT_STATUS_PAGE: '/pages/account-status-page/account-status-page',
APPEAL: '/pages/appeal/appeal',
};
// ============ 主业务类(规范 §4.4) ============
exports.MAIN = {
HOME: '/pages/index/index',
DISCOVER: '/pages/discover/discover',
PROFILE_DETAIL: '/pages/profile-detail/profile-detail',
FATE_CENTER: '/pages/fate-center/fate-center',
MESSAGES: '/pages/messages/messages',
CHAT: '/pages/chat/chat',
ACTIVITIES: '/pages/activity/activity',
MATCHMAKER: '/pages/matchmaker/matchmaker',
MINE: '/pages/mine/mine',
};
// ============ 设置与辅助类(规范 §4.5) ============
exports.SETTINGS = {
SETTINGS: '/pages/settings/settings',
PRIVACY: '/pages/privacy-settings/privacy-settings',
BLACKLIST: '/pages/blacklist/blacklist',
NOTIFICATIONS: '/pages/notifications/notifications',
HELP_CENTER: '/pages/help-center/help-center',
ABOUT: '/pages/about/about',
RELATIONSHIP_STATUS: '/pages/relationship-status/relationship-status',
ACCOUNT_LOGOUT: '/pages/account-logout/account-logout',
MY_REPORTS: '/pages/my-reports/my-reports',
};
// ============ 业务详情类(规范 §4.6) ============
exports.DETAIL = {
PROFILE_DETAIL: '/pages/profile-detail/profile-detail',
ACTIVITY_DETAIL: '/pages/activity-detail/activity-detail',
ACTIVITY_REGISTER: '/pages/activity-register/activity-register',
CHECKIN: '/pages/checkin/checkin',
ACTIVITY_FEEDBACK: '/pages/activity-feedback/activity-feedback',
ACTIVITY_MATCHES: '/pages/activity-matches/activity-matches',
MY_ACTIVITIES: '/pages/my-activities/my-activities',
MATCHMAKER_APPLY: '/pages/matchmaker-apply/matchmaker-apply',
MATCHMAKER_PROGRESS: '/pages/matchmaker-progress/matchmaker-progress',
REPORT: '/pages/report/report',
LIKERS: '/pages/likers/likers',
};
// ============ V1.1 公益服务类 ============
exports.SERVICE = {
CENTER: '/pages/service-center/service-center',
STATION: '/pages/service-station/service-station',
APPOINTMENT: '/pages/service-appointment/service-appointment',
MY_APPOINTMENTS: '/pages/my-appointments/my-appointments',
CLASSROOM: '/pages/content/content',
CONTENT_DETAIL: '/pages/content-detail/content-detail',
ANTI_FRAUD: '/pages/anti-fraud/anti-fraud',
PROGRAM: '/pages/service-program/service-program',
HISTORY: '/pages/service-history/service-history',
COUNSELING: '/pages/my-counseling/my-counseling',
REFERRAL_CONFIRMATION: '/pages/referral-confirmation/referral-confirmation',
MATCHMAKER_RECOMMENDATIONS: '/pages/matchmaker-recommendations/matchmaker-recommendations',
};
// ============ 工作人员/红娘端(规范 §4.7) ============
exports.OPERATOR = {
LOGIN: '/pages/matchmaker-login/matchmaker-login',
WORKBENCH: '/pages/matchmaker-workbench/matchmaker-workbench',
};
// ============ 带参路由快捷构造(仅 id 类参数,规范 §6) ============
// 用法:ROUTE.to.detail(userId) → /pages/profile-detail/profile-detail?id=xxx
exports.to = {
detail: (userId) => exports.buildPath(exports.DETAIL.PROFILE_DETAIL, { id: userId }),
activityDetail: (activityId) => exports.buildPath(exports.DETAIL.ACTIVITY_DETAIL, { id: activityId }),
chat: (conversationId) => exports.buildPath(exports.MAIN.CHAT, { id: conversationId }),
report: (userId) => exports.buildPath(exports.DETAIL.REPORT, { id: userId }),
matchmakerProgress: (serviceId) => exports.buildPath(exports.DETAIL.MATCHMAKER_PROGRESS, { id: serviceId }),
appeal: (type, actionId) => {
const params = { type };
if (actionId) params.actionId = actionId;
return exports.buildPath(exports.REVIEW.APPEAL, params);
},
};
/**
* 构造带参路由(只允许传 id 类参数)
* @param {string} path 路由常量
* @param {Record<string, string|number>} params 参数对象(仅 id 类)
* @returns {string} 完整路径
*/
exports.buildPath = (path, params = {}) => {
const entries = Object.entries(params);
if (entries.length === 0) return path;
const query = entries
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(String(v))}`)
.join('&');
return `${path}?${query}`;
};