| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- /**分类书籍的box容器 横大*/
- import { Text, View, Image, Navigator } from "@tarojs/components";
- import React from 'react'
- import './index.less'
- import useApi from "@src/Hook/useApi";
- import Taro from "@tarojs/taro";
- let { getBookInfo } = useApi()
- export interface BookboxColumnBigProps {
- bookId: number,//书ID
- authorName: string,//作者
- bookName: string,//书名称
- bookDesc: string,//描述
- picUrl: string,//封面
- bookStatus: number,//完本|连载状态
- wordCount: number,//字数
- labelInfoList: { name: string }[],//标签
- vipFree: boolean
- }
- function BookboxColumnBig(props: BookboxColumnBigProps) {
- const { picUrl, bookName, bookId, authorName, vipFree } = props
-
- const click = () => {
- getBookInfo(bookId).then((res: { data: any, code: any }) => {
- if (res?.data?.code == 200) {
- console.log(res?.data?.data)
- let { wechatBookId,inBookshelf } = res?.data?.data
- let json = JSON.stringify({inBookshelf,bookId})
- let encode = encodeURIComponent(json)
- if (wechatBookId) {
- Taro.navigateTo({
- url: `plugin-private://wx293c4b6097a8a4d0/pages/novel/index?bookId=${wechatBookId}&customServerParams=${encode}`
- })
- }else{
- Taro.showToast({
- title: '小说未上架',
- icon: 'none'
- })
- }
- }
- })
- }
- return <View className='book_box_column_big' onClick={click} >
- <Image src={picUrl || ''} className={`img ${vipFree ? "isVip" : ""}`}></Image>
- <View className='bottom'>
- <Text className='title'>{bookName}</Text>
- <Text className='author'>{authorName}</Text>
- </View>
- </View>
- }
- export default React.memo(BookboxColumnBig)
|