daijian_wd

组件点赞

... ... @@ -12,6 +12,7 @@ import {
} from 'wdBean';
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';
... ... @@ -91,7 +92,8 @@ export struct ImageAndTextPageComponent {
}
//底部交互区
Row() {
OperRowListView({contentDetailData: this.contentDetailData[0]})
/* Row() {
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
... ... @@ -126,7 +128,7 @@ export struct ImageAndTextPageComponent {
.height(56)
.padding({ left: 15, right: 15, bottom: 50, top: 20 })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
.backgroundColor(Color.White)*/
}
}
... ...
... ... @@ -12,6 +12,7 @@ import {
import router from '@ohos.router';
import inputMethod from '@ohos.inputMethod';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
import { LikeComponent } from './LikeComponent';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../../repository/PageRepository';
... ... @@ -29,9 +30,11 @@ const TAG = 'OperRowListView';
@Preview
@Component
export struct OperRowListView {
private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
// private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Prop contentDetailData: ContentDetailDTO
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State likeBean: Record<string, string> = {}
@State operationList: OperationItem[] = [
{
... ... @@ -60,6 +63,20 @@ export struct OperRowListView {
this.getInteractDataStatus()
}
this.queryContentInteractCount()
// 点赞需要数据
// this.data['userName'] = '人民日报网友2kD2xW'
// this.data['contentType'] = '8' //必须
// this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学'
// this.data['userHeaderUrl'] = ""
// this.data['channelId'] = "2059" //必须
// this.data['status'] = "1" //必须
this.likeBean['contentId'] = this.contentDetailData.newsId + ''
this.likeBean['userName'] = this.contentDetailData.editorName + ''
this.likeBean['contentType'] = this.contentDetailData.newsType + ''
this.likeBean['title'] = this.contentDetailData.newsTitle + ''
this.likeBean['userHeaderUrl'] = ''
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
this.likeBean['status'] = ''
}
build() {
... ... @@ -83,7 +100,7 @@ export struct OperRowListView {
.onClick(() => {
router.back();
})
TextInput({placeholder:'说两句...'})
TextInput({placeholder:'说两句11...'})
.placeholderColor('#999999')
.placeholderFont(
{
... ... @@ -112,10 +129,9 @@ export struct OperRowListView {
.width('54.5%')
}
.width('100%')
.height(56)
.height(126)
.backgroundColor(Color.Black)
}
/**
* 组件项
*
... ... @@ -125,7 +141,11 @@ export struct OperRowListView {
buildOperationItem(item: OperationItem, index: number) {
Column() {
if (item.text === '点赞') {
RelativeContainer() {
LikeComponent({
data: this.likeBean
})
/* RelativeContainer() {
Row() {
Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon)
.width(24)
... ... @@ -134,6 +154,7 @@ export struct OperRowListView {
.interpolation(ImageInterpolation.High)
.onClick(() => {
this.toggleLikeStatus()
console.log('点赞_111', JSON.stringify(this.contentDetailData))
})
}
.alignRules({
... ... @@ -168,7 +189,7 @@ export struct OperRowListView {
.id(`e_row3_${index}`)
}
}
.id(`e_icon_${index}`)
.id(`e_icon_${index}`)*/
} else if (item.text === '收藏') {
RelativeContainer() {
Row() {
... ...