|
|
@@ -1,7 +1,7 @@
|
|
|
-import { yTRouter } from "basic";
|
|
|
-import { tagItemComp } from "../components/BuilderIndex";
|
|
|
-import { CustomTextStyle } from "../style/CustomTextStyle";
|
|
|
-import { ThirdViewModel } from "./viewModel/ThirdViewModel";
|
|
|
+import { BookItem } from 'basic';
|
|
|
+import { tagItemComp } from '../components/BuilderIndex';
|
|
|
+import { CustomTextStyle } from '../style/CustomTextStyle';
|
|
|
+import { ThirdViewModel } from './viewModel/ThirdViewModel';
|
|
|
|
|
|
|
|
|
@ComponentV2
|
|
|
@@ -24,7 +24,7 @@ export struct ThirdView {
|
|
|
.borderRadius({bottomLeft: 16, bottomRight: 16})
|
|
|
|
|
|
Column(){
|
|
|
- if(true) {
|
|
|
+ if(this.vm.bookList.length != 0) {
|
|
|
this.bookList()
|
|
|
} else {
|
|
|
this.emptyView()
|
|
|
@@ -36,7 +36,7 @@ export struct ThirdView {
|
|
|
// 底部按钮
|
|
|
Row(){
|
|
|
Row(){
|
|
|
- if(true) {
|
|
|
+ if(this.vm.selectList.length != 10 || (this.vm.bookList.length != 0 && this.vm.selectList.length == this.vm.bookList.length)) {
|
|
|
Row().width(15).aspectRatio(1).borderRadius(15).border({width: 1})
|
|
|
} else {
|
|
|
Image($r('[basic].media.icon_select')).width(15).aspectRatio(1)
|
|
|
@@ -48,11 +48,14 @@ export struct ThirdView {
|
|
|
|
|
|
Text(){
|
|
|
Span('已选:')
|
|
|
- Span(`1`).fontWeight(700).fontColor('#FFFFC500')
|
|
|
+ Span(`${this.vm.selectList.length}`).fontWeight(700).fontColor('#FFFFC500')
|
|
|
Span('本书').fontColor('#FF333333')
|
|
|
}
|
|
|
.attributeModifier(new CustomTextStyle({size: 14, weight: 400, color: '#80000000'}))
|
|
|
}
|
|
|
+ .onClick(() => {
|
|
|
+ this.vm.clickSelectAll()
|
|
|
+ })
|
|
|
|
|
|
|
|
|
Row(){
|
|
|
@@ -177,26 +180,27 @@ export struct ThirdView {
|
|
|
this.tip()
|
|
|
}
|
|
|
|
|
|
- ForEach(new Array(10).fill(1), (item: number, index) => {
|
|
|
+ ForEach(this.vm.bookList, (item: BookItem, index: number) => {
|
|
|
ListItem(){
|
|
|
Row({space: 7}){
|
|
|
Row(){
|
|
|
- if(index%2 == 1) {
|
|
|
+ if(this.vm.selectList.indexOf(item.id!) == -1) {
|
|
|
Row().width(15).aspectRatio(1).borderRadius(15).border({width: 1})
|
|
|
} else {
|
|
|
Image($r('[basic].media.icon_select')).width(15).aspectRatio(1)
|
|
|
}
|
|
|
}.height('100%')
|
|
|
- .onClick(() => { this.vm.changeSelect() })
|
|
|
+ .onClick(() => { this.vm.changeSelect(item, index) })
|
|
|
|
|
|
Row({space: 11}){
|
|
|
- Image($r('[basic].media.png_defaultBook'))
|
|
|
+ Image(item.coverUrl)
|
|
|
.borderRadius(16)
|
|
|
.width(86).aspectRatio(1)
|
|
|
.backgroundColor('#FECF2F')
|
|
|
+ .alt($r('[basic].media.png_defaultBook'))
|
|
|
|
|
|
Column(){
|
|
|
- Text('我不愿嫉妒')
|
|
|
+ Text(item.bookTitle)
|
|
|
.attributeModifier(new CustomTextStyle({size: 14, weight: 400, color: '#FF111111'}))
|
|
|
|
|
|
Row(){
|
|
|
@@ -208,7 +212,7 @@ export struct ThirdView {
|
|
|
|
|
|
Row({space: 8}){
|
|
|
tagItemComp('情绪价值', '#FF4EB1EF', '#FFEDF7FD')
|
|
|
- tagItemComp('3-8岁', '#FFFC9911', '#FFFFF5E7')
|
|
|
+ tagItemComp(`${item.minAge}-${item.maxAge}岁`, '#FFFC9911', '#FFFFF5E7')
|
|
|
}
|
|
|
}
|
|
|
.width("100%")
|
|
|
@@ -227,7 +231,7 @@ export struct ThirdView {
|
|
|
.alignItems(VerticalAlign.Center)
|
|
|
.padding({left: 9, top: 8, right: 9, bottom: 8})
|
|
|
}
|
|
|
- .swipeAction({ end: () => { this.swipeAction() } })
|
|
|
+ .swipeAction({ end: () => { this.swipeAction(item, index) } })
|
|
|
})
|
|
|
}
|
|
|
.width("100%").height("100%")
|
|
|
@@ -257,7 +261,7 @@ export struct ThirdView {
|
|
|
}
|
|
|
|
|
|
@Builder
|
|
|
- swipeAction(){
|
|
|
+ swipeAction(item: BookItem, index: number){
|
|
|
Row(){
|
|
|
Text('移除')
|
|
|
.attributeModifier(new CustomTextStyle({size: 16, weight: 400, color: '#FFFFFFFF'}))
|
|
|
@@ -269,5 +273,7 @@ export struct ThirdView {
|
|
|
.alignItems(VerticalAlign.Center)
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
.padding({left: 15, right: 15})
|
|
|
+
|
|
|
+ .onClick(() => { this.vm.removeBook(item) })
|
|
|
}
|
|
|
}
|