feat: update page view

This commit is contained in:
tim
2025-07-07 13:07:19 +08:00
parent 587c4f795f
commit 081fa859fc
2 changed files with 17 additions and 3 deletions

View File

@@ -15,6 +15,8 @@
import { ref, onMounted } from 'vue'
import { API_BASE_URL } from '../main'
import BaseTimeline from '../components/BaseTimeline.vue'
import { getToken } from '../utils/auth'
import { toast } from '../main'
export default {
name: 'MessagePageView',
@@ -33,8 +35,20 @@ export default {
const fetchNotifications = async () => {
try {
const res = await fetch(`${API_BASE_URL}/api/notifications`)
if (!res.ok) return
const token = getToken()
if (!token) {
toast.error('请先登录')
return
}
const res = await fetch(`${API_BASE_URL}/api/notifications`, {
headers: {
Authorization: `Bearer ${token}`
}
})
if (!res.ok) {
toast.error('获取通知失败')
return
}
const data = await res.json()
notifications.value = data.map(n => ({ ...n, icon: iconMap[n.type] }))
} catch (e) {

View File

@@ -30,7 +30,7 @@
<div class="info-content">
<div class="info-content-header">
<div class="user-name">Nagisa77</div>
<div class="user-name">{{ author.username }}</div>
<div class="post-time">{{ postTime }}</div>
</div>
<div class="info-content-text" v-html="renderMarkdown(postContent)"></div>