批量推送

This commit is contained in:
郭庆泰
2026-08-16 21:24:53 +08:00
parent 0c093076a4
commit ccfd03a6eb
55 changed files with 3772 additions and 577 deletions
@@ -0,0 +1,341 @@
<template>
<div class="detail-page">
<header class="top-nav" :class="topNavClass">
<a class="logo" title="返回首页" @click.prevent="goHome">
<div class="logo-icon"></div>
<div class="logo-text">
<span class="logo-title">北京整合医学学会</span>
<span class="logo-subtitle">Beijing Association of Holistic Integrative Medicine</span>
</div>
</a>
<ul class="nav-list">
<li class="nav-item"><a class="nav-link" @click.prevent="goHome">年度项目规划</a></li>
<li class="nav-item"><a class="nav-link" @click.prevent="goPublicity">项目公示</a></li>
</ul>
<div class="top-tools">
<template v-if="!loggedIn">
<span class="login-btn" @click="goLogin">登录</span>
</template>
<template v-else>
<el-dropdown trigger="click" @command="onUserCmd">
<a class="user-link" @click.prevent>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/>
<circle cx="12" cy="7" r="4"/>
</svg>
<span>{{ userName }}</span>
</a>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="account">我的主页</el-dropdown-item>
<el-dropdown-item command="logout" divided>退出登录</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</div>
</header>
<main class="container">
<article class="plan-card" v-loading="loading">
<header class="plan-head">
<h1 class="plan-title">{{ plan.title || '专项计划' }}</h1>
<div class="plan-meta" v-if="plan.updateTime">最后更新: {{ fmt(plan.updateTime) }}</div>
</header>
<!-- 富文本内容 -->
<div v-if="!plan.contentType || plan.contentType === 'rich'"
class="plan-body plan-body-rich"
v-html="plan.content || '<p class=\'empty\'>暂无内容</p>'" />
<!-- 上传文件: PDF / PNG -->
<div v-else class="plan-body plan-body-file">
<iframe v-if="isPdf(plan.fileUrl)"
:src="proxyUrl(plan.fileUrl)"
class="content-frame"
frameborder="0"></iframe>
<img v-else-if="isImg(plan.fileUrl)"
:src="proxyUrl(plan.fileUrl)"
class="content-img"
alt="专项计划文件" />
<div v-else class="content-empty">
<el-icon size="64"><svg viewBox="0 0 24 24" fill="currentColor"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"/></svg></el-icon>
<p>暂无可查看的文件</p>
<p class="hint">请上传 PDF PNG 格式</p>
</div>
</div>
</article>
</main>
<footer class="footer">
<div class="container">
<div class="footer-main">
<div class="footer-brand">
<div class="brand-row">
<div class="footer-logo-icon"></div>
<div>
<div class="footer-brand-name">北京整合医学学会</div>
<div class="footer-brand-en">Beijing Association of Holistic Integrative Medicine</div>
</div>
</div>
<p class="footer-desc">依托"健康中国2030"战略,整合医学资源,推动健康科普与公益事业,助力全民健康素养提升,共建共享健康中国</p>
</div>
<div class="footer-col">
<h4>快速导航</h4>
<a @click.prevent="goHome">首页</a>
<a @click.prevent="goHome">年度项目规划</a>
<a @click.prevent="goPublicity">项目公示</a>
</div>
<div class="footer-col">
<h4>学会项目</h4>
<a>百姓巡常行</a>
<a>专病联盟暨全国专家智库</a>
<a>乡村幸福安康</a>
<a>临床科研资助计划</a>
</div>
<div class="footer-col">
<h4>联系方式</h4>
<p>电话: 010-82089470</p>
<p>邮箱: contactus@bahim.org.cn</p>
<p>地址: 北京市海淀区知春路1号学院国际大厦908-2</p>
<p>邮编: 100083</p>
</div>
<div class="footer-qr">
<div class="qr-image">
<svg width="52" height="52" viewBox="0 0 24 24" fill="currentColor">
<path d="M3 11h8V3H3v8zm2-6h4v4H5V5zm8-2v8h8V3h-8zm6 6h-4V5h4v4zM3 21h8v-8H3v8zm2-6h4v4H5v-4zm13-2h-2v2h2v-2zm-2 2h-2v2h2v-2zm2 2h-2v2h2v-2zm2-2h-2v2h2v-2zm-2-2h-2v2h2v-2zm-2-2h-2v2h2v-2zm-2-2h-2v2h2v-2zm-2-2h-2v2h2v-2zm0 0h-2v2h2v-2z"/>
</svg>
</div>
<div class="qr-label">公众号二维码</div>
</div>
</div>
<div class="footer-bottom">
<span>© 北京整合医学学会 BAHIM</span>
<span>京ICP备2020035479号-1 &nbsp;&nbsp; 京公网安备11010802034820</span>
</div>
</div>
</footer>
</div>
</template>
<script setup>
import { ref, computed, watch, onMounted, onBeforeUnmount } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useUserStore } from '@/store/user'
import { logout as logoutApi } from '@/api/auth'
import request from '@/utils/request'
const route = useRoute()
const router = useRouter()
const userStore = useUserStore()
const isScrolled = ref(false)
const topNavClass = computed(() => isScrolled.value ? 'is-scrolled' : '')
const loggedIn = computed(() => !!userStore.token)
const userName = computed(() => userStore.user?.userName || '用户')
const plan = ref({})
const loading = ref(false)
async function load() {
const id = route.params.id
if (!id) return
loading.value = true
try {
const r = await request({ url: `/business/public/specialPlan/${id}`, method: 'get' })
plan.value = (r.data && r.data.data) || r.data || {}
} catch (e) {
plan.value = {}
} finally { loading.value = false }
}
function fmt(d) {
if (!d) return ''
const date = new Date(d)
const y = date.getFullYear()
const m = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${y}-${m}-${day}`
}
function isPdf(url) {
if (!url) return false
return /\.pdf(\?|$)/i.test(url.split('?')[0])
}
function isImg(url) {
if (!url) return false
return /\.(png|jpg|jpeg|gif|webp)(\?|$)/i.test(url.split('?')[0])
}
// OSS bucket 默认 Content-Disposition: attachment, PDF 会被强制下载.
// 走 /common/oss/proxy 后端代理改写为 inline.
// 参考 PublicityDetail.vue 的 proxyUrl 逻辑
function proxyUrl(url) {
if (!url) return url
if (url.includes('hwtossbamlorgcn.oss-cn-beijing.aliyuncs.com')) {
return '/dev-api/common/oss/proxy?url=' + encodeURIComponent(url) + '#toolbar=0&zoom=page-width'
}
return url
}
function goHome() { router.push('/') }
function goPublicity() { router.push('/publicity') }
function goLogin() { router.push('/login') }
async function goLogout() { try { await logoutApi() } catch {}; userStore.logout(); router.replace('/login') }
async function onUserCmd(cmd) {
if (cmd === 'logout') return goLogout()
if (cmd === 'account') {
const r = (userStore.user?.role || '')
const map = { admin: '/leader/home', leader: '/leader/home', manager: '/manager/workbench', doctor: '/doctor/home', executor: '/executor/meetings', sponsor: '/sponsor/home' }
router.push(map[r] || '/leader/home')
}
}
function handleScroll() { isScrolled.value = window.scrollY > 10 }
onMounted(() => {
window.addEventListener('scroll', handleScroll, { passive: true })
load()
})
onBeforeUnmount(() => {
window.removeEventListener('scroll', handleScroll)
})
watch(() => route.params.id, load)
</script>
<style scoped>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #1f2937;
background: #f5f6f8;
min-width: 1354px;
line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
/* ===== 顶部导航 (与 PublicityDetail 一致) ===== */
.top-nav {
position: sticky; top: 0; z-index: 1000;
height: 72px; padding: 0 60px;
background: var(--brand-primary);
border-bottom: 1px solid rgba(255,255,255,0.08);
display: flex; align-items: center;
box-shadow: 0 2px 12px rgba(0,0,0,0.15);
transition: box-shadow 0.3s;
}
.top-nav.is-scrolled { box-shadow: 0 4px 20px rgba(0,0,0,0.25); }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
width: 36px; height: 36px;
background: #fff; color: var(--brand-primary);
display: flex; align-items: center; justify-content: center;
font-size: 18px; font-weight: 600;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-title { font-size: 16px; font-weight: 600; color: #fff; letter-spacing: 0.5px; }
.logo-subtitle { font-size: 11px; color: rgba(255,255,255,0.6); margin-top: 2px; letter-spacing: 0.3px; }
.nav-list { flex: 1; display: flex; align-items: center; justify-content: center; gap: 36px; list-style: none; }
.nav-item { position: relative; height: 72px; display: flex; align-items: center; }
.nav-link {
font-size: 15px; font-weight: 500; color: rgba(255,255,255,0.85);
cursor: pointer; transition: color 0.25s; position: relative;
height: 72px; display: flex; align-items: center;
}
.nav-link::after {
content: ''; position: absolute; left: 50%; bottom: 0;
width: 0; height: 2px; background: #fff;
transform: translateX(-50%); transition: width 0.3s ease;
}
.nav-item:hover .nav-link, .nav-link.active { color: #fff; }
.nav-item:hover .nav-link::after, .nav-link.active::after { width: 100%; }
.top-tools { display: flex; align-items: center; gap: 16px; }
.login-btn {
padding: 7px 20px; background: #fff; color: var(--brand-primary);
font-size: 13px; font-weight: 500;
cursor: pointer; transition: background 0.2s; letter-spacing: 1px;
}
.login-btn:hover { background: #f3f4f6; }
.user-link { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-size: 14px; cursor: pointer; }
/* ===== 主体 ===== */
.container { max-width: 1354px; margin: 0 auto; padding: 28px 60px 60px; }
.plan-card {
background: #fff;
border: 1px solid #e5e7eb;
box-shadow: 0 2px 12px rgba(0,0,0,0.04);
padding: 56px 80px 64px;
min-height: 480px;
}
.plan-head { text-align: center; border-bottom: 1px solid #eef0f3; padding-bottom: 28px; margin-bottom: 32px; }
.plan-title { font-size: 26px; font-weight: 700; color: #1f2937; letter-spacing: 1px; line-height: 1.4; }
.plan-meta { margin-top: 12px; font-size: 13px; color: #9ca3af; }
/* 富文本 (与 ArticleView 一致) */
.plan-body-rich {
font-size: 15px; line-height: 2; color: #374151;
}
.plan-body-rich :deep(h1),
.plan-body-rich :deep(h2),
.plan-body-rich :deep(h3) { font-weight: 700; color: #1f2937; margin: 24px 0 14px; line-height: 1.5; }
.plan-body-rich :deep(h1) { font-size: 22px; text-align: center; }
.plan-body-rich :deep(h2) { font-size: 18px; }
.plan-body-rich :deep(h3) { font-size: 16px; }
.plan-body-rich :deep(p) { margin: 10px 0; text-indent: 2em; text-align: justify; }
.plan-body-rich :deep(ul),
.plan-body-rich :deep(ol) { margin: 12px 0 12px 2em; }
.plan-body-rich :deep(li) { margin: 6px 0; }
.plan-body-rich :deep(.empty) { text-align: center; color: #c0c4cc; text-indent: 0; padding: 60px 0; }
/* 文件预览 */
.plan-body-file { padding: 0; min-height: 600px; }
.content-frame { width: 100%; height: 700px; display: block; border: 0; }
.content-img { width: 100%; max-width: 100%; display: block; margin: 0 auto; }
.content-empty { padding: 80px 20px; text-align: center; color: #c0c4cc; }
.content-empty p { margin: 8px 0 0; }
.content-empty .hint { font-size: 12px; }
/* ===== 底部 ===== */
.footer { background: var(--brand-primary-darker); color: rgba(255,255,255,0.65); padding: 48px 0 0; }
.footer-main { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr auto; gap: 48px; padding-bottom: 36px; }
.footer-brand .brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.footer-logo-icon {
width: 36px; height: 36px;
background: #fff; color: var(--brand-primary);
display: flex; align-items: center; justify-content: center;
font-size: 18px; font-weight: 600; flex-shrink: 0;
}
.footer-brand-name { font-size: 16px; font-weight: 600; color: #fff; letter-spacing: 1px; }
.footer-brand-en { font-size: 10px; color: rgba(255,255,255,0.4); letter-spacing: 0.5px; margin-top: 2px; }
.footer-desc { font-size: 13px; line-height: 1.9; color: rgba(255,255,255,0.55); }
.footer-col h4 {
font-size: 14px; font-weight: 600; color: #fff;
letter-spacing: 1px; margin-bottom: 16px; padding-bottom: 10px; position: relative;
}
.footer-col h4::after { content: ''; position: absolute; left: 0; bottom: 0; width: 24px; height: 2px; background: #93c5fd; }
.footer-col a, .footer-col p {
display: block; font-size: 13px; color: rgba(255,255,255,0.6);
line-height: 2.1; transition: color 0.2s;
}
.footer-col a { cursor: pointer; }
.footer-col a:hover { color: #fff; }
.footer-qr { text-align: center; }
.qr-image {
width: 100px; height: 100px;
background: #fff;
display: flex; align-items: center; justify-content: center;
color: #1f2937;
}
.qr-label { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 10px; }
.footer-bottom {
border-top: 1px solid rgba(255,255,255,0.12);
padding: 18px 0;
display: flex; justify-content: space-between;
font-size: 12px; color: rgba(255,255,255,0.4);
}
@media (max-width: 900px) {
.container { padding: 0 24px 40px; }
.plan-card { padding: 32px 24px; }
}
</style>