diff --git a/.env.production b/.env.production
index 1eb24be..07d391e 100644
--- a/.env.production
+++ b/.env.production
@@ -2,5 +2,5 @@
ENV = 'production'
# base api
-VUE_APP_BASE_API = 'http://lsytest.rocpool.top/api.php'
+VUE_APP_BASE_API = '/api'
diff --git a/src/utils/get-img-width.js b/src/utils/get-img-width.js
index 4bcf056..9f30f90 100644
--- a/src/utils/get-img-width.js
+++ b/src/utils/get-img-width.js
@@ -48,9 +48,18 @@ export default function (file, id) {
let img = document.createElement("img");
img.src = txt;
img.onload = function () {
- // console.log(id, width, height);
+ // 限制图片上传大小
+ if (parseInt(file.size / 1024) > 500) {
+ resolve({ validation: false, msg: `图片限制500kb以内` });
+ Message({
+ type: 'warning',
+ message: '图片限制500kb以内'
+ });
+ return;
+ }
+ // 限制图片宽高
if (width && height) {
- if (img.width === width && img.height === height) {
+ if ((img.width === width && img.height === height) || (img.width === width * 2 && img.height === height * 2) || (img.width === width * 3 && img.height === height * 3)) {
resolve({ validation: true })
} else {
Message({
@@ -58,7 +67,7 @@ export default function (file, id) {
type: "warning",
duration: 5000
});
- let res = { width, height, validation: false }
+ let res = { msg: `提示:基础宽高${width}x${height}`, validation: false }
resolve(res);
}
} else {
diff --git a/src/views/ad/index.vue b/src/views/ad/index.vue
index 15e3b74..65cd14f 100644
--- a/src/views/ad/index.vue
+++ b/src/views/ad/index.vue
@@ -155,7 +155,7 @@
v-if="validation === false"
style="padding-left: 10px; color: red"
>
- 提示:宽高{{ dislabelSize.width }}x{{ dislabelSize.height }}
+ {{ dislabelSize.msg }}
diff --git a/src/views/article/index.vue b/src/views/article/index.vue
index d9f0f16..f31de77 100644
--- a/src/views/article/index.vue
+++ b/src/views/article/index.vue
@@ -293,7 +293,7 @@
v-if="validation === false"
style="padding-left: 10px; color: red"
>
- 提示:宽高{{ dislabelSize.width }}x{{ dislabelSize.height }}
+ {{ dislabelSize.msg }}