This commit is contained in:
熊潇 2025-06-10 21:58:37 +08:00
parent e8867fc379
commit f6979c6d33

View File

@ -12,6 +12,7 @@ import { toast } from 'react-toastify';
import { hashFile } from '../../modules/hash-file'; import { hashFile } from '../../modules/hash-file';
import { uploadChunkV2 } from '../../modules/upload'; import { uploadChunkV2 } from '../../modules/upload';
import { downloadFile, toFile } from '../../modules/to-file'; import { downloadFile, toFile } from '../../modules/to-file';
import dayjs from 'dayjs';
type ImageResource = {}; type ImageResource = {};
export const ImagesResources = (props: ImageResource) => { export const ImagesResources = (props: ImageResource) => {
@ -207,9 +208,11 @@ export const Core = ({ onClose, id }: CoreProps) => {
for (const file of files) { for (const file of files) {
if (file.dataURL.startsWith('data')) { if (file.dataURL.startsWith('data')) {
const _file = toFile(file.dataURL, file.id); const _file = toFile(file.dataURL, file.id);
const day = dayjs().format('YYYY-MM');
const directory = `excalidraw/${day}/${id}`;
const res = (await uploadChunkV2(_file, { const res = (await uploadChunkV2(_file, {
filename: file.id, filename: file.id,
directory: id, directory: directory,
})) as any; })) as any;
if (res.code === 200) { if (res.code === 200) {
toast.success('上传图片成功'); toast.success('上传图片成功');