From 2ec1aba1b347cb054de9588181222f6861ef4cb7 Mon Sep 17 00:00:00 2001
From: hehongxing <hehongxing@pc.com>
Date: Fri, 3 Dec 2021 13:47:06 +0800
Subject: [PATCH] commit

---
 .../src/components/DecisionSupport.vue        | 22 +++++++++----------
 .../src/components/SynergyEvaluation.vue      | 22 +++++++++----------
 04.系统编码/Frontend/src/uilts/Config.ts  |  1 -
 04.系统编码/Frontend/src/uilts/axios.ts   |  2 +-
 4 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/04.系统编码/Frontend/src/components/DecisionSupport.vue b/04.系统编码/Frontend/src/components/DecisionSupport.vue
index 4c821d4..ba480ae 100644
--- a/04.系统编码/Frontend/src/components/DecisionSupport.vue
+++ b/04.系统编码/Frontend/src/components/DecisionSupport.vue
@@ -63,6 +63,7 @@
     import { onMounted, reactive, toRefs } from 'vue';
     import * as Tiff from 'browser-tiff.js';
     import { DecisionSupportConfig } from '../uilts/Config';
+import { post } from '../uilts/axios';
     
     export default {
         name: 'DecisionSupport',
@@ -128,18 +129,15 @@
             }
 
             const initImage = (type, imgName, index) => {
-                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();
+                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];
+                })
             }
 
             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");
     }
 }
diff --git a/04.系统编码/Frontend/src/uilts/axios.ts b/04.系统编码/Frontend/src/uilts/axios.ts
index a3de2a4..06a683a 100644
--- a/04.系统编码/Frontend/src/uilts/axios.ts
+++ b/04.系统编码/Frontend/src/uilts/axios.ts
@@ -5,7 +5,7 @@ import { ElLoading } from 'element-plus'
 
 let loading = null;
 const service = axios.create({
-    baseURL:"http://localhost:8001",
+    baseURL:"http://112.124.40.88:8002",
     timeout: 500000
 })