From 611da354a1ab071f636f992a4bdcae930e356f9b Mon Sep 17 00:00:00 2001 From: xingyu Date: Wed, 10 May 2023 15:45:48 +0800 Subject: [PATCH] feat: file upload --- src/components/Form/src/componentMap.ts | 2 + .../Form/src/components/FileUpload.vue | 370 ++++++++++++++++++ .../Form/src/components/UploadItemActions.vue | 90 +++++ src/components/Form/src/types/index.ts | 1 + src/views/system/oauth2/client/client.data.ts | 7 +- 5 files changed, 468 insertions(+), 2 deletions(-) create mode 100644 src/components/Form/src/components/FileUpload.vue create mode 100644 src/components/Form/src/components/UploadItemActions.vue diff --git a/src/components/Form/src/componentMap.ts b/src/components/Form/src/componentMap.ts index 8aa73996..b1309dac 100644 --- a/src/components/Form/src/componentMap.ts +++ b/src/components/Form/src/componentMap.ts @@ -33,6 +33,7 @@ import { StrengthMeter } from '@/components/StrengthMeter' import { IconPicker } from '@/components/Icon' import { CountdownInput } from '@/components/CountDown' import { Tinymce } from '@/components/Tinymce' +import FileUpload from './components/FileUpload.vue' const componentMap = new Map() @@ -71,6 +72,7 @@ componentMap.set('IconPicker', IconPicker) componentMap.set('InputCountDown', CountdownInput) componentMap.set('Upload', BasicUpload) +componentMap.set('FileUpload', FileUpload) componentMap.set('Divider', Divider) componentMap.set('Editor', Tinymce) diff --git a/src/components/Form/src/components/FileUpload.vue b/src/components/Form/src/components/FileUpload.vue new file mode 100644 index 00000000..5303bd8e --- /dev/null +++ b/src/components/Form/src/components/FileUpload.vue @@ -0,0 +1,370 @@ + + + + + diff --git a/src/components/Form/src/components/UploadItemActions.vue b/src/components/Form/src/components/UploadItemActions.vue new file mode 100644 index 00000000..a4536628 --- /dev/null +++ b/src/components/Form/src/components/UploadItemActions.vue @@ -0,0 +1,90 @@ + + + diff --git a/src/components/Form/src/types/index.ts b/src/components/Form/src/types/index.ts index 925b157e..ad36ebf9 100644 --- a/src/components/Form/src/types/index.ts +++ b/src/components/Form/src/types/index.ts @@ -116,3 +116,4 @@ export type ComponentType = | 'Divider' | 'ApiTransfer' | 'Editor' + | 'FileUpload' diff --git a/src/views/system/oauth2/client/client.data.ts b/src/views/system/oauth2/client/client.data.ts index 7eabaec8..68a7fd40 100644 --- a/src/views/system/oauth2/client/client.data.ts +++ b/src/views/system/oauth2/client/client.data.ts @@ -110,12 +110,15 @@ export const formSchema: FormSchema[] = [ required: true, component: 'Input' }, - // TODO UPLOAD { label: '应用图标', field: 'logo', required: true, - component: 'Input' + component: 'FileUpload', + componentProps: { + fileType: 'image', + maxCount: 1 + } }, { label: '应用描述',