liyubing

feat(广告): 冠名广告、视频广告、长通栏广告 和 顶部长通栏广告 大图卡 投放逻辑

... ... @@ -25,6 +25,7 @@ import { Card2Component } from './cardview/Card2Component';
import { Card5Component } from './cardview/Card5Component';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
import PageModel from '../viewmodel/PageModel';
/**
* comp适配器.
... ... @@ -34,7 +35,9 @@ import { AdvCardParser } from './cardViewAdv/AdvCardParser';
@Component
export struct CompParser {
@State compDTO: CompDTO = {} as CompDTO
compIndex: number = 0;
@State private pageModel: PageModel = new PageModel();
@State compIndex: number = 0;
build() {
Column() {
... ... @@ -100,7 +103,8 @@ export struct CompParser {
ZhSingleColumn09({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({compDTO})
AdvCardParser({pageModel:this.pageModel,compDTO,compIndex})
//Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
CardParser({ contentDTO: compDTO.operDataList[0] });
... ...
... ... @@ -7,6 +7,7 @@ import { CardAdvBigImageComponent } from './CardAdvBigImageComponent';
import { CardAdvVideoComponent } from './CardAdvVideoComponent';
import { CardAdvGanMiComponent } from './CardAdvGanMiComponent';
import { CardAdvVideoExComponent } from './CardAdvVideoExComponent';
import PageModel from '../../viewmodel/PageModel';
/**
* @Description: 广告稿件解析类
... ... @@ -19,28 +20,30 @@ import { CardAdvVideoExComponent } from './CardAdvVideoExComponent';
@Component
export struct AdvCardParser {
@State compDTO: CompDTO = {} as CompDTO;
pageModel: PageModel = new PageModel();
@State compIndex: number = 0;
build() {
this.contentBuilder(this.compDTO);
this.contentBuilder(this.pageModel, this.compDTO, this.compIndex);
}
@Builder
contentBuilder(compDTO: CompDTO) {
contentBuilder(pageModel: PageModel, compDTO: CompDTO, compIndex: number) {
if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_5) { //三图广告
CardAdvThreeImageComponent({ compDTO })
CardAdvThreeImageComponent({ pageModel, compDTO, compIndex })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_6) { //小图广告
CardAdvSmallImageComponent({ compDTO })
CardAdvSmallImageComponent({ pageModel, compDTO, compIndex })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_7 ||
compDTO.matInfo.advSubType === CompStyle.Card_Adv_12) { // 长通栏广告 和 顶部长通栏广告
CardAdvLongImageComponent({ compDTO })
CardAdvLongImageComponent({ pageModel, compDTO, compIndex })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_8) { //大图广告
CardAdvBigImageComponent({ compDTO })
CardAdvBigImageComponent({ pageModel, compDTO, compIndex })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_9) { //视频广告
CardAdvVideoComponent({ compDTO })
CardAdvVideoComponent({ pageModel, compDTO, compIndex })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_10) { //展会广告
CardAdvVideoExComponent({ compDTO })
CardAdvVideoExComponent({ pageModel, compDTO, compIndex })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_11) { //冠名广告
CardAdvGanMiComponent({ compDTO })
CardAdvGanMiComponent({ pageModel, compDTO, compIndex })
}
}
}
\ No newline at end of file
... ...
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ... @@ -16,12 +17,10 @@ const TAG: string = 'Card2Component';
@Component
export struct CardAdvBigImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State compIndex: number = 0;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
}
aboutToDisappear(): void {
... ... @@ -43,7 +42,7 @@ export struct CardAdvBigImageComponent {
.borderColor($r('app.color.color_0D000000'))
.width(CommonConstants.FULL_WIDTH)
CardAdvBottom().margin({
CardAdvBottom({pageModel:this.pageModel,compIndex:this.compIndex}).margin({
top: 8,
})
}
... ...
import { CompDTO } from 'wdBean/Index';
import PageModel from '../../viewmodel/PageModel';
/**
* @Description: 广告稿件 底部标签+删除按钮
... ... @@ -10,7 +10,9 @@ import { CompDTO } from 'wdBean/Index';
*/
@Component
export struct CardAdvBottom {
@State compDTO: CompDTO = {} as CompDTO;
pageModel: PageModel = new PageModel();
@State compIndex: number = 0;
build() {
... ... @@ -36,6 +38,11 @@ export struct CardAdvBottom {
.borderColor($r('app.color.color_EDEDED'))
.borderRadius(4)
}.width('100%')
}.width('100%').onClick(() => {
if (this.pageModel) {
// this.pageModel.compList.deleteItem(this.compIndex)
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -4,8 +4,10 @@ import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/Adv
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvTop } from './CardAdvTop';
const TAG: string = 'Card2Component';
... ... @@ -22,6 +24,8 @@ export struct CardAdvGanMiComponent {
@State compDTO: CompDTO = {} as CompDTO
@State advExtraData: AdvExtraData = {} as AdvExtraData
@State advLength: number = 0;
@State compIndex: number = 0;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
... ... @@ -53,41 +57,7 @@ export struct CardAdvGanMiComponent {
.borderColor($r('app.color.color_0D000000'))
// 广告标签和删除功能
Row() {
Text($r('app.string.comp_advertisement'))
.fontSize('10fp')
.fontColor($r('app.color.white'))
.width(28)
.height(16)
.backgroundColor('#4D000000')
.borderRadius(3)
.textAlign(TextAlign.Center)
Blank()
Stack() {
Image($r('app.media.comp_adv_close_white'))
.width(9)
.height(9)
.borderRadius({
topLeft: '4vp',
topRight: '4vp',
bottomLeft: '4vp',
bottomRight: '4vp'
})
}
.width(18)
.height(14)
.backgroundColor('#4D000000')
.borderWidth(0.5)
.borderColor($r('app.color.white'))
.borderRadius(3)
}.width('100%').padding({
top: 8,
left: 8,
right: 8
})
CardAdvTop({ pageModel: this.pageModel, compIndex: this.compIndex })
}
.alignContent(Alignment.Top)
.width(CommonConstants.FULL_WIDTH)
... ... @@ -100,7 +70,7 @@ export struct CardAdvGanMiComponent {
//
List({ space: 8 }) {
ForEach(this.advExtraData.item, (content: AdvExtraItemData) => {
ForEach(this.advExtraData.item, (content: AdvExtraItemData, index: number) => {
ListItem() {
// 广告列表信息
... ... @@ -123,7 +93,10 @@ export struct CardAdvGanMiComponent {
.width('100%')
.margin({ top: 8 })
}.width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%').onClick(() => {
}
.width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%')
.margin({ left: index === 0 ? this.advLength == 1 ? 0 : 16 : 0 })
.onClick(() => {
let matInfo: CompAdvMatInfoBean = {
linkUrl: content.linkUrl,
... ... @@ -142,7 +115,7 @@ export struct CardAdvGanMiComponent {
.listDirection(Axis.Horizontal)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.contentStartOffset(this.advLength == 1 ? 0 : 16)
// .contentStartOffset(this.advLength == 1 ? 0 : 16)
.contentEndOffset(this.advLength == 1 ? 0 : 16)
.margin({ top: 10, bottom: 10 })
.padding({
... ... @@ -150,7 +123,6 @@ export struct CardAdvGanMiComponent {
right: this.advLength == 1 ? 16 : 0,
})
// 更多按钮
commonButton(this.advExtraData)
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import PageModel from '../../viewmodel/PageModel';
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ... @@ -18,15 +17,12 @@ const TAG: string = 'Card2Component';
*/
@Component
export struct CardAdvLongImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State haveTitle : boolean = true
@State haveTitle: boolean = true
@State compIndex: number = 0;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
this.haveTitle = this.compDTO.matInfo.advSubType === CompStyle.Card_Adv_7;
}
... ... @@ -37,12 +33,10 @@ export struct CardAdvLongImageComponent {
build() {
Column() {
//新闻标题
if(this.haveTitle ){
if (this.haveTitle) {
Text(this.compDTO.matInfo.advTitle).width('100%').bottomTextStyle().margin({ bottom: 8, })
}
//长图
Image(this.compDTO.matInfo.matImageUrl[0])
.width(CommonConstants.FULL_WIDTH)
... ... @@ -51,7 +45,7 @@ export struct CardAdvLongImageComponent {
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
CardAdvBottom().margin({
CardAdvBottom({ pageModel: this.pageModel, compIndex: this.compIndex }).margin({
top: 8,
})
}
... ...
... ... @@ -5,6 +5,7 @@ import { ProcessUtils } from 'wdRouter';
import measure from '@ohos.measure';
import { DisplayUtils } from 'wdKit/Index';
import { CardAdvBottom } from './CardAdvBottom';
import PageModel from '../../viewmodel/PageModel';
const TAG: string = 'CardAdvSmallImageComponent';
... ... @@ -20,7 +21,8 @@ const TAG: string = 'CardAdvSmallImageComponent';
export struct CardAdvSmallImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true
@State compIndex: number = 0;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
// 计算标题文本行数
... ... @@ -68,7 +70,7 @@ export struct CardAdvSmallImageComponent {
.margin({ left: 12 })
CardAdvBottom().width('62%').id('bottom_adv').alignRules({
CardAdvBottom({pageModel:this.pageModel,compIndex:this.compIndex}).width('62%').id('bottom_adv').alignRules({
bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom },
right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start },
top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom },
... ...
... ... @@ -2,6 +2,7 @@
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
... ... @@ -19,7 +20,8 @@ const TAG: string = 'Card2Component';
@Component
export struct CardAdvThreeImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State compIndex: number = 0;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
}
... ... @@ -63,7 +65,7 @@ export struct CardAdvThreeImageComponent {
.margin({ top: 8 })
// 广告工具组件
CardAdvBottom().width('100%').margin({ top: 8 })
CardAdvBottom({pageModel:this.pageModel,compIndex:this.compIndex}).width('100%').margin({ top: 8 })
}
.width('100%')
.justifyContent(FlexAlign.Start)
... ...
import PageModel from '../../viewmodel/PageModel';
/**
* @Description: 广告稿件 顶部标签+删除按钮
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvTop {
@State compIndex: number = 0;
pageModel: PageModel = new PageModel();
build() {
Row() {
Text($r('app.string.comp_advertisement'))
.fontSize('10fp')
.fontColor($r('app.color.white'))
.width(28)
.height(16)
.backgroundColor('#4D000000')
.borderRadius(4)
.textAlign(TextAlign.Center)
Blank()
Stack() {
Image($r('app.media.comp_adv_close_white'))
.width(9)
.height(9)
.borderRadius({
topLeft: '4vp',
topRight: '4vp',
bottomLeft: '4vp',
bottomRight: '4vp'
})
}
.width(18)
.height(14)
.backgroundColor('#4D000000')
.borderWidth(0.5)
.borderColor($r('app.color.white'))
.borderRadius(4)
}.width('100%').padding({
top: 8,
left: 8,
right: 8
}).onClick(() => {
if (this.pageModel) {
this.pageModel.compList.deleteItem(this.compIndex)
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@
import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
... ... @@ -20,7 +21,8 @@ const TAG: string = 'Card2Component';
export struct CardAdvVideoComponent {
@State compDTO: CompDTO = {} as CompDTO
@State contentDTO: ContentDTO = {} as ContentDTO
@State compIndex: number = 0;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
// this.contentDTO.objectType = '1'
... ... @@ -54,7 +56,7 @@ export struct CardAdvVideoComponent {
.width(CommonConstants.FULL_WIDTH)
.margin({ top: 8 })
CardAdvBottom().margin({
CardAdvBottom({pageModel:this.pageModel,compIndex:this.compIndex}).margin({
top: 8,
})
}
... ...
... ... @@ -3,6 +3,8 @@ import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/Adv
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardAdvTop } from './CardAdvTop';
const TAG: string = 'Card2Component';
... ... @@ -18,6 +20,8 @@ const TAG: string = 'Card2Component';
export struct CardAdvVideoExComponent {
@State compDTO: CompDTO = {} as CompDTO
@State advExtraData: AdvExtraData = {} as AdvExtraData
@State compIndex: number = 0;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
... ... @@ -45,42 +49,7 @@ export struct CardAdvVideoExComponent {
.borderColor($r('app.color.color_0D000000'))
Row() {
Text($r('app.string.comp_advertisement'))
.fontSize('10fp')
.fontColor($r('app.color.white'))
.width(28)
.height(16)
.backgroundColor('#4D000000')
.borderRadius(4)
.textAlign(TextAlign.Center)
Blank()
Stack() {
Image($r('app.media.comp_adv_close_white'))
.width(9)
.height(9)
.borderRadius({
topLeft: '4vp',
topRight: '4vp',
bottomLeft: '4vp',
bottomRight: '4vp'
})
}
.width(18)
.height(14)
.backgroundColor('#4D000000')
.borderWidth(0.5)
.borderColor($r('app.color.white'))
.borderRadius(4)
}.width('100%').padding({
top: 8,
left: 8,
right: 8
})
CardAdvTop({ pageModel: this.pageModel, compIndex: this.compIndex })
}
.alignContent(Alignment.Top)
.width(CommonConstants.FULL_WIDTH)
... ...
import { ViewType } from 'wdConstant/Index'
import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index'
import { commentItemModel, commentListModel } from '../model/CommentModel'
import { commentItemModel } from '../model/CommentModel'
import commentViewModel from '../viewmodel/CommentViewModel'
import { router, window } from '@kit.ArkUI'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
import { MyCommentDataSource } from '../model/MyCommentDataSource'
import { HttpUrlUtils, HttpUtils } from 'wdNetwork/Index'
import PageModel from '../../../viewmodel/PageModel'
import { HttpUtils } from 'wdNetwork/Index'
import { ErrorComponent } from '../../view/ErrorComponent'
import { EmptyComponent , WDViewDefaultType} from '../../view/EmptyComponent'
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'
import { EmptyComponent, WDViewDefaultType } from '../../view/EmptyComponent'
import NoMoreLayout from '../../page/NoMoreLayout'
import { CommentCustomDialog } from './CommentCustomDialog'
import { publishCommentModel } from '../model/PublishCommentModel'
import { ifaa } from '@kit.OnlineAuthenticationKit'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
const TAG = 'QualityCommentsComponent';
... ...
... ... @@ -74,7 +74,7 @@ export struct PageComponent {
LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
CompParser({ compDTO: compDTO, compIndex: compIndex });
CompParser({ pageModel: this.pageModel, compDTO: compDTO, compIndex: compIndex });
}
}
},
... ...
... ... @@ -116,7 +116,6 @@ export class PageHelper {
//移除音频 和 活动
this.collectPageComp(pageModel, pageDto)
// pageModel.compList.push(...pageDto.compList)
// TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上)
... ... @@ -161,10 +160,8 @@ export class PageHelper {
flag = false
}
let pageCompSize = pageCompList.length // 信息流组件业务数量
// console.error("ZZZXXXXX", " start--->" + pageCompSize);
if (pageCompSize == 0) {
flag = false
}
... ... @@ -263,7 +260,7 @@ export class PageHelper {
if (advPosition <= pageModel.pageTotalCompSize && advPosition >= a) {
let b = advPosition - a;
console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b)
// console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b)
if (b <= pageCompSize && b >= 0) {
let advComp: CompDTO = {
... ... @@ -281,11 +278,9 @@ export class PageHelper {
}
}
}
}
}
}
}
... ...