liyubing

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

@@ -25,6 +25,7 @@ import { Card2Component } from './cardview/Card2Component'; @@ -25,6 +25,7 @@ import { Card2Component } from './cardview/Card2Component';
25 import { Card5Component } from './cardview/Card5Component'; 25 import { Card5Component } from './cardview/Card5Component';
26 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 26 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
27 import { AdvCardParser } from './cardViewAdv/AdvCardParser'; 27 import { AdvCardParser } from './cardViewAdv/AdvCardParser';
  28 +import PageModel from '../viewmodel/PageModel';
28 29
29 /** 30 /**
30 * comp适配器. 31 * comp适配器.
@@ -34,7 +35,9 @@ import { AdvCardParser } from './cardViewAdv/AdvCardParser'; @@ -34,7 +35,9 @@ import { AdvCardParser } from './cardViewAdv/AdvCardParser';
34 @Component 35 @Component
35 export struct CompParser { 36 export struct CompParser {
36 @State compDTO: CompDTO = {} as CompDTO 37 @State compDTO: CompDTO = {} as CompDTO
37 - compIndex: number = 0; 38 +
  39 + @State private pageModel: PageModel = new PageModel();
  40 + @State compIndex: number = 0;
38 41
39 build() { 42 build() {
40 Column() { 43 Column() {
@@ -100,7 +103,8 @@ export struct CompParser { @@ -100,7 +103,8 @@ export struct CompParser {
100 ZhSingleColumn09({ compDTO }) 103 ZhSingleColumn09({ compDTO })
101 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) 104 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
102 } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 105 } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
103 - AdvCardParser({compDTO}) 106 + AdvCardParser({pageModel:this.pageModel,compDTO,compIndex})
  107 + //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 })
104 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) 108 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
105 } else if (!Number.isNaN(Number(compDTO.compStyle))) { 109 } else if (!Number.isNaN(Number(compDTO.compStyle))) {
106 CardParser({ contentDTO: compDTO.operDataList[0] }); 110 CardParser({ contentDTO: compDTO.operDataList[0] });
@@ -7,6 +7,7 @@ import { CardAdvBigImageComponent } from './CardAdvBigImageComponent'; @@ -7,6 +7,7 @@ import { CardAdvBigImageComponent } from './CardAdvBigImageComponent';
7 import { CardAdvVideoComponent } from './CardAdvVideoComponent'; 7 import { CardAdvVideoComponent } from './CardAdvVideoComponent';
8 import { CardAdvGanMiComponent } from './CardAdvGanMiComponent'; 8 import { CardAdvGanMiComponent } from './CardAdvGanMiComponent';
9 import { CardAdvVideoExComponent } from './CardAdvVideoExComponent'; 9 import { CardAdvVideoExComponent } from './CardAdvVideoExComponent';
  10 +import PageModel from '../../viewmodel/PageModel';
10 11
11 /** 12 /**
12 * @Description: 广告稿件解析类 13 * @Description: 广告稿件解析类
@@ -19,28 +20,30 @@ import { CardAdvVideoExComponent } from './CardAdvVideoExComponent'; @@ -19,28 +20,30 @@ import { CardAdvVideoExComponent } from './CardAdvVideoExComponent';
19 @Component 20 @Component
20 export struct AdvCardParser { 21 export struct AdvCardParser {
21 @State compDTO: CompDTO = {} as CompDTO; 22 @State compDTO: CompDTO = {} as CompDTO;
  23 + pageModel: PageModel = new PageModel();
  24 + @State compIndex: number = 0;
22 25
23 build() { 26 build() {
24 - this.contentBuilder(this.compDTO); 27 + this.contentBuilder(this.pageModel, this.compDTO, this.compIndex);
25 } 28 }
26 29
27 @Builder 30 @Builder
28 - contentBuilder(compDTO: CompDTO) { 31 + contentBuilder(pageModel: PageModel, compDTO: CompDTO, compIndex: number) {
29 if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_5) { //三图广告 32 if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_5) { //三图广告
30 - CardAdvThreeImageComponent({ compDTO }) 33 + CardAdvThreeImageComponent({ pageModel, compDTO, compIndex })
31 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_6) { //小图广告 34 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_6) { //小图广告
32 - CardAdvSmallImageComponent({ compDTO }) 35 + CardAdvSmallImageComponent({ pageModel, compDTO, compIndex })
33 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_7 || 36 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_7 ||
34 compDTO.matInfo.advSubType === CompStyle.Card_Adv_12) { // 长通栏广告 和 顶部长通栏广告 37 compDTO.matInfo.advSubType === CompStyle.Card_Adv_12) { // 长通栏广告 和 顶部长通栏广告
35 - CardAdvLongImageComponent({ compDTO }) 38 + CardAdvLongImageComponent({ pageModel, compDTO, compIndex })
36 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_8) { //大图广告 39 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_8) { //大图广告
37 - CardAdvBigImageComponent({ compDTO }) 40 + CardAdvBigImageComponent({ pageModel, compDTO, compIndex })
38 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_9) { //视频广告 41 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_9) { //视频广告
39 - CardAdvVideoComponent({ compDTO }) 42 + CardAdvVideoComponent({ pageModel, compDTO, compIndex })
40 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_10) { //展会广告 43 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_10) { //展会广告
41 - CardAdvVideoExComponent({ compDTO }) 44 + CardAdvVideoExComponent({ pageModel, compDTO, compIndex })
42 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_11) { //冠名广告 45 } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_11) { //冠名广告
43 - CardAdvGanMiComponent({ compDTO }) 46 + CardAdvGanMiComponent({ pageModel, compDTO, compIndex })
44 } 47 }
45 } 48 }
46 } 49 }
1 import { CompDTO } from 'wdBean'; 1 import { CompDTO } from 'wdBean';
2 import { CommonConstants } from 'wdConstant/Index'; 2 import { CommonConstants } from 'wdConstant/Index';
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
  4 +import PageModel from '../../viewmodel/PageModel';
4 import { CardAdvBottom } from './CardAdvBottom'; 5 import { CardAdvBottom } from './CardAdvBottom';
5 6
6 const TAG: string = 'Card2Component'; 7 const TAG: string = 'Card2Component';
@@ -16,12 +17,10 @@ const TAG: string = 'Card2Component'; @@ -16,12 +17,10 @@ const TAG: string = 'Card2Component';
16 @Component 17 @Component
17 export struct CardAdvBigImageComponent { 18 export struct CardAdvBigImageComponent {
18 @State compDTO: CompDTO = {} as CompDTO 19 @State compDTO: CompDTO = {} as CompDTO
19 -  
20 - 20 + @State compIndex: number = 0;
  21 + pageModel: PageModel = new PageModel();
21 aboutToAppear(): void { 22 aboutToAppear(): void {
22 23
23 -  
24 -  
25 } 24 }
26 25
27 aboutToDisappear(): void { 26 aboutToDisappear(): void {
@@ -43,7 +42,7 @@ export struct CardAdvBigImageComponent { @@ -43,7 +42,7 @@ export struct CardAdvBigImageComponent {
43 .borderColor($r('app.color.color_0D000000')) 42 .borderColor($r('app.color.color_0D000000'))
44 .width(CommonConstants.FULL_WIDTH) 43 .width(CommonConstants.FULL_WIDTH)
45 44
46 - CardAdvBottom().margin({ 45 + CardAdvBottom({pageModel:this.pageModel,compIndex:this.compIndex}).margin({
47 top: 8, 46 top: 8,
48 }) 47 })
49 } 48 }
1 -import { CompDTO } from 'wdBean/Index'; 1 +import PageModel from '../../viewmodel/PageModel';
2 2
3 /** 3 /**
4 * @Description: 广告稿件 底部标签+删除按钮 4 * @Description: 广告稿件 底部标签+删除按钮
@@ -10,7 +10,9 @@ import { CompDTO } from 'wdBean/Index'; @@ -10,7 +10,9 @@ import { CompDTO } from 'wdBean/Index';
10 */ 10 */
11 @Component 11 @Component
12 export struct CardAdvBottom { 12 export struct CardAdvBottom {
13 - @State compDTO: CompDTO = {} as CompDTO; 13 +
  14 + pageModel: PageModel = new PageModel();
  15 + @State compIndex: number = 0;
14 16
15 build() { 17 build() {
16 18
@@ -36,6 +38,11 @@ export struct CardAdvBottom { @@ -36,6 +38,11 @@ export struct CardAdvBottom {
36 .borderColor($r('app.color.color_EDEDED')) 38 .borderColor($r('app.color.color_EDEDED'))
37 .borderRadius(4) 39 .borderRadius(4)
38 40
39 - }.width('100%') 41 + }.width('100%').onClick(() => {
  42 +
  43 + if (this.pageModel) {
  44 + // this.pageModel.compList.deleteItem(this.compIndex)
  45 + }
  46 + })
40 } 47 }
41 } 48 }
@@ -4,8 +4,10 @@ import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/Adv @@ -4,8 +4,10 @@ import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/Adv
4 import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; 4 import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
5 import { CommonConstants } from 'wdConstant/Index'; 5 import { CommonConstants } from 'wdConstant/Index';
6 import { ProcessUtils } from 'wdRouter'; 6 import { ProcessUtils } from 'wdRouter';
  7 +import PageModel from '../../viewmodel/PageModel';
