Showing
1 changed file
with
30 additions
and
23 deletions
| 1 | -import { CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | -import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 3 | -import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 4 | -import { postInteractAccentionOperateParams } from 'wdBean'; | ||
| 5 | -import { PageRepository } from '../../repository/PageRepository'; | ||
| 6 | -import { CommonConstants } from 'wdConstant/Index'; | 1 | +import { CompDTO, ContentDTO } from 'wdBean'; |
| 7 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 2 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 8 | -import { Tracking, TrackingContent, TrackConstants, ParamType } from 'wdTracking'; | ||
| 9 | -import { TrackingUtils } from 'wdTracking/src/main/ets/common/TrackingUtils' | 3 | +import { ParamType, Tracking } from 'wdTracking'; |
| 4 | +import { TrackingUtils } from 'wdTracking/src/main/ets/common/TrackingUtils'; | ||
| 10 | import { ToastUtils } from 'wdKit'; | 5 | import { ToastUtils } from 'wdKit'; |
| 11 | import PageModel from '../../viewmodel/PageModel'; | 6 | import PageModel from '../../viewmodel/PageModel'; |
| 12 | 7 | ||
| @@ -28,10 +23,12 @@ export struct ZhSingleColumn09 { | @@ -28,10 +23,12 @@ export struct ZhSingleColumn09 { | ||
| 28 | @StorageLink('selfClosed') selfClosed: boolean = false | 23 | @StorageLink('selfClosed') selfClosed: boolean = false |
| 29 | @State loadImg: boolean = false; | 24 | @State loadImg: boolean = false; |
| 30 | @State compIndex: number = 0; | 25 | @State compIndex: number = 0; |
| 26 | + @State currentOperDataListIndex: number = 0; //记录换一换点击次数 | ||
| 31 | 27 | ||
| 32 | async aboutToAppear(): Promise<void> { | 28 | async aboutToAppear(): Promise<void> { |
| 33 | this.loadImg = await onlyWifiLoadImg(); | 29 | this.loadImg = await onlyWifiLoadImg(); |
| 34 | this.operDataList = this.shuffleArray(this.compDTO?.operDataList) | 30 | this.operDataList = this.shuffleArray(this.compDTO?.operDataList) |
| 31 | + this.currentOperDataListIndex = this.compDTO?.operDataList.length | ||
| 35 | } | 32 | } |
| 36 | 33 | ||
| 37 | trackClick(type: 'close_interest_card_click' | 'interest_card_selecting_click') { | 34 | trackClick(type: 'close_interest_card_click' | 'interest_card_selecting_click') { |
| @@ -80,7 +77,7 @@ export struct ZhSingleColumn09 { | @@ -80,7 +77,7 @@ export struct ZhSingleColumn09 { | ||
| 80 | } | 77 | } |
| 81 | 78 | ||
| 82 | shuffleArray(array: ContentDTO[]) { | 79 | shuffleArray(array: ContentDTO[]) { |
| 83 | - for(let i = array.length - 1; i > 0; i--) { | 80 | + for (let i = array.length - 1; i > 0; i--) { |
| 84 | const j = Math.floor(Math.random() * (i + 1)); | 81 | const j = Math.floor(Math.random() * (i + 1)); |
| 85 | const tempArray = array[i]; | 82 | const tempArray = array[i]; |
| 86 | array[i] = array[j]; | 83 | array[i] = array[j]; |
| @@ -94,17 +91,17 @@ export struct ZhSingleColumn09 { | @@ -94,17 +91,17 @@ export struct ZhSingleColumn09 { | ||
| 94 | //顶部 | 91 | //顶部 |
| 95 | Row() { | 92 | Row() { |
| 96 | Column() { | 93 | Column() { |
| 97 | - Text('以下是否有您感兴趣?') | 94 | + Text('以下是否有您感兴趣的分类?') |
| 98 | .fontSize(18) | 95 | .fontSize(18) |
| 99 | .fontColor(0x000000) | 96 | .fontColor(0x000000) |
| 100 | .fontWeight(600) | 97 | .fontWeight(600) |
| 101 | .width('70%') | 98 | .width('70%') |
| 102 | - .padding({bottom: 4}) | 99 | + .padding({ bottom: 4 }) |
| 103 | 100 | ||
| 104 | Text('选中标签,为您推荐更多您感兴趣的内容') | 101 | Text('选中标签,为您推荐更多您感兴趣的内容') |
| 105 | .fontSize(12) | 102 | .fontSize(12) |
| 106 | .fontColor(0xB0B0B0) | 103 | .fontColor(0xB0B0B0) |
| 107 | - .padding({bottom: 10}) | 104 | + .padding({ bottom: 10 }) |
| 108 | .width('70%') | 105 | .width('70%') |
| 109 | } | 106 | } |
| 110 | 107 | ||
| @@ -113,11 +110,15 @@ export struct ZhSingleColumn09 { | @@ -113,11 +110,15 @@ export struct ZhSingleColumn09 { | ||
| 113 | .fontSize(14) | 110 | .fontSize(14) |
| 114 | .width(62) | 111 | .width(62) |
| 115 | .height(26) | 112 | .height(26) |
| 116 | - .backgroundColor(this.activeIndexs.length > 0 ? 0xfdf0ed : 0xf5f5f5) | ||
| 117 | - // .lineHeight(26) | 113 | + .backgroundColor(this.activeIndexs.length > 0 ? 0xfdf0ed : 0xf5f5f5)// .lineHeight(26) |
| 118 | .borderRadius(4) | 114 | .borderRadius(4) |
| 119 | - .margin({top: -10}) | ||
| 120 | - .padding({top: 0, bottom: 0, left: 0, right: 0}) | 115 | + .margin({ top: -10 }) |
| 116 | + .padding({ | ||
| 117 | + top: 0, | ||
| 118 | + bottom: 0, | ||
| 119 | + left: 0, | ||
| 120 | + right: 0 | ||
| 121 | + }) | ||
| 121 | .onClick(() => { | 122 | .onClick(() => { |
| 122 | this.trackClick('interest_card_selecting_click') | 123 | this.trackClick('interest_card_selecting_click') |
| 123 | if (this.activeIndexs.length > 0) { | 124 | if (this.activeIndexs.length > 0) { |
| @@ -133,18 +134,20 @@ export struct ZhSingleColumn09 { | @@ -133,18 +134,20 @@ export struct ZhSingleColumn09 { | ||
| 133 | Grid() { | 134 | Grid() { |
| 134 | ForEach(this.operDataList, (item: ContentDTO, index: number) => { | 135 | ForEach(this.operDataList, (item: ContentDTO, index: number) => { |
| 135 | GridItem() { | 136 | GridItem() { |
| 136 | - Stack({alignContent: Alignment.TopEnd}) { | 137 | + Stack({ alignContent: Alignment.TopEnd }) { |
| 137 | Image(this.loadImg ? item.coverUrl : '') | 138 | Image(this.loadImg ? item.coverUrl : '') |
| 138 | .backgroundColor(0xf5f5f5) | 139 | .backgroundColor(0xf5f5f5) |
| 139 | .width('100%') | 140 | .width('100%') |
| 140 | .height('100%') | 141 | .height('100%') |
| 141 | .borderRadius(3) | 142 | .borderRadius(3) |
| 142 | - Row(){} | 143 | + Row() { |
| 144 | + } | ||
| 143 | .width('100%') | 145 | .width('100%') |
| 144 | .height('100%') | 146 | .height('100%') |
| 145 | .backgroundColor('rgba(0, 0, 0, 1)') | 147 | .backgroundColor('rgba(0, 0, 0, 1)') |
| 146 | .opacity(0.4) | 148 | .opacity(0.4) |
| 147 | .borderRadius(3) | 149 | .borderRadius(3) |
| 150 | + | ||
| 148 | Text(item.newsTitle) | 151 | Text(item.newsTitle) |
| 149 | .width('100%') | 152 | .width('100%') |
| 150 | .height('100%') | 153 | .height('100%') |
| @@ -160,7 +163,7 @@ export struct ZhSingleColumn09 { | @@ -160,7 +163,7 @@ export struct ZhSingleColumn09 { | ||
| 160 | .width('100%') | 163 | .width('100%') |
| 161 | .height('100%') | 164 | .height('100%') |
| 162 | } | 165 | } |
| 163 | - .margin({right: index % 4 === 3 ? 0 : 6, bottom: 6}) | 166 | + .margin({ right: index % 4 === 3 ? 0 : 6, bottom: 6 }) |
| 164 | .onClick(() => { | 167 | .onClick(() => { |
| 165 | if (this.activeIndexs.includes(index)) { | 168 | if (this.activeIndexs.includes(index)) { |
| 166 | const ind = this.activeIndexs.indexOf(index); | 169 | const ind = this.activeIndexs.indexOf(index); |
| @@ -174,26 +177,30 @@ export struct ZhSingleColumn09 { | @@ -174,26 +177,30 @@ export struct ZhSingleColumn09 { | ||
| 174 | .height(90) | 177 | .height(90) |
| 175 | .columnsTemplate('1fr 1fr 1fr 1fr') | 178 | .columnsTemplate('1fr 1fr 1fr 1fr') |
| 176 | .rowsTemplate('1fr 1fr') | 179 | .rowsTemplate('1fr 1fr') |
| 177 | - .margin({bottom: 5}) | 180 | + .margin({ bottom: 5 }) |
| 178 | 181 | ||
| 179 | Row() { | 182 | Row() { |
| 180 | Row() { | 183 | Row() { |
| 181 | Text('换一换') | 184 | Text('换一换') |
| 182 | .fontSize(14) | 185 | .fontSize(14) |
| 183 | - .fontColor(this.compDTO?.operDataList.length > 8 ? 0xed2800 : 0xB0B0B0) | ||
| 184 | - .margin({right: 4}) | 186 | + .fontColor(this.compDTO?.operDataList.length > 8 && this.currentOperDataListIndex > 0 ? 0xed2800 : 0xB0B0B0) |
| 187 | + .margin({ right: 4 }) | ||
| 185 | Image(this.compDTO?.operDataList.length > 8 ? $r('app.media.icon_refresh') : $r('app.media.ic_refresh')) | 188 | Image(this.compDTO?.operDataList.length > 8 ? $r('app.media.icon_refresh') : $r('app.media.ic_refresh')) |
| 186 | .width(14) | 189 | .width(14) |
| 187 | .height(14) | 190 | .height(14) |
| 188 | } | 191 | } |
| 189 | .onClick(() => { | 192 | .onClick(() => { |
| 193 | + if (this.currentOperDataListIndex > 0) { | ||
| 194 | + this.currentOperDataListIndex-- | ||
| 195 | + } | ||
| 190 | if (this.compDTO?.operDataList.length > 8) { | 196 | if (this.compDTO?.operDataList.length > 8) { |
| 191 | - if (this.pageModel){ | 197 | + if (this.pageModel) { |
| 192 | this.pageModel.compList.deleteItem(this.compIndex) | 198 | this.pageModel.compList.deleteItem(this.compIndex) |
| 193 | } | 199 | } |
| 194 | this.activeIndexs = []; | 200 | this.activeIndexs = []; |
| 195 | } | 201 | } |
| 196 | }) | 202 | }) |
| 203 | + | ||
| 197 | Row() { | 204 | Row() { |
| 198 | Image($r("app.media.close_button_new")) | 205 | Image($r("app.media.close_button_new")) |
| 199 | .width(9) | 206 | .width(9) |
-
Please register or login to post a comment