diff --git a/src/utils/get-img-width.js b/src/utils/get-img-width.js index 35a2bf2..73ae9b0 100644 --- a/src/utils/get-img-width.js +++ b/src/utils/get-img-width.js @@ -1,7 +1,7 @@ import { Message } from 'element-ui' export default function (file, id) { - let width = 0; - let height = 0; + let width = null; + let height = null; switch (id) { case 23: //深度解说 width = 650; @@ -23,6 +23,14 @@ export default function (file, id) { width = 380; height = 220; break; + case 'bigSwiper': //首页大轮播 + width = 1920; + height = 960; + break; + case 'smallSwiper': //首页小轮播 + width = 722; + height = 406; + break; }; return new Promise(resolve => { let reader = new FileReader(); @@ -32,7 +40,7 @@ export default function (file, id) { let img = document.createElement("img"); img.src = txt; img.onload = function () { - console.log(id, width, height); + // console.log(id, width, height); if (width && height) { if (img.width === width && img.height === height) { resolve(true) @@ -51,8 +59,3 @@ export default function (file, id) { }; }) } -// 1. 650 350 -// 1. 650 350 -// 1. 650 350 -// 1. 650 350 -// 1. 650 350 \ No newline at end of file diff --git a/src/views/ad/index.vue b/src/views/ad/index.vue index df02e3f..ba064cf 100644 --- a/src/views/ad/index.vue +++ b/src/views/ad/index.vue @@ -6,7 +6,8 @@ type="primary" icon="el-icon-edit" @click="handleCreate" - >添加资讯 + >添加资讯 -