Commit 4f083e4f by zhangxw

上传pdf文件添加大小限制

1 parent 9fb0c770
...@@ -197,6 +197,9 @@ Component({ ...@@ -197,6 +197,9 @@ Component({
let tempFile = res.tempFiles[0] let tempFile = res.tempFiles[0]
let fileName = tempFile.name // 获取文件名 let fileName = tempFile.name // 获取文件名
let fileType = fileName.split('.').pop() // 获取文件扩展名 let fileType = fileName.split('.').pop() // 获取文件扩展名
if (tempFile?.size > 1024 * 1024 * 10) {
return wx.$util.showToast('上传文件需≤10M,请压缩后重传或联系总部')
}
// 读取文件 // 读取文件
if (fileType != 'pdf') return wx.$util.showToast('只可上传pdf类型文件') if (fileType != 'pdf') return wx.$util.showToast('只可上传pdf类型文件')
_this.setData({ _this.setData({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!