Showing
1 changed file
with
36 additions
and
117 deletions
| @@ -53,7 +53,8 @@ export struct LiveHorizontalCardComponent { | @@ -53,7 +53,8 @@ export struct LiveHorizontalCardComponent { | ||
| 53 | 53 | ||
| 54 | resetEdgeAnimation() { | 54 | resetEdgeAnimation() { |
| 55 | if (this.moreWidth > this.initMoreWidth) { | 55 | if (this.moreWidth > this.initMoreWidth) { |
| 56 | - this.moreWidth = 16 | 56 | + this.moreWidth = this.moreWidth - 1 |
| 57 | + this.resetEdgeAnimation(); | ||
| 57 | } | 58 | } |
| 58 | this.resetMoreTips() | 59 | this.resetMoreTips() |
| 59 | } | 60 | } |
| @@ -93,9 +94,9 @@ export struct LiveHorizontalCardComponent { | @@ -93,9 +94,9 @@ export struct LiveHorizontalCardComponent { | ||
| 93 | .fontWeight(600) | 94 | .fontWeight(600) |
| 94 | } | 95 | } |
| 95 | 96 | ||
| 96 | - if (this.compDTO?.objectType === '0' || this.compDTO?.objectType === '') { | 97 | + if (this.compDTO.dataSourceType === 'LIVE_HORIZONTAL_CARD' || this.compDTO.dataSourceType === 'LIVE_MONTHLY_RANKING' || this.compDTO.dataSourceType === 'OBJECT_POS') { |
| 97 | Row() { | 98 | Row() { |
| 98 | - Text("更多") | 99 | + Text("更多222222") |
| 99 | .fontSize($r("app.float.font_size_14")) | 100 | .fontSize($r("app.float.font_size_14")) |
| 100 | .fontColor($r("app.color.color_999999")) | 101 | .fontColor($r("app.color.color_999999")) |
| 101 | .margin({ right: 1 }) | 102 | .margin({ right: 1 }) |
| @@ -122,98 +123,25 @@ export struct LiveHorizontalCardComponent { | @@ -122,98 +123,25 @@ export struct LiveHorizontalCardComponent { | ||
| 122 | .margin({ top: 8, bottom: 8 }) | 123 | .margin({ top: 8, bottom: 8 }) |
| 123 | .width(CommonConstants.FULL_WIDTH) | 124 | .width(CommonConstants.FULL_WIDTH) |
| 124 | 125 | ||
| 125 | - Row(){ | ||
| 126 | - // 多个 | ||
| 127 | - if (this.compDTO.operDataList.length >= 2) { | ||
| 128 | - Scroll(this.scroller) { | ||
| 129 | - Row() { | ||
| 130 | - Row() { | ||
| 131 | - ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { | ||
| 132 | - Column() { | ||
| 133 | - Stack({ alignContent: Alignment.BottomEnd }) { | ||
| 134 | - Image(this.loadImg ? item.coverUrl : '') | ||
| 135 | - .backgroundColor(0xf5f5f5) | ||
| 136 | - .aspectRatio(16 / 9) | ||
| 137 | - .width(this.compDTO.operDataList.length == 2 ? 210 : 150) | ||
| 138 | - .borderRadius(4) | ||
| 139 | - .objectFit(ImageFit.Cover) | ||
| 140 | - CardMediaInfo({ | ||
| 141 | - livePeopleNum:false, | ||
| 142 | - contentDTO: item | ||
| 143 | - }) | ||
| 144 | - } | ||
| 145 | - | ||
| 146 | - Text(item.newsTitle) | ||
| 147 | - .fontSize($r("app.float.font_size_14")) | ||
| 148 | - .fontColor($r("app.color.color_212228")) | ||
| 149 | - .fontWeight(400) | ||
| 150 | - .maxLines(2) | ||
| 151 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 152 | - .textAlign(TextAlign.Start) | ||
| 153 | - .margin({ top: 8 }) | ||
| 154 | - .width(this.compDTO.operDataList.length == 2 ? 210 : 150) | ||
| 155 | - .height(42) | ||
| 156 | - .lineHeight(21) | ||
| 157 | - } | ||
| 158 | - .padding({ right: 16 }) | ||
| 159 | - .onClick(() => { | ||
| 160 | - InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName) | ||
| 161 | - if (item.objectType != '0') { | ||
| 162 | - console.log(item.objectId) | ||
| 163 | - this.gotoLive(item) | ||
| 164 | - } | ||
| 165 | - }) | ||
| 166 | - }) | ||
| 167 | - } | ||
| 168 | - if (this.compDTO.operDataList.length >= 2) { | ||
| 169 | - Column() { | ||
| 170 | - if (this.moreWidth > this.initMoreWidth + 2) { | ||
| 171 | - Text(this.moreTips) | ||
| 172 | - .fontSize(8) | ||
| 173 | - .fontColor(0x858585) | ||
| 174 | - .width(8) | ||
| 175 | - } | ||
| 176 | - } | ||
| 177 | - .justifyContent(FlexAlign.Center) | ||
| 178 | - .align(Alignment.Center) | ||
| 179 | - .width(this.moreWidth) | ||
| 180 | - .backgroundColor(0xf1f3f4) | ||
| 181 | - .borderRadius({ topLeft: 5, bottomLeft: 5 }) | ||
| 182 | - .height(this.compDTO.operDataList.length == 2 ? 180 : 146) | ||
| 183 | - } | ||
| 184 | - } | ||
| 185 | - } | ||
| 186 | - .align(Alignment.Start) | ||
| 187 | - .scrollable(this.compDTO.operDataList.length >= 2 ? ScrollDirection.Horizontal : ScrollDirection.None) | ||
| 188 | - .scrollBar(BarState.Off) | ||
| 189 | - .edgeEffect(EdgeEffect.None) | ||
| 190 | - .onReachEnd(() => { | ||
| 191 | - this.edgeAnimation() | ||
| 192 | - }) | ||
| 193 | - .onScrollStop(() => { | ||
| 194 | - // this.resetEdgeAnimation(); | ||
| 195 | - }) | ||
| 196 | - .onScroll((xOffset: number, yOffset: number) => { | ||
| 197 | - if (xOffset < 0) { | ||
| 198 | - this.reverseEdgeAnimation(); | ||
| 199 | - } | ||
| 200 | - }) | ||
| 201 | - .onTouch((event?: TouchEvent) => { | ||
| 202 | - if(event) { | ||
| 203 | - if (event.type === TouchType.Up) { | ||
| 204 | - this.toMore(); | ||
| 205 | - this.resetEdgeAnimation(); | ||
| 206 | - } | ||
| 207 | - } | ||
| 208 | - }) | ||
| 209 | - .width(CommonConstants.FULL_WIDTH) | ||
| 210 | - .height(this.compDTO.operDataList.length == 2 ? 180 : 136) | ||
| 211 | - } else if (this.compDTO.operDataList.length) { | ||
| 212 | - Row(){ | ||
| 213 | - LiveHorizontalCardForOneComponent({ contentDTO: this.compDTO.operDataList[0] }) | ||
| 214 | - } | ||
| 215 | - } | ||
| 216 | - }.padding({left:10}) | 126 | + // 多个 |
| 127 | + if (this.compDTO.operDataList.length >= 2) { | ||
| 128 | + Scroll(this.scroller) { | ||
| 129 | + Row() { | ||
| 130 | + Row() { | ||
| 131 | + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { | ||
| 132 | + Column() { | ||
| 133 | + Stack({ alignContent: Alignment.BottomEnd }) { | ||
| 134 | + Image(this.loadImg ? item.coverUrl : '') | ||
| 135 | + .backgroundColor(0xf5f5f5) | ||
| 136 | + .aspectRatio(16 / 9) | ||
| 137 | + .width(this.compDTO.operDataList.length == 2 ? 210 : 150) | ||
| 138 | + .borderRadius(4) | ||
| 139 | + .objectFit(ImageFit.Cover) | ||
| 140 | + CardMediaInfo({ | ||
| 141 | + livePeopleNum:false, | ||
| 142 | + contentDTO: item | ||
| 143 | + }) | ||
| 144 | + } | ||
| 217 | 145 | ||
| 218 | Text(item.newsTitle) | 146 | Text(item.newsTitle) |
| 219 | .fontSize($r("app.float.font_size_14")) | 147 | .fontSize($r("app.float.font_size_14")) |
| @@ -237,30 +165,21 @@ export struct LiveHorizontalCardComponent { | @@ -237,30 +165,21 @@ export struct LiveHorizontalCardComponent { | ||
| 237 | }) | 165 | }) |
| 238 | }) | 166 | }) |
| 239 | } | 167 | } |
| 240 | - if (this.compDTO.operDataList.length >= 2 && (this.compDTO?.objectType === '0' || this.compDTO?.objectType === '')) { | ||
| 241 | - Row() { | ||
| 242 | - Ellipse() | ||
| 243 | - .width(2* (this.moreWidth - this.initMoreWidth - 1)) | ||
| 244 | - .height(this.compDTO.operDataList.length == 2 ? 180 : 146) | ||
| 245 | - .fill(0xf1f3f4) | ||
| 246 | - .position({ left: -(this.moreWidth - this.initMoreWidth - 3) * 0.8 }) | ||
| 247 | - | ||
| 248 | - Column() { | ||
| 249 | - if (this.moreWidth > this.initMoreWidth + 2) { | ||
| 250 | - Text(this.moreTips) | ||
| 251 | - .fontSize(8) | ||
| 252 | - .fontColor(0x858585) | ||
| 253 | - .width(8) | ||
| 254 | - } | 168 | + if (this.compDTO.operDataList.length >= 2) { |
| 169 | + Column() { | ||
| 170 | + if (this.moreWidth > this.initMoreWidth + 2) { | ||
| 171 | + Text(this.moreTips) | ||
| 172 | + .fontSize(8) | ||
| 173 | + .fontColor(0x858585) | ||
| 174 | + .width(8) | ||
| 255 | } | 175 | } |
| 256 | - .justifyContent(FlexAlign.Center) | ||
| 257 | - .align(Alignment.Center) | ||
| 258 | - .height(this.compDTO.operDataList.length == 2 ? 180 : 146) | ||
| 259 | - .width(this.initMoreWidth) | ||
| 260 | - .backgroundColor(0xf1f3f4) | ||
| 261 | - .borderRadius({ topLeft: 5, bottomLeft: 5 }) | ||
| 262 | } | 176 | } |
| 263 | - .margin({left: 1.5 * (this.moreWidth - this.initMoreWidth)}) | 177 | + .justifyContent(FlexAlign.Center) |
| 178 | + .align(Alignment.Center) | ||
| 179 | + .width(this.moreWidth) | ||
| 180 | + .backgroundColor(0xf1f3f4) | ||
| 181 | + .borderRadius({ topLeft: 5, bottomLeft: 5 }) | ||
| 182 | + .height(this.compDTO.operDataList.length == 2 ? 180 : 146) | ||
| 264 | } | 183 | } |
| 265 | } | 184 | } |
| 266 | } | 185 | } |
-
Please register or login to post a comment