1
This commit is contained in:
parent
7800662267
commit
e3dde5cff3
@ -73,7 +73,7 @@
|
||||
:maxCount="1"
|
||||
@preview="handlePreview"
|
||||
@remove="handleBrandImageRemove"
|
||||
accept="image/*"
|
||||
accept=".jpg,.jpeg,.png"
|
||||
>
|
||||
<div v-if="!formState.brand_image_url">
|
||||
<plus-outlined />
|
||||
@ -217,7 +217,7 @@
|
||||
:maxCount="1"
|
||||
@preview="handlePreview"
|
||||
@remove="handleBrandImageRemove"
|
||||
accept="image/*"
|
||||
accept=".jpg,.jpeg,.png"
|
||||
>
|
||||
<div v-if="!editFormState.brand_image_url">
|
||||
<plus-outlined />
|
||||
@ -969,6 +969,14 @@ export default defineComponent({
|
||||
|
||||
// 处理品牌图片上传
|
||||
const handleBrandImageUpload = async ({ file, onSuccess, onError, onProgress }) => {
|
||||
// 验证文件类型
|
||||
const allowedTypes = ['image/jpeg', 'image/png']
|
||||
if (!allowedTypes.includes(file.type)) {
|
||||
message.error('只能上传 JPG/PNG 格式的图片!')
|
||||
onError()
|
||||
return
|
||||
}
|
||||
|
||||
const formData = new FormData()
|
||||
formData.append('files', file)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user