From 6a1d45e78da7eb5bbc040cc85d3d8e793bf2e3e4 Mon Sep 17 00:00:00 2001
From: hehongxing <hehongxing@pc.com>
Date: Fri, 3 Dec 2021 10:53:31 +0800
Subject: [PATCH 1/7] commit
---
.../src/components/DecisionSupport.vue | 4 ++
.../Frontend/src/components/Shared/Header.vue | 50 +++++++++----------
.../src/components/SynergyEvaluation.vue | 9 ++++
.../src/components/SystemManagement.vue | 2 +-
04.系统编码/Frontend/src/index.less | 5 +-
04.系统编码/Frontend/src/uilts/Config.ts | 10 ++--
6 files changed, 48 insertions(+), 32 deletions(-)
diff --git a/04.系统编码/Frontend/src/components/DecisionSupport.vue b/04.系统编码/Frontend/src/components/DecisionSupport.vue
index 5f5d283..5f57a23 100644
--- a/04.系统编码/Frontend/src/components/DecisionSupport.vue
+++ b/04.系统编码/Frontend/src/components/DecisionSupport.vue
@@ -176,6 +176,10 @@
.el-image {
height: calc(~"100% - 0.4rem");
margin-top: 0.1rem;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
}
}
}
diff --git a/04.系统编码/Frontend/src/components/Shared/Header.vue b/04.系统编码/Frontend/src/components/Shared/Header.vue
index 0003d26..8b9e3d5 100644
--- a/04.系统编码/Frontend/src/components/Shared/Header.vue
+++ b/04.系统编码/Frontend/src/components/Shared/Header.vue
@@ -5,37 +5,30 @@
南京生态环境评估决策平台
</div>
<div class="nav">
- <div class="nav-item" @click="onNavClick('MicrowaveRadiation')" :class="{'active': currentPath === 'MicrowaveRadiation'}">微波辐射计</div>
- <div class="nav-item" @click="onNavClick('RamanLidar')" :class="{'active': currentPath === 'RamanLidar'}">拉曼激光雷达</div>
- <div class="nav-item" @click="onNavClick('SynergyEvaluation')" :class="{'active': currentPath === 'SynergyEvaluation'}">生态环境效应评估</div>
- <div class="nav-item" @click="onNavClick('DecisionSupport')" :class="{'active': currentPath === 'DecisionSupport'}">决策支持</div>
- <div class="nav-item" @click="onNavClick('SystemManagement')" :class="{'active': currentPath === 'SystemManagement'}">系统管理</div>
+ <div class="nav-item">
+ <router-link to="/MicrowaveRadiation">微波辐射计</router-link>
+ </div>
+ <div class="nav-item">
+ <router-link to="/RamanLidar">拉曼激光雷达</router-link>
+ </div>
+ <div class="nav-item">
+ <router-link to="/SynergyEvaluation">生态环境效应评估</router-link>
+ </div>
+ <div class="nav-item">
+ <router-link to="/DecisionSupport">决策支持</router-link>
+ </div>
+ <div class="nav-item">
+ <router-link to="/SystemManagement">系统管理</router-link>
+ </div>
</div>
</div>
</template>
<script lang="ts">
- import { reactive, onMounted, toRefs } from "vue";
- import { useRouter } from 'vue-router';
-
export default {
name: 'Header',
setup() {
- const router = useRouter();
-
- let options = reactive({
- currentPath: 'MicrowaveRadiation'
- })
-
- const onNavClick = (path) => {
- options.currentPath = path;
- router.push({path: path});
- }
-
- return {
- ...toRefs(options),
- onNavClick
- }
+ return {}
}
}
</script>
@@ -72,14 +65,19 @@
text-align: center;
cursor: pointer;
+ a {
+ height: 100%;
+ color: #ffffff;
+ }
+
&:nth-of-type(3) {
width: 2.3rem;
- &.active {
+ .active {
background: url("/images/nav-bg-big.png") no-repeat center/cover;
}
}
- &.active {
- color: #ffffff;
+ .active {
+ color: #23FBFF;
background: url("/images/nav-bg.png") no-repeat center/cover;
}
}
diff --git a/04.系统编码/Frontend/src/components/SynergyEvaluation.vue b/04.系统编码/Frontend/src/components/SynergyEvaluation.vue
index 4baf6a0..cc637f3 100644
--- a/04.系统编码/Frontend/src/components/SynergyEvaluation.vue
+++ b/04.系统编码/Frontend/src/components/SynergyEvaluation.vue
@@ -324,6 +324,14 @@
.el-image {
height: calc(~"100% - 0.4rem");
margin-top: 0.1rem;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ background-color: #ffffff;
+ .image-slot {
+ margin-top: 0;
+ }
}
}
}
@@ -342,6 +350,7 @@
display: flex;
align-items: center;
flex-direction: column;
+ justify-content: center;
}
&:nth-of-type(6n) {
diff --git a/04.系统编码/Frontend/src/components/SystemManagement.vue b/04.系统编码/Frontend/src/components/SystemManagement.vue
index d2affee..0da68e0 100644
--- a/04.系统编码/Frontend/src/components/SystemManagement.vue
+++ b/04.系统编码/Frontend/src/components/SystemManagement.vue
@@ -98,7 +98,7 @@ export default {
isDisabled:false,
title:'',
formLabelWidth:"100px",
- total:"",
+ total: "",
current:1,
size:10,
form:{
diff --git a/04.系统编码/Frontend/src/index.less b/04.系统编码/Frontend/src/index.less
index 465d9ec..616d408 100644
--- a/04.系统编码/Frontend/src/index.less
+++ b/04.系统编码/Frontend/src/index.less
@@ -401,6 +401,10 @@ img {
.el-image {
height: 90%;
margin: 0 auto;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
.el-image__inner {
width: auto;
@@ -418,7 +422,6 @@ img {
.image-slot {
width: 1.5rem;
height: 1.5rem;
- margin: 1rem auto 0 auto;
text-align: center;
display: flex;
align-items: center;
diff --git a/04.系统编码/Frontend/src/uilts/Config.ts b/04.系统编码/Frontend/src/uilts/Config.ts
index 1ae6b7a..6422b3c 100644
--- a/04.系统编码/Frontend/src/uilts/Config.ts
+++ b/04.系统编码/Frontend/src/uilts/Config.ts
@@ -1,8 +1,8 @@
import { Moment } from "moment";
-import { format } from "../uilts/String";
+import { format } from "./String";
export class Config {
- public static parentUrl: string = "http://112.124.40.88:8890/product/picture";
+ public static parentUrl: string = "http://112.124.40.88:8002/product/picture";
}
export class MicrowaveRadiationConfig {
@@ -21,13 +21,15 @@ export class RamanLidarConfig {
}
export class SynergyEvaluationConfig {
+ private static url: string = Config.parentUrl + "/images";
public static getUrl(tabName: string, elementName: string, type: string): string {
- return format('/images/ecological-environment/{0}/{1}/{2}.tif', tabName, elementName, type)
+ return format('{3}/ecological-environment/{0}/{1}/{2}.tif', tabName, elementName, type, this.url);
}
}
export class DecisionSupportConfig {
+ private static url: string = Config.parentUrl + "/images";
public static getUrl(productName: string, imgName: string): string {
- return format('/images/decision-support/{0}/{1}.tif', productName, imgName)
+ return format('{2}/decision-support/{0}/{1}.tif', productName, imgName, this.url);
}
}
\ No newline at end of file
From 714df4804ebb5e09aa0a284bb1c478ba76822315 Mon Sep 17 00:00:00 2001
From: xiaowuler <xiaowuler@163.com>
Date: Fri, 3 Dec 2021 11:00:29 +0800
Subject: [PATCH 2/7] modify some codes
---
.../backend/config/WebMvcConfig.java | 18 ++++++++++++++++++
.../Backend/src/main/resources/application.yml | 2 +-
04.系统编码/Frontend/src/hooks/Config.ts | 8 +++++---
04.系统编码/Frontend/src/uilts/axios.ts | 2 +-
4 files changed, 25 insertions(+), 5 deletions(-)
create mode 100644 04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java
diff --git a/04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java b/04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java
new file mode 100644
index 0000000..6ee580b
--- /dev/null
+++ b/04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java
@@ -0,0 +1,18 @@
+package com.userinformation.backend.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+/**
+ * @describe: 虚拟目录配置
+ * @author: xiaowuler
+ * @createTime: 2021-12-03 09:33
+ */
+@Configuration
+public class WebMvcConfig extends WebMvcConfigurerAdapter {
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("/product/**").addResourceLocations("file:D:\\Deployments\\LamanRadar\\product\\");
+ }
+}
diff --git a/04.系统编码/Backend/src/main/resources/application.yml b/04.系统编码/Backend/src/main/resources/application.yml
index 0680ca7..246ed6f 100644
--- a/04.系统编码/Backend/src/main/resources/application.yml
+++ b/04.系统编码/Backend/src/main/resources/application.yml
@@ -1,5 +1,5 @@
server:
- port: 8001
+ port: 8002
spring:
datasource:
url: jdbc:mysql://112.124.40.88:33306/user_information?useUnicode=true&characteEncoding=utf-8
diff --git a/04.系统编码/Frontend/src/hooks/Config.ts b/04.系统编码/Frontend/src/hooks/Config.ts
index 99de69f..6422b3c 100644
--- a/04.系统编码/Frontend/src/hooks/Config.ts
+++ b/04.系统编码/Frontend/src/hooks/Config.ts
@@ -2,7 +2,7 @@ import { Moment } from "moment";
import { format } from "./String";
export class Config {
- public static parentUrl: string = "http://112.124.40.88:8890/product/picture";
+ public static parentUrl: string = "http://112.124.40.88:8002/product/picture";
}
export class MicrowaveRadiationConfig {
@@ -21,13 +21,15 @@ export class RamanLidarConfig {
}
export class SynergyEvaluationConfig {
+ private static url: string = Config.parentUrl + "/images";
public static getUrl(tabName: string, elementName: string, type: string): string {
- return format('/images/ecological-environment/{0}/{1}/{2}.tif', tabName, elementName, type)
+ return format('{3}/ecological-environment/{0}/{1}/{2}.tif', tabName, elementName, type, this.url);
}
}
export class DecisionSupportConfig {
+ private static url: string = Config.parentUrl + "/images";
public static getUrl(productName: string, imgName: string): string {
- return format('/images/decision-support/{0}/{1}.tif', productName, imgName)
+ return format('{2}/decision-support/{0}/{1}.tif', productName, imgName, this.url);
}
}
\ No newline at end of file
diff --git a/04.系统编码/Frontend/src/uilts/axios.ts b/04.系统编码/Frontend/src/uilts/axios.ts
index a3de2a4..6d600b5 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://localhost:8002",
timeout: 500000
})
From 4faccf7446b028f9738c8dfc28475bd9253937b5 Mon Sep 17 00:00:00 2001
From: hehongxing <hehongxing@pc.com>
Date: Fri, 3 Dec 2021 11:31:14 +0800
Subject: [PATCH 3/7] commit
---
.../Frontend/src/components/DecisionSupport.vue | 12 ++++++------
.../Frontend/src/components/MicrowaveRadiation.vue | 2 +-
.../Frontend/src/components/RamanLidar.vue | 2 +-
.../Frontend/src/components/SynergyEvaluation.vue | 2 +-
04.系统编码/Frontend/src/uilts/Config.ts | 1 +
5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/04.系统编码/Frontend/src/components/DecisionSupport.vue b/04.系统编码/Frontend/src/components/DecisionSupport.vue
index 5f57a23..4c821d4 100644
--- a/04.系统编码/Frontend/src/components/DecisionSupport.vue
+++ b/04.系统编码/Frontend/src/components/DecisionSupport.vue
@@ -73,32 +73,32 @@
items: [{
title: '比湿',
imgName: 'TFLD_Q2',
- imgUrl: '',
+ imgUrl: '/images/null-picture.png',
preview: []
}, {
title: '风速和风向',
imgName: 'TFLD_V10',
- imgUrl: '',
+ imgUrl: '/images/null-picture.png',
preview: []
}, {
title: '降水',
imgName: 'TFLD_RAIN',
- imgUrl: '',
+ imgUrl: '/images/null-picture.png',
preview: []
}, {
title: '平均气温',
imgName: 'TFLD_T2',
- imgUrl: '',
+ imgUrl: '/images/null-picture.png',
preview: []
}, {
title: '最低温度',
imgName: 'TFLD_TN',
- imgUrl: '',
+ imgUrl: '/images/null-picture.png',
preview: []
}, {
title: '最高温度',
imgName: 'TFLD_TX',
- imgUrl: '',
+ imgUrl: '/images/null-picture.png',
preview: []
}],
indicatorImg: '/images/decision-support/pollution-indicator/pollution-indicator.png',
diff --git a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue
index 887d0c3..dfc361a 100644
--- a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue
+++ b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue
@@ -118,7 +118,7 @@
hours: [],
times: [],
currentTime: null,
- imgUrl: null,
+ imgUrl: '/images/null-picture.png',
srcList: [],
isPlay: false,
title: null,
diff --git a/04.系统编码/Frontend/src/components/RamanLidar.vue b/04.系统编码/Frontend/src/components/RamanLidar.vue
index 2df742e..3ebdd1b 100644
--- a/04.系统编码/Frontend/src/components/RamanLidar.vue
+++ b/04.系统编码/Frontend/src/components/RamanLidar.vue
@@ -97,7 +97,7 @@
hours: [],
times: [],
currentTime: null,
- imgUrl: null,
+ imgUrl: '/images/null-picture.png',
srcList: [],
isPlay: false,
title: null,
diff --git a/04.系统编码/Frontend/src/components/SynergyEvaluation.vue b/04.系统编码/Frontend/src/components/SynergyEvaluation.vue
index cc637f3..036843f 100644
--- a/04.系统编码/Frontend/src/components/SynergyEvaluation.vue
+++ b/04.系统编码/Frontend/src/components/SynergyEvaluation.vue
@@ -143,7 +143,7 @@
currentYear: '2000',
currentSurfaceTemperatureTime: 'time0130',
srcList: [],
- imgUrl: null,
+ imgUrl: '/images/null-picture.png',
imgUrls: [],
items: [{
title: '地表温度(01:30)',
diff --git a/04.系统编码/Frontend/src/uilts/Config.ts b/04.系统编码/Frontend/src/uilts/Config.ts
index 6422b3c..7f33d8a 100644
--- a/04.系统编码/Frontend/src/uilts/Config.ts
+++ b/04.系统编码/Frontend/src/uilts/Config.ts
@@ -8,6 +8,7 @@ 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");
}
}
From 830e9c15a3a4bfc2c0fb6862edc902dd94f19850 Mon Sep 17 00:00:00 2001
From: xiaowuler <xiaowuler@163.com>
Date: Fri, 3 Dec 2021 11:32:27 +0800
Subject: [PATCH 4/7] modify some codes
---
.../java/com/userinformation/backend/config/WebMvcConfig.java | 1 +
04.系统编码/Frontend/src/components/DecisionSupport.vue | 4 ++--
04.系统编码/Frontend/src/uilts/axios.ts | 3 ++-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java b/04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java
index 6ee580b..edc3787 100644
--- a/04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java
+++ b/04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java
@@ -2,6 +2,7 @@ package com.userinformation.backend.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
diff --git a/04.系统编码/Frontend/src/components/DecisionSupport.vue b/04.系统编码/Frontend/src/components/DecisionSupport.vue
index 5f57a23..15cc658 100644
--- a/04.系统编码/Frontend/src/components/DecisionSupport.vue
+++ b/04.系统编码/Frontend/src/components/DecisionSupport.vue
@@ -101,8 +101,8 @@
imgUrl: '',
preview: []
}],
- indicatorImg: '/images/decision-support/pollution-indicator/pollution-indicator.png',
- indicatorPreview: ['/images/decision-support/pollution-indicator/pollution-indicator.png']
+ indicatorImg: '/product/picture/images/decision-support/pollution-indicator/pollution-indicator.png',
+ indicatorPreview: ['/product/picture/images/decision-support/pollution-indicator/pollution-indicator.png']
})
onMounted(() => {
diff --git a/04.系统编码/Frontend/src/uilts/axios.ts b/04.系统编码/Frontend/src/uilts/axios.ts
index 6d600b5..7db59eb 100644
--- a/04.系统编码/Frontend/src/uilts/axios.ts
+++ b/04.系统编码/Frontend/src/uilts/axios.ts
@@ -5,7 +5,8 @@ import { ElLoading } from 'element-plus'
let loading = null;
const service = axios.create({
- baseURL:"http://localhost:8002",
+ // baseURL:"http://localhost:8002",
+ baseURL:"",
timeout: 500000
})
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 5/7] 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
})
From 5a2322d3b8abadf1f98ee59ed3fb366132492b6b Mon Sep 17 00:00:00 2001
From: xiaowuler <xiaowuler@163.com>
Date: Fri, 3 Dec 2021 13:48:47 +0800
Subject: [PATCH 6/7] modify some codes
---
04.系统编码/Backend/pom.xml | 1 +
.../backend/config/WebMvcConfig.java | 7 ++-
.../backend/controller/ImageController.java | 29 +++++++++++++
.../backend/service/ImageService.java | 43 +++++++++++++++++++
.../src/main/resources/application.yml | 4 ++
.../UserInformationApplicationTests.java | 12 +++++-
.../src/components/DecisionSupport.vue | 25 ++++++++---
04.系统编码/Frontend/src/uilts/axios.ts | 4 +-
8 files changed, 114 insertions(+), 11 deletions(-)
create mode 100644 04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/ImageController.java
create mode 100644 04.系统编码/Backend/src/main/java/com/userinformation/backend/service/ImageService.java
diff --git a/04.系统编码/Backend/pom.xml b/04.系统编码/Backend/pom.xml
index 22bce2b..992203d 100644
--- a/04.系统编码/Backend/pom.xml
+++ b/04.系统编码/Backend/pom.xml
@@ -51,6 +51,7 @@
<version>1.0.29</version>
</dependency>
+
</dependencies>
<build>
diff --git a/04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java b/04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java
index edc3787..2debb5a 100644
--- a/04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java
+++ b/04.系统编码/Backend/src/main/java/com/userinformation/backend/config/WebMvcConfig.java
@@ -1,5 +1,6 @@
package com.userinformation.backend.config;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
@@ -12,8 +13,12 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
*/
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
+
+ @Value("${custom.image.path}")
+ private String path;
+
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler("/product/**").addResourceLocations("file:D:\\Deployments\\LamanRadar\\product\\");
+ registry.addResourceHandler("/product/**").addResourceLocations("file:" + path + "/");
}
}
diff --git a/04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/ImageController.java b/04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/ImageController.java
new file mode 100644
index 0000000..18bd322
--- /dev/null
+++ b/04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/ImageController.java
@@ -0,0 +1,29 @@
+package com.userinformation.backend.controller;
+
+import java.io.IOException;
+
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.userinformation.backend.service.ImageService;
+import com.userinformation.backend.util.RequestResult;
+
+/**
+ * @describe: 图片处理控制层
+ * @author: xiaowuler
+ * @createTime: 2021-12-03 13:10
+ */
+@RestController
+@RequestMapping("image")
+public class ImageController {
+
+ private final ImageService imageService;
+ public ImageController(ImageService imageService){
+ this.imageService = imageService;
+ }
+
+ @PostMapping("convert")
+ public RequestResult convert(String url) throws IOException {
+ return RequestResult.success(imageService.convert(url));
+ }
+}
diff --git a/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/ImageService.java b/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/ImageService.java
new file mode 100644
index 0000000..3b979fa
--- /dev/null
+++ b/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/ImageService.java
@@ -0,0 +1,43 @@
+package com.userinformation.backend.service;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.util.Locale;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.util.Assert;
+
+/**
+ * @describe: 图片处理 逻辑层
+ * @author: xiaowuler
+ * @createTime: 2021-12-03 13:12
+ */
+@Service
+public class ImageService {
+
+ @Value("${custom.image.path}")
+ private String imagePath;
+
+ @Value("${custom.image.url}")
+ private String imageUrl;
+
+ private final static String TIF_FILE_SUFFIX = ".tif";
+ private final static String PNG_FILE_SUFFIX = ".png";
+
+ public String convert(String url) throws IOException {
+ String filepath = url.replace(imageUrl, imagePath);
+ File sourceFile = new File(filepath);
+ Assert.isTrue(sourceFile.exists(), "文件不存在");
+ Assert.isTrue(filepath.toLowerCase(Locale.ROOT).endsWith(TIF_FILE_SUFFIX), "文件格式不正确");
+ String targetFilePath = filepath.replace(TIF_FILE_SUFFIX, PNG_FILE_SUFFIX);
+ File targetFile = new File(targetFilePath);
+ if (!targetFile.exists()){
+ BufferedImage image = ImageIO.read(sourceFile);
+ ImageIO.write(image, "png", targetFile);
+ }
+ return targetFilePath.replace(imagePath, imageUrl);
+ }
+}
diff --git a/04.系统编码/Backend/src/main/resources/application.yml b/04.系统编码/Backend/src/main/resources/application.yml
index 246ed6f..69c8ccb 100644
--- a/04.系统编码/Backend/src/main/resources/application.yml
+++ b/04.系统编码/Backend/src/main/resources/application.yml
@@ -6,3 +6,7 @@ spring:
username: root
password: 3cqscbr@only1
driver-class-name: com.mysql.cj.jdbc.Driver
+custom:
+ image:
+ url: http://112.124.40.88:8002/product
+ path: D:/Deployments/LamanRadar/product
diff --git a/04.系统编码/Backend/src/test/java/com/userinformation/backend/UserInformationApplicationTests.java b/04.系统编码/Backend/src/test/java/com/userinformation/backend/UserInformationApplicationTests.java
index e184ec9..6d25383 100644
--- a/04.系统编码/Backend/src/test/java/com/userinformation/backend/UserInformationApplicationTests.java
+++ b/04.系统编码/Backend/src/test/java/com/userinformation/backend/UserInformationApplicationTests.java
@@ -1,5 +1,11 @@
package com.userinformation.backend;
+import javax.imageio.ImageIO;
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@@ -7,7 +13,11 @@ import org.springframework.boot.test.context.SpringBootTest;
class UserInformationApplicationTests {
@Test
- void contextLoads() {
+ void contextLoads() throws IOException {
+ File inputFile = new File("C:\\Users\\xiaowuler\\Desktop\\images\\decision-support\\plan-advice\\control-experiment\\TFLD_Q2.tif");
+ File outputFile = new File("C:\\Users\\xiaowuler\\Desktop\\output.png");
+ BufferedImage image = ImageIO.read(inputFile);
+ ImageIO.write(image, "png", outputFile);
}
}
diff --git a/04.系统编码/Frontend/src/components/DecisionSupport.vue b/04.系统编码/Frontend/src/components/DecisionSupport.vue
index ab19541..6c85fae 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 { get } from '../uilts/axios';
export default {
name: 'DecisionSupport',
@@ -128,18 +129,28 @@
}
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});
+ 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];
- };
- xhr.send();
+ })
+ // 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/uilts/axios.ts b/04.系统编码/Frontend/src/uilts/axios.ts
index 7db59eb..d18d47e 100644
--- a/04.系统编码/Frontend/src/uilts/axios.ts
+++ b/04.系统编码/Frontend/src/uilts/axios.ts
@@ -5,8 +5,8 @@ import { ElLoading } from 'element-plus'
let loading = null;
const service = axios.create({
- // baseURL:"http://localhost:8002",
- baseURL:"",
+ baseURL:"http://localhost:8002",
+ // baseURL:"",
timeout: 500000
})
From 9a07c6cac1d595aac7bdb59d3924bc83b0a871c2 Mon Sep 17 00:00:00 2001
From: hehongxing <hehongxing@pc.com>
Date: Fri, 3 Dec 2021 14:59:12 +0800
Subject: [PATCH 7/7] 111
---
.../Frontend/src/components/DecisionSupport.vue | 5 ++++-
.../Frontend/src/components/MicrowaveRadiation.vue | 5 ++++-
04.系统编码/Frontend/src/components/RamanLidar.vue | 3 +++
.../Frontend/src/components/SynergyEvaluation.vue | 8 +++++++-
4 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/04.系统编码/Frontend/src/components/DecisionSupport.vue b/04.系统编码/Frontend/src/components/DecisionSupport.vue
index ba480ae..383a551 100644
--- a/04.系统编码/Frontend/src/components/DecisionSupport.vue
+++ b/04.系统编码/Frontend/src/components/DecisionSupport.vue
@@ -31,12 +31,15 @@
:initial-index="0"
fit="contain"
>
- <template #error>
+ <template #error>
<div class="image-slot">
<img src="/images/null-picture.png" />
</div>
<p class="image-tip">暂无图片</p>
</template>
+ <template #placeholder>
+ <div class="image-placeholder">正在加载...</div>
+ </template>
</el-image>
</el-col>
</el-row>
diff --git a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue
index dfc361a..b476a33 100644
--- a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue
+++ b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue
@@ -74,7 +74,7 @@
<div class="picture-view">
<span class="arrow arrow-prev" @click="onPrevImgClick"><img src="/images/prev-btn.png" /></span>
<span class="arrow arrow-next" @click="onNextImgClick"><img src="/images/next-btn.png" /></span>
- <span class="save-btn"><img src="/images/save.png" /></span>
+ <a href="/images/picture1.png" download class="save-btn"><img src="/images/save.png" /></a>
<div class="picture-container">
<h2 class="title">{{title}}</h2>
<div class="picture">
@@ -90,6 +90,9 @@
</div>
<p class="image-tip">暂无图片</p>
</template>
+ <template #placeholder>
+ <div class="image-placeholder">正在加载...</div>
+ </template>
</el-image>
</div>
</div>
diff --git a/04.系统编码/Frontend/src/components/RamanLidar.vue b/04.系统编码/Frontend/src/components/RamanLidar.vue
index 3ebdd1b..a2fd0d8 100644
--- a/04.系统编码/Frontend/src/components/RamanLidar.vue
+++ b/04.系统编码/Frontend/src/components/RamanLidar.vue
@@ -71,6 +71,9 @@
</div>
<p class="image-tip">暂无图片</p>
</template>
+ <template #placeholder>
+ <div class="image-placeholder">正在加载...</div>
+ </template>
</el-image>
</div>
</div>
diff --git a/04.系统编码/Frontend/src/components/SynergyEvaluation.vue b/04.系统编码/Frontend/src/components/SynergyEvaluation.vue
index f4252b2..7c1bb14 100644
--- a/04.系统编码/Frontend/src/components/SynergyEvaluation.vue
+++ b/04.系统编码/Frontend/src/components/SynergyEvaluation.vue
@@ -99,6 +99,9 @@
</div>
<p class="image-tip">暂无图片</p>
</template>
+ <template #placeholder>
+ <div class="image-placeholder">正在加载...</div>
+ </template>
</el-image>
</el-col>
</el-row>
@@ -112,12 +115,15 @@
:initial-index="0"
fit="contain"
>
- <template #error>
+ <template #error>
<div class="image-slot">
<img src="/images/null-picture.png" />
</div>
<p class="image-tip">暂无图片</p>
</template>
+ <template #placeholder>
+ <div class="image-placeholder">正在加载...</div>
+ </template>
</el-image>
</el-col>
</el-row>