Browse Source

commit

master
hehongxing 3 years ago
parent
commit
2ec1aba1b3
  1. 22
      04.系统编码/Frontend/src/components/DecisionSupport.vue
  2. 22
      04.系统编码/Frontend/src/components/SynergyEvaluation.vue
  3. 1
      04.系统编码/Frontend/src/uilts/Config.ts
  4. 2
      04.系统编码/Frontend/src/uilts/axios.ts

22
04.系统编码/Frontend/src/components/DecisionSupport.vue

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

22
04.系统编码/Frontend/src/components/SynergyEvaluation.vue

@ -131,6 +131,7 @@
import { format } from '../uilts/String'; import { format } from '../uilts/String';
import * as Tiff from 'browser-tiff.js'; import * as Tiff from 'browser-tiff.js';
import { SynergyEvaluationConfig } from '../uilts/Config'; import { SynergyEvaluationConfig } from '../uilts/Config';
import { post } from '../uilts/axios';
export default { export default {
name: 'SynergyEvaluation', name: 'SynergyEvaluation',
@ -238,18 +239,15 @@
} }
const initImage = (tabName, elementName, type, index, values) => { const initImage = (tabName, elementName, type, index, values) => {
var xhr = new XMLHttpRequest(); post("/image/convert", {url: SynergyEvaluationConfig.getUrl(tabName, elementName, type)}).then((response: any) => {
xhr.responseType = 'arraybuffer'; if (response.error != 0){
xhr.open('GET', SynergyEvaluationConfig.getUrl(tabName, elementName, type)); console.log("发生错误")
xhr.onload = function (e) { return;
let tiff = new Tiff({buffer: xhr.response}); }
let canvas = tiff.toCanvas();
let image = new Image(); values[index].imgUrl = response.data;
image.src = canvas.toDataURL("image/png"); values[index].preview = [response.data];
values[index].imgUrl = image.src; })
values[index].preview = [image.src];
};
xhr.send();
} }
const onTabClick = (name) => { const onTabClick = (name) => {

1
04.系统编码/Frontend/src/uilts/Config.ts

@ -8,7 +8,6 @@ export class Config {
export class MicrowaveRadiationConfig { export class MicrowaveRadiationConfig {
private static url: string = Config.parentUrl + "/weibo"; private static url: string = Config.parentUrl + "/weibo";
public static getUrl(station: string, type: string, time: Moment): string { 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"); return this.url+ '/' + station + '/' + type + '/' + time.format("YYYY/YYYYMM/YYYYMMDD/YYYYMMDDHHmmss.png");
} }
} }

2
04.系统编码/Frontend/src/uilts/axios.ts

@ -5,7 +5,7 @@ import { ElLoading } from 'element-plus'
let loading = null; let loading = null;
const service = axios.create({ const service = axios.create({
baseURL:"http://localhost:8001", baseURL:"http://112.124.40.88:8002",
timeout: 500000 timeout: 500000
}) })

Loading…
Cancel
Save