Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d33d1806
authored
Jan 14, 2026
by
Lin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 默认页面功能开关配置
1 parent
7e46f7d9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
129 additions
and
6 deletions
apps/web/venus-agentic/venus-agentic-base/src/config/center.ts
apps/web/venus-agentic/venus-agentic-base/src/qiankun/apps.ts
apps/web/venus-agentic/venus-agentic-base/src/qiankun/home-route-config.json
apps/web/venus-agentic/venus-agentic-base/src/views/Home.vue
apps/web/venus-agentic/venus-agentic-base/src/config/center.ts
View file @
d33d180
...
...
@@ -41,6 +41,63 @@ function initConfigReadyPromise() {
* @returns 路由数据
*/
export
async
function
fetchMicroAppRouteConfig
():
Promise
<
any
>
{
if
(
baseConfig
.
features
.
defaultRoute
.
enabled
){
return
{
"code"
:
200
,
"message"
:
"success"
,
"data"
:
{
"microApps"
:
[
{
"name"
:
"home"
,
"entry"
:
{
"development"
:
""
,
"production"
:
""
,
"test"
:
""
,
"default"
:
""
},
"container"
:
"#subapp-viewport"
,
"activeRule"
:
"/home"
,
"props"
:
{
"routerBase"
:
"/home"
},
"enabled"
:
true
,
"routes"
:
{
"path"
:
"/home"
,
"name"
:
"Home"
,
"title"
:
"首页"
,
"level"
:
1
,
"isMicroApp"
:
false
,
"requiresAuth"
:
true
},
"routerList"
:
{
"id"
:
"home"
,
"title"
:
"首页"
,
"path"
:
"/home"
,
"icon"
:
""
,
"sidebarMenus"
:
[
{
"id"
:
"home-dashboard"
,
"title"
:
"工作台"
,
"path"
:
"/home/dashboard"
,
"icon"
:
""
,
"level"
:
2
,
"hidden"
:
false
,
"parentId"
:
"home"
,
"meta"
:
{
"title"
:
"工作台"
,
"icon"
:
"dashboard"
,
"noCache"
:
false
,
"link"
:
null
},
"children"
:
[]
}
]
}
}
]
}
};
}
// 先检查本地缓存
const
cachedData
=
localCache
.
get
(
ROUTER_CONFIG_CACHE_KEY
);
if
(
cachedData
)
{
...
...
@@ -55,7 +112,6 @@ export async function fetchMicroAppRouteConfig(): Promise<any> {
if
(
result
)
{
localCache
.
set
(
ROUTER_CONFIG_CACHE_KEY
,
result
);
}
return
result
;
}
...
...
apps/web/venus-agentic/venus-agentic-base/src/qiankun/apps.ts
View file @
d33d180
...
...
@@ -11,7 +11,14 @@ let isConfigLoaded = false;
let
configLoadPromise
:
Promise
<
void
>
|
null
=
null
;
// 默认配置(作为降级方案)
const
defaultMicroApps
:
MicroAppConfig
[]
=
[];
const
defaultMicroApps
:
MicroAppConfig
[]
=
[
{
name
:
'Home'
,
entry
:
''
,
// 主应用页面,无需 entry
container
:
'#subapp-viewport'
,
// 微应用容器
activeRule
:
'/home'
,
// 对应路由路径
},
];
/**
* 加载并设置微应用配置
...
...
@@ -32,15 +39,16 @@ export async function loadMicroAppConfig(): Promise<void> {
configLoadPromise
=
(
async
()
=>
{
try
{
const
remoteConfig
=
await
fetchMicroAppRouteConfig
();
console
.
log
(
'remoteConfigAAAAAA'
,
JSON
.
stringify
(
remoteConfig
));
// 获取子应用路由配置,并转换远程配置为 qiankun 配置(
// props注入:communicationManager消息管理,getGscRequest请求实例,mountParcel,name子应用名称,singleSpa
microApps
=
transformToQiankun
(
remoteConfig
.
data
?.
microApps
);
// 如果远程配置为空,使用默认配置
if
(
microApps
.
length
===
0
)
{
microApps
=
defaultMicroApps
;
}
// if (config.features.defaultRoute.enabled
) {
//
microApps = defaultMicroApps;
//
}
isConfigLoaded
=
true
;
console
.
log
(
'[微前端配置] 配置加载完成,共加载'
,
microApps
.
length
,
'个微应用'
);
console
.
log
(
'[微前端配置] 配置加载完成,共加载'
,
microApps
,
'个微应用'
);
}
catch
(
error
)
{
microApps
=
defaultMicroApps
;
isConfigLoaded
=
true
;
...
...
apps/web/venus-agentic/venus-agentic-base/src/qiankun/home-route-config.json
0 → 100644
View file @
d33d180
{
"code"
:
200
,
"message"
:
"success"
,
"data"
:
{
"microApps"
:
[
{
"name"
:
"home"
,
"entry"
:
{
"development"
:
""
,
"production"
:
""
,
"test"
:
""
,
"default"
:
""
},
"container"
:
"#subapp-viewport"
,
"activeRule"
:
"/home"
,
"props"
:
{
"routerBase"
:
"/home"
},
"enabled"
:
true
,
"routes"
:
{
"path"
:
"/home"
,
"name"
:
"Home"
,
"title"
:
"首页"
,
"level"
:
1
,
"isMicroApp"
:
false
,
"requiresAuth"
:
true
},
"routerList"
:
{
"id"
:
"home"
,
"title"
:
"首页"
,
"path"
:
"/home"
,
"icon"
:
""
,
"sidebarMenus"
:
[
{
"id"
:
"home-dashboard"
,
"title"
:
"工作台"
,
"path"
:
"/home/dashboard"
,
"icon"
:
""
,
"level"
:
2
,
"hidden"
:
false
,
"parentId"
:
"home"
,
"meta"
:
{
"title"
:
"工作台"
,
"icon"
:
"dashboard"
,
"noCache"
:
false
,
"link"
:
null
},
"children"
:
[]
}
]
}
}
]
}
}
apps/web/venus-agentic/venus-agentic-base/src/views/Home.vue
View file @
d33d180
...
...
@@ -507,6 +507,9 @@ const handleDebounceClick = () => {
<GLButton
type=
"danger"
>
危险按钮
</GLButton>
<GLButton>
普通按钮
</GLButton>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment