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 * 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 {

22
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) => {

1
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");
}
}

2
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
})

Loading…
Cancel
Save