diff --git a/frontend_nuxt/components/BaseTabs.vue b/frontend_nuxt/components/BaseTabs.vue new file mode 100644 index 000000000..062ee0eef --- /dev/null +++ b/frontend_nuxt/components/BaseTabs.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/frontend_nuxt/pages/about/index.vue b/frontend_nuxt/pages/about/index.vue index 8d5aaa60f..ea60f0946 100644 --- a/frontend_nuxt/pages/about/index.vue +++ b/frontend_nuxt/pages/about/index.vue @@ -1,30 +1,23 @@ @@ -97,7 +89,7 @@ export default { margin: 0 auto; } -.about-tabs { +:deep(.base-tabs-header) { top: calc(var(--header-height) + 1px); background-color: var(--background-color-blur); display: flex; @@ -108,13 +100,13 @@ export default { scrollbar-width: none; } -.about-tabs-item { +:deep(.base-tabs-item) { padding: 10px 20px; cursor: pointer; white-space: nowrap; } -.about-tabs-item.selected { +:deep(.base-tabs-item.selected) { color: var(--primary-color); border-bottom: 2px solid var(--primary-color); } diff --git a/frontend_nuxt/pages/message-box/index.vue b/frontend_nuxt/pages/message-box/index.vue index ffb91ffb2..4c52f9d86 100644 --- a/frontend_nuxt/pages/message-box/index.vue +++ b/frontend_nuxt/pages/message-box/index.vue @@ -7,116 +7,113 @@
-
-
- 站内信 -
-
- 频道 -
-
- -
-
- -
- -
-
{{ error }}
-
- -
- -
- -
- -
- -
-
- + +
+
+
-
-
-
- {{ getOtherParticipant(convo)?.username || '未知用户' }} -
-
- {{ formatTime(convo.lastMessage?.createdAt || convo.createdAt) }} -
-
- -
-
- {{ - convo.lastMessage ? stripMarkdownLength(convo.lastMessage.content, 100) : '暂无消息' - }} -
-
- {{ convo.unreadCount }} -
-
+
+
{{ error }}
-
-
-
-
- -
-
-
- +
+
+ +
+ +
+
+
- {{ ch.name }} - + {{ getOtherParticipant(convo)?.username || '未知用户' }}
- {{ formatTime(ch.lastMessage?.createdAt || ch.createdAt) }} + {{ formatTime(convo.lastMessage?.createdAt || convo.createdAt) }}
+
{{ - ch.lastMessage ? stripMarkdownLength(ch.lastMessage.content, 100) : ch.description + convo.lastMessage + ? stripMarkdownLength(convo.lastMessage.content, 100) + : '暂无消息' }}
-
成员 {{ ch.memberCount }}
+
+ {{ convo.unreadCount }} +
-
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+ {{ ch.name }} + +
+
+ {{ formatTime(ch.lastMessage?.createdAt || ch.createdAt) }} +
+
+
+
+ {{ + ch.lastMessage + ? stripMarkdownLength(ch.lastMessage.content, 100) + : ch.description + }} +
+
成员 {{ ch.memberCount }}
+
+
+
+
+
+
@@ -132,6 +129,7 @@ import TimeManager from '~/utils/time' import { stripMarkdownLength } from '~/utils/markdown' import SearchPersonDropdown from '~/components/SearchPersonDropdown.vue' import BasePlaceholder from '~/components/BasePlaceholder.vue' +import BaseTabs from '~/components/BaseTabs.vue' const config = useRuntimeConfig() const conversations = ref([]) @@ -148,6 +146,10 @@ const { fetchChannelUnread: refreshChannelUnread, setFromList: setChannelUnreadF let subscription = null const activeTab = ref('channels') +const tabs = [ + { key: 'messages', label: '站内信' }, + { key: 'channels', label: '频道' }, +] const channels = ref([]) const loadingChannels = ref(false) const isFloatMode = computed(() => route.query.float === '1') @@ -216,15 +218,13 @@ async function fetchChannels() { } } -function switchToMessage() { - activeTab.value = 'messages' - fetchConversations() -} - -function switchToChannels() { - activeTab.value = 'channels' - fetchChannels() -} +watch(activeTab, (tab) => { + if (tab === 'messages') { + fetchConversations() + } else { + fetchChannels() + } +}) async function goToChannel(id) { const token = getToken() @@ -323,18 +323,18 @@ function minimize() { cursor: pointer; } -.tabs { +:deep(.base-tabs-header) { display: flex; border-bottom: 1px solid var(--normal-border-color); margin-bottom: 16px; } -.tab { +:deep(.base-tabs-item) { padding: 10px 20px; cursor: pointer; } -.tab.active { +:deep(.base-tabs-item.selected) { border-bottom: 2px solid var(--primary-color); color: var(--primary-color); } @@ -500,7 +500,7 @@ function minimize() { display: block; } - .tabs, + :deep(.base-tabs-header), .loading-message, .error-container, .search-container, diff --git a/frontend_nuxt/pages/message.vue b/frontend_nuxt/pages/message.vue index d694b1b2d..ed67cd2cb 100644 --- a/frontend_nuxt/pages/message.vue +++ b/frontend_nuxt/pages/message.vue @@ -1,515 +1,157 @@ @@ -546,6 +527,7 @@ import BasePlaceholder from '~/components/BasePlaceholder.vue' import BaseTimeline from '~/components/BaseTimeline.vue' import NotificationContainer from '~/components/NotificationContainer.vue' import InfiniteLoadMore from '~/components/InfiniteLoadMore.vue' +import BaseTabs from '~/components/BaseTabs.vue' import { toast } from '~/main' import { authState, getToken } from '~/utils/auth' import { stripMarkdownLength } from '~/utils/markdown' @@ -569,6 +551,11 @@ const route = useRoute() const selectedTab = ref( ['all', 'unread', 'control'].includes(route.query.tab) ? route.query.tab : 'unread', ) +const tabs = [ + { key: 'all', label: '消息' }, + { key: 'unread', label: '未读' }, + { key: 'control', label: '消息设置' }, +] const notificationPrefs = ref([]) const page = ref(0) const pageSize = 30 @@ -714,7 +701,7 @@ onActivated(async () => { overflow-x: hidden; } -.message-page-header { +.message-page :deep(.base-tabs-header) { position: sticky; top: 1px; z-index: 200; @@ -835,21 +822,6 @@ onActivated(async () => { color: var(--text-color); } -.message-tabs { - display: flex; - flex-direction: row; -} - -.message-tab-item { - padding: 10px 20px; - cursor: pointer; -} - -.message-tab-item.selected { - color: var(--primary-color); - border-bottom: 2px solid var(--primary-color); -} - .message-control-title { font-size: 16px; font-weight: bold; diff --git a/frontend_nuxt/pages/points.vue b/frontend_nuxt/pages/points.vue index 0c3e64616..7a1bba5b3 100644 --- a/frontend_nuxt/pages/points.vue +++ b/frontend_nuxt/pages/points.vue @@ -1,177 +1,170 @@