style(web): AI 工作台附件卡片样式与交互适配

- personal-workbench-ai-mode.css 新增 workbench-ai-file-card 系列样式,file-strip 改为 flex-wrap 左对齐排布卡片,移除按钮样式随卡片重构
- workbench-ai-mode-switch 测试补充附件卡片相关断言
This commit is contained in:
caoxiaozhu
2026-06-21 23:24:36 +08:00
parent d660a961fb
commit 08a4fa3577
2 changed files with 113 additions and 12 deletions

View File

@@ -214,7 +214,7 @@
.workbench-ai-icon-btn,
.workbench-ai-send-btn,
.workbench-ai-action,
.workbench-ai-file-strip button {
.workbench-ai-file-card__remove {
border: 0;
cursor: pointer;
transition:
@@ -294,7 +294,7 @@
}
.workbench-ai-action:hover,
.workbench-ai-file-strip button:hover {
.workbench-ai-file-card__remove:hover {
transform: translateY(-1px);
border-color: rgba(47, 124, 255, 0.1);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
@@ -456,9 +456,10 @@
.workbench-ai-file-strip {
width: min(980px, 100%);
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 12px;
justify-content: flex-start;
gap: 10px;
color: var(--ai-muted);
font-size: 13px;
font-weight: 700;
@@ -466,15 +467,100 @@
animation-delay: 340ms;
}
.workbench-ai-file-strip button {
min-height: 30px;
padding: 0 12px;
border: 1px solid rgba(47, 124, 255, 0.18);
border-radius: 8px;
background: rgba(255, 255, 255, 0.82);
color: var(--ai-blue);
font-size: 13px;
.workbench-ai-file-card {
flex: 0 1 312px;
min-width: 238px;
min-height: 64px;
display: grid;
grid-template-columns: 48px minmax(0, 1fr) 30px;
align-items: center;
gap: 12px;
padding: 10px 10px 10px 12px;
border: 1px solid rgba(203, 213, 225, 0.76);
border-radius: 16px;
background:
linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9));
box-shadow:
0 10px 28px rgba(15, 23, 42, 0.06),
inset 0 1px 0 rgba(255, 255, 255, 0.94);
}
.workbench-ai-file-card__icon {
width: 48px;
height: 48px;
display: inline-grid;
place-items: center;
border-radius: 13px;
background: #111827;
color: #ff6b6b;
font-size: 24px;
line-height: 1;
}
.workbench-ai-file-card__icon.type-image {
color: #38bdf8;
}
.workbench-ai-file-card__icon.type-spreadsheet {
color: #34d399;
}
.workbench-ai-file-card__icon.type-document {
color: #93c5fd;
}
.workbench-ai-file-card__icon.type-archive,
.workbench-ai-file-card__icon.type-file {
color: #c4b5fd;
}
.workbench-ai-file-card__body {
min-width: 0;
display: grid;
gap: 4px;
}
.workbench-ai-file-card__body strong,
.workbench-ai-file-card__body small {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.workbench-ai-file-card__body strong {
color: #1e293b;
font-size: 15px;
font-weight: 800;
line-height: 1.25;
}
.workbench-ai-file-card__body small {
color: #7b8799;
font-size: 13px;
font-weight: 760;
letter-spacing: 0;
}
.workbench-ai-file-card__remove {
width: 30px;
height: 30px;
display: inline-grid;
place-items: center;
align-self: start;
border: 1px solid rgba(203, 213, 225, 0.72);
border-radius: 999px;
background: #ffffff;
color: #475569;
font-size: 18px;
line-height: 1;
}
.workbench-ai-file-card__remove:disabled {
cursor: not-allowed;
opacity: 0.48;
transform: none;
box-shadow: none;
}
.workbench-ai-quick-start-section {

View File

@@ -163,6 +163,8 @@ const orbRule = readRuleBody(aiModeStyles, '.workbench-ai-orb')
const orbImageRule = readRuleBody(aiModeStyles, '.workbench-ai-orb__image')
const composerRule = readRuleBody(aiModeStyles, '.workbench-ai-composer')
const composerTextareaRule = readRuleBody(aiModeStyles, '.workbench-ai-composer textarea')
const fileStripRule = readRuleBody(aiModeStyles, '.workbench-ai-file-strip')
const fileCardRule = readRuleBody(aiModeStyles, '.workbench-ai-file-card')
const orbIconAsset = fileURLToPath(
new URL('../src/assets/workbench-ai-mode-orb-icon.gif', import.meta.url)
)
@@ -218,6 +220,13 @@ test('AI mode screen follows the approved reference structure', () => {
assert.match(aiMode, /费用测算中,请稍等/)
assert.match(aiMode, /rows="3"/)
assert.match(aiMode, /workbench-ai-composer-toolbar/)
assert.match(aiMode, /<article v-for="file in selectedFileCards"[\s\S]*class="workbench-ai-file-card"/)
assert.match(aiMode, /:aria-label="`移除附件 \$\{file\.name\}`"/)
assert.match(aiMode, /function removeAiModeFile\(fileKey\)/)
assert.match(aiMode, /const selectedFileCards = computed/)
assert.match(aiMode, /resolveAiComposerFileType\(file\)/)
assert.match(aiMode, /AI_COMPOSER_FILE_TYPE_META = \{[\s\S]*pdf:\s*\{ label:\s*'PDF'/)
assert.doesNotMatch(aiMode, /已选择 \{\{ selectedFiles\.length \}\} 份附件/)
assert.match(aiMode, /Axiom Ultra 3\.1/)
assert.match(aiMode, /mdi mdi-calendar-range/)
assert.match(aiMode, /workbench-ai-date-popover/)
@@ -324,6 +333,12 @@ test('AI mode screen follows the approved reference structure', () => {
assert.match(aiModeStyles, /\.workbench-ai-mode\s*\{[\s\S]*min-height:\s*100%;[\s\S]*background:/)
assert.match(aiModeStyles, /\.workbench-ai-mode\.has-conversation\s*\{[\s\S]*place-items:\s*stretch;[\s\S]*padding:\s*0;/)
assert.match(aiModeStyles, /\.workbench-ai-composer\s*\{[\s\S]*border-radius:\s*20px;[\s\S]*box-shadow:/)
assert.match(fileStripRule, /flex-wrap:\s*wrap;/)
assert.match(fileStripRule, /justify-content:\s*flex-start;/)
assert.match(fileCardRule, /grid-template-columns:\s*48px minmax\(0,\s*1fr\) 30px;/)
assert.match(fileCardRule, /border-radius:\s*16px;/)
assert.match(aiModeStyles, /\.workbench-ai-file-card__body strong,[\s\S]*\.workbench-ai-file-card__body small\s*\{[\s\S]*text-overflow:\s*ellipsis;/)
assert.match(aiModeStyles, /\.workbench-ai-file-card__remove\s*\{[\s\S]*border-radius:\s*999px;/)
assert.match(composerRule, /min-height:\s*154px;/)
assert.match(composerRule, /grid-template-rows:\s*minmax\(80px,\s*1fr\) auto;/)
assert.match(composerTextareaRule, /min-height:\s*80px;/)