Files
guoju0808/ry-vue3/src/views/portal/Publicity.vue
T
郭庆泰 b5b3e3a213 feat: 会议批量审核 + 公示按发布时间倒序 + 现场照片 dialog 预览 + 重复报错精确
- 会议列表 manager 批量合规审核 (批量通过/退回, best-effort 逐条回执)
- 公示列表按 publish_time 倒序, 发布/开通写本地 publish_time (修 toISOString UTC 时区 bug)
- 签到表/前全景/后全景「查看照片」改 dialog 预览 (复用 Preview.vue)
- 手机号/用户名重复报错精确提示 (后端 fieldMap + 前端 duplicateTip)
- 医生首页欢迎语改「欢迎使用合规系统」
2026-08-26 00:41:33 +08:00

698 lines
18 KiB
Vue

<template>
<div class="pub-page">
<header class="top-nav" :class="topNavClass">
<a class="logo" title="返回首页" @click.prevent="goHome">
<div class="logo-icon"><img src="/logo.png" alt="logo" /></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"><span class="nav-link active">项目公示</span></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">
<div class="page-header">
<h1 class="section-title">项目公示</h1>
</div>
<div class="filter-bar">
<div class="filter-input-wrap">
<svg class="filter-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
<circle cx="11" cy="11" r="7"/>
<path d="M21 21l-4.3-4.3"/>
</svg>
<input v-model="currentKeyword" @keydown.enter="applyFilter" type="text" class="filter-input" placeholder="搜索项目名称">
</div>
<button class="filter-btn" @click="applyFilter">查询</button>
<button class="filter-btn filter-btn-plain" @click="resetFilter">重置</button>
</div>
<div class="notice-list">
<template v-if="pageItems.length === 0">
<div class="notice-empty">
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<path d="M14 2v6h6"/>
</svg>
<span>暂无公示项目</span>
</div>
</template>
<template v-else>
<div class="notice-header">
<span class="notice-header-title">项目名称</span>
<span class="notice-header-date">发布日期</span>
</div>
<div v-for="(n, i) in pageItems" :key="n.annId || i" class="notice-item" @click="goDetail(n)">
<span class="notice-title">
{{ n.title }}
<svg class="notice-arrow" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M9 6l6 6-6 6"/>
</svg>
</span>
<span class="notice-date">
<svg class="notice-date-icon" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="4" width="18" height="18" rx="2"/>
<line x1="16" y1="2" x2="16" y2="6"/>
<line x1="8" y1="2" x2="8" y2="6"/>
<line x1="3" y1="10" x2="21" y2="10"/>
</svg>
{{ fmtDate(n.publishTime) }}
</span>
</div>
</template>
</div>
<div class="pagination">
<template v-if="total > 0">
<button class="page-btn" :disabled="currentPage === 1" @click="prevPage">上一页</button>
<template v-for="(b, idx) in pageButtons" :key="idx">
<span v-if="b === '...'" style="color: #9ca3af; padding: 0 4px;">···</span>
<button v-else class="page-btn" :class="b === currentPage ? 'active' : ''" @click="goPage(b)">{{ b }}</button>
</template>
<button class="page-btn" :disabled="currentPage === totalPages" @click="nextPage">下一页</button>
<span class="page-info"> {{ total }} / {{ totalPages }} </span>
</template>
</div>
</main>
<PortalFooter />
</div>
</template>
<script setup>
import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
import { useRouter } from 'vue-router'
import { useUserStore } from '@/store/user'
import { logout as logoutApi } from '@/api/auth'
import request from '@/utils/request'
import { bizList } from '@/api/public'
import PortalFooter from '@/components/PortalFooter.vue'
const router = useRouter()
const userStore = useUserStore()
const PAGE_SIZE = 10
const isScrolled = ref(false)
const topNavClass = computed(() => isScrolled.value ? 'is-scrolled' : '')
const loggedIn = computed(() => !!userStore.token)
const userName = computed(() => userStore.user?.userName || '用户')
const ALL_NOTICES = []
const currentKeyword = ref('')
const currentPage = ref(1)
const allRows = ref([])
const loading = ref(false)
async function load() {
loading.value = true
try {
// 项目公示 = biz_project 表中 is_published='1' 的项目
const res = await request({ url: '/business/public/announcements', method: 'get' })
const list = res.data?.data || res.data || []
allRows.value = list.map(r => {
return {
annId: r.projectId,
publishTime: r.publishTime,
type: '公示',
projectNo: r.projectNo || '',
projectName: r.projectName,
title: r.projectName,
fileUrl: r.invitationUrl || r.supportLetterUrl || r.publishUrl || r.scheduleUrl || ''
}
})
} catch (e) {
console.error('[publicity] load failed', e)
allRows.value = []
}
finally { loading.value = false }
}
load()
function detectType(title) {
if (title.includes('【邀请函】')) return '邀请函'
if (title.includes('【支持函】')) return '支持函'
if (title.includes('【通知】')) return '通知'
if (title.includes('【日程】')) return '日程'
if (title.includes('【会议通知】')) return '通知'
return '其他'
}
const filteredList = computed(() => {
let list = allRows.value.map(n => ({ ...n, type: n.type || detectType(n.title) }))
if (currentKeyword.value) {
const kw = currentKeyword.value.toLowerCase()
list = list.filter(n => n.title.toLowerCase().includes(kw))
}
return list
})
const total = computed(() => filteredList.value.length)
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / PAGE_SIZE)))
const pageItems = computed(() => {
const start = (currentPage.value - 1) * PAGE_SIZE
return filteredList.value.slice(start, start + PAGE_SIZE)
})
const pageButtons = computed(() => {
const buttons = []
for (let i = 1; i <= totalPages.value; i++) {
if (i === 1 || i === totalPages.value || (i >= currentPage.value - 1 && i <= currentPage.value + 1)) {
buttons.push(i)
} else if (i === currentPage.value - 2 || i === currentPage.value + 2) {
buttons.push('...')
}
}
const result = []
for (let i = 0; i < buttons.length; i++) {
if (buttons[i] === '...' && result[result.length - 1] === '...') continue
result.push(buttons[i])
}
return result
})
function applyFilter() { currentPage.value = 1 }
function resetFilter() { currentKeyword.value = ''; currentPage.value = 1 }
function prevPage() { if (currentPage.value > 1) { currentPage.value--; window.scrollTo({ top: 0, behavior: 'smooth' }) } }
function nextPage() { if (currentPage.value < totalPages.value) { currentPage.value++; window.scrollTo({ top: 0, behavior: 'smooth' }) } }
function goPage(p) { currentPage.value = p; window.scrollTo({ top: 0, behavior: 'smooth' }) }
function goHome() { router.push('/') }
function goPublicity() { router.push('/publicity') }
function goLogin() { router.push('/login') }
function goUser() { /* placeholder */ }
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: '/admin/workbench', manager: '/manager/workbench', doctor: '/doctor/home', executor: '/executor/meetings', sponsor: '/sponsor/home' }
router.push(map[r] || '/admin/workbench')
}
}
function goDetail(n) {
if (!n || !n.annId) return
router.push({ name: 'publicity-detail', params: { projectId: n.annId } })
}
function fmtDate(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 handleScroll() { isScrolled.value = window.scrollY > 10 }
onMounted(() => window.addEventListener('scroll', handleScroll, { passive: true }))
onBeforeUnmount(() => window.removeEventListener('scroll', handleScroll))
</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: #ffffff;
min-width: 1354px;
line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
/* ========== 顶部导航 ========== */
.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;
cursor: pointer;
text-decoration: none;
transition: opacity 0.2s;
}
.logo:hover { opacity: 0.85; }
.logo-icon {
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
flex-shrink: 0;
}
.logo-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.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;
}
/* 已登录: 右上角人员信息 (用户名 + 头像图标) — 深色 navbar 上必须白色 */
.user-link {
display: inline-flex;
align-items: center;
gap: 6px;
color: #fff;
font-size: 14px;
font-weight: 500;
cursor: pointer;
text-decoration: none;
transition: opacity 0.2s;
}
.user-link:hover { opacity: 0.85; }
.user-link svg { stroke: currentColor; }
.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;
}
/* ========== 页面骨架 (sticky footer: 内容少时底部仍贴屏幕底) ========== */
.pub-page {
display: flex;
flex-direction: column;
min-height: 100vh;
}
main.container {
flex: 1 0 auto;
/* flex item 的 width:auto 会塌成 fit-content (margin:0 auto 覆盖 align-items:stretch),
导致版心宽度丢失; 显式 width:100% 配合 max-width:1354px + margin:auto 恢复居中版心 */
width: 100%;
}
/* ========== 主体容器 ========== */
.container {
max-width: 1354px;
margin: 0 auto;
padding: 0 60px;
}
/* ========== 页面标题 ========== */
.page-header {
padding: 40px 0 24px;
}
.section-title {
font-size: 20px;
font-weight: 600;
color: #1f2937;
margin-bottom: 22px;
position: relative;
padding-left: 12px;
letter-spacing: 0.5px;
}
.section-title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 3px;
height: 18px;
background: var(--brand-primary);
}
/* ========== 筛选条 ========== */
.filter-bar {
padding: 14px 0;
border-bottom: 1px solid #f0f2f5;
display: flex;
align-items: center;
gap: 12px;
font-size: 13px;
}
.filter-input-wrap {
position: relative;
display: flex;
align-items: center;
}
.filter-icon {
position: absolute;
left: 13px;
top: 50%;
transform: translateY(-50%);
color: #9ca3af;
pointer-events: none;
}
.filter-input {
height: 34px;
padding: 0 12px 0 34px;
border: 1px solid #dde1e6;
border-radius: 17px;
background: #f7f8fa;
font-size: 13px;
color: #1f2937;
font-family: inherit;
outline: none;
width: 240px;
transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.filter-input:focus {
border-color: var(--brand-primary);
background: #fff;
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}
.filter-input::placeholder {
color: #9ca3af;
}
.filter-btn {
height: 34px;
padding: 0 20px;
background: var(--brand-primary);
color: #fff;
border: 1px solid var(--brand-primary);
border-radius: 17px;
font-size: 13px;
cursor: pointer;
font-family: inherit;
letter-spacing: 1px;
transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.filter-btn:hover {
background: var(--brand-primary-deep);
border-color: var(--brand-primary-deep);
}
.filter-btn-plain {
background: #fff;
color: var(--brand-primary);
}
.filter-btn-plain:hover {
background: #f7f8fa;
border-color: var(--brand-primary);
color: var(--brand-primary);
}
/* ========== 公示列表 ========== */
.notice-list {
padding: 0;
}
.notice-empty {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
padding: 64px 0;
color: #c0c6cf;
font-size: 14px;
}
/* 表头: 与 notice-item 相同的 flex + gap + 列宽, 保证列对齐 */
.notice-header {
display: flex;
align-items: center;
gap: 24px;
padding: 14px 20px;
border-bottom: 1px solid #eef0f3;
font-size: 12px;
font-weight: 600;
color: #9ca3af;
letter-spacing: 1px;
}
.notice-header-title {
flex: 1;
min-width: 0;
}
.notice-header-date {
flex-shrink: 0;
width: 130px;
text-align: right;
}
.notice-item {
position: relative;
display: flex;
align-items: center;
gap: 24px;
padding: 16px 20px;
border-bottom: 1px solid #f3f4f6;
cursor: pointer;
transition: background 0.2s;
}
.notice-item::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 3px;
height: 52%;
border-radius: 2px;
background: var(--brand-primary);
opacity: 0;
transition: opacity 0.2s ease;
}
.notice-item:hover {
background: #f7f9fb;
}
.notice-item:hover::before {
opacity: 1;
}
.notice-item:hover .notice-title {
color: var(--brand-primary);
}
.notice-title {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
gap: 8px;
font-size: 15px;
font-weight: 500;
color: #1f2937;
line-height: 1.6;
transition: color 0.2s;
}
.notice-arrow {
flex-shrink: 0;
color: var(--brand-primary);
opacity: 0;
transform: translateX(-6px);
transition: opacity 0.2s ease, transform 0.2s ease;
}
.notice-item:hover .notice-arrow {
opacity: 1;
transform: translateX(0);
}
.notice-date {
flex-shrink: 0;
width: 130px;
display: inline-flex;
align-items: center;
justify-content: flex-end;
gap: 6px;
font-size: 12px;
color: #8a919c;
}
.notice-date-icon {
color: #b6bcc6;
}
/* ========== 分页 ========== */
.pagination {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
padding: 30px 0 60px;
}
.page-btn {
min-width: 32px;
height: 32px;
padding: 0 10px;
border: 1px solid #e5e7eb;
background: #fff;
color: #4b5563;
font-size: 13px;
cursor: pointer;
font-family: inherit;
display: inline-flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}
.page-btn:hover {
border-color: var(--brand-primary);
color: var(--brand-primary);
}
.page-btn.active {
background: var(--brand-primary);
border-color: var(--brand-primary);
color: #fff;
}
.page-btn:disabled {
opacity: 0.4;
cursor: not-allowed;
border-color: #e5e7eb;
}
.page-btn:disabled:hover {
border-color: #e5e7eb;
color: #4b5563;
}
.page-info {
font-size: 13px;
color: #6b7280;
margin-left: 12px;
}
</style>