Compare commits

...

4 Commits

Author SHA1 Message Date
Tim 583d4042f5 feat: add optional hover for BaseTimeline 2025-08-25 10:29:35 +08:00
Tim 8437c1c714 Merge pull request #709 from nagisa77/codex/add-globalpopup-for-internal-messages
feat: add message feature popup
2025-08-23 02:58:34 +08:00
Tim 2613fe6cf1 feat: introduce message popup component 2025-08-23 02:58:24 +08:00
Tim a15d541b72 Merge pull request #699 from nagisa77/feature/daily_bugfix_0823
daily bugfix
2025-08-23 02:49:36 +08:00
4 changed files with 96 additions and 3 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
<template> <template>
<div class="timeline"> <div class="timeline" :class="{ 'hover-enabled': hover }">
<div class="timeline-item" v-for="(item, idx) in items" :key="idx"> <div class="timeline-item" v-for="(item, idx) in items" :key="idx">
<div <div
class="timeline-icon" class="timeline-icon"
@@ -22,6 +22,7 @@ export default {
name: 'BaseTimeline', name: 'BaseTimeline',
props: { props: {
items: { type: Array, default: () => [] }, items: { type: Array, default: () => [] },
hover: { type: Boolean, default: false },
}, },
} }
</script> </script>
@@ -41,7 +42,7 @@ export default {
margin-top: 10px; margin-top: 10px;
} }
.timeline-item:hover { .hover-enabled .timeline-item:hover {
background-color: var(--menu-selected-background-color); background-color: var(--menu-selected-background-color);
transition: background-color 0.2s; transition: background-color 0.2s;
border-radius: 10px; border-radius: 10px;
+18
View File
@@ -7,6 +7,7 @@
@close="closeMilkTeaPopup" @close="closeMilkTeaPopup"
/> />
<NotificationSettingPopup :visible="showNotificationPopup" @close="closeNotificationPopup" /> <NotificationSettingPopup :visible="showNotificationPopup" @close="closeNotificationPopup" />
<MessagePopup :visible="showMessagePopup" @close="closeMessagePopup" />
<MedalPopup :visible="showMedalPopup" :medals="newMedals" @close="closeMedalPopup" /> <MedalPopup :visible="showMedalPopup" :medals="newMedals" @close="closeMedalPopup" />
<ActivityPopup <ActivityPopup
@@ -22,6 +23,7 @@
import ActivityPopup from '~/components/ActivityPopup.vue' import ActivityPopup from '~/components/ActivityPopup.vue'
import MedalPopup from '~/components/MedalPopup.vue' import MedalPopup from '~/components/MedalPopup.vue'
import NotificationSettingPopup from '~/components/NotificationSettingPopup.vue' import NotificationSettingPopup from '~/components/NotificationSettingPopup.vue'
import MessagePopup from '~/components/MessagePopup.vue'
import { authState } from '~/utils/auth' import { authState } from '~/utils/auth'
const config = useRuntimeConfig() const config = useRuntimeConfig()
@@ -33,6 +35,7 @@ const milkTeaIcon = ref('')
const inviteCodeIcon = ref('') const inviteCodeIcon = ref('')
const showNotificationPopup = ref(false) const showNotificationPopup = ref(false)
const showMessagePopup = ref(false)
const showMedalPopup = ref(false) const showMedalPopup = ref(false)
const newMedals = ref([]) const newMedals = ref([])
@@ -43,6 +46,9 @@ onMounted(async () => {
await checkInviteCodeActivity() await checkInviteCodeActivity()
if (showInviteCodePopup.value) return if (showInviteCodePopup.value) return
await checkMessageFeature()
if (showMessagePopup.value) return
await checkNotificationSetting() await checkNotificationSetting()
if (showNotificationPopup.value) return if (showNotificationPopup.value) return
@@ -97,6 +103,18 @@ const closeMilkTeaPopup = () => {
showMilkTeaPopup.value = false showMilkTeaPopup.value = false
} }
const checkMessageFeature = async () => {
if (!import.meta.client) return
if (!authState.loggedIn) return
if (localStorage.getItem('messageFeaturePopupShown')) return
showMessagePopup.value = true
}
const closeMessagePopup = () => {
if (!import.meta.client) return
localStorage.setItem('messageFeaturePopupShown', 'true')
showMessagePopup.value = false
}
const checkNotificationSetting = async () => { const checkNotificationSetting = async () => {
if (!import.meta.client) return if (!import.meta.client) return
if (!authState.loggedIn) return if (!authState.loggedIn) return
+74
View File
@@ -0,0 +1,74 @@
<template>
<BasePopup :visible="visible" @close="close">
<div class="message-popup">
<div class="message-popup-title">📨 站内信上线啦</div>
<div class="message-popup-text">现在可以在右上角使用站内信功能</div>
<div class="message-popup-actions">
<div class="message-popup-close" @click="close">知道了</div>
<div class="message-popup-button" @click="gotoMessage">去看看</div>
</div>
</div>
</BasePopup>
</template>
<script setup>
import BasePopup from '~/components/BasePopup.vue'
defineProps({
visible: { type: Boolean, default: false },
})
const emit = defineEmits(['close'])
const gotoMessage = () => {
emit('close')
navigateTo('/message-box', { replace: true })
}
const close = () => emit('close')
</script>
<style scoped>
.message-popup {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
gap: 10px;
min-width: 200px;
}
.message-popup-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
}
.message-popup-actions {
margin-top: 10px;
display: flex;
flex-direction: row;
gap: 20px;
}
.message-popup-button {
background-color: var(--primary-color);
color: #fff;
padding: 8px 16px;
border-radius: 8px;
cursor: pointer;
}
.message-popup-button:hover {
background-color: var(--primary-color-hover);
}
.message-popup-close {
cursor: pointer;
color: var(--primary-color);
display: flex;
align-items: center;
}
.message-popup-close:hover {
text-decoration: underline;
}
</style>
+1 -1
View File
@@ -20,7 +20,7 @@
{{ loadingMore ? '加载中...' : '查看更多消息' }} {{ loadingMore ? '加载中...' : '查看更多消息' }}
</div> </div>
</div> </div>
<BaseTimeline :items="messages"> <BaseTimeline :items="messages" hover>
<template #item="{ item }"> <template #item="{ item }">
<div class="message-header"> <div class="message-header">
<div class="user-name"> <div class="user-name">