From 2d9a27b0de522d04bc53aab8c818a079eecbdebd Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 18 Nov 2020 14:21:20 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9Atopology=20=E9=99=90=E5=88=B6?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=A4=A7=E5=B0=8F=20=EF=BC=8C=E7=82=B9?= =?UTF-8?q?=E5=87=BB=20overview=20topo=E5=9B=BE=E8=B7=B3=E8=BD=AC=E5=AF=B9?= =?UTF-8?q?=E5=BA=94project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/project/addNode.vue | 36 +++++++++++++++---- .../page/dashboard/overview/overview2.vue | 6 +++- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/nezha-fronted/src/components/common/project/addNode.vue b/nezha-fronted/src/components/common/project/addNode.vue index d72129a4f..03f670bef 100644 --- a/nezha-fronted/src/components/common/project/addNode.vue +++ b/nezha-fronted/src/components/common/project/addNode.vue @@ -345,19 +345,41 @@ this.esc(); }, beforeAvatarUpload(file){ + let this_=this let isJPG = (file.type === 'image/jpeg' || file.type === 'image/png'); const isLt2M = file.size / 1024 / 1024 < 2; if (!isJPG) { - this.$message.error('上传图片只能是 JPG/png 格式!'); + this.$message.error( this_.$t('project.topology.imgFormat')); + return false; } - if (!isLt2M) { - this.$message.error('上传图片大小不能超过 2MB!'); - } - this.file=file; - this.upload(); - return false; + // if (!isLt2M) { + // this.$message.error( this_.$t('project.topology.imgSize')); + // return false; + // } + const isSize = new Promise(function(resolve, reject) { + let width = 100; + let height = 100; + let _URL = window.URL || window.webkitURL; + let img = new Image(); + img.onload = function() { + console.log(img.width); + let valid = img.width > width && img.height > height; + valid ? resolve() : reject(); + } + img.src = _URL.createObjectURL(file); + }).then(() => { + if(isJPG){ + this.file=file; + this.upload(); + } + return file; + }, () => { + this.$message.error( this_.$t('project.topology.imgMeasure')); + return Promise.reject(); + }); + return false; }, handleAvatarSuccess(file,res){ diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue index 758d63240..e7e79b244 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue @@ -112,7 +112,7 @@
-
+
{{item.name}} { this.assetLoading = true; @@ -1662,6 +1665,7 @@ top: 0; left: 0; z-index: 10; + cursor: pointer; } /deep/ .el-carousel__indicator--horizontal .el-carousel__button{ background-color: #C0C4CC;