Browse Source

fix(miniprogram): route mrc home menu to application

anubis 1 month ago
parent
commit
be647a358c

+ 12 - 1
04-新项目源码_source/项目源码/pri-smart-hospital-miniprogram/tests/mrc-home-menu-entry.test.js

@@ -2,7 +2,8 @@ const assert = require('assert');
 const { mergeRequiredMenus, normalizeMenus } = require('../utils/homeMenu');
 const { isWhitelisted, lookupRoute } = require('../utils/homeRoute');
 
-const MRC_ENTRY_ROUTE = '/packageMRC/pages/entry/index';
+const MRC_ENTRY_ROUTE = '/packageMRC/pages/apply-entry/index';
+const MRC_DEVELOPER_TOOL_ROUTE = '/packageMRC/pages/entry/index';
 
 function findMrcEntries(menus) {
   return menus.filter((menu) => String(menu.routePath || '').replace(/^\//, '') === MRC_ENTRY_ROUTE.slice(1));
@@ -14,12 +15,22 @@ const localEntries = findMrcEntries(localOnlyMenus);
 assert.strictEqual(localEntries.length, 1, 'the MRC Demo entry must be available when the service API has no menu data');
 assert.strictEqual(localEntries[0].name, '病案复印(Demo)');
 assert.strictEqual(localEntries[0].whitelisted, true);
+assert.strictEqual(
+  localOnlyMenus.some((menu) => String(menu.routePath || '').replace(/^\//, '') === MRC_DEVELOPER_TOOL_ROUTE.slice(1)),
+  false,
+  'the developer tool route must not be exposed through the patient-facing home menu'
+);
 assert.strictEqual(isWhitelisted(MRC_ENTRY_ROUTE), true, 'the home-menu entry must use the existing whitelist dispatcher');
 assert.deepStrictEqual(
   lookupRoute(MRC_ENTRY_ROUTE),
   { path: MRC_ENTRY_ROUTE, type: 'navigateTo' },
   'the home-menu entry must use the existing navigateTo dispatcher'
 );
+assert.deepStrictEqual(
+  lookupRoute(MRC_DEVELOPER_TOOL_ROUTE),
+  { path: MRC_DEVELOPER_TOOL_ROUTE, type: 'navigateTo' },
+  'the developer tool route remains available for internal Demo troubleshooting'
+);
 
 const serverMenus = normalizeMenus({
   rows: [{

+ 1 - 1
04-新项目源码_source/项目源码/pri-smart-hospital-miniprogram/utils/homeMenu.js

@@ -66,7 +66,7 @@ const REQUIRED_MENUS = [
   DEFAULT_MENUS[0],
   {
     name: '病案复印(Demo)',
-    routePath: '/packageMRC/pages/entry/index',
+    routePath: '/packageMRC/pages/apply-entry/index',
     whitelisted: true,
     code: 'MRC-DEMO-ENTRY',
     icon: ''

+ 1 - 0
04-新项目源码_source/项目源码/pri-smart-hospital-miniprogram/utils/homeRoute.js

@@ -10,6 +10,7 @@ const TAB_ROUTES = {
 };
 
 const NORMAL_ROUTES = {
+  '/packageMRC/pages/apply-entry/index': 'navigateTo',
   '/packageMRC/pages/entry/index': 'navigateTo',
   '/pages/index/pages/switchHospital/switchHospital': 'navigateTo',
   '/pages/index/pages/hospitalIntro/hospitalIntro': 'navigateTo',