Commit 0bf11568 by yancanhua

fix: 自测问题修改

1 parent 152f2275
Pipeline #137 for 0bf11568 failed in 0 seconds
......@@ -48,6 +48,10 @@ async function onFileChange(ev: Event) {
const file = input.files?.[0];
input.value = "";
if (!file) return;
const fileSize = file.size / 1024 / 1024;
if (fileSize && fileSize > 5) {
return showToast(`文件大小不能超过5MB`);
}
uploading.value = true;
try {
const res = await uploadFile(file);
......
......@@ -49,6 +49,16 @@ async function onFileChange(ev: Event) {
const file = input.files?.[0];
input.value = "";
if (!file) return;
const fileSize = file.size / 1024 / 1024;
// 检查文件大小是否超过限制 10MB
if (props.item.interactionType == 'image_upload' && fileSize && fileSize > 5) {
return showToast(`文件大小不能超过5MB`);;
}
// 检查文件大小是否超过限制 10MB
if (props.item.interactionType == 'video_upload' && fileSize && fileSize > 100) {
return showToast(`文件大小不能超过100MB`);
}
uploading.value = true;
try {
const res = await uploadFile(file);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!