From ce523e5a663798cec9ae8d5fe7a384e63959794f Mon Sep 17 00:00:00 2001 From: MaDaLei Date: Fri, 17 Apr 2026 13:43:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/report/Report.vue | 38 ++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/pages/report/Report.vue b/src/pages/report/Report.vue index 0163a53..083988c 100644 --- a/src/pages/report/Report.vue +++ b/src/pages/report/Report.vue @@ -73,7 +73,7 @@ 上传失败,点此重试 - + @@ -97,7 +97,7 @@ 上传失败,点此重试 - + @@ -141,7 +141,7 @@ 上传失败,点此重试 - + @@ -265,14 +265,19 @@ const friendlyUploadError = (rawMsg) => { if (msg.includes('request:fail')) return '网络异常,请重试' if (msg.includes('timeout')) return '上传超时,请重试' if (msg.includes('只能上传图片或视频')) return '格式不支持' - if (msg.includes('413') || msg.includes('Too Large') || msg.includes('HTTP 413')) return '文件过大' + if (msg.includes('413') || msg.includes('Too Large') || msg.includes('HTTP 413')) { + return '文件过大:可先压缩视频;仍失败请把网关上传上限调到≥200MB' + } if (msg.includes('HTTP 502') || msg.includes('HTTP 503') || msg.includes('HTTP 504')) return '服务暂不可用' if (/HTTP\s(4|5)\d{2}/.test(msg)) return '上传失败,请重试' return msg } /** 大视频上传较慢,单独加长超时(毫秒) */ -const UPLOAD_TIMEOUT_MS = 180000 +const UPLOAD_TIMEOUT_MS = 300000 + +/** 与后端 max-file-size 对齐,前端提前提示,避免长时间上传后 413 */ +const MAX_VIDEO_MB = 190 const buildPendingItem = (localPath, mediaType) => ({ url: localPath, @@ -432,10 +437,10 @@ const uploadVideo = (field) => { const item = buildPendingItem(f.tempFilePath, 'video') report.value[field].push(item) const sizeMB = (f.size || 0) / 1024 / 1024 - if (sizeMB > 100) { + if (sizeMB > MAX_VIDEO_MB) { failCount++ - if (!firstReason) firstReason = '视频不能超过100MB' - setUploadFail(item, '视频不能超过100MB') + if (!firstReason) firstReason = `视频请不超过${MAX_VIDEO_MB}MB` + setUploadFail(item, `视频请不超过${MAX_VIDEO_MB}MB`) continue } const r = await uploadSingleFile(f.tempFilePath) @@ -492,10 +497,10 @@ const uploadDuring = () => { if (isVideo) { const sizeMB = (f.size || 0) / 1024 / 1024 - if (sizeMB > 100) { + if (sizeMB > MAX_VIDEO_MB) { failCount++ - if (!firstReason) firstReason = '视频不能超过100MB' - setUploadFail(item, '视频不能超过100MB') + if (!firstReason) firstReason = `视频请不超过${MAX_VIDEO_MB}MB` + setUploadFail(item, `视频请不超过${MAX_VIDEO_MB}MB`) continue } } @@ -559,7 +564,9 @@ const onServiceTimeChange = (e) => { const submitReport = async () => { if (hasUploadingMedia.value) return uni.showToast({ title: '还有素材上传中,请稍候', icon: 'none' }) - if (hasFailedMedia.value) return uni.showToast({ title: '有上传失败项,请重试或删除', icon: 'none' }) + if (hasFailedMedia.value) { + return uni.showToast({ title: '请先点缩略图右上角✕删除失败项', icon: 'none', duration: 2800 }) + } if (!report.value.petName) return uni.showToast({ title: '请输入宠物名字', icon: 'none' }) if (!report.value.serviceType) return uni.showToast({ title: '请选择服务类型', icon: 'none' }) if (!report.value.appointmentTime) return uni.showToast({ title: '请选择服务时间', icon: 'none' }) @@ -786,9 +793,10 @@ const onRemarkBlur = () => { position: absolute; top: 4px; right: 4px; - width: 20px; - height: 20px; - background: rgba(0,0,0,0.5); + z-index: 10; + width: 22px; + height: 22px; + background: rgba(0,0,0,0.55); color: #fff; border-radius: 50%; font-size: 11px;