BookboxRowBig.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**分类书籍的box容器 横大*/
  2. import { Text, View, Image, Navigator } from "@tarojs/components";
  3. import React from 'react'
  4. import './index.less'
  5. export interface BookboxRowBigProps {
  6. bookId: number,//书ID
  7. authorName:string,//作者
  8. bookName: string,//书名称
  9. bookDesc:string,//描述
  10. picUrl: string,//封面
  11. bookStatus: number,//完本|连载状态
  12. wordCount: number,//字数
  13. labelInfoList:{name:string}[],//标签
  14. }
  15. function BookboxRowBig(props: BookboxRowBigProps) {
  16. const { bookName, picUrl, bookDesc, labelInfoList, authorName, bookId, wordCount, bookStatus } = props
  17. let describe = ""
  18. if(wordCount && bookStatus) {
  19. describe = `${bookName}·${(wordCount/10000).toFixed(0)}万字·${bookStatus === 0 ? '连载' : '完本'}`
  20. }
  21. const click = () => {
  22. // BookStore.setData({ openBookData: props })
  23. }
  24. return <View className='book_box_row_big' onClick={click}>
  25. <Navigator url={'/pages/book/bookDetails/index?bookId=' + bookId} hoverClass="none">
  26. <Image src={picUrl || ''} className='img'></Image>
  27. <View className='right'>
  28. <Text className='title'>{bookName}</Text>
  29. <View className='content'>
  30. <View className='left'>
  31. <Text className='details'>{bookDesc.replace(/\s/ig,'')}</Text>
  32. <View className='bottom'>
  33. <Text className='describe'>{describe || authorName}</Text>
  34. {
  35. labelInfoList.length > 0 && <Text className='label'>{labelInfoList[0].name}</Text>
  36. }
  37. </View>
  38. </View>
  39. </View>
  40. </View>
  41. </Navigator>
  42. </View>
  43. }
  44. export default React.memo(BookboxRowBig)