王士厅

fix: 兴趣卡关闭添加提示,关闭后列表删除数据

@@ -185,7 +185,7 @@ export struct CompParser { @@ -185,7 +185,7 @@ export struct CompParser {
185 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_05) { 185 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
186 // ZhSingleColumn05({ compDTO: compDTO }) 186 // ZhSingleColumn05({ compDTO: compDTO })
187 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) { 187 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
188 - ZhSingleColumn09({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) 188 + ZhSingleColumn09({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName, pageModel: this.pageModel, compIndex: this.compIndex })
189 } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 189 } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
190 AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO }) 190 AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO })
191 //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 0, right: 0 }) 191 //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 0, right: 0 })
@@ -7,6 +7,9 @@ import { CommonConstants } from 'wdConstant/Index'; @@ -7,6 +7,9 @@ import { CommonConstants } from 'wdConstant/Index';
7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 import { Tracking, TrackingContent, TrackConstants, ParamType } from 'wdTracking'; 8 import { Tracking, TrackingContent, TrackConstants, ParamType } from 'wdTracking';
9 import { TrackingUtils } from 'wdTracking/src/main/ets/common/TrackingUtils' 9 import { TrackingUtils } from 'wdTracking/src/main/ets/common/TrackingUtils'
  10 +import { ToastUtils } from 'wdKit';
  11 +import PageModel from '../../viewmodel/PageModel';
  12 +
10 /** 13 /**
11 * 兴趣卡 14 * 兴趣卡
12 * Zh_Single_Column-09 15 * Zh_Single_Column-09
@@ -16,6 +19,7 @@ const TAG = 'Zh_Single_Column-09' @@ -16,6 +19,7 @@ const TAG = 'Zh_Single_Column-09'
16 @Entry 19 @Entry
17 @Component 20 @Component
18 export struct ZhSingleColumn09 { 21 export struct ZhSingleColumn09 {
  22 + @State private pageModel: PageModel = new PageModel();
19 @State pageId: string = ''; 23 @State pageId: string = '';
20 @State pageName: string = ''; 24 @State pageName: string = '';
21 @State compDTO: CompDTO = {} as CompDTO 25 @State compDTO: CompDTO = {} as CompDTO
@@ -23,6 +27,7 @@ export struct ZhSingleColumn09 { @@ -23,6 +27,7 @@ export struct ZhSingleColumn09 {
23 @State operDataList: ContentDTO[] = this.compDTO?.operDataList || [] 27 @State operDataList: ContentDTO[] = this.compDTO?.operDataList || []
24 @State selfClosed: Boolean = false; 28 @State selfClosed: Boolean = false;
25 @State loadImg: boolean = false; 29 @State loadImg: boolean = false;
  30 + @State compIndex: number = 0;
26 31
27 async aboutToAppear(): Promise<void> { 32 async aboutToAppear(): Promise<void> {
28 this.loadImg = await onlyWifiLoadImg(); 33 this.loadImg = await onlyWifiLoadImg();
@@ -116,6 +121,8 @@ export struct ZhSingleColumn09 { @@ -116,6 +121,8 @@ export struct ZhSingleColumn09 {
116 .onClick(() => { 121 .onClick(() => {
117 this.trackClick('interest_card_selecting_click') 122 this.trackClick('interest_card_selecting_click')
118 if (this.activeIndexs.length > 0) { 123 if (this.activeIndexs.length > 0) {
  124 + ToastUtils.shortToast('已为您调整推荐内容')
  125 + this.pageModel.compList.deleteItem(this.compIndex)
119 this.selfClosed = true; 126 this.selfClosed = true;
120 } 127 }
121 }) 128 })
@@ -181,7 +188,9 @@ export struct ZhSingleColumn09 { @@ -181,7 +188,9 @@ export struct ZhSingleColumn09 {
181 } 188 }
182 .onClick(() => { 189 .onClick(() => {
183 if (this.compDTO?.operDataList.length > 8) { 190 if (this.compDTO?.operDataList.length > 8) {
184 - this.operDataList = this.shuffleArray(this.operDataList) 191 + if (this.pageModel){
  192 + this.pageModel.compList.deleteItem(this.compIndex)
  193 + }
185 this.activeIndexs = []; 194 this.activeIndexs = [];
186 } 195 }
187 }) 196 })
@@ -191,6 +200,8 @@ export struct ZhSingleColumn09 { @@ -191,6 +200,8 @@ export struct ZhSingleColumn09 {
191 .height(9) 200 .height(9)
192 .onClick(() => { 201 .onClick(() => {
193 this.trackClick('close_interest_card_click') 202 this.trackClick('close_interest_card_click')
  203 + ToastUtils.shortToast('已为您调整推荐内容')
  204 + this.pageModel.compList.deleteItem(this.compIndex)
194 this.selfClosed = true; 205 this.selfClosed = true;
195 }) 206 })
196 } 207 }