fix: 修复报告页
This commit is contained in:
parent
dfee22f42f
commit
ce523e5a66
@ -73,7 +73,7 @@
|
||||
<view v-else-if="item.failed" class="media-mask media-mask--error" @click="retryUpload('beforeMedia', idx)">
|
||||
<text class="media-mask-text">上传失败,点此重试</text>
|
||||
</view>
|
||||
<view class="thumb-del" @click="removeMedia('beforeMedia', idx)">✕</view>
|
||||
<view class="thumb-del" @click.stop="removeMedia('beforeMedia', idx)">✕</view>
|
||||
</view>
|
||||
<view v-if="report.beforeMedia.length < 4" class="photo-add" @click="uploadPhoto('beforeMedia')">
|
||||
<AppIcon name="camera" :size="20" color="#bbbbb5" />
|
||||
@ -97,7 +97,7 @@
|
||||
<view v-else-if="item.failed" class="media-mask media-mask--error" @click="retryUpload('afterMedia', idx)">
|
||||
<text class="media-mask-text">上传失败,点此重试</text>
|
||||
</view>
|
||||
<view class="thumb-del" @click="removeMedia('afterMedia', idx)">✕</view>
|
||||
<view class="thumb-del" @click.stop="removeMedia('afterMedia', idx)">✕</view>
|
||||
</view>
|
||||
<view v-if="report.afterMedia.length < 4" class="photo-add" @click="uploadPhoto('afterMedia')">
|
||||
<AppIcon name="camera" :size="20" color="#bbbbb5" />
|
||||
@ -141,7 +141,7 @@
|
||||
<view v-else-if="item.failed" class="media-mask media-mask--error" @click="retryUpload('duringMedia', idx)">
|
||||
<text class="media-mask-text">上传失败,点此重试</text>
|
||||
</view>
|
||||
<view class="thumb-del" @click="removeMedia('duringMedia', idx)">✕</view>
|
||||
<view class="thumb-del" @click.stop="removeMedia('duringMedia', idx)">✕</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user