daijian_wd

组件点赞参数

1 export interface UserInfoDTO { 1 export interface UserInfoDTO {
2 - userHeadUrl:string 2 + userHeadUrl: string
  3 + userName?: string
  4 + headPhotoUrl?: string
3 } 5 }
@@ -13,6 +13,7 @@ import { @@ -13,6 +13,7 @@ import {
13 import DetailViewModel from '../viewmodel/DetailViewModel'; 13 import DetailViewModel from '../viewmodel/DetailViewModel';
14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; 14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
15 import { OperRowListView } from './view/OperRowListView'; 15 import { OperRowListView } from './view/OperRowListView';
  16 +import router from '@ohos.router';
16 import { RecommendList } from '../components/view/RecommendList' 17 import { RecommendList } from '../components/view/RecommendList'
17 import { CommonConstants } from 'wdConstant'; 18 import { CommonConstants } from 'wdConstant';
18 import { HttpUrlUtils } from 'wdNetwork/Index'; 19 import { HttpUrlUtils } from 'wdNetwork/Index';
@@ -20,7 +21,6 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; @@ -20,7 +21,6 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
20 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 21 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
21 import { PageRepository } from '../repository/PageRepository'; 22 import { PageRepository } from '../repository/PageRepository';
22 import { detailedSkeleton } from './skeleton/detailSkeleton'; 23 import { detailedSkeleton } from './skeleton/detailSkeleton';
23 -import { CommentComponent } from '../components/comment/view/CommentComponent'  
24 24
25 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; 25 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
26 26
@@ -75,58 +75,16 @@ export struct ImageAndTextPageComponent { @@ -75,58 +75,16 @@ export struct ImageAndTextPageComponent {
75 isPageEnd: $isPageEnd 75 isPageEnd: $isPageEnd
76 }) 76 })
77 Column() { 77 Column() {
78 - // 点赞  
79 - if (this.contentDetailData[0]?.openLikes) {  
80 - Row() {  
81 - Row() {  
82 - if (this.newsStatusOfUser?.likeStatus === '1') {  
83 - 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')))  
84 - .width(24)  
85 - .height(24)  
86 - .margin({ right: 5 })  
87 - } else {  
88 - 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')))  
89 - .width(24)  
90 - .height(24)  
91 - .margin({ right: 5 })  
92 - }  
93 - Text(`${this.interactData?.likeNum || 0 }`)  
94 - .fontSize(16)  
95 - .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')  
96 - .fontWeight(500)  
97 - }  
98 - .width(140)  
99 - .height(36)  
100 - .justifyContent(FlexAlign.Center)  
101 - .alignItems(VerticalAlign.Center)  
102 - .borderRadius(20)  
103 - // .border({  
104 - // width: 1,  
105 - // color: '#EDEDED',  
106 - // })  
107 - .onClick(() => {  
108 - this.toggleLikeStatus()  
109 - })  
110 -  
111 - }.width(CommonConstants.FULL_WIDTH).height(80)  
112 - .justifyContent(FlexAlign.Center)  
113 -  
114 - Divider().strokeWidth(6).color('#f5f5f5')  
115 - }  
116 if (this.recommendList.length > 0) { 78 if (this.recommendList.length > 0) {
117 RecommendList({ recommendList: this.recommendList }) 79 RecommendList({ recommendList: this.recommendList })
118 } 80 }
119 - // 评论  
120 - if(this.contentDetailData[0]?.openComment){  
121 -  
122 - }  
123 } 81 }
124 } 82 }
125 83
126 } 84 }
127 .width(CommonConstants.FULL_WIDTH) 85 .width(CommonConstants.FULL_WIDTH)
128 .height(CommonConstants.FULL_HEIGHT) 86 .height(CommonConstants.FULL_HEIGHT)
129 - .padding({ bottom: 126 }) 87 + .padding({ bottom: 76 })
130 .scrollBar(BarState.Off) 88 .scrollBar(BarState.Off)
131 89
132 if (!this.isPageEnd) { 90 if (!this.isPageEnd) {
@@ -134,7 +92,45 @@ export struct ImageAndTextPageComponent { @@ -134,7 +92,45 @@ export struct ImageAndTextPageComponent {
134 } 92 }
135 93
136 //底部交互区 94 //底部交互区
137 - OperRowListView({ contentDetailData: this.contentDetailData[0] }) 95 + if (this.contentDetailData?.length) {
  96 + OperRowListView({contentDetailData: this.contentDetailData[0]})
  97 + }
  98 + /* Row() {
  99 + Image($r('app.media.icon_arrow_left'))
  100 + .width(24)
  101 + .height(24)
  102 + .onClick((event: ClickEvent) => {
  103 + router.back()
  104 + })
  105 +
  106 + Row() {
  107 + Image($r('app.media.icon_comment'))
  108 + .width(24)
  109 + .height(24)
  110 + .margin({ right: 24 })
  111 + .id('comment')
  112 +
  113 + Image($r('app.media.icon_star'))
  114 + .width(24)
  115 + .height(24)
  116 + .margin({ right: 24 })
  117 +
  118 + Image($r('app.media.icon_listen'))
  119 + .width(24)
  120 + .height(24)
  121 + .margin({ right: 24 })
  122 +
  123 + Image($r('app.media.icon_forward'))
  124 + .width(24)
  125 + .height(24)
  126 +
  127 + }
  128 + }
  129 + .width(CommonConstants.FULL_WIDTH)
  130 + .height(56)
  131 + .padding({ left: 15, right: 15, bottom: 50, top: 20 })
  132 + .justifyContent(FlexAlign.SpaceBetween)
  133 + .backgroundColor(Color.White)*/
138 } 134 }
139 135
140 } 136 }
@@ -13,6 +13,7 @@ import router from '@ohos.router'; @@ -13,6 +13,7 @@ import router from '@ohos.router';
13 import inputMethod from '@ohos.inputMethod'; 13 import inputMethod from '@ohos.inputMethod';
14 import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; 14 import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
15 import { LikeComponent } from './LikeComponent'; 15 import { LikeComponent } from './LikeComponent';
  16 +import { CommentCustomDialog } from '../comment/view/CommentCustomDialog';
