xugenyuan

ref |> 修复评论列表用户等级头像框和加V标签和最佳评论员头像相关逻辑

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
... ... @@ -114,7 +114,7 @@ export class commentItemModel {
/*评论点赞状态 0-未点赞 1-已点赞*/
api_status: boolean = false;
api_level: string = '';
api_levelHead: string = 'http';
api_levelHead: string = '';
api_userId: string = '';
api_creatorId: string = '';
api_userType: string = '';
... ...
import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource } from 'wdKit/Index';
import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource, StringUtils } from 'wdKit/Index';
import { commentItemModel, WDPublicUserType } from '../model/CommentModel';
import commentViewModel from '../viewmodel/CommentViewModel';
import { CommentText } from './CommentText';
... ... @@ -303,34 +303,7 @@ struct ChildCommentItem {
Column() {
Row() {
//头像
Stack() {
Image(this.item.fromUserHeader)
.alt($r('app.media.default_head'))
.width('24')
.height('24')
.objectFit(ImageFit.Cover)
.borderRadius(16)
Image(this.item.api_levelHead)
.width('36')
.height('36')
.objectFit(ImageFit.Cover)
.borderRadius(24)
}
.width(48)
.height(48)
.margin({ left: 47 })
.alignContent(Alignment.Center)
.onClick(() => {
// TODO 跳转个人详情
// 跳转到号主页
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
this.headerView()
//昵称
Text() {
... ... @@ -354,7 +327,7 @@ struct ChildCommentItem {
/// 人民号>置顶>作者
//人民号
if (this.item.fromUserType === WDPublicUserType.WDPublicUserType_Matrix) {
if (this.item.fromUserType !== 1) {
Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 });
}
//置顶
... ... @@ -400,6 +373,53 @@ struct ChildCommentItem {
.width('100%')
}
@Builder headerView() {
Stack() {
Stack() {
Image(this.item.fromUserHeader)
.alt($r('app.media.default_head'))
.width(24)
.height(24)
.objectFit(ImageFit.Cover)
.borderRadius(16)
if (this.item.api_authIcon && this.item.api_authIcon.length) {
Image(this.item.api_authIcon) // 加v
.width(14).height(14)
.objectFit(ImageFit.Cover)
}
}.width(24).height(24)
.alignContent(Alignment.BottomEnd)
if ((!this.item.api_authIcon || this.item.api_authIcon.length == 0)
&& this.item.fromUserType === 1
&& ((this.item.api_levelHead && this.item.api_levelHead.length > 0)
|| (this.item.avatarFrame && this.item.avatarFrame.length > 0))) {
Image(this.customBorderIconURL())
.width('36')
.height('36')
.objectFit(ImageFit.Cover)
.borderRadius(24)
}
}
.width(48).height(48)
.margin({ left: 47 })
.alignContent(Alignment.Center)
.onClick(() => {
commentViewModel.jumpToAccountPage(this.item)
})
}
customBorderIconURL() : string {
if (this.item.avatarFrame.length > 0) {
return this.item.avatarFrame
}
if (this.item.fromUserType === 1) {
return this.item.api_levelHead
}
return ""
}
replyComment() {
if (this.item.id && this.item.checkStatus == '2') { // 审核通过的才显示回复
this.publishCommentModel.rootCommentId = this.item.rootCommentId
... ... @@ -498,26 +518,7 @@ struct commentHeaderView {
Column() {
Row() {
//头像
Stack() {
Image(this.item.fromUserHeader)
.alt($r('app.media.default_head'))
.width('32')
.height('32')
.objectFit(ImageFit.Cover)
.borderRadius(16)
Image(this.item.api_levelHead)
.width('48')
.height('48')
.objectFit(ImageFit.Cover)
.borderRadius(24)
}
.width(48)
.height(48)
.margin({ left: 8 })
.alignContent(Alignment.Center)
.onClick(() => {
commentViewModel.jumpToAccountPage(this.item)
})
this.headerView()
//昵称
Text(this.item.fromUserName)
... ... @@ -531,7 +532,7 @@ struct commentHeaderView {
/// 人民号>置顶>作者
//人民号
if (this.item.fromUserType === WDPublicUserType.WDPublicUserType_Matrix) {
if (this.item.fromUserType !== 1) {
Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 });
}
//置顶
... ... @@ -573,6 +574,53 @@ struct commentHeaderView {
.padding({bottom: 8})
}
@Builder headerView() {
Stack() {
Stack() {
Image(this.item.fromUserHeader)
.alt($r('app.media.default_head'))
.width(32)
.height(32)
.objectFit(ImageFit.Cover)
.borderRadius(16)
if (this.item.api_authIcon && this.item.api_authIcon.length > 0) {
Image(this.item.api_authIcon) // 加v
.width(14).height(14)
.objectFit(ImageFit.Cover)
}
}.width(32).height(32)
.alignContent(Alignment.BottomEnd)
if ((!this.item.api_authIcon || this.item.api_authIcon.length == 0)
&& this.item.fromUserType === 1
&& ((this.item.api_levelHead && this.item.api_levelHead.length > 0)
|| (this.item.avatarFrame && this.item.avatarFrame.length > 0))) {
Image(this.customBorderIconURL())
.width(48)
.height(48)
.objectFit(ImageFit.Cover)
.borderRadius(24)
}
}
.width(48).height(48)
.margin({ left: 8 })
.alignContent(Alignment.Center)
.onClick(() => {
commentViewModel.jumpToAccountPage(this.item)
})
}
customBorderIconURL() : string {
if (this.item.avatarFrame.length > 0) {
return this.item.avatarFrame
}
if (this.item.fromUserType === 1) {
return this.item.api_levelHead
}
return ""
}
replyComment() {
if (this.item.id && this.item.checkStatus == '2') { // 审核通过的才显示回复
this.publishCommentModel.rootCommentId = this.item.rootCommentId
... ...
... ... @@ -419,7 +419,7 @@ class CommentViewModel {
newModel.fromUserHeader = model.fromUserHeader
newModel.fromUserId = model.fromUserId
newModel.fromUserName = model.fromUserName
if (model.toUserType != null) {
if (model.fromUserType) {
newModel.fromUserType = model.fromUserType
}
newModel.id = model.id
... ... @@ -443,7 +443,7 @@ class CommentViewModel {
// newModel.isLoading = model.isLoading
if (model.toUserType != null) {
if (model.toUserType) {
newModel.toUserType = model.toUserType.toString()
}
newModel.topFlag = model.topFlag
... ...