daijian_wd

组件点赞参数

export interface UserInfoDTO {
userHeadUrl:string
userHeadUrl: string
userName?: string
headPhotoUrl?: string
}
... ...
... ... @@ -13,6 +13,7 @@ import {
import DetailViewModel from '../viewmodel/DetailViewModel';
import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
import { OperRowListView } from './view/OperRowListView';
import router from '@ohos.router';
import { RecommendList } from '../components/view/RecommendList'
import { CommonConstants } from 'wdConstant';
import { HttpUrlUtils } from 'wdNetwork/Index';
... ... @@ -20,7 +21,6 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { PageRepository } from '../repository/PageRepository';
import { detailedSkeleton } from './skeleton/detailSkeleton';
import { CommentComponent } from '../components/comment/view/CommentComponent'
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
... ... @@ -75,58 +75,16 @@ export struct ImageAndTextPageComponent {
isPageEnd: $isPageEnd
})
Column() {
// 点赞
if (this.contentDetailData[0]?.openLikes) {
Row() {
Row() {
if (this.newsStatusOfUser?.likeStatus === '1') {
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active')))
.width(24)
.height(24)
.margin({ right: 5 })
} else {
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle')))
.width(24)
.height(24)
.margin({ right: 5 })
}
Text(`${this.interactData?.likeNum || 0 }`)
.fontSize(16)
.fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
.fontWeight(500)
}
.width(140)
.height(36)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.borderRadius(20)
// .border({
// width: 1,
// color: '#EDEDED',
// })
.onClick(() => {
this.toggleLikeStatus()
})
}.width(CommonConstants.FULL_WIDTH).height(80)
.justifyContent(FlexAlign.Center)
Divider().strokeWidth(6).color('#f5f5f5')
}
if (this.recommendList.length > 0) {
RecommendList({ recommendList: this.recommendList })
}
// 评论
if(this.contentDetailData[0]?.openComment){
}
}
}
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 126 })
.padding({ bottom: 76 })
.scrollBar(BarState.Off)
if (!this.isPageEnd) {
... ... @@ -134,7 +92,45 @@ export struct ImageAndTextPageComponent {
}
//底部交互区
OperRowListView({ contentDetailData: this.contentDetailData[0] })
if (this.contentDetailData?.length) {
OperRowListView({contentDetailData: this.contentDetailData[0]})
}
/* Row() {
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.onClick((event: ClickEvent) => {
router.back()
})
Row() {
Image($r('app.media.icon_comment'))
.width(24)
.height(24)
.margin({ right: 24 })
.id('comment')
Image($r('app.media.icon_star'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_listen'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_forward'))
.width(24)
.height(24)
}
}
.width(CommonConstants.FULL_WIDTH)
.height(56)
.padding({ left: 15, right: 15, bottom: 50, top: 20 })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)*/
}
}
... ...
... ... @@ -13,6 +13,7 @@ import router from '@ohos.router';
import inputMethod from '@ohos.inputMethod';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
import { LikeComponent } from './LikeComponent';
import { CommentCustomDialog } from '../comment/view/CommentCustomDialog';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../../repository/PageRepository';
... ... @@ -27,11 +28,13 @@ export interface OperationItem {
const TAG = 'OperRowListView';
@Preview
// @Preview
@Entry
@Component
export struct OperRowListView {
// private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Prop contentDetailData: ContentDetailDTO
// @Prop contentDetailData: ContentDetailDTO
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State likeBean: Record<string, string> = {}
... ... @@ -71,12 +74,13 @@ export struct OperRowListView {
// this.data['channelId'] = "2059" //必须
// this.data['status'] = "1" //必须
this.likeBean['contentId'] = this.contentDetailData.newsId + ''
this.likeBean['userName'] = this.contentDetailData.editorName + ''
this.likeBean['userName'] = this.contentDetailData.userInfo?.userName + ''
this.likeBean['contentType'] = this.contentDetailData.newsType + ''
this.likeBean['title'] = this.contentDetailData.newsTitle + ''
this.likeBean['userHeaderUrl'] = ''
this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
this.likeBean['status'] = ''
console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))
}
build() {
... ... @@ -100,7 +104,13 @@ export struct OperRowListView {
.onClick(() => {
router.back();
})
TextInput({placeholder:'说两句11...'})
Column() {
/*评论组件*/
/* CommentCustomDialog({
placeHolderText: '说两句'
})*/
}
/*TextInput({placeholder:'说两句...'})
.placeholderColor('#999999')
.placeholderFont(
{
... ... @@ -116,9 +126,9 @@ export struct OperRowListView {
.borderRadius(0)
.onClick(() => {
this.buildInputMethod()
})
})*/
}
.width('45.5%')
// .width('45.5%')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Start)
Flex({ justifyContent: FlexAlign.SpaceAround, alignItems:ItemAlign.Center }) {
... ... @@ -129,8 +139,11 @@ export struct OperRowListView {
.width('54.5%')
}
.width('100%')
.height(126)
.height(50)
.backgroundColor(Color.Black)
.margin({
bottom: 20
})
}
/**
* 组件项
... ... @@ -141,9 +154,12 @@ export struct OperRowListView {
buildOperationItem(item: OperationItem, index: number) {
Column() {
if (item.text === '点赞') {
/*点赞组件*/
if (this.likeBean?.contentId) {
LikeComponent({
data: this.likeBean
})
}
/* RelativeContainer() {
Row() {
... ... @@ -191,6 +207,7 @@ export struct OperRowListView {
}
.id(`e_icon_${index}`)*/
} else if (item.text === '收藏') {
RelativeContainer() {
Row() {
Image(this.newsStatusOfUser?.collectStatus == 1 ? item.icon_check : item.icon)
... ... @@ -236,7 +253,7 @@ export struct OperRowListView {
}
.id(`e_icon_${index}`)
} else if (item.text === '评论') {
RelativeContainer() {
/* RelativeContainer() {
Row() {
Image(item.icon)
.width(24)
... ... @@ -279,7 +296,7 @@ export struct OperRowListView {
.id(`e_row3_${index}`)
}
}
.id(`e_icon_${index}`)
.id(`e_icon_${index}`)*/
} else {
RelativeContainer() {
Row() {
... ...