16 import { HttpUrlUtils } from 'wdNetwork/Index'; 17 import { HttpUrlUtils } from 'wdNetwork/Index';
17 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 18 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
18 import { PageRepository } from '../../repository/PageRepository'; 19 import { PageRepository } from '../../repository/PageRepository';
@@ -27,11 +28,13 @@ export interface OperationItem { @@ -27,11 +28,13 @@ export interface OperationItem {
27 28
28 const TAG = 'OperRowListView'; 29 const TAG = 'OperRowListView';
29 30
30 -@Preview 31 +// @Preview
  32 +@Entry
31 @Component 33 @Component
32 export struct OperRowListView { 34 export struct OperRowListView {
33 // private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 35 // private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
34 - @Prop contentDetailData: ContentDetailDTO 36 + // @Prop contentDetailData: ContentDetailDTO
  37 + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
35 @State interactData: InteractDataDTO = {} as InteractDataDTO 38 @State interactData: InteractDataDTO = {} as InteractDataDTO
36 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 39 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
37 @State likeBean: Record<string, string> = {} 40 @State likeBean: Record<string, string> = {}
@@ -71,12 +74,13 @@ export struct OperRowListView { @@ -71,12 +74,13 @@ export struct OperRowListView {
71 // this.data['channelId'] = "2059" //必须 74 // this.data['channelId'] = "2059" //必须
72 // this.data['status'] = "1" //必须 75 // this.data['status'] = "1" //必须
73 this.likeBean['contentId'] = this.contentDetailData.newsId + '' 76 this.likeBean['contentId'] = this.contentDetailData.newsId + ''
74 - this.likeBean['userName'] = this.contentDetailData.editorName + '' 77 + this.likeBean['userName'] = this.contentDetailData.userInfo?.userName + ''
75 this.likeBean['contentType'] = this.contentDetailData.newsType + '' 78 this.likeBean['contentType'] = this.contentDetailData.newsType + ''
76 this.likeBean['title'] = this.contentDetailData.newsTitle + '' 79 this.likeBean['title'] = this.contentDetailData.newsTitle + ''
77 - this.likeBean['userHeaderUrl'] = '' 80 + this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
78 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' 81 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
79 - this.likeBean['status'] = '' 82 + console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
  83 + console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))
80 } 84 }
81 85
82 build() { 86 build() {
@@ -100,7 +104,13 @@ export struct OperRowListView { @@ -100,7 +104,13 @@ export struct OperRowListView {
100 .onClick(() => { 104 .onClick(() => {
101 router.back(); 105 router.back();
102 }) 106 })
103 - TextInput({placeholder:'说两句11...'}) 107 + Column() {
  108 + /*评论组件*/
  109 + /* CommentCustomDialog({
  110 + placeHolderText: '说两句'
  111 + })*/
  112 + }
  113 + /*TextInput({placeholder:'说两句...'})
104 .placeholderColor('#999999') 114 .placeholderColor('#999999')
105 .placeholderFont( 115 .placeholderFont(
106 { 116 {
@@ -116,9 +126,9 @@ export struct OperRowListView { @@ -116,9 +126,9 @@ export struct OperRowListView {
116 .borderRadius(0) 126 .borderRadius(0)
117 .onClick(() => { 127 .onClick(() => {
118 this.buildInputMethod() 128 this.buildInputMethod()
119 - }) 129 + })*/
120 } 130 }
121 - .width('45.5%') 131 + // .width('45.5%')
122 .alignItems(VerticalAlign.Center) 132 .alignItems(VerticalAlign.Center)
123 .justifyContent(FlexAlign.Start) 133 .justifyContent(FlexAlign.Start)
124 Flex({ justifyContent: FlexAlign.SpaceAround, alignItems:ItemAlign.Center }) { 134 Flex({ justifyContent: FlexAlign.SpaceAround, alignItems:ItemAlign.Center }) {
@@ -129,8 +139,11 @@ export struct OperRowListView { @@ -129,8 +139,11 @@ export struct OperRowListView {
129 .width('54.5%') 139 .width('54.5%')
130 } 140 }
131 .width('100%') 141 .width('100%')
132 - .height(126) 142 + .height(50)
133 .backgroundColor(Color.Black) 143 .backgroundColor(Color.Black)
  144 + .margin({
  145 + bottom: 20
  146 + })
134 } 147 }
135 /** 148 /**
136 * 组件项 149 * 组件项
@@ -141,9 +154,12 @@ export struct OperRowListView { @@ -141,9 +154,12 @@ export struct OperRowListView {
141 buildOperationItem(item: OperationItem, index: number) { 154 buildOperationItem(item: OperationItem, index: number) {
142 Column() { 155 Column() {
143 if (item.text === '点赞') { 156 if (item.text === '点赞') {
144 - LikeComponent({  
145 - data: this.likeBean  
146 - }) 157 + /*点赞组件*/
  158 + if (this.likeBean?.contentId) {
  159 + LikeComponent({
  160 + data: this.likeBean
  161 + })
  162 + }
147 163
148 /* RelativeContainer() { 164 /* RelativeContainer() {
149 Row() { 165 Row() {
@@ -191,6 +207,7 @@ export struct OperRowListView { @@ -191,6 +207,7 @@ export struct OperRowListView {
191 } 207 }
192 .id(`e_icon_${index}`)*/ 208 .id(`e_icon_${index}`)*/
193 } else if (item.text === '收藏') { 209 } else if (item.text === '收藏') {
  210 +
194 RelativeContainer() { 211 RelativeContainer() {
195 Row() { 212 Row() {
196 Image(this.newsStatusOfUser?.collectStatus == 1 ? item.icon_check : item.icon) 213 Image(this.newsStatusOfUser?.collectStatus == 1 ? item.icon_check : item.icon)
@@ -236,7 +253,7 @@ export struct OperRowListView { @@ -236,7 +253,7 @@ export struct OperRowListView {
236 } 253 }
237 .id(`e_icon_${index}`) 254 .id(`e_icon_${index}`)
238 } else if (item.text === '评论') { 255 } else if (item.text === '评论') {
239 - RelativeContainer() { 256 + /* RelativeContainer() {
240 Row() { 257 Row() {
241 Image(item.icon) 258 Image(item.icon)
242 .width(24) 259 .width(24)
@@ -279,7 +296,7 @@ export struct OperRowListView { @@ -279,7 +296,7 @@ export struct OperRowListView {
279 .id(`e_row3_${index}`) 296 .id(`e_row3_${index}`)
280 } 297 }
281 } 298 }
282 - .id(`e_icon_${index}`) 299 + .id(`e_icon_${index}`)*/
283 } else { 300 } else {
284 RelativeContainer() { 301 RelativeContainer() {
285 Row() { 302 Row() {