问题:管理员的商户上下文存在 localStorage,之前只会在「平台商户」页点「成员」时被 写入,界面上没有任何提示,而且只在登录/登出时清除。管理员点过一次商户后,订单/商品/ 钱包/成员等商户后台页面会一直停在该商户视角,而首页看板仍是平台口径——两个数字 看起来互相矛盾却无法解释。 - MainLayout 顶栏为管理员常驻显示「当前商户:xxx」,并用 Tooltip 说明哪些页面受它影响 - 提供「退出商户视角」按钮:清除 localStorage 后整页刷新,保证当前页已加载的数据 也按新上下文重新取一遍(只在上下文确实存在时出现) - README 管理端章节同步说明 未做静默回退的取舍:商户上下文解析失败时后端仍返回 403。因为商户后台存在写操作 (人工下单、取消、成员管理),若自动回退到默认商户,写入会落到错误的商户上—— 这是比"多点一下退出"严重得多的问题。
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Oxc
- @vitejs/plugin-react-swc uses SWC
React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
Expanding the Oxlint configuration
If you are developing a production application, we recommend enabling type-aware lint rules by installing oxlint-tsgolint and editing .oxlintrc.json:
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "oxc"],
"options": {
"typeAware": true
},
"rules": {
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }]
}
}
See the Oxlint rules documentation for the full list of rules and categories.