Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
liyubing
2024-04-24 16:48:26 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
44eb1bbfa61db1a5473abaf1fcd655341dbbcb23
44eb1bbf
1 parent
c3fb969c
feat(广告):展现中心挂角广告,以及挂角广告跳转
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
81 deletions
sight_harmony/features/wdComponent/src/main/ets/components/page/PageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/PageComponent.ets
View file @
44eb1bb
...
...
@@ -125,18 +125,18 @@ export struct PageComponent {
if (this.pageModel.pageCornerAdv.matInfo != null) {
if (1 == this.pageModel.isRightAdv) {
// 页面右边挂角
this.draw
RightCornerAdvView(1
)
this.draw
PageCornerAdvView(1, true
)
} else if (2 == this.pageModel.isRightAdv) {
// 页面左边挂角
this.draw
LeftCornerAdvView(1
)
this.draw
PageCornerAdvView(1, false
)
}
} else if (this.pageModel.pageCornerContentInfo.advert != null) {
if (1 == this.pageModel.isRightAdv) {
// 页面右边挂角
this.draw
RightCornerAdvView(2
)
this.draw
PageCornerAdvView(2, true
)
} else if (2 == this.pageModel.isRightAdv) {
// 页面左边挂角
this.draw
LeftCornerAdvView(2
)
this.draw
PageCornerAdvView(2, false
)
}
}
}
...
...
@@ -144,11 +144,11 @@ export struct PageComponent {
}
/**
*
*
绘制页面挂角
* @param type 1:广告中心的挂角广告;2:展现中心的挂角广告
*/
@Builder
draw
LeftCornerAdvView(type: number
) {
draw
PageCornerAdvView(type: number, isRightCorne: boolean
) {
// 页面左挂角
Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0]
: this.pageModel.pageCornerContentInfo.advert.displayUrl)
...
...
@@ -157,76 +157,16 @@ export struct PageComponent {
.id("left_iv")
.alignRules({
bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
left: { anchor: '__container__', align: HorizontalAlign.Start },
left: { anchor: isRightCorne ? "" : '__container__', align: HorizontalAlign.Start },
right: { anchor: isRightCorne ? '__container__' : "", align: HorizontalAlign.End },
})
.margin({
bottom: "65vp",
left: ('app.float.card_comp_pagePadding_lf')
})
.onClick(() => {
// 广告业务跳转
ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo);
})
left: isRightCorne ? 0 : $r('app.float.card_comp_pagePadding_lf'),
right: isRightCorne ? $r('app.float.card_comp_pagePadding_lf') : 0,
Image($r('app.media.icon_adv_horn_close'))
.id('left_close')
.width($r('app.float.vp_16'))
.alignRules({
top: { anchor: 'left_iv', align: VerticalAlign.Top },
left: { anchor: 'left_iv', align: HorizontalAlign.Start },
})
.offset({
x: -10,
y: -10
})
.onClick(() => {
// 关闭挂角广告
this.pageModel.isShowAds = false;
})
if (type == 1) {
Text($r('app.string.comp_advertisement'))
.width($r('app.float.vp_28'))
.height($r('app.float.vp_16'))
.fontSize($r('app.float.font_size_10'))
.fontColor(Color.White)
.id('left_tag')
.alignRules({
bottom: { anchor: 'left_iv', align: VerticalAlign.Bottom },
left: { anchor: 'left_iv', align: HorizontalAlign.Start },
})
.textAlign(TextAlign.Center)
.backgroundColor($r('app.color.res_color_general_000000_30'))
.borderRadius({
topLeft: $r('app.float.vp_2'),
topRight: $r('app.float.vp_2'),
bottomLeft: $r('app.float.vp_2'),
bottomRight: $r('app.float.vp_2')
})
}
}
/**
*
* @param type 1:广告中心的挂角广告;2:展现中心的挂角广告
*/
@Builder
drawRightCornerAdvView(type: number) {
Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0]
: this.pageModel.pageCornerContentInfo.advert.displayUrl)
.width($r('app.float.vp_80'))
.height($r('app.float.vp_80'))
.id("right_iv")
.alignRules({
bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
right: { anchor: '__container__', align: HorizontalAlign.End },
})
.margin({ bottom: "65vp", right: $r('app.float.card_comp_pagePadding_lf') })
.onClick(() => {
if (type === 1) {
// 广告业务跳转
ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo);
...
...
@@ -235,19 +175,19 @@ export struct PageComponent {
ProcessUtils.advJumpMainPage(this.pageModel.pageCornerContentInfo.advert)
}
})
// 关闭按钮
Image($r('app.media.icon_adv_horn_close'))
.id('
righ
t_close')
.id('
lef
t_close')
.width($r('app.float.vp_16'))
.alignRules({
top: { anchor: 'right_iv', align: VerticalAlign.Top },
right: { anchor: 'right_iv', align: HorizontalAlign.End },
top: { anchor: 'left_iv', align: VerticalAlign.Top },
left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start },
right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End },
})
.offset({
x: 10,
y: -10
x: isRightCorne ? 10 : -10,
y: isRightCorne ? -10 : -10
})
.onClick(() => {
// 关闭挂角广告
...
...
@@ -261,10 +201,11 @@ export struct PageComponent {
.height($r('app.float.vp_16'))
.fontSize($r('app.float.font_size_10'))
.fontColor(Color.White)
.id('
righ
t_tag')
.id('
lef
t_tag')
.alignRules({
bottom: { anchor: 'right_iv', align: VerticalAlign.Bottom },
right: { anchor: 'right_iv', align: HorizontalAlign.End },
bottom: { anchor: 'left_iv', align: VerticalAlign.Bottom },
left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start },
right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End },
})
.textAlign(TextAlign.Center)
.backgroundColor($r('app.color.res_color_general_000000_30'))
...
...
@@ -276,9 +217,9 @@ export struct PageComponent {
})
}
}
async aboutToAppear() {
// 选中tab,才请求数据。拦截大量接口请求
if (this.navIndex === this.currentTopNavSelectedIndex) {
...
...
Please
register
or
login
to post a comment