From 6f421c7bd6fc0ced71e9e58ba18852fa2306c41f Mon Sep 17 00:00:00 2001 From: wangziqi Date: Mon, 10 Aug 2026 17:29:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E9=99=84=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=94=B9=E4=B8=BA=E6=8B=96=E6=8B=BD=E5=B9=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=A4=A7=E5=B0=8F/=E6=A0=BC=E5=BC=8F=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StudentProfileContent/AttachmentsTab.tsx | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/apps/admin/src/components/StudentProfileContent/AttachmentsTab.tsx b/apps/admin/src/components/StudentProfileContent/AttachmentsTab.tsx index b9ae266f..86487e78 100644 --- a/apps/admin/src/components/StudentProfileContent/AttachmentsTab.tsx +++ b/apps/admin/src/components/StudentProfileContent/AttachmentsTab.tsx @@ -1,7 +1,7 @@ import React, { useRef, useState } from 'react'; import { App, Button, Modal, Popconfirm, Space, Table, Upload } from 'antd'; import type { ColumnsType } from 'antd/es/table'; -import { EyeOutlined, InboxOutlined, UploadOutlined } from '@ant-design/icons'; +import { EyeOutlined, InboxOutlined } from '@ant-design/icons'; import api from '../../api'; import { message } from '../../ui/app-message'; import { useApiMutation } from '../../hooks/useApiMutation'; @@ -145,8 +145,16 @@ export const AttachmentsTab: React.FC = return (
{hasPermission('student:edit') ? ( - { + if (file.size > 2 * 1024 * 1024) { + message.error('文件大小不能超过 2MB'); + return Upload.LIST_IGNORE; + } + return true; + }} customRequest={async (options) => { const formData = new FormData(); formData.append( @@ -166,11 +174,14 @@ export const AttachmentsTab: React.FC = setUploading(false); } }} + style={{ marginBottom: 16 }} > - - +

+ +

+

{uploading ? '上传中…' : '点击或拖拽文件到此区域上传'}

+

支持图片 / PDF / Word / Excel 等格式,单个文件不超过 2MB

+ ) : null} scroll={{ x: 'max-content' }} columns={columns}