CommentDialogView.ets
3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import { ContentDetailDTO } from 'wdBean/Index'
import { WindowModel } from 'wdKit/Index'
import {
publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { CommentComponent } from '../../../../../wdComponent/src/main/ets/components/comment/view/CommentComponent'
import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView'
@Component
export struct CommentDialogView {
@Prop publishCommentModel: publishCommentModel
@Consume windowWidth: number
@Consume windowHeight: number
@Consume bottomSafeHeight: number
@Consume topSafeHeight: number
@Consume contentDetailData: ContentDetailDTO
@Consume @Watch('showCommentListChange') showCommentList: boolean
@State dialogOffsetY: number = 0 // (this.windowHeight - this.windowWidth * 9 / 16)
@State modifier: DrawModifier = new DrawModifier();
private dialogController: CustomDialogController = new CustomDialogController({
builder: DetailDialog({
publishCommentModel: this.publishCommentModel,
dialogOffsetY: $dialogOffsetY
}),
autoCancel: false,
customStyle: true,
alignment: DialogAlignment.Bottom,
// onWillDismiss: (dismissDialogAction: DismissDialogAction) => {
// this.showCommentList = false
// dismissDialogAction.dismiss()
// },
openAnimation: { duration: 0 },
closeAnimation: { duration: 0 },
})
/**
* 问题:弹窗从底部到上动画无法添加
*/
showCommentListChange(val: boolean) {
if (this.showCommentList) {
this.dialogController.open()
console.log('open')
// animateTo({ duration: 10000, expectedFrameRateRange: { min: 60, max: 60, expected: 60 } }, () => {
// this.dialogOffsetY = 500
// this.modifier.invalidate()
// })
} else {
this.dialogController.close()
console.log('close')
}
}
build() {
}
}
@CustomDialog
export struct DetailDialog {
controller: CustomDialogController
@Prop publishCommentModel: publishCommentModel
@Link dialogOffsetY: number
@Consume contentDetailData: ContentDetailDTO
@Consume showCommentList: boolean
@Consume windowWidth: number
@Consume windowHeight: number
build() {
Column() {
CommentComponent({
publishCommentModel: this.publishCommentModel,
showCloseIcon: true,
onCloseClick: () => {
console.log('onCloseClick')
this.showCommentList = false
this.controller.close()
}
})
.layoutWeight(1)
OperRowListView({
componentType: 1,
showBackIcon: false,
operationButtonList: ['comment', 'like', 'collect', 'share'],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: true,
onBack: () => {
WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
})
}
.height(this.windowHeight - this.windowWidth * 9 / 16 + 'px')
// .margin({ top: this.dialogOffsetY + 'px' })
.zIndex(1000)
.backgroundColor(Color.White)
}
}