Showing
1 changed file
with
22 additions
and
81 deletions
| @@ -125,18 +125,18 @@ export struct PageComponent { | @@ -125,18 +125,18 @@ export struct PageComponent { | ||
| 125 | if (this.pageModel.pageCornerAdv.matInfo != null) { | 125 | if (this.pageModel.pageCornerAdv.matInfo != null) { |
| 126 | if (1 == this.pageModel.isRightAdv) { | 126 | if (1 == this.pageModel.isRightAdv) { |
| 127 | // 页面右边挂角 | 127 | // 页面右边挂角 |
| 128 | - this.drawRightCornerAdvView(1) | 128 | + this.drawPageCornerAdvView(1, true) |
| 129 | } else if (2 == this.pageModel.isRightAdv) { | 129 | } else if (2 == this.pageModel.isRightAdv) { |
| 130 | // 页面左边挂角 | 130 | // 页面左边挂角 |
| 131 | - this.drawLeftCornerAdvView(1) | 131 | + this.drawPageCornerAdvView(1, false) |
| 132 | } | 132 | } |
| 133 | } else if (this.pageModel.pageCornerContentInfo.advert != null) { | 133 | } else if (this.pageModel.pageCornerContentInfo.advert != null) { |
| 134 | if (1 == this.pageModel.isRightAdv) { | 134 | if (1 == this.pageModel.isRightAdv) { |
| 135 | // 页面右边挂角 | 135 | // 页面右边挂角 |
| 136 | - this.drawRightCornerAdvView(2) | 136 | + this.drawPageCornerAdvView(2, true) |
| 137 | } else if (2 == this.pageModel.isRightAdv) { | 137 | } else if (2 == this.pageModel.isRightAdv) { |
| 138 | // 页面左边挂角 | 138 | // 页面左边挂角 |
| 139 | - this.drawLeftCornerAdvView(2) | 139 | + this.drawPageCornerAdvView(2, false) |
| 140 | } | 140 | } |
| 141 | } | 141 | } |
| 142 | } | 142 | } |
| @@ -144,11 +144,11 @@ export struct PageComponent { | @@ -144,11 +144,11 @@ export struct PageComponent { | ||
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | /** | 146 | /** |
| 147 | - * | 147 | + * 绘制页面挂角 |
| 148 | * @param type 1:广告中心的挂角广告;2:展现中心的挂角广告 | 148 | * @param type 1:广告中心的挂角广告;2:展现中心的挂角广告 |
| 149 | */ | 149 | */ |
| 150 | @Builder | 150 | @Builder |
| 151 | - drawLeftCornerAdvView(type: number) { | 151 | + drawPageCornerAdvView(type: number, isRightCorne: boolean) { |
| 152 | // 页面左挂角 | 152 | // 页面左挂角 |
| 153 | Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0] | 153 | Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0] |
| 154 | : this.pageModel.pageCornerContentInfo.advert.displayUrl) | 154 | : this.pageModel.pageCornerContentInfo.advert.displayUrl) |
| @@ -157,76 +157,16 @@ export struct PageComponent { | @@ -157,76 +157,16 @@ export struct PageComponent { | ||
| 157 | .id("left_iv") | 157 | .id("left_iv") |
| 158 | .alignRules({ | 158 | .alignRules({ |
| 159 | bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, | 159 | bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, |
| 160 | - left: { anchor: '__container__', align: HorizontalAlign.Start }, | 160 | + left: { anchor: isRightCorne ? "" : '__container__', align: HorizontalAlign.Start }, |
| 161 | + right: { anchor: isRightCorne ? '__container__' : "", align: HorizontalAlign.End }, | ||
| 161 | }) | 162 | }) |
| 162 | .margin({ | 163 | .margin({ |
| 163 | bottom: "65vp", | 164 | bottom: "65vp", |
| 164 | - left: ('app.float.card_comp_pagePadding_lf') | ||
| 165 | - }) | ||
| 166 | - .onClick(() => { | ||
| 167 | - // 广告业务跳转 | ||
| 168 | - ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo); | ||
| 169 | - }) | 165 | + left: isRightCorne ? 0 : $r('app.float.card_comp_pagePadding_lf'), |
| 166 | + right: isRightCorne ? $r('app.float.card_comp_pagePadding_lf') : 0, | ||
| 170 | 167 | ||
| 171 | - Image($r('app.media.icon_adv_horn_close')) | ||
| 172 | - .id('left_close') | ||
| 173 | - .width($r('app.float.vp_16')) | ||
| 174 | - .alignRules({ | ||
| 175 | - top: { anchor: 'left_iv', align: VerticalAlign.Top }, | ||
| 176 | - left: { anchor: 'left_iv', align: HorizontalAlign.Start }, | ||
| 177 | - }) | ||
| 178 | - .offset({ | ||
| 179 | - x: -10, | ||
| 180 | - y: -10 | ||
| 181 | }) | 168 | }) |
| 182 | .onClick(() => { | 169 | .onClick(() => { |
| 183 | - // 关闭挂角广告 | ||
| 184 | - this.pageModel.isShowAds = false; | ||
| 185 | - | ||
| 186 | - }) | ||
| 187 | - | ||
| 188 | - if (type == 1) { | ||
| 189 | - Text($r('app.string.comp_advertisement')) | ||
| 190 | - .width($r('app.float.vp_28')) | ||
| 191 | - .height($r('app.float.vp_16')) | ||
| 192 | - .fontSize($r('app.float.font_size_10')) | ||
| 193 | - .fontColor(Color.White) | ||
| 194 | - .id('left_tag') | ||
| 195 | - .alignRules({ | ||
| 196 | - bottom: { anchor: 'left_iv', align: VerticalAlign.Bottom }, | ||
| 197 | - left: { anchor: 'left_iv', align: HorizontalAlign.Start }, | ||
| 198 | - }) | ||
| 199 | - .textAlign(TextAlign.Center) | ||
| 200 | - .backgroundColor($r('app.color.res_color_general_000000_30')) | ||
| 201 | - .borderRadius({ | ||
| 202 | - topLeft: $r('app.float.vp_2'), | ||
| 203 | - topRight: $r('app.float.vp_2'), | ||
| 204 | - bottomLeft: $r('app.float.vp_2'), | ||
| 205 | - bottomRight: $r('app.float.vp_2') | ||
| 206 | - }) | ||
| 207 | - } | ||
| 208 | - | ||
| 209 | - } | ||
| 210 | - | ||
| 211 | - /** | ||
| 212 | - * | ||
| 213 | - * @param type 1:广告中心的挂角广告;2:展现中心的挂角广告 | ||
| 214 | - */ | ||
| 215 | - @Builder | ||
| 216 | - drawRightCornerAdvView(type: number) { | ||
| 217 | - | ||
| 218 | - Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0] | ||
| 219 | - : this.pageModel.pageCornerContentInfo.advert.displayUrl) | ||
| 220 | - .width($r('app.float.vp_80')) | ||
| 221 | - .height($r('app.float.vp_80')) | ||
| 222 | - .id("right_iv") | ||
| 223 | - .alignRules({ | ||
| 224 | - bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, | ||
| 225 | - right: { anchor: '__container__', align: HorizontalAlign.End }, | ||
| 226 | - }) | ||
| 227 | - .margin({ bottom: "65vp", right: $r('app.float.card_comp_pagePadding_lf') }) | ||
| 228 | - .onClick(() => { | ||
| 229 | - | ||
| 230 | if (type === 1) { | 170 | if (type === 1) { |
| 231 | // 广告业务跳转 | 171 | // 广告业务跳转 |
| 232 | ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo); | 172 | ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo); |
| @@ -235,19 +175,19 @@ export struct PageComponent { | @@ -235,19 +175,19 @@ export struct PageComponent { | ||
| 235 | ProcessUtils.advJumpMainPage(this.pageModel.pageCornerContentInfo.advert) | 175 | ProcessUtils.advJumpMainPage(this.pageModel.pageCornerContentInfo.advert) |
| 236 | 176 | ||
| 237 | } | 177 | } |
| 238 | - | ||
| 239 | }) | 178 | }) |
| 240 | - | 179 | + // 关闭按钮 |
| 241 | Image($r('app.media.icon_adv_horn_close')) | 180 | Image($r('app.media.icon_adv_horn_close')) |
| 242 | - .id('right_close') | 181 | + .id('left_close') |
| 243 | .width($r('app.float.vp_16')) | 182 | .width($r('app.float.vp_16')) |
| 244 | .alignRules({ | 183 | .alignRules({ |
| 245 | - top: { anchor: 'right_iv', align: VerticalAlign.Top }, | ||
| 246 | - right: { anchor: 'right_iv', align: HorizontalAlign.End }, | 184 | + top: { anchor: 'left_iv', align: VerticalAlign.Top }, |
| 185 | + left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start }, | ||
| 186 | + right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End }, | ||
| 247 | }) | 187 | }) |
| 248 | .offset({ | 188 | .offset({ |
| 249 | - x: 10, | ||
| 250 | - y: -10 | 189 | + x: isRightCorne ? 10 : -10, |
| 190 | + y: isRightCorne ? -10 : -10 | ||
| 251 | }) | 191 | }) |
| 252 | .onClick(() => { | 192 | .onClick(() => { |
| 253 | // 关闭挂角广告 | 193 | // 关闭挂角广告 |
| @@ -261,10 +201,11 @@ export struct PageComponent { | @@ -261,10 +201,11 @@ export struct PageComponent { | ||
| 261 | .height($r('app.float.vp_16')) | 201 | .height($r('app.float.vp_16')) |
| 262 | .fontSize($r('app.float.font_size_10')) | 202 | .fontSize($r('app.float.font_size_10')) |
| 263 | .fontColor(Color.White) | 203 | .fontColor(Color.White) |
| 264 | - .id('right_tag') | 204 | + .id('left_tag') |
| 265 | .alignRules({ | 205 | .alignRules({ |
| 266 | - bottom: { anchor: 'right_iv', align: VerticalAlign.Bottom }, | ||
| 267 | - right: { anchor: 'right_iv', align: HorizontalAlign.End }, | 206 | + bottom: { anchor: 'left_iv', align: VerticalAlign.Bottom }, |
| 207 | + left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start }, | ||
| 208 | + right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End }, | ||
| 268 | }) | 209 | }) |
| 269 | .textAlign(TextAlign.Center) | 210 | .textAlign(TextAlign.Center) |
| 270 | .backgroundColor($r('app.color.res_color_general_000000_30')) | 211 | .backgroundColor($r('app.color.res_color_general_000000_30')) |
| @@ -276,9 +217,9 @@ export struct PageComponent { | @@ -276,9 +217,9 @@ export struct PageComponent { | ||
| 276 | }) | 217 | }) |
| 277 | } | 218 | } |
| 278 | 219 | ||
| 279 | - | ||
| 280 | } | 220 | } |
| 281 | 221 | ||
| 222 | + | ||
| 282 | async aboutToAppear() { | 223 | async aboutToAppear() { |
| 283 | // 选中tab,才请求数据。拦截大量接口请求 | 224 | // 选中tab,才请求数据。拦截大量接口请求 |
| 284 | if (this.navIndex === this.currentTopNavSelectedIndex) { | 225 | if (this.navIndex === this.currentTopNavSelectedIndex) { |
-
Please register or login to post a comment