Skip to content

Commit 5474046

Browse files
committed
feat(bugs): 修改首页加载的顺位逻辑 和备注
1 parent 14633f5 commit 5474046

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

packages/plugins/materials/src/composable/useResource.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,14 @@ const initPageOrBlock = async () => {
133133
return
134134
}
135135

136-
// url 没有 pageid 或 blockid,到当前用户锁定的页面顺位第一位,如果没有则停留在全部公共页面顺位第一页或者页面首页
137-
const pageInfo = appSchemaState.pageTree.find((page) => page?.meta?.isHome) ||
138-
appSchemaState.pageTree.find((page) => {
139-
if (page.componentName === COMPONENT_NAME.Page && globalState.userInfo.id === page.meta.occupier.id) {
140-
return true
141-
}
142-
return page.componentName === COMPONENT_NAME.Page && page?.meta?.group !== 'publicPages'
143-
}) || {
144-
page_content: {
145-
componentName: COMPONENT_NAME.Page
146-
}
147-
}
136+
// url 没有 pageid 或 blockid,到当前用户锁定的页面顺位第一位,如果没有则停留在页面首页 或者 全部公共页面顺位第一页
137+
const pageInfo = appSchemaState.pageTree.find(
138+
(page) => page.componentName === COMPONENT_NAME.Page && globalState.userInfo.id === page.meta.occupier.id
139+
) ||
140+
appSchemaState.pageTree.find((page) => page?.meta?.isHome) ||
141+
appSchemaState.pageTree.find(
142+
(page) => page.componentName === COMPONENT_NAME.Page && page?.meta?.group !== 'publicPages'
143+
) || { page_content: { componentName: COMPONENT_NAME.Page } }
148144

149145
if (pageInfo.meta?.id) {
150146
// 这里重新请求一遍页面详情数据,是因为 appSchemaState 的页面信息存在字段转换,比如 route 被转换成了 router 字段,导致调用页面保存接口的时候报错

0 commit comments

Comments
 (0)