From a5c529df0221419b3c9e1877a66bc4fe7a7ac952 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 28 Apr 2021 15:51:04 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=20icon=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/project/L5/services/canvas.js | 2 +- .../components/common/project/topologyL5.vue | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/nezha-fronted/src/components/common/project/L5/services/canvas.js b/nezha-fronted/src/components/common/project/L5/services/canvas.js index b84bb661f..6918097ac 100644 --- a/nezha-fronted/src/components/common/project/L5/services/canvas.js +++ b/nezha-fronted/src/components/common/project/L5/services/canvas.js @@ -180,7 +180,7 @@ export const imageTemp = { width: 100, height: 100 }, - imageRatio: false, + imageRatio: true, lineWidth: 0, rotate: 0, offsetRotate: 0, diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue index 7bfbfafc4..c8acf506c 100644 --- a/nezha-fronted/src/components/common/project/topologyL5.vue +++ b/nezha-fronted/src/components/common/project/topologyL5.vue @@ -1562,7 +1562,7 @@ export default { if (res.code == 200) { this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.uploadPicShow = false - this.dealImg(`monitor/project/topo/icon/${res.data.id}/1`).then((data) => { + this.dealImg(`monitor/project/topo/icon/${res.data.id}/0`).then((data,header) => { const group = this.tools.find(tool => tool.group === this.uploadPic.unit) if (group) { group.children.push({ @@ -1618,10 +1618,10 @@ export default { res.data.list.forEach((item, index) => { item.imageName = item.name delete item.name - promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.id}/1`)) + promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.id}/0`)) imgArr.push({ ...item }) }) - Promise.all(promiseArr).then((res2) => { + Promise.all(promiseArr).then((res2,header) => { this.iconArray = [...res.data.list] this.iconArray.forEach((item, index) => { item.image = res2[index] @@ -1662,7 +1662,7 @@ export default { const promiseArr = [] imgidList.forEach((item, index) => { if (item.data.imageId) { - promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`)) + promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/0`)) } else { promiseArr.push('') } @@ -1691,11 +1691,14 @@ export default { .get(url, { responseType: 'arraybuffer' }) - .then(res => { - return ('data:image/jpeg;base64,' + btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))) + .then((res, resHeader) => { + return { + data: ('data:image/jpeg;base64,' + btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))), + header: resHeader + } }) .then(data => { - resolve(data) + resolve(data.data, data.header) // changeImage(data,(img)=>{ // resolve(img) // })