From 115bc268902a9899d7d159133c2ba693eddfe00d Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 03 十一月 2026 17:58:50 +0800
Subject: [PATCH] 完善门户与会员审批交互
---
src/views/dashboard/analytics/index.vue | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/src/views/dashboard/analytics/index.vue b/src/views/dashboard/analytics/index.vue
index c11b0a4..8afb641 100644
--- a/src/views/dashboard/analytics/index.vue
+++ b/src/views/dashboard/analytics/index.vue
@@ -1,11 +1,12 @@
<script lang="ts" setup>
-import { computed, ref } from 'vue';
+import { computed, onMounted, onUnmounted, ref } from 'vue';
import { IconifyIcon } from '@vben/icons';
import { preferences } from '@vben/preferences';
import PortalFooter from '#/components/portal/portal-footer.vue';
import { portalCategory, usePortalMenus } from '#/components/portal/use-portal-menus';
+import { getEnabledHomeBanners, type HomeBanner } from '#/api/system/home-banner';
import KpiCards from './modules/kpi-cards.vue';
import NoticePanel from './modules/notice-panel.vue';
@@ -18,6 +19,16 @@
const { menus, leaves, features, goMenu } = usePortalMenus();
const appName = computed(() => preferences.copyright.companyName);
const slideIndex = ref(0);
+const banners = ref<HomeBanner[]>([]);
+let slideTimer: ReturnType<typeof setInterval> | undefined;
+onMounted(async () => {
+ slideTimer = setInterval(() => {
+ const count = banners.value.length || slides.length;
+ if (count > 1) slideIndex.value = (slideIndex.value + 1) % count;
+ }, 5000);
+ try { banners.value = await getEnabledHomeBanners(); slideIndex.value = 0; } catch { /* 浣跨敤榛樿棣栭〉 */ }
+});
+onUnmounted(() => { if (slideTimer) clearInterval(slideTimer); });
const slides = [
{ title: '鏈嶅姟渚涢攢鍚堜綔銆�鍔╁姏涔℃潙鎸叴', motto: '寮�鏀惧崗浣� 路 瀛︽湳鐮旂┒ 路 鏈嶅姟鍙戝睍', description: '鎺ㄥ姩渚涢攢鍚堜綔缁忔祹鐮旂┒锛屾湇鍔¤涓氶珮璐ㄩ噺鍙戝睍' },
{ title: '鍑濊仛瀛︽湳鍔涢噺銆�娣卞寲璇鹃鐮旂┒', motto: '璇鹃鎸囧崡 路 鍦ㄧ嚎鐢虫姤 路 杩涘害璺熻釜', description: '鍥寸粫鐮旂┒璇鹃锛岃繛鎺ョ敵鎶ャ�佸鎵逛笌鍗忎綔鏈嶅姟' },
@@ -31,25 +42,25 @@
<template>
<div class="portal-home">
- <section class="portal-hero" aria-labelledby="portal-hero-title">
+ <section class="portal-hero" :class="{ 'has-banner': banners.length }" :style="banners.length ? { backgroundImage: `url('${banners[slideIndex]?.imageUrl}')` } : undefined" :aria-label="banners.length ? banners[slideIndex]?.title : undefined" :aria-labelledby="banners.length ? undefined : 'portal-hero-title'">
<div class="portal-hero-copy">
- <h1 id="portal-hero-title"><span v-for="part in currentSlide.title.split('銆�')" :key="part">{{ part }}</span></h1>
+ <h1 id="portal-hero-title"><span v-for="part in (banners.length ? (banners[slideIndex]?.title || '') : currentSlide.title).split('銆�')" :key="part">{{ part }}</span></h1>
<div class="portal-hero-organization"><span></span><strong>{{ appName }}</strong><span></span></div>
- <p class="portal-hero-motto">{{ currentSlide.motto }}</p>
- <p class="portal-hero-description">{{ currentSlide.description }}</p>
+ <p v-if="!banners.length" class="portal-hero-motto">{{ currentSlide.motto }}</p>
+ <p v-if="!banners.length" class="portal-hero-description">{{ currentSlide.description }}</p>
</div>
<div class="portal-hero-pages" aria-label="棣栭〉涓婚鍒囨崲">
- <button v-for="(slide, index) in slides" :key="slide.title" type="button" :aria-label="`鏌ョ湅涓婚锛�${slide.title}`" :aria-pressed="slideIndex === index" :class="{ active: slideIndex === index }" @click="slideIndex = index"></button>
+ <button v-for="(slide, index) in (banners.length ? banners : slides)" :key="index" type="button" :aria-label="`鏌ョ湅涓婚锛�${slide.title}`" :aria-pressed="slideIndex === index" :class="{ active: slideIndex === index }" @click="slideIndex = index"></button>
</div>
</section>
<div class="portal-content">
<QuickActions />
- <section v-if="features.application || features.todo || features.notice" class="portal-news-grid" aria-label="涓氬姟鍔ㄦ�佷笌閫氱煡">
+ <section class="portal-news-grid" aria-label="涓氬姟鍔ㄦ�佷笌閫氱煡">
<ResearchHighlights v-if="features.application" :menu="features.application" />
<TodoPanel v-else-if="features.todo" />
- <NoticePanel v-if="features.notice" :menu-path="features.notice.path" />
+ <NoticePanel :menu-path="features.notice?.path" />
</section>
<section v-if="topicMenus.length" class="portal-topic-strip" aria-label="涓氬姟鐩磋揪">
--
Gitblit v1.9.3