Showing
7 changed files
with
207 additions
and
59 deletions
| @@ -6,6 +6,8 @@ import { WDRouterRule } from '../router/WDRouterRule'; | @@ -6,6 +6,8 @@ import { WDRouterRule } from '../router/WDRouterRule'; | ||
| 6 | import { ContentConstants } from 'wdConstant'; | 6 | import { ContentConstants } from 'wdConstant'; |
| 7 | import { common, Want } from '@kit.AbilityKit'; | 7 | import { common, Want } from '@kit.AbilityKit'; |
| 8 | import { BusinessError } from '@kit.BasicServicesKit'; | 8 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 9 | +import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; | ||
| 10 | +import { AdvertsBean } from 'wdBean/src/main/ets/bean/adv/AdvertsBean'; | ||
| 9 | 11 | ||
| 10 | // import { LiveModel } from '../viewmodel/LiveModel'; | 12 | // import { LiveModel } from '../viewmodel/LiveModel'; |
| 11 | 13 | ||
| @@ -16,6 +18,65 @@ const TAG = 'ProcessUtils'; | @@ -16,6 +18,65 @@ const TAG = 'ProcessUtils'; | ||
| 16 | */ | 18 | */ |
| 17 | export class ProcessUtils { | 19 | export class ProcessUtils { |
| 18 | /** | 20 | /** |
| 21 | + * 广告中心的业务广告跳转方法( 现用在挂角广告) | ||
| 22 | + * @param advContent | ||
| 23 | + */ | ||
| 24 | + static openAdvDetail(matInfo: CompAdvMatInfoBean) { | ||
| 25 | + | ||
| 26 | + if (matInfo == null) { | ||
| 27 | + return; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + // 优先openType,再取linkType | ||
| 31 | + let type: string; | ||
| 32 | + if (!StringUtils.isEmpty(matInfo.openType)) { | ||
| 33 | + type = matInfo.openType; | ||
| 34 | + } else { | ||
| 35 | + type = matInfo.linkType; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + if ('0' == type) { | ||
| 39 | + // 0 :无链接 | ||
| 40 | + return; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + let linkUrl: string = matInfo.linkUrl; | ||
| 44 | + if (StringUtils.isEmpty(linkUrl)) { | ||
| 45 | + return; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + if ('1' == type) { | ||
| 49 | + // 内链 | ||
| 50 | + let content: ContentDTO = {} as ContentDTO; | ||
| 51 | + content.linkUrl = linkUrl; | ||
| 52 | + ProcessUtils.gotoWeb(content); | ||
| 53 | + } else if ('2' == type) { | ||
| 54 | + // 外链 | ||
| 55 | + ProcessUtils.jumpExternalWebPage(linkUrl); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 展现中心的广告跳转 ( 现用在挂角广告) | ||
| 63 | + * @param advert 展现中心的展现广告 | ||
| 64 | + */ | ||
| 65 | + static advJumpMainPage(advert: AdvertsBean) { | ||
| 66 | + | ||
| 67 | + let content: ContentDTO = { | ||
| 68 | + linkUrl: advert.linkUrl, | ||
| 69 | + pageId: advert.pageId, | ||
| 70 | + objectId: advert.objectId, | ||
| 71 | + objectType: advert.objectType, | ||
| 72 | + relId: advert.relId, | ||
| 73 | + bottomNavId: advert.bottomNavId | ||
| 74 | + } as ContentDTO; | ||
| 75 | + | ||
| 76 | + ProcessUtils.processPage(content); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 19 | * 页面跳转 | 80 | * 页面跳转 |
| 20 | */ | 81 | */ |
| 21 | static processPage(content: ContentDTO) { | 82 | static processPage(content: ContentDTO) { |
| @@ -97,7 +158,7 @@ export class ProcessUtils { | @@ -97,7 +158,7 @@ export class ProcessUtils { | ||
| 97 | * 图集详情页 | 158 | * 图集详情页 |
| 98 | * @param content | 159 | * @param content |
| 99 | * */ | 160 | * */ |
| 100 | - public static gotoMultiPictureListPage(photoList: PhotoListBean[]) { | 161 | + public static gotoMultiPictureListPage(photoList: PhotoListBean[]) { |
| 101 | let taskAction: Action = { | 162 | let taskAction: Action = { |
| 102 | type: 'JUMP_DETAIL_PAGE', | 163 | type: 'JUMP_DETAIL_PAGE', |
| 103 | params: { | 164 | params: { |
| @@ -78,4 +78,6 @@ export interface ContentDTO { | @@ -78,4 +78,6 @@ export interface ContentDTO { | ||
| 78 | titleShow?: number; | 78 | titleShow?: number; |
| 79 | isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 | 79 | isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 |
| 80 | commentInfo?: commentInfo | 80 | commentInfo?: commentInfo |
| 81 | + //底部导航栏 id(用于频道跳转) | ||
| 82 | + bottomNavId:string; | ||
| 81 | } | 83 | } |
| @@ -14,6 +14,7 @@ import { CompParser } from '../CompParser'; | @@ -14,6 +14,7 @@ import { CompParser } from '../CompParser'; | ||
| 14 | import { CompDTO } from 'wdBean'; | 14 | import { CompDTO } from 'wdBean'; |
| 15 | import PageHelper from '../../viewmodel/PageHelper'; | 15 | import PageHelper from '../../viewmodel/PageHelper'; |
| 16 | import { channelSkeleton } from '../skeleton/channelSkeleton' | 16 | import { channelSkeleton } from '../skeleton/channelSkeleton' |
| 17 | +import { ProcessUtils } from 'wdRouter/Index'; | ||
| 17 | 18 | ||
| 18 | const TAG = 'PageComponent'; | 19 | const TAG = 'PageComponent'; |
| 19 | 20 | ||
| @@ -119,29 +120,72 @@ export struct PageComponent { | @@ -119,29 +120,72 @@ export struct PageComponent { | ||
| 119 | @Builder | 120 | @Builder |
| 120 | pageHornAd() { | 121 | pageHornAd() { |
| 121 | 122 | ||
| 123 | + if (this.pageModel.isShowAds) { | ||
| 122 | 124 | ||
| 123 | - if (this.pageModel.pageLeftCornerAdv.matInfo != null) { | 125 | + if (this.pageModel.pageCornerAdv.matInfo != null) { |
| 126 | + if (1 == this.pageModel.isRightAdv) { | ||
| 127 | + // 页面右边挂角 | ||
| 128 | + this.drawRightCornerAdvView(1) | ||
| 129 | + } else if (2 == this.pageModel.isRightAdv) { | ||
| 130 | + // 页面左边挂角 | ||
| 131 | + this.drawLeftCornerAdvView(1) | ||
| 132 | + } | ||
| 133 | + } else if (this.pageModel.pageCornerContentInfo.advert != null) { | ||
| 134 | + if (1 == this.pageModel.isRightAdv) { | ||
| 135 | + // 页面右边挂角 | ||
| 136 | + this.drawRightCornerAdvView(2) | ||
| 137 | + } else if (2 == this.pageModel.isRightAdv) { | ||
| 138 | + // 页面左边挂角 | ||
| 139 | + this.drawLeftCornerAdvView(2) | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + } | ||
| 124 | 143 | ||
| 144 | + } | ||
| 125 | 145 | ||
| 126 | - // 页面左挂角 | ||
| 127 | - Image(this.pageModel.pageLeftCornerAdv.matInfo.matImageUrl[0]) | ||
| 128 | - .width($r('app.float.vp_80')) | ||
| 129 | - .height($r('app.float.vp_80')) | ||
| 130 | - .id("left_iv") | ||
| 131 | - .alignRules({ | ||
| 132 | - bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, | ||
| 133 | - left: { anchor: '__container__', align: HorizontalAlign.Start }, | ||
| 134 | - }) | ||
| 135 | - .margin({ bottom: "65vp", left: $r('app.float.card_comp_pagePadding_lf') }) | 146 | + /** |
| 147 | + * | ||
| 148 | + * @param type 1:广告中心的挂角广告;2:展现中心的挂角广告 | ||
| 149 | + */ | ||
| 150 | + @Builder | ||
| 151 | + drawLeftCornerAdvView(type: number) { | ||
| 152 | + // 页面左挂角 | ||
| 153 | + Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0] | ||
| 154 | + : this.pageModel.pageCornerContentInfo.advert.displayUrl) | ||
| 155 | + .width($r('app.float.vp_80')) | ||
| 156 | + .height($r('app.float.vp_80')) | ||
| 157 | + .id("left_iv") | ||
| 158 | + .alignRules({ | ||
| 159 | + bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, | ||
| 160 | + left: { anchor: '__container__', align: HorizontalAlign.Start }, | ||
| 161 | + }) | ||
| 162 | + .margin({ | ||
| 163 | + bottom: "65vp", | ||
| 164 | + left: ('app.float.card_comp_pagePadding_lf') | ||
| 165 | + }) | ||
| 166 | + .onClick(() => { | ||
| 167 | + // 广告业务跳转 | ||
| 168 | + ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo); | ||
| 169 | + }) | ||
| 136 | 170 | ||
| 137 | - Image($r('app.media.icon_adv_horn_close')).id('left_close').width($r('app.float.vp_16')).alignRules({ | 171 | + Image($r('app.media.icon_adv_horn_close')) |
| 172 | + .id('left_close') | ||
| 173 | + .width($r('app.float.vp_16')) | ||
| 174 | + .alignRules({ | ||
| 138 | top: { anchor: 'left_iv', align: VerticalAlign.Top }, | 175 | top: { anchor: 'left_iv', align: VerticalAlign.Top }, |
| 139 | left: { anchor: 'left_iv', align: HorizontalAlign.Start }, | 176 | left: { anchor: 'left_iv', align: HorizontalAlign.Start }, |
| 140 | - }).offset({ | 177 | + }) |
| 178 | + .offset({ | ||
| 141 | x: -10, | 179 | x: -10, |
| 142 | y: -10 | 180 | y: -10 |
| 143 | }) | 181 | }) |
| 182 | + .onClick(() => { | ||
| 183 | + // 关闭挂角广告 | ||
| 184 | + this.pageModel.isShowAds = false; | ||
| 185 | + | ||
| 186 | + }) | ||
| 144 | 187 | ||
| 188 | + if (type == 1) { | ||
| 145 | Text($r('app.string.comp_advertisement')) | 189 | Text($r('app.string.comp_advertisement')) |
| 146 | .width($r('app.float.vp_28')) | 190 | .width($r('app.float.vp_28')) |
| 147 | .height($r('app.float.vp_16')) | 191 | .height($r('app.float.vp_16')) |
| @@ -162,41 +206,56 @@ export struct PageComponent { | @@ -162,41 +206,56 @@ export struct PageComponent { | ||
| 162 | }) | 206 | }) |
| 163 | } | 207 | } |
| 164 | 208 | ||
| 165 | - if (this.pageModel.pageRightCornerAdv.matInfo != null && this.pageModel.isShowRightAds) { | ||
| 166 | - // 页面右边挂角 | ||
| 167 | - Image(this.pageModel.pageRightCornerAdv.matInfo.matImageUrl[0]) | ||
| 168 | - .width($r('app.float.vp_80')) | ||
| 169 | - .height($r('app.float.vp_80')) | ||
| 170 | - .id("right_iv") | ||
| 171 | - .alignRules({ | ||
| 172 | - bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, | ||
| 173 | - right: { anchor: '__container__', align: HorizontalAlign.End }, | ||
| 174 | - }) | ||
| 175 | - .margin({ bottom: "65vp", right: $r('app.float.card_comp_pagePadding_lf') }) | ||
| 176 | - .onClick(()=>{ | 209 | + } |
| 210 | + | ||
| 211 | + /** | ||
| 212 | + * | ||
| 213 | + * @param type 1:广告中心的挂角广告;2:展现中心的挂角广告 | ||
| 214 | + */ | ||
| 215 | + @Builder | ||
| 216 | + drawRightCornerAdvView(type: number) { | ||
| 177 | 217 | ||
| 178 | - // 关闭挂角广告 | ||
| 179 | - this.pageModel.isShowLeftAds = false; | 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(() => { | ||
| 180 | 229 | ||
| 181 | - }) | 230 | + if (type === 1) { |
| 231 | + // 广告业务跳转 | ||
| 232 | + ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo); | ||
| 233 | + } else { | ||
| 234 | + // 展现中心的业务跳转 | ||
| 235 | + ProcessUtils.advJumpMainPage(this.pageModel.pageCornerContentInfo.advert) | ||
| 182 | 236 | ||
| 183 | - Image($r('app.media.icon_adv_horn_close')) | ||
| 184 | - .id('right_close') | ||
| 185 | - .width($r('app.float.vp_16')) | ||
| 186 | - .alignRules({ | ||
| 187 | - top: { anchor: 'right_iv', align: VerticalAlign.Top }, | ||
| 188 | - right: { anchor: 'right_iv', align: HorizontalAlign.End }, | ||
| 189 | - }) | ||
| 190 | - .offset({ | ||
| 191 | - x: 10, | ||
| 192 | - y: -10 | ||
| 193 | - }) | ||
| 194 | - .onClick(() => { | ||
| 195 | - // 关闭挂角广告 | ||
| 196 | - this.pageModel.isShowRightAds = false; | 237 | + } |
| 197 | 238 | ||
| 198 | - }) | 239 | + }) |
| 240 | + | ||
| 241 | + Image($r('app.media.icon_adv_horn_close')) | ||
| 242 | + .id('right_close') | ||
| 243 | + .width($r('app.float.vp_16')) | ||
| 244 | + .alignRules({ | ||
| 245 | + top: { anchor: 'right_iv', align: VerticalAlign.Top }, | ||
| 246 | + right: { anchor: 'right_iv', align: HorizontalAlign.End }, | ||
| 247 | + }) | ||
| 248 | + .offset({ | ||
| 249 | + x: 10, | ||
| 250 | + y: -10 | ||
| 251 | + }) | ||
| 252 | + .onClick(() => { | ||
| 253 | + // 关闭挂角广告 | ||
| 254 | + this.pageModel.isShowAds = false; | ||
| 255 | + | ||
| 256 | + }) | ||
| 199 | 257 | ||
| 258 | + if (type == 1) { | ||
| 200 | Text($r('app.string.comp_advertisement')) | 259 | Text($r('app.string.comp_advertisement')) |
| 201 | .width($r('app.float.vp_28')) | 260 | .width($r('app.float.vp_28')) |
| 202 | .height($r('app.float.vp_16')) | 261 | .height($r('app.float.vp_16')) |
| @@ -216,6 +275,8 @@ export struct PageComponent { | @@ -216,6 +275,8 @@ export struct PageComponent { | ||
| 216 | bottomRight: $r('app.float.vp_2') | 275 | bottomRight: $r('app.float.vp_2') |
| 217 | }) | 276 | }) |
| 218 | } | 277 | } |
| 278 | + | ||
| 279 | + | ||
| 219 | } | 280 | } |
| 220 | 281 | ||
| 221 | async aboutToAppear() { | 282 | async aboutToAppear() { |
| @@ -192,7 +192,8 @@ export struct SearchResultContentComponent{ | @@ -192,7 +192,8 @@ export struct SearchResultContentComponent{ | ||
| 192 | rmhPlatform: 0, | 192 | rmhPlatform: 0, |
| 193 | newTags: '', | 193 | newTags: '', |
| 194 | isSearch: true, | 194 | isSearch: true, |
| 195 | - publishTimestamp:"" | 195 | + publishTimestamp:"", |
| 196 | + bottomNavId:'', | ||
| 196 | } | 197 | } |
| 197 | 198 | ||
| 198 | this.data.push(contentDTO) | 199 | this.data.push(contentDTO) |
| @@ -64,29 +64,50 @@ export class PageHelper { | @@ -64,29 +64,50 @@ export class PageHelper { | ||
| 64 | // 优先展示展现中心广告 | 64 | // 优先展示展现中心广告 |
| 65 | let cornersAdv = pageInfo.cornersAdv | 65 | let cornersAdv = pageInfo.cornersAdv |
| 66 | 66 | ||
| 67 | + if (cornersAdv == null) { | ||
| 68 | + return | ||
| 69 | + } | ||
| 70 | + if (cornersAdv.advert == null) { | ||
| 71 | + return | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + if ("left_down" == cornersAdv.pos) { | ||
| 76 | + // 左边挂角广告 | ||
| 77 | + pageModel.isRightAdv = 2 | ||
| 78 | + } else { | ||
| 79 | + // 右边挂角广告 | ||
| 80 | + pageModel.isRightAdv = 1 | ||
| 81 | + | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + pageModel.pageCornerContentInfo = cornersAdv; | ||
| 85 | + pageModel.isShowAds = true | ||
| 86 | + | ||
| 67 | } else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) { | 87 | } else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) { |
| 68 | // 广告中心-挂角广告信息 | 88 | // 广告中心-挂角广告信息 |
| 69 | let cornersAdv2 = pageInfo.cornersAdv2 | 89 | let cornersAdv2 = pageInfo.cornersAdv2 |
| 70 | // 获取 | 90 | // 获取 |
| 71 | let showCompAdvBean = cornersAdv2[0] | 91 | let showCompAdvBean = cornersAdv2[0] |
| 72 | 92 | ||
| 93 | + if (showCompAdvBean.matInfo == null) { | ||
| 94 | + return | ||
| 95 | + } | ||
| 73 | // | 96 | // |
| 74 | let slotInfo = showCompAdvBean.slotInfo; | 97 | let slotInfo = showCompAdvBean.slotInfo; |
| 75 | let postion = slotInfo.position | 98 | let postion = slotInfo.position |
| 76 | - | ||
| 77 | if (postion == 0) { | 99 | if (postion == 0) { |
| 78 | //左边挂角 | 100 | //左边挂角 |
| 79 | - pageModel.pageLeftCornerAdv = showCompAdvBean | ||
| 80 | - pageModel.isShowLeftAds = true | 101 | + pageModel.isRightAdv = 2 |
| 81 | } else { | 102 | } else { |
| 82 | // 右边挂角 | 103 | // 右边挂角 |
| 83 | - pageModel.pageRightCornerAdv = showCompAdvBean | ||
| 84 | - pageModel.isShowRightAds = true | 104 | + pageModel.isRightAdv = 1 |
| 85 | } | 105 | } |
| 86 | - | ||
| 87 | - Logger.error("XXX", JSON.stringify(pageInfo.cornersAdv2)) | 106 | + pageModel.pageCornerAdv = showCompAdvBean |
| 107 | + pageModel.isShowAds = true | ||
| 88 | } | 108 | } |
| 89 | 109 | ||
| 110 | + | ||
| 90 | } | 111 | } |
| 91 | 112 | ||
| 92 | 113 |
| @@ -4,7 +4,7 @@ import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; | @@ -4,7 +4,7 @@ import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; | ||
| 4 | import { RefreshConstants as Const } from '../utils/RefreshConstants'; | 4 | import { RefreshConstants as Const } from '../utils/RefreshConstants'; |
| 5 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; | 5 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; |
| 6 | import { GroupInfoDTO, PageInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; | 6 | import { GroupInfoDTO, PageInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; |
| 7 | -import { CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; | 7 | +import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * 页面下拉刷新、上拉加载数据bean。 | 10 | * 页面下拉刷新、上拉加载数据bean。 |
| @@ -52,12 +52,10 @@ export default class PageModel { | @@ -52,12 +52,10 @@ export default class PageModel { | ||
| 52 | timestamp: String = '1'; | 52 | timestamp: String = '1'; |
| 53 | 53 | ||
| 54 | //左右挂角广告对象 | 54 | //左右挂角广告对象 |
| 55 | - pageLeftCornerAdv:CompAdvBean = {} as CompAdvBean | ||
| 56 | - isShowLeftAds : boolean = true; | ||
| 57 | - pageRightCornerAdv:CompAdvBean = {} as CompAdvBean | ||
| 58 | - isShowRightAds : boolean = true; | ||
| 59 | - | ||
| 60 | - | 55 | + pageCornerAdv:CompAdvBean = {} as CompAdvBean // 挂角广告 |
| 56 | + isShowAds : boolean = false; | ||
| 57 | + isRightAdv : number = 1;// 1:右边;2:左边 -> 默认右边 | ||
| 58 | + pageCornerContentInfo:AdvRuleBean = {} as AdvRuleBean // 展现中心业务信息 | ||
| 61 | 59 | ||
| 62 | 60 | ||
| 63 | /** | 61 | /** |
-
Please register or login to post a comment