From 4bbae7e63a6b0e72ab1a81ea5cfb62edb7737ec0 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 24 Feb 2023 14:28:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E9=99=90=E5=88=B6?= =?UTF-8?q?=E8=83=BD=E4=B8=8A=E4=BC=A0jpg=E3=80=81jpeg=E3=80=81png?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E7=9A=84=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/package/inspectionInput/inspectionInput.js | 6 ++++++ 1 file changed, 6 insertions(+) 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({