From 1937cf48a1790d16f13980919459d89f9480c593 Mon Sep 17 00:00:00 2001 From: Ycc Date: Wed, 27 Aug 2025 13:53:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E4=B8=8D=E6=98=AF=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=98=BE=E7=A4=BA=E4=B8=8B=E8=BD=BD=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ImageUploader.jsx | 76 +++++++++----------------------- 1 file changed, 22 insertions(+), 54 deletions(-) diff --git a/src/components/ImageUploader.jsx b/src/components/ImageUploader.jsx index 433c8e1..2c8067c 100644 --- a/src/components/ImageUploader.jsx +++ b/src/components/ImageUploader.jsx @@ -1,7 +1,6 @@ import { useEffect, useState } from "react"; -import { Upload, List, Popconfirm } from "antd"; - -import { UploadOutlined, DeleteOutlined } from "@ant-design/icons"; +import { Upload, List, Button, Space } from "antd"; +import { UploadOutlined, FileTextOutlined } from "@ant-design/icons"; import { Image } from "antd"; import { fetchJSON } from "@/utils/request"; import { HT3_HOST } from "@/config"; @@ -109,7 +108,6 @@ export const ImageUploader = props => { }, [key]); // 处理删除操作 - const handleDelete = async file => { const success = await deleteImage(file.encrypt_key); if (success) { @@ -118,9 +116,9 @@ export const ImageUploader = props => { props.onChange(newImages); } setFileList(newImages); - //console.log("删除成功"); + console.log("删除成功"); } else { - //console.error("删除失败"); + console.error("删除失败"); } }; @@ -166,42 +164,12 @@ export const ImageUploader = props => { setPreviewOpen(true); }; - const handleRemove = () => { - return false; - }; - return ( <> - { - return ( - { - handleDelete(file); - }} - onCancel={() => setFileList([...fileList])} - okText="是" - cancelText="否"> - - - ); - }, - }}> +
-
上传图片
+
Upload
@@ -242,22 +210,22 @@ export const ImageViewer = props => { return ( <> - { - return ( - - - - ); - }} - /> + + + {fileList && + fileList.map(item => { + return item.key.match(/\.(jpg|jpeg|png|gif|bmp|webp)$/i) ? ( + + ) : ( + + + + ); + })} + + ); };