Browse Source

fix: 修复体位卡片高度不一致和文本显示问题

- 固定图片高度为 100px,确保所有卡片高度一致
- 添加文本省略样式(overflow, textOverflow, whiteSpace),防止文本过长时换行
- 引入 Ant Design Tooltip 组件,鼠标悬停时显示完整体位名称
- 确保所有体位卡片保持统一高度,提升界面整齐度

改动文件:
- src/pages/patient/components/register.available.view.list.tsx
- CHANGELOG.md
- package.json (版本更新: 1.12.1 -> 1.12.2)
dengdx 3 tuần trước cách đây
mục cha
commit
23ff3098eb
3 tập tin đã thay đổi với 40 bổ sung6 xóa
  1. 28 0
      CHANGELOG.md
  2. 1 1
      package.json
  3. 11 5
      src/pages/patient/components/register.available.view.list.tsx

+ 28 - 0
CHANGELOG.md

@@ -2,6 +2,34 @@
 
 本项目的所有重要变更都将记录在此文件中。
 
+## [1.12.2] - 2025-12-18 09:54
+
+### 修复 (Fixed)
+- **体位卡片高度不一致和文本显示问题** ([src/pages/patient/components/register.available.view.list.tsx](src/pages/patient/components/register.available.view.list.tsx))
+  - 修复图片大小不同导致卡片高度不一致的问题
+  - 将图片尺寸从响应式(100% / auto)改为固定尺寸(100px / 100px)
+  - 添加文本省略样式(overflow: hidden, textOverflow: ellipsis, whiteSpace: nowrap)
+  - 引入 Ant Design Tooltip 组件,鼠标悬停时显示完整的体位名称
+  - 确保所有体位卡片保持统一高度,提升界面整齐度
+
+**核心改进:**
+- 布局优化:固定图片高度确保所有卡片高度一致
+- 文本处理:过长文本显示省略号,不换行撑开卡片
+- 用户体验:Tooltip 悬停提示显示完整文本内容
+- 视觉统一:所有体位卡片整齐排列,界面更加美观
+
+**技术实现:**
+- 添加 Tooltip 组件到 antd 导入列表
+- 修改 Image 组件样式:width: '100px', height: '100px'
+- 为文本 div 添加省略号样式
+- 使用 Tooltip 包裹文本 div,title 属性设为完整文本
+
+**改动文件:**
+- src/pages/patient/components/register.available.view.list.tsx
+- package.json (版本更新: 1.12.1 -> 1.12.2)
+
+---
+
 ## [1.12.1] - 2025-12-18 09:48
 
 ### 修复 (Fixed)

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "zsis",
-  "version": "1.12.1",
+  "version": "1.12.2",
   "private": true,
   "description": "医学成像系统",
   "main": "main.js",

+ 11 - 5
src/pages/patient/components/register.available.view.list.tsx

@@ -1,6 +1,6 @@
 import React from 'react';
 import { useSelector, useDispatch } from 'react-redux';
-import { Card, Row, Col, Empty, Image } from 'antd';
+import { Card, Row, Col, Empty, Image, Tooltip } from 'antd';
 import { getViewIconUrl } from '@/API/bodyPosition';
 
 import type { RootState } from '@/states/store'; // 假设RootState已定义
@@ -41,12 +41,18 @@ const RegisterViewList: React.FC = () => {
                   view.view_icon_name || view.view_coach_name
                 )}
                 style={{
-                  width: '100%',
-                  height: 'auto',
-                  objectFit: 'cover',
+                  width: '100px',
+                  height: '100px',
+                  //objectFit: 'cover',
                 }}
               />
-              <div>{view.view_name_local}</div>
+              <Tooltip title={view.view_name_local}>
+                <div style={{
+                  overflow: 'hidden',
+                  textOverflow: 'ellipsis',
+                  whiteSpace: 'nowrap'
+                }}>{view.view_name_local}</div>
+              </Tooltip>
               {/* 可根据需要展示更多字段 */}
             </Card>
           </Col>