处理里站搜索时没有搜索结果的情况。里站搜索时增加加载图标(同步更新)

This commit is contained in:
chuzhongzai 2023-03-31 22:09:32 +08:00
parent dc4960cdac
commit db0b6319cf
2 changed files with 34 additions and 11 deletions

View File

@ -84,7 +84,7 @@
<el-dialog title="里站搜索" v-model="isQuerying" top="0" style="margin-bottom: 0"> <el-dialog title="里站搜索" v-model="isQuerying" top="0" style="margin-bottom: 0">
<div style="text-align: center"> <div style="text-align: center">
<el-input v-model="keyword"></el-input> <el-button @click="queryGalleries(null)">查询</el-button> <el-input v-model="keyword"></el-input> <el-button @click="queryGalleries(null)">查询</el-button> <div id="loading"/>
</div> </div>
<el-scrollbar height="525px"> <el-scrollbar height="525px">
<div style="height: 251px; width: 100%; background-color: #f5f5f5; border-radius: 5px" v-for="gallery in galleries"> <div style="height: 251px; width: 100%; background-color: #f5f5f5; border-radius: 5px" v-for="gallery in galleries">
@ -228,19 +228,25 @@ function queryGalleries(link){
tempParam = keyword.value tempParam = keyword.value
} }
tempParam = tempParam.replace(" ", "+") tempParam = tempParam.replace(" ", "+")
document.getElementById("loading").style.display = "inline-block";
axios.get("http://downloader.lionwebsite.xyz/query?keyword=" + tempParam) axios.get("http://downloader.lionwebsite.xyz/query?keyword=" + tempParam)
.then((res) => { .then((res) => {
let tempGalleries = JSON.parse(res.data.data) document.getElementById("loading").style.display = "none";
queryPage.value.first = 'first' in res.data? res.data.first: undefined if (res.data.result === "success") {
queryPage.value.previous = 'previous' in res.data? res.data.previous: undefined let tempGalleries = JSON.parse(res.data.data)
queryPage.value.next = 'next' in res.data? res.data.next: undefined queryPage.value.first = 'first' in res.data ? res.data.first : undefined
queryPage.value.last = 'last' in res.data? res.data.last: 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) galleries.value.splice(0)
tempGalleries.forEach((gallery) => { tempGalleries.forEach((gallery) => {
galleries.value.push(gallery) galleries.value.push(gallery)
}) })
}else {
ElMessage({message: res.data.data, type: "error"})
}
}) })
} }
@ -305,4 +311,18 @@ onMounted(() => {
.el-input{ .el-input{
width: 300px; width: 300px;
} }
#loading {
width: 25px;
height: 25px;
border: 2px solid #ccc;
border-top-color: #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
display: none;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
</style> </style>

View File

@ -2,7 +2,10 @@
<div class="side" style="width: 100%"> <div class="side" style="width: 100%">
<span v-show="loadComplete">本子历史</span> <span v-show="loadComplete">本子历史</span>
<div v-show="loadComplete" class="load_complete"> <div v-show="loadComplete" class="load_complete">
<el-table :data="currentTasks" :empty-text="emptyText" :row-key="gallery=>gallery.gid"> <el-table :data="currentTasks"
:empty-text="emptyText"
:row-key="gallery=>gallery.gid"
>
<el-table-column type="expand"> <el-table-column type="expand">
<template #default="props"> <template #default="props">