fix:修改获取 icon的接口

This commit is contained in:
zhangyu
2021-04-28 15:51:04 +08:00
parent b24c263f41
commit a5c529df02
2 changed files with 11 additions and 8 deletions

View File

@@ -180,7 +180,7 @@ export const imageTemp = {
width: 100, width: 100,
height: 100 height: 100
}, },
imageRatio: false, imageRatio: true,
lineWidth: 0, lineWidth: 0,
rotate: 0, rotate: 0,
offsetRotate: 0, offsetRotate: 0,

View File

@@ -1562,7 +1562,7 @@ export default {
if (res.code == 200) { if (res.code == 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.uploadPicShow = false 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) const group = this.tools.find(tool => tool.group === this.uploadPic.unit)
if (group) { if (group) {
group.children.push({ group.children.push({
@@ -1618,10 +1618,10 @@ export default {
res.data.list.forEach((item, index) => { res.data.list.forEach((item, index) => {
item.imageName = item.name item.imageName = item.name
delete 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 }) imgArr.push({ ...item })
}) })
Promise.all(promiseArr).then((res2) => { 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]
@@ -1662,7 +1662,7 @@ export default {
const promiseArr = [] const promiseArr = []
imgidList.forEach((item, index) => { imgidList.forEach((item, index) => {
if (item.data.imageId) { 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 { } else {
promiseArr.push('') promiseArr.push('')
} }
@@ -1691,11 +1691,14 @@ export default {
.get(url, { .get(url, {
responseType: 'arraybuffer' responseType: 'arraybuffer'
}) })
.then(res => { .then((res, resHeader) => {
return ('data:image/jpeg;base64,' + btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))) return {
data: ('data:image/jpeg;base64,' + btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))),
header: resHeader
}
}) })
.then(data => { .then(data => {
resolve(data) resolve(data.data, data.header)
// changeImage(data,(img)=>{ // changeImage(data,(img)=>{
// resolve(img) // resolve(img)
// }) // })