ENewspaperPageDialog.ets
2.41 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
import { NewspaperListBean, NewspaperListItemBean } from 'wdBean/Index'
/**
* 期刊日期选择弹窗
*/
@CustomDialog
export struct ENewspaperPageDialog {
dialogType: number = 0 //0:图片版,1:文字版
pageDialogController?: CustomDialogController
@Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string
@Prop newspaperListBean: NewspaperListBean = {} as NewspaperListBean
public dialogVisibility?: (visibility: boolean) => void
onCurrentPageNumUpdated(): void {
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
}
aboutToAppear(): void {
if (this.dialogType == 1 && this.dialogVisibility) {
this.dialogVisibility(true)
}
}
aboutToDisappear(): void {
if (this.dialogType == 1 && this.dialogVisibility) {
this.dialogVisibility(false)
}
}
build() {
Column() {
if (this.dialogType == 1) {
Image($r("app.media.iv_e_news_pager_calendar_arrow_up"))
.width(18).height(8.5)
.margin({ left: 31 })
}
Stack() {
GridRow({ columns: 5, gutter: { x: 15, y: 15 } }) {
ForEach(this.newspaperListBean.list, (item: NewspaperListItemBean, index) => {
GridCol() {
Row() {
Text(item.pageNum)
.fontSize($r('app.float.normal_text_size'))
.fontColor(this.currentPageNum == item.pageNum ? Color.White : $r('app.color.color_222222'))
.fontFamily('BebasNeueBold')
}
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.width(30)
.height(30)
.borderRadius(3)
.backgroundColor(this.currentPageNum != item.pageNum ? Color.White : $r('app.color.color_ED2800'))
.onClick((event: ClickEvent) => {
this.currentPageNum = item.pageNum
if (this.pageDialogController) {
this.pageDialogController.close()
}
})
}
})
}
}
.padding(20)
.width(260)
.borderRadius(4)
.backgroundColor(Color.White)
if (this.dialogType == 0) {
Image($r("app.media.iv_e_news_pager_calendar_arrow_down"))
.width(18).height(8.5)
.margin({ left: 31 })
}
}
.margin({ left: 10 })
.alignItems(HorizontalAlign.Start)
}
}