Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #60 from k99k5/main
Browse files Browse the repository at this point in the history
Beta 0.32
  • Loading branch information
k99k5 committed Feb 25, 2024
2 parents d8f40d8 + a68ecec commit 60b00fd
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 23 deletions.
6 changes: 6 additions & 0 deletions src/components/views/NovelList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,12 @@ onServerData((res) => {
onServerPrefetch(() => {
const instance = getCurrentInstance();
return loadData().then((res) => {
if (res.data) {
res.data = res.data.map(item => {
item.desc = item.desc.replace('\r', '');
return item;
});
}
provideServerData({
reqId: ssrId,
data: res,
Expand Down
106 changes: 83 additions & 23 deletions src/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,43 @@
<template>
<div class="flex h-full w-full flex-col">
<div class="flex flex-1 flex-col rounded bg-white p-10 text-black max-sm:p-3 dark:bg-surface-600 dark:text-white">
<div class="m-2 flex items-center justify-between">
<div class="text-2xl font-bold">热门精选</div>
<router-link :to="{name:'list'}" :draggable="false">
<Button class="mr-2 text-sm text-primary-500 dark:text-white" label="查看更多" size="small" text>
查看更多
<div class="ml-2 fa-regular fa-chevron-right"></div>
</Button>
</router-link>
<div class="flex flex-1 flex-wrap max-sm:flex-col">
<div class="flex flex-[2] flex-col rounded bg-white text-black max-sm:p-3 dark:bg-surface-600 dark:text-white">
<div class="m-2 flex items-center justify-between">
<div class="text-2xl font-bold">热门精选</div>
<router-link :to="{name:'list'}" :draggable="false">
<Button class="mr-2 text-sm text-primary-500 dark:text-white" label="查看更多" size="small"
text>
查看更多
<div class="ml-2 fa-regular fa-chevron-right"></div>
</Button>
</router-link>
</div>
<NovelList v-ssr type="popular" order="desc" listStyle="style1" :desc="false" :author="false"
:tags="null"
:limit="15"
:userId="null" :keyword="null" :ids="null"/>
</div>
<div class="flex flex-1 flex-col rounded bg-white text-black max-sm:p-3 dark:bg-surface-600 dark:text-white">
<div class="m-2 flex items-center justify-between">
<div class="text-2xl font-bold">随便看看</div>
<Button class="mr-2 text-sm text-primary-500 dark:text-white" label="刷新一下" size="small"
text @click="refreshRandomList">
刷新一下
<div class="ml-2 fa-regular fa-rotate-right"></div>
</Button>
</div>
<NovelList ref="randomList" v-ssr type="random" order="desc" listStyle="style2" :desc="false"
:author="false"
:tags="null"
:limit="4"
:userId="null" :keyword="null" :ids="null"/>
</div>
</div>
<NovelList v-ssr type="popular" order="desc" listStyle="style1" :desc="false" :author="false" :tags="null"
:limit="16"
:userId="null" :keyword="null" :ids="null"/>
</div>

<div class="flex flex-1 flex-col rounded bg-white p-10 text-black max-sm:p-3 dark:bg-surface-600 dark:text-white">
<div class="m-2 flex items-center justify-between">
<div class="text-2xl font-bold">按种族</div>
<div class="text-2xl font-bold">种族</div>
</div>
<div class="">
<div class="flex flex-1 flex-wrap max-sm:flex-col">
Expand All @@ -33,9 +53,9 @@
</Button>
</router-link>
</div>
<NovelList v-ssr type="popular" order="desc" listStyle="style1" :desc="false" :author="false"
<NovelList v-ssr type="popular" order="desc" listStyle="style2" :desc="false" :author="false"
:tags="['']"
:limit="4"
:limit="3"
:userId="null" :keyword="null" :ids="null"/>
</div>
<div class="flex flex-1 flex-col rounded bg-white text-black max-sm:p-3 dark:bg-surface-600 dark:text-white">
Expand All @@ -50,13 +70,11 @@
</Button>
</router-link>
</div>
<NovelList v-ssr type="popular" order="desc" listStyle="style1" :desc="false" :author="false"
<NovelList v-ssr type="popular" order="desc" listStyle="style2" :desc="false" :author="false"
:tags="['']"
:limit="4"
:limit="3"
:userId="null" :keyword="null" :ids="null"/>
</div>
</div>
<div class="flex flex-1 flex-wrap max-sm:flex-col">
<div class="flex flex-1 flex-col rounded bg-white text-black max-sm:p-3 dark:bg-surface-600 dark:text-white">
<div class="m-2 flex items-center justify-between">
<div class="text-xl font-bold">狼</div>
Expand All @@ -69,11 +87,13 @@
</Button>
</router-link>
</div>
<NovelList v-ssr type="popular" order="desc" listStyle="style1" :desc="false" :author="false"
<NovelList v-ssr type="popular" order="desc" listStyle="style2" :desc="false" :author="false"
:tags="['']"
:limit="4"
:limit="3"
:userId="null" :keyword="null" :ids="null"/>
</div>
</div>
<div class="flex flex-1 flex-wrap max-sm:flex-col">
<div class="flex flex-1 flex-col rounded bg-white text-black max-sm:p-3 dark:bg-surface-600 dark:text-white">
<div class="m-2 flex items-center justify-between">
<div class="text-xl font-bold">狗</div>
Expand All @@ -86,9 +106,43 @@
</Button>
</router-link>
</div>
<NovelList v-ssr type="popular" order="desc" listStyle="style1" :desc="false" :author="false"
<NovelList v-ssr type="popular" order="desc" listStyle="style2" :desc="false" :author="false"
:tags="['']"
:limit="4"
:limit="3"
:userId="null" :keyword="null" :ids="null"/>
</div>
<div class="flex flex-1 flex-col rounded bg-white text-black max-sm:p-3 dark:bg-surface-600 dark:text-white">
<div class="m-2 flex items-center justify-between">
<div class="text-xl font-bold">猫</div>
<router-link :to="{name:'list',query:{type:'popular',tags:''}}" :draggable="false">
<Button class="mr-2 text-sm text-primary-500 dark:text-white" label="查看更多"
size="small"
text>
查看更多
<div class="ml-2 fa-regular fa-chevron-right"></div>
</Button>
</router-link>
</div>
<NovelList v-ssr type="popular" order="desc" listStyle="style2" :desc="false" :author="false"
:tags="['']"
:limit="3"
:userId="null" :keyword="null" :ids="null"/>
</div>
<div class="flex flex-1 flex-col rounded bg-white text-black max-sm:p-3 dark:bg-surface-600 dark:text-white">
<div class="m-2 flex items-center justify-between">
<div class="text-xl font-bold">狐</div>
<router-link :to="{name:'list',query:{type:'popular',tags:''}}" :draggable="false">
<Button class="mr-2 text-sm text-primary-500 dark:text-white" label="查看更多"
size="small"
text>
查看更多
<div class="ml-2 fa-regular fa-chevron-right"></div>
</Button>
</router-link>
</div>
<NovelList v-ssr type="popular" order="desc" listStyle="style2" :desc="false" :author="false"
:tags="['']"
:limit="3"
:userId="null" :keyword="null" :ids="null"/>
</div>
</div>
Expand Down Expand Up @@ -116,6 +170,12 @@
import dialog from '@/utils/dialog.js';
import NovelList from '@/components/views/NovelList.vue';
const randomList = ref(null);
function refreshRandomList() {
randomList.value.reload();
}
onServerPrefetch(() => {
});
</script>
6 changes: 6 additions & 0 deletions src/pages/info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ function loadData() {
id: data.id,
onCache: (novel) => {
data.novel = novel;
if (data.novel) {
data.novel.desc = data.novel.desc.replace('\r', '');
}
hitCaches.push('novel');
if (hitCaches.length === 2) {
data.loading = false;
Expand All @@ -448,6 +451,9 @@ function loadData() {
ignoreReq: import.meta.env.SSR,
}).then((novel) => {
data.novel = novel;
if (data.novel) {
data.novel.desc = data.novel.desc.replace('\r', '');
}
}).catch((e) => {
data.novel = null;
})
Expand Down

0 comments on commit 60b00fd

Please sign in to comment.