Showing
1 changed file
with
28 additions
and
26 deletions
| 1 | import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean'; | 1 | import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | -import { Logger, LazyDataSource } from 'wdKit/Index'; | 3 | +import { Logger } from 'wdKit/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import PageViewModel from '../../viewmodel/PageViewModel'; | 5 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| @@ -8,6 +8,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | @@ -8,6 +8,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 8 | const TAG = 'Zh_Grid_Layout-02'; | 8 | const TAG = 'Zh_Grid_Layout-02'; |
| 9 | const FULL_PARENT: string = '100%'; | 9 | const FULL_PARENT: string = '100%'; |
| 10 | let listSize: number = 2; | 10 | let listSize: number = 2; |
| 11 | + | ||
| 11 | /** | 12 | /** |
| 12 | * 双图卡 | 13 | * 双图卡 |
| 13 | * 枚举值Zh_Grid_Layout-02 | 14 | * 枚举值Zh_Grid_Layout-02 |
| @@ -20,6 +21,8 @@ export struct ZhGridLayout02 { | @@ -20,6 +21,8 @@ export struct ZhGridLayout02 { | ||
| 20 | @State operDataList: ContentDTO[] = [] | 21 | @State operDataList: ContentDTO[] = [] |
| 21 | @State loadImg: boolean = false; | 22 | @State loadImg: boolean = false; |
| 22 | @State liveRoomList: LiveRoomDataBean[] = [] | 23 | @State liveRoomList: LiveRoomDataBean[] = [] |
| 24 | + currentPage = 1 | ||
| 25 | + pageSize = 12 | ||
| 23 | 26 | ||
| 24 | async aboutToAppear(): Promise<void> { | 27 | async aboutToAppear(): Promise<void> { |
| 25 | Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle) | 28 | Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle) |
| @@ -33,9 +36,6 @@ export struct ZhGridLayout02 { | @@ -33,9 +36,6 @@ export struct ZhGridLayout02 { | ||
| 33 | this.loadImg = await onlyWifiLoadImg(); | 36 | this.loadImg = await onlyWifiLoadImg(); |
| 34 | } | 37 | } |
| 35 | 38 | ||
| 36 | - currentPage = 1 | ||
| 37 | - pageSize = 12 | ||
| 38 | - | ||
| 39 | build() { | 39 | build() { |
| 40 | Column() { | 40 | Column() { |
| 41 | Scroll() { | 41 | Scroll() { |
| @@ -51,7 +51,7 @@ export struct ZhGridLayout02 { | @@ -51,7 +51,7 @@ export struct ZhGridLayout02 { | ||
| 51 | .fontWeight(600) | 51 | .fontWeight(600) |
| 52 | } | 52 | } |
| 53 | .justifyContent(FlexAlign.Start) | 53 | .justifyContent(FlexAlign.Start) |
| 54 | - .margin({ top: 16, bottom: 8 }) | 54 | + .margin({ top: 16, bottom: 18 }) |
| 55 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| 56 | 56 | ||
| 57 | GridRow({ | 57 | GridRow({ |
| @@ -101,7 +101,7 @@ export struct ZhGridLayout02 { | @@ -101,7 +101,7 @@ export struct ZhGridLayout02 { | ||
| 101 | @Builder | 101 | @Builder |
| 102 | buildItemCard(item: ContentDTO) { | 102 | buildItemCard(item: ContentDTO) { |
| 103 | Column() { | 103 | Column() { |
| 104 | - Stack({alignContent: Alignment.BottomEnd}) { | 104 | + Stack({ alignContent: Alignment.BottomEnd }) { |
| 105 | Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') | 105 | Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') |
| 106 | .backgroundColor(0xf5f5f5) | 106 | .backgroundColor(0xf5f5f5) |
| 107 | .width('100%') | 107 | .width('100%') |
| @@ -114,10 +114,11 @@ export struct ZhGridLayout02 { | @@ -114,10 +114,11 @@ export struct ZhGridLayout02 { | ||
| 114 | .fontColor(Color.White) | 114 | .fontColor(Color.White) |
| 115 | .margin({ | 115 | .margin({ |
| 116 | right: '5vp', | 116 | right: '5vp', |
| 117 | - bottom:'5vp' | 117 | + bottom: '5vp' |
| 118 | }) | 118 | }) |
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| 121 | + | ||
| 121 | Text(item.newsTitle) | 122 | Text(item.newsTitle) |
| 122 | .margin({ top: '5' }) | 123 | .margin({ top: '5' }) |
| 123 | .fontSize(13) | 124 | .fontSize(13) |
| @@ -130,14 +131,6 @@ export struct ZhGridLayout02 { | @@ -130,14 +131,6 @@ export struct ZhGridLayout02 { | ||
| 130 | }) | 131 | }) |
| 131 | } | 132 | } |
| 132 | 133 | ||
| 133 | - | ||
| 134 | - private getLiveDetailIds(list: ContentDTO[]): string { | ||
| 135 | - let idList: string[] = [] | ||
| 136 | - list.forEach(item => { | ||
| 137 | - idList.push(item.objectId) | ||
| 138 | - }); | ||
| 139 | - return idList.join(',') | ||
| 140 | - } | ||
| 141 | // 获取评论数 | 134 | // 获取评论数 |
| 142 | async getLiveRoomDataInfo(list: ContentDTO[]) { | 135 | async getLiveRoomDataInfo(list: ContentDTO[]) { |
| 143 | const reserveIds = this.getLiveDetailIds(list) | 136 | const reserveIds = this.getLiveDetailIds(list) |
| @@ -145,7 +138,7 @@ export struct ZhGridLayout02 { | @@ -145,7 +138,7 @@ export struct ZhGridLayout02 { | ||
| 145 | if (result && result.length > 0) { | 138 | if (result && result.length > 0) { |
| 146 | this.liveRoomList.push(...result) | 139 | this.liveRoomList.push(...result) |
| 147 | } | 140 | } |
| 148 | - }).catch(() =>{ | 141 | + }).catch(() => { |
| 149 | }) | 142 | }) |
| 150 | } | 143 | } |
| 151 | 144 | ||
| @@ -160,16 +153,6 @@ export struct ZhGridLayout02 { | @@ -160,16 +153,6 @@ export struct ZhGridLayout02 { | ||
| 160 | return '' | 153 | return '' |
| 161 | } | 154 | } |
| 162 | 155 | ||
| 163 | - private computeShowNum(count: number): string { | ||
| 164 | - if (count >= 10000) { | ||
| 165 | - let num = ( count / 10000).toFixed(1) | ||
| 166 | - if (Number(num.substring(num.length-1)) == 0) { | ||
| 167 | - num = num.substring(0, num.length-2) | ||
| 168 | - } | ||
| 169 | - return num + '万人参加' | ||
| 170 | - } | ||
| 171 | - return `${count}人参加` | ||
| 172 | - } | ||
| 173 | addItems() { | 156 | addItems() { |
| 174 | Logger.debug(TAG, 'addItems') | 157 | Logger.debug(TAG, 'addItems') |
| 175 | this.currentPage++ | 158 | this.currentPage++ |
| @@ -179,6 +162,25 @@ export struct ZhGridLayout02 { | @@ -179,6 +162,25 @@ export struct ZhGridLayout02 { | ||
| 179 | Logger.debug(TAG, 'addItems after: ' + this.operDataList.length) | 162 | Logger.debug(TAG, 'addItems after: ' + this.operDataList.length) |
| 180 | }) | 163 | }) |
| 181 | } | 164 | } |
| 165 | + | ||
| 166 | + private getLiveDetailIds(list: ContentDTO[]): string { | ||
| 167 | + let idList: string[] = [] | ||
| 168 | + list.forEach(item => { | ||
| 169 | + idList.push(item.objectId) | ||
| 170 | + }); | ||
| 171 | + return idList.join(',') | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + private computeShowNum(count: number): string { | ||
| 175 | + if (count >= 10000) { | ||
| 176 | + let num = (count / 10000).toFixed(1) | ||
| 177 | + if (Number(num.substring(num.length - 1)) == 0) { | ||
| 178 | + num = num.substring(0, num.length - 2) | ||
| 179 | + } | ||
| 180 | + return num + '万人参加' | ||
| 181 | + } | ||
| 182 | + return `${count}人参加` | ||
| 183 | + } | ||
| 182 | } | 184 | } |
| 183 | 185 | ||
| 184 | 186 |
-
Please register or login to post a comment