From e74b631e0687a38f8163943cc84a8cd76a970c98 Mon Sep 17 00:00:00 2001
From: hongjli <3117313295@qq.com>
Date: 星期三, 09 四月 2025 16:14:12 +0800
Subject: [PATCH] 数据演示对话框
---
src/components/DataPreviewDialog.tsx | 24 +++++++++++++++++++-----
src/app/ai-scene/page.tsx | 6 +++---
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/src/app/ai-scene/page.tsx b/src/app/ai-scene/page.tsx
index 98efab7..c39a22c 100644
--- a/src/app/ai-scene/page.tsx
+++ b/src/app/ai-scene/page.tsx
@@ -18,7 +18,7 @@
### 宸ヤ綅淇℃伅
| 宸ヤ綅 | 鍘熸潗鏂欓渶姹� | 鍘熸潗鏂欐秷鑰楅�熺巼 | 鐢熶骇鐨勪骇鍝� | 浜х嚎鍚� |
-|------|------------|----------------|------------|--------|
+| :--: | :--: | :--: | :--: | :--: |
| 1 | A1 | 2/灏忔椂 | P | 浜х嚎1 |
| 2 | A2 | 1/灏忔椂 | P | 浜х嚎1 |
| 3 | A3 | 2/灏忔椂 | P | 浜х嚎1 |
@@ -32,7 +32,7 @@
### 浜х嚎鐜板満搴撳瓨閲�
| 鍘熸潗鏂� | 鏁伴噺 | 浜х嚎鍚� |
-|--------|------|--------|
+| :--: | :--: | :--: |
| A1 | 10 | 浜х嚎1 |
| A2 | 10 | 浜х嚎1 |
| A3 | 10 | 浜х嚎1 |
@@ -46,7 +46,7 @@
### 鍘熸潗鏂欏簱瀛�
| 鍘熸潗鏂� | 搴撲綅 | 鏁伴噺 |
-|--------|------|------|
+| :--: | :--: | :--: |
| A1 | 3-2 | 100 |
| A2 | 3-1 | 100 |
| A3 | 1-1 | 100 |
diff --git a/src/components/DataPreviewDialog.tsx b/src/components/DataPreviewDialog.tsx
index b7bb47d..ebbba51 100644
--- a/src/components/DataPreviewDialog.tsx
+++ b/src/components/DataPreviewDialog.tsx
@@ -62,7 +62,7 @@
</Dialog.Title>
<button
onClick={onClose}
- className="text-gray-500 hover:text-gray-700 transition-colors duration-300"
+ className="text-gray-500 hover:text-gray-700 transition-colors duration-300 cursor-pointer"
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
@@ -85,11 +85,25 @@
thead: ({ node, ...props }) => (
<thead className="bg-gray-50" {...props} />
),
- th: ({ node, ...props }) => (
- <th className="px-4 py-3 text-left text-sm font-semibold text-gray-700" {...props} />
- ),
+ th: ({ node, children, ...props }) => {
+ // 鏍规嵁琛ㄥご鍐呭鍔ㄦ�佽皟鏁村搴�
+ let className = "px-4 py-3 text-center text-sm font-semibold text-gray-700";
+
+ if (typeof children === 'string') {
+ // 鏍规嵁琛ㄥご鍐呭璁剧疆鍚堥�傜殑瀹藉害绫�
+ if (children === '宸ヤ綅' || children === '鏁伴噺' || children === '搴撲綅') {
+ className += " w-[15%]";
+ } else if (children === '鍘熸潗鏂�' || children === '鍘熸潗鏂欓渶姹�' || children === '浜х嚎鍚�') {
+ className += " w-[20%]";
+ } else if (children === '鍘熸潗鏂欐秷鑰楅�熺巼' || children === '鐢熶骇鐨勪骇鍝�') {
+ className += " w-[25%]";
+ }
+ }
+
+ return <th className={className} {...props}>{children}</th>;
+ },
td: ({ node, ...props }) => (
- <td className="px-4 py-3 text-sm text-gray-600 border-t border-gray-200" {...props} />
+ <td className="px-4 py-3 text-sm text-gray-600 border-t border-gray-200 text-center whitespace-nowrap" {...props} />
),
tr: ({ node, ...props }) => (
<tr className="hover:bg-gray-50 transition-colors duration-150" {...props} />
--
Gitblit v1.9.3