diff --git a/src/components/DesignForm/formControlAttr.vue b/src/components/DesignForm/formControlAttr.vue index 4017f024a..1e3ef2427 100644 --- a/src/components/DesignForm/formControlAttr.vue +++ b/src/components/DesignForm/formControlAttr.vue @@ -24,6 +24,8 @@ //样式布局 import LayoutPage from '@/components/DesignForm/layoutPage/index.vue' + + import { Plus } from '@element-plus/icons-vue' const props = withDefaults( //接收父级参数 @@ -1547,6 +1549,34 @@ } return false; } +/** +@ 作者: 秦东 +@ 时间: 2024-03-18 11:42:52 +@ 功能: 上传图标相关 +*/ +const imgUploadApiUrl = import.meta.env.VITE_APP_BASE_API+"/api/upordown" //上传地址 +const handleAvatarSuccess: UploadProps['onSuccess'] = ( + response, + uploadFile +) => { +// imageUrl.value = URL.createObjectURL(uploadFile.raw!) +formConfig.value.imageUrl = response.data.url +} + +const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile) => { + console.log("beforeAvatarUpload",rawFile.type) + if (rawFile.type !== 'image/jpeg' && rawFile.type !== 'image/jpg' && rawFile.type !== 'image/png' && rawFile.type !== 'image/gif' && rawFile.type !== 'image/icon') { + ElMessage.error('请上传以下格式的图片(jpg、jpeg、png、gif、icon)!'+rawFile.type) + return false + } else if (rawFile.size / 1024 / 1024 > 2) { + ElMessage.error('图片大小不要大于 2MB!') + return false + } + return true +} + + +