ref |> 调整评论弹框上面点赞需要登录问题
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
2 changed files
with
23 additions
and
9 deletions
| @@ -48,6 +48,7 @@ export struct CommentComponent { | @@ -48,6 +48,7 @@ export struct CommentComponent { | ||
| 48 | 48 | ||
| 49 | // 是否在弹框中 | 49 | // 是否在弹框中 |
| 50 | @Provide inDialog: boolean = false | 50 | @Provide inDialog: boolean = false |
| 51 | + private dialogBeforeJumpOtherPageAction: () => void = () => {} | ||
| 51 | 52 | ||
| 52 | // 在自定义组件即将析构销毁时将dialogControlle置空 | 53 | // 在自定义组件即将析构销毁时将dialogControlle置空 |
| 53 | aboutToDisappear() { | 54 | aboutToDisappear() { |
| @@ -158,7 +159,8 @@ export struct CommentComponent { | @@ -158,7 +159,8 @@ export struct CommentComponent { | ||
| 158 | commentHeaderView({ | 159 | commentHeaderView({ |
| 159 | item: item, | 160 | item: item, |
| 160 | dialogController: this.dialogController, | 161 | dialogController: this.dialogController, |
| 161 | - publishCommentModel: this.publishCommentModel | 162 | + publishCommentModel: this.publishCommentModel, |
| 163 | + dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction | ||
| 162 | }) | 164 | }) |
| 163 | } | 165 | } |
| 164 | 166 | ||
| @@ -194,7 +196,8 @@ export struct CommentComponent { | @@ -194,7 +196,8 @@ export struct CommentComponent { | ||
| 194 | ChildCommentItem({ | 196 | ChildCommentItem({ |
| 195 | item: childItem, | 197 | item: childItem, |
| 196 | dialogController: this.dialogController, | 198 | dialogController: this.dialogController, |
| 197 | - publishCommentModel: this.publishCommentModel | 199 | + publishCommentModel: this.publishCommentModel, |
| 200 | + dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction | ||
| 198 | }); | 201 | }); |
| 199 | } | 202 | } |
| 200 | .onClick(() => { | 203 | .onClick(() => { |
| @@ -209,7 +212,8 @@ export struct CommentComponent { | @@ -209,7 +212,8 @@ export struct CommentComponent { | ||
| 209 | ChildCommentItem({ | 212 | ChildCommentItem({ |
| 210 | item: childItem, | 213 | item: childItem, |
| 211 | dialogController: this.dialogController, | 214 | dialogController: this.dialogController, |
| 212 | - publishCommentModel: this.publishCommentModel | 215 | + publishCommentModel: this.publishCommentModel, |
| 216 | + dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction | ||
| 213 | }); | 217 | }); |
| 214 | } | 218 | } |
| 215 | .onClick(() => { | 219 | .onClick(() => { |
| @@ -319,6 +323,7 @@ struct ChildCommentItem { | @@ -319,6 +323,7 @@ struct ChildCommentItem { | ||
| 319 | @Consume contentDetailData: ContentDetailDTO | 323 | @Consume contentDetailData: ContentDetailDTO |
| 320 | 324 | ||
| 321 | @Consume inDialog: boolean | 325 | @Consume inDialog: boolean |
| 326 | + private dialogBeforeJumpOtherPageAction: () => void = () => {} | ||
| 322 | 327 | ||
| 323 | build() { | 328 | build() { |
| 324 | Column() { | 329 | Column() { |
| @@ -388,7 +393,8 @@ struct ChildCommentItem { | @@ -388,7 +393,8 @@ struct ChildCommentItem { | ||
| 388 | commentFooterView({ | 393 | commentFooterView({ |
| 389 | item: this.item, | 394 | item: this.item, |
| 390 | dialogController: this.dialogController, | 395 | dialogController: this.dialogController, |
| 391 | - publishCommentModel: this.publishCommentModel | 396 | + publishCommentModel: this.publishCommentModel, |
| 397 | + dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction | ||
| 392 | }).margin({ left: 95, right: 16 }) | 398 | }).margin({ left: 95, right: 16 }) |
| 393 | }.alignItems(HorizontalAlign.Start) | 399 | }.alignItems(HorizontalAlign.Start) |
| 394 | .width('100%') | 400 | .width('100%') |
| @@ -430,7 +436,7 @@ struct ChildCommentItem { | @@ -430,7 +436,7 @@ struct ChildCommentItem { | ||
| 430 | 436 | ||
| 431 | commentViewModel.jumpToAccountPage(this.item, () => { | 437 | commentViewModel.jumpToAccountPage(this.item, () => { |
| 432 | if (this.inDialog) { | 438 | if (this.inDialog) { |
| 433 | - PublicDialogManager.shareInstance().closeLastDialog() | 439 | + if (this.dialogBeforeJumpOtherPageAction) { this.dialogBeforeJumpOtherPageAction() } |
| 434 | } | 440 | } |
| 435 | }) | 441 | }) |
| 436 | }) | 442 | }) |
| @@ -541,6 +547,7 @@ struct commentHeaderView { | @@ -541,6 +547,7 @@ struct commentHeaderView { | ||
| 541 | @ObjectLink item: commentItemModel | 547 | @ObjectLink item: commentItemModel |
| 542 | 548 | ||
| 543 | @Consume inDialog: boolean | 549 | @Consume inDialog: boolean |
| 550 | + private dialogBeforeJumpOtherPageAction: () => void = () => {} | ||
| 544 | 551 | ||
| 545 | build() { | 552 | build() { |
| 546 | Column() { | 553 | Column() { |
| @@ -598,7 +605,8 @@ struct commentHeaderView { | @@ -598,7 +605,8 @@ struct commentHeaderView { | ||
| 598 | commentFooterView({ | 605 | commentFooterView({ |
| 599 | item: this.item, | 606 | item: this.item, |
| 600 | dialogController: this.dialogController, | 607 | dialogController: this.dialogController, |
| 601 | - publishCommentModel: this.publishCommentModel | 608 | + publishCommentModel: this.publishCommentModel, |
| 609 | + dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction | ||
| 602 | }).margin({ left: 59, right: 16 }) | 610 | }).margin({ left: 59, right: 16 }) |
| 603 | }.alignItems(HorizontalAlign.Start) | 611 | }.alignItems(HorizontalAlign.Start) |
| 604 | .padding({bottom: 8}) | 612 | .padding({bottom: 8}) |
| @@ -640,7 +648,7 @@ struct commentHeaderView { | @@ -640,7 +648,7 @@ struct commentHeaderView { | ||
| 640 | 648 | ||
| 641 | commentViewModel.jumpToAccountPage(this.item, () => { | 649 | commentViewModel.jumpToAccountPage(this.item, () => { |
| 642 | if (this.inDialog) { | 650 | if (this.inDialog) { |
| 643 | - PublicDialogManager.shareInstance().closeLastDialog() | 651 | + if (this.dialogBeforeJumpOtherPageAction) { this.dialogBeforeJumpOtherPageAction() } |
| 644 | } | 652 | } |
| 645 | }) | 653 | }) |
| 646 | }) | 654 | }) |
| @@ -676,6 +684,7 @@ struct commentFooterView { | @@ -676,6 +684,7 @@ struct commentFooterView { | ||
| 676 | @ObjectLink item: commentItemModel | 684 | @ObjectLink item: commentItemModel |
| 677 | 685 | ||
| 678 | @Consume inDialog: boolean | 686 | @Consume inDialog: boolean |
| 687 | + private dialogBeforeJumpOtherPageAction: () => void = () => {} | ||
| 679 | 688 | ||
| 680 | build() { | 689 | build() { |
| 681 | Row() { | 690 | Row() { |
| @@ -748,7 +757,7 @@ struct commentFooterView { | @@ -748,7 +757,7 @@ struct commentFooterView { | ||
| 748 | const user_id = HttpUtils.getUserId() | 757 | const user_id = HttpUtils.getUserId() |
| 749 | if (!user_id) { | 758 | if (!user_id) { |
| 750 | if (this.inDialog) { | 759 | if (this.inDialog) { |
| 751 | - PublicDialogManager.shareInstance().closeLastDialog() | 760 | + if (this.dialogBeforeJumpOtherPageAction) { this.dialogBeforeJumpOtherPageAction() } |
| 752 | } | 761 | } |
| 753 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 762 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 754 | return | 763 | return |
| @@ -117,7 +117,12 @@ struct CommentListDialog { | @@ -117,7 +117,12 @@ struct CommentListDialog { | ||
| 117 | publishCommentModel: this.publishCommentModel, | 117 | publishCommentModel: this.publishCommentModel, |
| 118 | fixedHeightMode: true, | 118 | fixedHeightMode: true, |
| 119 | inDialog: true, | 119 | inDialog: true, |
| 120 | - showTitleComponent: false | 120 | + showTitleComponent: false, |
| 121 | + dialogBeforeJumpOtherPageAction: () => { | ||
| 122 | + if (this.onClose) { | ||
| 123 | + this.onClose() | ||
| 124 | + } | ||
| 125 | + } | ||
| 121 | }).layoutWeight(1) | 126 | }).layoutWeight(1) |
| 122 | 127 | ||
| 123 | OperRowListView({ | 128 | OperRowListView({ |
-
Please register or login to post a comment