fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useState, useEffect, useMemo } from 'react';
|
||||
import { supabase } from '@/config/supabase';
|
||||
import { Card, Upload, Button, message, List, Switch, Space, Input, Select, Tag, Pagination, Modal, Image } from 'antd';
|
||||
import { Upload, Button, message, List, Switch, Space, Input, Tag, Pagination, Modal, Image, Popconfirm } from 'antd';
|
||||
import { UploadOutlined, FileTextOutlined, FileImageOutlined,
|
||||
FileMarkdownOutlined, FilePdfOutlined, FileWordOutlined,
|
||||
FileExcelOutlined, InboxOutlined, SearchOutlined, EditOutlined } from '@ant-design/icons';
|
||||
@@ -65,9 +65,8 @@ const StorageManager = () => {
|
||||
const { data, error } = await supabase.storage
|
||||
.from('file')
|
||||
.list('', {
|
||||
sortBy: { column: 'created_at', order: 'desc' }
|
||||
sortBy: { column: 'created_at', order: 'desc' } // 按创建时间倒序
|
||||
});
|
||||
|
||||
if (error) throw error;
|
||||
setAllFiles(data || []);
|
||||
} catch (error) {
|
||||
@@ -299,7 +298,7 @@ const handleDelete = async (fileName) => {
|
||||
<p className="ant-upload-drag-icon">
|
||||
<InboxOutlined />
|
||||
</p>
|
||||
<p className="ant-upload-text">点击<EFBFBD><EFBFBD>拖拽文件到此区域上传</p>
|
||||
<p className="ant-upload-text">点击或者拖拽文件到此区域上传</p>
|
||||
<p className="ant-upload-hint text-xs text-gray-500">
|
||||
支持单个或批量上传,文件大小不超过50MB
|
||||
</p>
|
||||
@@ -348,17 +347,25 @@ const handleDelete = async (fileName) => {
|
||||
}`}
|
||||
onClick={() => previewFile(file)}
|
||||
actions={[
|
||||
<Button
|
||||
key="delete"
|
||||
type="text"
|
||||
danger
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
<Popconfirm
|
||||
key="delete"
|
||||
title="确认删除"
|
||||
description={`是否确认删除文件 "${file.name}"?`}
|
||||
onConfirm={(e) => {
|
||||
e?.stopPropagation();
|
||||
handleDelete(file.name);
|
||||
}}
|
||||
okText="确认"
|
||||
cancelText="取消"
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
danger
|
||||
onClick={e => e.stopPropagation()}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
]}
|
||||
>
|
||||
<List.Item.Meta
|
||||
@@ -393,7 +400,7 @@ const handleDelete = async (fileName) => {
|
||||
)}
|
||||
/>
|
||||
|
||||
{/* 分页器 - 只在非搜索状态下显示 */}
|
||||
{/* 分页器 - 只<EFBFBD><EFBFBD>非搜索状态下显示 */}
|
||||
{!searchText && (
|
||||
<div className="mt-4 flex justify-center">
|
||||
<Pagination
|
||||
|
||||
Reference in New Issue
Block a user