feat(homepage): 更新首页内容为破产事务服务平台
- 将默认租户ID从10398更新为10586 - 更改网站名称为"行于思破产事务服务平台" - 替换首页为破产事务相关的新闻、公告和申报系统 - 更新头部导航栏和底部信息显示新的网站名称 - 修改应用布局背景为透明 - 更新PM2配置中的应用名称和端口设置 - 调整导航栏结构,增加搜索功能和品牌展示区域
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
const { data: siteInfo } = useSiteInfo()
|
||||
const siteName = computed(() => String((siteInfo.value as any)?.data?.websiteName || '网宿软件'))
|
||||
const siteName = computed(() => String((siteInfo.value as any)?.data?.websiteName || '行于思破产事务服务平台'))
|
||||
const icpText = computed(() => {
|
||||
const icp = (siteInfo.value as any)?.data?.icpNo
|
||||
return icp ? `备案号:${icp}` : '备案号:'
|
||||
|
||||
@@ -1,62 +1,136 @@
|
||||
<template>
|
||||
<a-affix :offset-top="0">
|
||||
<a-layout-header class="header">
|
||||
<div class="mx-auto flex max-w-screen-xl items-center justify-between px-4">
|
||||
<NuxtLink to="/" class="flex items-center gap-2 text-white">
|
||||
<a-image src="https://oss.wsdns.cn/20251226/675876f9f5a84732b22efc02b275440a.png" :width="120" :preview="false" />
|
||||
</NuxtLink>
|
||||
<a-menu
|
||||
mode="horizontal"
|
||||
theme="dark"
|
||||
:selected-keys="selectedKeys"
|
||||
class="menu"
|
||||
>
|
||||
<a-menu-item v-for="item in nav" :key="item.to">
|
||||
<NuxtLink :to="item.to">{{ item.label }}</NuxtLink>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
|
||||
<div class="hidden md:flex items-center gap-3">
|
||||
|
||||
<template v-if="!isAuthed">
|
||||
<a-button type="primary" @click="navigateTo('/login')">登录</a-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a-dropdown :trigger="['hover']" placement="bottomRight">
|
||||
<a-space>
|
||||
<a-avatar :src="userAvatar" :size="32">
|
||||
<template v-if="!userAvatar" #icon>
|
||||
<UserOutlined />
|
||||
</template>
|
||||
</a-avatar>
|
||||
<span class="text-gray-100">{{ userName }}</span>
|
||||
</a-space>
|
||||
<template #overlay>
|
||||
<a-menu @click="onUserMenuClick">
|
||||
<a-menu-item key="console">管理中心</a-menu-item>
|
||||
<a-menu-item key="developer">开发者中心</a-menu-item>
|
||||
<a-menu-item key="profile">个人资料</a-menu-item>
|
||||
<a-menu-divider />
|
||||
<a-menu-item key="logout">退出登录</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<header class="site-header">
|
||||
<div class="topbar">
|
||||
<div class="mx-auto flex max-w-screen-xl items-center justify-between gap-4 px-4">
|
||||
<div class="topbar-left">
|
||||
<span class="topbar-date">{{ todayText }}</span>
|
||||
</div>
|
||||
|
||||
<div class="md:hidden">
|
||||
<a-button type="primary" @click="open = true">菜单</a-button>
|
||||
<div class="topbar-right">
|
||||
<a-input-search
|
||||
v-model:value="keywords"
|
||||
class="topbar-search"
|
||||
placeholder="请输入关键字"
|
||||
:allow-clear="true"
|
||||
@search="onSearch"
|
||||
/>
|
||||
|
||||
<div class="hidden md:flex items-center gap-3">
|
||||
<template v-if="!isAuthed">
|
||||
<a-button size="small" type="primary" @click="navigateTo('/login')">登录</a-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a-dropdown :trigger="['hover']" placement="bottomRight">
|
||||
<a-space>
|
||||
<a-avatar :src="userAvatar" :size="28">
|
||||
<template v-if="!userAvatar" #icon>
|
||||
<UserOutlined />
|
||||
</template>
|
||||
</a-avatar>
|
||||
<span class="topbar-user">{{ userName }}</span>
|
||||
</a-space>
|
||||
<template #overlay>
|
||||
<a-menu @click="onUserMenuClick">
|
||||
<a-menu-item key="console">管理中心</a-menu-item>
|
||||
<a-menu-item key="developer">开发者中心</a-menu-item>
|
||||
<a-menu-item key="profile">个人资料</a-menu-item>
|
||||
<a-menu-divider />
|
||||
<a-menu-item key="logout">退出登录</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<a-button class="md:hidden" size="small" @click="open = true">菜单</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</a-layout-header>
|
||||
</a-affix>
|
||||
</div>
|
||||
|
||||
<div v-if="isHome" class="brandbar">
|
||||
<div class="mx-auto grid max-w-screen-xl grid-cols-12 items-center gap-6 px-4 py-8">
|
||||
<NuxtLink to="/" class="col-span-12 flex items-center gap-4 md:col-span-6">
|
||||
<a-image :src="logoUrl" :width="120" :preview="false" />
|
||||
<div class="brand-title">
|
||||
<div class="brand-name">{{ siteName }}</div>
|
||||
<div class="brand-sub">{{ siteSlogan }}</div>
|
||||
</div>
|
||||
</NuxtLink>
|
||||
|
||||
<div class="col-span-12 text-right md:col-span-6">
|
||||
<div class="brand-mission">{{ missionText }}</div>
|
||||
<div class="brand-values">{{ valuesText }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a-affix :offset-top="0">
|
||||
<div class="navbar">
|
||||
<div class="mx-auto flex max-w-screen-xl items-center justify-between gap-3 px-4">
|
||||
<nav class="nav hidden md:flex">
|
||||
<template v-for="item in navItems" :key="item.key">
|
||||
<a-dropdown v-if="item.children?.length" :trigger="['hover']">
|
||||
<a class="nav-link" :class="{ active: isActive(item) }" @click.prevent>
|
||||
{{ item.label }}
|
||||
</a>
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item
|
||||
v-for="child in item.children"
|
||||
:key="child.key"
|
||||
@click="onNavClick(child)"
|
||||
>
|
||||
{{ child.label }}
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
|
||||
<NuxtLink
|
||||
v-else-if="item.to"
|
||||
class="nav-link"
|
||||
:class="{ active: isActive(item) }"
|
||||
:to="item.to"
|
||||
>
|
||||
{{ item.label }}
|
||||
</NuxtLink>
|
||||
|
||||
<a
|
||||
v-else
|
||||
class="nav-link"
|
||||
:class="{ active: isActive(item) }"
|
||||
:href="item.href"
|
||||
:target="item.target || undefined"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{{ item.label }}
|
||||
</a>
|
||||
</template>
|
||||
</nav>
|
||||
<div class="nav-spacer md:hidden" />
|
||||
</div>
|
||||
</div>
|
||||
</a-affix>
|
||||
</header>
|
||||
|
||||
<a-drawer v-model:open="open" title="导航" placement="right">
|
||||
<a-menu mode="inline" :selected-keys="selectedKeys">
|
||||
<a-menu-item v-for="item in nav" :key="item.to" @click="onNav(item.to)">
|
||||
{{ item.label }}
|
||||
</a-menu-item>
|
||||
<template v-for="item in navItems" :key="item.key">
|
||||
<a-menu-item v-if="!item.children?.length" :key="item.key" @click="onNavClick(item)">
|
||||
{{ item.label }}
|
||||
</a-menu-item>
|
||||
<a-sub-menu v-else :key="item.key" :title="item.label">
|
||||
<a-menu-item
|
||||
v-for="child in item.children"
|
||||
:key="child.key"
|
||||
@click="onNavClick(child)"
|
||||
>
|
||||
{{ child.label }}
|
||||
</a-menu-item>
|
||||
</a-sub-menu>
|
||||
</template>
|
||||
</a-menu>
|
||||
|
||||
<div class="mt-4">
|
||||
<a-button v-if="!isAuthed" block type="primary" @click="onNav('/login')">登录</a-button>
|
||||
<template v-else>
|
||||
@@ -73,32 +147,167 @@
|
||||
import { mainNav } from '@/config/nav'
|
||||
import { getUserInfo } from '@/api/layout'
|
||||
import type { User } from '@/api/system/user/model'
|
||||
import type { CmsNavigation } from '@/api/cms/cmsNavigation/model'
|
||||
import { getToken, removeToken } from '@/utils/token-util'
|
||||
import { clearAuthz, hasRole, setAuthzFromUser } from '@/utils/permission'
|
||||
import { UserOutlined } from '@ant-design/icons-vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
|
||||
const nav = computed(() => mainNav)
|
||||
const route = useRoute()
|
||||
const open = ref(false)
|
||||
const keywords = ref('')
|
||||
|
||||
const selectedKeys = computed(() => {
|
||||
const hit = nav.value.find((n) => n.to === route.path)
|
||||
if (hit) return [hit.to]
|
||||
if (route.path.startsWith('/products')) return ['/products']
|
||||
return ['/']
|
||||
})
|
||||
type HeaderNavItem = {
|
||||
key: string
|
||||
label: string
|
||||
to?: string
|
||||
href?: string
|
||||
target?: string
|
||||
children?: HeaderNavItem[]
|
||||
}
|
||||
|
||||
const { data: siteInfo } = useSiteInfo()
|
||||
const siteName = computed(() => {
|
||||
const data = siteInfo.value?.data
|
||||
if (data && typeof data === 'object' && 'websiteName' in data) {
|
||||
const websiteName = (data as { websiteName?: unknown }).websiteName
|
||||
if (typeof websiteName === 'string' && websiteName.trim()) return websiteName.trim()
|
||||
}
|
||||
return '网宿软件'
|
||||
|
||||
const selectedKeys = computed(() => {
|
||||
const flatten = (items: HeaderNavItem[]) =>
|
||||
items.flatMap((i) => [i, ...(i.children?.length ? flatten(i.children) : [])])
|
||||
const all = flatten(navItems.value)
|
||||
|
||||
const exactHit = all.find((n) => n.to === route.path)
|
||||
if (exactHit) return [exactHit.key]
|
||||
|
||||
const prefixHit = all
|
||||
.filter((n) => n.to && n.to !== '/' && route.path.startsWith(n.to))
|
||||
.sort((a, b) => (b.to?.length ?? 0) - (a.to?.length ?? 0))[0]
|
||||
if (prefixHit) return [prefixHit.key]
|
||||
|
||||
const home = all.find((n) => n.to === '/')
|
||||
return home ? [home.key] : []
|
||||
})
|
||||
|
||||
type SiteInfoData = {
|
||||
websiteName?: unknown
|
||||
websiteLogo?: unknown
|
||||
websiteIcon?: unknown
|
||||
topNavs?: unknown
|
||||
setting?: unknown
|
||||
config?: unknown
|
||||
} & Record<string, unknown>
|
||||
|
||||
const siteData = computed<SiteInfoData | null>(() => {
|
||||
const data = siteInfo.value?.data
|
||||
if (data && typeof data === 'object') return data as SiteInfoData
|
||||
return null
|
||||
})
|
||||
|
||||
function pickString(source: unknown, key: string) {
|
||||
if (!source || typeof source !== 'object') return ''
|
||||
const record = source as Record<string, unknown>
|
||||
const value = record[key]
|
||||
return typeof value === 'string' ? value.trim() : ''
|
||||
}
|
||||
|
||||
const siteName = computed(() => {
|
||||
const websiteName = siteData.value?.websiteName
|
||||
return typeof websiteName === 'string' && websiteName.trim() ? websiteName.trim() : '行于思破产事务服务平台'
|
||||
})
|
||||
|
||||
const isHome = computed(() => route.path === '/')
|
||||
|
||||
const logoUrl = computed(() => {
|
||||
const data = siteData.value
|
||||
const logo = typeof data?.websiteLogo === 'string' ? data.websiteLogo.trim() : ''
|
||||
const icon = typeof data?.websiteIcon === 'string' ? data.websiteIcon.trim() : ''
|
||||
return (
|
||||
logo ||
|
||||
icon ||
|
||||
'https://oss.wsdns.cn/20251226/675876f9f5a84732b22efc02b275440a.png'
|
||||
)
|
||||
})
|
||||
|
||||
const siteSlogan = computed(() => {
|
||||
const data = siteData.value
|
||||
const slogan =
|
||||
pickString(data?.setting, 'slogan') ||
|
||||
pickString(data?.setting, 'subtitle') ||
|
||||
pickString(data?.config, 'slogan')
|
||||
return slogan || 'XINGYUSI BANKRUPTCY TRANSACTION SERVICE PLATFORM'
|
||||
})
|
||||
|
||||
const missionText = computed(() => '致力于企业纾困和破产事务服务')
|
||||
const valuesText = computed(() => '真诚 · 奉献 · 规范 · 聚力')
|
||||
|
||||
function normalizePath(path: unknown) {
|
||||
if (typeof path !== 'string') return ''
|
||||
const p = path.trim()
|
||||
if (!p) return ''
|
||||
if (/^https?:\/\//i.test(p)) return p
|
||||
if (p.startsWith('/')) return p
|
||||
return `/${p}`
|
||||
}
|
||||
|
||||
function normalizeNavTree(list: CmsNavigation[]): HeaderNavItem[] {
|
||||
const normalizeOne = (n: CmsNavigation): HeaderNavItem => {
|
||||
const label = String(n.title || n.label || '').trim() || '未命名'
|
||||
const rawPath = normalizePath(n.path)
|
||||
const isExternal = /^https?:\/\//i.test(rawPath)
|
||||
const children =
|
||||
Array.isArray(n.children) && n.children.length
|
||||
? n.children
|
||||
.slice()
|
||||
.filter((c) => (c.hide ?? 0) !== 1)
|
||||
.sort((a, b) => (a.sortNumber ?? 0) - (b.sortNumber ?? 0))
|
||||
.map(normalizeOne)
|
||||
: undefined
|
||||
const key = String(n.code || n.navigationId || rawPath || label)
|
||||
const target = n.target ? String(n.target) : (isExternal ? '_blank' : undefined)
|
||||
return {
|
||||
key,
|
||||
label,
|
||||
...(isExternal ? { href: rawPath } : { to: rawPath || '/' }),
|
||||
target,
|
||||
...(children?.length ? { children } : {})
|
||||
}
|
||||
}
|
||||
|
||||
return list
|
||||
.filter((n) => (n.hide ?? 0) !== 1)
|
||||
.slice()
|
||||
.sort((a, b) => (a.sortNumber ?? 0) - (b.sortNumber ?? 0))
|
||||
.map(normalizeOne)
|
||||
}
|
||||
|
||||
const navItems = computed<HeaderNavItem[]>(() => {
|
||||
const apiNavs = siteData.value?.topNavs
|
||||
if (Array.isArray(apiNavs) && apiNavs.length) {
|
||||
return normalizeNavTree(apiNavs as CmsNavigation[])
|
||||
}
|
||||
// Fallback when CMS has not configured topNavs.
|
||||
return mainNav.map((n) => ({ key: n.key || n.to, label: n.label, to: n.to }))
|
||||
})
|
||||
|
||||
function isActive(item: HeaderNavItem) {
|
||||
const isHit = (candidate: HeaderNavItem): boolean => {
|
||||
if (candidate.to && candidate.to === route.path) return true
|
||||
return !!candidate.children?.some(isHit)
|
||||
}
|
||||
return isHit(item)
|
||||
}
|
||||
|
||||
function onNavClick(item: HeaderNavItem) {
|
||||
open.value = false
|
||||
if (item.href) {
|
||||
window.open(item.href, item.target || '_blank')
|
||||
return
|
||||
}
|
||||
if (item.to) navigateTo(item.to)
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
if (!keywords.value.trim()) return
|
||||
navigateTo({ path: '/articles', query: { keywords: keywords.value.trim() } })
|
||||
}
|
||||
|
||||
const token = ref('')
|
||||
const user = ref<User | null>(null)
|
||||
const isAuthed = computed(() => !!token.value)
|
||||
@@ -121,6 +330,13 @@ function onNav(to: string) {
|
||||
navigateTo(to)
|
||||
}
|
||||
|
||||
const todayText = computed(() => {
|
||||
const d = new Date()
|
||||
const week = ['日', '一', '二', '三', '四', '五', '六'][d.getDay()] || ''
|
||||
const pad = (n: number) => String(n).padStart(2, '0')
|
||||
return `${d.getFullYear()}年${pad(d.getMonth() + 1)}月${pad(d.getDate())}日 星期${week}`
|
||||
})
|
||||
|
||||
async function refreshAuth() {
|
||||
token.value = getToken()
|
||||
if (!token.value) {
|
||||
@@ -186,14 +402,109 @@ onUnmounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.header {
|
||||
background: #111827;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
||||
padding: 0;
|
||||
.site-header {
|
||||
background: #fff;
|
||||
}
|
||||
.menu {
|
||||
background: transparent;
|
||||
border-bottom: none;
|
||||
min-width: 520px;
|
||||
|
||||
.topbar {
|
||||
background: #f7f7f7;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.topbar-left {
|
||||
color: rgba(0, 0, 0, 0.7);
|
||||
padding: 6px 0;
|
||||
}
|
||||
|
||||
.topbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 6px 0;
|
||||
}
|
||||
|
||||
.topbar-search {
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
.topbar-user {
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.brandbar {
|
||||
background:
|
||||
linear-gradient(0deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.88)),
|
||||
radial-gradient(circle at 25% 20%, rgba(220, 38, 38, 0.12), transparent 60%),
|
||||
radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.12), transparent 55%),
|
||||
linear-gradient(180deg, #f2f4f7, #ffffff);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.brand-title {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.brand-name {
|
||||
font-size: 28px;
|
||||
line-height: 1.1;
|
||||
font-weight: 800;
|
||||
color: #b91c1c;
|
||||
}
|
||||
|
||||
.brand-sub {
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.08em;
|
||||
color: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.brand-mission {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #1d4ed8;
|
||||
}
|
||||
|
||||
.brand-values {
|
||||
margin-top: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: rgba(0, 0, 0, 0.65);
|
||||
}
|
||||
|
||||
.navbar {
|
||||
background: #c30000;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.15);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.nav {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 48px;
|
||||
padding: 0 18px;
|
||||
color: rgba(255, 255, 255, 0.92);
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav-link:hover {
|
||||
color: #fff;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
.nav-link.active {
|
||||
background: rgba(255, 255, 255, 0.18);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.nav-spacer {
|
||||
height: 48px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user