fix: restore dashboard-rendered control center

This commit is contained in:
2026-06-13 09:50:51 +08:00
parent ff9dcdd4e1
commit af879e4607
6 changed files with 52 additions and 1240 deletions
@@ -16,5 +16,5 @@ export interface PageMeta {
}
export async function getPageByCodeApi(code: string) {
return requestClient.get<PageMeta>(`/api/online_dev/page/code/${code}`);
return requestClient.get<PageMeta>(`/api/core/page/code/${code}`);
}
File diff suppressed because it is too large Load Diff
@@ -1,11 +1,11 @@
<script lang="ts" setup>
import type { Component } from 'vue';
import { computed, defineAsyncComponent, onMounted, ref, watch } from 'vue';
import { defineAsyncComponent, onMounted, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import { ElEmpty, ElMessage, ElScrollbar } from 'element-plus';
import { getPageByCodeApi } from '#/api/core/page-manager';
defineOptions({ name: 'PageRender' });
const route = useRoute();
@@ -17,11 +17,6 @@ const pageConfig = ref<string>('');
const pageName = ref('');
const pageCode = ref('');
const builtinPages: Record<string, Component> = {
main_home: defineAsyncComponent(() => import('./AiAgentHome.vue')),
};
const currentBuiltinPage = computed(() => builtinPages[pageCode.value]);
// 获取页面编码
function getPageCode(): string {
// 优先从 query 获取
@@ -53,19 +48,9 @@ async function loadPageData() {
}
pageCode.value = code;
if (builtinPages[code]) {
pageName.value = '控制中心';
pageConfig.value = '';
loading.value = false;
return;
}
loading.value = true;
try {
const { getPageByCodeApi } = await import(
'#/api/online-dev/page-manager'
);
const page = await getPageByCodeApi(code);
pageName.value = page.name;
pageConfig.value =
@@ -95,8 +80,7 @@ watch(
<template>
<ElScrollbar class="rounded-[8px] py-3">
<div v-loading="loading" class="h-[calc(100vh-120px)] rounded-[8px] px-3">
<component :is="currentBuiltinPage" v-if="currentBuiltinPage" />
<DashboardRenderer v-else-if="pageConfig" :config="pageConfig" />
<DashboardRenderer v-if="pageConfig" :config="pageConfig" />
<ElEmpty v-else-if="!loading" description="暂无页面配置" />
</div>
</ElScrollbar>