Files
2026-09-11 12:25:38 +08:00

253 lines
5.1 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="suggestion-detail-page">
<PortalHeader active-path="/suggestions" />
<main class="container suggestion-detail-main">
<div class="breadcrumb-bar">
<NuxtLink to="/">首页</NuxtLink>
<span>/</span>
<NuxtLink to="/suggestions">建言献策</NuxtLink>
<span>/</span>
<span>{{ suggestion.title || '建言详情' }}</span>
</div>
<div v-if="loading" class="state-wrap">
<a-skeleton active :paragraph="{ rows: 10 }" />
</div>
<div v-else-if="!suggestion.suggestionId" class="state-wrap">
<a-result status="404" title="建言不存在" sub-title="您查找的建言不存在或未公开显示">
<template #extra>
<a-button type="primary" @click="navigateTo('/suggestions')">返回列表</a-button>
</template>
</a-result>
</div>
<article v-else class="suggestion-detail-card">
<div class="detail-head">
<div>
<h1>{{ suggestion.title }}</h1>
<p>公开建言内容详情</p>
</div>
<div class="detail-side">
<a-tag :color="Number(suggestion.status) === 2 ? 'green' : 'blue'">
{{ Number(suggestion.status) === 2 ? '已采纳' : '已处理' }}
</a-tag>
<span v-if="suggestion.createTime">提交时间{{ suggestion.createTime }}</span>
<span v-if="suggestion.processedTime">处理时间{{ suggestion.processedTime }}</span>
</div>
</div>
<section class="content-section">
<h2>建言内容</h2>
<div class="content-body">
<p>{{ suggestion.content || '暂无内容。' }}</p>
</div>
</section>
<section v-if="suggestion.reply" class="content-section">
<h2>处理说明</h2>
<div class="reply-box">
{{ suggestion.reply }}
</div>
</section>
</article>
</main>
<footer class="site-footer">
<PortalFooter />
</footer>
</div>
</template>
<script setup lang="ts">
import { message } from 'ant-design-vue'
import { getSiteSuggestion, type SiteSuggestion } from '@/api/site'
import { usePageSeo } from '@/composables/usePageSeo'
definePageMeta({
layout: 'blank'
})
usePageSeo({
title: '建言详情',
description: '广西决策咨询网建言详情页'
})
const route = useRoute()
const suggestionId = computed(() => route.params.id as string)
const loading = ref(true)
const suggestion = ref<Partial<SiteSuggestion>>({})
useHead({
title: computed(() => `${suggestion.value.title || '建言详情'} - 广西决策咨询网`),
meta: [
{ name: 'description', content: computed(() => suggestion.value.content || '广西决策咨询网建言详情页') }
]
})
async function loadSuggestion() {
loading.value = true
try {
suggestion.value = await getSiteSuggestion(suggestionId.value)
} catch (error) {
suggestion.value = {}
if (!(error instanceof Error && /404/.test(error.message))) {
message.error(error instanceof Error ? error.message : '加载失败')
}
} finally {
loading.value = false
}
}
watch(suggestionId, () => {
loadSuggestion()
})
onMounted(() => {
loadSuggestion()
})
</script>
<style scoped>
.suggestion-detail-page {
min-height: 100vh;
background: #f5f7fa;
}
.container {
width: min(1200px, calc(100% - 32px));
margin: 0 auto;
}
.suggestion-detail-main {
padding: 28px 0 48px;
}
.breadcrumb-bar {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 24px;
color: #7d8a98;
font-size: 14px;
}
.breadcrumb-bar a {
color: #4a6fa1;
}
.suggestion-detail-card {
padding: 32px;
background: #fff;
border: 1px solid #e5ebf2;
}
.detail-head {
display: flex;
align-items: start;
justify-content: space-between;
gap: 24px;
padding-bottom: 24px;
border-bottom: 1px solid #edf1f5;
}
.detail-head h1 {
margin: 0 0 10px;
color: #1f2d3d;
font-size: 34px;
line-height: 1.2;
}
.detail-head p {
margin: 0;
color: #64707d;
font-size: 15px;
}
.detail-side {
display: flex;
flex-direction: column;
align-items: end;
gap: 10px;
color: #7d8a98;
font-size: 14px;
}
.content-section {
padding-top: 24px;
}
.content-section h2 {
margin: 0 0 16px;
color: #1f2d3d;
font-size: 22px;
}
.content-body,
.reply-box {
color: #495463;
font-size: 15px;
line-height: 2;
}
.content-body p,
.reply-box {
margin: 0;
white-space: pre-wrap;
}
.reply-box {
padding: 18px 20px;
background: #f8fafc;
}
.state-wrap {
padding: 40px 0;
}
.site-footer {
margin-top: 24px;
}
.footer-nav {
background: #1f4fa3;
}
.footer-nav-inner {
display: flex;
align-items: center;
justify-content: center;
gap: 36px;
min-height: 50px;
}
.footer-nav-inner a {
color: #fff;
font-size: 14px;
}
@media (max-width: 768px) {
.suggestion-detail-main {
padding: 24px 0 40px;
}
.suggestion-detail-card {
padding: 24px 18px;
}
.detail-head {
flex-direction: column;
}
.detail-head h1 {
font-size: 28px;
}
.detail-side {
align-items: start;
}
}
</style>