Showing
4 changed files
with
137 additions
and
13 deletions
| 1 | import { TopicInfo } from '../morningevening/TopicInfo'; | 1 | import { TopicInfo } from '../morningevening/TopicInfo'; |
| 2 | import { ArrayList } from '@kit.ArkTS'; | 2 | import { ArrayList } from '@kit.ArkTS'; |
| 3 | +import { AdvRuleBean, CompAdvBean } from '../adv/AdvsRuleBean'; | ||
| 3 | 4 | ||
| 4 | export interface GroupItem { | 5 | export interface GroupItem { |
| 5 | id: number; | 6 | id: number; |
| @@ -15,7 +16,6 @@ export interface TopicDetailData { | @@ -15,7 +16,6 @@ export interface TopicDetailData { | ||
| 15 | shareSummary: string; | 16 | shareSummary: string; |
| 16 | id: number; | 17 | id: number; |
| 17 | baselineCopywriting: string; | 18 | baselineCopywriting: string; |
| 18 | - cornersAdv: string; | ||
| 19 | backgroundImgUrl: string; | 19 | backgroundImgUrl: string; |
| 20 | description: string; | 20 | description: string; |
| 21 | imgSize: string; | 21 | imgSize: string; |
| @@ -38,4 +38,12 @@ export interface TopicDetailData { | @@ -38,4 +38,12 @@ export interface TopicDetailData { | ||
| 38 | topicInfo: TopicInfo; | 38 | topicInfo: TopicInfo; |
| 39 | baselineColor: string; | 39 | baselineColor: string; |
| 40 | groups: ArrayList<GroupItem>; | 40 | groups: ArrayList<GroupItem>; |
| 41 | + /** | ||
| 42 | + * 挂角广告数据 | ||
| 43 | + */ | ||
| 44 | + cornersAdv: AdvRuleBean; | ||
| 45 | + /** | ||
| 46 | + * 广告中心-挂角广告信息 | ||
| 47 | + */ | ||
| 48 | + cornersAdv2: CompAdvBean[]; | ||
| 41 | } | 49 | } |
| @@ -22,6 +22,9 @@ import { PageRepository } from '../repository/PageRepository'; | @@ -22,6 +22,9 @@ import { PageRepository } from '../repository/PageRepository'; | ||
| 22 | import { CommentDialogView } from './CommentDialogView'; | 22 | import { CommentDialogView } from './CommentDialogView'; |
| 23 | import { faceDetector } from '@kit.CoreVisionKit'; | 23 | import { faceDetector } from '@kit.CoreVisionKit'; |
| 24 | import { channelSkeleton } from './skeleton/channelSkeleton'; | 24 | import { channelSkeleton } from './skeleton/channelSkeleton'; |
| 25 | +import PageAdModel from '../viewmodel/PageAdvModel'; | ||
| 26 | +import { ProcessUtils } from 'wdRouter/Index'; | ||
| 27 | +import { GrayManageModel } from '../viewmodel/GrayManageModel'; | ||
| 25 | 28 | ||
| 26 | const TAG: string = 'SpacialTopicPageComponent' | 29 | const TAG: string = 'SpacialTopicPageComponent' |
| 27 | 30 | ||
| @@ -51,10 +54,14 @@ export struct SpacialTopicPageComponent { | @@ -51,10 +54,14 @@ export struct SpacialTopicPageComponent { | ||
| 51 | @State showComment: boolean = false | 54 | @State showComment: boolean = false |
| 52 | @State topicInfo: TopicInfo = {} as TopicInfo | 55 | @State topicInfo: TopicInfo = {} as TopicInfo |
| 53 | @State topicDetail: TopicDetailData = {} as TopicDetailData | 56 | @State topicDetail: TopicDetailData = {} as TopicDetailData |
| 57 | + @State private pageAdvModel: PageAdModel = new PageAdModel(); | ||
| 54 | @State shareInfo: ShareInfoDTO = {} as ShareInfoDTO | 58 | @State shareInfo: ShareInfoDTO = {} as ShareInfoDTO |
| 55 | @State showBottomView: boolean = false; | 59 | @State showBottomView: boolean = false; |
| 56 | @State executedStartTime: number = new Date().getTime() | 60 | @State executedStartTime: number = new Date().getTime() |
| 57 | 61 | ||
| 62 | + // 国殇灰度管理 | ||
| 63 | + GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') | ||
| 64 | + | ||
| 58 | private trySendData2H5() { | 65 | private trySendData2H5() { |
| 59 | if (!this.webPrepared) { | 66 | if (!this.webPrepared) { |
| 60 | return | 67 | return |
| @@ -85,7 +92,7 @@ export struct SpacialTopicPageComponent { | @@ -85,7 +92,7 @@ export struct SpacialTopicPageComponent { | ||
| 85 | 92 | ||
| 86 | this.topicDetail = JSON.parse(dataString); | 93 | this.topicDetail = JSON.parse(dataString); |
| 87 | this.topicInfo = this.topicDetail.topicInfo; | 94 | this.topicInfo = this.topicDetail.topicInfo; |
| 88 | - | 95 | + this.pageAdvModel.analysisTopicAdvSource(this.topicDetail) |
| 89 | if (this.topicInfo) { | 96 | if (this.topicInfo) { |
| 90 | // 转换详情数据 | 97 | // 转换详情数据 |
| 91 | this.contentDetailData.openComment = Number(this.topicInfo.commentFlag) | 98 | this.contentDetailData.openComment = Number(this.topicInfo.commentFlag) |
| @@ -105,7 +112,6 @@ export struct SpacialTopicPageComponent { | @@ -105,7 +112,6 @@ export struct SpacialTopicPageComponent { | ||
| 105 | this.shareInfo.shareUrl = this.topicInfo.shareUrl | 112 | this.shareInfo.shareUrl = this.topicInfo.shareUrl |
| 106 | this.contentDetailData.shareInfo = this.shareInfo | 113 | this.contentDetailData.shareInfo = this.shareInfo |
| 107 | 114 | ||
| 108 | - console.log('contentDetailData111', JSON.stringify(this.contentDetailData)) | ||
| 109 | // if(this.topicInfo.shareOpen === 1){ | 115 | // if(this.topicInfo.shareOpen === 1){ |
| 110 | // if (!this.operationButtonList.includes('share')) { | 116 | // if (!this.operationButtonList.includes('share')) { |
| 111 | // this.operationButtonList.push('share'); | 117 | // this.operationButtonList.push('share'); |
| @@ -196,10 +202,112 @@ export struct SpacialTopicPageComponent { | @@ -196,10 +202,112 @@ export struct SpacialTopicPageComponent { | ||
| 196 | interactData: $interactData, | 202 | interactData: $interactData, |
| 197 | }).visibility(this.showComment ? Visibility.Visible : Visibility.Hidden) | 203 | }).visibility(this.showComment ? Visibility.Visible : Visibility.Hidden) |
| 198 | } | 204 | } |
| 205 | + | ||
| 206 | + RelativeContainer() { | ||
| 207 | + // 挂角广告 | ||
| 208 | + this.pageHornAd() | ||
| 209 | + } | ||
| 210 | + | ||
| 199 | } | 211 | } |
| 200 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 212 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 201 | } | 213 | } |
| 202 | 214 | ||
| 215 | + /** | ||
| 216 | + * 页面挂角广告 | ||
| 217 | + */ | ||
| 218 | + @Builder | ||
| 219 | + pageHornAd() { | ||
| 220 | + | ||
| 221 | + if (this.pageAdvModel.isShowAds) { | ||
| 222 | + if (this.pageAdvModel.pageCornerAdv.matInfo != null && this.pageAdvModel.pageCornerAdv.matInfo.linkType != '2') { | ||
| 223 | + // 广告中心的挂角广告 | ||
| 224 | + this.drawPageCornerAdvView(1, 1 == this.pageAdvModel.isRightAdv) | ||
| 225 | + } else if (this.pageAdvModel.pageCornerContentInfo.advert != null ) { | ||
| 226 | + // 展现中心的挂角广告业务 | ||
| 227 | + this.drawPageCornerAdvView(2, 1 == this.pageAdvModel.isRightAdv) | ||
| 228 | + } | ||
| 229 | + } | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + /** | ||
| 233 | + * 绘制页面挂角 | ||
| 234 | + * | ||
| 235 | + * @param type 1:广告中心的挂角广告;2:展现中心的挂角广告 | ||
| 236 | + * @param isRightCorne true:右挂角;false:左挂角 | ||
| 237 | + */ | ||
| 238 | + @Builder | ||
| 239 | + drawPageCornerAdvView(type: number, isRightCorne: boolean) { | ||
| 240 | + // 页面左挂角 | ||
| 241 | + Image(type === 1 ? this.pageAdvModel.pageCornerAdv.matInfo.matImageUrl[0] | ||
| 242 | + : this.pageAdvModel.pageCornerContentInfo.advert.displayUrl) | ||
| 243 | + .width($r('app.float.vp_80')) | ||
| 244 | + .height($r('app.float.vp_80')) | ||
| 245 | + .id("left_iv") | ||
| 246 | + .alignRules({ | ||
| 247 | + bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, | ||
| 248 | + left: { anchor: isRightCorne ? "" : '__container__', align: HorizontalAlign.Start }, | ||
| 249 | + right: { anchor: isRightCorne ? '__container__' : "", align: HorizontalAlign.End }, | ||
| 250 | + }) | ||
| 251 | + .margin({ | ||
| 252 | + bottom: "105vp", | ||
| 253 | + left: isRightCorne ? 0 : $r('app.float.card_comp_pagePadding_lf'), | ||
| 254 | + right: isRightCorne ? $r('app.float.card_comp_pagePadding_lf') : 0, | ||
| 255 | + | ||
| 256 | + }) | ||
| 257 | + .onClick(() => { | ||
| 258 | + if (type === 1) { | ||
| 259 | + // 广告业务跳转 | ||
| 260 | + ProcessUtils.openAdvDetail(this.pageAdvModel.pageCornerAdv.matInfo); | ||
| 261 | + } else { | ||
| 262 | + // 展现中心的业务跳转 | ||
| 263 | + ProcessUtils.advJumpMainPage(this.pageAdvModel.pageCornerContentInfo.advert) | ||
| 264 | + } | ||
| 265 | + }) | ||
| 266 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 267 | + // 关闭按钮 | ||
| 268 | + Image($r('app.media.icon_adv_horn_close')) | ||
| 269 | + .id('left_close') | ||
| 270 | + .width($r('app.float.vp_16')) | ||
| 271 | + .alignRules({ | ||
| 272 | + top: { anchor: 'left_iv', align: VerticalAlign.Top }, | ||
| 273 | + left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start }, | ||
| 274 | + right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End }, | ||
| 275 | + }) | ||
| 276 | + .offset({ | ||
| 277 | + x: isRightCorne ? 10 : -10, | ||
| 278 | + y: isRightCorne ? -10 : -10 | ||
| 279 | + }) | ||
| 280 | + .onClick(() => { | ||
| 281 | + // 关闭挂角广告 | ||
| 282 | + this.pageAdvModel.isShowAds = false; | ||
| 283 | + | ||
| 284 | + }) | ||
| 285 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 286 | + | ||
| 287 | + if (type == 1) { | ||
| 288 | + Text($r('app.string.comp_advertisement')) | ||
| 289 | + .width($r('app.float.vp_28')) | ||
| 290 | + .height($r('app.float.vp_16')) | ||
| 291 | + .fontSize($r('app.float.font_size_10')) | ||
| 292 | + .fontColor(Color.White) | ||
| 293 | + .id('left_tag') | ||
| 294 | + .alignRules({ | ||
| 295 | + bottom: { anchor: 'left_iv', align: VerticalAlign.Bottom }, | ||
| 296 | + left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start }, | ||
| 297 | + right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End }, | ||
| 298 | + }) | ||
| 299 | + .textAlign(TextAlign.Center) | ||
| 300 | + .backgroundColor($r('app.color.res_color_general_000000_30')) | ||
| 301 | + .borderRadius({ | ||
| 302 | + topLeft: $r('app.float.vp_2'), | ||
| 303 | + topRight: $r('app.float.vp_2'), | ||
| 304 | + bottomLeft: $r('app.float.vp_2'), | ||
| 305 | + bottomRight: $r('app.float.vp_2') | ||
| 306 | + }) | ||
| 307 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 308 | + } | ||
| 309 | + } | ||
| 310 | + | ||
| 203 | aboutToAppear() { | 311 | aboutToAppear() { |
| 204 | if (!this.action?.params?.backVisibility) { | 312 | if (!this.action?.params?.backVisibility) { |
| 205 | // WindowModel.shared.setWindowLayoutFullScreen(true) | 313 | // WindowModel.shared.setWindowLayoutFullScreen(true) |
| 1 | -import { PageInfoDTO } from 'wdBean/Index'; | 1 | +import { PageInfoDTO,TopicDetailData } from 'wdBean/Index'; |
| 2 | import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; | 2 | import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; |
| 3 | import { DateTimeUtils, SPHelper } from 'wdKit/Index'; | 3 | import { DateTimeUtils, SPHelper } from 'wdKit/Index'; |
| 4 | import { ArrayList } from '@kit.ArkTS'; | 4 | import { ArrayList } from '@kit.ArkTS'; |
| @@ -21,15 +21,23 @@ export default class PageAdModel { | @@ -21,15 +21,23 @@ export default class PageAdModel { | ||
| 21 | // 1:右边;2:左边 -> 默认右边 | 21 | // 1:右边;2:左边 -> 默认右边 |
| 22 | pageCornerContentInfo: AdvRuleBean = {} as AdvRuleBean | 22 | pageCornerContentInfo: AdvRuleBean = {} as AdvRuleBean |
| 23 | 23 | ||
| 24 | + | ||
| 25 | + analysisAdvSource(pageInfo: PageInfoDTO) { | ||
| 26 | + this.analysisAllAdvSource(pageInfo.hasAdInfo,pageInfo.cornersAdv,pageInfo.cornersAdv2,pageInfo.id) | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + analysisTopicAdvSource(topicDetail: TopicDetailData) { | ||
| 30 | + this.analysisAllAdvSource(topicDetail.hasAdInfo,topicDetail.cornersAdv,topicDetail.cornersAdv2,topicDetail.id) | ||
| 31 | + } | ||
| 32 | + | ||
| 24 | /** | 33 | /** |
| 25 | * 解析广告资源 | 34 | * 解析广告资源 |
| 26 | * @param pageInfo | 35 | * @param pageInfo |
| 27 | */ | 36 | */ |
| 28 | - async analysisAdvSource(pageInfo: PageInfoDTO) { | ||
| 29 | - | ||
| 30 | - if (pageInfo.hasAdInfo === 1 && pageInfo.cornersAdv != null) { | 37 | + private async analysisAllAdvSource(hasAdInfo: number,cornersAd: AdvRuleBean,cornersAd2: CompAdvBean[],id: number) { |
| 38 | + if (hasAdInfo === 1 && cornersAd != null) { | ||
| 31 | // 优先展示展现中心广告 | 39 | // 优先展示展现中心广告 |
| 32 | - let cornersAdv = pageInfo.cornersAdv | 40 | + let cornersAdv = cornersAd |
| 33 | 41 | ||
| 34 | if (cornersAdv == null) { | 42 | if (cornersAdv == null) { |
| 35 | return | 43 | return |
| @@ -50,9 +58,9 @@ export default class PageAdModel { | @@ -50,9 +58,9 @@ export default class PageAdModel { | ||
| 50 | this.pageCornerContentInfo = cornersAdv; | 58 | this.pageCornerContentInfo = cornersAdv; |
| 51 | this.isShowAds = true | 59 | this.isShowAds = true |
| 52 | 60 | ||
| 53 | - } else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) { | 61 | + } else if (cornersAd2 != null && cornersAd2.length > 0) { |
| 54 | // 广告中心-挂角广告信息 | 62 | // 广告中心-挂角广告信息 |
| 55 | - let cornersAdv2 = pageInfo.cornersAdv2 | 63 | + let cornersAdv2 = cornersAd2 |
| 56 | 64 | ||
| 57 | if (cornersAdv2.length == 0) { | 65 | if (cornersAdv2.length == 0) { |
| 58 | return | 66 | return |
| @@ -61,7 +69,7 @@ export default class PageAdModel { | @@ -61,7 +69,7 @@ export default class PageAdModel { | ||
| 61 | let pageCoreAdvArray = this.treatPageInfoAdsData(cornersAdv2); | 69 | let pageCoreAdvArray = this.treatPageInfoAdsData(cornersAdv2); |
| 62 | 70 | ||
| 63 | let advLength = pageCoreAdvArray.length; | 71 | let advLength = pageCoreAdvArray.length; |
| 64 | - let pageId = pageInfo.id.toString(); | 72 | + let pageId = id.toString(); |
| 65 | let a = 0; | 73 | let a = 0; |
| 66 | if (advLength > 1) { | 74 | if (advLength > 1) { |
| 67 | a = await this.calPageAdvIndex(pageId,advLength) | 75 | a = await this.calPageAdvIndex(pageId,advLength) |
| @@ -86,8 +94,8 @@ export default class PageAdModel { | @@ -86,8 +94,8 @@ export default class PageAdModel { | ||
| 86 | this.pageCornerAdv = showCompAdvBean | 94 | this.pageCornerAdv = showCompAdvBean |
| 87 | this.isShowAds = true | 95 | this.isShowAds = true |
| 88 | } | 96 | } |
| 89 | - | ||
| 90 | } | 97 | } |
| 98 | + | ||
| 91 | /** | 99 | /** |
| 92 | * 计算投放广告的序列号 | 100 | * 计算投放广告的序列号 |
| 93 | * @param pageId | 101 | * @param pageId |
| @@ -24,7 +24,7 @@ export class LaunchPageModel { | @@ -24,7 +24,7 @@ export class LaunchPageModel { | ||
| 24 | success(data.data); | 24 | success(data.data); |
| 25 | //存储数据 | 25 | //存储数据 |
| 26 | let obj : string = JSON.stringify(data.data) | 26 | let obj : string = JSON.stringify(data.data) |
| 27 | - console.log(obj) | 27 | + console.log('LaunchPageModel获取启动相关数据',obj) |
| 28 | SPHelper.default.saveSync(SpConstants.APP_LAUNCH_PAGE_DATA_MODEL,obj) | 28 | SPHelper.default.saveSync(SpConstants.APP_LAUNCH_PAGE_DATA_MODEL,obj) |
| 29 | 29 | ||
| 30 | }, (error: Error) => { | 30 | }, (error: Error) => { |
-
Please register or login to post a comment