BookboxRowSmall.tsx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**书架中书籍的box容器横小 */
  2. import { Text, View, Image, Button, Navigator } from "@tarojs/components";
  3. import React from 'react'
  4. import './index.less'
  5. import BookStore from "@src/store/book"
  6. import { setReadLog } from "@src/utils/loginSto";
  7. export interface BookboxRowSmallProps {
  8. bookId: number,//书ID
  9. authorName: string,//作者
  10. bookName: string,//书名称
  11. bookDesc: string,//描述
  12. picUrl: string,//封面
  13. bookStatus: number,//完本|连载状态
  14. wordCount: number,//字数
  15. labelInfoList: { name: string }[],//标签
  16. readLogId: string,//上次阅读的记录
  17. }
  18. function BookboxRowSmall(props: BookboxRowSmallProps) {
  19. const { bookName, picUrl, bookDesc, labelInfoList, authorName, bookId, wordCount, bookStatus, readLogId } = props
  20. const click = () => {
  21. BookStore.setData({ openBookData: props })
  22. if (readLogId) {
  23. setReadLog({ [bookId]: readLogId })
  24. }
  25. }
  26. return <View className='book_box_row_small' onClick={click} style={{ margin: 0 }}>
  27. <Navigator url={`/pages/book/bookArticle/index?bookId=${bookId}}`} hoverClass="none">
  28. <Image src={picUrl} className='img'></Image>
  29. <View className='right'>
  30. <Text className='title'>{bookName}</Text>
  31. <View className='content'>
  32. <View className='left'>
  33. <Text className='author'>{authorName}</Text>
  34. <View className='bottom'>
  35. {
  36. true ? <>
  37. <Text className='time'>{123}</Text>
  38. {/* <Text className='section'>{chapter_name}</Text> */}
  39. </>
  40. :
  41. <Text className='null'>未读</Text>
  42. }
  43. </View>
  44. </View>
  45. <Button className='btn' plain={true}>继续阅读</Button>
  46. </View>
  47. </View>
  48. </Navigator>
  49. </View>
  50. }
  51. export default React.memo(BookboxRowSmall)