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 index a71deb0..b4e7feb 100644 --- a/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/ImageService.java +++ b/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/ImageService.java @@ -66,7 +66,7 @@ public class ImageService { e.setRepeat(0); e.start(targetPath); for(File file : files){ - e.setDelay(500); + e.setDelay(1000); BufferedImage bufferedImage = ImageIO.read(file); e.addFrame(bufferedImage); } diff --git a/04.系统编码/Frontend/src/components/DecisionSupport.vue b/04.系统编码/Frontend/src/components/DecisionSupport.vue index 11a3084..dd24237 100644 --- a/04.系统编码/Frontend/src/components/DecisionSupport.vue +++ b/04.系统编码/Frontend/src/components/DecisionSupport.vue @@ -19,7 +19,10 @@
- + +
+ +
@@ -115,7 +118,8 @@ import { post } from '../uilts/axios'; preview: [] }], indicatorImg: '/product/picture/images/decision-support/pollution-indicator/pollution-indicator.png', - indicatorPreview: ['/product/picture/images/decision-support/pollution-indicator/pollution-indicator.png'] + indicatorPreview: ['/product/picture/images/decision-support/pollution-indicator/pollution-indicator.png'], + urls: [] }) onMounted(() => { @@ -138,6 +142,8 @@ import { post } from '../uilts/axios'; for(let index = 0; index < 6; index ++){ initImage(type, options.items[index].imgName, index); } + + options.urls = options.items; } const initImage = (type, imgName, index) => { @@ -152,10 +158,38 @@ import { post } from '../uilts/axios'; }) } + const onSaveClick = () => { + let pictures = document.getElementById('pictures'); + + for (let i = 0; i < options.urls.length; i++) { + let img = new Image(); + img.src = options.urls[i].imgUrl; + let canvas = document.createElement("canvas") as HTMLCanvasElement; + canvas.width = img.width; + canvas.height = img.height; + + let ctx = canvas.getContext("2d"); + let base64 = ''; + + img.setAttribute("crossOrigin",'Anonymous'); + img.onload = function() { + ctx.drawImage(img, 0, 0); + base64 = canvas.toDataURL("image/png"); + pictures.children[i].setAttribute('href', base64); + + let button: HTMLElement = pictures.children[i] as HTMLElement; + setTimeout(() => { + button.click(); + }, 500); + }; + } + } + return { ...toRefs(options), onIndicatorClick, - onProductClick + onProductClick, + onSaveClick } } } diff --git a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue index b358b8d..7582ddf 100644 --- a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue +++ b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue @@ -68,8 +68,8 @@
{{isPlay ? '暂停动画' : '播放动画'}} - 下载动画 - + 下载动画 +
@@ -119,7 +119,7 @@ import { post } from '../uilts/axios'; currentType: 'TEMP', currentElement: 'TEMPERATURE', currentCategory: 'CAPE', - date: moment('2020-07-01').format('YYYY-MM-DD'), + date: moment('2021-11-01').format('YYYY-MM-DD'), currentHour: '10', hours: [], times: [], @@ -208,13 +208,14 @@ import { post } from '../uilts/axios'; console.log(response.message); return; } - + fetch(response.data).then(res => { return res.blob(); }).then(blob => { let reader = new FileReader(); reader.onloadend = function(){ options.downloadSrc = reader.result; + setTimeout(() => { document.getElementById("weboDownload").click(); options.downloadSrc = null; @@ -229,7 +230,7 @@ import { post } from '../uilts/axios'; return { model: 'weibo', station: options.currentRegion, - elementCode: options.currentElement, + elementCode: options.currentType, type: options.currentTab, time: moment(options.times[0].date).format("YYYYMMDDHHmmss") + '-' + moment(options.times[options.times.length - 1].date).format("YYYYMMDDHHmmss"), urls: prepareUrls() @@ -238,9 +239,8 @@ import { post } from '../uilts/axios'; const prepareUrls = () => { let urls = []; - for(let index = 0, len = options.hours.length; index < len; index++){ - let date = moment(options.times[options.index].date); - let time = moment(options.date).hour(date.hour()).minute(date.minute()); + for(let index = 0, len = options.times.length; index < len; index++){ + let time = moment(options.times[index].date); let type = (options.currentTab === 'T-logP' || options.currentTab === 'BPFY') ? options.currentTab : (options.currentTab + '_' + options.currentType); urls.push(MicrowaveRadiationConfig.getUrl(options.currentRegion, type, time)); } @@ -322,7 +322,6 @@ import { post } from '../uilts/axios'; } const onPrevImgClick = () => { - console.log(options.index); let element = getCurrentElement(); options.index--; @@ -344,8 +343,15 @@ import { post } from '../uilts/axios'; const onRefreshClick = () => { cancelActive(); - options.date = moment('2020-07-01').format('YYYY-MM-DD'); + let element = getCurrentElement();; + options.currentHour = '10'; + options.date = moment('2021-11-01').format('YYYY-MM-DD'); + options.currentTime = moment(options.date).hour(parseInt(options.currentHour)).format('YYYY-MM-DD HH:mm'); + + setTitle(moment(options.currentTime, 'YYYY-MM-DD HH:mm')); + activeImage(moment(options.currentTime).hour(), moment(options.currentTime).minute()); + element.children[options.times.length - 1].classList.add('active'); } const onPlayClick = () => { @@ -360,7 +366,7 @@ import { post } from '../uilts/axios'; const timeExcute = () => { clearTimer(); - let element = getCurrentElement();; + let element = getCurrentElement(); timer = setInterval( () => { options.index++; diff --git a/04.系统编码/Frontend/src/components/RamanLidar.vue b/04.系统编码/Frontend/src/components/RamanLidar.vue index f39bba9..91bdc51 100644 --- a/04.系统编码/Frontend/src/components/RamanLidar.vue +++ b/04.系统编码/Frontend/src/components/RamanLidar.vue @@ -49,7 +49,8 @@
{{isPlay ? '暂停动画' : '播放动画'}} - 下载动画 + 下载动画 +
@@ -87,6 +88,7 @@ import { onMounted, reactive, toRefs } from 'vue'; import moment from "moment"; import { RamanLidarConfig } from '../uilts/Config'; +import { post } from '../uilts/axios'; export default { name: 'RamanLidar', @@ -96,7 +98,7 @@ currentRegion: 'jiangning', currentElement: 'lidar-ratio', currentType: '激光雷达比', - date: moment('2020-07-01').format('YYYY-MM-DD'), + date: moment('2021-11-01').format('YYYY-MM-DD'), currentHour: '10', hours: [], times: [], @@ -106,7 +108,8 @@ srcList: [], isPlay: false, title: null, - index: 0 + index: 0, + downloadSrc: null }) onMounted(() => { @@ -153,9 +156,48 @@ } const onDownloadClick = () => { - let params = { - station: options.currentRegion + post("/image/createGif", prepareParams(), 'application/json').then((response: any) => { + if (response.error != 0){ + console.log(response.message); + return; + } + + fetch(response.data).then(res => { + return res.blob(); + }).then(blob => { + let reader = new FileReader(); + reader.onloadend = function(){ + options.downloadSrc = reader.result; + + setTimeout(() => { + document.getElementById("radarDownload").click(); + options.downloadSrc = null; + }, 500); + }; + reader.readAsDataURL(blob); + }).catch(console.error); + }) + } + + const prepareParams = () => { + return { + model: 'radar', + station: options.currentRegion, + elementCode: options.currentElement, + type: null, + time: moment(options.times[0].date).format("YYYYMMDDHHmmss") + '-' + moment(options.times[options.times.length - 1].date).format("YYYYMMDDHHmmss"), + urls: prepareUrls() + } + } + + const prepareUrls = () => { + let urls = []; + for(let index = 0, len = options.times.length; index < len; index++){ + let time = moment(options.times[index].date); + urls.push(RamanLidarConfig.getUrl(options.currentRegion, options.currentElement, time)); } + + return urls; } const converToBase64 = (path) => { @@ -254,7 +296,8 @@ const onRefreshClick = () => { cancelActive(); - options.date = moment('2020-07-01').format('YYYY-MM-DD'); + options.date = moment('2021-11-01').format('YYYY-MM-DD'); + options.currentTime = options.times[options.times.length - 1]; options.currentHour = '10'; } diff --git a/04.系统编码/Frontend/src/components/SynergyEvaluation.vue b/04.系统编码/Frontend/src/components/SynergyEvaluation.vue index 721de81..ad51e91 100644 --- a/04.系统编码/Frontend/src/components/SynergyEvaluation.vue +++ b/04.系统编码/Frontend/src/components/SynergyEvaluation.vue @@ -50,7 +50,10 @@
- + +
+ +
地表温度(01:30) @@ -137,7 +140,7 @@ import { format } from '../uilts/String'; import * as Tiff from 'browser-tiff.js'; import { SynergyEvaluationConfig } from '../uilts/Config'; -import { post } from '../uilts/axios'; + import { post } from '../uilts/axios'; export default { name: 'SynergyEvaluation', @@ -231,7 +234,8 @@ import { post } from '../uilts/axios'; type: 'month_12', imgUrl: '/images/default-picture.png', preview: [] - }] + }], + urls: [] }) onMounted(() => { @@ -242,6 +246,7 @@ import { post } from '../uilts/axios'; for(let index = 0; index < number; index ++){ initImage(options.currentTab, element, values[index].type, index, values); } + options.urls = values; } const initImage = (tabName, elementName, type, index, values) => { @@ -253,7 +258,7 @@ import { post } from '../uilts/axios'; values[index].imgUrl = response.data; values[index].preview = [response.data]; - }) + }); } const onTabClick = (name) => { @@ -294,6 +299,33 @@ import { post } from '../uilts/axios'; setImage(12, options.trendItems, options.currentCategory + '/' + options.currentTime + '/' + options.currentYear); } + const onSaveClick = () => { + let pictures = document.getElementById('pictures'); + + for (let i = 0; i < options.urls.length; i++) { + let img = new Image(); + img.src = options.urls[i].imgUrl; + let canvas = document.createElement("canvas") as HTMLCanvasElement; + canvas.width = img.width; + canvas.height = img.height; + + let ctx = canvas.getContext("2d"); + let base64 = ''; + + img.setAttribute("crossOrigin",'Anonymous'); + img.onload = function() { + ctx.drawImage(img, 0, 0); + base64 = canvas.toDataURL("image/png"); + pictures.children[i].setAttribute('href', base64); + + let button: HTMLElement = pictures.children[i] as HTMLElement; + setTimeout(() => { + button.click(); + }, 500); + }; + } + } + return { ...toRefs(options), onTabClick, @@ -302,6 +334,7 @@ import { post } from '../uilts/axios'; onSurfaceTemperatureClick, onYearClick, onTimeClick, + onSaveClick } } } diff --git a/04.系统编码/Frontend/src/uilts/axios.ts b/04.系统编码/Frontend/src/uilts/axios.ts index d40b739..9f7069a 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://112.124.40.88:8002", - baseURL: "http://localhost:8002", + baseURL:"http://112.124.40.88:8002", + // baseURL: "http://localhost:8002", // baseURL: "", timeout: 500000 })