7 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 8 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
8 import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 9 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  10 +import { CardAdvTop } from './CardAdvTop';
9 11
10 const TAG: string = 'Card2Component'; 12 const TAG: string = 'Card2Component';
11 13
@@ -22,6 +24,8 @@ export struct CardAdvGanMiComponent { @@ -22,6 +24,8 @@ export struct CardAdvGanMiComponent {
22 @State compDTO: CompDTO = {} as CompDTO 24 @State compDTO: CompDTO = {} as CompDTO
23 @State advExtraData: AdvExtraData = {} as AdvExtraData 25 @State advExtraData: AdvExtraData = {} as AdvExtraData
24 @State advLength: number = 0; 26 @State advLength: number = 0;
  27 + @State compIndex: number = 0;
  28 + pageModel: PageModel = new PageModel();
25 29
26 aboutToAppear(): void { 30 aboutToAppear(): void {
27 31
@@ -53,41 +57,7 @@ export struct CardAdvGanMiComponent { @@ -53,41 +57,7 @@ export struct CardAdvGanMiComponent {
53 .borderColor($r('app.color.color_0D000000')) 57 .borderColor($r('app.color.color_0D000000'))
54 58
55 // 广告标签和删除功能 59 // 广告标签和删除功能
56 - Row() {  
57 - Text($r('app.string.comp_advertisement'))  
58 - .fontSize('10fp')  
59 - .fontColor($r('app.color.white'))  
60 - .width(28)  
61 - .height(16)  
62 - .backgroundColor('#4D000000')  
63 - .borderRadius(3)  
64 - .textAlign(TextAlign.Center)  
65 -  
66 - Blank()  
67 -  
68 - Stack() {  
69 - Image($r('app.media.comp_adv_close_white'))  
70 - .width(9)  
71 - .height(9)  
72 - .borderRadius({  
73 - topLeft: '4vp',  
74 - topRight: '4vp',  
75 - bottomLeft: '4vp',  
76 - bottomRight: '4vp'  
77 - })  
78 - }  
79 - .width(18)  
80 - .height(14)  
81 - .backgroundColor('#4D000000')  
82 - .borderWidth(0.5)  
83 - .borderColor($r('app.color.white'))  
84 - .borderRadius(3)  
85 -  
86 - }.width('100%').padding({  
87 - top: 8,  
88 - left: 8,  
89 - right: 8  
90 - }) 60 + CardAdvTop({ pageModel: this.pageModel, compIndex: this.compIndex })
91 } 61 }
92 .alignContent(Alignment.Top) 62 .alignContent(Alignment.Top)
93 .width(CommonConstants.FULL_WIDTH) 63 .width(CommonConstants.FULL_WIDTH)
@@ -100,7 +70,7 @@ export struct CardAdvGanMiComponent { @@ -100,7 +70,7 @@ export struct CardAdvGanMiComponent {
100 // 70 //
101 List({ space: 8 }) { 71 List({ space: 8 }) {
102 72
103 - ForEach(this.advExtraData.item, (content: AdvExtraItemData) => { 73 + ForEach(this.advExtraData.item, (content: AdvExtraItemData, index: number) => {
104 74
105 ListItem() { 75 ListItem() {
106 // 广告列表信息 76 // 广告列表信息
@@ -123,7 +93,10 @@ export struct CardAdvGanMiComponent { @@ -123,7 +93,10 @@ export struct CardAdvGanMiComponent {
123 .width('100%') 93 .width('100%')
124 .margin({ top: 8 }) 94 .margin({ top: 8 })
125 95
126 - }.width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%').onClick(() => { 96 + }
  97 + .width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%')
  98 + .margin({ left: index === 0 ? this.advLength == 1 ? 0 : 16 : 0 })
  99 + .onClick(() => {
127 100
128 let matInfo: CompAdvMatInfoBean = { 101 let matInfo: CompAdvMatInfoBean = {
129 linkUrl: content.linkUrl, 102 linkUrl: content.linkUrl,
@@ -142,7 +115,7 @@ export struct CardAdvGanMiComponent { @@ -142,7 +115,7 @@ export struct CardAdvGanMiComponent {
142 .listDirection(Axis.Horizontal) 115 .listDirection(Axis.Horizontal)
143 .edgeEffect(EdgeEffect.None) 116 .edgeEffect(EdgeEffect.None)
144 .scrollBar(BarState.Off) 117 .scrollBar(BarState.Off)
145 - .contentStartOffset(this.advLength == 1 ? 0 : 16) 118 + // .contentStartOffset(this.advLength == 1 ? 0 : 16)
146 .contentEndOffset(this.advLength == 1 ? 0 : 16) 119 .contentEndOffset(this.advLength == 1 ? 0 : 16)
147 .margin({ top: 10, bottom: 10 }) 120 .margin({ top: 10, bottom: 10 })
148 .padding({ 121 .padding({
@@ -150,7 +123,6 @@ export struct CardAdvGanMiComponent { @@ -150,7 +123,6 @@ export struct CardAdvGanMiComponent {
150 right: this.advLength == 1 ? 16 : 0, 123 right: this.advLength == 1 ? 16 : 0,
151 }) 124 })
152 125
153 -  
154 // 更多按钮 126 // 更多按钮
155 commonButton(this.advExtraData) 127 commonButton(this.advExtraData)
156 128
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 -import { CompDTO, ContentDTO } from 'wdBean'; 2 +import { CompDTO } from 'wdBean';
3 import { CommonConstants, CompStyle } from 'wdConstant/Index'; 3 import { CommonConstants, CompStyle } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 5 +import PageModel from '../../viewmodel/PageModel';
7 import { CardAdvBottom } from './CardAdvBottom'; 6 import { CardAdvBottom } from './CardAdvBottom';
8 7
9 const TAG: string = 'Card2Component'; 8 const TAG: string = 'Card2Component';
@@ -18,15 +17,12 @@ const TAG: string = 'Card2Component'; @@ -18,15 +17,12 @@ const TAG: string = 'Card2Component';
18 */ 17 */
19 @Component 18 @Component
20 export struct CardAdvLongImageComponent { 19 export struct CardAdvLongImageComponent {
21 -  
22 -  
23 @State compDTO: CompDTO = {} as CompDTO 20 @State compDTO: CompDTO = {} as CompDTO
24 -  
25 - @State haveTitle : boolean = true 21 + @State haveTitle: boolean = true
  22 + @State compIndex: number = 0;
  23 + pageModel: PageModel = new PageModel();
26 24
27 aboutToAppear(): void { 25 aboutToAppear(): void {
28 -  
29 -  
30 this.haveTitle = this.compDTO.matInfo.advSubType === CompStyle.Card_Adv_7; 26 this.haveTitle = this.compDTO.matInfo.advSubType === CompStyle.Card_Adv_7;
31 } 27 }
32 28
@@ -37,12 +33,10 @@ export struct CardAdvLongImageComponent { @@ -37,12 +33,10 @@ export struct CardAdvLongImageComponent {
37 build() { 33 build() {
38 34
39 Column() { 35 Column() {
40 -  
41 //新闻标题 36 //新闻标题
42 - if(this.haveTitle ){ 37 + if (this.haveTitle) {
43 Text(this.compDTO.matInfo.advTitle).width('100%').bottomTextStyle().margin({ bottom: 8, }) 38 Text(this.compDTO.matInfo.advTitle).width('100%').bottomTextStyle().margin({ bottom: 8, })
44 } 39 }
45 -  
46 //长图 40 //长图
47 Image(this.compDTO.matInfo.matImageUrl[0]) 41 Image(this.compDTO.matInfo.matImageUrl[0])
48 .width(CommonConstants.FULL_WIDTH) 42 .width(CommonConstants.FULL_WIDTH)
@@ -51,7 +45,7 @@ export struct CardAdvLongImageComponent { @@ -51,7 +45,7 @@ export struct CardAdvLongImageComponent {
51 .borderWidth(0.5) 45 .borderWidth(0.5)
52 .borderColor($r('app.color.color_0D000000')) 46 .borderColor($r('app.color.color_0D000000'))
53 47
54 - CardAdvBottom().margin({ 48 + CardAdvBottom({ pageModel: this.pageModel, compIndex: this.compIndex }).margin({
55 top: 8, 49 top: 8,
56 }) 50 })
57 } 51 }
@@ -5,6 +5,7 @@ import { ProcessUtils } from 'wdRouter'; @@ -5,6 +5,7 @@ import { ProcessUtils } from 'wdRouter';
5 import measure from '@ohos.measure'; 5 import measure from '@ohos.measure';
6 import { DisplayUtils } from 'wdKit/Index'; 6 import { DisplayUtils } from 'wdKit/Index';
7 import { CardAdvBottom } from './CardAdvBottom'; 7 import { CardAdvBottom } from './CardAdvBottom';
  8 +import PageModel from '../../viewmodel/PageModel';
8 9
9 const TAG: string = 'CardAdvSmallImageComponent'; 10 const TAG: string = 'CardAdvSmallImageComponent';
10 11
@@ -20,7 +21,8 @@ const TAG: string = 'CardAdvSmallImageComponent'; @@ -20,7 +21,8 @@ const TAG: string = 'CardAdvSmallImageComponent';
20 export struct CardAdvSmallImageComponent { 21 export struct CardAdvSmallImageComponent {
21 @State compDTO: CompDTO = {} as CompDTO 22 @State compDTO: CompDTO = {} as CompDTO
22 @State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true 23 @State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true
23 - 24 + @State compIndex: number = 0;
  25 + pageModel: PageModel = new PageModel();
24 aboutToAppear(): void { 26 aboutToAppear(): void {
25 27
26 // 计算标题文本行数 28 // 计算标题文本行数
@@ -68,7 +70,7 @@ export struct CardAdvSmallImageComponent { @@ -68,7 +70,7 @@ export struct CardAdvSmallImageComponent {
68 .margin({ left: 12 }) 70 .margin({ left: 12 })
69 71
70 72
71 - CardAdvBottom().width('62%').id('bottom_adv').alignRules({ 73 + CardAdvBottom({pageModel:this.pageModel,compIndex:this.compIndex}).width('62%').id('bottom_adv').alignRules({
72 bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom }, 74 bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom },
73 right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start }, 75 right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start },
74 top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom }, 76 top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom },
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 import { CompDTO, ContentDTO } from 'wdBean'; 2 import { CompDTO, ContentDTO } from 'wdBean';
3 import { CommonConstants } from 'wdConstant/Index'; 3 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
  5 +import PageModel from '../../viewmodel/PageModel';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 7 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
7 import { CardAdvBottom } from './CardAdvBottom'; 8 import { CardAdvBottom } from './CardAdvBottom';
@@ -19,7 +20,8 @@ const TAG: string = 'Card2Component'; @@ -19,7 +20,8 @@ const TAG: string = 'Card2Component';
19 @Component 20 @Component
20 export struct CardAdvThreeImageComponent { 21 export struct CardAdvThreeImageComponent {
21 @State compDTO: CompDTO = {} as CompDTO 22 @State compDTO: CompDTO = {} as CompDTO
22 - 23 + @State compIndex: number = 0;
  24 + pageModel: PageModel = new PageModel();
23 aboutToAppear(): void { 25 aboutToAppear(): void {
24 26
25 } 27 }
@@ -63,7 +65,7 @@ export struct CardAdvThreeImageComponent { @@ -63,7 +65,7 @@ export struct CardAdvThreeImageComponent {
63 .margin({ top: 8 }) 65 .margin({ top: 8 })
64 66
65 // 广告工具组件 67 // 广告工具组件
66 - CardAdvBottom().width('100%').margin({ top: 8 }) 68 + CardAdvBottom({pageModel:this.pageModel,compIndex:this.compIndex}).width('100%').margin({ top: 8 })
67 } 69 }
68 .width('100%') 70 .width('100%')
69 .justifyContent(FlexAlign.Start) 71 .justifyContent(FlexAlign.Start)
  1 +import PageModel from '../../viewmodel/PageModel';
  2 +
  3 +/**
  4 + * @Description: 广告稿件 顶部标签+删除按钮
  5 + * @Author:
  6 + * @Email: liyubing@wondertek.com.cn
  7 + * @CreateDate:
  8 + * @UpdateRemark: 更新说明
  9 + * @Version: 1.0
  10 + */
  11 +@Component
  12 +export struct CardAdvTop {
  13 + @State compIndex: number = 0;
  14 + pageModel: PageModel = new PageModel();
  15 +
  16 + build() {
  17 +
  18 + Row() {
  19 + Text($r('app.string.comp_advertisement'))
  20 + .fontSize('10fp')
  21 + .fontColor($r('app.color.white'))
  22 + .width(28)
  23 + .height(16)
  24 + .backgroundColor('#4D000000')
  25 + .borderRadius(4)
  26 + .textAlign(TextAlign.Center)
  27 +
  28 + Blank()
  29 +
  30 + Stack() {
  31 + Image($r('app.media.comp_adv_close_white'))
  32 + .width(9)
  33 + .height(9)
  34 + .borderRadius({
  35 + topLeft: '4vp',
  36 + topRight: '4vp',
  37 + bottomLeft: '4vp',
  38 + bottomRight: '4vp'
  39 + })
  40 + }
  41 + .width(18)
  42 + .height(14)
  43 + .backgroundColor('#4D000000')
  44 + .borderWidth(0.5)
  45 + .borderColor($r('app.color.white'))
  46 + .borderRadius(4)
  47 +
  48 + }.width('100%').padding({
  49 + top: 8,
  50 + left: 8,
  51 + right: 8
  52 + }).onClick(() => {
  53 + if (this.pageModel) {
  54 + this.pageModel.compList.deleteItem(this.compIndex)
  55 + }
  56 +
  57 + })
  58 + }
  59 +}
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean'; 2 import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean';
3 import { CommonConstants } from 'wdConstant/Index'; 3 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
  5 +import PageModel from '../../viewmodel/PageModel';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 7 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
7 import { CardAdvBottom } from './CardAdvBottom'; 8 import { CardAdvBottom } from './CardAdvBottom';
@@ -20,7 +21,8 @@ const TAG: string = 'Card2Component'; @@ -20,7 +21,8 @@ const TAG: string = 'Card2Component';
20 export struct CardAdvVideoComponent { 21 export struct CardAdvVideoComponent {
21 @State compDTO: CompDTO = {} as CompDTO 22 @State compDTO: CompDTO = {} as CompDTO
22 @State contentDTO: ContentDTO = {} as ContentDTO 23 @State contentDTO: ContentDTO = {} as ContentDTO
23 - 24 + @State compIndex: number = 0;
  25 + pageModel: PageModel = new PageModel();
24 aboutToAppear(): void { 26 aboutToAppear(): void {
25 27
26 // this.contentDTO.objectType = '1' 28 // this.contentDTO.objectType = '1'
@@ -54,7 +56,7 @@ export struct CardAdvVideoComponent { @@ -54,7 +56,7 @@ export struct CardAdvVideoComponent {
54 .width(CommonConstants.FULL_WIDTH) 56 .width(CommonConstants.FULL_WIDTH)
55 .margin({ top: 8 }) 57 .margin({ top: 8 })
56 58
57 - CardAdvBottom().margin({ 59 + CardAdvBottom({pageModel:this.pageModel,compIndex:this.compIndex}).margin({
58 top: 8, 60 top: 8,
59 }) 61 })
60 } 62 }
@@ -3,6 +3,8 @@ import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/Adv @@ -3,6 +3,8 @@ import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/Adv
3 import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; 3 import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
4 import { CommonConstants } from 'wdConstant/Index'; 4 import { CommonConstants } from 'wdConstant/Index';
5 import { ProcessUtils } from 'wdRouter'; 5 import { ProcessUtils } from 'wdRouter';
  6 +import PageModel from '../../viewmodel/PageModel';
  7 +import { CardAdvTop } from './CardAdvTop';
6 8
7 const TAG: string = 'Card2Component'; 9 const TAG: string = 'Card2Component';
8 10
@@ -18,6 +20,8 @@ const TAG: string = 'Card2Component'; @@ -18,6 +20,8 @@ const TAG: string = 'Card2Component';
18 export struct CardAdvVideoExComponent { 20 export struct CardAdvVideoExComponent {
19 @State compDTO: CompDTO = {} as CompDTO 21 @State compDTO: CompDTO = {} as CompDTO
20 @State advExtraData: AdvExtraData = {} as AdvExtraData 22 @State advExtraData: AdvExtraData = {} as AdvExtraData
  23 + @State compIndex: number = 0;
  24 + pageModel: PageModel = new PageModel();
21 25
22 aboutToAppear(): void { 26 aboutToAppear(): void {
23 27
@@ -45,42 +49,7 @@ export struct CardAdvVideoExComponent { @@ -45,42 +49,7 @@ export struct CardAdvVideoExComponent {
45 .borderColor($r('app.color.color_0D000000')) 49 .borderColor($r('app.color.color_0D000000'))
46 50
47 51
48 - Row() {  
49 -  
50 - Text($r('app.string.comp_advertisement'))  
51 - .fontSize('10fp')  
52 - .fontColor($r('app.color.white'))  
53 - .width(28)  
54 - .height(16)  
55 - .backgroundColor('#4D000000')  
56 - .borderRadius(4)  
57 - .textAlign(TextAlign.Center)  
58 -  
59 - Blank()  
60 -  
61 - Stack() {  
62 - Image($r('app.media.comp_adv_close_white'))  
63 - .width(9)  
64 - .height(9)  
65 - .borderRadius({  
66 - topLeft: '4vp',  
67 - topRight: '4vp',  
68 - bottomLeft: '4vp',  
69 - bottomRight: '4vp'  
70 - })  
71 - }  
72 - .width(18)  
73 - .height(14)  
74 - .backgroundColor('#4D000000')  
75 - .borderWidth(0.5)  
76 - .borderColor($r('app.color.white'))  
77 - .borderRadius(4)  
78 -  
79 - }.width('100%').padding({  
80 - top: 8,  
81 - left: 8,  
82 - right: 8  
83 - }) 52 + CardAdvTop({ pageModel: this.pageModel, compIndex: this.compIndex })
84 } 53 }
85 .alignContent(Alignment.Top) 54 .alignContent(Alignment.Top)
86 .width(CommonConstants.FULL_WIDTH) 55 .width(CommonConstants.FULL_WIDTH)
1 import { ViewType } from 'wdConstant/Index' 1 import { ViewType } from 'wdConstant/Index'
2 import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index' 2 import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index'
3 -import { commentItemModel, commentListModel } from '../model/CommentModel' 3 +import { commentItemModel } from '../model/CommentModel'
4 import commentViewModel from '../viewmodel/CommentViewModel' 4 import commentViewModel from '../viewmodel/CommentViewModel'
5 import { router, window } from '@kit.ArkUI' 5 import { router, window } from '@kit.ArkUI'
6 -import { CustomTitleUI } from '../../reusable/CustomTitleUI'  
7 -import { MyCommentDataSource } from '../model/MyCommentDataSource'  
8 -import { HttpUrlUtils, HttpUtils } from 'wdNetwork/Index'  
9 -import PageModel from '../../../viewmodel/PageModel' 6 +import { HttpUtils } from 'wdNetwork/Index'
10 import { ErrorComponent } from '../../view/ErrorComponent' 7 import { ErrorComponent } from '../../view/ErrorComponent'
11 -import { EmptyComponent , WDViewDefaultType} from '../../view/EmptyComponent'  
12 -import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh' 8 +import { EmptyComponent, WDViewDefaultType } from '../../view/EmptyComponent'
13 import NoMoreLayout from '../../page/NoMoreLayout' 9 import NoMoreLayout from '../../page/NoMoreLayout'
14 import { CommentCustomDialog } from './CommentCustomDialog' 10 import { CommentCustomDialog } from './CommentCustomDialog'
15 import { publishCommentModel } from '../model/PublishCommentModel' 11 import { publishCommentModel } from '../model/PublishCommentModel'
16 -import { ifaa } from '@kit.OnlineAuthenticationKit'  
17 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' 12 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
18 13
19 const TAG = 'QualityCommentsComponent'; 14 const TAG = 'QualityCommentsComponent';
@@ -74,7 +74,7 @@ export struct PageComponent { @@ -74,7 +74,7 @@ export struct PageComponent {
74 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { 74 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
75 ListItem() { 75 ListItem() {
76 Column() { 76 Column() {
77 - CompParser({ compDTO: compDTO, compIndex: compIndex }); 77 + CompParser({ pageModel: this.pageModel, compDTO: compDTO, compIndex: compIndex });
78 } 78 }
79 } 79 }
80 }, 80 },
@@ -116,7 +116,6 @@ export class PageHelper { @@ -116,7 +116,6 @@ export class PageHelper {
116 //移除音频 和 活动 116 //移除音频 和 活动
117 this.collectPageComp(pageModel, pageDto) 117 this.collectPageComp(pageModel, pageDto)
118 118
119 -  
120 // pageModel.compList.push(...pageDto.compList) 119 // pageModel.compList.push(...pageDto.compList)
121 120
122 // TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上) 121 // TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上)
@@ -161,10 +160,8 @@ export class PageHelper { @@ -161,10 +160,8 @@ export class PageHelper {
161 flag = false 160 flag = false
162 } 161 }
163 162
164 -  
165 let pageCompSize = pageCompList.length // 信息流组件业务数量 163 let pageCompSize = pageCompList.length // 信息流组件业务数量
166 // console.error("ZZZXXXXX", " start--->" + pageCompSize); 164 // console.error("ZZZXXXXX", " start--->" + pageCompSize);
167 -  
168 if (pageCompSize == 0) { 165 if (pageCompSize == 0) {
169 flag = false 166 flag = false
170 } 167 }
@@ -263,7 +260,7 @@ export class PageHelper { @@ -263,7 +260,7 @@ export class PageHelper {
263 if (advPosition <= pageModel.pageTotalCompSize && advPosition >= a) { 260 if (advPosition <= pageModel.pageTotalCompSize && advPosition >= a) {
264 261
265 let b = advPosition - a; 262 let b = advPosition - a;
266 - console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b) 263 + // console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b)
267 if (b <= pageCompSize && b >= 0) { 264 if (b <= pageCompSize && b >= 0) {
268 265
269 let advComp: CompDTO = { 266 let advComp: CompDTO = {
@@ -281,11 +278,9 @@ export class PageHelper { @@ -281,11 +278,9 @@ export class PageHelper {
281 278
282 } 279 }
283 } 280 }
284 -  
285 } 281 }
286 } 282 }
287 } 283 }
288 -  
289 } 284 }
290 285
291 } 286 }