上线里站搜索,修复提交任务后看不到downloader的bug,修复提交任务后再次查询可以直接操作的bug(同步更新)

This commit is contained in:
chuzhongzai 2023-03-18 12:59:15 +08:00
parent 38267a076a
commit dc4960cdac
2 changed files with 64 additions and 2 deletions

View File

@ -23,6 +23,7 @@
<el-button @click="isAlterAuthCode = true">修改授权码</el-button> <el-button @click="isAlterAuthCode = true">修改授权码</el-button>
<el-button @click="deleteAuthCode">删除本地授权码</el-button> <el-button @click="deleteAuthCode">删除本地授权码</el-button>
<hr> <hr>
<el-button @click="isQuerying = true">里站搜索</el-button><hr>
<div v-show="thumbnailGallery !== {}"> <div v-show="thumbnailGallery !== {}">
<span> <span>
{{thumbnailGallery.shortName}}<br> {{thumbnailGallery.shortName}}<br>
@ -50,7 +51,7 @@
</tr> </tr>
</table> </table>
<el-button @click="postTask" v-if="chosenGallery.availableResolution">下载</el-button> <el-button @click="postTask" v-if="chosenGallery.availableResolution">下载</el-button>
<tr v-if="!chosenGallery.availableResolution"> <tr v-if="chosenGallery.status === '下载完成'">
<el-button @click="onlineGalleryReader(chosenGallery.gid)">在线预览</el-button> <el-button @click="onlineGalleryReader(chosenGallery.gid)">在线预览</el-button>
<el-button @click="showThumbnailGallery(chosenGallery)">查看封面图</el-button> <el-button @click="showThumbnailGallery(chosenGallery)">查看封面图</el-button>
<el-button @click="deleteGallery">删除</el-button> <el-button @click="deleteGallery">删除</el-button>
@ -81,6 +82,36 @@
</el-footer> </el-footer>
</el-dialog> </el-dialog>
<el-dialog title="里站搜索" v-model="isQuerying" top="0" style="margin-bottom: 0">
<div style="text-align: center">
<el-input v-model="keyword"></el-input> <el-button @click="queryGalleries(null)">查询</el-button>
</div>
<el-scrollbar height="525px">
<div style="height: 251px; width: 100%; background-color: #f5f5f5; border-radius: 5px" v-for="gallery in galleries">
<el-image alt="picture" :preview-src-list="['http://downloader.lionwebsite.xyz/query/image?path=' + gallery.thumbnailUrl,]"
:src="'http://downloader.lionwebsite.xyz/query/image?path=' + gallery.thumbnailUrl"
style="height:250px;width:250px;float: left;"
fit="contain"
loading="lazy"
/>
<div style="font: bold 16px semi-condensed; margin-top: 10px; padding-top: 15px; padding-left: 275px">
<span>{{gallery.name}}</span><br><br>
<span>上传时间{{gallery.uploadTime}}</span><br>
<span>页数{{gallery.page}}</span><br>
<span class="ct6">类型{{gallery.type}}</span><br>
<a :href="gallery.link">链接</a><br>
<el-button style="position: relative; margin-left: 80%" @click="param=gallery.link; queryRemoteTask()">下载</el-button>
</div>
</div><br>
</el-scrollbar>
<div style="padding-top: 10px; text-align: center">
<el-button @click="queryGalleries(queryPage.first)" :disabled="queryPage.first === undefined">首页</el-button>
<el-button @click="queryGalleries(queryPage.previous)" :disabled="queryPage.previous === undefined">上一页</el-button>
<el-button @click="queryGalleries(queryPage.next)" :disabled="queryPage.next === undefined">下一页</el-button>
<el-button @click="queryGalleries(queryPage.last)" :disabled="queryPage.last === undefined">尾页</el-button>
</div>
</el-dialog>
<div class="DashBoard" v-show="!loadComplete"> <div class="DashBoard" v-show="!loadComplete">
<el-input v-model="AuthCode" placeholder="请输入授权码" style="padding-top: 200px"/> <br> <el-input v-model="AuthCode" placeholder="请输入授权码" style="padding-top: 200px"/> <br>
<el-checkbox v-model="isRemember">是否记住授权码</el-checkbox> <el-checkbox v-model="isRemember">是否记住授权码</el-checkbox>
@ -92,6 +123,7 @@
import store from "../store"; import store from "../store";
import {computed, ref, onMounted} from "vue"; import {computed, ref, onMounted} from "vue";
import {ElMessage} from "element-plus" import {ElMessage} from "element-plus"
import axios from "axios";
// //
let AuthCode = ref("") let AuthCode = ref("")
@ -100,6 +132,11 @@ let isAlterAuthCode = ref(false)
let newAuthCode = ref("") let newAuthCode = ref("")
let tempAuthCode = ref("") let tempAuthCode = ref("")
let isQuerying = ref(false)
let keyword = ref("")
let galleries = ref([])
let queryPage = ref({})
// //
let type = ref("link") let type = ref("link")
let param = ref("") let param = ref("")
@ -182,6 +219,30 @@ function resetLocalQuery(){
store.commit("_searchLocalByTag", ['']) store.commit("_searchLocalByTag", [''])
param.value = "" param.value = ""
} }
function queryGalleries(link){
let tempParam
if(link !== null) {
let url = new URL(link)
tempParam = url.search.replace("?f_search=", "")
}else{
tempParam = keyword.value
}
tempParam = tempParam.replace(" ", "+")
axios.get("http://downloader.lionwebsite.xyz/query?keyword=" + tempParam)
.then((res) => {
let tempGalleries = JSON.parse(res.data.data)
queryPage.value.first = 'first' in res.data? res.data.first: undefined
queryPage.value.previous = 'previous' in res.data? res.data.previous: undefined
queryPage.value.next = 'next' in res.data? res.data.next: undefined
queryPage.value.last = 'last' in res.data? res.data.last: undefined
galleries.value.splice(0)
tempGalleries.forEach((gallery) => {
galleries.value.push(gallery)
})
})
}
function deleteGallery(){ function deleteGallery(){
store.dispatch("deleteGallery", chosenGallery.value.gid) store.dispatch("deleteGallery", chosenGallery.value.gid)

View File

@ -432,6 +432,7 @@ const mutations = {
state.chosenGallery.createTimeDisplay = "等待下载完成后再查看" state.chosenGallery.createTimeDisplay = "等待下载完成后再查看"
state.chosenGallery.progress = "已提交" state.chosenGallery.progress = "已提交"
state.chosenGallery.tag = "" state.chosenGallery.tag = ""
state.chosenGallery.downloader = state.userId
state.totalGalleryTask.push(state.chosenGallery) state.totalGalleryTask.push(state.chosenGallery)
state.downloadGallery.push(state.chosenGallery) state.downloadGallery.push(state.chosenGallery)
} }
@ -614,6 +615,6 @@ function deleteTask(tasks, key, value){
for(let i=0; i<tasks[j].length; i++) for(let i=0; i<tasks[j].length; i++)
if(tasks[j][i][key] === value){ if(tasks[j][i][key] === value){
tasks[j].splice(i, 1) tasks[j].splice(i, 1)
break return
} }
} }