diff --git a/weapp/package/inspectionInput/inspectionInput.js b/weapp/package/inspectionInput/inspectionInput.js index 2f0ed73..d398e4f 100644 --- a/weapp/package/inspectionInput/inspectionInput.js +++ b/weapp/package/inspectionInput/inspectionInput.js @@ -197,6 +197,12 @@ Page({ wx.showToast({ title: '图片大于15M,不可上传', icon: 'none' }); return; } + const fileNameArr = res.tempFiles[i].tempFilePath.split('.'); + const extension = res.tempFiles[i].tempFilePath.split('.')[fileNameArr.length - 1]; + if (extension !== 'jpg' && extension !== 'png' && extension !== 'jpeg') { + wx.showToast({ title: '只能上传jpg、jpeg、png格式的图片', icon: 'none' }); + return; + } pics.push(imgs[i].tempFilePath) } that.uploadimg({