ref |> 调整评论弹框弹出后,点击头像进号主页 评论弹框没有关闭问题
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
11 changed files
with
227 additions
and
119 deletions
| @@ -64,4 +64,7 @@ export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/Mpaas | @@ -64,4 +64,7 @@ export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/Mpaas | ||
| 64 | 64 | ||
| 65 | export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM' | 65 | export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM' |
| 66 | 66 | ||
| 67 | -export { FastClickUtil } from './src/main/ets/utils/FastClickUtil'; | ||
| 67 | +export { FastClickUtil } from './src/main/ets/utils/FastClickUtil'; | ||
| 68 | + | ||
| 69 | +// export { PublicPopupDialogView } from "./src/main/ets/pubComps/dialog/PublicPopupDialogView" | ||
| 70 | +export { PublicDialogManager, CloseAction } from "./src/main/ets/pubComps/dialog/PublicDialogManager" |
| 1 | + | ||
| 2 | +export type CloseAction = () => void | ||
| 3 | + | ||
| 4 | +export class PublicDialogManager { | ||
| 5 | + | ||
| 6 | + private dialogControllers: CustomDialogController[] = [] | ||
| 7 | + private closeActions: CloseAction[] = [] | ||
| 8 | + | ||
| 9 | + private constructor() { | ||
| 10 | + } | ||
| 11 | + private static manager: PublicDialogManager | ||
| 12 | + static shareInstance(): PublicDialogManager { | ||
| 13 | + if (!PublicDialogManager.manager) { | ||
| 14 | + PublicDialogManager.manager = new PublicDialogManager() | ||
| 15 | + } | ||
| 16 | + return PublicDialogManager.manager | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + openDialog(dialogController: CustomDialogController, closeAction: CloseAction) { | ||
| 20 | + if (!dialogController) { | ||
| 21 | + return | ||
| 22 | + } | ||
| 23 | + dialogController.open() | ||
| 24 | + this.dialogControllers.push(dialogController) | ||
| 25 | + this.closeActions.push(closeAction) | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + closeDialog(dialogController: CustomDialogController) { | ||
| 29 | + if (!dialogController) { | ||
| 30 | + return | ||
| 31 | + } | ||
| 32 | + dialogController.close() | ||
| 33 | + const index = this.dialogControllers.indexOf(dialogController) | ||
| 34 | + if (index != -1) { | ||
| 35 | + this.dialogControllers.splice(index, 1) | ||
| 36 | + this.closeActions.splice(index, 1)[0]() | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + closeLastDialog() { | ||
| 41 | + const count = this.dialogControllers.length | ||
| 42 | + if (count > 0) { | ||
| 43 | + this.closeDialog(this.dialogControllers[count - 1]) | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | +} |
| 1 | +import { PublicDialogManager } from './PublicDialogManager' | ||
| 2 | + | ||
| 3 | +/* | ||
| 4 | + * 公共自定义弹出框,上层赋值showPopup变量,决定是否显示 | ||
| 5 | + * | ||
| 6 | + * 当上层需要关闭,调用 PublicDialogManager.shareInstance().closeDialog(dialogController) 关闭 | ||
| 7 | + * | ||
| 8 | + * ===> customBuilder 当前传值有问题,用不了 | ||
| 9 | + */ | ||
| 10 | +@Component | ||
| 11 | +struct PublicPopupDialogView { | ||
| 12 | + | ||
| 13 | + // 决定是否显示变量 | ||
| 14 | + @Link @Watch('showPopupAction') showPopup: boolean | ||
| 15 | + | ||
| 16 | + // 自定义弹框的 @CustomDialog | ||
| 17 | + private customBuilder: Object | null = null | ||
| 18 | + | ||
| 19 | + private autoCancel: boolean = false | ||
| 20 | + | ||
| 21 | + dialogController: CustomDialogController = new CustomDialogController({ | ||
| 22 | + builder: this.customBuilder, | ||
| 23 | + autoCancel: this.autoCancel, | ||
| 24 | + cancel: () => { | ||
| 25 | + this.showPopup = false | ||
| 26 | + }, | ||
| 27 | + customStyle: true, | ||
| 28 | + alignment: DialogAlignment.Bottom, | ||
| 29 | + }) | ||
| 30 | + | ||
| 31 | + showPopupAction(val: boolean) { | ||
| 32 | + if (this.showPopup) { | ||
| 33 | + PublicDialogManager.shareInstance().openDialog(this.dialogController, this.closeAction) | ||
| 34 | + } else { | ||
| 35 | + PublicDialogManager.shareInstance().closeDialog(this.dialogController) | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Builder emptyBuild() { | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + closeAction() { | ||
| 44 | + this.showPopup = false | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + build() { | ||
| 48 | + this.emptyBuild() | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | +} | ||
| 52 | + |
| @@ -97,4 +97,6 @@ export { PageRepository } from './src/main/ets/repository/PageRepository'; | @@ -97,4 +97,6 @@ export { PageRepository } from './src/main/ets/repository/PageRepository'; | ||
| 97 | 97 | ||
| 98 | export { MultiPictureDetailViewModel } from './src/main/ets/viewmodel/MultiPictureDetailViewModel'; | 98 | export { MultiPictureDetailViewModel } from './src/main/ets/viewmodel/MultiPictureDetailViewModel'; |
| 99 | 99 | ||
| 100 | -export { viewBlogItemInsightIntentShare } from './src/main/ets/utils/InsightIntentShare'; | ||
| 100 | +export { viewBlogItemInsightIntentShare } from './src/main/ets/utils/InsightIntentShare'; | ||
| 101 | + | ||
| 102 | +export { CommentListDialogView } from './src/main/ets/components/comment/view/CommentListDialog'; |
| 1 | -import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource, StringUtils } from 'wdKit/Index'; | 1 | +import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource, |
| 2 | + PublicDialogManager, | ||
| 3 | + StringUtils } from 'wdKit/Index'; | ||
| 2 | import { commentItemModel, WDPublicUserType } from '../model/CommentModel'; | 4 | import { commentItemModel, WDPublicUserType } from '../model/CommentModel'; |
| 3 | import commentViewModel from '../viewmodel/CommentViewModel'; | 5 | import commentViewModel from '../viewmodel/CommentViewModel'; |
| 4 | import { CommentText } from './CommentText'; | 6 | import { CommentText } from './CommentText'; |
| @@ -40,6 +42,9 @@ export struct CommentComponent { | @@ -40,6 +42,9 @@ export struct CommentComponent { | ||
| 40 | @Prop @Watch("parentOnReachEnd") reachEndIncreament: number = 0 | 42 | @Prop @Watch("parentOnReachEnd") reachEndIncreament: number = 0 |
| 41 | reachEndLoadMoreFinish?: () => void | 43 | reachEndLoadMoreFinish?: () => void |
| 42 | 44 | ||
| 45 | + // 是否在弹框中 | ||
| 46 | + @Provide inDialog: boolean = false | ||
| 47 | + | ||
| 43 | // 在自定义组件即将析构销毁时将dialogControlle置空 | 48 | // 在自定义组件即将析构销毁时将dialogControlle置空 |
| 44 | aboutToDisappear() { | 49 | aboutToDisappear() { |
| 45 | this.dialogController = null // 将dialogController置空 | 50 | this.dialogController = null // 将dialogController置空 |
| @@ -299,6 +304,8 @@ struct ChildCommentItem { | @@ -299,6 +304,8 @@ struct ChildCommentItem { | ||
| 299 | @ObjectLink item: commentItemModel | 304 | @ObjectLink item: commentItemModel |
| 300 | @Consume contentDetailData: ContentDetailDTO | 305 | @Consume contentDetailData: ContentDetailDTO |
| 301 | 306 | ||
| 307 | + @Consume inDialog: boolean | ||
| 308 | + | ||
| 302 | build() { | 309 | build() { |
| 303 | Column() { | 310 | Column() { |
| 304 | Row() { | 311 | Row() { |
| @@ -406,7 +413,12 @@ struct ChildCommentItem { | @@ -406,7 +413,12 @@ struct ChildCommentItem { | ||
| 406 | .margin({ left: 47 }) | 413 | .margin({ left: 47 }) |
| 407 | .alignContent(Alignment.Center) | 414 | .alignContent(Alignment.Center) |
| 408 | .onClick(() => { | 415 | .onClick(() => { |
| 409 | - commentViewModel.jumpToAccountPage(this.item) | 416 | + |
| 417 | + commentViewModel.jumpToAccountPage(this.item, () => { | ||
| 418 | + if (this.inDialog) { | ||
| 419 | + PublicDialogManager.shareInstance().closeLastDialog() | ||
| 420 | + } | ||
| 421 | + }) | ||
| 410 | }) | 422 | }) |
| 411 | } | 423 | } |
| 412 | 424 | ||
| @@ -514,6 +526,8 @@ struct commentHeaderView { | @@ -514,6 +526,8 @@ struct commentHeaderView { | ||
| 514 | @Link dialogController: CustomDialogController | null | 526 | @Link dialogController: CustomDialogController | null |
| 515 | @ObjectLink item: commentItemModel | 527 | @ObjectLink item: commentItemModel |
| 516 | 528 | ||
| 529 | + @Consume inDialog: boolean | ||
| 530 | + | ||
| 517 | build() { | 531 | build() { |
| 518 | Column() { | 532 | Column() { |
| 519 | Row() { | 533 | Row() { |
| @@ -607,7 +621,12 @@ struct commentHeaderView { | @@ -607,7 +621,12 @@ struct commentHeaderView { | ||
| 607 | .margin({ left: 8 }) | 621 | .margin({ left: 8 }) |
| 608 | .alignContent(Alignment.Center) | 622 | .alignContent(Alignment.Center) |
| 609 | .onClick(() => { | 623 | .onClick(() => { |
| 610 | - commentViewModel.jumpToAccountPage(this.item) | 624 | + |
| 625 | + commentViewModel.jumpToAccountPage(this.item, () => { | ||
| 626 | + if (this.inDialog) { | ||
| 627 | + PublicDialogManager.shareInstance().closeLastDialog() | ||
| 628 | + } | ||
| 629 | + }) | ||
| 611 | }) | 630 | }) |
| 612 | } | 631 | } |
| 613 | 632 | ||
| @@ -640,6 +659,8 @@ struct commentFooterView { | @@ -640,6 +659,8 @@ struct commentFooterView { | ||
| 640 | @Link dialogController: CustomDialogController | null | 659 | @Link dialogController: CustomDialogController | null |
| 641 | @ObjectLink item: commentItemModel | 660 | @ObjectLink item: commentItemModel |
| 642 | 661 | ||
| 662 | + @Consume inDialog: boolean | ||
| 663 | + | ||
| 643 | build() { | 664 | build() { |
| 644 | Row() { | 665 | Row() { |
| 645 | 666 | ||
| @@ -710,6 +731,9 @@ struct commentFooterView { | @@ -710,6 +731,9 @@ struct commentFooterView { | ||
| 710 | // 未登录,跳转登录 | 731 | // 未登录,跳转登录 |
| 711 | const user_id = HttpUtils.getUserId() | 732 | const user_id = HttpUtils.getUserId() |
| 712 | if (!user_id) { | 733 | if (!user_id) { |
| 734 | + if (this.inDialog) { | ||
| 735 | + PublicDialogManager.shareInstance().closeLastDialog() | ||
| 736 | + } | ||
| 713 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 737 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 714 | return | 738 | return |
| 715 | } | 739 | } |
| 1 | import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index' | 1 | import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index' |
| 2 | +import { PublicDialogManager } from 'wdKit/Index' | ||
| 3 | +import { TrackConstants } from 'wdTracking/Index' | ||
| 2 | import { OperRowListView } from '../../view/OperRowListView' | 4 | import { OperRowListView } from '../../view/OperRowListView' |
| 3 | import { publishCommentModel } from '../model/PublishCommentModel' | 5 | import { publishCommentModel } from '../model/PublishCommentModel' |
| 4 | import { CommentComponent } from './CommentComponent' | 6 | import { CommentComponent } from './CommentComponent' |
| 5 | 7 | ||
| 6 | /// 评论列表弹框 | 8 | /// 评论列表弹框 |
| 9 | +@Component | ||
| 10 | +export struct CommentListDialogView { | ||
| 11 | + @Link @Watch('showCommentListChange') showCommentList: boolean | ||
| 12 | + @Link contentDetailData: ContentDetailDTO // 详情页传 | ||
| 13 | + @Link pageInfo: PageInfoDTO // 专题页传 | ||
| 14 | + onClose?: () => void | ||
| 15 | + | ||
| 16 | + // @Consume pageId: TrackConstants.PageName | ||
| 17 | + // @Consume pageName: TrackConstants.PageName | ||
| 18 | + | ||
| 19 | + private dialogController: CustomDialogController = new CustomDialogController({ | ||
| 20 | + builder: CommentListDialog({ | ||
| 21 | + contentDetailData: this.contentDetailData, | ||
| 22 | + pageInfo: this.pageInfo, | ||
| 23 | + onClose: this.onClose | ||
| 24 | + }), | ||
| 25 | + autoCancel: false, | ||
| 26 | + customStyle: true, | ||
| 27 | + alignment: DialogAlignment.Bottom, | ||
| 28 | + }) | ||
| 29 | + | ||
| 30 | + showCommentListChange(val: boolean) { | ||
| 31 | + if (this.showCommentList) { | ||
| 32 | + PublicDialogManager.shareInstance().openDialog(this.dialogController, this.closeAction.bind(this)) | ||
| 33 | + } else { | ||
| 34 | + PublicDialogManager.shareInstance().closeDialog(this.dialogController) | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + closeAction() { | ||
| 39 | + this.showCommentList = false | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + build() { | ||
| 43 | + } | ||
| 44 | +} | ||
| 45 | + | ||
| 7 | @CustomDialog | 46 | @CustomDialog |
| 8 | -export struct CommentListDialog { | 47 | +struct CommentListDialog { |
| 9 | 48 | ||
| 10 | /// 内部使用 | 49 | /// 内部使用 |
| 11 | @State private publishCommentModel: publishCommentModel = new publishCommentModel() | 50 | @State private publishCommentModel: publishCommentModel = new publishCommentModel() |
| @@ -15,12 +54,12 @@ export struct CommentListDialog { | @@ -15,12 +54,12 @@ export struct CommentListDialog { | ||
| 15 | @State windowHeight: number = AppStorage.get<number>('windowHeight') || 0 | 54 | @State windowHeight: number = AppStorage.get<number>('windowHeight') || 0 |
| 16 | 55 | ||
| 17 | /// 外部初始化 | 56 | /// 外部初始化 |
| 18 | - @Consume contentDetailData: ContentDetailDTO // 详情页传 | ||
| 19 | - @Consume pageInfo: PageInfoDTO // 专题页传 | 57 | + @Link contentDetailData: ContentDetailDTO // 详情页传 |
| 58 | + @Link pageInfo: PageInfoDTO // 专题页传 | ||
| 20 | onClose?: () => void | 59 | onClose?: () => void |
| 21 | 60 | ||
| 22 | aboutToAppear(): void { | 61 | aboutToAppear(): void { |
| 23 | - if (this.contentDetailData) { | 62 | + if (this.contentDetailData.newsId) { |
| 24 | if (this.contentDetailData?.openComment) { | 63 | if (this.contentDetailData?.openComment) { |
| 25 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 64 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 26 | this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') | 65 | this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| @@ -33,11 +72,17 @@ export struct CommentListDialog { | @@ -33,11 +72,17 @@ export struct CommentListDialog { | ||
| 33 | 72 | ||
| 34 | this.operationButtonList.push('comment') | 73 | this.operationButtonList.push('comment') |
| 35 | } | 74 | } |
| 75 | + if (this.contentDetailData?.openLikes && this.contentDetailData?.likesStyle != 4) { | ||
| 76 | + this.operationButtonList.push('like') | ||
| 77 | + } | ||
| 36 | this.operationButtonList.push('collect') | 78 | this.operationButtonList.push('collect') |
| 79 | + | ||
| 37 | this.operationButtonList.push('share') | 80 | this.operationButtonList.push('share') |
| 38 | } | 81 | } |
| 39 | 82 | ||
| 40 | if (this.pageInfo) { | 83 | if (this.pageInfo) { |
| 84 | + //TODO: 专题的逻辑判断 | ||
| 85 | + | ||
| 41 | } | 86 | } |
| 42 | } | 87 | } |
| 43 | 88 | ||
| @@ -52,21 +97,26 @@ export struct CommentListDialog { | @@ -52,21 +97,26 @@ export struct CommentListDialog { | ||
| 52 | if (this.onClose) { | 97 | if (this.onClose) { |
| 53 | this.onClose() | 98 | this.onClose() |
| 54 | } | 99 | } |
| 55 | - } | 100 | + }, |
| 101 | + inDialog: true | ||
| 56 | }).layoutWeight(1) | 102 | }).layoutWeight(1) |
| 57 | 103 | ||
| 58 | OperRowListView({ | 104 | OperRowListView({ |
| 59 | - componentType: 1, | 105 | + componentType: 4, |
| 60 | pageComponentType: 8, | 106 | pageComponentType: 8, |
| 61 | showBackIcon: false, | 107 | showBackIcon: false, |
| 62 | operationButtonList: this.operationButtonList, | 108 | operationButtonList: this.operationButtonList, |
| 63 | contentDetailData: this.contentDetailData, | 109 | contentDetailData: this.contentDetailData, |
| 64 | publishCommentModel: this.publishCommentModel, | 110 | publishCommentModel: this.publishCommentModel, |
| 65 | showCommentIcon: true, | 111 | showCommentIcon: true, |
| 112 | + styleType: 1, | ||
| 113 | + inDialog: true, | ||
| 114 | + dialogBeforeJumpOtherPageAction: () => { | ||
| 115 | + PublicDialogManager.shareInstance().closeLastDialog() | ||
| 116 | + } | ||
| 66 | }) | 117 | }) |
| 67 | } | 118 | } |
| 68 | .height(this.windowHeight - this.windowWidth * 9 / 16 + 'px') | 119 | .height(this.windowHeight - this.windowWidth * 9 / 16 + 'px') |
| 69 | - .zIndex(1000) | ||
| 70 | .backgroundColor(Color.White) | 120 | .backgroundColor(Color.White) |
| 71 | } | 121 | } |
| 72 | } | 122 | } |
| @@ -483,7 +483,7 @@ class CommentViewModel { | @@ -483,7 +483,7 @@ class CommentViewModel { | ||
| 483 | return false | 483 | return false |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | - jumpToAccountPage(commentItem: commentItemModel) { | 486 | + jumpToAccountPage(commentItem: commentItemModel, beforeJump: () => void = () => {}) { |
| 487 | let url = HttpUrlUtils.getOtherUserDetailDataUrl() | 487 | let url = HttpUrlUtils.getOtherUserDetailDataUrl() |
| 488 | let item : Record<string, string >= {} | 488 | let item : Record<string, string >= {} |
| 489 | 489 | ||
| @@ -504,6 +504,7 @@ class CommentViewModel { | @@ -504,6 +504,7 @@ class CommentViewModel { | ||
| 504 | return | 504 | return |
| 505 | } | 505 | } |
| 506 | 506 | ||
| 507 | + beforeJump() | ||
| 507 | if (result.data.userType === "1") { // 普通用户 | 508 | if (result.data.userType === "1") { // 普通用户 |
| 508 | let params: Record<string, string> = {'userId': result.data.userId}; | 509 | let params: Record<string, string> = {'userId': result.data.userId}; |
| 509 | WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | 510 | WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) |
| @@ -50,6 +50,10 @@ export struct OperRowListView { | @@ -50,6 +50,10 @@ export struct OperRowListView { | ||
| 50 | } | 50 | } |
| 51 | private onCommentIconClick: () => void = () => { | 51 | private onCommentIconClick: () => void = () => { |
| 52 | } | 52 | } |
| 53 | + | ||
| 54 | + @Provide inDialog: boolean = false | ||
| 55 | + private dialogBeforeJumpOtherPageAction: () => void = () => {} | ||
| 56 | + | ||
| 53 | @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情 | 57 | @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情 |
| 54 | /** | 58 | /** |
| 55 | * 组件样式类型,根据详情页类型传值,组件内部根据样式展现类型做判断 | 59 | * 组件样式类型,根据详情页类型传值,组件内部根据样式展现类型做判断 |
| @@ -233,23 +237,23 @@ export struct OperRowListView { | @@ -233,23 +237,23 @@ export struct OperRowListView { | ||
| 233 | left: 16 | 237 | left: 16 |
| 234 | }) | 238 | }) |
| 235 | 239 | ||
| 236 | - if (this.showCommentIcon) { | 240 | + if (this.showCommentIcon // 页面控制开关,直播传false |
| 241 | + && this.contentDetailData.openComment == 1 // 内容开关 | ||
| 242 | + && this.publishCommentModel?.targetId) { | ||
| 237 | Column() { | 243 | Column() { |
| 238 | - if (this.publishCommentModel?.targetId) { | ||
| 239 | - CommentIconComponent({ | ||
| 240 | - publishCommentModel: this.publishCommentModel, | ||
| 241 | - styleType: this.styleType, | ||
| 242 | - contentDetail: this.contentDetailData | ||
| 243 | - }) | ||
| 244 | - .onClick(() => { | ||
| 245 | - this.onCommentIconClick() | 244 | + CommentIconComponent({ |
| 245 | + publishCommentModel: this.publishCommentModel, | ||
| 246 | + styleType: this.styleType, | ||
| 247 | + contentDetail: this.contentDetailData | ||
| 248 | + }) | ||
| 249 | + .onClick(() => { | ||
| 250 | + this.onCommentIconClick() | ||
| 246 | 251 | ||
| 247 | - console.log(JSON.stringify(this.dialogController?.open)) | 252 | + console.log(JSON.stringify(this.dialogController?.open)) |
| 248 | 253 | ||
| 249 | - // 评论弹框内部嵌入 | ||
| 250 | - !this.showBackIcon && this.dialogController?.open() | ||
| 251 | - }) | ||
| 252 | - } | 254 | + // 评论弹框内部嵌入 |
| 255 | + !this.showBackIcon && this.dialogController?.open() | ||
| 256 | + }) | ||
| 253 | } | 257 | } |
| 254 | .width(48) | 258 | .width(48) |
| 255 | } | 259 | } |
| @@ -185,7 +185,7 @@ export struct DetailPlayShortVideoPage { | @@ -185,7 +185,7 @@ export struct DetailPlayShortVideoPage { | ||
| 185 | index: $index, | 185 | index: $index, |
| 186 | currentIndex: $currentIndex, | 186 | currentIndex: $currentIndex, |
| 187 | showCommentList: $showCommentList, | 187 | showCommentList: $showCommentList, |
| 188 | - publishCommentModel: $publishCommentModel | 188 | + // publishCommentModel: $publishCommentModel |
| 189 | }) | 189 | }) |
| 190 | this.playerViewBuilder() | 190 | this.playerViewBuilder() |
| 191 | 191 |
| 1 | -import { ContentDetailDTO } from 'wdBean/Index' | ||
| 2 | -import { WindowModel } from 'wdKit/Index' | ||
| 3 | -import { | ||
| 4 | - publishCommentModel | ||
| 5 | -} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel' | ||
| 6 | -import { CommentComponent } from '../../../../../wdComponent/src/main/ets/components/comment/view/CommentComponent' | ||
| 7 | -import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView' | 1 | +import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index' |
| 8 | 2 | ||
| 3 | +import { CommentListDialogView } from 'wdComponent/Index' | ||
| 9 | 4 | ||
| 10 | @Component | 5 | @Component |
| 11 | export struct CommentDialogView { | 6 | export struct CommentDialogView { |
| 12 | - @Link publishCommentModel: publishCommentModel | ||
| 13 | @Link @Watch('showCommentListChange') showCommentList: boolean | 7 | @Link @Watch('showCommentListChange') showCommentList: boolean |
| 14 | @Link index: number | 8 | @Link index: number |
| 15 | @Link currentIndex: number | 9 | @Link currentIndex: number |
| 16 | - @Consume windowWidth: number | ||
| 17 | - @Consume windowHeight: number | ||
| 18 | - @Consume bottomSafeHeight: number | ||
| 19 | - @Consume topSafeHeight: number | ||
| 20 | @Consume contentDetailData: ContentDetailDTO | 10 | @Consume contentDetailData: ContentDetailDTO |
| 11 | + @State fakePageInfo: PageInfoDTO = {} as PageInfoDTO | ||
| 21 | @State dialogOffsetY: number = 0 // (this.windowHeight - this.windowWidth * 9 / 16) | 12 | @State dialogOffsetY: number = 0 // (this.windowHeight - this.windowWidth * 9 / 16) |
| 22 | - // @State modifier: DrawModifier = new DrawModifier(); | ||
| 23 | - dialogController: CustomDialogController = new CustomDialogController({ | ||
| 24 | - builder: DetailDialog({ | ||
| 25 | - publishCommentModel: $publishCommentModel, | ||
| 26 | - contentDetailData: $contentDetailData, | ||
| 27 | - dialogOffsetY: $dialogOffsetY, | ||
| 28 | - showCommentList: $showCommentList, | ||
| 29 | - windowWidth: this.windowWidth, | ||
| 30 | - windowHeight: this.windowHeight | ||
| 31 | - }), | ||
| 32 | - autoCancel: false, | ||
| 33 | - customStyle: true, | ||
| 34 | - alignment: DialogAlignment.Bottom, | ||
| 35 | - // onWillDismiss: (dismissDialogAction: DismissDialogAction) => { | ||
| 36 | - // this.showCommentList = false | ||
| 37 | - // dismissDialogAction.dismiss() | ||
| 38 | - // }, | ||
| 39 | - // openAnimation: { duration: 0 }, | ||
| 40 | - // closeAnimation: { duration: 0 }, | ||
| 41 | - }) | ||
| 42 | 13 | ||
| 43 | - /** | ||
| 44 | - * 问题:弹窗从底部到上动画无法添加 | ||
| 45 | - */ | 14 | + @State @Watch("innerShowCommentChange") innerShowComment: boolean = false |
| 46 | 15 | ||
| 47 | showCommentListChange(val: boolean) { | 16 | showCommentListChange(val: boolean) { |
| 48 | if (this.showCommentList && this.index === this.currentIndex) { | 17 | if (this.showCommentList && this.index === this.currentIndex) { |
| 49 | - this.dialogController.open() | ||
| 50 | - console.log('open') | ||
| 51 | - // animateTo({ duration: 10000, expectedFrameRateRange: { min: 60, max: 60, expected: 60 } }, () => { | ||
| 52 | - // this.dialogOffsetY = 500 | ||
| 53 | - // this.modifier.invalidate() | ||
| 54 | - // }) | 18 | + this.innerShowComment = true |
| 55 | } else { | 19 | } else { |
| 56 | - this.dialogController.close() | ||
| 57 | - console.log('close') | 20 | + this.innerShowComment = false |
| 58 | } | 21 | } |
| 59 | } | 22 | } |
| 60 | 23 | ||
| 61 | - build() { | 24 | + innerShowCommentChange() { |
| 25 | + this.showCommentList = this.innerShowComment | ||
| 62 | } | 26 | } |
| 63 | -} | ||
| 64 | - | ||
| 65 | -@CustomDialog | ||
| 66 | -export struct DetailDialog { | ||
| 67 | - controller: CustomDialogController | ||
| 68 | - @Link publishCommentModel: publishCommentModel | ||
| 69 | - @Link dialogOffsetY: number | ||
| 70 | - @Link contentDetailData: ContentDetailDTO | ||
| 71 | - @Link showCommentList: boolean | ||
| 72 | - @Prop windowWidth: number | ||
| 73 | - @Prop windowHeight: number | ||
| 74 | 27 | ||
| 75 | build() { | 28 | build() { |
| 76 | - Column() { | ||
| 77 | - CommentComponent({ | ||
| 78 | - publishCommentModel: this.publishCommentModel, | ||
| 79 | - showCloseIcon: true, | ||
| 80 | - fixedHeightMode: true, | ||
| 81 | - onCloseClick: () => { | ||
| 82 | - console.log('onCloseClick') | ||
| 83 | - this.showCommentList = false | ||
| 84 | - this.controller.close() | ||
| 85 | - // setTimeout(() => { | ||
| 86 | - // | ||
| 87 | - // }, 1000) | ||
| 88 | - | ||
| 89 | - } | ||
| 90 | - }).layoutWeight(1) | ||
| 91 | - | ||
| 92 | - OperRowListView({ | ||
| 93 | - componentType: 4, | ||
| 94 | - pageComponentType: 8, | ||
| 95 | - showBackIcon: false, | ||
| 96 | - operationButtonList: ['comment', 'like', 'collect', 'share'], | ||
| 97 | - contentDetailData: this.contentDetailData, | ||
| 98 | - publishCommentModel: this.publishCommentModel, | ||
| 99 | - showCommentIcon: true, | ||
| 100 | - styleType: 1, | ||
| 101 | - onBack: () => { | ||
| 102 | - WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 103 | - WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 104 | - } | ||
| 105 | - }) | ||
| 106 | - } | ||
| 107 | - .height(this.windowHeight - this.windowWidth * 9 / 16 + 'px') | ||
| 108 | - // .margin({ top: this.dialogOffsetY + 'px' }) | ||
| 109 | - .zIndex(1000) | ||
| 110 | - .backgroundColor(Color.White) | 29 | + CommentListDialogView({ |
| 30 | + showCommentList: this.innerShowComment, | ||
| 31 | + contentDetailData: this.contentDetailData, | ||
| 32 | + pageInfo: this.fakePageInfo, | ||
| 33 | + onClose: () => { | ||
| 34 | + this.showCommentList = false | ||
| 35 | + } | ||
| 36 | + }) | ||
| 111 | } | 37 | } |
| 112 | } | 38 | } |
| @@ -99,7 +99,7 @@ export struct MultiPictureDetailPageComponent { | @@ -99,7 +99,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 99 | index: $index, | 99 | index: $index, |
| 100 | currentIndex: $currentIndex, | 100 | currentIndex: $currentIndex, |
| 101 | showCommentList: $showCommentList, | 101 | showCommentList: $showCommentList, |
| 102 | - publishCommentModel: $publishCommentModel | 102 | + // publishCommentModel: $publishCommentModel |
| 103 | }) | 103 | }) |
| 104 | 104 | ||
| 105 | } | 105 | } |
-
Please register or login to post a comment