ENewspaperPageDialog.ets
2.1 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
import { NewspaperListBean, NewspaperListItemBean } from 'wdBean/Index'
/**
* 期刊日期选择弹窗
*/
@CustomDialog
export struct ENewspaperPageDialog {
dialogType: number = 0 //0:图片版,1:文字版
pageDialogController?: CustomDialogController
@Link currentPageNum: string
@Prop newspaperListBean: NewspaperListBean = {} as NewspaperListBean
// 选择变化监听,
onDateChange?: (date: string, dialogType: number) => void
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('BebasNeue_Regular')
}
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.width(30)
.height(30)
.backgroundColor(this.currentPageNum != item.pageNum ? Color.White : $r('app.color.color_ED2800'))
.onClick((event: ClickEvent) => {
this.currentPageNum = item.pageNum
if (this.onDateChange) {
this.onDateChange(item.pageNum, this.dialogType)
}
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)
}
}