|
|
@ -68,13 +68,13 @@ |
|
|
|
</div> |
|
|
|
<div class="btns-group"> |
|
|
|
<span @click="onPlayClick">{{isPlay ? '暂停动画' : '播放动画'}}</span> |
|
|
|
<span>下载动画</span> |
|
|
|
<a @click="onDownloadClick">下载动画</a> <!-- :href=""--> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<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> |
|
|
|
<a href="/images/picture1.png" download class="save-btn"><img src="/images/save.png" /></a> |
|
|
|
<a :href="downloadImgUrl" download class="save-btn"><img src="/images/save.png" /></a> |
|
|
|
<div class="picture-container"> |
|
|
|
<h2 class="title">{{title}}</h2> |
|
|
|
<div class="picture"> |
|
|
@ -83,6 +83,7 @@ |
|
|
|
:preview-src-list="srcList" |
|
|
|
:initial-index="0" |
|
|
|
fit="contain" |
|
|
|
@load="onImageLoad" |
|
|
|
> |
|
|
|
<template #error> |
|
|
|
<div class="image-slot"> |
|
|
@ -122,6 +123,7 @@ |
|
|
|
times: [], |
|
|
|
currentTime: null, |
|
|
|
imgUrl: '/images/default-picture.png', |
|
|
|
downloadImgUrl: '/images/default-picture.png', |
|
|
|
srcList: [], |
|
|
|
isPlay: false, |
|
|
|
title: null, |
|
|
@ -190,6 +192,42 @@ |
|
|
|
options.srcList = [options.imgUrl]; |
|
|
|
} |
|
|
|
|
|
|
|
const onImageLoad = (event) => { |
|
|
|
if (event.currentTarget.getAttribute('src') !== '/images/default-picture.png') |
|
|
|
converToBase64(options.imgUrl); |
|
|
|
else |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
const onDownloadClick = () => { |
|
|
|
let params = { |
|
|
|
model: 'weibo', |
|
|
|
station: options.currentRegion, |
|
|
|
element: options.currentElement, |
|
|
|
type: options.currentTab, |
|
|
|
time: [options.times[0].date, options.times[options.times.length - 1].date], |
|
|
|
urls: [] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const converToBase64 = (path) => { |
|
|
|
let img = new Image(); |
|
|
|
img.src = path; |
|
|
|
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"); |
|
|
|
options.downloadImgUrl = base64; |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
const initTimeLine = () => { |
|
|
|
options.times = []; |
|
|
|
options.currentTime = moment(options.date).hour(parseInt(options.currentHour)).format('YYYY-MM-DD HH:mm'); |
|
|
@ -292,7 +330,7 @@ |
|
|
|
options.index = 0; |
|
|
|
|
|
|
|
setCurrentPlayElement(element); |
|
|
|
}, 2000) |
|
|
|
}, 5000) |
|
|
|
} |
|
|
|
|
|
|
|
const clearTimer = () => { |
|
|
@ -333,7 +371,9 @@ |
|
|
|
onNextImgClick, |
|
|
|
onRefreshClick, |
|
|
|
onPlayClick, |
|
|
|
onChange |
|
|
|
onChange, |
|
|
|
onImageLoad, |
|
|
|
onDownloadClick |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|