|
|
@ -69,7 +69,7 @@ |
|
|
|
<div class="btns-group"> |
|
|
|
<span @click="onPlayClick">{{isPlay ? '暂停动画' : '播放动画'}}</span> |
|
|
|
<a @click="onDownloadClick">下载动画</a> <!-- :href=""--> |
|
|
|
<a id="weboDownload" :download='downloadSrc' :href='downloadSrc'>下载隐藏层</a> |
|
|
|
<a id="weboDownload" download :href='downloadSrc' style="display: none;">下载隐藏层</a> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="picture-view"> |
|
|
@ -203,16 +203,25 @@ import { post } from '../uilts/axios'; |
|
|
|
} |
|
|
|
|
|
|
|
const onDownloadClick = () => { |
|
|
|
|
|
|
|
post("/image/createGif", prepareParams(), 'application/json').then((response: any) => { |
|
|
|
if (response.error != 0){ |
|
|
|
console.log(response.message); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
options.downloadSrc = response.data; |
|
|
|
console.log(response.data); |
|
|
|
document.getElementById("weboDownload").click(); |
|
|
|
|
|
|
|
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; |
|
|
|
}, 500); |
|
|
|
}; |
|
|
|
reader.readAsDataURL(blob); |
|
|
|
}).catch(console.error); |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|