diff --git a/frontend_nuxt/components/BaseTabs.vue b/frontend_nuxt/components/BaseTabs.vue new file mode 100644 index 000000000..6c7d36c6d --- /dev/null +++ b/frontend_nuxt/components/BaseTabs.vue @@ -0,0 +1,110 @@ + + + + + diff --git a/frontend_nuxt/pages/about/index.vue b/frontend_nuxt/pages/about/index.vue index 8d5aaa60f..698327e16 100644 --- a/frontend_nuxt/pages/about/index.vue +++ b/frontend_nuxt/pages/about/index.vue @@ -1,33 +1,29 @@ @@ -100,25 +95,11 @@ export default { .about-tabs { top: calc(var(--header-height) + 1px); background-color: var(--background-color-blur); - display: flex; - flex-direction: row; - border-bottom: 1px solid var(--normal-border-color); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; } -.about-tabs-item { - padding: 10px 20px; - cursor: pointer; - white-space: nowrap; -} - -.about-tabs-item.selected { - color: var(--primary-color); - border-bottom: 2px solid var(--primary-color); -} - .about-content { line-height: 1.6; padding: 20px; diff --git a/frontend_nuxt/pages/message-box/index.vue b/frontend_nuxt/pages/message-box/index.vue index abd255dfc..7ec6555a6 100644 --- a/frontend_nuxt/pages/message-box/index.vue +++ b/frontend_nuxt/pages/message-box/index.vue @@ -7,116 +7,119 @@
-
-
- 站内信 -
-
- 频道 -
-
- -
-
- -
- -
-
{{ error }}
-
- -
- -
- -
- -
- -
-
- -
- -
-
-
- {{ getOtherParticipant(convo)?.username || '未知用户' }} -
-
- {{ formatTime(convo.lastMessage?.createdAt || convo.createdAt) }} -
+ + +
@@ -132,6 +135,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([]) @@ -152,6 +156,10 @@ const channels = ref([]) const loadingChannels = ref(false) const isFloatMode = computed(() => route.query.float === '1') const floatRoute = useState('messageFloatRoute') +const tabs = [ + { name: 'messages', label: '站内信' }, + { name: 'channels', label: '频道' }, +] async function fetchConversations() { const token = getToken() @@ -216,16 +224,6 @@ async function fetchChannels() { } } -function switchToMessage() { - activeTab.value = 'messages' - fetchConversations() -} - -function switchToChannels() { - activeTab.value = 'channels' - fetchChannels() -} - async function goToChannel(id) { const token = getToken() if (!token) { @@ -285,6 +283,14 @@ watch(isConnected, (newValue) => { } }) +watch(activeTab, (val) => { + if (val === 'messages') { + fetchConversations() + } else { + fetchChannels() + } +}) + onUnmounted(() => { if (subscription) { subscription.unsubscribe() @@ -323,22 +329,10 @@ function minimize() { cursor: pointer; } -.tabs { - display: flex; - border-bottom: 1px solid var(--normal-border-color); +.messages-container :deep(.base-tabs-header) { margin-bottom: 16px; } -.tab { - padding: 10px 20px; - cursor: pointer; -} - -.tab.active { - border-bottom: 2px solid var(--primary-color); - color: var(--primary-color); -} - .loading-message { display: flex; justify-content: center; @@ -500,7 +494,7 @@ function minimize() { display: block; } - .tabs, + .base-tabs-wrapper, .loading-message, .error-container, .search-container, diff --git a/frontend_nuxt/pages/message.vue b/frontend_nuxt/pages/message.vue index d694b1b2d..10c787bbe 100644 --- a/frontend_nuxt/pages/message.vue +++ b/frontend_nuxt/pages/message.vue @@ -1,545 +1,527 @@ -