Commit 09d189c6 by 胡悦

refactor: 重构独立页面布局,优化详情抽屉样式

为 Agent、Skill、渠道活码的详情抽屉添加统一左右20px内边距,提升页面视觉一致性
新增IndependentPageLayout通用布局组件,替换原有sticky页头方案,将独立页面改为主体内容内部滚动以解决视觉错位问题
更新所有关联的独立页面代码与测试用例,适配新布局规范
更新admin-shell开放规范,明确独立页面滚动规则与页头布局要求
清理已废弃的openspec变更提案与归档文件
1 parent 30d7e0a3
Showing 27 changed files with 273 additions and 189 deletions
# Design: 独立页面改为内容区内部滚动
## Context
`BusinessAdminShell` 使用一屏高度布局,内容区 `main` 当前是可滚动容器。独立页面内部页头又使用 `sticky top-0`,在滚动过程中会与全局 header、左侧菜单和内容背景产生视觉错位。用户已明确放弃独立页面页头吸顶方案,新的方向是避免整屏滚动,将滚动范围收敛到独立页面主体内容。
## Goals / Non-Goals
**Goals:**
- 独立页面在后台 shell 内容区内形成一屏布局,不推动外层页面滚动。
- 独立页面页头是普通块级内容,不使用 `sticky` 或 `fixed`。
- 独立页面主体内容区独立滚动,长表单可完整编辑。
- 页面级操作按钮保持在页头右侧可见,不受主体内容滚动影响。
**Non-Goals:**
- 不调整列表页、表格页、抽屉和弹窗的滚动模型。
- 不改变全局后台 shell 的顶部用户区、面包屑、菜单和退出登录行为。
- 不改变独立页面字段、保存 payload、权限和业务状态。
## Decisions
### 决策 1:独立页使用内部纵向布局承载滚动
独立页根节点使用可占满 shell 内容区的纵向布局,页头和错误提示位于滚动区域外,主体卡片或主体容器设置 `min-height: 0` 并承担 `overflow-y-auto`。这样滚动只发生在独立页主体内容,不再让 `main` 或浏览器窗口整屏滚动。
替代方案:继续使用页头 sticky。该方案已被用户否定,且会改变页头视觉表现。
### 决策 2:页头不再使用定位
独立页面页头移除 `sticky top-0 z-*` 等定位类,保留原有白色背景、边框、圆角、内边距和右侧操作区。页头作为普通布局块固定在独立页可视区域顶部,稳定性由父级一屏布局保证。
替代方案:使用 `position: fixed` 加补位。该方案容易脱离 shell 布局并影响列表页或其他页面,不采用。
### 决策 3:只作用于独立页面
实现应优先通过独立页共享 class、组件或明确的页面级布局收敛,避免修改列表页默认滚动模型。若必须调整 shell,需要保证列表页和其他页面仍保留原有滚动行为。
## Risks / Trade-offs
- 风险:主体内容滚动容器缺少 `min-height: 0` 导致仍然撑开外层。处理:测试独立页根节点、主体容器和表单卡片的高度约束。
- 风险:错误提示或加载态位置影响可用高度。处理:错误提示保持在页头下方,主体区域按剩余空间滚动。
- 风险:移动端或窄屏下按钮挤压标题。处理:标题区域 `min-width: 0`,操作区 `shrink-0`,必要时保持换行但不改变业务行为。
## Migration Plan
1. 更新独立页面布局测试,先断言页头不再使用 sticky/fixed,主体内容区具备内部滚动能力。
2. 调整独立页面根布局和主体容器样式。
3. 运行相关测试、类型检查,并由用户在浏览器中验证页面视觉效果。
# Proposal: 独立页面改为内容区内部滚动
## Why
管理后台独立新增、编辑和配置页面当前依赖整页滚动与页头 sticky,滚动时容易出现页头、内容卡片和全局 header 的视觉错位。用户已确认不采用 sticky 吸顶方案,需要让独立页面保持在后台 shell 的一屏范围内,只让页面主体内容区域滚动。
## What Changes
- 独立页面整体不得触发浏览器窗口或后台 shell 外层整屏滚动。
- 独立页面页头操作区恢复为普通布局块,不使用 sticky 或 fixed。
- 独立页面主体内容区域在可用高度内滚动,保持页头与页面操作区稳定可见。
- 保持现有返回、保存、校验、请求、路由和业务字段行为不变。
## Capabilities
### New Capabilities
- 无。
### Modified Capabilities
- `admin-shell`: 调整独立页面滚动模型,要求独立页在 shell 内容区内形成一屏布局,并由页面主体内容区承担滚动。
## Impact
- 影响项目 OpenSpec:`openspec/specs/admin-shell/spec.md`。
- 影响前端实现:独立新增、编辑、配置页面的根布局、页头定位样式和主体内容滚动容器。
- 影响验证:需要覆盖至少一个长表单独立页,确认窗口不整屏滚动、页头不吸顶但保持可见、主体内容可滚动且无双滚动条。
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
## MODIFIED Requirements ## MODIFIED Requirements
### Requirement: 独立页面页头操作区 ### Requirement: 独立页面页头操作区
岗位 Agent 管理后台 SHALL 为新增、编辑、配置等独立页面提供一致且滚动可见的页头操作区。页头左侧只展示页面标题、说明和状态摘要等页面识别信息;页头右侧 MUST 展示 `返回` 和其他页面级操作按钮。独立页面页头 MUST 使用内容滚动容器内的 sticky 吸顶实现,不得使用 `position: fixed` 脱离后台 shell 布局。 岗位 Agent 管理后台 SHALL 为新增、编辑、配置等独立页面提供一致且滚动稳定的页头操作区。页头左侧只展示页面标题、说明和状态摘要等页面识别信息;页头右侧 MUST 展示 `返回` 和其他页面级操作按钮。独立页面 MUST 避免浏览器窗口或后台 shell 外层整屏滚动;长内容 SHALL 在独立页面主体内容区内部滚动。独立页面页头 MUST 使用普通文档流布局,不得使用 `position: sticky` 或 `position: fixed`。
#### Scenario: 独立页面右侧集中展示操作按钮 #### Scenario: 独立页面右侧集中展示操作按钮
- **WHEN** 已登录用户打开新增、编辑、配置等独立页面 - **WHEN** 已登录用户打开新增、编辑、配置等独立页面
...@@ -19,10 +19,12 @@ ...@@ -19,10 +19,12 @@
- **AND** 主操作位于右侧操作区内靠右位置 - **AND** 主操作位于右侧操作区内靠右位置
- **AND** 其他次级页面级操作位于 `返回` 和主操作之间,或收敛到更多操作菜单 - **AND** 其他次级页面级操作位于 `返回` 和主操作之间,或收敛到更多操作菜单
#### Scenario: 滚动时保持页头操作区可见 #### Scenario: 独立页面主体内容内部滚动
- **WHEN** 已登录用户在新增、编辑、配置等独立页面向下滚动表单内容 - **WHEN** 已登录用户在新增、编辑、配置等独立页面查看长表单内容
- **THEN** 独立页面页头操作区使用 sticky 方式保持在内容滚动容器顶部可见 - **THEN** 浏览器窗口和后台 shell 外层不得发生整屏滚动
- **AND** 独立页面页头不得使用 fixed 定位或依赖页面级手动补位保持可见 - **AND** 独立页面页头操作区保持在独立页面可视区域顶部
- **AND** 独立页面页头不得使用 sticky 或 fixed 定位
- **AND** 长表单内容在独立页面主体内容区内部滚动
- **AND** `返回` 和 `保存` 等页面级操作入口保持可点击 - **AND** `返回` 和 `保存` 等页面级操作入口保持可点击
- **AND** 滚动内容不得覆盖页头操作区 - **AND** 页面不得出现互相竞争的双滚动条
- **AND** 页头右侧操作区不得被页面标题或说明挤压到不可见 - **AND** 页头右侧操作区不得被页面标题或说明挤压到不可见
# Tasks
## 1. OpenSpec
- [x] 1.1 移除旧的独立页 sticky 吸顶方案 change。
- [x] 1.2 新增 `admin-shell` 规范 delta,明确独立页面不整屏滚动,长内容在主体内容区内部滚动。
- [x] 1.3 明确独立页面页头不得使用 sticky 或 fixed。
- [x] 1.4 运行 `openspec validate fix-independent-page-contained-scroll --strict`。
## 2. 测试
- [x] 2.1 更新独立页面相关测试,断言页头不包含 sticky/fixed 定位类。
- [x] 2.2 覆盖至少一个长表单独立页主体内容区具备内部滚动容器。
- [x] 2.3 确认列表页或其他非独立页面测试不需要改变滚动模型。
## 3. 实现
- [x] 3.1 调整独立页面根布局,使页面在 shell 内容区内形成一屏纵向布局。
- [x] 3.2 移除独立页面页头 `sticky top-0` 等定位样式,保留白色背景、边框、圆角和内边距。
- [x] 3.3 将长表单主体内容收敛到内部滚动容器,并设置必要的 `min-height: 0`。
- [x] 3.4 确保返回、保存、加载、错误提示和请求行为不变。
## 4. 验证
- [x] 4.1 运行相关测试。
- [x] 4.2 运行类型检查。
- [x] 4.3 由用户在浏览器中验证长表单独立页不整屏滚动、页头样式稳定、主体内容可滚动且无双滚动条。
# Design: 修复独立页面页头吸顶错位
## 方案
独立页面继续渲染在 `BusinessAdminShell` 的内容区内。页面自身不创建新的全屏 `fixed` header,也不通过 `margin-top`、`padding-top` 或 `height: calc(100vh - xx)` 为 fixed header 手动补位。
独立页面的页头操作区使用 sticky 吸顶:
- sticky 元素位于页面内容结构顶部。
- sticky 的 `top` 相对于后台内容滚动容器,默认为 `0`。
- sticky 页头必须具备不透明背景、边框和足够 `z-index`,避免内容滚动时视觉穿透。
- 页头右侧操作区必须 `shrink-0`,避免标题过长时挤压 `返回`、`保存` 等按钮。
## 实现策略
优先收敛独立页面页头的通用 class 或组件样式,减少各页面复制 `sticky top-0` 时出现细节漂移。若短期先改页面 class,也必须保持同一套布局规则。
需要重点检查以下页面类型:
- Agent 新增/编辑页。
- 岗位标签新增/编辑页。
- 员工渠道活码新增/编辑页。
- 官网岗位展示新增/编辑页。
- 官网 Agent 展示配置页。
## 风险与处理
- 风险:sticky 元素被外层异常 `overflow`、`transform` 或额外滚动容器影响。处理:验证 sticky 参照为后台内容滚动容器,并避免在独立页根节点再创建不必要的全屏滚动。
- 风险:页头吸顶后覆盖首段内容。处理:保持页头仍占据文档流位置,不使用 fixed,因此内容自然从页头后开始。
- 风险:长标题挤压操作按钮。处理:标题区域 `min-width: 0`,操作区 `shrink-0`。
## 验证
- 运行相关单元测试或组件测试。
- 运行类型检查。
- 使用浏览器打开一个长表单独立页,滚动页面,确认页头吸顶、操作按钮可点击、内容不穿透且无双滚动条。
# Proposal: 修复独立页面页头吸顶错位
## 背景
管理后台独立新增、编辑和配置页面已经要求页头操作区在滚动时保持可见,但当前实现和规范没有明确页头吸顶必须以内容滚动容器为参照,也没有明确禁止使用 `fixed` 加手动补位。页面滚动时容易出现页头、内容卡片和全局 header 的视觉错位。
## 目标
- 独立页面页头使用 `position: sticky` 在页面内容滚动容器内吸顶。
- 独立页面页头不得使用 `position: fixed` 脱离后台 shell 布局。
- 页面内容滚动时,页头背景、边框和层级保持稳定,滚动内容不得穿透或覆盖页头。
- 保持现有页面的返回、保存、校验、请求和路由行为不变。
## 非目标
- 不调整全局后台 shell 的菜单、面包屑、用户区和退出登录行为。
- 不改变列表页滚动模型、表格分页、筛选或虚拟滚动规则。
- 不改变独立页面字段、保存 payload、权限和业务状态。
## 影响范围
- 影响项目 OpenSpec:`openspec/specs/admin-shell/spec.md`。
- 影响前端实现:独立新增、编辑、配置页面的页头吸顶样式和必要的共享样式收敛。
- 影响验证:需要覆盖至少一个长表单独立页滚动时页头吸顶且不遮挡操作按钮。
# Tasks
## 1. OpenSpec
- [x] 1.1 新增 `admin-shell` 规范 delta,明确独立页面页头必须在内容滚动容器内 sticky 吸顶。
- [x] 1.2 明确独立页面页头不得使用 fixed 和手动补位。
- [x] 1.3 运行 `openspec validate fix-independent-page-sticky-header --strict`。
## 2. 实现
- [ ] 2.1 检查独立页面页头实现,识别导致 sticky 错位的外层滚动或样式问题。
- [ ] 2.2 收敛独立页面页头吸顶样式,保持 `返回`、`保存` 等操作在右侧可见。
- [ ] 2.3 清理独立页面中与 fixed header 补位相关的样式,如 `margin-top`、`padding-top` 或不必要的 `height: calc(...)`。
## 3. 验证
- [ ] 3.1 运行相关测试。
- [ ] 3.2 运行类型检查。
- [ ] 3.3 浏览器验证长表单独立页滚动时页头吸顶、无错位、无双滚动条、按钮可点击。
...@@ -97,7 +97,7 @@ TBD - created by archiving change add-admin-login-agent-list-mock. Update Purpos ...@@ -97,7 +97,7 @@ TBD - created by archiving change add-admin-login-agent-list-mock. Update Purpos
- **AND** 点击二级菜单面包屑项返回该二级菜单页面 - **AND** 点击二级菜单面包屑项返回该二级菜单页面
### Requirement: 独立页面页头操作区 ### Requirement: 独立页面页头操作区
岗位 Agent 管理后台 SHALL 为新增、编辑、配置等独立页面提供一致且滚动可见的页头操作区。页头左侧只展示页面标题、说明和状态摘要等页面识别信息;页头右侧 MUST 展示 `返回` 和其他页面级操作按钮。 岗位 Agent 管理后台 SHALL 为新增、编辑、配置等独立页面提供一致且滚动稳定的页头操作区。页头左侧只展示页面标题、说明和状态摘要等页面识别信息;页头右侧 MUST 展示 `返回` 和其他页面级操作按钮。独立页面 MUST 避免浏览器窗口或后台 shell 外层整屏滚动;长内容 SHALL 在独立页面主体内容区内部滚动。独立页面页头 MUST 使用普通文档流布局,不得使用 `position: sticky` 或 `position: fixed`。
#### Scenario: 独立页面右侧集中展示操作按钮 #### Scenario: 独立页面右侧集中展示操作按钮
- **WHEN** 已登录用户打开新增、编辑、配置等独立页面 - **WHEN** 已登录用户打开新增、编辑、配置等独立页面
...@@ -113,10 +113,13 @@ TBD - created by archiving change add-admin-login-agent-list-mock. Update Purpos ...@@ -113,10 +113,13 @@ TBD - created by archiving change add-admin-login-agent-list-mock. Update Purpos
- **AND** 主操作位于右侧操作区内靠右位置 - **AND** 主操作位于右侧操作区内靠右位置
- **AND** 其他次级页面级操作位于 `返回` 和主操作之间,或收敛到更多操作菜单 - **AND** 其他次级页面级操作位于 `返回` 和主操作之间,或收敛到更多操作菜单
#### Scenario: 滚动时保持页头操作区可见 #### Scenario: 独立页面主体内容内部滚动
- **WHEN** 已登录用户在新增、编辑、配置等独立页面向下滚动表单内容 - **WHEN** 已登录用户在新增、编辑、配置等独立页面查看长表单内容
- **THEN** 独立页面页头操作区保持在内容滚动容器顶部可见 - **THEN** 浏览器窗口和后台 shell 外层不得发生整屏滚动
- **AND** 独立页面页头操作区保持在独立页面可视区域顶部
- **AND** 独立页面页头不得使用 sticky 或 fixed 定位
- **AND** 长表单内容在独立页面主体内容区内部滚动
- **AND** `返回` 和 `保存` 等页面级操作入口保持可点击 - **AND** `返回` 和 `保存` 等页面级操作入口保持可点击
- **AND** 滚动内容不得覆盖页头操作区 - **AND** 页面不得出现互相竞争的双滚动条
- **AND** 页头右侧操作区不得被页面标题或说明挤压到不可见 - **AND** 页头右侧操作区不得被页面标题或说明挤压到不可见
...@@ -18,6 +18,7 @@ import { ...@@ -18,6 +18,7 @@ import {
} from '../../api/positionTag'; } from '../../api/positionTag';
import { trackCustomEvent } from '../../api/tracking'; import { trackCustomEvent } from '../../api/tracking';
import { useDeferredEffect } from '../../hooks/useDeferredEffect'; import { useDeferredEffect } from '../../hooks/useDeferredEffect';
import { IndependentPageBody, IndependentPageHeader, IndependentPageLayout } from '../components/IndependentPageLayout';
import { buildAgentTagListSearch, readAgentTagListRouteState } from './agentTagRouteState'; import { buildAgentTagListSearch, readAgentTagListRouteState } from './agentTagRouteState';
interface TagFormState extends BusinessFormValues { interface TagFormState extends BusinessFormValues {
...@@ -162,8 +163,8 @@ export function AgentTagEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -162,8 +163,8 @@ export function AgentTagEditorPage({ mode }: { mode: 'create' | 'edit' }) {
}; };
return ( return (
<section className="grid gap-6"> <IndependentPageLayout>
<header className="sticky top-0 z-10 flex items-start justify-between gap-6 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-6"> <IndependentPageHeader>
<div aria-label="页面标题" className="min-w-0 flex-1"> <div aria-label="页面标题" className="min-w-0 flex-1">
<h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]">{mode === 'create' ? '新建岗位标签' : '编辑岗位标签'}</h2> <h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]">{mode === 'create' ? '新建岗位标签' : '编辑岗位标签'}</h2>
<p className="m-0 mt-1 text-sm text-[var(--gl-color-text-secondary)]"> <p className="m-0 mt-1 text-sm text-[var(--gl-color-text-secondary)]">
...@@ -174,7 +175,7 @@ export function AgentTagEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -174,7 +175,7 @@ export function AgentTagEditorPage({ mode }: { mode: 'create' | 'edit' }) {
<Button variant="outline" onClick={goBackToList}>返回</Button> <Button variant="outline" onClick={goBackToList}>返回</Button>
<Button theme="primary" loading={saving} onClick={handleSave}>保存</Button> <Button theme="primary" loading={saving} onClick={handleSave}>保存</Button>
</div> </div>
</header> </IndependentPageHeader>
{notice ? ( {notice ? (
<div <div
...@@ -186,7 +187,7 @@ export function AgentTagEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -186,7 +187,7 @@ export function AgentTagEditorPage({ mode }: { mode: 'create' | 'edit' }) {
</div> </div>
) : null} ) : null}
<div className="rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-10"> <IndependentPageBody className="rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-10">
<div className="mx-auto grid max-w-[760px] gap-6"> <div className="mx-auto grid max-w-[760px] gap-6">
<BusinessForm <BusinessForm
fields={fields} fields={fields}
...@@ -197,7 +198,7 @@ export function AgentTagEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -197,7 +198,7 @@ export function AgentTagEditorPage({ mode }: { mode: 'create' | 'edit' }) {
onChange={(nextValues) => setForm(nextValues as TagFormState)} onChange={(nextValues) => setForm(nextValues as TagFormState)}
/> />
</div> </div>
</div> </IndependentPageBody>
</section> </IndependentPageLayout>
); );
} }
...@@ -279,7 +279,11 @@ describe('Agent tag create and edit pages', () => { ...@@ -279,7 +279,11 @@ describe('Agent tag create and edit pages', () => {
await screen.findByRole('heading', { name: '新建岗位标签' }); await screen.findByRole('heading', { name: '新建岗位标签' });
const pageHeader = screen.getByRole('heading', { name: '新建岗位标签' }).closest('header') as HTMLElement; const pageHeader = screen.getByRole('heading', { name: '新建岗位标签' }).closest('header') as HTMLElement;
expect(pageHeader).toHaveClass('sticky', 'top-0', 'z-10'); const pageRoot = pageHeader.closest('section') as HTMLElement;
expect(pageRoot).toHaveClass('h-full', 'min-h-0', 'overflow-hidden');
expect(pageHeader).toHaveClass('shrink-0', 'bg-[var(--gl-color-bg-container)]');
expect(pageHeader).not.toHaveClass('sticky', 'top-0', 'z-10');
expect(pageRoot.querySelector('.flex-1.overflow-y-auto')).toBeInTheDocument();
expect(within(screen.getByLabelText('页面标题')).queryByRole('button')).not.toBeInTheDocument(); expect(within(screen.getByLabelText('页面标题')).queryByRole('button')).not.toBeInTheDocument();
const pageActions = screen.getByLabelText('页面操作'); const pageActions = screen.getByLabelText('页面操作');
expect(within(pageActions).getByRole('button', { name: '返回' })).toBeInTheDocument(); expect(within(pageActions).getByRole('button', { name: '返回' })).toBeInTheDocument();
......
...@@ -48,6 +48,7 @@ export function AgentDetailDrawer({ agentId, routeState }: { agentId?: string; r ...@@ -48,6 +48,7 @@ export function AgentDetailDrawer({ agentId, routeState }: { agentId?: string; r
visible visible
header="Agent详情" header="Agent详情"
size="520px" size="520px"
className="detail-drawer"
destroyOnClose destroyOnClose
closeBtn={<Button aria-label="关闭Agent详情" icon={<CloseIcon />} shape="square" variant="text" />} closeBtn={<Button aria-label="关闭Agent详情" icon={<CloseIcon />} shape="square" variant="text" />}
onClose={closeDrawer} onClose={closeDrawer}
......
...@@ -169,15 +169,19 @@ describe('Agent editor routes and detail drawer', () => { ...@@ -169,15 +169,19 @@ describe('Agent editor routes and detail drawer', () => {
vi.mocked(reportAnalyticsEvents).mockResolvedValue({ success: true }); vi.mocked(reportAnalyticsEvents).mockResolvedValue({ success: true });
}); });
it('renders the new page with sticky header actions and returns to the list context from the header return', async () => { it('renders the new page with contained body scrolling and returns to the list context from the header return', async () => {
renderAgents('/agents/new?keyword=复盘&page=2&pageSize=20'); renderAgents('/agents/new?keyword=复盘&page=2&pageSize=20');
await waitFor(() => { await waitFor(() => {
expect(screen.getByRole('heading', { name: '新建Agent' })).toBeInTheDocument(); expect(screen.getByRole('heading', { name: '新建Agent' })).toBeInTheDocument();
}); });
const pageHeader = screen.getByRole('heading', { name: '新建Agent' }).closest('header') as HTMLElement; const pageHeader = screen.getByRole('heading', { name: '新建Agent' }).closest('header') as HTMLElement;
const pageRoot = pageHeader.closest('section') as HTMLElement;
expect(within(screen.getByLabelText('左侧导航')).getByText('Agent列表').closest('li')).toHaveClass('t-is-active'); expect(within(screen.getByLabelText('左侧导航')).getByText('Agent列表').closest('li')).toHaveClass('t-is-active');
expect(pageHeader).toHaveClass('sticky', 'top-0', 'z-10'); expect(pageRoot).toHaveClass('h-full', 'min-h-0', 'overflow-hidden');
expect(pageHeader).toHaveClass('shrink-0', 'bg-[var(--gl-color-bg-container)]');
expect(pageHeader).not.toHaveClass('sticky', 'top-0', 'z-10');
expect(pageRoot.querySelector('.flex-1.overflow-y-auto')).toBeInTheDocument();
expect(within(screen.getByLabelText('页面标题')).queryByRole('button')).not.toBeInTheDocument(); expect(within(screen.getByLabelText('页面标题')).queryByRole('button')).not.toBeInTheDocument();
const pageActions = screen.getByLabelText('页面操作'); const pageActions = screen.getByLabelText('页面操作');
expect(within(pageActions).getByRole('button', { name: '返回' })).toBeInTheDocument(); expect(within(pageActions).getByRole('button', { name: '返回' })).toBeInTheDocument();
......
...@@ -15,6 +15,7 @@ import { getEmployeeMounts, getAgentDetail, getAgentList, createAgent, updateAge ...@@ -15,6 +15,7 @@ import { getEmployeeMounts, getAgentDetail, getAgentList, createAgent, updateAge
import { getSkillList, type SkillSummary } from '../../api/skill'; import { getSkillList, type SkillSummary } from '../../api/skill';
import { trackCustomEvent } from '../../api/tracking'; import { trackCustomEvent } from '../../api/tracking';
import { useDeferredEffect } from '../../hooks/useDeferredEffect'; import { useDeferredEffect } from '../../hooks/useDeferredEffect';
import { IndependentPageBody, IndependentPageHeader, IndependentPageLayout } from '../components/IndependentPageLayout';
import { upsertSavedAgent } from './agentLocalStore'; import { upsertSavedAgent } from './agentLocalStore';
import { buildAgentListSearch, readAgentListRouteState } from './agentRouteState'; import { buildAgentListSearch, readAgentListRouteState } from './agentRouteState';
import { isApiError } from '../../api/client'; import { isApiError } from '../../api/client';
...@@ -576,8 +577,8 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -576,8 +577,8 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) {
}; };
return ( return (
<section className="grid gap-6"> <IndependentPageLayout>
<header className="sticky top-0 z-10 flex items-start justify-between gap-6 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-6"> <IndependentPageHeader>
<div aria-label="页面标题" className="min-w-0 flex-1"> <div aria-label="页面标题" className="min-w-0 flex-1">
<h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]">{title}</h2> <h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]">{title}</h2>
<p className="m-0 mt-1 text-sm text-[var(--gl-color-text-secondary)]"> <p className="m-0 mt-1 text-sm text-[var(--gl-color-text-secondary)]">
...@@ -588,7 +589,7 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -588,7 +589,7 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) {
<Button variant="outline" onClick={() => goBackToList(Boolean(routeState.detail && mode === 'edit'))}>返回</Button> <Button variant="outline" onClick={() => goBackToList(Boolean(routeState.detail && mode === 'edit'))}>返回</Button>
<Button theme="primary" loading={saveLoading} onClick={handleSave}>保存</Button> <Button theme="primary" loading={saveLoading} onClick={handleSave}>保存</Button>
</div> </div>
</header> </IndependentPageHeader>
{saveError ? ( {saveError ? (
<StatePlaceholder <StatePlaceholder
...@@ -599,7 +600,7 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -599,7 +600,7 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) {
/> />
) : null} ) : null}
<div className="rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-10"> <IndependentPageBody className="rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-10">
<BusinessForm <BusinessForm
fields={fields} fields={fields}
values={form} values={form}
...@@ -610,7 +611,7 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -610,7 +611,7 @@ export function AgentEditorPage({ mode }: { mode: 'create' | 'edit' }) {
setForm((current) => ({ ...current, ...nextValues } as AgentFormState)); setForm((current) => ({ ...current, ...nextValues } as AgentFormState));
}} }}
/> />
</div> </IndependentPageBody>
</section> </IndependentPageLayout>
); );
} }
...@@ -224,7 +224,11 @@ describe('Channel code create page', () => { ...@@ -224,7 +224,11 @@ describe('Channel code create page', () => {
expect(screen.getByRole('heading', { name: '新增员工渠道活码' })).toBeInTheDocument(); expect(screen.getByRole('heading', { name: '新增员工渠道活码' })).toBeInTheDocument();
}); });
const pageHeader = screen.getByRole('heading', { name: '新增员工渠道活码' }).closest('header') as HTMLElement; const pageHeader = screen.getByRole('heading', { name: '新增员工渠道活码' }).closest('header') as HTMLElement;
expect(pageHeader).toHaveClass('sticky', 'top-0', 'z-10'); const pageRoot = pageHeader.closest('section') as HTMLElement;
expect(pageRoot).toHaveClass('h-full', 'min-h-0', 'overflow-hidden');
expect(pageHeader).toHaveClass('shrink-0', 'items-center', 'bg-[var(--gl-color-bg-container)]');
expect(pageHeader).not.toHaveClass('sticky', 'top-0', 'z-10');
expect(pageRoot.querySelector('.flex-1.overflow-y-auto')).toBeInTheDocument();
expect(within(screen.getByLabelText('页面标题')).queryByRole('button')).not.toBeInTheDocument(); expect(within(screen.getByLabelText('页面标题')).queryByRole('button')).not.toBeInTheDocument();
const pageActions = screen.getByLabelText('页面操作'); const pageActions = screen.getByLabelText('页面操作');
expect(within(pageActions).getByRole('button', { name: '返回' })).toBeInTheDocument(); expect(within(pageActions).getByRole('button', { name: '返回' })).toBeInTheDocument();
......
...@@ -25,6 +25,7 @@ import { ...@@ -25,6 +25,7 @@ import {
type PositionTagListItem, type PositionTagListItem,
} from '../../api/positionTag'; } from '../../api/positionTag';
import { useDeferredEffect } from '../../hooks/useDeferredEffect'; import { useDeferredEffect } from '../../hooks/useDeferredEffect';
import { IndependentPageBody, IndependentPageHeader, IndependentPageLayout } from '../components/IndependentPageLayout';
interface ChannelCodeFormState extends BusinessFormValues { interface ChannelCodeFormState extends BusinessFormValues {
qrcode_name: string; qrcode_name: string;
...@@ -413,8 +414,8 @@ export function ChannelCodeEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -413,8 +414,8 @@ export function ChannelCodeEditorPage({ mode }: { mode: 'create' | 'edit' }) {
}; };
return ( return (
<section className="grid gap-6"> <IndependentPageLayout>
<header className="sticky top-0 z-10 flex items-start justify-between gap-6 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-6"> <IndependentPageHeader>
<div aria-label="页面标题" className="min-w-0 flex-1"> <div aria-label="页面标题" className="min-w-0 flex-1">
<h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]"> <h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]">
{mode === 'create' ? '新增员工渠道活码' : '编辑员工渠道活码'} {mode === 'create' ? '新增员工渠道活码' : '编辑员工渠道活码'}
...@@ -427,7 +428,7 @@ export function ChannelCodeEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -427,7 +428,7 @@ export function ChannelCodeEditorPage({ mode }: { mode: 'create' | 'edit' }) {
<Button variant="outline" onClick={goBackToList}>返回</Button> <Button variant="outline" onClick={goBackToList}>返回</Button>
<Button theme="primary" loading={saving} onClick={handleSave}>保存</Button> <Button theme="primary" loading={saving} onClick={handleSave}>保存</Button>
</div> </div>
</header> </IndependentPageHeader>
{notice ? ( {notice ? (
<div <div
...@@ -443,7 +444,7 @@ export function ChannelCodeEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -443,7 +444,7 @@ export function ChannelCodeEditorPage({ mode }: { mode: 'create' | 'edit' }) {
</div> </div>
) : null} ) : null}
<div className="rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-10"> <IndependentPageBody className="rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-10">
<div className="mx-auto grid max-w-[760px] gap-6"> <div className="mx-auto grid max-w-[760px] gap-6">
<BusinessForm <BusinessForm
fields={fields} fields={fields}
...@@ -454,7 +455,7 @@ export function ChannelCodeEditorPage({ mode }: { mode: 'create' | 'edit' }) { ...@@ -454,7 +455,7 @@ export function ChannelCodeEditorPage({ mode }: { mode: 'create' | 'edit' }) {
onChange={(nextValues) => setForm(nextValues as ChannelCodeFormState)} onChange={(nextValues) => setForm(nextValues as ChannelCodeFormState)}
/> />
</div> </div>
</div> </IndependentPageBody>
</section> </IndependentPageLayout>
); );
} }
...@@ -74,6 +74,7 @@ export function ChannelCodeViewDrawer({ open, qrcodeId, onClose }: ChannelCodeVi ...@@ -74,6 +74,7 @@ export function ChannelCodeViewDrawer({ open, qrcodeId, onClose }: ChannelCodeVi
visible={open} visible={open}
header={detail?.qrcode_name ?? '渠道活码详情'} header={detail?.qrcode_name ?? '渠道活码详情'}
closeBtn={<Button aria-label={`关闭${detail?.qrcode_name ?? '渠道活码详情'}`} icon={<CloseIcon />} shape="square" variant="text" />} closeBtn={<Button aria-label={`关闭${detail?.qrcode_name ?? '渠道活码详情'}`} icon={<CloseIcon />} shape="square" variant="text" />}
className="detail-drawer"
destroyOnClose destroyOnClose
onClose={onClose} onClose={onClose}
size="480px" size="480px"
......
import type { ReactNode } from 'react';
const rootClassName = 'flex h-full min-h-0 flex-col gap-6 overflow-hidden';
const headerClassName =
'flex shrink-0 items-center justify-between gap-6 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-6';
const bodyClassName = 'min-h-0 flex-1 overflow-y-auto';
export function IndependentPageLayout({ children }: { children: ReactNode }) {
return <section className={rootClassName}>{children}</section>;
}
export function IndependentPageHeader({ children }: { children: ReactNode }) {
return <header className={headerClassName}>{children}</header>;
}
export function IndependentPageBody({ children, className = '' }: { children: ReactNode; className?: string }) {
return <div className={`${bodyClassName} ${className}`.trim()}>{children}</div>;
}
...@@ -12,6 +12,7 @@ import { ...@@ -12,6 +12,7 @@ import {
import { getOfficialSiteTabDetail, type OfficialSiteTabDetail } from '../../api/officialSiteTab'; import { getOfficialSiteTabDetail, type OfficialSiteTabDetail } from '../../api/officialSiteTab';
import { useTrackPageView } from '../../api/tracking'; import { useTrackPageView } from '../../api/tracking';
import { useDeferredEffect } from '../../hooks/useDeferredEffect'; import { useDeferredEffect } from '../../hooks/useDeferredEffect';
import { IndependentPageBody, IndependentPageHeader, IndependentPageLayout } from '../components/IndependentPageLayout';
import { AgentDisplayConfigEditModal } from './AgentDisplayConfigEditModal'; import { AgentDisplayConfigEditModal } from './AgentDisplayConfigEditModal';
function mapAgentStatusToText(status: AgentStatus): string { function mapAgentStatusToText(status: AgentStatus): string {
...@@ -72,19 +73,19 @@ export function OfficialSiteAgentDisplayConfigPage() { ...@@ -72,19 +73,19 @@ export function OfficialSiteAgentDisplayConfigPage() {
// Loading state // Loading state
if (loading) { if (loading) {
return ( return (
<section className="grid gap-6"> <IndependentPageLayout>
<header className="sticky top-0 z-10 flex items-start justify-between gap-6 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-6"> <IndependentPageHeader>
<div aria-label="页面标题" className="min-w-0 flex-1"> <div aria-label="页面标题" className="min-w-0 flex-1">
<h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]">Agent展示配置页</h2> <h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]">Agent展示配置页</h2>
</div> </div>
<div aria-label="页面操作" className="flex shrink-0 items-center gap-2"> <div aria-label="页面操作" className="flex shrink-0 items-center gap-2">
<Button variant="outline" onClick={goBackToList}>返回</Button> <Button variant="outline" onClick={goBackToList}>返回</Button>
</div> </div>
</header> </IndependentPageHeader>
<div className="grid gap-4 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] p-6"> <IndependentPageBody className="grid gap-4 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] p-6">
<p className="text-sm text-[var(--gl-color-text-secondary)]">加载中...</p> <p className="text-sm text-[var(--gl-color-text-secondary)]">加载中...</p>
</div> </IndependentPageBody>
</section> </IndependentPageLayout>
); );
} }
...@@ -168,8 +169,8 @@ export function OfficialSiteAgentDisplayConfigPage() { ...@@ -168,8 +169,8 @@ export function OfficialSiteAgentDisplayConfigPage() {
]; ];
return ( return (
<section className="grid gap-6"> <IndependentPageLayout>
<header className="sticky top-0 z-10 flex items-start justify-between gap-6 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-6"> <IndependentPageHeader>
<div aria-label="页面标题" className="min-w-0 flex-1"> <div aria-label="页面标题" className="min-w-0 flex-1">
<h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]"> <h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]">
{tabDetail?.position_name ?? '-'} Agent展示配置页 {tabDetail?.position_name ?? '-'} Agent展示配置页
...@@ -181,70 +182,72 @@ export function OfficialSiteAgentDisplayConfigPage() { ...@@ -181,70 +182,72 @@ export function OfficialSiteAgentDisplayConfigPage() {
<div aria-label="页面操作" className="flex shrink-0 items-center gap-2"> <div aria-label="页面操作" className="flex shrink-0 items-center gap-2">
<Button variant="outline" onClick={goBackToList}>返回</Button> <Button variant="outline" onClick={goBackToList}>返回</Button>
</div> </div>
</header> </IndependentPageHeader>
{notice ? ( <IndependentPageBody className="grid gap-6">
<div {notice ? (
className={`rounded-[var(--gl-radius-sm)] border px-4 py-3 text-sm ${ <div
notice.type === 'error' className={`rounded-[var(--gl-radius-sm)] border px-4 py-3 text-sm ${
? 'border-[var(--gl-color-danger-border)] bg-[var(--gl-color-danger-bg)] text-[var(--gl-color-danger-text)]' notice.type === 'error'
: 'border-[var(--gl-color-success-border)] bg-[var(--gl-color-success-bg)] text-[var(--gl-color-success-text)]' ? 'border-[var(--gl-color-danger-border)] bg-[var(--gl-color-danger-bg)] text-[var(--gl-color-danger-text)]'
}`} : 'border-[var(--gl-color-success-border)] bg-[var(--gl-color-success-bg)] text-[var(--gl-color-success-text)]'
role={notice.type === 'error' ? 'alert' : 'status'} }`}
aria-label={notice.message} role={notice.type === 'error' ? 'alert' : 'status'}
> aria-label={notice.message}
{notice.message} >
</div> {notice.message}
) : null} </div>
) : null}
{/* Tab context info */} {/* Tab context info */}
{tabDetail ? ( {tabDetail ? (
<div className="grid gap-4 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-6"> <div className="grid gap-4 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-6">
<div className="grid gap-4 text-sm"> <div className="grid gap-4 text-sm">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="shrink-0 min-w-[80px] text-[var(--gl-color-text-secondary)]">关联渠道活码:</span> <span className="shrink-0 min-w-[80px] text-[var(--gl-color-text-secondary)]">关联渠道活码:</span>
<span>{tabDetail.qrcode_name || '-'}</span> <span>{tabDetail.qrcode_name || '-'}</span>
</div> </div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="shrink-0 min-w-[80px] text-[var(--gl-color-text-secondary)]">渠道编码:</span> <span className="shrink-0 min-w-[80px] text-[var(--gl-color-text-secondary)]">渠道编码:</span>
<span>{tabDetail.position_code || '-'}</span> <span>{tabDetail.position_code || '-'}</span>
</div> </div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="shrink-0 min-w-[80px] text-[var(--gl-color-text-secondary)]">承接员工:</span> <span className="shrink-0 min-w-[80px] text-[var(--gl-color-text-secondary)]">承接员工:</span>
<span>{tabDetail.qrcode_employee_name || '-'}</span> <span>{tabDetail.qrcode_employee_name || '-'}</span>
</div>
</div> </div>
</div> </div>
</div> ) : null}
) : null}
{/* Agent list table */} {/* Agent list table */}
<div className="grid gap-4 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] p-6"> <div className="grid gap-4 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] p-6">
<p className="text-sm text-[var(--gl-color-text-secondary)]"> <p className="text-sm text-[var(--gl-color-text-secondary)]">
Agent 数据源来自该岗位关联的渠道活码。管家 Agent 不参与官网展示。 Agent 数据源来自该岗位关联的渠道活码。管家 Agent 不参与官网展示。
Agent 列表不可增删,仅可编辑展示配置。 Agent 列表不可增删,仅可编辑展示配置。
</p> </p>
{loadError ? ( {loadError ? (
<BusinessTable <BusinessTable
rowKey="agent_id" rowKey="agent_id"
columns={columns} columns={columns}
data={items} data={items}
error error
errorState={{ errorState={{
onRetry: fetchData, onRetry: fetchData,
}} }}
/> />
) : items.length === 0 ? ( ) : items.length === 0 ? (
<div className="grid gap-4 py-10"> <div className="grid gap-4 py-10">
<StatePlaceholder state="empty" title="当前无可配置 Agent" /> <StatePlaceholder state="empty" title="当前无可配置 Agent" />
</div> </div>
) : ( ) : (
<BusinessTable <BusinessTable
rowKey="agent_id" rowKey="agent_id"
columns={columns} columns={columns}
data={items} data={items}
/> />
)} )}
</div> </div>
</IndependentPageBody>
{/* Edit modal */} {/* Edit modal */}
<AgentDisplayConfigEditModal <AgentDisplayConfigEditModal
...@@ -257,6 +260,6 @@ export function OfficialSiteAgentDisplayConfigPage() { ...@@ -257,6 +260,6 @@ export function OfficialSiteAgentDisplayConfigPage() {
fetchData(); fetchData();
}} }}
/> />
</section> </IndependentPageLayout>
); );
} }
...@@ -143,7 +143,11 @@ describe('official site agent display config routes and navigation', () => { ...@@ -143,7 +143,11 @@ describe('official site agent display config routes and navigation', () => {
expect(screen.getByRole('heading', { name: '店销顾问 Agent展示配置页' })).toBeInTheDocument(); expect(screen.getByRole('heading', { name: '店销顾问 Agent展示配置页' })).toBeInTheDocument();
}); });
const pageHeader = screen.getByRole('heading', { name: '店销顾问 Agent展示配置页' }).closest('header') as HTMLElement; const pageHeader = screen.getByRole('heading', { name: '店销顾问 Agent展示配置页' }).closest('header') as HTMLElement;
expect(pageHeader).toHaveClass('sticky', 'top-0', 'z-10'); const pageRoot = pageHeader.closest('section') as HTMLElement;
expect(pageRoot).toHaveClass('h-full', 'min-h-0', 'overflow-hidden');
expect(pageHeader).toHaveClass('shrink-0', 'bg-[var(--gl-color-bg-container)]');
expect(pageHeader).not.toHaveClass('sticky', 'top-0', 'z-10');
expect(pageRoot.querySelector('.flex-1.overflow-y-auto')).toBeInTheDocument();
expect(within(screen.getByLabelText('页面标题')).queryByRole('button')).not.toBeInTheDocument(); expect(within(screen.getByLabelText('页面标题')).queryByRole('button')).not.toBeInTheDocument();
const pageActions = screen.getByLabelText('页面操作'); const pageActions = screen.getByLabelText('页面操作');
expect(within(pageActions).getByRole('button', { name: '返回' })).toBeInTheDocument(); expect(within(pageActions).getByRole('button', { name: '返回' })).toBeInTheDocument();
......
...@@ -106,7 +106,11 @@ describe('OfficialSiteJobTabEditorPage', () => { ...@@ -106,7 +106,11 @@ describe('OfficialSiteJobTabEditorPage', () => {
renderApp('/official-site/job-tabs/new'); renderApp('/official-site/job-tabs/new');
expect(await screen.findByRole('heading', { name: '新建岗位展示' })).toBeInTheDocument(); expect(await screen.findByRole('heading', { name: '新建岗位展示' })).toBeInTheDocument();
const pageHeader = screen.getByRole('heading', { name: '新建岗位展示' }).closest('header') as HTMLElement; const pageHeader = screen.getByRole('heading', { name: '新建岗位展示' }).closest('header') as HTMLElement;
expect(pageHeader).toHaveClass('sticky', 'top-0', 'z-10'); const pageRoot = pageHeader.closest('section') as HTMLElement;
expect(pageRoot).toHaveClass('h-full', 'min-h-0', 'overflow-hidden');
expect(pageHeader).toHaveClass('shrink-0', 'bg-[var(--gl-color-bg-container)]');
expect(pageHeader).not.toHaveClass('sticky', 'top-0', 'z-10');
expect(pageRoot.querySelector('.flex-1.overflow-y-auto')).toBeInTheDocument();
expect(within(screen.getByLabelText('页面标题')).queryByRole('button')).not.toBeInTheDocument(); expect(within(screen.getByLabelText('页面标题')).queryByRole('button')).not.toBeInTheDocument();
const pageActions = screen.getByLabelText('页面操作'); const pageActions = screen.getByLabelText('页面操作');
expect(within(pageActions).getByRole('button', { name: '返回' })).toBeInTheDocument(); expect(within(pageActions).getByRole('button', { name: '返回' })).toBeInTheDocument();
...@@ -208,7 +212,7 @@ describe('OfficialSiteJobTabEditorPage', () => { ...@@ -208,7 +212,7 @@ describe('OfficialSiteJobTabEditorPage', () => {
}); });
}); });
it('returns from the sticky page header back to list', async () => { it('returns from the page header back to list', async () => {
renderApp('/official-site/job-tabs/new'); renderApp('/official-site/job-tabs/new');
const pageHeader = (await screen.findByRole('heading', { name: '新建岗位展示' })).closest('header') as HTMLElement; const pageHeader = (await screen.findByRole('heading', { name: '新建岗位展示' })).closest('header') as HTMLElement;
fireEvent.click(within(pageHeader).getByRole('button', { name: '返回' })); fireEvent.click(within(pageHeader).getByRole('button', { name: '返回' }));
......
...@@ -22,6 +22,7 @@ import { ...@@ -22,6 +22,7 @@ import {
type OfficialSiteTabStatus, type OfficialSiteTabStatus,
} from '../../api/officialSiteTab'; } from '../../api/officialSiteTab';
import { useDeferredEffect } from '../../hooks/useDeferredEffect'; import { useDeferredEffect } from '../../hooks/useDeferredEffect';
import { IndependentPageBody, IndependentPageHeader, IndependentPageLayout } from '../components/IndependentPageLayout';
import { buildOfficialSiteJobTabListSearch, readOfficialSiteJobTabListRouteState } from './officialSiteJobTabRouteState'; import { buildOfficialSiteJobTabListSearch, readOfficialSiteJobTabListRouteState } from './officialSiteJobTabRouteState';
interface TabFormState extends BusinessFormValues { interface TabFormState extends BusinessFormValues {
...@@ -379,8 +380,8 @@ export function OfficialSiteJobTabEditorPage({ mode }: { mode: 'create' | 'edit' ...@@ -379,8 +380,8 @@ export function OfficialSiteJobTabEditorPage({ mode }: { mode: 'create' | 'edit'
}; };
return ( return (
<section className="grid gap-6"> <IndependentPageLayout>
<header className="sticky top-0 z-10 flex items-start justify-between gap-6 rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-6"> <IndependentPageHeader>
<div aria-label="页面标题" className="min-w-0 flex-1"> <div aria-label="页面标题" className="min-w-0 flex-1">
<h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]"> <h2 className="m-0 text-2xl leading-[var(--gl-line-height-xl)]">
{mode === 'create' ? '新建岗位展示' : '编辑岗位展示'} {mode === 'create' ? '新建岗位展示' : '编辑岗位展示'}
...@@ -393,7 +394,7 @@ export function OfficialSiteJobTabEditorPage({ mode }: { mode: 'create' | 'edit' ...@@ -393,7 +394,7 @@ export function OfficialSiteJobTabEditorPage({ mode }: { mode: 'create' | 'edit'
<Button variant="outline" onClick={goBackToList}>返回</Button> <Button variant="outline" onClick={goBackToList}>返回</Button>
<Button theme="primary" loading={saving} onClick={handleSave}>保存</Button> <Button theme="primary" loading={saving} onClick={handleSave}>保存</Button>
</div> </div>
</header> </IndependentPageHeader>
{notice ? ( {notice ? (
<div <div
...@@ -409,7 +410,7 @@ export function OfficialSiteJobTabEditorPage({ mode }: { mode: 'create' | 'edit' ...@@ -409,7 +410,7 @@ export function OfficialSiteJobTabEditorPage({ mode }: { mode: 'create' | 'edit'
</div> </div>
) : null} ) : null}
<div className="rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-10"> <IndependentPageBody className="rounded-[var(--gl-radius-md)] border border-[var(--gl-color-border-secondary)] bg-[var(--gl-color-bg-container)] px-8 py-10">
<div className="mx-auto grid max-w-[760px] gap-6"> <div className="mx-auto grid max-w-[760px] gap-6">
<h3 className="m-0 text-base font-medium leading-[var(--gl-line-height-lg)]">{sectionTitle}</h3> <h3 className="m-0 text-base font-medium leading-[var(--gl-line-height-lg)]">{sectionTitle}</h3>
<BusinessForm <BusinessForm
...@@ -421,7 +422,7 @@ export function OfficialSiteJobTabEditorPage({ mode }: { mode: 'create' | 'edit' ...@@ -421,7 +422,7 @@ export function OfficialSiteJobTabEditorPage({ mode }: { mode: 'create' | 'edit'
onChange={(nextValues) => setForm(nextValues as TabFormState)} onChange={(nextValues) => setForm(nextValues as TabFormState)}
/> />
</div> </div>
</div> </IndependentPageBody>
</section> </IndependentPageLayout>
); );
} }
...@@ -44,6 +44,7 @@ export function SkillDetailDrawer({ routeState, skillCode }: { routeState: Skill ...@@ -44,6 +44,7 @@ export function SkillDetailDrawer({ routeState, skillCode }: { routeState: Skill
visible visible
header="Skill详情" header="Skill详情"
size="560px" size="560px"
className="detail-drawer"
destroyOnClose destroyOnClose
closeBtn={<Button aria-label="关闭Skill详情" icon={<CloseIcon />} shape="square" variant="text" />} closeBtn={<Button aria-label="关闭Skill详情" icon={<CloseIcon />} shape="square" variant="text" />}
onClose={closeDrawer} onClose={closeDrawer}
......
@import './tokens.css'; @import './tokens.css';
@import './reset.css'; @import './reset.css';
.detail-drawer .t-drawer__body {
padding-left: 20px;
padding-right: 20px;
}
@tailwind utilities; @tailwind utilities;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!