BookListDetailPage.ets 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. import { BookItem, RouterPage, YTHeader } from 'basic';
  2. import { BookItemComp } from '../../components/BookItemComp';
  3. import { SchoolBag } from '../../components/SchoolBag';
  4. import { BookListItem } from '../../model/BookModelIndex';
  5. import { CustomTextStyle } from '../../style/CustomTextStyle';
  6. import { BookListDetailViewModel } from '../viewModel/BookListDetailViewModel';
  7. @ComponentV2
  8. @RouterPage
  9. struct BookListDetailPage {
  10. @Param @Require vm: BookListDetailViewModel;
  11. build() {
  12. NavDestination() {
  13. RelativeContainer(){
  14. Column() {
  15. YTHeader({
  16. defaultStyle: { title: '书单详情' },
  17. bgc: Color.White
  18. })
  19. Column(){
  20. List(){
  21. ListItem(){
  22. Column(){
  23. Text(this.vm.item.bookListName)
  24. .attributeModifier(new CustomTextStyle({size: 18, weight: 600, color: '#FF111111'}))
  25. Row(){
  26. Text(this.vm.item.author)
  27. .attributeModifier(new CustomTextStyle({size: 14, weight: 400, color: '#FF555555'}))
  28. Row(){
  29. // Text('2028人')
  30. // .attributeModifier(new CustomTextStyle({size: 14, weight: 600, color: '#FF111111'}))
  31. }
  32. }
  33. .width('100%')
  34. .margin({top: 30})
  35. .justifyContent(FlexAlign.SpaceBetween)
  36. Column(){
  37. Text(this.vm.item.synopsis)
  38. .attributeModifier(new CustomTextStyle({size: 14, weight: 400, color: '#FF555555'}))
  39. }
  40. .height(100)
  41. .width('100%')
  42. .margin({top: 5})
  43. .padding({top: 23, left: 5})
  44. .alignItems(HorizontalAlign.Start)
  45. .backgroundImageSize({width: '100%', height: '100%'})
  46. .backgroundImage($r('[basic].media.png_ListDetailBg'))
  47. }
  48. .padding({bottom: 13})
  49. .backgroundColor(Color.White)
  50. .padding({left: 16, right: 16})
  51. .alignItems(HorizontalAlign.Start)
  52. .borderRadius({bottomLeft: 16, bottomRight: 16})
  53. }
  54. ListItem(){
  55. Row(){
  56. Column(){
  57. Text(`共${this.vm.item.bookCount}册`)
  58. .zIndex(99)
  59. .attributeModifier(new CustomTextStyle({size: 18, weight: 600}))
  60. Image($r('[basic].media.icon_SelectBg'))
  61. .width(45)
  62. .height(16)
  63. .margin({top:-10})
  64. }
  65. Text(``) // 已读xx本
  66. .attributeModifier(new CustomTextStyle({size: 14, weight: 500, color: '#FF7C7D7D'}))
  67. }
  68. .width('100%')
  69. .justifyContent(FlexAlign.SpaceBetween)
  70. }
  71. .margin({top: 12})
  72. .padding({left: 16, right: 16})
  73. ForEach(this.vm.bookList, (item: BookItem, index) => {
  74. ListItem(){
  75. Column(){
  76. BookItemComp({ item: item })
  77. }.alignItems(HorizontalAlign.End).justifyContent(FlexAlign.End)
  78. }
  79. .margin({top: 8})
  80. .padding({left: 16, right: 16})
  81. })
  82. ListItem().height(this.vm.safeBottom)
  83. }
  84. .width('100%')
  85. .height('100%')
  86. .scrollBar(BarState.Off)
  87. .backgroundColor('#F7F9FA')
  88. }
  89. .width("100%")
  90. .layoutWeight(1)
  91. .backgroundColor(Color.White)
  92. }
  93. Column({space: 3}){
  94. Column({space: 3}){
  95. Image($r('[basic].media.icon_deerIncrease'))
  96. .width(24)
  97. .aspectRatio(1)
  98. Text('一键\n添加')
  99. .attributeModifier(new CustomTextStyle({size: 12, weight: 400}))
  100. }
  101. .width(42)
  102. .padding(9)
  103. .borderRadius(8)
  104. .backgroundColor(Color.White)
  105. .shadow({ color: '#40000000', radius: 8 })
  106. SchoolBag({compMode: true})
  107. }
  108. .margin({ bottom: 53, right: 31})
  109. .backgroundColor(Color.Transparent)
  110. .alignRules({
  111. right: { anchor: '__container__', align: HorizontalAlign.End },
  112. bottom: { anchor: '__container__', align: VerticalAlign.Bottom}
  113. })
  114. }
  115. }
  116. .hideTitleBar(true)
  117. }
  118. }
  119. @Builder
  120. function BookListDetailBuilder(_: string, item: BookListItem) {
  121. BookListDetailPage({ vm: new BookListDetailViewModel(item) })
  122. }