|
@@ -27,7 +27,7 @@
|
|
|
aria-label="Link"
|
|
|
aria-description="All Results"
|
|
|
:class="{ active: activeTabbar === -1 }"
|
|
|
- @click="activeTabbar = -1"
|
|
|
+ @click="handleActiveTab(-1)"
|
|
|
>
|
|
|
<p>All Results</p>
|
|
|
<p>({{ resultTotal }})</p>
|
|
@@ -39,7 +39,7 @@
|
|
|
aria-label="Link"
|
|
|
:aria-description="item.name"
|
|
|
:class="{ active: idx === activeTabbar }"
|
|
|
- @click="activeTabbar = idx"
|
|
|
+ @click="handleActiveTab(idx)"
|
|
|
>
|
|
|
<p>{{ item.name }}</p>
|
|
|
<p>({{ item.total }})</p>
|
|
@@ -65,7 +65,7 @@
|
|
|
<ul class="search-page-list">
|
|
|
<li
|
|
|
v-for="item in list"
|
|
|
- :key="item.name"
|
|
|
+ :key="item.id ? item.module + item.id : item.name"
|
|
|
class="search-page-item"
|
|
|
:class="{
|
|
|
'no-rtf': !item.rtf,
|
|
@@ -91,11 +91,8 @@
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
- <div v-if="list.length >= PAGE_SIZE" class="search-page__pagination">
|
|
|
- <Pagination
|
|
|
- :total="activeTabbar === -1 ? resultTotal : tabbar[activeTabbar].total"
|
|
|
- @change="handlePage"
|
|
|
- />
|
|
|
+ <div v-if="total >= PAGE_SIZE" class="search-page__pagination">
|
|
|
+ <Pagination :total="total" :page-size="PAGE_SIZE" @change="handlePage" />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -213,10 +210,12 @@ const getList = async () => {
|
|
|
return false;
|
|
|
|
|
|
return true;
|
|
|
- }).map((i) => ({
|
|
|
- ...i,
|
|
|
- rtf: getAbstract(i.rtf),
|
|
|
- }));
|
|
|
+ })
|
|
|
+ .splice(pageNum.value === 1 ? 0 : pageNum.value * PAGE_SIZE, PAGE_SIZE)
|
|
|
+ .map((i) => ({
|
|
|
+ ...i,
|
|
|
+ rtf: getAbstract(i.rtf),
|
|
|
+ }));
|
|
|
|
|
|
const BACKEND_MODULE_INDEX = [-1, 1, 2, 3, 4, 7];
|
|
|
const data = await searchApi({
|
|
@@ -261,6 +260,11 @@ const getList = async () => {
|
|
|
loading.value = false;
|
|
|
}
|
|
|
};
|
|
|
+const total = computed(() =>
|
|
|
+ activeTabbar.value === -1
|
|
|
+ ? resultTotal.value
|
|
|
+ : tabbar.value[activeTabbar.value].total
|
|
|
+);
|
|
|
|
|
|
watch(
|
|
|
route,
|
|
@@ -354,6 +358,11 @@ const handleClick = (item: SearchItem) => {
|
|
|
break;
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+const handleActiveTab = (idx: number) => {
|
|
|
+ pageNum.value = 1;
|
|
|
+ activeTabbar.value = idx;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|