|
@@ -2,6 +2,8 @@ import { DeerSearch } from '../components/DeerSearch'
|
|
|
import { SecondViewModel } from './viewModel/SecondViewModel'
|
|
import { SecondViewModel } from './viewModel/SecondViewModel'
|
|
|
import { CustomTextStyle } from '../style/CustomTextStyle'
|
|
import { CustomTextStyle } from '../style/CustomTextStyle'
|
|
|
import { bookItemComp } from '../components/BuilderIndex'
|
|
import { bookItemComp } from '../components/BuilderIndex'
|
|
|
|
|
+import { BookItem, BookListTypeList } from '../model/BookModelIndex'
|
|
|
|
|
+import { cert } from '@kit.DeviceCertificateKit'
|
|
|
|
|
|
|
|
@ComponentV2
|
|
@ComponentV2
|
|
|
export struct SecondView {
|
|
export struct SecondView {
|
|
@@ -11,7 +13,7 @@ export struct SecondView {
|
|
|
Column(){
|
|
Column(){
|
|
|
Row({space: 12}){
|
|
Row({space: 12}){
|
|
|
Row({space: 6}){
|
|
Row({space: 6}){
|
|
|
- Text('年龄选择')
|
|
|
|
|
|
|
+ Text(this.vm.ageRange || '年龄选择')
|
|
|
.attributeModifier(new CustomTextStyle({size: 14, weight: 600}))
|
|
.attributeModifier(new CustomTextStyle({size: 14, weight: 600}))
|
|
|
|
|
|
|
|
Image($r('[basic].media.icon_expension'))
|
|
Image($r('[basic].media.icon_expension'))
|
|
@@ -20,10 +22,12 @@ export struct SecondView {
|
|
|
.rotate({ angle: this.vm.openAgeDialog ? 180 : 0 })
|
|
.rotate({ angle: this.vm.openAgeDialog ? 180 : 0 })
|
|
|
.animation({duration: 200, curve: Curve.Smooth})
|
|
.animation({duration: 200, curve: Curve.Smooth})
|
|
|
}
|
|
}
|
|
|
|
|
+ .width(120)
|
|
|
.borderRadius(18)
|
|
.borderRadius(18)
|
|
|
|
|
+ .padding({top: 8, bottom: 8})
|
|
|
.backgroundColor('#FFFECF2F')
|
|
.backgroundColor('#FFFECF2F')
|
|
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
.border({width: 2, color: '#FF000000'})
|
|
.border({width: 2, color: '#FF000000'})
|
|
|
- .padding({left: 15, top: 8, right: 15, bottom: 8})
|
|
|
|
|
.bindMenu(this.ageSelect())
|
|
.bindMenu(this.ageSelect())
|
|
|
.onClick(() => { if(!this.vm.openAgeDialog) this.vm.openAgeDialog = true })
|
|
.onClick(() => { if(!this.vm.openAgeDialog) this.vm.openAgeDialog = true })
|
|
|
|
|
|
|
@@ -42,10 +46,10 @@ export struct SecondView {
|
|
|
Row(){
|
|
Row(){
|
|
|
Row(){
|
|
Row(){
|
|
|
List({space: 22, scroller: this.vm.categoryControl}){
|
|
List({space: 22, scroller: this.vm.categoryControl}){
|
|
|
- ForEach(this.vm.categoryList, (item: string, index) => {
|
|
|
|
|
|
|
+ ForEach(this.vm.categoryList.list, (item: BookListTypeList, index) => {
|
|
|
ListItem(){
|
|
ListItem(){
|
|
|
Column(){
|
|
Column(){
|
|
|
- Text(item)
|
|
|
|
|
|
|
+ Text(item.bookListTypeName)
|
|
|
.zIndex(99)
|
|
.zIndex(99)
|
|
|
.onClick(() => { this.vm.changeCategory(index) })
|
|
.onClick(() => { this.vm.changeCategory(index) })
|
|
|
.attributeModifier(new CustomTextStyle({size: 16, weight: 600, color: this.vm.categoryIndex == index ? '#FF111111' : '#FF777777'}))
|
|
.attributeModifier(new CustomTextStyle({size: 16, weight: 600, color: this.vm.categoryIndex == index ? '#FF111111' : '#FF777777'}))
|
|
@@ -87,8 +91,8 @@ export struct SecondView {
|
|
|
.borderRadius(15)
|
|
.borderRadius(15)
|
|
|
.padding({left: 12, top: 5, right: 12, bottom: 5})
|
|
.padding({left: 12, top: 5, right: 12, bottom: 5})
|
|
|
.attributeModifier(new CustomTextStyle({size: 14, weight: 600}))
|
|
.attributeModifier(new CustomTextStyle({size: 14, weight: 600}))
|
|
|
- .border({width: 2, color: this.vm.sortType == index ? '#FF000000' : Color.Transparent})
|
|
|
|
|
- .backgroundColor(this.vm.sortType == index ? '#FFFECF2F' : Color.Transparent)
|
|
|
|
|
|
|
+ .border({width: 2, color: this.vm.query?.sort == index ? '#FF000000' : Color.Transparent})
|
|
|
|
|
+ .backgroundColor(this.vm.query?.sort == index ? '#FFFECF2F' : Color.Transparent)
|
|
|
.onClick(() => { this.vm.changeSortType(index) })
|
|
.onClick(() => { this.vm.changeSortType(index) })
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -125,8 +129,8 @@ export struct SecondView {
|
|
|
ListItem()
|
|
ListItem()
|
|
|
|
|
|
|
|
Repeat(this.vm.bookList)
|
|
Repeat(this.vm.bookList)
|
|
|
- .each((item) => {
|
|
|
|
|
- bookItemComp(item.item, () => {})
|
|
|
|
|
|
|
+ .each((item: RepeatItem<BookItem>) => {
|
|
|
|
|
+ bookItemComp(item, () => {})
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
.width("100%")
|
|
.width("100%")
|
|
@@ -177,9 +181,9 @@ export struct SecondView {
|
|
|
.justifyContent(FlexAlign.SpaceBetween)
|
|
.justifyContent(FlexAlign.SpaceBetween)
|
|
|
|
|
|
|
|
Grid(){
|
|
Grid(){
|
|
|
- ForEach(this.vm.categoryList, (item: string, index: number) => {
|
|
|
|
|
|
|
+ ForEach(this.vm.categoryList.list, (item: BookListTypeList, index: number) => {
|
|
|
GridItem(){
|
|
GridItem(){
|
|
|
- Text(item)
|
|
|
|
|
|
|
+ Text(item.bookListTypeName)
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.borderRadius(18)
|
|
.borderRadius(18)
|
|
|
.textAlign(TextAlign.Center)
|
|
.textAlign(TextAlign.Center)
|
|
@@ -197,7 +201,7 @@ export struct SecondView {
|
|
|
.rowsGap(14)
|
|
.rowsGap(14)
|
|
|
.columnsGap(23)
|
|
.columnsGap(23)
|
|
|
.margin({top: 13})
|
|
.margin({top: 13})
|
|
|
- .maxCount(Math.abs(this.vm.categoryList.length/3))
|
|
|
|
|
|
|
+ .maxCount(Math.abs(this.vm.categoryList?.list?.length/3))
|
|
|
.columnsTemplate('repeat(3, 1fr)')
|
|
.columnsTemplate('repeat(3, 1fr)')
|
|
|
}
|
|
}
|
|
|
.width("100%")
|
|
.width("100%")
|
|
@@ -232,9 +236,12 @@ export struct SecondView {
|
|
|
@Builder
|
|
@Builder
|
|
|
ageSelect(){
|
|
ageSelect(){
|
|
|
Column({space: 17}){
|
|
Column({space: 17}){
|
|
|
- ForEach(['0-2岁', '3-6岁', '7-10岁', '10岁+'], (item: string, index) => {
|
|
|
|
|
|
|
+ ForEach(this.vm.ageList, (item: string, index: number) => {
|
|
|
Text(item)
|
|
Text(item)
|
|
|
.attributeModifier(new CustomTextStyle({size: 14, weight: 600}))
|
|
.attributeModifier(new CustomTextStyle({size: 14, weight: 600}))
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ this.vm.changeAgeRange(index)
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
.margin(-4)
|
|
.margin(-4)
|