修复画廊下载按钮和下载链接
This commit is contained in:
parent
1542369770
commit
bd7fba5184
@ -84,7 +84,7 @@
|
|||||||
</table>
|
</table>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="postTask" v-if="chosenGallery.availableResolution">下载</el-button>
|
<el-button @click="postTask" v-if="chosenGallery.availableResolution">下载</el-button>
|
||||||
<el-button @click="window.open(chosenGallery.download)" v-else>下载文件</el-button>
|
<el-button @click="downloadChosenGallery" v-else-if="chosenGallery.status === '下载完成'">下载文件</el-button>
|
||||||
<el-button @click="readOnlineGallery(chosenGallery)">在线预览</el-button>
|
<el-button @click="readOnlineGallery(chosenGallery)">在线预览</el-button>
|
||||||
<el-button v-if="chosenGallery.status === '下载完成'" @click="deleteGallery">删除</el-button>
|
<el-button v-if="chosenGallery.status === '下载完成'" @click="deleteGallery">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -271,6 +271,13 @@ function deleteGallery(){
|
|||||||
store.dispatch("deleteGallery", chosenGallery.value.gid)
|
store.dispatch("deleteGallery", chosenGallery.value.gid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function downloadChosenGallery(){
|
||||||
|
if(chosenGallery.value.download)
|
||||||
|
window.open(chosenGallery.value.download)
|
||||||
|
else
|
||||||
|
ElMessage({message: "下载地址不存在,请刷新任务后重试", type: "error"})
|
||||||
|
}
|
||||||
|
|
||||||
function validate(){
|
function validate(){
|
||||||
if(AuthCode.value.trim() === ""){
|
if(AuthCode.value.trim() === ""){
|
||||||
ElMessage("请输入授权码后再验证")
|
ElMessage("请输入授权码后再验证")
|
||||||
@ -357,4 +364,4 @@ function saveConfig(){
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -64,8 +64,12 @@ const actions = {
|
|||||||
AuthCode: context.state.AuthCode
|
AuthCode: context.state.AuthCode
|
||||||
}
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if(res.data.result === 'success')
|
if(res.data.result === 'success'){
|
||||||
context.commit("_setChosenGallery", {gallery: JSON.parse(res.data.data)})
|
let gallery = JSON.parse(res.data.data)
|
||||||
|
if(gallery.status === "下载完成")
|
||||||
|
gallery.download = buildGalleryDownloadUrl(gallery.gid, context.state.AuthCode)
|
||||||
|
context.commit("_setChosenGallery", {gallery})
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ElMessage("查询失败")
|
ElMessage("查询失败")
|
||||||
})
|
})
|
||||||
@ -237,7 +241,7 @@ const mutations = {
|
|||||||
break;
|
break;
|
||||||
case "下载完成":
|
case "下载完成":
|
||||||
task.progress = task.status
|
task.progress = task.status
|
||||||
task.download = GalleryManageUrl + "/file/" + encodeURI(task.name) + ".zip?AuthCode=" + state.AuthCode + "&gid=" + task.gid
|
task.download = buildGalleryDownloadUrl(task.gid, state.AuthCode)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,6 +487,11 @@ function getShortname(name){
|
|||||||
return name.replace(/\s*\[[^\]]*\]\s*/g, '').replace(/\s*\([^\)]*\)\s*/g, '').trim()
|
return name.replace(/\s*\[[^\]]*\]\s*/g, '').replace(/\s*\([^\)]*\)\s*/g, '').trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildGalleryDownloadUrl(gid, AuthCode){
|
||||||
|
let params = new URLSearchParams({AuthCode, gid: gid.toString()})
|
||||||
|
return GalleryManageUrl + "/file/" + gid + ".zip?" + params.toString()
|
||||||
|
}
|
||||||
|
|
||||||
function confirmCurrentTask(state){
|
function confirmCurrentTask(state){
|
||||||
switch (state.category){
|
switch (state.category){
|
||||||
case 'myDownload':
|
case 'myDownload':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user