chengen02

-fix 评论展示bug修复

  1 +import { ContentDetailDTO, InteractDataDTO, PageInfoDTO } from 'wdBean/Index'
  2 +
  3 +import { CommentListDialogView, publishCommentModel } from '../../../../Index'
  4 +
  5 +@Component
  6 +export struct CommentDialogView {
  7 + @Link @Watch('showCommentListChange') showCommentList: boolean
  8 + @Link index: number
  9 + @Link currentIndex: number
  10 + @Link publishCommentModel: publishCommentModel
  11 + @Consume contentDetailData: ContentDetailDTO
  12 + @Link interactData: InteractDataDTO
  13 + @State fakePageInfo: PageInfoDTO = {} as PageInfoDTO
  14 + @State dialogOffsetY: number = 0 // (this.windowHeight - this.windowWidth * 9 / 16)
  15 +
  16 + @State @Watch("innerShowCommentChange") innerShowComment: boolean = false
  17 +
  18 + showCommentListChange(val: boolean) {
  19 + if (this.showCommentList && this.index === this.currentIndex) {
  20 + this.innerShowComment = true
  21 + } else {
  22 + this.innerShowComment = false
  23 + }
  24 + }
  25 +
  26 + innerShowCommentChange() {
  27 + this.showCommentList = this.innerShowComment
  28 + }
  29 +
  30 + build() {
  31 + CommentListDialogView({
  32 + showCommentList: this.innerShowComment,
  33 + contentDetailData: this.contentDetailData,
  34 + publishCommentModel: this.publishCommentModel,
  35 + pageInfo: this.fakePageInfo,
  36 + onClose: () => {
  37 + this.showCommentList = false
  38 + if (Number.parseInt(this.publishCommentModel.totalCommentNumer) > Number.parseInt(this.interactData.commentNum + "")) {
  39 + this.interactData.commentNum = Number.parseInt(this.publishCommentModel.totalCommentNumer)
  40 + }
  41 + }
  42 + })
  43 + }
  44 +}
1 -import { Action, H5ReceiveDetailBean, ContentDetailDTO } from 'wdBean'; 1 +import { Action, H5ReceiveDetailBean, ContentDetailDTO, InteractDataDTO } from 'wdBean';
2 import { WdWebComponent } from 'wdWebComponent'; 2 import { WdWebComponent } from 'wdWebComponent';
3 import router from '@ohos.router'; 3 import router from '@ohos.router';
4 import { CommonConstants } from 'wdConstant' 4 import { CommonConstants } from 'wdConstant'
@@ -13,6 +13,7 @@ import { NetworkUtil, WindowModel } from 'wdKit'; @@ -13,6 +13,7 @@ import { NetworkUtil, WindowModel } from 'wdKit';
13 import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' 13 import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
14 import { common } from '@kit.AbilityKit'; 14 import { common } from '@kit.AbilityKit';
15 import { PageRepository } from '../repository/PageRepository'; 15 import { PageRepository } from '../repository/PageRepository';
  16 +import { CommentDialogView } from './CommentDialogView';
16 17
17 const TAG: string = 'SpacialTopicPageComponent' 18 const TAG: string = 'SpacialTopicPageComponent'
18 19
@@ -23,7 +24,11 @@ export struct SpacialTopicPageComponent { @@ -23,7 +24,11 @@ export struct SpacialTopicPageComponent {
23 action: Action = {} as Action 24 action: Action = {} as Action
24 @State webUrl: string = ''; 25 @State webUrl: string = '';
25 @State subjectData: string = ''; 26 @State subjectData: string = '';
  27 + @State index: number = 0
  28 + @State currentIndex: number = 0
26 @State isPageEnd: boolean = false 29 @State isPageEnd: boolean = false
  30 + @State showCommentList: boolean = false
  31 + @State interactData: InteractDataDTO = {} as InteractDataDTO
27 @Prop reload: number = 0; 32 @Prop reload: number = 0;
28 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 33 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
29 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean 34 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
@@ -185,6 +190,16 @@ export struct SpacialTopicPageComponent { @@ -185,6 +190,16 @@ export struct SpacialTopicPageComponent {
185 publishCommentModel: this.publishCommentModel, 190 publishCommentModel: this.publishCommentModel,
186 operationButtonList: this.operationButtonList, 191 operationButtonList: this.operationButtonList,
187 styleType: 1, 192 styleType: 1,
  193 + onCommentIconClick:()=>{
  194 + this.showCommentList = true
  195 + }
  196 + })
  197 + CommentDialogView({
  198 + index: $index,
  199 + currentIndex: $currentIndex,
  200 + showCommentList: $showCommentList,
  201 + publishCommentModel: $publishCommentModel,
  202 + interactData: $interactData,
188 }) 203 })
189 } 204 }
190 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) 205 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
@@ -48,6 +48,7 @@ export struct OperRowListView { @@ -48,6 +48,7 @@ export struct OperRowListView {
48 private onCommentFocus: () => void = () => { 48 private onCommentFocus: () => void = () => {
49 } 49 }
50 private onCommentIconClick: () => void = () => { 50 private onCommentIconClick: () => void = () => {
  51 +
51 } 52 }
52 53
53 @Provide inDialog: boolean = false 54 @Provide inDialog: boolean = false
@@ -252,6 +253,9 @@ export struct OperRowListView { @@ -252,6 +253,9 @@ export struct OperRowListView {
252 @Builder 253 @Builder
253 builderComment() { 254 builderComment() {
254 Column() { 255 Column() {
  256 + // Text((this.contentDetailData.openComment == 1).toString())
  257 + // Text((this.contentDetailData.commentDisplay == 1).toString())
  258 + // Text(this.publishCommentModel?.targetId.toString())
255 if (this.contentDetailData.openComment == 1 259 if (this.contentDetailData.openComment == 1
256 && this.contentDetailData.commentDisplay == 1 260 && this.contentDetailData.commentDisplay == 1
257 && this.publishCommentModel?.targetId) { 261 && this.publishCommentModel?.targetId) {
@@ -284,9 +288,10 @@ export struct OperRowListView { @@ -284,9 +288,10 @@ export struct OperRowListView {
284 contentDetail: this.contentDetailData 288 contentDetail: this.contentDetailData
285 }) 289 })
286 .onClick(() => { 290 .onClick(() => {
  291 + console.log('akdbakdbakdbaksjd')
287 this.onCommentIconClick() 292 this.onCommentIconClick()
288 293
289 - console.log(JSON.stringify(this.dialogController?.open)) 294 + // console.log('his.dialogController?.open',JSON.stringify(this.dialogController))
290 295
291 // 评论弹框内部嵌入 296 // 评论弹框内部嵌入
292 !this.showBackIcon && this.dialogController?.open() 297 !this.showBackIcon && this.dialogController?.open()