Files
Mdeical_Sur_Report/工程分析/需求分析-2026-04-18-22-59-10.md

33 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 需求分析 —— 2026-04-18-22-59-10
## 需求来源
用户希望调整字段默认下划线行为,并修复占位符文字居中的样式问题。
## 需求概述
### 需求 1所有字段默认打印时不显示下划线
当前字段管理中,新增字段的「打印时显示下划线」复选框默认勾选(`hasUnderline` 默认为 `true`)。用户希望改为默认不勾选,即所有现有字段和新增字段在打印时默认不显示下划线。
具体改动点:
- `newFieldHasUnderline` 状态默认值从 `true` 改为 `false`
- 编辑字段回显时,`hasUnderline` 回退值从 `true` 改为 `false`
- `insertSmartField` 中类名判断逻辑改为:只要 `hasUnderline !== true` 就加 `.no-underline`
- `defaultContent.ts``smartField()` 直接给所有字段加 `.no-underline`
### 需求 2修复删除图片后占位符文字偏左
删除图片后,占位符恢复为默认状态,但提示文字(如「插入/点击放置图片」)在虚线框内偏左,未真正居中。
原因分析:虽然使用了 `position:absolute + transform:translate(-50%, -50%)`,但 `placeholder-text``display:block; width:100%` 的块级元素,其内部文本流默认 `text-align:left`,导致文字靠左。
修复方案:在所有 `.placeholder-text` 的 style 中追加 `text-align:center;`
## 涉及文件
- `src/pages/TemplateManage.tsx`(需求 1、2
- `src/utils/defaultContent.ts`(需求 1、2
- `src/pages/ReportEditor.tsx`(需求 2
## 需求影响范围
- 字段管理的默认值和插入逻辑
- 默认模板中所有 smartField 的下划线行为
- 所有图片占位符的提示文字对齐方式