mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-08-21 10:27:15 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2322b2da15 |
@@ -150,6 +150,13 @@ const topics = ref(['最新回复', '最新', '排行榜' /*, '热门', '类别'
|
|||||||
const selectedTopic = ref(
|
const selectedTopic = ref(
|
||||||
route.query.view === 'ranking' ? '排行榜' : route.query.view === 'latest' ? '最新' : '最新回复',
|
route.query.view === 'ranking' ? '排行榜' : route.query.view === 'latest' ? '最新' : '最新回复',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (import.meta.client) {
|
||||||
|
const storedTopic = localStorage.getItem('home-selected-topic')
|
||||||
|
if (storedTopic && topics.value.includes(storedTopic)) {
|
||||||
|
selectedTopic.value = storedTopic
|
||||||
|
}
|
||||||
|
}
|
||||||
const articles = ref([])
|
const articles = ref([])
|
||||||
const page = ref(0)
|
const page = ref(0)
|
||||||
const pageSize = 10
|
const pageSize = 10
|
||||||
@@ -340,7 +347,10 @@ watch(
|
|||||||
watch([selectedCategory, selectedTags], () => {
|
watch([selectedCategory, selectedTags], () => {
|
||||||
loadOptions()
|
loadOptions()
|
||||||
})
|
})
|
||||||
watch(selectedTopic, () => {
|
watch(selectedTopic, (topic) => {
|
||||||
|
if (import.meta.client) {
|
||||||
|
localStorage.setItem('home-selected-topic', topic)
|
||||||
|
}
|
||||||
// 仅当需要额外选项时加载
|
// 仅当需要额外选项时加载
|
||||||
loadOptions()
|
loadOptions()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -204,32 +204,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="selectedTab === 'timeline'" class="profile-timeline">
|
<div v-else-if="selectedTab === 'timeline'" class="profile-timeline">
|
||||||
<div class="timeline-tabs">
|
|
||||||
<div
|
|
||||||
:class="['timeline-tab-item', { selected: timelineFilter === 'all' }]"
|
|
||||||
@click="timelineFilter = 'all'"
|
|
||||||
>
|
|
||||||
全部
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
:class="['timeline-tab-item', { selected: timelineFilter === 'articles' }]"
|
|
||||||
@click="timelineFilter = 'articles'"
|
|
||||||
>
|
|
||||||
文章
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
:class="['timeline-tab-item', { selected: timelineFilter === 'comments' }]"
|
|
||||||
@click="timelineFilter = 'comments'"
|
|
||||||
>
|
|
||||||
评论和回复
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<BasePlaceholder
|
<BasePlaceholder
|
||||||
v-if="filteredTimelineItems.length === 0"
|
v-if="timelineItems.length === 0"
|
||||||
text="暂无时间线"
|
text="暂无时间线"
|
||||||
icon="fas fa-inbox"
|
icon="fas fa-inbox"
|
||||||
/>
|
/>
|
||||||
<BaseTimeline :items="filteredTimelineItems">
|
<BaseTimeline :items="timelineItems">
|
||||||
<template #item="{ item }">
|
<template #item="{ item }">
|
||||||
<template v-if="item.type === 'post'">
|
<template v-if="item.type === 'post'">
|
||||||
发布了文章
|
发布了文章
|
||||||
@@ -344,15 +324,6 @@ const hotPosts = ref([])
|
|||||||
const hotReplies = ref([])
|
const hotReplies = ref([])
|
||||||
const hotTags = ref([])
|
const hotTags = ref([])
|
||||||
const timelineItems = ref([])
|
const timelineItems = ref([])
|
||||||
const timelineFilter = ref('all')
|
|
||||||
const filteredTimelineItems = computed(() => {
|
|
||||||
if (timelineFilter.value === 'articles') {
|
|
||||||
return timelineItems.value.filter((item) => item.type === 'post')
|
|
||||||
} else if (timelineFilter.value === 'comments') {
|
|
||||||
return timelineItems.value.filter((item) => item.type === 'comment' || item.type === 'reply')
|
|
||||||
}
|
|
||||||
return timelineItems.value
|
|
||||||
})
|
|
||||||
const followers = ref([])
|
const followers = ref([])
|
||||||
const followings = ref([])
|
const followings = ref([])
|
||||||
const medals = ref([])
|
const medals = ref([])
|
||||||
@@ -806,23 +777,6 @@ watch(selectedTab, async (val) => {
|
|||||||
width: 40%;
|
width: 40%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeline-tabs {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
border-bottom: 1px solid var(--normal-border-color);
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline-tab-item {
|
|
||||||
padding: 10px 20px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline-tab-item.selected {
|
|
||||||
color: var(--primary-color);
|
|
||||||
border-bottom: 2px solid var(--primary-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile-timeline {
|
.profile-timeline {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user