更新首页
This commit is contained in:
+92
-61
@@ -133,14 +133,6 @@
|
||||
</main>
|
||||
|
||||
<footer class="site-footer">
|
||||
<div class="footer-nav">
|
||||
<div class="container footer-nav-inner">
|
||||
<NuxtLink to="/about">友情链接</NuxtLink>
|
||||
<NuxtLink to="/consultation">咨询服务</NuxtLink>
|
||||
<NuxtLink to="/reference">决策成果研究文库</NuxtLink>
|
||||
<NuxtLink to="/expert">政府智库学者库</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
<PortalFooter />
|
||||
</footer>
|
||||
</div>
|
||||
@@ -148,6 +140,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { message } from 'ant-design-vue'
|
||||
import { getSiteArticle, pageSiteArticles, resolveSiteAssetUrl, type SiteArticle } from '@/api/site'
|
||||
import { usePageSeo } from '@/composables/usePageSeo'
|
||||
|
||||
definePageMeta({
|
||||
@@ -161,11 +154,12 @@ type ArticleAttachment = {
|
||||
}
|
||||
|
||||
type ArticleRecord = {
|
||||
id?: string
|
||||
id?: number
|
||||
title: string
|
||||
cover?: string
|
||||
categoryName?: string
|
||||
categoryPath?: string
|
||||
categoryId?: number
|
||||
source?: string
|
||||
author?: string
|
||||
publishTime?: string
|
||||
@@ -191,13 +185,7 @@ const article = ref<ArticleRecord>({ title: '' })
|
||||
const prevArticle = ref<ArticleLink | null>(null)
|
||||
const nextArticle = ref<ArticleLink | null>(null)
|
||||
const relatedArticles = ref<ArticleLink[]>([])
|
||||
const hotArticles = ref<ArticleLink[]>([
|
||||
{ id: 1, title: '广西数字经济发展报告(2024)', rank: 1 },
|
||||
{ id: 2, title: '自治区关于优化营商环境的实施意见', rank: 2 },
|
||||
{ id: 3, title: '面向东盟的产业合作政策解读', rank: 3 },
|
||||
{ id: 4, title: '广西乡村振兴战略实施进展报告', rank: 4 },
|
||||
{ id: 5, title: '北部湾经济区发展最新动态', rank: 5 }
|
||||
])
|
||||
const hotArticles = ref<ArticleLink[]>([])
|
||||
|
||||
usePageSeo({
|
||||
title: '文章详情',
|
||||
@@ -211,58 +199,101 @@ useHead({
|
||||
]
|
||||
})
|
||||
|
||||
function escapeHtml(value: string) {
|
||||
return value
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
}
|
||||
|
||||
function formatContent(content?: string) {
|
||||
if (!content) {
|
||||
return '<p>暂无正文内容</p>'
|
||||
}
|
||||
|
||||
if (/<[a-z][\s\S]*>/i.test(content)) {
|
||||
return content
|
||||
}
|
||||
|
||||
return content
|
||||
.split(/\n+/)
|
||||
.map((item) => item.trim())
|
||||
.filter(Boolean)
|
||||
.map((item) => `<p>${escapeHtml(item)}</p>`)
|
||||
.join('')
|
||||
}
|
||||
|
||||
function normalizeArticle(item: SiteArticle): ArticleRecord {
|
||||
return {
|
||||
id: item.articleId || item.id,
|
||||
title: item.title,
|
||||
cover: resolveSiteAssetUrl(item.image),
|
||||
categoryId: item.categoryId,
|
||||
categoryName: item.categoryName,
|
||||
categoryPath: item.categoryPath,
|
||||
source: item.source,
|
||||
author: item.author,
|
||||
publishTime: item.publishTime,
|
||||
views: Number(item.views || item.actualViews || 0),
|
||||
summary: item.overview,
|
||||
content: formatContent(item.content),
|
||||
}
|
||||
}
|
||||
|
||||
async function loadArticle() {
|
||||
loading.value = true
|
||||
try {
|
||||
article.value = {
|
||||
id: articleId.value,
|
||||
title: '广西自治区党委政府关于加快数字经济发展的实施意见',
|
||||
cover: `https://picsum.photos/900/400?random=${articleId.value}`,
|
||||
categoryName: '政策要闻',
|
||||
categoryPath: '/news',
|
||||
source: '广西壮族自治区人民政府',
|
||||
author: '政策研究处',
|
||||
publishTime: '2024-12-20 09:30:00',
|
||||
views: 1286,
|
||||
summary: '本意见旨在深入贯彻党中央、国务院关于发展数字经济的战略部署,结合广西实际,加快推进数字产业化和产业数字化,培育壮大数字经济新动能。',
|
||||
content: `
|
||||
<h2>一、总体要求</h2>
|
||||
<p>以习近平新时代中国特色社会主义思想为指导,全面贯彻党的二十大精神,围绕建设数字中国战略部署,立足广西比较优势,坚持创新驱动、数据赋能、融合发展,加快推动数字经济与实体经济深度融合,着力打造面向东盟的数字经济发展高地。</p>
|
||||
const current = await getSiteArticle(articleId.value)
|
||||
article.value = normalizeArticle(current)
|
||||
|
||||
<h2>二、主要目标</h2>
|
||||
<p>到2026年,数字经济核心产业增加值占GDP比重达到12%,数字经济总量突破1万亿元,数字化转型企业数量超过5000家,建成5G基站15万座。</p>
|
||||
const [relatedPage, hotPage, siblingPage] = await Promise.all([
|
||||
pageSiteArticles({
|
||||
page: 1,
|
||||
limit: 6,
|
||||
categoryId: current.categoryId,
|
||||
}),
|
||||
pageSiteArticles({
|
||||
page: 1,
|
||||
limit: 5,
|
||||
recommend: 1,
|
||||
}),
|
||||
pageSiteArticles({
|
||||
page: 1,
|
||||
limit: 100,
|
||||
categoryId: current.categoryId,
|
||||
}),
|
||||
])
|
||||
|
||||
<h2>三、重点任务</h2>
|
||||
<h3>(一)加快数字基础设施建设</h3>
|
||||
<p>系统推进新型基础设施建设,加快5G、大数据中心、工业互联网等数字基础设施部署,构建高速、泛在、天地一体、云网融合、智能敏捷、绿色低碳的新型数字基础设施体系。</p>
|
||||
relatedArticles.value = (relatedPage.list || [])
|
||||
.filter((item) => (item.articleId || item.id) !== current.articleId)
|
||||
.slice(0, 5)
|
||||
.map((item) => ({
|
||||
id: item.articleId || item.id,
|
||||
title: item.title,
|
||||
}))
|
||||
|
||||
<h3>(二)深化数字技术与实体经济融合</h3>
|
||||
<p>推动制造业、农业、服务业数字化转型,加快工业互联网创新应用,推进数字农业农村建设,促进数字技术与传统产业深度融合。</p>
|
||||
hotArticles.value = (hotPage.list || []).slice(0, 5).map((item, index) => ({
|
||||
id: item.articleId || item.id,
|
||||
title: item.title,
|
||||
rank: index + 1,
|
||||
}))
|
||||
|
||||
<h3>(三)培育壮大数字经济核心产业</h3>
|
||||
<p>重点发展软件和信息技术服务业、大数据、云计算、人工智能、区块链等核心产业,打造广西数字经济核心产业集群。</p>
|
||||
|
||||
<h2>四、保障措施</h2>
|
||||
<p>加强组织领导,完善工作机制,强化政策支持,健全评估体系,确保各项任务落到实处。</p>
|
||||
`,
|
||||
tags: ['数字经济', '政策解读', '广西'],
|
||||
attachments: [
|
||||
{ name: '广西数字经济发展实施意见(全文).pdf', url: '#', size: '2.4MB' },
|
||||
{ name: '附件:实施细则.docx', url: '#', size: '856KB' }
|
||||
]
|
||||
}
|
||||
|
||||
prevArticle.value = { id: Number(articleId.value) - 1 || 1, title: '广西人工智能产业发展三年行动计划解读' }
|
||||
nextArticle.value = { id: Number(articleId.value) + 1 || 2, title: '关于推动平台经济规范健康持续发展的若干措施' }
|
||||
relatedArticles.value = [
|
||||
{ id: 11, title: '广西数字政府建设重点任务清单发布' },
|
||||
{ id: 12, title: '自治区大数据发展战略阶段性成果综述' },
|
||||
{ id: 13, title: '面向东盟的数据跨境合作政策观察' },
|
||||
{ id: 14, title: '产业数字化转型标杆案例分析' },
|
||||
{ id: 15, title: '推动数字基础设施提质增效的实施路径' }
|
||||
]
|
||||
} catch {
|
||||
message.error('加载失败')
|
||||
const siblings = (siblingPage.list || []).map((item) => ({
|
||||
id: item.articleId || item.id,
|
||||
title: item.title,
|
||||
}))
|
||||
const currentIndex = siblings.findIndex((item) => Number(item.id) === Number(current.articleId))
|
||||
prevArticle.value = currentIndex > 0 ? siblings[currentIndex - 1] : null
|
||||
nextArticle.value = currentIndex >= 0 && currentIndex < siblings.length - 1 ? siblings[currentIndex + 1] : null
|
||||
} catch (e) {
|
||||
article.value = { title: '' }
|
||||
prevArticle.value = null
|
||||
nextArticle.value = null
|
||||
relatedArticles.value = []
|
||||
hotArticles.value = []
|
||||
message.error(e instanceof Error ? e.message : '加载失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user