diff --git a/src/utils/auth.ts b/src/utils/auth.ts index 552c61f..6e35d33 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -7,14 +7,16 @@ import { ROUTES } from '@/constants/routes' // 游客可浏览页面(微信审核要求:进入首页即要求授权登录会被拒, // tab 页与登录页放开,操作型页面按需登录;协议全文页游客可读—— -// 登录前需可查看协议内容才能完成勾选同意) +// 登录前需可查看协议内容才能完成勾选同意; +// BLE 配网页纯本地蓝牙操作不依赖账号,游客放行供设备试连体验) export const PUBLIC_PAGES = new Set([ ROUTES.LOGIN, ROUTES.HOME, ROUTES.DEVICE_LIST, ROUTES.EVENT, ROUTES.MINE, - ROUTES.AGREEMENT + ROUTES.AGREEMENT, + ROUTES.DEVICE_BLE_CONFIG ]) // 登录页路径(navigation 守卫改投目标) diff --git a/tests/unit/utils/auth.spec.ts b/tests/unit/utils/auth.spec.ts index 449574d..16d970b 100644 --- a/tests/unit/utils/auth.spec.ts +++ b/tests/unit/utils/auth.spec.ts @@ -88,12 +88,14 @@ describe('navigation 登录守卫', () => { }) describe('isProtectedPage', () => { - it('登录页与四个 tab 页返回 false(游客可浏览),其余页面返回 true', () => { + it('登录页、四个 tab 页与协议/BLE 配网页返回 false(游客可浏览),其余页面返回 true', () => { expect(isProtectedPage(ROUTES.LOGIN)).toBe(false) expect(isProtectedPage(ROUTES.HOME)).toBe(false) expect(isProtectedPage(ROUTES.DEVICE_LIST)).toBe(false) expect(isProtectedPage(ROUTES.EVENT)).toBe(false) expect(isProtectedPage(ROUTES.MINE)).toBe(false) + expect(isProtectedPage(ROUTES.AGREEMENT)).toBe(false) + expect(isProtectedPage(ROUTES.DEVICE_BLE_CONFIG)).toBe(false) expect(isProtectedPage(ROUTES.FAMILY)).toBe(true) expect(isProtectedPage(`${ROUTES.LOGIN}?from=xxx`)).toBe(false) })