feat(home): 重构首页界面并移除文章相关页面
- 添加公司信息配置文件,包含项目名称、地址、经营范围等 - 实现404页面路由,显示页面建设中提示和导航按钮 - 在首页集成公司信息展示,包括经营范围和资质信息 - 移除文章列表页、文章详情页、栏目页和单页内容相关功能 - 更新Ant Design主题配色为绿色主色调 - 简化首页布局,突出业务板块和服务导向设计 - 删除部署方案和开通流程等临时页面内容
This commit is contained in:
@@ -7,38 +7,9 @@
|
||||
</div>
|
||||
|
||||
<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="profile">个人资料</a-menu-item>
|
||||
<a-menu-divider />
|
||||
<a-menu-item key="logout">退出登录</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<div class="hidden md:flex items-center gap-2">
|
||||
<a-button size="small" @click="navigateTo('/products')">经营范围</a-button>
|
||||
<a-button size="small" type="primary" @click="navigateTo('/contact')">联系我们</a-button>
|
||||
</div>
|
||||
|
||||
<a-button class="md:hidden" size="small" @click="open = true">菜单</a-button>
|
||||
@@ -137,30 +108,21 @@
|
||||
</a-menu>
|
||||
|
||||
<div class="mt-4">
|
||||
<a-button v-if="!isAuthed" block type="primary" @click="onNav('/login')">登录</a-button>
|
||||
<template v-else>
|
||||
<a-button block @click="goConsoleCenter">管理中心</a-button>
|
||||
<a-button block @click="goDeveloperCenter">开发者中心</a-button>
|
||||
<a-button block @click="onNav('/profile')">个人资料</a-button>
|
||||
<a-button block danger class="mt-2" @click="logout">退出登录</a-button>
|
||||
</template>
|
||||
<a-space direction="vertical" class="w-full">
|
||||
<a-button type="primary" block @click="onNav('/contact')">联系我们</a-button>
|
||||
<a-button block @click="onNav('/products')">经营范围</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
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'
|
||||
import { COMPANY } from '@/config/company'
|
||||
|
||||
const route = useRoute()
|
||||
const open = ref(false)
|
||||
const keywords = ref('')
|
||||
|
||||
type HeaderNavItem = {
|
||||
key: string
|
||||
@@ -218,10 +180,8 @@ const siteName = computed(() => {
|
||||
})
|
||||
|
||||
const showBrandbar = computed(() => {
|
||||
const p = route.path || '/'
|
||||
if (p === '/') return true
|
||||
// 文章列表、单页详情、文章详情都显示 brandbar
|
||||
return p === '/articles' || p.startsWith('/article/') || p.startsWith('/page/') || p.startsWith('/item/')
|
||||
// Corporate site: keep brand bar consistent across pages.
|
||||
return true
|
||||
})
|
||||
|
||||
const logoUrl = computed(() => {
|
||||
@@ -241,10 +201,10 @@ const siteSlogan = computed(() => {
|
||||
pickString(data?.setting, 'slogan') ||
|
||||
pickString(data?.setting, 'subtitle') ||
|
||||
pickString(data?.config, 'slogan')
|
||||
return slogan || 'XINGYUSI BANKRUPTCY TRANSACTION SERVICE PLATFORM'
|
||||
return slogan || `${COMPANY.projectName} · 品质服务与合规经营`
|
||||
})
|
||||
|
||||
const missionText = computed(() => '致力于企业纾困和破产事务服务')
|
||||
const missionText = computed(() => '生物基材料研发 · 技术服务 · 食品与农产品流通')
|
||||
const valuesText = computed(() => '真诚 · 奉献 · 规范 · 聚力')
|
||||
|
||||
function normalizePath(path: unknown) {
|
||||
@@ -290,6 +250,7 @@ function normalizeNavTree(list: CmsNavigation[]): HeaderNavItem[] {
|
||||
const navItems = computed<HeaderNavItem[]>(() => {
|
||||
const apiNavs = siteData.value?.topNavs
|
||||
if (Array.isArray(apiNavs) && apiNavs.length) {
|
||||
// Prefer navigation from getShopInfo (CMS-managed).
|
||||
return normalizeNavTree(apiNavs as CmsNavigation[])
|
||||
}
|
||||
// Fallback when CMS has not configured topNavs.
|
||||
@@ -313,28 +274,6 @@ function onNavClick(item: HeaderNavItem) {
|
||||
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)
|
||||
const userName = computed(() => String(user.value?.nickname || user.value?.username || '已登录'))
|
||||
const userAvatar = computed(() => {
|
||||
const candidate =
|
||||
user.value?.avatarUrl ||
|
||||
user.value?.avatar ||
|
||||
user.value?.merchantAvatar ||
|
||||
user.value?.logo ||
|
||||
''
|
||||
if (typeof candidate !== 'string') return ''
|
||||
const normalized = candidate.trim()
|
||||
if (!normalized || normalized === 'null' || normalized === 'undefined') return ''
|
||||
return normalized
|
||||
})
|
||||
|
||||
function onNav(to: string) {
|
||||
open.value = false
|
||||
navigateTo(to)
|
||||
@@ -346,69 +285,6 @@ const todayText = computed(() => {
|
||||
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) {
|
||||
user.value = null
|
||||
clearAuthz()
|
||||
return
|
||||
}
|
||||
try {
|
||||
user.value = await getUserInfo()
|
||||
setAuthzFromUser(user.value)
|
||||
} catch {
|
||||
// token may be expired; keep authed UI but without profile info
|
||||
clearAuthz()
|
||||
}
|
||||
}
|
||||
|
||||
function goConsoleCenter() {
|
||||
if (!isAuthed.value) return navigateTo('/login')
|
||||
open.value = false
|
||||
navigateTo('/console')
|
||||
}
|
||||
|
||||
function goDeveloperCenter() {
|
||||
if (!isAuthed.value) return navigateTo('/login')
|
||||
open.value = false
|
||||
if (!hasRole('developer')) return message.error('您还不是开发者')
|
||||
navigateTo('/developer')
|
||||
}
|
||||
|
||||
function logout() {
|
||||
removeToken()
|
||||
try {
|
||||
localStorage.removeItem('TenantId')
|
||||
localStorage.removeItem('UserId')
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
clearAuthz()
|
||||
user.value = null
|
||||
token.value = ''
|
||||
open.value = false
|
||||
navigateTo('/')
|
||||
}
|
||||
|
||||
function onUserMenuClick(info: { key: string }) {
|
||||
if (info.key === 'console') return goConsoleCenter()
|
||||
if (info.key === 'developer') return goDeveloperCenter()
|
||||
if (info.key === 'profile') return navigateTo('/profile')
|
||||
if (info.key === 'logout') return logout()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
refreshAuth()
|
||||
|
||||
window.addEventListener('auth-token-changed', refreshAuth)
|
||||
window.addEventListener('storage', refreshAuth)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('auth-token-changed', refreshAuth)
|
||||
window.removeEventListener('storage', refreshAuth)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -434,14 +310,6 @@ onUnmounted(() => {
|
||||
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)),
|
||||
@@ -468,7 +336,7 @@ onUnmounted(() => {
|
||||
font-size: 28px;
|
||||
line-height: 1.1;
|
||||
font-weight: 800;
|
||||
color: #b91c1c;
|
||||
color: #15803d;
|
||||
}
|
||||
|
||||
.brand-sub {
|
||||
@@ -491,7 +359,7 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
.navbar {
|
||||
background: #c30000;
|
||||
background: #16a34a;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.15);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user