From ed693a450a13f5f8d7b1b0979d2c59982f6b0bf2 Mon Sep 17 00:00:00 2001 From: zhanjunhao <642307404@qq.com> Date: Wed, 25 Nov 2026 16:29:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(org/vite):=20=E4=BF=AE=E6=AD=A3=E6=88=90?= =?UTF-8?q?=E5=91=98=E6=8E=92=E8=A1=8C=E8=B7=A8=E9=A1=B5=E5=90=8D=E6=AC=A1?= =?UTF-8?q?=E4=B8=8E=E9=85=8D=E8=89=B2=EF=BC=8C=E6=8B=A6=E6=88=AA=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E6=9C=8D=E5=8A=A1=E7=9A=84=20.npmrc=20=E8=AF=B7?= =?UTF-8?q?=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + docs/CHANGELOG.md | 16 ++++++++++++++++ docs/ui/ORG_CENTER_SPEC.md | 2 +- src/pages/Organization/OrgLogs.jsx | 12 +++++++++--- src/styles/org-center.css | 24 ++++++++++++++---------- vite.config.js | 29 +++++++++++++++++++++++++++++ 6 files changed, 70 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e435964e..974cdadf 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,7 @@ npm run preview | 现象 | 优先检查 | | --- | --- | | 页面能打开但提示状态或接口加载失败 | 后端是否可用;Network 中 `/api/status` 的目标地址与响应;代理配置 | +| 共享测试站出现 Vite 红色遮罩 | 检查站点网关的前端上游。共享测试站应由网关提供构建后的静态文件,Vite 开发服务仅用于联调。开发服务对 `.npmrc` 请求直接返回 404。 | | 登录后又回到登录页 | `/api/user/self` 响应、Cookie 是否发送、跨域凭证策略、账号状态 | | 企业数据为空或串到其他企业 | 当前组织选择、`current_org_id` 与请求头 `X-Org-Id` | | 修改环境变量后无变化 | 是否重启开发服务或重新构建发布;HTML 与静态资源缓存 | diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 8aea4634..abf29396 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -42,6 +42,22 @@ - **回滚**:还原兑换码列表、表单、详情弹窗和对应样式与文案。 - **关联**:`src/components/table/redemptions/`、`docs/ui/CONSOLE_SPEC.md`。 +### 修复 · 企业成员排行的主题色与跨页名次 + +- **范围**:企业中心 `/org/logs` 的成员排行。 +- **变更**:前三名使用主题派生的三档底色,其他名次使用中性色;在分页前生成全表名次。 +- **影响**:切换系统主色或明暗模式时,排名徽章同步更新;翻页时继续显示全表名次。 +- **回滚**:还原排名列的名次生成和徽章配色。 +- **关联**:`src/pages/Organization/OrgLogs.jsx`、`src/styles/org-center.css`、`docs/ui/ORG_CENTER_SPEC.md`。 + +### 修复 · Vite 读取 npm 配置文件触发错误遮罩 + +- **范围**:Vite 开发服务的文件请求处理。 +- **变更**:在资源转换前拦截 `.npmrc` 请求并返回 404,同时将 `.npmrc` 加入文件访问拒绝列表。 +- **影响**:npm 配置文件请求不会启动资源转换或触发全站热更新错误遮罩。应用使用的文本资源导入继续由 Vite 转换。 +- **回滚**:还原 Vite 的 npm 配置文件拦截和对应访问规则。 +- **关联**:`vite.config.js`、`README.md`。 + ### 修复 · 控制台数据看板持续加载 - **范围**:控制台 `/console/analytics` 运营看板、创作作品详情抽屉及公共 API 的只读请求。 diff --git a/docs/ui/ORG_CENTER_SPEC.md b/docs/ui/ORG_CENTER_SPEC.md index a41dd09f..28f48e90 100644 --- a/docs/ui/ORG_CENTER_SPEC.md +++ b/docs/ui/ORG_CENTER_SPEC.md @@ -90,7 +90,7 @@ - 时间范围为本页签自有的可编辑字段(默认最近 7 天,含快捷预设),与“明细日志”筛选互不影响;起止颠倒沿用原提示。 - 末列“操作”不固定:视频任务显示“点击预览视频”,失败任务保留失败原因查看,其余显示“-”。 - 预览视频沿用 `ContentModal`:标题栏“视频预览”与关闭按钮、16:9 播放区、加载态、播放失败或无地址时 `Empty` 空态、页脚复制链接 / 新标签页打开 / 关闭;关闭时暂停视频,重开同一视频不残留加载指示。 -- 成员排行行键使用 `user_id-名次序号`,避免后端同一成员多行时出现重复 key。 +- 成员排行按接口返回顺序在分页前生成连续名次。行键使用 `user_id-名次序号`,避免后端同一成员多行时出现重复 key。前三名使用当前主题的强调色及三档底色,其余名次使用中性色。 - 明细日志查询不写 URL;绘图与视频筛选沿用原有 URL 同步。 - 保留差异:明细日志无列设置、分组列、操作列;任务表无渠道 / 用户 ID 筛选、平台列、排序与任务 ID 复制。 diff --git a/src/pages/Organization/OrgLogs.jsx b/src/pages/Organization/OrgLogs.jsx index 6ec7268d..c1c8bf61 100644 --- a/src/pages/Organization/OrgLogs.jsx +++ b/src/pages/Organization/OrgLogs.jsx @@ -731,6 +731,7 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => { () => (ranking || []).map((row, index) => ({ ...row, + rank: index + 1, rank_row_key: `${row.user_id ?? 'unknown'}-${index}`, })), [ranking], @@ -740,10 +741,15 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => { () => [ { title: t('排名'), + dataIndex: 'rank', width: 90, - render: (_, __, index) => ( - - {index + 1} + render: (rank) => ( + + {rank} ), }, diff --git a/src/styles/org-center.css b/src/styles/org-center.css index b9b88581..9ce8db5e 100644 --- a/src/styles/org-center.css +++ b/src/styles/org-center.css @@ -527,10 +527,6 @@ html.dark .org-center .oc-page { --oc-stat-rose: #cf4c69; --oc-stat-blue-bg: #2981ce10; --oc-stat-blue: #2981ce; - --oc-rank-1: #e0ad21; - --oc-rank-2: #8795a8; - --oc-rank-3: #bc7847; - --oc-rank-text: #fff; } .org-center .oc-page .oc-exp-stats { @@ -631,18 +627,26 @@ html.dark .org-center .oc-page { } .org-center .oc-page .oc-exp-rank-1 { - background: var(--oc-rank-1); - color: var(--oc-rank-text); + background-color: var(--brand-selection-bg); + color: var(--brand-selection-text); } .org-center .oc-page .oc-exp-rank-2 { - background: var(--oc-rank-2); - color: var(--oc-rank-text); + background-color: color-mix( + in srgb, + var(--brand-selection-bg) 65%, + var(--oc-soft) + ); + color: var(--brand-selection-text); } .org-center .oc-page .oc-exp-rank-3 { - background: var(--oc-rank-3); - color: var(--oc-rank-text); + background-color: color-mix( + in srgb, + var(--brand-selection-bg) 35%, + var(--oc-soft) + ); + color: var(--brand-selection-text); } @media (max-width: 767px) { diff --git a/vite.config.js b/vite.config.js index eaa0a946..c249bdc2 100644 --- a/vite.config.js +++ b/vite.config.js @@ -16,6 +16,7 @@ const DEV_PROXY_TARGET = 'http://134.175.227.134:13000'; */ const JSX_IN_JS_RE = /src\/.*\.js$/; const REACT_RUNTIME_RE = /\/node_modules\/(?:react|react-dom|scheduler)\//; +const NPM_CONFIG_PATH_RE = /(?:^|[\\/])\.npmrc[. ]*(?:[\\/]|$)/i; /** * 让 JSX_IN_JS_RE 命中的 .js 按 JSX 语法解析。 @@ -59,6 +60,29 @@ function disableDevImportGlob() { }; } +function blockNpmConfigRequests() { + return { + name: 'block-npm-config-requests', + configureServer(server) { + server.middlewares.use((request, response, next) => { + let pathname; + try { + pathname = decodeURIComponent( + (request.url ?? '').split(/[?#]/, 1)[0], + ); + } catch { + return next(); + } + if (!NPM_CONFIG_PATH_RE.test(pathname)) return next(); + + // Stop before Vite tries to load the file or broadcasts an HMR error. + response.statusCode = 404; + response.end(); + }); + }, + }; +} + /** * 向 index.html 注入统计脚本。 * @@ -123,6 +147,7 @@ export default defineConfig(({ mode, command }) => { }, }, plugins: [ + blockNpmConfigRequests(), disableDevImportGlob(), jsxInJsPlugin(), react(), @@ -172,6 +197,10 @@ export default defineConfig(({ mode, command }) => { // 监听局域网接口,供本机、后端及测试人员联调。 host: '0.0.0.0', port: 5174, + fs: { + // Setting deny replaces the Vite defaults. + deny: ['.env', '.env.*', '*.{crt,pem}', '**/.git/**', '.npmrc'], + }, warmup: { clientFiles: [ './src/index.jsx',