fix: topology 图片加载宽高的问题修改
This commit is contained in:
@@ -825,8 +825,9 @@ export default {
|
|||||||
opacity: data.data.opacity,
|
opacity: data.data.opacity,
|
||||||
name: data.name
|
name: data.name
|
||||||
}
|
}
|
||||||
if (this.fromOverView) { // 优化从首页来的加载速度
|
if (this.fromOverView || this.fromChartBox) { // 优化从首页来的加载速度
|
||||||
const arr = data.pens.filter(item => !item.type)
|
const arr = data.pens.filter(item => !item.type)
|
||||||
|
this.imgInit = false
|
||||||
this.addNodeInit(arr)
|
this.addNodeInit(arr)
|
||||||
}
|
}
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
@@ -1577,7 +1578,7 @@ export default {
|
|||||||
const group = this.tools.find(tool => tool.group === this.uploadPic.unit)
|
const group = this.tools.find(tool => tool.group === this.uploadPic.unit)
|
||||||
this.iconArray.push({
|
this.iconArray.push({
|
||||||
...iconInfo.data.list[0],
|
...iconInfo.data.list[0],
|
||||||
image: data
|
image: data.data
|
||||||
})
|
})
|
||||||
if (group) {
|
if (group) {
|
||||||
group.children.push({
|
group.children.push({
|
||||||
@@ -1585,9 +1586,13 @@ export default {
|
|||||||
data: {
|
data: {
|
||||||
...imageTemp2.data,
|
...imageTemp2.data,
|
||||||
text: res.data.imageName,
|
text: res.data.imageName,
|
||||||
image: data,
|
image: data.data,
|
||||||
imageId: res.data.id,
|
imageId: res.data.id,
|
||||||
unit: this.uploadPic.unit
|
unit: this.uploadPic.unit,
|
||||||
|
rect: {
|
||||||
|
width: data.width,
|
||||||
|
height: data.height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -1598,9 +1603,13 @@ export default {
|
|||||||
data: {
|
data: {
|
||||||
...imageTemp2.data,
|
...imageTemp2.data,
|
||||||
text: res.data.imageName,
|
text: res.data.imageName,
|
||||||
image: data,
|
image: data.data,
|
||||||
imageId: res.data.id,
|
imageId: res.data.id,
|
||||||
unit: this.uploadPic.unit
|
unit: this.uploadPic.unit,
|
||||||
|
rect: {
|
||||||
|
width: data.width,
|
||||||
|
height: data.height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1588,7 +1588,7 @@ export default {
|
|||||||
const group = this.tools.find(tool => tool.group === this.uploadPic.unit)
|
const group = this.tools.find(tool => tool.group === this.uploadPic.unit)
|
||||||
this.iconArray.push({
|
this.iconArray.push({
|
||||||
...iconInfo.data.list[0],
|
...iconInfo.data.list[0],
|
||||||
image: data
|
image: data.data
|
||||||
})
|
})
|
||||||
if (group) {
|
if (group) {
|
||||||
group.children.push({
|
group.children.push({
|
||||||
@@ -1598,7 +1598,11 @@ export default {
|
|||||||
text: res.data.imageName,
|
text: res.data.imageName,
|
||||||
image: data,
|
image: data,
|
||||||
imageId: res.data.id,
|
imageId: res.data.id,
|
||||||
unit: this.uploadPic.unit
|
unit: this.uploadPic.unit,
|
||||||
|
rect: {
|
||||||
|
width: data.width,
|
||||||
|
height: data.height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -1611,7 +1615,11 @@ export default {
|
|||||||
text: res.data.imageName,
|
text: res.data.imageName,
|
||||||
image: data,
|
image: data,
|
||||||
imageId: res.data.id,
|
imageId: res.data.id,
|
||||||
unit: this.uploadPic.unit
|
unit: this.uploadPic.unit,
|
||||||
|
rect: {
|
||||||
|
width: data.width,
|
||||||
|
height: data.height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
@@ -1678,7 +1686,7 @@ export default {
|
|||||||
Promise.all(promiseArr).then((res2, header) => {
|
Promise.all(promiseArr).then((res2, header) => {
|
||||||
this.iconArray = [...res.data.list]
|
this.iconArray = [...res.data.list]
|
||||||
this.iconArray.forEach((item, index) => {
|
this.iconArray.forEach((item, index) => {
|
||||||
item.image = res2[index]
|
item.image = res2[index].data
|
||||||
const group = this.tools.find(tool => tool.group === item.unit)
|
const group = this.tools.find(tool => tool.group === item.unit)
|
||||||
if (group) {
|
if (group) {
|
||||||
group.children.push({
|
group.children.push({
|
||||||
@@ -1686,9 +1694,13 @@ export default {
|
|||||||
data: {
|
data: {
|
||||||
...imageTemp.data,
|
...imageTemp.data,
|
||||||
text: item.imageName,
|
text: item.imageName,
|
||||||
image: res2[index],
|
image: res2[index].data,
|
||||||
imageId: item.id,
|
imageId: item.id,
|
||||||
unit: item.unit
|
unit: item.unit,
|
||||||
|
rect: {
|
||||||
|
width: res2[index].width,
|
||||||
|
height: res2[index].height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -1701,7 +1713,11 @@ export default {
|
|||||||
text: item.imageName,
|
text: item.imageName,
|
||||||
image: res2[index],
|
image: res2[index],
|
||||||
imageId: item.id,
|
imageId: item.id,
|
||||||
unit: item.unit
|
unit: item.unit,
|
||||||
|
rect: {
|
||||||
|
width: res2[index].width,
|
||||||
|
height: res2[index].height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
@@ -1733,7 +1749,7 @@ export default {
|
|||||||
})
|
})
|
||||||
this.iconArray.forEach((item, index) => {
|
this.iconArray.forEach((item, index) => {
|
||||||
if (item.id) {
|
if (item.id) {
|
||||||
item.image = res2[index]
|
item.image = res2[index].data
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.imgInit = true
|
this.imgInit = true
|
||||||
@@ -1750,12 +1766,29 @@ export default {
|
|||||||
this.$axios
|
this.$axios
|
||||||
.get(url)
|
.get(url)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
return {
|
const imageInfo = {
|
||||||
data: ('data:image/jpeg;base64,' + res.data)
|
data: ('data:image/jpeg;base64,' + res.data),
|
||||||
|
// width: res.headers.width === -1 ? 100 : (res.headers.width > 900 ? 900 : res.headers.width),
|
||||||
|
// height: res.headers.height === -1 ? 100 : (res.headers.height > 900 ? 900 : res.headers.height)
|
||||||
|
width: res.headers.width === -1 ? 100 : Number(res.headers.width),
|
||||||
|
height: res.headers.height === -1 ? 100 : Number(res.headers.height)
|
||||||
}
|
}
|
||||||
|
if (imageInfo.width > 900 || imageInfo.height > 900) {
|
||||||
|
if (imageInfo.height > imageInfo.width) {
|
||||||
|
imageInfo.width = imageInfo.width * 900 / imageInfo.height
|
||||||
|
imageInfo.height = 900
|
||||||
|
} else if (imageInfo.height < imageInfo.width) {
|
||||||
|
imageInfo.height = imageInfo.height * 900 / imageInfo.width
|
||||||
|
imageInfo.width = 900
|
||||||
|
} else {
|
||||||
|
imageInfo.height = 900
|
||||||
|
imageInfo.width = 900
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return imageInfo
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
resolve(data.data, data.header)
|
resolve(data)
|
||||||
// changeImage(data,(img)=>{
|
// changeImage(data,(img)=>{
|
||||||
// resolve(img)
|
// resolve(img)
|
||||||
// })
|
// })
|
||||||
|
|||||||
Reference in New Issue
Block a user