|
|
@@ -36,119 +36,114 @@ export struct SecondView {
|
|
|
|
|
|
Column(){
|
|
|
RelativeContainer(){
|
|
|
- // 页面的 Title
|
|
|
Column(){
|
|
|
- Row(){
|
|
|
+ // 页面的 Title
|
|
|
+ Column(){
|
|
|
Row(){
|
|
|
- List({space: 22, scroller: this.vm.categoryControl}){
|
|
|
- ForEach(this.vm.categoryList, (item: string, index) => {
|
|
|
- ListItem(){
|
|
|
- Column(){
|
|
|
- Text(item)
|
|
|
- .zIndex(99)
|
|
|
- .onClick(() => { this.vm.changeCategory(index) })
|
|
|
- .attributeModifier(new CustomTextStyle({size: 16, weight: 600, color: this.vm.categoryIndex == index ? '#FF111111' : '#FF777777'}))
|
|
|
-
|
|
|
- if(this.vm.categoryIndex == index){
|
|
|
- Image($r('[basic].media.icon_SelectBg'))
|
|
|
- .width(45)
|
|
|
- .height(16)
|
|
|
- .margin({top:-10})
|
|
|
- .transition(TransitionEffect.asymmetric(TransitionEffect.move(TransitionEdge.TOP), TransitionEffect.move(TransitionEdge.TOP)).animation({ duration: 100, curve: Curve.Smooth }))
|
|
|
+ Row(){
|
|
|
+ List({space: 22, scroller: this.vm.categoryControl}){
|
|
|
+ ForEach(this.vm.categoryList, (item: string, index) => {
|
|
|
+ ListItem(){
|
|
|
+ Column(){
|
|
|
+ Text(item)
|
|
|
+ .zIndex(99)
|
|
|
+ .onClick(() => { this.vm.changeCategory(index) })
|
|
|
+ .attributeModifier(new CustomTextStyle({size: 16, weight: 600, color: this.vm.categoryIndex == index ? '#FF111111' : '#FF777777'}))
|
|
|
+
|
|
|
+ if(this.vm.categoryIndex == index){
|
|
|
+ Image($r('[basic].media.icon_SelectBg'))
|
|
|
+ .width(45)
|
|
|
+ .height(16)
|
|
|
+ .margin({top:-10})
|
|
|
+ .transition(TransitionEffect.asymmetric(TransitionEffect.move(TransitionEdge.TOP), TransitionEffect.move(TransitionEdge.TOP)).animation({ duration: 100, curve: Curve.Smooth }))
|
|
|
+ }
|
|
|
}
|
|
|
+ .alignItems(HorizontalAlign.Center)
|
|
|
}
|
|
|
- .alignItems(HorizontalAlign.Center)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- .height(40)
|
|
|
- .width("100%")
|
|
|
- .scrollBar(BarState.Off)
|
|
|
- .listDirection(Axis.Horizontal)
|
|
|
- }.layoutWeight(1)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .height(40)
|
|
|
+ .width("100%")
|
|
|
+ .scrollBar(BarState.Off)
|
|
|
+ .listDirection(Axis.Horizontal)
|
|
|
+ }.layoutWeight(1)
|
|
|
|
|
|
- Row(){
|
|
|
- Image($r('[basic].media.icon_expension'))
|
|
|
- .width(10)
|
|
|
- .height(8)
|
|
|
- .rotate({ angle: this.vm.openTypeDialog ? 180 : 0 })
|
|
|
- .animation({duration: 200, curve: Curve.Smooth})
|
|
|
- }
|
|
|
- .padding({left: 16, top: 2})
|
|
|
- .onClick(() => { this.vm.openCategoryDialog() })
|
|
|
+ Row(){
|
|
|
+ Image($r('[basic].media.icon_expension'))
|
|
|
+ .width(10)
|
|
|
+ .height(8)
|
|
|
+ .rotate({ angle: this.vm.openTypeDialog ? 180 : 0 })
|
|
|
+ .animation({duration: 200, curve: Curve.Smooth})
|
|
|
+ }
|
|
|
+ .padding({left: 16, top: 2})
|
|
|
+ .onClick(() => { this.vm.openCategoryDialog() })
|
|
|
|
|
|
- }.alignItems(VerticalAlign.Top)
|
|
|
+ }.alignItems(VerticalAlign.Top)
|
|
|
|
|
|
- Row(){
|
|
|
Row(){
|
|
|
- ForEach(['最新', '最热'], (item: string, index: number) => {
|
|
|
- Text(item)
|
|
|
- .borderRadius(15)
|
|
|
- .padding({left: 12, top: 5, right: 12, bottom: 5})
|
|
|
- .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)
|
|
|
- .onClick(() => { this.vm.changeSortType(index) })
|
|
|
- })
|
|
|
- }
|
|
|
+ Row(){
|
|
|
+ ForEach(['最新', '最热'], (item: string, index: number) => {
|
|
|
+ Text(item)
|
|
|
+ .borderRadius(15)
|
|
|
+ .padding({left: 12, top: 5, right: 12, bottom: 5})
|
|
|
+ .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)
|
|
|
+ .onClick(() => { this.vm.changeSortType(index) })
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- Row({space: 16}){
|
|
|
- Row({space: 6}){
|
|
|
- Blank()
|
|
|
- .width(14)
|
|
|
- .aspectRatio(1)
|
|
|
- .borderRadius(2)
|
|
|
- .border({width: 2, color: '#FF000000'})
|
|
|
- .backgroundColor(this.vm.isRead ? '#FFFECF2F' : Color.White)
|
|
|
- Text('未读')
|
|
|
+ Row({space: 16}){
|
|
|
+ Row({space: 6}){
|
|
|
+ Blank()
|
|
|
+ .width(14)
|
|
|
+ .aspectRatio(1)
|
|
|
+ .borderRadius(2)
|
|
|
+ .border({width: 2, color: '#FF000000'})
|
|
|
+ .backgroundColor(this.vm.isRead ? '#FFFECF2F' : Color.White)
|
|
|
+ Text('未读')
|
|
|
+ .attributeModifier(new CustomTextStyle({size: 14, weight: 400}))
|
|
|
+ }.onClick(() => { this.vm.changeIsRead() })
|
|
|
+
|
|
|
+ Text(this.vm.showMode ? '封面模式' : '列表模式')
|
|
|
+ .onClick(() => { this.vm.changeShowMode() })
|
|
|
.attributeModifier(new CustomTextStyle({size: 14, weight: 400}))
|
|
|
- }.onClick(() => { this.vm.changeIsRead() })
|
|
|
-
|
|
|
- Text(this.vm.showMode ? '封面模式' : '列表模式')
|
|
|
- .onClick(() => { this.vm.changeShowMode() })
|
|
|
- .attributeModifier(new CustomTextStyle({size: 14, weight: 400}))
|
|
|
+ }
|
|
|
}
|
|
|
+ .width("100%")
|
|
|
+ .margin({top: 10})
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
}
|
|
|
.width("100%")
|
|
|
- .margin({top: 10})
|
|
|
- .justifyContent(FlexAlign.SpaceBetween)
|
|
|
- }
|
|
|
- .width("100%")
|
|
|
- .id('classify')
|
|
|
- .backgroundColor(Color.White)
|
|
|
- .borderRadius({bottomLeft: 20, bottomRight: 20})
|
|
|
- .padding({left: 16, right: 16, bottom: 18})
|
|
|
- .alignRules({
|
|
|
- left: { anchor: '__container__', align: HorizontalAlign.Start },
|
|
|
- top: { anchor: '__container__', align: VerticalAlign.Top }
|
|
|
- })
|
|
|
-
|
|
|
+ .backgroundColor(Color.White)
|
|
|
+ .borderRadius({bottomLeft: 20, bottomRight: 20})
|
|
|
+ .padding({left: 16, right: 16, bottom: 18})
|
|
|
|
|
|
- // 书籍列表项
|
|
|
- Column(){
|
|
|
- List({space: 12}){
|
|
|
- ListItem()
|
|
|
+ // 书籍列表项
|
|
|
+ Column(){
|
|
|
+ List({space: 12}){
|
|
|
+ ListItem()
|
|
|
|
|
|
- Repeat(this.vm.bookList)
|
|
|
- .each((item) => {
|
|
|
- bookItemComp(item.item, () => {})
|
|
|
- })
|
|
|
+ Repeat(this.vm.bookList)
|
|
|
+ .each((item) => {
|
|
|
+ bookItemComp(item.item, () => {})
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .width("100%")
|
|
|
+ .height("100%")
|
|
|
+ .scrollBar(BarState.Off)
|
|
|
}
|
|
|
+ .id('list')
|
|
|
.width("100%")
|
|
|
- .height("100%")
|
|
|
- .scrollBar(BarState.Off)
|
|
|
- }
|
|
|
- .id('list')
|
|
|
- .width("100%")
|
|
|
- .layoutWeight(1)
|
|
|
- .padding({left: 16, right: 16})
|
|
|
- .backgroundColor(Color.Transparent)
|
|
|
+ .layoutWeight(1)
|
|
|
+ .padding({left: 16, right: 16})
|
|
|
+ .backgroundColor(Color.Transparent)
|
|
|
+ }.width("100%").height("100%")
|
|
|
.alignRules({
|
|
|
left: { anchor: '__container__', align: HorizontalAlign.Start },
|
|
|
- top: { anchor: 'classify', align: VerticalAlign.Bottom }
|
|
|
+ top: { anchor: '__container__', align: VerticalAlign.Top }
|
|
|
})
|
|
|
|
|
|
-
|
|
|
// 分类弹窗
|
|
|
if(this.vm.openTypeDialog){
|
|
|
Column(){
|