diff --git a/04.系统编码/Frontend/src/components/DecisionSupport.vue b/04.系统编码/Frontend/src/components/DecisionSupport.vue index 6c85fae..ba480ae 100644 --- a/04.系统编码/Frontend/src/components/DecisionSupport.vue +++ b/04.系统编码/Frontend/src/components/DecisionSupport.vue @@ -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 { diff --git a/04.系统编码/Frontend/src/components/SynergyEvaluation.vue b/04.系统编码/Frontend/src/components/SynergyEvaluation.vue index 036843f..f4252b2 100644 --- a/04.系统编码/Frontend/src/components/SynergyEvaluation.vue +++ b/04.系统编码/Frontend/src/components/SynergyEvaluation.vue @@ -131,6 +131,7 @@ import { format } from '../uilts/String'; import * as Tiff from 'browser-tiff.js'; import { SynergyEvaluationConfig } from '../uilts/Config'; +import { post } from '../uilts/axios'; export default { name: 'SynergyEvaluation', @@ -238,18 +239,15 @@ } const initImage = (tabName, elementName, type, index, values) => { - var xhr = new XMLHttpRequest(); - xhr.responseType = 'arraybuffer'; - xhr.open('GET', SynergyEvaluationConfig.getUrl(tabName, elementName, type)); - 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"); - values[index].imgUrl = image.src; - values[index].preview = [image.src]; - }; - xhr.send(); + post("/image/convert", {url: SynergyEvaluationConfig.getUrl(tabName, elementName, type)}).then((response: any) => { + if (response.error != 0){ + console.log("发生错误") + return; + } + + values[index].imgUrl = response.data; + values[index].preview = [response.data]; + }) } const onTabClick = (name) => { diff --git a/04.系统编码/Frontend/src/uilts/Config.ts b/04.系统编码/Frontend/src/uilts/Config.ts index 7f33d8a..6422b3c 100644 --- a/04.系统编码/Frontend/src/uilts/Config.ts +++ b/04.系统编码/Frontend/src/uilts/Config.ts @@ -8,7 +8,6 @@ export class Config { export class MicrowaveRadiationConfig { private static url: string = Config.parentUrl + "/weibo"; public static getUrl(station: string, type: string, time: Moment): string { - console.log(this.url+ '/' + station + '/' + type + '/' + time.format("YYYY/YYYYMM/YYYYMMDD/YYYYMMDDHHmmss.png")) return this.url+ '/' + station + '/' + type + '/' + time.format("YYYY/YYYYMM/YYYYMMDD/YYYYMMDDHHmmss.png"); } }