fix: resolve antd to do

This commit is contained in:
dylanmay
2025-11-28 15:39:39 +08:00
parent 7d9285de96
commit ffc48fa171
11 changed files with 56 additions and 50 deletions

View File

@@ -0,0 +1,46 @@
import type { UploadProps } from 'ant-design-vue';
import type { UploadRawFile } from '#/views/mp/hooks/useUpload';
import { useAccessStore } from '@vben/stores';
import { UploadType, useBeforeUpload } from '#/views/mp/hooks/useUpload';
const accessStore = useAccessStore();
const HEADERS = { Authorization: `Bearer ${accessStore.accessToken}` }; // 请求头
const UPLOAD_URL = `${import.meta.env.VITE_BASE_URL}/admin-api/mp/material/upload-permanent`; // 上传地址
interface UploadData {
accountId: number;
introduction: string;
title: string;
type: UploadType;
}
const beforeImageUpload: UploadProps['beforeUpload'] = function (
rawFile: UploadRawFile,
) {
return useBeforeUpload(UploadType.Image, 2)(rawFile);
};
const beforeVoiceUpload: UploadProps['beforeUpload'] = function (
rawFile: UploadRawFile,
) {
return useBeforeUpload(UploadType.Voice, 2)(rawFile);
};
const beforeVideoUpload: UploadProps['beforeUpload'] = function (
rawFile: UploadRawFile,
) {
return useBeforeUpload(UploadType.Video, 10)(rawFile);
};
export {
beforeImageUpload,
beforeVideoUpload,
beforeVoiceUpload,
HEADERS,
UPLOAD_URL,
type UploadData,
UploadType,
};