|
|
@ -63,7 +63,7 @@ |
|
|
|
import { onMounted, reactive, toRefs } from 'vue'; |
|
|
|
import * as Tiff from 'browser-tiff.js'; |
|
|
|
import { DecisionSupportConfig } from '../uilts/Config'; |
|
|
|
import { get } from '../uilts/axios'; |
|
|
|
import { post } from '../uilts/axios'; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'DecisionSupport', |
|
|
@ -102,8 +102,8 @@ import { get } from '../uilts/axios'; |
|
|
|
imgUrl: '/images/null-picture.png', |
|
|
|
preview: [] |
|
|
|
}], |
|
|
|
indicatorImg: '/product/picture/images/decision-support/pollution-indicator/pollution-indicator.png', |
|
|
|
indicatorPreview: ['/product/picture/images/decision-support/pollution-indicator/pollution-indicator.png'] |
|
|
|
indicatorImg: '/images/decision-support/pollution-indicator/pollution-indicator.png', |
|
|
|
indicatorPreview: ['/images/decision-support/pollution-indicator/pollution-indicator.png'] |
|
|
|
}) |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
@ -129,28 +129,15 @@ import { get } from '../uilts/axios'; |
|
|
|
} |
|
|
|
|
|
|
|
const initImage = (type, imgName, index) => { |
|
|
|
console.log(DecisionSupportConfig.getUrl(type, imgName)) |
|
|
|
get(DecisionSupportConfig.getUrl(type, imgName)).then((response: any) => { |
|
|
|
console.log(response) |
|
|
|
let tiff = new Tiff({buffer: response.data}); |
|
|
|
let canvas = tiff.toCanvas(); |
|
|
|
let image = new Image(); |
|
|
|
image.src = canvas.toDataURL("image/png"); |
|
|
|
options.items[index].imgUrl = image.src; |
|
|
|
options.items[index].preview = [image.src]; |
|
|
|
post("/image/convert", {url: DecisionSupportConfig.getUrl(type, imgName)}).then((response: any) => { |
|
|
|
if (response.error != 0){ |
|
|
|
console.log("发生错误") |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
options.items[index].imgUrl = response.data; |
|
|
|
options.items[index].preview = [response.data]; |
|
|
|
}) |
|
|
|
// var xhr = new XMLHttpRequest(); |
|
|
|
// xhr.responseType = 'arraybuffer'; |
|
|
|
// xhr.open('GET', DecisionSupportConfig.getUrl(type, imgName)); |
|
|
|
// xhr.onload = function (e) { |
|
|
|
// let tiff = new Tiff({buffer: xhr.response}); |
|
|
|
// let canvas = tiff.toCanvas(); |
|
|
|
// let image = new Image(); |
|
|
|
// image.src = canvas.toDataURL("image/png"); |
|
|
|
// options.items[index].imgUrl = image.src; |
|
|
|
// options.items[index].preview = [image.src]; |
|
|
|
// }; |
|
|
|
// xhr.send(); |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|