v1.2.1版本,优化调整了很多,整改验收阶段新加字段
This commit is contained in:
39
unpackage/dist/dev/mp-weixin/app.js
vendored
39
unpackage/dist/dev/mp-weixin/app.js
vendored
@@ -79,23 +79,34 @@ common_vendor.index.addInterceptor("chooseImage", {
|
||||
res.tempFiles = validTempFiles;
|
||||
}
|
||||
});
|
||||
const UPLOAD_ALLOWED_EXTENSIONS = ["bmp", "gif", "jpg", "jpeg", "png", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", "rar", "zip", "gz", "bz2", "mp4", "avi", "rmvb", "pdf"];
|
||||
const QINIU_UPLOAD_HOST_MARKERS = ["qiniup.com", "qbox.me"];
|
||||
function validateUploadLocalFileExt(filePath) {
|
||||
if (!filePath)
|
||||
return true;
|
||||
const cleanPath = filePath.split("?")[0];
|
||||
const ext = cleanPath.split(".").pop().toLowerCase();
|
||||
if (!UPLOAD_ALLOWED_EXTENSIONS.includes(ext)) {
|
||||
common_vendor.index.showToast({
|
||||
title: `不支持 .${ext} 格式,请上传合规的文件或图片`,
|
||||
icon: "none",
|
||||
duration: 3e3
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
common_vendor.index.addInterceptor("uploadFile", {
|
||||
invoke(args) {
|
||||
const filePath = args.filePath;
|
||||
if (filePath) {
|
||||
const cleanPath = filePath.split("?")[0];
|
||||
const ext = cleanPath.split(".").pop().toLowerCase();
|
||||
const allowedExtensions = ["bmp", "gif", "jpg", "jpeg", "png", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", "rar", "zip", "gz", "bz2", "mp4", "avi", "rmvb", "pdf"];
|
||||
if (!allowedExtensions.includes(ext)) {
|
||||
common_vendor.index.showToast({
|
||||
title: `不支持 .${ext} 格式,请上传合规的文件或图片`,
|
||||
icon: "none",
|
||||
duration: 3e3
|
||||
});
|
||||
return false;
|
||||
}
|
||||
const uploadUrl = args.url || "";
|
||||
const isQiniuUpload = QINIU_UPLOAD_HOST_MARKERS.some((m) => uploadUrl.includes(m));
|
||||
if (isQiniuUpload) {
|
||||
return validateUploadLocalFileExt(args.filePath) ? args : false;
|
||||
}
|
||||
return args;
|
||||
if (uploadUrl.includes("/frontend/attachment/upload")) {
|
||||
return validateUploadLocalFileExt(args.filePath) ? args : false;
|
||||
}
|
||||
return validateUploadLocalFileExt(args.filePath) ? args : false;
|
||||
}
|
||||
});
|
||||
function createApp() {
|
||||
|
||||
Reference in New Issue
Block a user