fix:图片上传修改
build / task (16.x, npm, macOS-latest) (push) Canceled after 0s
build / task (16.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, npm, windows-latest) (push) Canceled after 0s
build / task (16.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (16.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (16.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (16.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, yarn, windows-latest) (push) Canceled after 0s
build / task (18.x, npm, macOS-latest) (push) Canceled after 0s
build / task (18.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, npm, windows-latest) (push) Canceled after 0s
build / task (18.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (18.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (18.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (18.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, yarn, windows-latest) (push) Canceled after 0s
build / task (20.x, npm, macOS-latest) (push) Canceled after 0s
build / task (20.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, npm, windows-latest) (push) Canceled after 0s
build / task (20.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (20.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (20.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (20.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, yarn, windows-latest) (push) Canceled after 0s

This commit is contained in:
dzc committed 2026-10-29 19:29:24 +08:00
1 parent fb3f8ae277
commit fbf163e3f2
4 files changed
+103 -53

No files matched your search

+13 -17
View File
@@ -31,7 +31,7 @@ interface UploadFileProps {
}
const props = withDefaults(defineProps<UploadFileProps>(), {
disabled: false,
fileType: () => ["image/jpeg", "image/png", "image/gif"],
fileType: () => ["image/jpeg", "image/png", "image/gif", "image/webp"],
fileSize: 5,
height: "150px",
width: "150px",
@@ -51,20 +51,16 @@ const formContext = inject(formContextKey, void 0)
const handleHttpUpload = async (options: UploadRequestOptions) => {
let formData = new FormData()
formData.append("file", options.file)
try {
const res = await request({
url: "/admin/sys-file/qn/upload",
method: "post",
headers: {
"Content-Type": "multipart/form-data",
},
data: formData,
})
if (res.code == 0) {
return res
}
} catch (error) {
options.onError(error as any)
const res = await request({
url: "/admin/sys-file/qn/upload",
method: "post",
headers: {
"Content-Type": "multipart/form-data",
},
data: formData,
})
if (res.code == 0) {
return res
}
}
@@ -137,10 +133,10 @@ const handleRemove = (uploadFile: any, uploadFiles: any[]) => {
/**
* @description 图片上传错误
* */
const uploadError = () => {
const uploadError = (error: any) => {
ElNotification({
title: "温馨提示",
message: "图片上传失败,请您重新上传!",
message: error?.msg || error?.message || "图片上传失败,请您重新上传!",
type: "error",
})
}