diff --git a/src/App.vue b/src/App.vue index bbef5a9..176f4ce 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,9 +2,9 @@ import { useI18n } from 'vue-i18n'; import NavBar from '@/components/layout/NavBar.vue'; import Footer from '@/components/layout/Footer.vue'; -import { queryConfigList } from '@/api/modules/config'; -import { ref } from 'vue'; -import type { ConfigItem } from '@/api/modules/config'; +import { queryConfigList, querySummaryList } from '@/api'; +import { ref, onMounted, provide } from 'vue'; +import type { ConfigItem, SummaryItem } from '@/api'; const { locale } = useI18n(); @@ -14,16 +14,42 @@ const changeLanguage = (lang: string) => { localStorage.setItem('language', lang); }; -// 获取系统配置列表 +// 系统配置数据 const configList = ref([]); +// 概要说明数据 +const summaryList = ref([]); + +// 获取系统配置列表 const getConfigList = async () => { - const response = await queryConfigList(); - console.log('系统配置', response); - - configList.value = response; + try { + const response = await queryConfigList(); + console.log('系统配置', response); + configList.value = response; + } catch (error) { + console.error('获取系统配置失败:', error); + } }; -getConfigList(); +// 获取概要说明列表 +const getSummaryList = async () => { + try { + const response = await querySummaryList(); + console.log('概要说明', response); + summaryList.value = response; + } catch (error) { + console.error('获取概要说明失败:', error); + } +}; + +// 在组件挂载时加载数据 +onMounted(() => { + getConfigList(); + getSummaryList(); +}); + +// 提供数据给子组件使用 +provide('configList', configList); +provide('summaryList', summaryList);