|
|
@@ -55,6 +55,7 @@
|
|
|
v-model:file-list="form.planeImageFileList"
|
|
|
list-type="picture-card"
|
|
|
:limit="9"
|
|
|
+ :before-upload="beforePlaneImageUpload"
|
|
|
:http-request="handlePlaneImageUpload"
|
|
|
:on-remove="onPlaneImageRemove"
|
|
|
:on-preview="onPlaneImagePreview"
|
|
|
@@ -122,6 +123,23 @@ import {
|
|
|
import { uploadFileToOss } from "@/api/upload.js";
|
|
|
import { localGet } from "@/utils";
|
|
|
|
|
|
+/** 平面图单张上限(与商户端 / 动态发布一致) */
|
|
|
+const PLANE_IMAGE_MAX_MB = 20;
|
|
|
+const UPLOAD_TIP_IMAGE = "图片建议不超过 20MB";
|
|
|
+
|
|
|
+const beforePlaneImageUpload = (rawFile: File) => {
|
|
|
+ const mime = String(rawFile?.type || "");
|
|
|
+ if (!mime.startsWith("image/")) {
|
|
|
+ ElMessage.warning("只能上传图片格式");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (rawFile.size > PLANE_IMAGE_MAX_MB * 1024 * 1024) {
|
|
|
+ ElMessage.warning(UPLOAD_TIP_IMAGE);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+};
|
|
|
+
|
|
|
export interface CategoryRow {
|
|
|
id: number | string;
|
|
|
_seq?: number;
|