|
|
@@ -1,4 +1,4 @@
|
|
|
-import { RouterPage, yTRouter } from 'basic';
|
|
|
+import { BookItem, RouterPage, yTRouter } from 'basic';
|
|
|
import { tagItemComp } from '../../components/BuilderIndex';
|
|
|
import { SchoolBag } from '../../components/SchoolBag';
|
|
|
import { CustomTextStyle } from '../../style/CustomTextStyle';
|
|
|
@@ -7,7 +7,7 @@ import { BookItemDetailViewModel } from '../viewModel/BookItemDetailViewModel';
|
|
|
@ComponentV2
|
|
|
@RouterPage
|
|
|
struct BookItemDetailPage {
|
|
|
- @Local vm: BookItemDetailViewModel = new BookItemDetailViewModel();
|
|
|
+ @Param @Require vm: BookItemDetailViewModel;
|
|
|
|
|
|
build() {
|
|
|
NavDestination() {
|
|
|
@@ -20,7 +20,7 @@ struct BookItemDetailPage {
|
|
|
ListItem(){
|
|
|
Stack({alignContent: Alignment.TopStart}){
|
|
|
Row(){
|
|
|
- Image('https://th.bing.com/th/id/R.8bbf769b39bb26eefb9b6de51c23851d?rik=crTnc5i8A%2b8p7A&riu=http%3a%2f%2fpicview.iituku.com%2fcontentm%2fzhuanji%2fimg%2f202207%2f09%2fe7196ac159f7cf2b.jpg%2fnu&ehk=DYPLVpoNAXLj5qzwgR5vHf9DladFh%2b34s4UcuP3Kn6E%3d&risl=&pid=ImgRaw&r=0')
|
|
|
+ Image(this.vm.book.coverUrl)
|
|
|
.height(344)
|
|
|
}
|
|
|
.width("100%").height('100%')
|
|
|
@@ -49,7 +49,7 @@ struct BookItemDetailPage {
|
|
|
Span(' 元/天')
|
|
|
}.attributeModifier(new CustomTextStyle({size: 14, weight: 500}))
|
|
|
|
|
|
- Text(`市场售价:¥${30.5}`)
|
|
|
+ Text(`市场售价:¥${this.vm.book.marketPrice}`)
|
|
|
.borderRadius(9)
|
|
|
.backgroundColor(Color.White)
|
|
|
.padding({left: 10, right: 10, top: 2, bottom: 2})
|
|
|
@@ -73,21 +73,21 @@ struct BookItemDetailPage {
|
|
|
ListItem(){
|
|
|
Column({space: 12}){
|
|
|
Column({space: 8}){
|
|
|
- Text('我有友情要出租(拼音版)')
|
|
|
+ Text(this.vm.book.bookTitle)
|
|
|
.attributeModifier(new CustomTextStyle({size: 18, weight: 600}))
|
|
|
|
|
|
Row({space: 8}){
|
|
|
tagItemComp('情绪价值', '#4EB1EF', '#EDF7FD')
|
|
|
tagItemComp('哄娃神器', '#4EB1EF', '#EDF7FD')
|
|
|
- tagItemComp('3-8岁', '#FC9911', '#FFF5E7')
|
|
|
+ tagItemComp(`${this.vm.book.minAge}-${this.vm.book.maxAge}岁`, '#FC9911', '#FFF5E7')
|
|
|
}
|
|
|
|
|
|
Column(){
|
|
|
Text(){
|
|
|
- Span('语言:中文\n')
|
|
|
- Span('作者:啊啊啊啊啊啊啊啊啊啊\n')
|
|
|
- Span('出版社:啊啊啊啊啊啊啊啊啊啊\n')
|
|
|
- Span('出版时间:2022-07-09\n')
|
|
|
+ Span(`语言:${this.vm.book.language}` + '\n')
|
|
|
+ Span(`作者:${this.vm.book.author}` + '\n')
|
|
|
+ Span(`出版社:${this.vm.book.publisher}` + '\n')
|
|
|
+ Span(`出版时间:${this.vm.book.publicationDate?.split(' ')[1]}}`)
|
|
|
}
|
|
|
.attributeModifier(new CustomTextStyle({size: 12, weight: 400, color: '#80000000'}))
|
|
|
}
|
|
|
@@ -106,7 +106,7 @@ struct BookItemDetailPage {
|
|
|
|
|
|
|
|
|
// 本书书单
|
|
|
- if(true){
|
|
|
+ if(false){
|
|
|
Column({space: 12}){
|
|
|
Row(){
|
|
|
Text('本书书单')
|
|
|
@@ -154,28 +154,63 @@ struct BookItemDetailPage {
|
|
|
|
|
|
// 图书介绍
|
|
|
if(true){
|
|
|
- Column({space: 13}){
|
|
|
- Column(){
|
|
|
- Text('图书简介')
|
|
|
- .zIndex(99)
|
|
|
- .attributeModifier(new CustomTextStyle({size: 16, weight: 600, color: '#FF000000'}))
|
|
|
-
|
|
|
- Image($r('[basic].media.icon_SelectBg'))
|
|
|
- .width(45)
|
|
|
- .height(16)
|
|
|
- .margin({top:-10})
|
|
|
- }
|
|
|
+ // Column({space: 13}){
|
|
|
+ // Column(){
|
|
|
+ // Text('图书简介')
|
|
|
+ // .zIndex(99)
|
|
|
+ // .attributeModifier(new CustomTextStyle({size: 16, weight: 600, color: '#FF000000'}))
|
|
|
+ //
|
|
|
+ // Image($r('[basic].media.icon_SelectBg'))
|
|
|
+ // .width(45)
|
|
|
+ // .height(16)
|
|
|
+ // .margin({top:-10})
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // Text('哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈\n' +
|
|
|
+ // '哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈\n' +
|
|
|
+ // '哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈\n' +
|
|
|
+ // '哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈')
|
|
|
+ // .attributeModifier(new CustomTextStyle({size: 12, weight: 400, color: '#FF555555'}))
|
|
|
+ // }
|
|
|
+ // .borderRadius(10)
|
|
|
+ // .alignItems(HorizontalAlign.Start)
|
|
|
+ // .padding({left: 15, right: 15, top: 11, bottom: 11})
|
|
|
+ // .linearGradient({colors: [['#FFFFF6D9', 0], ['#FFFFFFFF', 1]]})
|
|
|
+ //富文本
|
|
|
+ Web({ src: $rawfile('index.html'), controller: this.vm.webController, renderMode: RenderMode.SYNC_RENDER })
|
|
|
+ .margin(5)
|
|
|
+ .width('100%')
|
|
|
+ .javaScriptAccess(true)
|
|
|
+ // .height(this.vm.webHeight).../
|
|
|
+ .backgroundColor(Color.Transparent)
|
|
|
+ .overScrollMode(OverScrollMode.NEVER) // 禁用弹性回弹
|
|
|
+ .onPageEnd(() => {
|
|
|
+ this.vm.webController.runJavaScript(`writeHtml(\`${this.vm.book.remark}\`)`).catch(() => {
|
|
|
+ console.log('writeHtml error')
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // .onControllerAttached(() => {
|
|
|
+ // this.vm.webController.loadData('<!DOCTYPE html>' +
|
|
|
+ // "<html><body style=\"font-size:16px;color:rgba(0,0,0,0.6);flex-shrink:0;font-style:normal;font-weight:normal;background-color:rgb(255, 255, 255);\">" +
|
|
|
+ // " <style>\n" +
|
|
|
+ // " p { \n" +
|
|
|
+ // " margin: 0; /* 清除默认上下边距 */\n" +
|
|
|
+ // " padding: 8px 0; /* 可自定义段落间距,避免过密 */\n" +
|
|
|
+ // " line-height: 1.6; /* 优化行高,提升可读性 */\n" +
|
|
|
+ // " }\n" +
|
|
|
+ // " img { \n" +
|
|
|
+ // " max-width: 100%; /* 图片自适应容器,避免溢出导致的空白 */\n" +
|
|
|
+ // " height: auto; \n" +
|
|
|
+ // " margin: 10px 0; /* 图片与文字间留适当间距 */\n" +
|
|
|
+ // " }\n" +
|
|
|
+ // " </style>" +
|
|
|
+ // this.vm.book.remark
|
|
|
+ // + "</body> </html>",
|
|
|
+ // "text/html",
|
|
|
+ // "UTF-8", " ", " ");
|
|
|
+ // })
|
|
|
|
|
|
- Text('哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈\n' +
|
|
|
- '哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈\n' +
|
|
|
- '哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈\n' +
|
|
|
- '哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈')
|
|
|
- .attributeModifier(new CustomTextStyle({size: 12, weight: 400, color: '#FF555555'}))
|
|
|
- }
|
|
|
- .borderRadius(10)
|
|
|
- .alignItems(HorizontalAlign.Start)
|
|
|
- .padding({left: 15, right: 15, top: 11, bottom: 11})
|
|
|
- .linearGradient({colors: [['#FFFFF6D9', 0], ['#FFFFFFFF', 1]]})
|
|
|
+ // .layoutMode(WebLayoutMode.FIT_CONTENT)
|
|
|
}
|
|
|
}
|
|
|
.backgroundColor('#F5F7F8')
|
|
|
@@ -226,6 +261,6 @@ struct BookItemDetailPage {
|
|
|
|
|
|
|
|
|
@Builder
|
|
|
-function BookItemDetailBuilder() {
|
|
|
- BookItemDetailPage()
|
|
|
+function BookItemDetailBuilder(_: string, book: BookItem) {
|
|
|
+ BookItemDetailPage({ vm: new BookItemDetailViewModel(book)})
|
|
|
}
|