From 5ad476898556914575a42eb6fb7194a40746c7b5 Mon Sep 17 00:00:00 2001 From: pzy Date: Fri, 18 Feb 2022 15:04:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E4=B8=8A=E4=BC=A0=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E9=99=90=E5=88=B6=E5=A4=A7=E5=B0=8F=EF=BC=8C=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=9B=BE=E7=89=87=E5=AE=BD=E5=BA=A6=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/get-img-width.js | 19 +-- src/views/ad/index.vue | 279 ++++++++++++++++++++---------------- src/views/article/index.vue | 8 +- 3 files changed, 172 insertions(+), 134 deletions(-) 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" - >添加资讯 + >添加资讯 -