first commit

This commit is contained in:
2026-01-26 09:33:40 +08:00
commit 2589ef668d
106 changed files with 17738 additions and 0 deletions
+261
View File
@@ -0,0 +1,261 @@
<template>
<div class="not-found">
<!-- Load page -->
<div class="animationload">
<div class="loader"></div>
</div>
<!-- Content Wrapper -->
<div id="wrapper">
<div class="container">
<!-- Switcher -->
<div class="switcher">
<label for="sw" class="sw_btn"></label>
<div class="bg"></div>
</div>
<!-- Dark version -->
<div id="dark" class="row text-center" v-show="isDark">
<div class="info">
<img :src="darkImage" alt="404 error" />
</div>
</div>
<!-- Light version -->
<div
id="light"
class="row text-center"
style="display: flex; justify-content: center; align-items: center"
v-show="!isDark"
>
<div class="info">
<img :src="lightImage" alt="404 error" />
<p>
您要查找的页面已被移动或删除
<br />
被重新命名或者可能从未存在过
</p>
<router-link to="/" class="btn">返回首页</router-link>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import darkImage from '@/assets/images/404/404-dark.png'
import lightImage from '@/assets/images/404/404-light.gif'
// 导入 jQuery 类型
import type { JQueryStatic } from 'jquery'
// 声明 Modernizr 类型
interface ModernizrStatic {
// 添加 Modernizr 需要的属性和方法
[key: string]: boolean | string | number | object | undefined
}
// 声明全局类型
declare global {
interface Window {
jQuery: JQueryStatic
$: JQueryStatic
init404Page?: () => void
Modernizr: ModernizrStatic
}
}
// 使用 useRouter 但不需要返回值
useRouter()
const isDark = ref(false)
const toggleTheme = () => {
document.body.classList.toggle('dark-theme', isDark.value)
}
onMounted(() => {
// Initialize theme
document.body.classList.toggle('dark-theme', isDark.value)
// 在组件挂载后加载脚本
onMounted(() => {
// 加载 CSS 文件
const loadCSS = (href: string) => {
return new Promise<void>((resolve, reject) => {
const link = document.createElement('link')
link.rel = 'stylesheet'
link.href = href
link.onload = () => resolve()
link.onerror = (err) => reject(err)
document.head.appendChild(link)
})
}
// 加载 JS 文件
const loadJS = (src: string) => {
return new Promise<void>((resolve, reject) => {
const script = document.createElement('script')
script.src = src
script.onload = () => resolve()
script.onerror = (err) => reject(err)
document.body.appendChild(script)
})
}
// 加载所有资源
const loadAll = async () => {
try {
// 加载 CSS
await Promise.all([
loadCSS('/src/assets/css/bootstrap.min.css'),
loadCSS('/src/assets/css/404.min.css'),
loadCSS('/src/assets/css/font-face.css'),
])
// 加载 JS
await loadJS('/node_modules/jquery/dist/jquery.min.js')
// 设置全局 jQuery
const win = window as unknown as {
jQuery: JQueryStatic
$: JQueryStatic
}
window.jQuery = window.$ = win.jQuery || win.$
await Promise.all([
loadJS('/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js'),
loadJS('/src/assets/js/modernizr.custom.js'),
loadJS('/node_modules/jquery.nicescroll/jquery.nicescroll.min.js'),
loadJS('/src/assets/js/404.min.js'),
])
// 调用初始化函数(如果存在)
if (typeof window.init404Page === 'function') {
window.init404Page()
}
} catch (error) {
console.error('Error loading resources:', error)
}
}
loadAll()
})
})
</script>
<style scoped>
/* Add any component-specific styles here */
.not-found {
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
}
/* Ensure the wrapper takes full height */
#wrapper {
min-height: 100vh;
display: flex;
align-items: center;
}
/* Make sure the container is properly centered */
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
/* Make images responsive */
img {
max-width: 100%;
height: auto;
}
/* Style the home button */
.btn {
display: inline-block;
margin-top: 20px;
padding: 10px 20px;
background: #3498db;
color: white;
text-decoration: none;
border-radius: 4px;
transition: background 0.3s ease;
}
.btn:hover {
background: #2980b9;
}
/* Add smooth transitions for theme switching */
#dark,
#light {
transition: opacity 0.3s ease;
}
.info{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* Ensure proper spacing for the switcher */
.switcher {
position: fixed;
top: 20px;
right: 20px;
z-index: 1000;
}
/* 主题切换器文本样式 */
.switcher .text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 12px;
color: #666;
text-align: center;
line-height: 1.4;
white-space: nowrap;
pointer-events: none;
user-select: none;
transition: color 0.3s ease;
}
.switcher .text-l {
display: block;
margin-top: 2px;
font-size: 11px;
color: #999;
}
/* 暗色主题下的文本颜色 */
.dark-theme .switcher .text {
color: #ccc;
}
.dark-theme .switcher .text-l {
color: #aaa;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.container {
padding: 10px;
}
.switcher {
position: relative;
top: 0;
right: 0;
margin: 20px auto;
display: inline-block;
}
}
</style>
+617
View File
@@ -0,0 +1,617 @@
<template>
<Header />
<div class="detail">
<div class="backimage"></div>
<div class="content">
<div class="content-left">
<div class="detail-header">
<h1>{{ article.title }}</h1>
<el-divider></el-divider>
<div class="detail-meta">
<div>
<i class="fa-regular fa-calendar"></i>
{{ article.publishdate }}
</div>
<div>
<i class="fa-solid fa-user-pen"></i>
{{ article.author }}
</div>
<div>
<i class="fa-solid fa-list"></i>
{{ article.catename }}
</div>
<div>
<i class="fa-regular fa-thumbs-up"></i>
{{ article.likes }}
</div>
<div>
<i class="fa-regular fa-eye"></i>
{{ article.views }}
</div>
</div>
</div>
<div class="detail-content" ref="contentRef">
<div v-html="article.content" class="content-html"></div>
</div>
<div class="theend">
<el-divider></el-divider>
<div class="the-end">The End</div>
<el-divider></el-divider>
</div>
<div class="endtool">
<div
style="
margin-bottom: 65px;
display: flex;
justify-content: center;
align-items: center;
gap: 40px;
"
>
<div class="tool-item" @click="handleShareClick">
<div class="tool-icon">
<i class="fa-solid fa-share-nodes"></i>
</div>
<span class="tool-text">分享</span>
</div>
<div class="tool-item" @click="handleLikeClick">
<div class="tool-icon">
<i
class="fa-regular fa-thumbs-up"
:class="{ liked: article.liked }"
></i>
</div>
<span class="tool-text">
{{ article.liked ? '取消点赞' : '点赞' }}
</span>
</div>
<div class="tool-item">
<div class="tool-icon">
<i class="fa-regular fa-comment"></i>
</div>
<span class="tool-text">评论</span>
</div>
</div>
</div>
<div class="article-nav">
<div
class="nav-item"
v-if="nextPreviousArticles.previous"
@click="goToArticle(nextPreviousArticles.previous.id)"
>
<div class="nav-label">
<i class="fa-solid fa-arrow-left"></i>
上一篇
</div>
<div class="nav-title">
{{ nextPreviousArticles.previous.title }}
</div>
</div>
<div
class="nav-item"
v-if="nextPreviousArticles.next"
@click="goToArticle(nextPreviousArticles.next.id)"
>
<div class="nav-label">
下一篇
<i class="fa-solid fa-arrow-right"></i>
</div>
<div class="nav-title">{{ nextPreviousArticles.next.title }}</div>
</div>
</div>
</div>
<div class="content-right">
<div class="card-item">
<div class="card-header">相关文章</div>
<el-divider></el-divider>
<div class="card-content">
<div
class="article-item"
v-for="item in relatedArticles"
:key="item.id"
>
<div class="thumb-img">
<img :src="imagePath(item.image)" alt="" />
</div>
<div class="article-title">{{ item.title }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
<Footer />
</template>
<script lang="ts" setup>
import { ref, onMounted, nextTick, getCurrentInstance } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { addLike, reduceLike } from '@/api/article'
import Header from '@/views/components/header.vue'
import Footer from '@/views/components/footer.vue'
import { getKingdeeNewsDetail, getCompanyNewsDetail } from '@/api/newscenter'
const route = useRoute()
const article = ref({})
const relatedArticles = ref([])
const nextPreviousArticles = ref<{
previous?: { id: number; title: string }
next?: { id: number; title: string }
}>({})
const loading = ref(true)
const { proxy } = getCurrentInstance()
const router = useRouter()
const contentRef = ref<HTMLElement | null>(null)
const VITE_APP_API_URL = import.meta.env.VITE_APP_API_URL
// 处理代码块复制功能
const handleCopyCode = async (e: Event) => {
const target = e.target as HTMLElement
const preElement = target.closest('.code-block-wrapper')
if (!preElement) return
const codeElement = preElement.querySelector('code')
if (!codeElement) return
const code = codeElement.innerText
try {
await navigator.clipboard.writeText(code)
proxy.$message.success('复制成功')
} catch (err) {
proxy.$message.error('复制失败,请手动复制')
}
}
// 为代码块添加复制按钮
const initCodeBlocks = () => {
if (!contentRef.value) return
const preElements = contentRef.value.querySelectorAll('pre')
preElements.forEach((pre) => {
if (pre.parentElement?.classList.contains('code-block-wrapper')) return
const wrapper = document.createElement('div')
wrapper.className = 'code-block-wrapper'
pre.parentNode?.insertBefore(wrapper, pre)
wrapper.appendChild(pre)
const copyBtn = document.createElement('button')
copyBtn.className = 'copy-code-btn'
copyBtn.innerHTML = '<i class="fa-regular fa-copy"></i>'
copyBtn.title = '复制代码'
copyBtn.onclick = handleCopyCode
wrapper.appendChild(copyBtn)
})
}
//分享功能
const handleShareClick = async () => {
const url = window.location.href
try {
await navigator.clipboard.writeText(url)
proxy.$message.success('复制地址成功')
} catch (err) {
proxy.$message.error('复制失败,请手动复制地址')
}
}
//点赞增加
const handleLikeClick = async () => {
if (article.value.liked) {
await reduceLike(article.value.id)
article.value.likes--
article.value.liked = false
} else {
await addLike(article.value.id)
article.value.likes++
article.value.liked = true
}
}
//拼接接口图片路径
const imagePath = (path: string) => {
if (!path) {
return new URL('@/assets/images/noimage.png', import.meta.url).href
}
return VITE_APP_API_URL + path
}
const goToArticle = (id: number) => {
if (route.path.includes('companyNews')) {
router.push(`/companyNews/detail/${id}`)
} else if (route.path.includes('kingdeeNews')) {
router.push(`/kingdeeNews/detail/${id}`)
} else {
router.push(`/kingdeeNews/detail/${id}`)
}
}
onMounted(async () => {
const id = route.params.id
loading.value = true
try {
let res
const path = route.path
if (path.includes('companyNews')) {
res = await getCompanyNewsDetail(id)
} else if (path.includes('kingdeeNews')) {
res = await getKingdeeNewsDetail(id)
} else {
res = await getKingdeeNewsDetail(id)
}
if (res.code === 200) {
article.value = res.data
nextTick(() => {
initCodeBlocks()
})
if (res.data.relatedArticles && res.data.relatedArticles.list) {
relatedArticles.value = res.data.relatedArticles.list.map(
(item: any) => ({
...item,
catename: item.cate,
}),
)
}
if (res.data.nextPreviousArticles) {
nextPreviousArticles.value = res.data.nextPreviousArticles
}
}
} catch (err) {
console.error('获取文章详情失败:', err)
} finally {
loading.value = false
}
})
</script>
<style lang="scss" scoped>
.detail {
padding-top: 120px;
background-color: #f8f8f8;
padding-bottom: 120px;
.content {
width: 1200px;
margin: 0 auto;
display: flex;
gap: 20px;
position: relative;
z-index: 1;
.content-left {
width: 70%;
border-radius: 10px;
background-color: #fff;
opacity: 0.9;
.detail-header {
margin-bottom: 20px;
padding: 50px 50px 0 50px;
.detail-meta {
display: flex;
align-items: center;
gap: 20px;
color: #707070;
font-size: 14px;
padding-bottom: 20px;
}
}
.detail-content {
padding: 0 50px;
.content-html {
:deep(pre) {
position: relative;
padding-right: 50px;
}
}
/* 代码块包装器 */
:deep(.code-block-wrapper) {
position: relative;
border-radius: 12px;
overflow: hidden;
margin: 20px 0;
pre {
margin: 0;
}
}
/* 复制按钮 */
:deep(.copy-code-btn) {
position: absolute;
top: 10px;
right: 10px;
width: 25px;
height: 25px;
border: none;
border-radius: 6px;
background: rgba(255, 255, 255, 0.1);
color: rgba(255, 255, 255, 0.7);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
transition: all 0.2s ease;
z-index: 10;
&:hover {
background: rgba(255, 255, 255, 0.2);
color: #fff;
}
&:active {
transform: scale(0.95);
}
}
/* 代码样式 */
:deep(code) {
border-radius: 4px;
padding: 2px 6px;
font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
font-size: 13px;
color: #f06b6b;
}
/* 代码块样式 */
:deep(pre) {
background: linear-gradient(135deg, #1e1e2e 0%, #2d2d3f 100%);
border-radius: 12px;
padding: 10px;
overflow-x: auto;
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
code {
background-color: transparent;
padding: 0;
padding-left: 10px;
color: #cdd6f4;
font-size: 13px;
line-height: 1.7;
}
}
:deep(img) {
width: 100%;
height: auto;
max-width: 100%;
display: block;
}
:deep(p) {
font-size: 14px;
line-height: 25px;
color: #606266;
}
}
.theend {
display: flex;
justify-content: center;
align-items: center;
gap: 20px;
margin: 60px;
.the-end {
width: 200px;
text-align: center;
color: #dcdfe6;
}
}
.endtool {
padding: 65px;
.tool-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
cursor: pointer;
transition: transform 0.3s ease;
&:hover {
transform: translateY(-5px);
.tool-icon {
background-color: #ff6b6b;
box-shadow: 0 8px 20px rgba(64, 158, 255, 0.4);
}
}
&:active {
transform: translateY(-2px);
.tool-icon {
background-color: #337ecc;
box-shadow: 0 4px 10px rgba(64, 158, 255, 0.3);
transform: scale(0.95);
}
}
&:has(.liked) {
.tool-icon {
background-color: #ff6b6b;
box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}
.tool-text {
color: #ff6b6b;
}
}
.tool-icon {
width: 50px;
height: 50px;
border-radius: 50%;
background-color: #409eff;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
font-size: 20px;
box-shadow: 0 4px 15px rgba(64, 158, 255, 0.3);
transition: all 0.3s ease;
.fa-thumbs-up.liked {
color: #fff;
animation: likeAnimation 0.4s ease;
}
}
.tool-text {
font-size: 14px;
color: #606266;
font-weight: 500;
transition: color 0.3s ease;
}
&:hover .tool-text {
color: #409eff;
}
}
}
.article-nav {
display: flex;
justify-content: space-between;
padding: 30px 65px;
border-top: 1px solid #f0f0f0;
.nav-item {
max-width: 45%;
cursor: pointer;
transition: all 0.3s ease;
&:hover {
.nav-label {
color: #409eff;
}
.nav-title {
color: #409eff;
}
}
.nav-label {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
color: #909399;
margin-bottom: 10px;
transition: color 0.3s ease;
}
.nav-title {
font-size: 14px;
color: #303133;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
transition: color 0.3s ease;
}
}
}
}
.content-right {
width: 30%;
opacity: 0.9;
.card-item {
// position: sticky;
top: 100px;
padding: 30px;
border-radius: 10px;
background-color: #fff;
.card-header {
font-size: 18px;
font-weight: 500;
}
.card-content {
.article-item {
padding-bottom: 20px;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 20px;
&:last-child {
padding-bottom: 0;
border-bottom: none;
margin-bottom: 0;
}
.thumb-img {
width: 100%;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 10px;
}
}
.article-title {
font-size: 16px;
font-weight: 500;
color: #303133;
margin-top: 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
&:hover {
color: #409eff;
transition: color 0.3s ease;
}
}
}
}
}
}
}
}
.backimage {
width: 800px;
height: 400px;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
position: fixed;
right: 100px;
bottom: 100px;
pointer-events: none;
background-image: url('@/assets/images/sologen.png');
opacity: 0.2;
}
@keyframes likeAnimation {
0% {
transform: scale(1);
}
25% {
transform: scale(1.3);
}
50% {
transform: scale(0.9);
}
100% {
transform: scale(1);
}
}
</style>
+206
View File
@@ -0,0 +1,206 @@
<template>
<div class="footer">
<div class="gototop" v-show="showGototop" @click="goToTop">
<i class="fa-solid fa-arrow-up"></i>
</div>
<div class="footer-content">
<div class="footer-main">
<div class="left">
<div class="footer-column">
<div class="title">关于美天</div>
<ul>
<li>企业概况</li>
<li>公司证件</li>
<li>新闻中心</li>
<li>加入我们</li>
<li>联系我们</li>
</ul>
</div>
<div class="footer-column">
<div class="title">产品中心</div>
<ul>
<li>金蝶·云星空</li>
<li>金蝶·KIS Cloud</li>
<li>金蝶·EAS Cloud</li>
<li>警务保障系统</li>
<li>义警联盟平台</li>
<li>商超进销存系统</li>
</ul>
</div>
<div class="footer-column">
<div class="title">解决方案</div>
<ul>
<li>财务云</li>
<li>供应链云</li>
<li>全渠道云</li>
<li>制造云</li>
</ul>
</div>
<div class="footer-column">
<div class="title">服务支持</div>
<ul>
<li>常见问题</li>
<li>软件下载</li>
<li>投诉与建议</li>
</ul>
</div>
<div class="footer-column">
<div class="title">商务合作</div>
<ul>
<li>商务合作</li>
</ul>
</div>
</div>
<div class="right">
<div class="footer-column">
<div class="title">订阅我们</div>
<div>第一时间了解我们的最新信息</div>
</div>
</div>
</div>
<div class="footer-bottom">
<div class="left">
<span>美天为您用心多一点</span>
<span>江苏美天智能科技有限公司·所有版权©2019-2026</span>
<span>备案号:苏ICP备2020053493号</span>
</div>
<div class="right">
<span>法律声明 | 隐私条款</span>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue'
const showGototop = ref(false)
const handleScroll = () => {
showGototop.value = window.scrollY > 300
}
const goToTop = () => {
window.scrollTo({
top: 0,
behavior: 'smooth'
})
}
onMounted(() => {
window.addEventListener('scroll', handleScroll)
handleScroll()
})
onUnmounted(() => {
window.removeEventListener('scroll', handleScroll)
})
</script>
<style lang="scss" scoped>
.footer {
width: 100%;
background-color: var(--tw-bg-opacity);
color: var(--footer-color);
font-size: var(--footer-size);
padding: 20px 0;
margin-top: auto;
position: relative;
z-index: 99;
.footer-content {
width:1200px;
margin: 0 auto;
}
.title {
font-size: var(--footer-title);
font-weight: var(--footer-title-weight);
margin-bottom: 16px;
color: #fff;
}
ul {
list-style: none;
padding: 0;
margin: 0;
}
li {
margin-bottom: 12px;
cursor: pointer;
transition: color 0.3s;
}
li:hover {
color: #fff;
}
.footer-main {
display: flex;
padding: 40px 0;
.left {
width: 80%;
display: flex;
.footer-column {
flex: 1;
padding: 0 15px;
}
}
.right {
width: 20%;
}
}
.footer-bottom {
border-top: 1px solid #fff;
padding: 20px 0;
display: flex;
justify-content: space-between;
.left {
display: flex;
p {
margin-right: 12px;
}
}
}
.gototop {
position: fixed;
right: 40px;
bottom: 40px;
width: 50px;
height: 50px;
border-radius: 50%;
background-color: #409eff;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
box-shadow: 0 4px 15px rgba(64, 158, 255, 0.3);
transition: all 0.3s ease;
z-index: 9999;
i {
font-size: 20px;
}
&:hover {
background-color: #ff6b6b;
transform: translateY(-5px);
box-shadow: 0 8px 20px rgba(64, 158, 255, 0.4);
}
&:active {
transform: scale(0.95);
}
}
}
</style>
+887
View File
@@ -0,0 +1,887 @@
<template>
<div class="site-header-nav" :class="{ scrolled: isScrolled }" id="top">
<div class="container">
<div class="maincontent">
<div class="logo">
<img src="@/assets/images/logo.png" alt="Logo" />
</div>
<div class="menu">
<ul @mouseleave="handleMenuLeave">
<li
v-for="(item, index) in menuItems"
:key="index"
@mouseenter="handleMenuEnter(index)"
>
<!-- 一级菜单根据类型处理跳转 -->
<template v-if="!item.children || item.children.length === 0">
<!-- type 2: 页面 - 正常路由跳转 -->
<router-link
v-if="item.type === 2"
:to="item.path"
class="menu-link"
>
{{ item.title }}
</router-link>
<!-- type 4: 单页 - 跳转到单页路由 -->
<router-link
v-else-if="item.type === 4"
:to="item.path"
class="menu-link"
>
{{ item.title }}
</router-link>
<!-- type 3: 外链 - 直接打开外链 -->
<a
v-else-if="item.type === 3 && item.link_url"
:href="item.link_url"
target="_blank"
rel="noopener noreferrer"
class="menu-link"
@click.prevent="handleExternalLink(item.link_url)"
>
{{ item.title }}
</a>
<!-- type 1: 目录 - 不可点击只显示文本 -->
<span v-else class="menu-text">{{ item.title }}</span>
</template>
<span v-else class="menu-text">{{ item.title }}</span>
<!-- 下拉菜单显示二级和三级 -->
<div
v-if="
item.children &&
item.children.length > 0 &&
activeMenu === index
"
class="site-header-dropdown-menu"
@mouseenter="handleMenuEnter(index)"
@mouseleave="handleMenuLeave"
>
<div class="site-header-dropdown-container">
<!-- 左侧:二级菜单列表 -->
<div class="category-list">
<div
v-for="(category, catIndex) in item.children"
:key="'cat-' + catIndex"
class="category-item"
:class="{ active: activeCategory === catIndex }"
@mouseenter="activeCategory = catIndex"
>
{{ category.title }}
</div>
</div>
<!-- 右侧:三级菜单内容 -->
<div class="content-panel">
<div v-if="item.children[activeCategory || 0]">
<div class="content-section11">
<div>
<h3>
{{ item.children[activeCategory || 0].title }}
</h3>
</div>
<div class="content-grid">
<!-- 如果二级菜单有子菜单(三级),显示三级菜单 -->
<template
v-if="
item.children[activeCategory || 0].children &&
item.children[activeCategory || 0].children
.length > 0
"
>
<template
v-for="(subItem, subIndex) in item.children[
activeCategory || 0
].children"
:key="'sub-' + subIndex"
>
<!-- type 2: 页面 - 正常路由跳转 -->
<router-link
v-if="subItem.type === 2"
:to="subItem.path"
class="content-item"
>
<div class="icon" v-if="subItem.icon">
<i :class="subItem.icon"></i>
</div>
<div class="content">
<h4>{{ subItem.title }}</h4>
<p v-if="subItem.desc">{{ subItem.desc }}</p>
</div>
</router-link>
<!-- type 4: 单页 - 跳转到单页路由 -->
<router-link
v-else-if="subItem.type === 4"
:to="subItem.path"
class="content-item"
>
<div class="icon" v-if="subItem.icon">
<i :class="subItem.icon"></i>
</div>
<div class="content">
<h4>{{ subItem.title }}</h4>
<p v-if="subItem.desc">{{ subItem.desc }}</p>
</div>
</router-link>
<!-- type 3: 外链 - 直接打开外链 -->
<a
v-else-if="
subItem.type === 3 && subItem.link_url
"
:href="subItem.link_url"
target="_blank"
rel="noopener noreferrer"
class="content-item"
@click.prevent="
handleExternalLink(subItem.link_url)
"
>
<div class="icon" v-if="subItem.icon">
<i :class="subItem.icon"></i>
</div>
<div class="content">
<h4>{{ subItem.title }}</h4>
<p v-if="subItem.desc">{{ subItem.desc }}</p>
</div>
</a>
<!-- type 1: 目录 - 不可点击 -->
<div
v-else
class="content-item"
style="cursor: default"
>
<div class="icon" v-if="subItem.icon">
<i :class="subItem.icon"></i>
</div>
<div class="content">
<h4>{{ subItem.title }}</h4>
<p v-if="subItem.desc">{{ subItem.desc }}</p>
</div>
</div>
</template>
</template>
<!-- 如果二级菜单没有子菜单,直接显示二级菜单为可点击项 -->
<template v-else>
<!-- type 2: 页面 - 正常路由跳转 -->
<router-link
v-if="
item.children[activeCategory || 0].type === 2
"
:to="item.children[activeCategory || 0].path"
class="content-item"
>
<div
class="icon"
v-if="item.children[activeCategory || 0].icon"
>
<i
:class="
item.children[activeCategory || 0].icon
"
></i>
</div>
<div class="content">
<h4>
{{ item.children[activeCategory || 0].title }}
</h4>
<p
v-if="item.children[activeCategory || 0].desc"
>
{{ item.children[activeCategory || 0].desc }}
</p>
</div>
</router-link>
<!-- type 4: 单页 - 跳转到单页路由 -->
<router-link
v-else-if="
item.children[activeCategory || 0].type === 4
"
:to="item.children[activeCategory || 0].path"
class="content-item"
>
<div
class="icon"
v-if="item.children[activeCategory || 0].icon"
>
<i
:class="
item.children[activeCategory || 0].icon
"
></i>
</div>
<div class="content">
<h4>
{{ item.children[activeCategory || 0].title }}
</h4>
<p
v-if="item.children[activeCategory || 0].desc"
>
{{ item.children[activeCategory || 0].desc }}
</p>
</div>
</router-link>
<!-- type 3: 外链 - 直接打开外链 -->
<a
v-else-if="
item.children[activeCategory || 0].type === 3 &&
item.children[activeCategory || 0].link_url
"
:href="
item.children[activeCategory || 0].link_url
"
target="_blank"
rel="noopener noreferrer"
class="content-item"
@click.prevent="
handleExternalLink(
item.children[activeCategory || 0].link_url,
)
"
>
<div
class="icon"
v-if="item.children[activeCategory || 0].icon"
>
<i
:class="
item.children[activeCategory || 0].icon
"
></i>
</div>
<div class="content">
<h4>
{{ item.children[activeCategory || 0].title }}
</h4>
<p
v-if="item.children[activeCategory || 0].desc"
>
{{ item.children[activeCategory || 0].desc }}
</p>
</div>
</a>
<!-- type 1: 目录 - 不可点击 -->
<div
v-else
class="content-item"
style="cursor: default"
>
<div
class="icon"
v-if="item.children[activeCategory || 0].icon"
>
<i
:class="
item.children[activeCategory || 0].icon
"
></i>
</div>
<div class="content">
<h4>
{{ item.children[activeCategory || 0].title }}
</h4>
<p
v-if="item.children[activeCategory || 0].desc"
>
{{ item.children[activeCategory || 0].desc }}
</p>
</div>
</div>
</template>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
<div class="search">
<div class="search-icon" @click="showSearch = true">
<i class="fa-solid fa-magnifying-glass"></i>
</div>
<div class="language-switcher" @click="showLanguage = true">
<span>中文</span>
<i class="fa-solid fa-caret-down"></i>
</div>
</div>
<!-- 搜索弹窗 -->
<div
class="modal"
:class="{ active: showSearch }"
@click.self="showSearch = false"
>
<div class="modal-content">
<div class="search-box">
<input
type="text"
placeholder="请输入搜索内容..."
v-model="searchQuery"
@keyup.enter="performSearch"
/>
<button @click="performSearch">搜索</button>
</div>
<button class="close-btn" @click="showSearch = false">×</button>
</div>
</div>
<!-- 语言选择弹窗 -->
<div
class="modal"
:class="{ active: showLanguage }"
@click.self="showLanguage = false"
>
<div class="modal-content language-modal">
<h3>选择语言 / Language</h3>
<div class="language-options">
<div
class="language-option"
:class="{ active: currentLanguage === 'zh' }"
@click="changeLanguage('zh')"
>
<span>中文</span>
</div>
<div
class="language-option"
:class="{ active: currentLanguage === 'en' }"
@click="changeLanguage('en')"
>
<span>English</span>
</div>
</div>
<button class="close-btn" @click="showLanguage = false">×</button>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import { getHeadMenu } from '@/api/index'
// 菜单数据
const menuItems = ref([])
// 统一处理菜单路径大小写
const normalizeMenuPaths = (menus) => {
return menus.map(menu => {
const normalizedMenu = { ...menu }
// 将路径中的 /newscenter/ 替换为 /newsCenter/
if (normalizedMenu.path) {
normalizedMenu.path = normalizedMenu.path.replace(/\/newscenter\//g, '/newsCenter/')
}
// 递归处理子菜单
if (normalizedMenu.children && normalizedMenu.children.length > 0) {
normalizedMenu.children = normalizeMenuPaths(normalizedMenu.children)
}
return normalizedMenu
})
}
// 加载菜单数据
const loadMenu = async () => {
try {
const response = await getHeadMenu()
if (response.code === 200) {
menuItems.value = normalizeMenuPaths(response.data)
}
} catch (error) {
console.error('加载菜单失败:', error)
menuItems.value = []
}
}
const activeMenu = ref(null)
const activeCategory = ref(0)
const showSearch = ref(false)
const showLanguage = ref(false)
const searchQuery = ref('')
const currentLanguage = ref('zh')
const isScrolled = ref(false)
let closeTimer = null
const handleScroll = () => {
isScrolled.value = window.scrollY > 10
}
const performSearch = () => {
if (searchQuery.value.trim()) {
console.log('Searching for:', searchQuery.value)
showSearch.value = false
}
}
const changeLanguage = (lang) => {
currentLanguage.value = lang
showLanguage.value = false
console.log('Language changed to:', lang)
}
const handleMenuEnter = (index) => {
// 清除关闭定时器
if (closeTimer) {
clearTimeout(closeTimer)
closeTimer = null
}
activeMenu.value = index
activeCategory.value = 0 // 重置二级菜单选中状态
}
const handleMenuLeave = () => {
// 延迟关闭,给鼠标移动到其他菜单项的时间
closeTimer = setTimeout(() => {
activeMenu.value = null
activeCategory.value = 0
}, 150) // 150ms 延迟
}
// 处理外链跳转
const handleExternalLink = (url) => {
if (url) {
// 确保 URL 是完整的(包含协议)
const fullUrl =
url.startsWith('http://') || url.startsWith('https://')
? url
: `https://${url}`
window.open(fullUrl, '_blank', 'noopener,noreferrer')
}
}
onMounted(() => {
window.addEventListener('scroll', handleScroll)
loadMenu() // 加载菜单数据
})
onUnmounted(() => {
window.removeEventListener('scroll', handleScroll)
if (closeTimer) {
clearTimeout(closeTimer)
closeTimer = null
}
})
</script>
<style lang="scss" scoped>
.site-header-nav {
width: 100%;
height: 80px;
position: fixed;
top: 0;
left: 0;
color: #fff;
z-index: 500; // 提高 z-index,确保在单页内容的导航栏之上
transition: all 0.3s ease;
padding: 0 20px;
&.scrolled {
background: rgba(255, 255, 255, 0.95);
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
color: #333;
height: 70px;
.menu ul > li .site-header-dropdown-menu {
top: 70px;
}
}
.container {
max-width: 1200px;
height: 100%;
margin: 0 auto;
display: flex;
align-items: center;
padding: 0 20px;
}
.maincontent {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
img {
max-width: 300px;
object-fit: contain;
}
}
.menu {
ul {
display: flex;
list-style: none;
margin: 0;
padding: 0;
gap: 30px;
position: relative;
> li {
position: relative;
font-size: 16px;
/*font-weight: 500;*/
cursor: pointer;
padding: 5px 0;
transition: color 0.3s ease;
.menu-link,
.menu-text {
// color: inherit;
color: #1f1f1f;
text-decoration: none;
display: block;
&:hover {
color: #1890ff;
}
}
// 外链样式(与 menu-link 保持一致)
a.menu-link {
color: #1f1f1f;
text-decoration: none;
display: block;
cursor: pointer;
&:hover {
color: #1890ff;
}
}
&:hover {
color: #1890ff;
}
&::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 2px;
background-color: #1890ff;
transition: width 0.3s ease;
}
&:hover::after {
width: 100%;
}
/* 下拉菜单样式 */
.site-header-dropdown-menu {
position: fixed;
left: 0;
right: 0;
top: 75px;
width: 100vw;
background: #fff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
z-index: 9999; // 提高 z-index,确保在单页内容之上
display: flex;
opacity: 0;
visibility: hidden;
transition:
opacity 0.3s ease,
visibility 0.3s ease;
pointer-events: none;
margin-top: 5px; /* 添加一个小间隙,让鼠标可以移动 */
.site-header-dropdown-container {
display: flex;
width: 100%;
margin: 0 auto;
min-height: 350px;
pointer-events: auto;
}
/* 二级菜单(左侧) */
.category-list {
// width: 200px;
background: #f8f9fa;
border-right: 1px solid #eee;
overflow-y: auto;
padding: 20px 0;
padding-left: 15%;
.category-item {
display: flex;
align-items: center;
min-height: 40px;
padding: 10px 20px;
cursor: pointer;
transition: all 0.2s ease;
color: #333;
font-size: 14px;
&:hover,
&.active {
background: #e9ecef;
color: #1890ff;
}
}
}
.content-panel {
flex: 1;
padding: 20px;
overflow-y: auto;
.content-section11 {
h3 {
margin: 0 0 20px;
color: #333;
font-size: 18px;
border-bottom: 1px solid #efefef;
padding-bottom: 20px;
}
.content-grid {
display: flex;
flex-wrap: wrap;
gap: 15px;
.content-item {
display: flex;
align-items: flex-start;
flex: 0 0 calc(33.333% - 10px); // 每行3个,减去gap
min-width: 250px; // 最小宽度
padding: 15px;
border-radius: 4px;
transition: all 0.2s ease;
color: #333;
text-decoration: none;
&:hover {
background: #f8f9fa;
transform: translateY(-2px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.icon {
margin-right: 12px;
color: #1890ff;
font-size: 20px;
flex-shrink: 0;
}
.content {
flex: 1;
}
h4 {
margin: 0 0 5px;
font-size: 15px;
}
p {
margin: 0;
font-size: 13px;
color: #666;
}
}
}
}
}
}
&:hover .site-header-dropdown-menu,
.site-header-dropdown-menu:hover {
opacity: 1;
visibility: visible;
pointer-events: auto;
}
}
}
}
.search {
display: flex;
align-items: center;
gap: 20px;
color: #1f1f1f;
.search-icon,
.language-switcher {
cursor: pointer;
font-size: 18px;
transition: all 0.3s ease;
display: flex;
align-items: center;
gap: 5px;
&:hover {
color: #1890ff;
transform: scale(1.1);
}
}
}
.modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
z-index: 2000;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(5px);
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
&.active {
opacity: 1;
visibility: visible;
}
.modal-content {
background: white;
padding: 30px;
border-radius: 8px;
width: 90%;
max-width: 500px;
position: relative;
transform: translateY(20px);
transition:
transform 0.3s ease,
opacity 0.3s ease;
opacity: 0;
.search-box {
display: flex;
gap: 10px;
margin-top: 20px;
input {
flex: 1;
padding: 12px 15px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 16px;
transition: border-color 0.3s ease;
&:focus {
border-color: #1890ff;
outline: none;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}
}
button {
padding: 0 25px;
background-color: #1890ff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.3s ease;
&:hover {
background-color: #40a9ff;
transform: translateY(-1px);
}
&:active {
transform: translateY(0);
}
}
}
.close-btn {
position: absolute;
top: 15px;
right: 20px;
background: none;
border: none;
font-size: 24px;
cursor: pointer;
color: #999;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: all 0.3s ease;
&:hover {
color: #333;
background-color: #f5f5f5;
}
}
&.language-modal {
text-align: center;
h3 {
margin: 0 0 20px;
color: #333;
font-size: 18px;
}
.language-options {
display: flex;
flex-direction: column;
gap: 10px;
.language-option {
padding: 12px 20px;
border-radius: 4px;
cursor: pointer;
transition: all 0.3s ease;
background-color: #f9f9f9;
&:hover {
background-color: #f0f0f0;
transform: translateX(5px);
}
&.active {
background-color: #e6f7ff;
color: #1890ff;
font-weight: 500;
}
}
}
}
}
&.active .modal-content {
transform: translateY(0);
opacity: 1;
}
}
}
/* 响应式调整 */
@media (max-width: 992px) {
.site-header-nav {
.menu {
display: none;
}
.search {
margin-left: auto;
}
}
}
@media (max-width: 576px) {
.site-header-nav {
.logo img {
max-width: 150px;
}
.search {
gap: 15px;
}
}
}
</style>
File diff suppressed because it is too large Load Diff
+559
View File
@@ -0,0 +1,559 @@
<template>
<Header />
<div class="headtop"></div>
<div class="content-container">
<div class="topcontent">
<div class="top-content">
<div class="top-content-title">新闻中心 - 企业新闻</div>
<div class="top-content-subtitle">NEWS CENTER - COMPANY NEWS</div>
</div>
</div>
<div class="maincontent">
<!-- 筛选栏 -->
<div class="filter-panel">
<div class="filter-row">
<span class="filter-label">新闻分类</span>
<div class="filter-options">
<span
v-for="item in categoryList"
:key="item.value"
:class="[
'filter-item',
{ active: activeCategory === item.value },
]"
@click="activeCategory = item.value"
>
{{ item.label }}
</span>
</div>
</div>
<div class="filter-row">
<span class="filter-label">新闻属性</span>
<div class="filter-options">
<span
v-for="item in flagList"
:key="item.value"
:class="['filter-item', { active: activeFlag === item.value }]"
@click="activeFlag = item.value"
>
{{ item.label }}
</span>
</div>
</div>
</div>
<!-- 加载状态 -->
<div v-if="loading" class="loading-state">
<i class="fas fa-spinner fa-spin"></i>
<span>加载中...</span>
</div>
<!-- 错误信息 -->
<div v-else-if="error" class="error-state">
<i class="fas fa-exclamation-circle"></i>
<span>{{ error }}</span>
</div>
<!-- 新闻列表 -->
<div v-else-if="newsData.length > 0" class="news-grid">
<div
v-for="news in newsData"
:key="news.id"
class="news-card"
@click="goToDetail(news.id)"
>
<div class="card-image" v-if="news.image">
<img :src="getImageUrl(news.image)" :alt="news.title" />
</div>
<div v-else class="card-image-placeholder">
<i class="fas fa-image"></i>
</div>
<div class="card-content">
<div class="card-title-container">
<h3 class="card-title">
<span v-if="news.top === 1" class="top-tag">置顶</span>
<span v-if="news.recommend === 1" class="recommend-tag">
推荐
</span>
{{ news.title }}
</h3>
</div>
<div class="card-meta">
<span class="card-date">
<i class="fa-regular fa-calendar-minus"></i>
{{ formatDate(news.publishdate) }}
</span>
<span class="right-meta">
<span class="card-date">
<i class="fa-regular fa-heart"></i>
{{ news.likes }}
</span>
<span class="card-date">
<i class="fa-regular fa-eye"></i>
{{ news.views }}
</span>
</span>
</div>
</div>
</div>
</div>
<!-- 无数据状态 -->
<div v-else class="empty-state">
<el-empty :image-size="200" />
</div>
<!-- 加载更多按钮 -->
<div
v-if="!loading && !error && newsData.length > 0 && hasMore"
class="load-more"
>
<button class="load-more-btn" @click="loadMore" :disabled="loadingMore">
<i v-if="loadingMore" class="fas fa-spinner fa-spin"></i>
<span v-else>加载更多</span>
</button>
</div>
<!-- 没有更多数据提示 -->
<div
v-if="!loading && !error && newsData.length > 0 && !hasMore"
class="no-more"
>
<span>已加载全部数据</span>
</div>
</div>
<div class="bottomcontent"></div>
</div>
<Footer />
</template>
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import Header from '@/views/components/header.vue'
import Footer from '@/views/components/footer.vue'
import { getCompanyNews } from '@/api/newscenter'
const router = useRouter()
const newsData = ref<any[]>([])
const loading = ref(false)
const loadingMore = ref(false)
const error = ref('')
const currentPage = ref(1)
const pageSize = ref(12) // 每次加载12条
const total = ref(0)
// 写死的筛选项
const categoryList = [
{ label: '全部', value: 'all' },
{ label: '公司新闻', value: 'company' },
{ label: '行业新闻', value: 'industry' },
{ label: '媒体报道', value: 'media' },
]
const flagList = [
{ label: '全部', value: 'all' },
{ label: '置顶', value: 'top' },
{ label: '推荐', value: 'recommend' },
]
// 当前选中状态
const activeCategory = ref('all')
const activeFlag = ref('all')
// 计算是否还有更多数据
const hasMore = computed(() => {
return newsData.value.length < total.value
})
// 获取图片URL
const getImageUrl = (image: string) => {
if (!image) return ''
if (image.startsWith('http')) return image
return `${import.meta.env.VITE_APP_API_URL || ''}${image}`
}
// 格式化日期
const formatDate = (date: string) => {
if (!date) return ''
const d = new Date(date)
return d.toLocaleDateString('zh-CN', {
year: 'numeric',
month: 'long',
day: 'numeric',
})
}
const goToDetail = (id: number) => {
router.push(`/newscenter/companyNews/detail/${id}`)
}
// 加载更多数据
const loadMore = async () => {
if (loadingMore.value || !hasMore.value) return
loadingMore.value = true
currentPage.value++
try {
const response = await getCompanyNews(currentPage.value, pageSize.value)
if (response.code === 200) {
// 追加新数据到现有列表
newsData.value = [...newsData.value, ...(response.list || [])]
total.value = response.total || 0
} else {
error.value = response.msg || '加载更多数据失败'
currentPage.value-- // 回退页码
}
} catch (err: any) {
error.value = '加载更多数据时发生错误'
console.error('加载更多数据错误:', err)
currentPage.value-- // 回退页码
} finally {
loadingMore.value = false
}
}
// 初始加载新闻数据
const loadNews = async () => {
loading.value = true
error.value = ''
currentPage.value = 1
try {
const response = await getCompanyNews(currentPage.value, pageSize.value)
if (response.code === 200) {
newsData.value = response.list || []
total.value = response.total || 0
} else {
error.value = response.msg || '获取新闻数据失败'
}
} catch (err: any) {
error.value = '获取新闻数据时发生错误'
console.error('获取新闻数据错误:', err)
} finally {
loading.value = false
}
}
onMounted(() => {
loadNews()
})
</script>
<style lang="scss" scoped>
.headtop {
height: 80px;
flex-shrink: 0;
}
.content-container {
min-height: calc(100vh - 80px);
display: flex;
flex-direction: column;
.filter-panel {
background: #fff;
padding: 20px 30px;
margin-bottom: 40px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
.filter-row {
display: flex;
align-items: center;
padding: 12px 0;
border-bottom: 1px dashed #eee;
&:last-child {
border-bottom: none;
}
.filter-label {
width: 90px;
font-size: 14px;
font-weight: 500;
color: #333;
flex-shrink: 0;
}
.filter-options {
display: flex;
flex-wrap: wrap;
gap: 16px;
.filter-item {
font-size: 14px;
color: #666;
cursor: pointer;
transition: all 0.2s;
&:hover {
color: #1890ff;
}
&.active {
color: #1890ff;
font-weight: 600;
}
}
}
}
}
.topcontent {
height: 450px;
width: 100%;
background-image: url(@/assets/images/newscenter.jpg);
background-size: cover;
background-position: center;
flex-shrink: 0;
.top-content {
padding-top: 180px;
width: 1200px;
margin: 0 auto;
.top-content-title {
font-size: 35px;
font-weight: 600;
color: #fff;
}
.top-content-subtitle {
width: 300px;
margin-top: 20px;
padding-top: 20px;
font-size: 16px;
color: #fff;
border-top: 2px solid #fff;
}
}
}
.maincontent {
flex: 1;
width: 1200px;
margin: 80px auto;
padding: 0 20px;
.loading-state,
.error-state,
.empty-state {
display: flex;
align-items: center;
justify-content: center;
padding: 60px 20px;
text-align: center;
color: #666;
font-size: 16px;
i {
margin-right: 10px;
font-size: 24px;
}
}
.error-state {
color: #f56c6c;
i {
color: #f56c6c;
}
}
.news-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 30px;
margin-bottom: 40px;
@media (max-width: 992px) {
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}
@media (max-width: 576px) {
grid-template-columns: 1fr;
gap: 20px;
}
.news-card {
display: flex;
flex-direction: column;
background: #fff;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
cursor: pointer;
&:hover {
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
transform: translateY(-4px);
}
.card-image {
width: 100%;
height: 140px;
overflow: hidden;
background: #f5f5f5;
img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
&:hover img {
transform: scale(1.05);
}
}
.card-image-placeholder {
width: 100%;
height: 140px;
background: #f5f5f5;
display: flex;
align-items: center;
justify-content: center;
color: #ccc;
font-size: 48px;
}
.card-content {
padding: 20px;
display: flex;
flex-direction: column;
gap: 12px;
flex: 1;
.card-title-container {
display: flex;
align-items: flex-start;
gap: 8px;
flex-wrap: wrap;
.recommend-tag {
padding: 4px 10px;
background: #1890ff;
color: #fff;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
flex-shrink: 0;
}
.top-tag {
padding: 4px 10px;
background: #ff5050;
color: #fff;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
flex-shrink: 0;
}
.card-title {
font-size: 14px;
font-weight: 600;
color: #333;
margin: 0;
height: 40px;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
flex: 1;
min-width: 0;
}
}
.card-meta {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 13px;
color: #999;
.right-meta {
display: flex;
gap: 6px;
}
span {
margin-right: 6px;
}
.card-date {
display: flex;
align-items: center;
gap: 5px;
}
}
.card-desc {
font-size: 14px;
color: #666;
line-height: 1.6;
margin: 0;
display: -webkit-box;
-webkit-line-clamp: 3;
line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
flex: 1;
}
}
}
}
.load-more {
display: flex;
justify-content: center;
margin-top: 40px;
padding: 20px 0;
.load-more-btn {
padding: 12px 40px;
border: 1px solid #1890ff;
border-radius: 6px;
background: #fff;
color: #1890ff;
cursor: pointer;
transition: all 0.3s ease;
font-size: 15px;
display: flex;
align-items: center;
gap: 8px;
&:hover:not(:disabled) {
background: #1890ff;
color: #fff;
}
&:disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
}
.no-more {
display: flex;
justify-content: center;
margin-top: 40px;
padding: 20px 0;
color: #999;
font-size: 14px;
}
}
.bottomcontent {
flex-shrink: 0;
}
}
</style>
@@ -0,0 +1,94 @@
<template>
<Header />
<div class="detail">
<div class="detail-header">
<h1>{{ article.title }}</h1>
<p>{{ article.create_time }}</p>
</div>
<div class="detail-content">
<p v-html="article.content"></p>
</div>
</div>
<Footer />
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import Header from '@/views/components/header.vue'
import Footer from '@/views/components/footer.vue'
import { getKingdeeNewsDetail, getCompanyNewsDetail } from '@/api/newscenter'
const route = useRoute()
const article = ref({})
const loading = ref(true)
onMounted(async () => {
const id = route.params.id
loading.value = true
try {
let res
const path = route.path
if (path.includes('companyNews')) {
res = await getCompanyNewsDetail(id)
} else if (path.includes('kingdeeNews')) {
res = await getKingdeeNewsDetail(id)
} else {
res = await getKingdeeNewsDetail(id)
}
if (res.code === 200) {
article.value = res.data
}
} catch (err) {
console.error('获取文章详情失败:', err)
} finally {
loading.value = false
}
})
</script>
<style lang="scss" scoped>
.detail {
padding: 40px 0;
background-color: var(--tw-bg-opacity);
color: var(--footer-color);
font-size: var(--footer-size);
.detail-header {
margin-bottom: 20px;
}
.detail-content {
::v-deep code {
background-color: #f0f2f5;
border-radius: 4px;
padding: 2px 6px;
font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
font-size: 13px;
color: #f06b6b;
}
::v-deep pre {
background: linear-gradient(135deg, #1e1e2e 0%, #2d2d3f 100%) !important;
border-radius: 12px;
padding: 20px;
overflow-x: auto;
margin: 20px 0;
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
code {
background-color: transparent !important;
padding: 0;
color: #cdd6f4;
font-size: 13px;
line-height: 1.7;
display: block;
}
}
}
}
</style>
+459
View File
@@ -0,0 +1,459 @@
<template>
<Header />
<div class="headtop"></div>
<div class="content-container">
<div class="topcontent">
<div class="top-content">
<div class="top-content-title">新闻中心 - 金蝶新闻</div>
<div class="top-content-subtitle">NEWS CENTER - KINGDEE NEWS</div>
</div>
</div>
<div class="maincontent">
<!-- 加载状态 -->
<div v-if="loading" class="loading-state">
<i class="fas fa-spinner fa-spin"></i>
<span>加载中...</span>
</div>
<!-- 错误信息 -->
<div v-else-if="error" class="error-state">
<i class="fas fa-exclamation-circle"></i>
<span>{{ error }}</span>
</div>
<!-- 新闻列表 -->
<div v-else-if="newsData.length > 0" class="news-grid">
<div
v-for="news in newsData"
:key="news.id"
class="news-card"
@click="goToDetail(news.id)"
>
<div class="card-image" v-if="news.image">
<img :src="getImageUrl(news.image)" :alt="news.title" />
</div>
<div v-else class="card-image-placeholder card-image">
<img src="@/assets/images/noimage.png">
</div>
<div class="card-content">
<div class="card-title-container">
<h3 class="card-title">
<span v-if="news.top === 1" class="top-tag">置顶</span>
<span v-if="news.recommend === 1" class="recommend-tag">
推荐
</span>
{{ news.title }}
</h3>
</div>
<div class="card-meta">
<span class="card-date">
<i class="fa-regular fa-calendar-minus"></i>
{{ formatDate(news.publishdate) }}
</span>
<span class="right-meta">
<span class="card-date">
<i class="fa-regular fa-heart"></i>
{{ news.likes }}
</span>
<span class="card-date">
<i class="fa-regular fa-eye"></i>
{{ news.views }}
</span>
</span>
</div>
</div>
</div>
</div>
<!-- 无数据状态 -->
<div v-else class="empty-state">
<el-empty :image-size="200" />
</div>
<!-- 加载更多按钮 -->
<div
v-if="!loading && !error && newsData.length > 0 && hasMore"
class="load-more"
>
<button class="load-more-btn" @click="loadMore" :disabled="loadingMore">
<i v-if="loadingMore" class="fas fa-spinner fa-spin"></i>
<span v-else>加载更多</span>
</button>
</div>
<!-- 没有更多数据提示 -->
<div
v-if="!loading && !error && newsData.length > 0 && !hasMore"
class="no-more"
>
<span>已加载全部数据</span>
</div>
</div>
<div class="bottomcontent"></div>
</div>
<Footer />
</template>
<script lang="ts" setup>
import { ref, onMounted, computed } from 'vue'
import { useRouter } from 'vue-router'
import Header from '@/views/components/header.vue'
import Footer from '@/views/components/footer.vue'
import { getKingdeeNews } from '@/api/newscenter'
const router = useRouter()
const newsData = ref<any[]>([])
const loading = ref(false)
const loadingMore = ref(false)
const error = ref('')
const currentPage = ref(1)
const pageSize = ref(12) // 每次加载12条
const total = ref(0)
// 跳转到详情页
const goToDetail = (id: number) => {
router.push(`/newscenter/kingdeeNews/detail/${id}`)
}
// 计算是否还有更多数据
const hasMore = computed(() => {
return newsData.value.length < total.value
})
// 获取图片URL
const getImageUrl = (image: string) => {
if (!image) return ''
if (image.startsWith('http')) return image
return `${import.meta.env.VITE_APP_API_URL || ''}${image}`
}
// 格式化日期
const formatDate = (date: string) => {
if (!date) return ''
const d = new Date(date)
return d.toLocaleDateString('zh-CN', {
year: 'numeric',
month: 'long',
day: 'numeric',
})
}
// 加载更多数据
const loadMore = async () => {
if (loadingMore.value || !hasMore.value) return
loadingMore.value = true
currentPage.value++
try {
const response = await getKingdeeNews(currentPage.value, pageSize.value)
if (response.code === 200) {
// 追加新数据到现有列表
newsData.value = [...newsData.value, ...(response.list || [])]
total.value = response.total || 0
} else {
error.value = response.msg || '加载更多数据失败'
currentPage.value-- // 回退页码
}
} catch (err: any) {
error.value = '加载更多数据时发生错误'
console.error('加载更多数据错误:', err)
currentPage.value-- // 回退页码
} finally {
loadingMore.value = false
}
}
// 初始加载新闻数据
const loadNews = async () => {
loading.value = true
error.value = ''
currentPage.value = 1
try {
const response = await getKingdeeNews(currentPage.value, pageSize.value)
if (response.code === 200) {
newsData.value = response.list || []
total.value = response.total || 0
} else {
error.value = response.msg || '获取新闻数据失败'
}
} catch (err: any) {
error.value = '获取新闻数据时发生错误'
console.error('获取新闻数据错误:', err)
} finally {
loading.value = false
}
}
onMounted(() => {
loadNews()
})
</script>
<style lang="scss" scoped>
.headtop {
height: 80px;
flex-shrink: 0;
}
.content-container {
min-height: calc(100vh - 80px);
display: flex;
flex-direction: column;
.topcontent {
height: 450px;
width: 100%;
background-image: url(@/assets/images/kingdeenews.jpg);
background-size: cover;
background-position: center;
flex-shrink: 0;
.top-content {
padding-top: 180px;
width: 1200px;
margin: 0 auto;
.top-content-title {
font-size: 35px;
font-weight: 600;
color: #fff;
}
.top-content-subtitle {
width: 300px;
margin-top: 20px;
padding-top: 20px;
font-size: 16px;
color: #fff;
border-top: 2px solid #fff;
}
}
}
.maincontent {
flex: 1;
width: 1200px;
margin: 80px auto;
padding: 0 20px;
.loading-state,
.error-state,
.empty-state {
display: flex;
align-items: center;
justify-content: center;
padding: 60px 20px;
text-align: center;
color: #666;
font-size: 16px;
i {
margin-right: 10px;
font-size: 24px;
}
}
.error-state {
color: #f56c6c;
i {
color: #f56c6c;
}
}
.news-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 30px;
margin-bottom: 40px;
@media (max-width: 992px) {
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}
@media (max-width: 576px) {
grid-template-columns: 1fr;
gap: 20px;
}
.news-card {
display: flex;
flex-direction: column;
background: #fff;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
cursor: pointer;
&:hover {
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
transform: translateY(-4px);
}
.card-image {
width: 100%;
height: 140px;
overflow: hidden;
background: #f5f5f5;
img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
&:hover img {
transform: scale(1.05);
}
}
.card-image-placeholder {
width: 100%;
height: 140px;
background: #f5f5f5;
display: flex;
align-items: center;
justify-content: center;
color: #ccc;
font-size: 48px;
}
.card-content {
padding: 20px;
display: flex;
flex-direction: column;
gap: 12px;
flex: 1;
.card-title-container {
display: flex;
align-items: flex-start;
gap: 8px;
flex-wrap: wrap;
.recommend-tag {
padding: 4px 10px;
background: #1890ff;
color: #fff;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
flex-shrink: 0;
}
.top-tag {
padding: 4px 10px;
background: #ff5050;
color: #fff;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
flex-shrink: 0;
}
.card-title {
font-size: 14px;
font-weight: 600;
color: #333;
margin: 0;
height: 40px;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
flex: 1;
min-width: 0;
span {
margin-right: 6px;
}
}
}
.card-meta {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 13px;
color: #999;
.right-meta {
display: flex;
gap: 6px;
}
span {
margin-right: 6px;
}
.card-date {
display: flex;
align-items: center;
gap: 5px;
}
}
.card-desc {
font-size: 14px;
color: #666;
line-height: 1.6;
margin: 0;
display: -webkit-box;
-webkit-line-clamp: 3;
line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
flex: 1;
}
}
}
}
.load-more {
display: flex;
justify-content: center;
margin-top: 40px;
padding: 20px 0;
.load-more-btn {
padding: 12px 40px;
border: 1px solid #1890ff;
border-radius: 6px;
background: #fff;
color: #1890ff;
cursor: pointer;
transition: all 0.3s ease;
font-size: 15px;
display: flex;
align-items: center;
gap: 8px;
&:hover:not(:disabled) {
background: #1890ff;
color: #fff;
}
&:disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
}
.no-more {
display: flex;
justify-content: center;
margin-top: 40px;
padding: 20px 0;
color: #999;
font-size: 14px;
}
}
.bottomcontent {
flex-shrink: 0;
}
}
</style>
@@ -0,0 +1,584 @@
<template>
<Header />
<div class="headtop"></div>
<div class="container">
<div class="topcontent">
<div class="top-content">
<div class="top-content-title">技术中心</div>
<div class="top-content-subtitle">Technology Center</div>
</div>
</div>
<div class="maincontent">
<div class="content-wrapper">
<!-- 左侧分类列表 -->
<div class="category-sidebar">
<div class="sidebar-title">分类</div>
<div class="category-list">
<div
v-for="category in categories"
:key="category.id"
class="category-item"
:class="{ active: selectedCategoryId === category.id }"
@click="selectCategory(category.id)"
>
{{ category.name }}
</div>
</div>
</div>
<!-- 右侧新闻列表 -->
<div class="news-content">
<!-- 加载状态 -->
<div v-if="loading" class="loading-state">
<i class="fas fa-spinner fa-spin"></i>
<span>加载中...</span>
</div>
<!-- 错误信息 -->
<div v-else-if="error" class="error-state">
<i class="fas fa-exclamation-circle"></i>
<span>{{ error }}</span>
</div>
<!-- 新闻列表 -->
<div v-else-if="newsData.length > 0" class="news-grid">
<div
v-for="news in newsData"
:key="news.id"
class="news-card"
@click="goToDetail(news.id)"
>
<div class="card-image" v-if="news.image || news.cate">
<img :src="getImageUrl(news.image, news.cate)" :alt="news.title" />
</div>
<div v-else class="card-image-placeholder">
<i class="fas fa-image"></i>
</div>
<div class="card-content">
<div class="card-title-container">
<h3 class="card-title">
<span v-if="news.top === 1" class="top-tag">置顶</span>
<span v-if="news.recommend === 1" class="recommend-tag">
推荐
</span>
{{ news.title }}
</h3>
</div>
<div class="card-meta">
<span class="card-date">
<i class="fa-regular fa-calendar-minus"></i>
{{ formatDate(news.publishdate) }}
</span>
<span class="right-meta">
<span class="card-date">
<i class="fa-regular fa-heart"></i>
{{ news.likes }}
</span>
<span class="card-date">
<i class="fa-regular fa-eye"></i>
{{ news.views }}
</span>
</span>
</div>
</div>
</div>
</div>
<!-- 无数据状态 -->
<div v-else class="empty-state">
<el-empty :image-size="200" />
</div>
<!-- 加载更多按钮 -->
<div
v-if="!loading && !error && newsData.length > 0 && hasMore"
class="load-more"
>
<button
class="load-more-btn"
@click="loadMore"
:disabled="loadingMore"
>
<i v-if="loadingMore" class="fas fa-spinner fa-spin"></i>
<span v-else>加载更多</span>
</button>
</div>
<!-- 没有更多数据提示 -->
<div
v-if="!loading && !error && newsData.length > 0 && !hasMore"
class="no-more"
>
<span>已加载全部数据</span>
</div>
</div>
</div>
</div>
<div class="bottomcontent"></div>
</div>
<Footer />
</template>
<script lang="ts" setup>
import { ref, onMounted, computed } from 'vue'
import { useRouter } from 'vue-router'
import Header from '@/views/components/header.vue'
import Footer from '@/views/components/footer.vue'
import { getTechnologyCenter, getTechnologyCategories } from '@/api/newscenter'
const router = useRouter()
// 分类相关
const categories = ref<any[]>([])
const selectedCategoryId = ref<number | null>(null)
// 新闻数据
const newsData = ref<any[]>([])
const loading = ref(false)
const loadingMore = ref(false)
const error = ref('')
const currentPage = ref(1)
const pageSize = ref(6) // 每次加载6条
const total = ref(0)
// 计算是否还有更多数据
const hasMore = computed(() => {
return newsData.value.length < total.value
})
// 获取图片URL
const getImageUrl = (image: string, cateId?: number) => {
if (image) {
if (image.startsWith('http')) return image
return `${import.meta.env.VITE_APP_API_URL || ''}${image}`
}
// 如果文章没有图片,使用分类的图片
if (cateId) {
const category = categories.value.find(c => c.id === cateId)
if (category?.image) {
const catImage = category.image
if (catImage.startsWith('http')) return catImage
return `${import.meta.env.VITE_APP_API_URL || ''}${catImage}`
}
}
return ''
}
// 格式化日期
const formatDate = (date: string) => {
if (!date) return ''
const d = new Date(date)
const year = d.getFullYear().toString().slice(-2)
const month = (d.getMonth() + 1).toString()
const day = d.getDate().toString()
return `${year}${month}${day}`
}
const goToDetail = (id: number) => {
router.push(`/newscenter/companyNews/detail/${id}`)
}
// 选择分类
const selectCategory = (categoryId: number) => {
if (selectedCategoryId.value === categoryId) {
// 已选中的分类不做任何操作
return
}
selectedCategoryId.value = categoryId
// 重新加载数据
loadNews()
}
// 加载分类列表
const loadCategories = async () => {
try {
const response = await getTechnologyCategories()
if (response.code === 200) {
categories.value = response.data || []
// 默认选择第一个分类
if (categories.value.length > 0) {
selectedCategoryId.value = categories.value[0].id
loadNews()
}
}
} catch (err: any) {
console.error('加载分类错误:', err)
}
}
// 加载更多数据
const loadMore = async () => {
if (loadingMore.value || !hasMore.value) return
loadingMore.value = true
currentPage.value++
try {
const response = await getTechnologyCenter(
currentPage.value,
pageSize.value,
selectedCategoryId.value || undefined,
)
if (response.code === 200) {
// 追加新数据到现有列表
newsData.value = [...newsData.value, ...(response.list || [])]
total.value = response.total || 0
} else {
error.value = response.msg || '加载更多数据失败'
currentPage.value-- // 回退页码
}
} catch (err: any) {
error.value = '加载更多数据时发生错误'
console.error('加载更多数据错误:', err)
currentPage.value-- // 回退页码
} finally {
loadingMore.value = false
}
}
// 初始加载数据
const loadNews = async () => {
loading.value = true
error.value = ''
currentPage.value = 1
try {
const response = await getTechnologyCenter(
currentPage.value,
pageSize.value,
selectedCategoryId.value || undefined,
)
if (response.code === 200) {
newsData.value = response.list || []
total.value = response.total || 0
} else {
error.value = response.msg || '获取数据失败'
}
} catch (err: any) {
error.value = '获取数据时发生错误'
console.error('获取数据错误:', err)
} finally {
loading.value = false
}
}
onMounted(() => {
loadCategories()
})
</script>
<style lang="scss" scoped>
.headtop {
height: 80px;
flex-shrink: 0;
}
.container {
min-height: calc(100vh - 80px);
display: flex;
flex-direction: column;
.topcontent {
height: 450px;
width: 100%;
background-image: url(@/assets/images/newscenter.jpg);
background-size: cover;
background-position: center;
flex-shrink: 0;
.top-content {
padding-top: 180px;
width: 1200px;
margin: 0 auto;
.top-content-title {
font-size: 35px;
font-weight: 600;
color: #fff;
}
.top-content-subtitle {
width: 300px;
margin-top: 20px;
padding-top: 20px;
font-size: 16px;
color: #fff;
border-top: 2px solid #fff;
}
}
}
.maincontent {
flex: 1;
width: 1200px;
margin: 80px auto;
padding: 0 20px;
.content-wrapper {
display: flex;
gap: 40px;
// 左侧分类栏
.category-sidebar {
width: 200px;
flex-shrink: 0;
.sidebar-title {
font-size: 18px;
font-weight: 600;
color: #333;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #1890ff;
}
.category-list {
.category-item {
padding: 14px 20px;
margin-bottom: 8px;
background: #f8f9fa;
border-radius: 6px;
cursor: pointer;
transition: all 0.3s ease;
font-size: 15px;
color: #333;
&:hover {
background: #e9ecef;
color: #1890ff;
}
&.active {
background: #1890ff;
color: #fff;
font-weight: 500;
}
}
}
}
// 右侧内容区
.news-content {
flex: 1;
min-width: 0;
.loading-state,
.error-state,
.empty-state {
display: flex;
align-items: center;
justify-content: center;
padding: 60px 20px;
text-align: center;
color: #666;
font-size: 16px;
i {
margin-right: 10px;
font-size: 24px;
}
}
.error-state {
color: #f56c6c;
i {
color: #f56c6c;
}
}
.news-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 30px;
margin-bottom: 40px;
@media (max-width: 992px) {
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}
@media (max-width: 576px) {
grid-template-columns: 1fr;
gap: 20px;
}
.news-card {
display: flex;
flex-direction: column;
background: #fff;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
cursor: pointer;
&:hover {
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
transform: translateY(-4px);
}
.card-image {
width: 100%;
height: 140px;
overflow: hidden;
background: #f5f5f5;
img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
&:hover img {
transform: scale(1.05);
}
}
.card-image-placeholder {
width: 100%;
height: 140px;
background: #f5f5f5;
display: flex;
align-items: center;
justify-content: center;
color: #ccc;
font-size: 48px;
}
.card-content {
padding: 20px;
display: flex;
flex-direction: column;
gap: 12px;
flex: 1;
.card-title-container {
display: flex;
align-items: flex-start;
gap: 8px;
flex-wrap: wrap;
.recommend-tag {
padding: 4px 10px;
background: #1890ff;
color: #fff;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
flex-shrink: 0;
}
.top-tag {
padding: 4px 10px;
background: #ff5050;
color: #fff;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
flex-shrink: 0;
}
.card-title {
font-size: 14px;
font-weight: 600;
color: #333;
margin: 0;
line-height: 1.4;
height: 40px;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
flex: 1;
min-width: 0;
}
}
.card-meta {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 10px;
color: #999;
.right-meta {
display: flex;
gap: 6px;
}
span {
margin-right: 6px;
}
.card-date {
display: flex;
align-items: center;
gap: 5px;
}
}
.card-desc {
font-size: 14px;
color: #666;
line-height: 1.6;
margin: 0;
display: -webkit-box;
-webkit-line-clamp: 3;
line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
flex: 1;
}
}
}
}
.load-more {
display: flex;
justify-content: center;
margin-top: 40px;
padding: 20px 0;
.load-more-btn {
padding: 12px 40px;
border: 1px solid #1890ff;
border-radius: 6px;
background: #fff;
color: #1890ff;
cursor: pointer;
transition: all 0.3s ease;
font-size: 15px;
display: flex;
align-items: center;
gap: 8px;
&:hover:not(:disabled) {
background: #1890ff;
color: #fff;
}
&:disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
}
.no-more {
display: flex;
justify-content: center;
margin-top: 40px;
padding: 20px 0;
color: #999;
font-size: 14px;
}
}
}
}
.bottomcontent {
flex-shrink: 0;
}
}
</style>
@@ -0,0 +1,446 @@
<template>
<Header />
<div class="headtop"></div>
<div class="container">
<div class="topcontent">
<div class="top-content">
<div class="top-content-title">技术中心</div>
<div class="top-content-subtitle">Technology Center</div>
</div>
</div>
<div class="maincontent">
<!-- 加载状态 -->
<div v-if="loading" class="loading-state">
<i class="fas fa-spinner fa-spin"></i>
<span>加载中...</span>
</div>
<!-- 错误信息 -->
<div v-else-if="error" class="error-state">
<i class="fas fa-exclamation-circle"></i>
<span>{{ error }}</span>
</div>
<!-- 新闻列表 -->
<div v-else-if="newsData.length > 0" class="news-grid">
<div v-for="news in newsData" :key="news.id" class="news-card" @click="goToDetail(news.id)">
<div class="card-image" v-if="news.image">
<img :src="getImageUrl(news.image)" :alt="news.title" />
</div>
<div v-else class="card-image-placeholder">
<i class="fas fa-image"></i>
</div>
<div class="card-content">
<div class="card-title-container">
<h3 class="card-title">
<span v-if="news.top === 1" class="top-tag">置顶</span>
<span v-if="news.recommend === 1" class="recommend-tag">
推荐
</span>
{{ news.title }}
</h3>
</div>
<div class="card-meta">
<span class="card-date">
<i class="fa-regular fa-calendar-minus"></i>
{{ formatDate(news.publishdate) }}
</span>
<span class="right-meta">
<span class="card-date">
<i class="fa-regular fa-heart"></i>
{{ news.likes }}
</span>
<span class="card-date">
<i class="fa-regular fa-eye"></i>
{{ news.views }}
</span>
</span>
</div>
</div>
</div>
</div>
<!-- 无数据状态 -->
<div v-else class="empty-state">
<el-empty :image-size="200" />
</div>
<!-- 加载更多按钮 -->
<div v-if="!loading && !error && newsData.length > 0 && hasMore" class="load-more">
<button class="load-more-btn" @click="loadMore" :disabled="loadingMore">
<i v-if="loadingMore" class="fas fa-spinner fa-spin"></i>
<span v-else>加载更多</span>
</button>
</div>
<!-- 没有更多数据提示 -->
<div v-if="!loading && !error && newsData.length > 0 && !hasMore" class="no-more">
<span>已加载全部数据</span>
</div>
</div>
<div class="bottomcontent"></div>
</div>
<Footer />
</template>
<script lang="ts" setup>
import { ref, onMounted, computed } from 'vue'
import { useRouter } from 'vue-router'
import Header from '@/views/components/header.vue'
import Footer from '@/views/components/footer.vue'
import { getTechnologyCenter } from '@/api/newscenter'
const router = useRouter()
const newsData = ref<any[]>([])
const loading = ref(false)
const loadingMore = ref(false)
const error = ref('')
const currentPage = ref(1)
const pageSize = ref(6) // 每次加载6条
const total = ref(0)
// 计算是否还有更多数据
const hasMore = computed(() => {
return newsData.value.length < total.value
})
// 获取图片URL
const getImageUrl = (image: string) => {
if (!image) return ''
if (image.startsWith('http')) return image
return `${import.meta.env.VITE_APP_API_URL || ''}${image}`
}
// 格式化日期
const formatDate = (date: string) => {
if (!date) return ''
const d = new Date(date)
return d.toLocaleDateString('zh-CN', {
year: 'numeric',
month: 'long',
day: 'numeric',
})
}
const goToDetail = (id: number) => {
router.push(`/newscenter/companyNews/detail/${id}`)
}
// 加载更多数据
const loadMore = async () => {
if (loadingMore.value || !hasMore.value) return
loadingMore.value = true
currentPage.value++
try {
const response = await getTechnologyCenter(currentPage.value, pageSize.value)
if (response.code === 200) {
// 追加新数据到现有列表
newsData.value = [...newsData.value, ...(response.list || [])]
total.value = response.total || 0
} else {
error.value = response.msg || '加载更多数据失败'
currentPage.value-- // 回退页码
}
} catch (err: any) {
error.value = '加载更多数据时发生错误'
console.error('加载更多数据错误:', err)
currentPage.value-- // 回退页码
} finally {
loadingMore.value = false
}
}
// 初始加载数据
const loadNews = async () => {
loading.value = true
error.value = ''
currentPage.value = 1
try {
const response = await getTechnologyCenter(currentPage.value, pageSize.value)
if (response.code === 200) {
newsData.value = response.list || []
total.value = response.total || 0
} else {
error.value = response.msg || '获取数据失败'
}
} catch (err: any) {
error.value = '获取数据时发生错误'
console.error('获取数据错误:', err)
} finally {
loading.value = false
}
}
onMounted(() => {
loadNews()
})
</script>
<style lang="scss" scoped>
.headtop {
height: 80px;
flex-shrink: 0;
}
.container {
min-height: calc(100vh - 80px);
display: flex;
flex-direction: column;
.topcontent {
height: 450px;
width: 100%;
background-image: url(@/assets/images/newscenter.jpg);
background-size: cover;
background-position: center;
flex-shrink: 0;
.top-content {
padding-top: 180px;
width: 1200px;
margin: 0 auto;
.top-content-title {
font-size: 35px;
font-weight: 600;
color: #fff;
}
.top-content-subtitle {
width: 300px;
margin-top: 20px;
padding-top: 20px;
font-size: 16px;
color: #fff;
border-top: 2px solid #fff;
}
}
}
.maincontent {
flex: 1;
width: 1200px;
margin: 80px auto;
padding: 0 20px;
.loading-state,
.error-state,
.empty-state {
display: flex;
align-items: center;
justify-content: center;
padding: 60px 20px;
text-align: center;
color: #666;
font-size: 16px;
i {
margin-right: 10px;
font-size: 24px;
}
}
.error-state {
color: #f56c6c;
i {
color: #f56c6c;
}
}
.news-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 30px;
margin-bottom: 40px;
@media (max-width: 992px) {
grid-template-columns: repeat(2, 1fr);
gap: 20px;
}
@media (max-width: 576px) {
grid-template-columns: 1fr;
gap: 20px;
}
.news-card {
display: flex;
flex-direction: column;
background: #fff;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
cursor: pointer;
&:hover {
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
transform: translateY(-4px);
}
.card-image {
width: 100%;
height: 200px;
overflow: hidden;
background: #f5f5f5;
img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
&:hover img {
transform: scale(1.05);
}
}
.card-image-placeholder {
width: 100%;
height: 200px;
background: #f5f5f5;
display: flex;
align-items: center;
justify-content: center;
color: #ccc;
font-size: 48px;
}
.card-content {
padding: 20px;
display: flex;
flex-direction: column;
gap: 12px;
flex: 1;
.card-title-container {
display: flex;
align-items: flex-start;
gap: 8px;
flex-wrap: wrap;
.recommend-tag {
padding: 4px 10px;
background: #1890ff;
color: #fff;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
flex-shrink: 0;
}
.top-tag {
padding: 4px 10px;
background: #ff5050;
color: #fff;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
flex-shrink: 0;
}
.card-title {
font-size: 18px;
font-weight: 600;
color: #333;
margin: 0;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
flex: 1;
min-width: 0;
}
}
.card-meta {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 13px;
color: #999;
.right-meta {
display: flex;
gap: 6px;
}
span {
margin-right: 6px;
}
.card-date {
display: flex;
align-items: center;
gap: 5px;
}
}
.card-desc {
font-size: 14px;
color: #666;
line-height: 1.6;
margin: 0;
display: -webkit-box;
-webkit-line-clamp: 3;
line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
flex: 1;
}
}
}
}
.load-more {
display: flex;
justify-content: center;
margin-top: 40px;
padding: 20px 0;
.load-more-btn {
padding: 12px 40px;
border: 1px solid #1890ff;
border-radius: 6px;
background: #fff;
color: #1890ff;
cursor: pointer;
transition: all 0.3s ease;
font-size: 15px;
display: flex;
align-items: center;
gap: 8px;
&:hover:not(:disabled) {
background: #1890ff;
color: #fff;
}
&:disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
}
.no-more {
display: flex;
justify-content: center;
margin-top: 40px;
padding: 20px 0;
color: #999;
font-size: 14px;
}
}
.bottomcontent {
flex-shrink: 0;
}
}
</style>
+184
View File
@@ -0,0 +1,184 @@
<template>
<div class="onepage-container">
<Header />
<div class="headtop"></div>
<div v-if="loading" class="loading">
<i class="fas fa-spinner fa-spin"></i>
<span>加载中...</span>
</div>
<div v-else-if="error" class="error">
<i class="fas fa-exclamation-triangle"></i>
<p>{{ error }}</p>
<button @click="loadOnePage" class="retry-btn">重试</button>
</div>
<div v-else-if="onePage" class="content">
<div class="page-wrapper" v-html="onePage.content"></div>
</div>
<div v-else class="not-found">
<i class="fas fa-file-alt"></i>
<p>单页内容不存在</p>
</div>
<Footer />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import Header from '../components/header.vue'
import Footer from '../components/footer.vue'
import { getOnePageByPath } from '@/api/index'
interface OnePage {
id: number
title: string
content: string
path: string
sort: number
status: 0 | 1
}
const route = useRoute()
const router = useRouter()
const loading = ref(false)
const error = ref('')
const onePage = ref<OnePage | null>(null)
// 根据路由路径获取单页内容
const loadOnePage = async () => {
const path = route.path
if (!path || path === '/') {
router.push('/404')
return
}
// 检查当前路由是否已匹配到其他组件(type 2 的页面)
// 如果已匹配到具体组件,说明不是单页,不应该由单页组件处理
const matchedRoute = route.matched[route.matched.length - 1]
if (matchedRoute && matchedRoute.name && matchedRoute.name !== 'OnePage') {
// 如果匹配到的不是 OnePage,说明是其他路由(如 type 2 的页面),不应该处理
// 但通配符路由会匹配所有路径,所以需要检查 meta
if (matchedRoute.meta && matchedRoute.meta.menuType === 2) {
router.push('/404')
return
}
}
loading.value = true
error.value = ''
try {
const result = await getOnePageByPath(path)
if (result.code === 200 && result.data) {
onePage.value = result.data
} else {
// 如果单页不存在,重定向到404
router.push('/404')
}
} catch (err: any) {
// 如果请求失败,重定向到404
router.push('/404')
} finally {
loading.value = false
}
}
onMounted(() => {
loadOnePage()
})
</script>
<style lang="scss" scoped>
.onepage-container {
min-height: 100vh;
display: flex;
flex-direction: column;
width: 100%;
}
// 头部占位符,高度与固定头部一致(80px)
.headtop {
height: 80px;
width: 100%;
flex-shrink: 0;
background-color: #F8F8F8;
}
.loading,
.error,
.not-found {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 60vh;
gap: 16px;
color: #666;
padding: 40px 20px;
flex: 1;
i {
font-size: 48px;
color: #999;
}
p {
margin: 0;
font-size: 16px;
}
}
.error {
i {
color: #f56c6c;
}
}
.retry-btn {
padding: 10px 20px;
background-color: #409eff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s;
&:hover {
background-color: #66b1ff;
}
}
.content {
flex: 1;
width: 100%;
min-height: 0; // 允许 flex 子元素缩小
.page-wrapper {
width: 100%;
min-height: 100%;
position: relative; // 确保定位上下文正确
// 确保单页内容样式正确显示
:deep(*) {
box-sizing: border-box;
}
// 确保单页内容中的下拉菜单不受前端导航栏样式影响
// 只针对单页内容中的下拉菜单,不影响前端导航栏
:deep(.dropdown-menu:not(.site-header-dropdown-menu)) {
position: relative !important;
top: auto !important;
left: auto !important;
right: auto !important;
width: auto !important;
z-index: auto !important;
}
// 确保单页内容中的元素不会影响前端导航栏的下拉菜单
:deep(*) {
z-index: auto !important;
}
}
}
</style>
+363
View File
@@ -0,0 +1,363 @@
<script setup lang="ts">
import { ref,reactive } from "vue";
import Header from "@/views/components/header.vue";
import Footer from "@/views/components/footer.vue";
import { VideoPlay } from "@element-plus/icons-vue";
const activeIndex = ref(0);
const industryTabs = [
{
title: "制造行业",
icon: "src/assets/images/solution/14194311qxyp.png",
iconActive: "src/assets/images/solution/15172752x7hf.png",
contents: [
{ title: "制造业概述", route: "/solution/manufacture" },
{ title: "电子行业", route: "/solution/electronics" }
]
},
{
title: "服务行业",
icon: "@/assets/icons/zz1.png",
iconActive: "@/assets/icons/zz1.png",
contents: [
{ title: "服务行业概述", route: "/solution/service" }
]
},
{
title: "批发与零售",
icon: new URL("@/assets/icons/zf1.png", import.meta.url).href,
iconActive: new URL("@/assets/icons/zf2.png", import.meta.url).href,
contents: [
{ title: "贸易零售", route: "/solution/government" }
]
},
{
title: "建筑与房地产",
icon: new URL("@/assets/icons/yy1.png", import.meta.url).href,
iconActive: new URL("@/assets/icons/yy2.png", import.meta.url).href,
contents: [
{ title: "建筑行业", route: "/solution/medical" }
]
},
{
title: "快速消费品",
icon: new URL("@/assets/icons/qc1.png", import.meta.url).href,
iconActive: new URL("@/assets/icons/qc2.png", import.meta.url).href,
contents: [
{ title: "食品行业", route: "/solution/auto" }
]
}
];
const caseList = [
{
id: 111,
title: '碧桂园:数字化驱动业务创新',
desc:
'碧桂园集团,是中国最大的新型城镇化住宅开发商。采用集中及标准化的运营模式,业务包含物业发展、建安、装修、物业管理、物业投资、酒店开发和管理,以及现代农业、机器人。\n',
image: 'http://backapi.yunzer.cn/storage/uploads/2026/01/20/696ee14c17458.jpg'
},
{
id: 114,
title: '四川路桥:“财务共享助力业务腾飞”',
desc:
'四川路桥建设集团股份有限公司是国有控股上市公司,中国500强企业,于2003年3月在上海证券交易所挂牌交易,是四川省交通系统首家A股上市企业,母公司为四川省铁路产业投资集团公司。',
image: 'http://backapi.yunzer.cn/storage/uploads/2026/01/20/696eec54c8e64.png'
}
]
/* 视频弹窗 */
const showVideo = ref(false);
</script>
<template>
<Header />
<!-- Banner -->
<div class="banner">
<div class="banner-inner">
<h1>行业解决方案</h1>
<p>
金蝶行业解决方案致力于应用智能技术助力企业实现数字化转型重塑企业核心竞争力
</p>
<el-button type="primary" size="large">立即咨询</el-button>
</div>
</div>
<!-- 行业解决方案 -->
<div class="section">
<!-- Tabs-->
<div class="industry-tabs-grid">
<div
v-for="(tab, index) in industryTabs"
:key="index"
class="tab-item"
@mouseenter="activeIndex = index"
>
<div
class="tab-box"
:class="{ active: activeIndex === index }"
>
<img
:src="tab.icon"
v-show="activeIndex !== index"
/>
<img
:src="tab.iconActive"
v-show="activeIndex === index"
/>
<p class="text-xl">{{ tab.title }}</p>
</div>
</div>
</div>
<!-- 内容区 -->
<div class="industry-content">
<router-link
v-for="(item, i) in industryTabs[activeIndex].contents"
:key="i"
:to="item.route"
class="content-card"
>
<div class="card-img">
<img src="@/assets/images/noimage.png">
</div>
<div class="flex-1">
<p class="card-title">{{ item.title }}</p>
<p class=""></p>
</div>
</router-link>
</div>
</div>
<!-- 视频 -->
<div class="banner-center">
<div class="banner-center-container">
<p class="banner-center-title">金蝶助力传统制造企业由大变强</p>
<el-button type="primary" :icon="VideoPlay" @click="showVideo = true">
观看视频
</el-button>
</div>
</div>
<div class="py-10 flex flex-col items-center">
<div class="text-left w-7xl">
<div class="text-3xl mb-5">客户成功故事</div>
<div class="con3-list mb-5">
<router-link
v-for="item in caseList"
:key="item.id"
:to="`/newscenter/kingdeeNews/detail/${item.id}`"
class="con3-list-link"
>
<div class="con3-list-box">
<img
class="con3-list-box-img"
:src="item.image"
:alt="item.title"
/>
<div class="con3-list-box-content">
<p class="con3-list-content-title">
{{ item.title }}
</p>
<p class="con3-list-content-text">
{{ item.desc }}
</p>
</div>
</div>
</router-link>
</div>
<div>
<el-link type="primary" underline="never">
更多客户成功故事
</el-link>
</div>
</div>
</div>
<el-dialog v-model="showVideo" width="800px">
<video
src=""
controls
autoplay
style="width:100%"
/>
</el-dialog>
<Footer />
</template>
<style scoped lang="scss">
.banner {
height: 360px;
background: url("@/assets/images/solution/solution.png") center / cover no-repeat;
color: #fff;
.banner-inner {
width: 1200px;
margin: 0 auto;
padding-top: 110px;
h1 {
font-size: 40px;
font-weight: 600;
}
p {
width: 420px;
margin: 20px 0;
font-size: 16px;
}
}
}
.section {
width: 1300px;
margin: 80px auto;
}
/* Tabs Grid */
.industry-tabs-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 24px;
}
.tab-box {
display: flex;
flex-direction: column;
align-items: center;
height: 200px;
background: #f7f7f7;
padding-top: 10px;
text-align: center;
border-bottom: 6px solid #f7f7f7;
cursor: pointer;
transition: 0.2s;
img {
height: 67px;
margin: 30px;
}
&.active {
background: #fff;
border-bottom-color: #00ccff;
box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}
}
/* Content */
.industry-content {
margin-top: 60px;
display: flex;
justify-content: center;
gap: 24px;
}
.content-card {
display: flex;
width: 260px;
padding: 20px;
border: 1px solid #eee;
background: #fff;
text-align: center;
transition: 0.2s;
&:hover {
box-shadow: 0 8px 10px rgba(0, 0, 0, 0.08);
}
.card-img {
width: 50px;
height: 53px;
}
.card-title {
font-size: 16px;
font-weight: 500;
}
}
.banner-center {
width: 100%;
height: 400px;
padding: 70px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: url(@/assets/images/solution/banner-center-pc.png) center center no-repeat;
.banner-center-container {
width: 1200px;
text-align: start;
.banner-center-title {
width: 380px;
font-size: 38px;
font-weight: 400;
line-height: 56px;
color: #fff;
margin: 28px 0;
}
}
}
.con3-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
gap: 110px;
}
.con3-list-link {
text-decoration: none;
color: inherit;
}
/* 卡片 */
.con3-list-box {
background: #fff;
border: 1px solid #eee;
transition: all 0.25s ease;
height: 100%;
display: flex;
flex-direction: column;
&:hover {
transform: translateY(-6px);
box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
}
}
.con3-list-box-img {
width: 100%;
height: 220px;
object-fit: cover;
background: #f5f7fa;
}
/* 文本区 */
.con3-list-box-content {
padding: 24px;
flex: 1;
background-color: #F6F6F6;
}
.con3-list-content-title {
font-size: 16px;
font-weight: 600;
color: #222;
margin-bottom: 12px;
line-height: 1.4;
}
.con3-list-content-text {
font-size: 14px;
color: #666;
line-height: 1.7;
}
</style>
+7
View File
@@ -0,0 +1,7 @@
<template>
</template>
<script lang="ts" setup>
</script>
<style scoped></style>
@@ -0,0 +1,7 @@
<template>
</template>
<script lang="ts" setup>
</script>
<style scoped></style>