From 2322b2da1514fc0bd86b9a3407ca91bb878ff017 Mon Sep 17 00:00:00 2001 From: Tim <135014430+nagisa77@users.noreply.github.com> Date: Sat, 16 Aug 2025 16:10:37 +0800 Subject: [PATCH 1/9] feat: remember selected tab --- frontend_nuxt/pages/index.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend_nuxt/pages/index.vue b/frontend_nuxt/pages/index.vue index bb8eee891..491424d72 100644 --- a/frontend_nuxt/pages/index.vue +++ b/frontend_nuxt/pages/index.vue @@ -150,6 +150,13 @@ const topics = ref(['最新回复', '最新', '排行榜' /*, '热门', '类别' const selectedTopic = ref( 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 page = ref(0) const pageSize = 10 @@ -340,7 +347,10 @@ watch( watch([selectedCategory, selectedTags], () => { loadOptions() }) -watch(selectedTopic, () => { +watch(selectedTopic, (topic) => { + if (import.meta.client) { + localStorage.setItem('home-selected-topic', topic) + } // 仅当需要额外选项时加载 loadOptions() }) From 2f29946b11bb02ac03bb579e49617598a93657f0 Mon Sep 17 00:00:00 2001 From: tim Date: Sat, 16 Aug 2025 16:19:23 +0800 Subject: [PATCH 2/9] Revert "feat: remember selected tab" This reverts commit 2322b2da1514fc0bd86b9a3407ca91bb878ff017. --- frontend_nuxt/pages/index.vue | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/frontend_nuxt/pages/index.vue b/frontend_nuxt/pages/index.vue index 491424d72..bb8eee891 100644 --- a/frontend_nuxt/pages/index.vue +++ b/frontend_nuxt/pages/index.vue @@ -150,13 +150,6 @@ const topics = ref(['最新回复', '最新', '排行榜' /*, '热门', '类别' const selectedTopic = ref( 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 page = ref(0) const pageSize = 10 @@ -347,10 +340,7 @@ watch( watch([selectedCategory, selectedTags], () => { loadOptions() }) -watch(selectedTopic, (topic) => { - if (import.meta.client) { - localStorage.setItem('home-selected-topic', topic) - } +watch(selectedTopic, () => { // 仅当需要额外选项时加载 loadOptions() }) From 2c5462cd9783b64b566ce45b2af2babd20744488 Mon Sep 17 00:00:00 2001 From: Tim <135014430+nagisa77@users.noreply.github.com> Date: Sat, 16 Aug 2025 16:19:44 +0800 Subject: [PATCH 3/9] feat: persist home tab selection --- frontend_nuxt/pages/index.vue | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/frontend_nuxt/pages/index.vue b/frontend_nuxt/pages/index.vue index bb8eee891..18d9e835c 100644 --- a/frontend_nuxt/pages/index.vue +++ b/frontend_nuxt/pages/index.vue @@ -147,9 +147,20 @@ const categoryOptions = ref([]) const isLoadingMore = ref(false) const topics = ref(['最新回复', '最新', '排行榜' /*, '热门', '类别'*/]) -const selectedTopic = ref( - route.query.view === 'ranking' ? '排行榜' : route.query.view === 'latest' ? '最新' : '最新回复', -) +const HOME_TAB_KEY = 'homeTab' +const routeDefault = + route.query.view === 'ranking' ? '排行榜' : route.query.view === 'latest' ? '最新' : null +const selectedTopic = ref(routeDefault || '最新回复') +if (import.meta.client) { + if (routeDefault) { + localStorage.setItem(HOME_TAB_KEY, routeDefault) + } else { + const stored = localStorage.getItem(HOME_TAB_KEY) + if (stored && topics.value.includes(stored)) { + selectedTopic.value = stored + } + } +} const articles = ref([]) const page = ref(0) const pageSize = 10 @@ -340,7 +351,8 @@ watch( watch([selectedCategory, selectedTags], () => { loadOptions() }) -watch(selectedTopic, () => { +watch(selectedTopic, (val) => { + if (import.meta.client) localStorage.setItem(HOME_TAB_KEY, val) // 仅当需要额外选项时加载 loadOptions() }) From 642a527dcfe863457a98de3354ae5cdaeed23208 Mon Sep 17 00:00:00 2001 From: tim Date: Sat, 16 Aug 2025 16:20:52 +0800 Subject: [PATCH 4/9] Revert "feat: persist home tab selection" This reverts commit 2c5462cd9783b64b566ce45b2af2babd20744488. --- frontend_nuxt/pages/index.vue | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/frontend_nuxt/pages/index.vue b/frontend_nuxt/pages/index.vue index 18d9e835c..bb8eee891 100644 --- a/frontend_nuxt/pages/index.vue +++ b/frontend_nuxt/pages/index.vue @@ -147,20 +147,9 @@ const categoryOptions = ref([]) const isLoadingMore = ref(false) const topics = ref(['最新回复', '最新', '排行榜' /*, '热门', '类别'*/]) -const HOME_TAB_KEY = 'homeTab' -const routeDefault = - route.query.view === 'ranking' ? '排行榜' : route.query.view === 'latest' ? '最新' : null -const selectedTopic = ref(routeDefault || '最新回复') -if (import.meta.client) { - if (routeDefault) { - localStorage.setItem(HOME_TAB_KEY, routeDefault) - } else { - const stored = localStorage.getItem(HOME_TAB_KEY) - if (stored && topics.value.includes(stored)) { - selectedTopic.value = stored - } - } -} +const selectedTopic = ref( + route.query.view === 'ranking' ? '排行榜' : route.query.view === 'latest' ? '最新' : '最新回复', +) const articles = ref([]) const page = ref(0) const pageSize = 10 @@ -351,8 +340,7 @@ watch( watch([selectedCategory, selectedTags], () => { loadOptions() }) -watch(selectedTopic, (val) => { - if (import.meta.client) localStorage.setItem(HOME_TAB_KEY, val) +watch(selectedTopic, () => { // 仅当需要额外选项时加载 loadOptions() }) From b9fd9711de963158325fce1d4bfbd51c989ccef1 Mon Sep 17 00:00:00 2001 From: Tim <135014430+nagisa77@users.noreply.github.com> Date: Sat, 16 Aug 2025 16:21:45 +0800 Subject: [PATCH 5/9] feat: add timeline filters on profile page --- frontend_nuxt/pages/users/[id].vue | 50 ++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/frontend_nuxt/pages/users/[id].vue b/frontend_nuxt/pages/users/[id].vue index dda0ab827..2e67ea756 100644 --- a/frontend_nuxt/pages/users/[id].vue +++ b/frontend_nuxt/pages/users/[id].vue @@ -204,12 +204,32 @@
+
+
+ 全部 +
+
+ 文章 +
+
+ 评论和回复 +
+
- +