去除部分getters。未下载完成时,将按钮从隐藏改为禁用,修改接口路径(同步更新)

This commit is contained in:
chuzhongzai
2022-09-24 17:30:45 +08:00
parent c319c420c7
commit 3f0f24dab4
3 changed files with 51 additions and 50 deletions
+22 -29
View File
@@ -3,8 +3,8 @@ import axios from "axios"
import {ElMessage} from "element-plus"
import qs from "qs"
const BaseUrl = "http://downloader.lionwebsite.xyz/"
const GalleryTaskHandlerUrl = BaseUrl + "GalleryTaskHandler/"
const VideoTaskHandlerUrl = BaseUrl + "VideoTaskHandler/"
const GalleryTaskHandlerUrl = BaseUrl + "GalleryManage/"
const VideoTaskHandlerUrl = BaseUrl + "VideoManage/"
const actions = {
updateGalleryTasks(context){
@@ -121,6 +121,7 @@ const actions = {
context.dispatch("updateGalleryTasks").then()
context.dispatch("updateVideoTasks").then()
context.dispatch("loadMaskDomain").then()
context.dispatch("loadWeekUsedAmount").then()
setInterval(() => {
context.dispatch("update").then()
}, 30000)
@@ -143,6 +144,19 @@ const actions = {
}
})
},
loadWeekUsedAmount(context){
axios.get(GalleryTaskHandlerUrl + "weekUsedAmount", {
params: {
AuthCode: context.state.AuthCode
}
}).then((res) => {
if(res.data.result === "success"){
context.state.weekUsed = JSON.parse(res.data.data)
}else{
ElMessage("查询用量失败")
}
})
},
searchByLink(context, link){
context.commit("_searchByLink", link)
},
@@ -303,6 +317,7 @@ const mutations = {
if(data.gallery === false) {
state.preDownloadGallery.resolution = data.resolution
state.preDownloadGallery.fileSize = "等待下载完成后再查看"
state.preDownloadGallery.progress = "已提交"
state.totalGalleryTask.push(state.preDownloadGallery)
}
state.preDownloadGallery = data.gallery
@@ -312,6 +327,7 @@ const mutations = {
state.preDownloadVideo.resolution = data.resolution
state.preDownloadVideo.fileSize = "下载完成后再查看"
state.preDownloadVideo.duration = "下载完成后再查看"
state.preDownloadVideo.progress = "已提交"
state.totalVideoTask.push(state.preDownloadVideo)
}
state.preDownloadVideo = data.video
@@ -347,7 +363,8 @@ const state = {
isInclude:false, //是否搜索到任务
searchTask:[], //搜索到的任务
isShowHistory:false, //是否打开面板
showType:"gallery",
showType:"gallery", //展示类型
weekUsed:{},
maskDomain:[]
}
@@ -376,10 +393,10 @@ const getters = {
if(state.searchTask.length !== 0){
tasks = state.searchTask
}
else if(state.showHistory === "gallery")
else if(state.showType === "gallery")
if(state.totalGalleryTask.length !== 0)
tasks = state.totalGalleryTask
else if(state.showHistory === "video")
else if(state.showType === "video")
if(state.totalVideoTask.length)
tasks = state.totalVideoTask
if(!tasks)
@@ -389,30 +406,6 @@ const getters = {
max += 1
}
return max
},
isAuth(state){
return state.isAuth
},
page(state){
return state.page
},
loadComplete(state){
return state.loadComplete
},
preDownloadGallery(state){
return state.preDownloadGallery
},
preDownloadVideo(state){
return state.preDownloadVideo
},
isShowHistory(state){
return state.isShowHistory
},
showType(state){
return state.showType
},
maskDomain(state){
return state.maskDomain
}
}