ref |> 精选评论列表展示加V和等级头像框
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
1 changed file
with
80 additions
and
21 deletions
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| @@ -279,28 +279,15 @@ struct QualityCommentItem { | @@ -279,28 +279,15 @@ struct QualityCommentItem { | ||
| 279 | /*头像以及昵称*/ | 279 | /*头像以及昵称*/ |
| 280 | RelativeContainer() { | 280 | RelativeContainer() { |
| 281 | 281 | ||
| 282 | - Image(this.item.fromUserHeader) | 282 | + this.headerView() |
| 283 | 283 | ||
| 284 | - .alt($r(commentViewModel.adjustUserType(this.item.fromUserType) ? | ||
| 285 | - 'app.media.WDAccountOwnerHedaerDefaultIcon' : 'app.media.WDAccountDefaultIcon')) | ||
| 286 | - .width(50) | ||
| 287 | - .height(50) | ||
| 288 | - .borderRadius(25) | ||
| 289 | - .borderWidth(2) | ||
| 290 | - .borderColor(Color.White) | ||
| 291 | - .id('image1') | ||
| 292 | - .alignRules({ | ||
| 293 | - top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 294 | - left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 295 | - }) | ||
| 296 | - .offset( | ||
| 297 | - { | ||
| 298 | - y: -16 | 284 | + if ((!this.item.api_authIcon || this.item.api_authIcon.length == 0) |
| 285 | + && this.item.fromUserType === 1 | ||
| 286 | + && ((this.item.api_levelHead && this.item.api_levelHead.length > 0) | ||
| 287 | + || (this.item.avatarFrame && this.item.avatarFrame.length > 0))) { | ||
| 288 | + this.borderView() | ||
| 299 | } | 289 | } |
| 300 | - ) | ||
| 301 | - .onClick(() => { | ||
| 302 | - this.jumpToAccountOwner() | ||
| 303 | - }) | 290 | + |
| 304 | Text(this.item.fromUserName) | 291 | Text(this.item.fromUserName) |
| 305 | .fontSize(14) | 292 | .fontSize(14) |
| 306 | .fontColor('#222222') | 293 | .fontColor('#222222') |
| @@ -404,12 +391,83 @@ struct QualityCommentItem { | @@ -404,12 +391,83 @@ struct QualityCommentItem { | ||
| 404 | 391 | ||
| 405 | } | 392 | } |
| 406 | 393 | ||
| 394 | + @Builder headerView() { | ||
| 395 | + Stack() { | ||
| 396 | + Stack() { | ||
| 397 | + Image(this.item.fromUserHeader) | ||
| 398 | + .alt(commentViewModel.adjustUserType(this.item.fromUserType) ? $r('app.media.WDAccountOwnerHedaerDefaultIcon') : $r('app.media.WDAccountDefaultIcon')) | ||
| 399 | + .width(50) | ||
| 400 | + .height(50) | ||
| 401 | + .borderRadius(24) | ||
| 402 | + .borderWidth(2) | ||
| 403 | + .borderColor(Color.White) | ||
| 404 | + .objectFit(ImageFit.Cover) | ||
| 405 | + | ||
| 406 | + if (this.item.api_authIcon && this.item.api_authIcon.length > 0) { | ||
| 407 | + Image(this.item.api_authIcon) // 加v | ||
| 408 | + .width(12).height(12) | ||
| 409 | + .objectFit(ImageFit.Cover) | ||
| 410 | + } | ||
| 411 | + }.width(50).height(50) | ||
| 412 | + .alignContent(Alignment.BottomEnd) | ||
| 413 | + } | ||
| 414 | + .width(50) | ||
| 415 | + .height(50) | ||
| 416 | + .alignContent(Alignment.Center) | ||
| 417 | + .id('image1') | ||
| 418 | + .alignRules({ | ||
| 419 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 420 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 421 | + }) | ||
| 422 | + .offset( | ||
| 423 | + { | ||
| 424 | + y: -16 | ||
| 425 | + } | ||
| 426 | + ) | ||
| 427 | + .onClick(() => { | ||
| 428 | + this.jumpToAccountOwner() | ||
| 429 | + }) | ||
| 430 | + } | ||
| 431 | + | ||
| 432 | + @Builder borderView() { | ||
| 433 | + Image(this.customBorderIconURL()) | ||
| 434 | + .objectFit(ImageFit.Cover) | ||
| 435 | + .width(70) | ||
| 436 | + .height(70) | ||
| 437 | + .id('image2') | ||
| 438 | + .alignRules({ | ||
| 439 | + middle: { anchor: "image1", align: HorizontalAlign.Center }, | ||
| 440 | + center: { anchor: "image1", align: VerticalAlign.Center } | ||
| 441 | + }) | ||
| 442 | + .offset( | ||
| 443 | + { | ||
| 444 | + y: -16 | ||
| 445 | + } | ||
| 446 | + ) | ||
| 447 | + .onClick(() => { | ||
| 448 | + this.jumpToAccountOwner() | ||
| 449 | + }) | ||
| 450 | + } | ||
| 451 | + | ||
| 452 | + customBorderIconURL() : string { | ||
| 453 | + if (this.item.avatarFrame.length > 0) { | ||
| 454 | + return this.item.avatarFrame | ||
| 455 | + } | ||
| 456 | + if (this.item.fromUserType === 1) { | ||
| 457 | + return this.item.api_levelHead | ||
| 458 | + } | ||
| 459 | + return "" | ||
| 460 | + } | ||
| 461 | + | ||
| 407 | jumpToAccountOwner() { | 462 | jumpToAccountOwner() { |
| 408 | 463 | ||
| 409 | - commentViewModel.jumpToAccountPage(this.item) | 464 | + commentViewModel.jumpToAccountPage(this.item, () => { |
| 465 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 466 | + }) | ||
| 410 | } | 467 | } |
| 411 | 468 | ||
| 412 | jumpToDetail() { | 469 | jumpToDetail() { |
| 470 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 413 | // programInfoModel.api_isCommentAction = YES; | 471 | // programInfoModel.api_isCommentAction = YES; |
| 414 | let content = new ContentDTO() | 472 | let content = new ContentDTO() |
| 415 | content.objectId = this.item.targetId; | 473 | content.objectId = this.item.targetId; |
| @@ -442,6 +500,7 @@ struct QualityCommentItem { | @@ -442,6 +500,7 @@ struct QualityCommentItem { | ||
| 442 | // 未登录,跳转登录 | 500 | // 未登录,跳转登录 |
| 443 | const user_id = HttpUtils.getUserId() | 501 | const user_id = HttpUtils.getUserId() |
| 444 | if (!user_id) { | 502 | if (!user_id) { |
| 503 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 445 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 504 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 446 | return | 505 | return |
| 447 | } | 506 | } |
-
Please register or login to post a comment