Skip to content

Commit

Permalink
fix child tempalte page mode
Browse files Browse the repository at this point in the history
  • Loading branch information
biezhihua committed May 23, 2024
1 parent b2e645f commit 579f5ac
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ object GXNodeTreeCreator {

// 容器模板下的子模板
if (gxNode.isContainerType() && gxChildTemplateInfo.isTemplate()) {
val gxTemplateItem = GXTemplateEngine.GXTemplateItem(
gxTemplateContext.context,
gxTemplateContext.templateItem.bizId,
gxChildLayer.id
).apply {
this.isPageMode = gxTemplateContext.templateItem.isPageMode
}
gxNode.addChildTemplateItems(
GXTemplateEngine.GXTemplateItem(
gxTemplateContext.context,
gxTemplateContext.templateItem.bizId,
gxChildLayer.id
), gxChildVisualTemplateNode
gxTemplateItem, gxChildVisualTemplateNode
)
}
// 普通模板嵌套的子模板根节点,可能是普通模板也可能是容器模板
Expand All @@ -119,9 +122,7 @@ object GXNodeTreeCreator {
}
// 普通子节点
else {
val gxChildNode = createNode(
gxTemplateContext, gxNode, currentLayer, null, gxTemplateInfo
)
val gxChildNode = createNode(gxTemplateContext, gxNode, currentLayer, null, gxTemplateInfo)

// 建立层级关系
if (gxNode.children == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,15 @@ object GXNodeTreePrepare {

// 容器模板下的子模板
if (gxNode.isContainerType() && gxChildTemplateInfo.isTemplate()) {
val gxTemplateItem = GXTemplateEngine.GXTemplateItem(
gxTemplateContext.context,
gxTemplateContext.templateItem.bizId,
gxChildLayer.id
).apply {
this.isPageMode = gxTemplateContext.templateItem.isPageMode
}
gxNode.addChildTemplateItems(
GXTemplateEngine.GXTemplateItem(
gxTemplateContext.context,
gxTemplateContext.templateItem.bizId,
gxChildLayer.id
), gxChildVisualTemplateNode
gxTemplateItem, gxChildVisualTemplateNode
)
}
// 普通模板嵌套的子模板根节点,可能是普通模板也可能是容器模板
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,12 @@ class GXContainerViewAdapter(
val footer = extend?.getJSONObject(GAIAX_CONTAINER_FOOTER)
if (footer != null) {
val templateId = footer.getString(GXTemplateKey.GAIAX_LAYER_ID)
footerTemplateItem = GXTemplateEngine.GXTemplateItem(
val gxTemplateItem = GXTemplateEngine.GXTemplateItem(
gxTemplateContext.context, gxTemplateContext.templateItem.bizId, templateId
)
).apply {
this.isPageMode = gxTemplateContext.templateItem.isPageMode
}
footerTemplateItem = gxTemplateItem
footerTypeHasMore = footer.getBoolean(GXTemplateKey.GAIAX_CONTAINER_HAS_MORE) ?: false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,14 @@ data class GXTemplateInfo(
templateInfo: GXTemplateInfo, templateItem: GXTemplateEngine.GXTemplateItem
) {
forChildrenTemplate(templateInfo.layer) {
val childTemplate = createTemplate(GXTemplateEngine.GXTemplateItem(
val gxTemplateItem = GXTemplateEngine.GXTemplateItem(
templateItem.context, templateItem.bizId, it.id
).apply {
this.isLocal = templateItem.isLocal
this.templateVersion = templateItem.templateVersion
})
this.isPageMode = templateItem.isPageMode
}
val childTemplate = createTemplate(gxTemplateItem)
if (templateInfo.children == null) {
templateInfo.children = mutableListOf()
}
Expand Down

0 comments on commit 579f5ac

Please sign in to comment.