MessageDetailPage.vue
1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!--
* @Date: 2025-03-24 12:56:24
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-06-13 13:23:52
* @FilePath: /mlaj/src/views/profile/MessageDetailPage.vue
* @Description: 文件描述
-->
<template>
<AppLayout title="消息详情">
<div class="bg-gradient-to-br from-green-50 via-green-100/30 to-blue-50/30 min-h-screen">
<div class="p-4">
<FrostedGlass class="p-4 rounded-xl">
<div class="mb-4">
<!-- <h1 class="text-xl font-medium mb-2">{{ message.title }}</h1> -->
<div class="text-xs text-gray-500">{{ message.created_time }}</div>
</div>
<div class="text-gray-700 leading-relaxed whitespace-pre-wrap">
{{ message.note }}
</div>
</FrostedGlass>
</div>
</div>
</AppLayout>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import AppLayout from '@/components/layout/AppLayout.vue';
import FrostedGlass from '@/components/ui/FrostedGlass.vue';
import { useTitle } from '@vueuse/core';
// 导入接口
import { getNewsInfoAPI } from '@/api/news';
const $route = useRoute();
useTitle($route.meta.title);
const route = useRoute();
const message = ref({
title: '',
note: '',
created_time: '',
status: 'send'
});
onMounted(async () => {
// 调用接口获取消息详情
const { code, data } = await getNewsInfoAPI({ id: route.params.id });
if (code) {
message.value = data;
// 更新消息已读状态
message.value.status = 'read';
}
});
</script>