1
+ import BookType from '../head/BookType'
2
+ import groupTypePanel from './groupTypePanel'
3
+
4
+ @Component
5
+ export default struct groupTypeComponent {
6
+ @State globalPositionY: Length = 0
7
+ @Link bookType: string
8
+ @Link currentIndex: number
9
+ @Link groupCoverShow:boolean
10
+
11
+ build() {
12
+ if (this.groupCoverShow){
13
+ Stack(){
14
+ Rect()
15
+ // .fillOpacity(0)
16
+ .height('85%')
17
+ .width('100%')
18
+ .fill('rgba(0, 0, 0, 0.45)')
19
+ groupTypePanel({
20
+ groupCoverShow:this.groupCoverShow
21
+ }).zIndex(9999)
22
+ }.alignContent(Alignment.Top)
23
+ } else {
24
+ Flex(
25
+ {
26
+ alignItems: ItemAlign.Center,
27
+ justifyContent: FlexAlign.SpaceBetween
28
+ }
29
+ ) {
30
+ Scroll() {
31
+ Row({ space: 10 }) {
32
+ BookType({ title: '全部', bookType: this.bookType }).onClick(() => {
33
+ this.bookType = '全部'
34
+ })
35
+ BookType({ title: '未分组', bookType: this.bookType }).onClick(() => {
36
+ this.bookType = '未分组'
37
+ })
38
+ BookType({ title: '本地', bookType: this.bookType }).onClick(() => {
39
+ this.bookType = '本地'
40
+ })
41
+ BookType({ title: '书单', bookType: this.bookType }).onClick(() => {
42
+ this.bookType = '书单'
43
+ })
44
+ if (this.currentIndex === 0) {
45
+ BookType({ title: '玄幻', bookType: this.bookType }).onClick(() => {
46
+ this.bookType = '玄幻'
47
+ })
48
+ BookType({ title: '修仙', bookType: this.bookType }).onClick(() => {
49
+ this.bookType = '修仙'
50
+ })
51
+ BookType({ title: '女同', bookType: this.bookType }).onClick(() => {
52
+ this.bookType = '女同'
53
+ })
54
+ BookType({ title: '军事', bookType: this.bookType }).onClick(() => {
55
+ this.bookType = '军事'
56
+ })
57
+ } else if (this.currentIndex === 1) {
58
+ BookType({ title: '国漫', bookType: this.bookType }).onClick(() => {
59
+ this.bookType = '国漫'
60
+ })
61
+ BookType({ title: '日漫', bookType: this.bookType }).onClick(() => {
62
+ this.bookType = '日漫'
63
+ })
64
+ } else if (this.currentIndex === 2) {
65
+ BookType({ title: '广播', bookType: this.bookType }).onClick(() => {
66
+ this.bookType = '广播'
67
+ })
68
+ BookType({ title: '深夜电台', bookType: this.bookType }).onClick(() => {
69
+ this.bookType = '深夜电台'
70
+ })
71
+ }
72
+ }
73
+ }
74
+ .scrollBar(BarState.Off)
75
+ .scrollable(ScrollDirection.Horizontal)
76
+ Row(){
77
+ Image($r('app.media.more_search')).width(25).height(25)
78
+ }.width(
79
+ '10%'
80
+ ).onClick(()=>{
81
+ this.groupCoverShow = true
82
+ })
83
+ // .bindPopup(this.groupCoverShow, {
84
+ // builder: this.groupTypePanel,
85
+ // placement: Placement.Bottom,
86
+ // // mask:true,
87
+ // radius:10,
88
+ // offset: {y:-35},
89
+ // // mask:{color:'rgba(0,0,0,0.45)'},
90
+ // enableArrow: false,
91
+ // // autoCancel:false,
92
+ // width:'100%',
93
+ // popupColor:Color.Transparent,
94
+ // onStateChange: (e) => {
95
+ // if (!e.isVisible) {
96
+ // this.groupCoverShow = false;
97
+ // }
98
+ // }
99
+ // })
100
+ }.margin({ left: 15,bottom:10})
101
+ }
102
+
103
+ }
104
+
105
+ @Builder
106
+ groupTypePanel() {
107
+ Column({
108
+ space:15
109
+ }){
110
+ Flex({
111
+ justifyContent:FlexAlign.SpaceBetween,
112
+ alignItems:ItemAlign.End
113
+ }){
114
+ Row({space:12}){
115
+ Text('显示分组').fontSize(16).fontWeight(500).lineHeight(24).fontColor('rgba(0, 0, 0, 0.88)')
116
+ Text('点击进入').fontSize(12).fontWeight(400).lineHeight(20).fontColor('rgba(0, 0, 0, 0.45)')
117
+ }.alignItems(VerticalAlign.Bottom)
118
+ Row({space:12}){
119
+ Text('管理').fontSize(12).fontWeight(400).lineHeight(20).fontColor($r('app.color.theme_color'))
120
+ Image($r('app.media.close')).width(24).height(20).onClick(()=>{
121
+ this.groupCoverShow = false
122
+ })
123
+ }
124
+ }
125
+ Flex({
126
+ direction: FlexDirection.Row, wrap: FlexWrap.Wrap,
127
+ justifyContent:FlexAlign.Start
128
+ }){
129
+ Row(){
130
+ this.GroupType()
131
+ }.width('25%')
132
+ Row(){
133
+ this.GroupType1('全部')
134
+ //后续添加右上角图
135
+ }.width('25%')
136
+ Row(){
137
+ this.GroupType1('未分组')
138
+ }.width('25%')
139
+ Row(){
140
+ this.GroupType1('本地')
141
+ }.width('25%')
142
+ Row(){
143
+ this.GroupType1('书单')
144
+ }.width('25%')
145
+ }
146
+
147
+ Flex({
148
+ justifyContent:FlexAlign.SpaceBetween,
149
+ alignItems:ItemAlign.End
150
+ }){
151
+ Row({space:12}){
152
+ Text('隐藏分组').fontSize(16).fontWeight(500).lineHeight(24).fontColor('rgba(0, 0, 0, 0.88)')
153
+ Text('点击进入,长按编辑').fontSize(12).fontWeight(400).lineHeight(20).fontColor('rgba(0, 0, 0, 0.45)')
154
+ }.alignItems(VerticalAlign.Bottom)
155
+ Row({space:8}){
156
+ Image($r('app.media.help')).width(20).height(20)
157
+ Text('标签锁').fontSize(16).fontWeight(500).lineHeight(24).fontColor('rgba(0, 0, 0, 0.45)')
158
+ Toggle({ type: ToggleType.Switch, isOn: false})
159
+ .selectedColor("#F60").hoverEffect(HoverEffect.None)
160
+ }.alignItems(VerticalAlign.Bottom).justifyContent(FlexAlign.End)
161
+ }
162
+ Scroll(){
163
+ if (false){
164
+ Flex({
165
+ direction: FlexDirection.Row
166
+ }){
167
+ Row(){
168
+ this.GroupType1('游戏')
169
+ }.width('25%')
170
+ Row(){
171
+ this.GroupType1('未分组')
172
+ }.width('25%')
173
+ Row(){
174
+ this.GroupType1('本地')
175
+ }.width('25%')
176
+ Row(){
177
+ this.GroupType1('书单')
178
+ }.width('25%')
179
+ Row(){
180
+ this.GroupType1('书单')
181
+ }.width('25%')
182
+ }
183
+ } else {
184
+ Flex({
185
+ justifyContent:FlexAlign.Center
186
+ }){
187
+ Text('暂无隐藏分组').fontSize(12).fontWeight(400).fontColor('rgba(0, 0, 0, 0.45)')
188
+ }
189
+ .borderRadius(4)
190
+ .width('100%')
191
+ .backgroundColor('rgba(0, 0, 0, 0.04)')
192
+ .padding({top:6,bottom:6})
193
+
194
+ }
195
+ } .scrollBar(BarState.Off)
196
+ .scrollable(ScrollDirection.Horizontal)
197
+
198
+ }
199
+ .padding({left:20,right:20,top:12})
200
+ .width('100%').height('30%').backgroundColor(Color.White)
201
+ }
202
+
203
+ @Builder GroupType(){
204
+ Row(){
205
+ Text('分组').fontWeight(500).fontSize(12).textOverflow({
206
+ overflow:TextOverflow.Ellipsis
207
+ }).ellipsisMode(EllipsisMode.END)
208
+ .maxLines(1).fontColor($r('app.color.theme_color'))
209
+ .textAlign(TextAlign.Center)
210
+ }
211
+ .margin({ right: 16, bottom: 16 })
212
+ .justifyContent(FlexAlign.Center)
213
+ .alignItems(VerticalAlign.Center)
214
+ .width(68)
215
+ .backgroundColor('rgba(0, 0, 0, 0.04)').padding({left:16,right:16,top:6,bottom:6})
216
+ }
217
+ @Builder GroupType1(title:string){
218
+ Row(){
219
+ Text(title).fontWeight(500).fontSize(12).textOverflow({
220
+ overflow:TextOverflow.Ellipsis
221
+ }).ellipsisMode(EllipsisMode.END)
222
+ .maxLines(1).fontColor(Color.Black)
223
+ .textAlign(TextAlign.Center)
224
+ }
225
+
226
+ .justifyContent(FlexAlign.Center)
227
+ .alignItems(VerticalAlign.Center)
228
+ .width(68)
229
+ .backgroundColor('rgba(0, 0, 0, 0.04)').padding({left:16,right:16,top:6,bottom:6})
230
+ }
231
+ }
0 commit comments