|
@@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from 'react';
|
|
|
import { observer, inject } from 'mobx-react';
|
|
|
import { useDidHide, useDidShow } from '@tarojs/taro';
|
|
|
//==========components组件引用========================
|
|
|
-import TopNavBar from '@src/components/TopNavBar';
|
|
|
+import TopNavBar1 from '@src/components/TopNavBar/index1';
|
|
|
import ScrollViewHoc from '@src/components/ScrollView';
|
|
|
import { Store } from '@src/app';
|
|
|
import useApi from '@src/Hook/useApi';
|
|
@@ -144,7 +144,7 @@ const Index: React.FC<Props> = ({ store }) => {
|
|
|
}
|
|
|
//下拉加载
|
|
|
const load = async () => {
|
|
|
- if(indexConfig['guess_like']){
|
|
|
+ if (indexConfig['guess_like']) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
let { size, total, records } = indexStore?.indexGuessLike?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]
|
|
|
let pageSize = size + 20
|
|
@@ -164,134 +164,137 @@ const Index: React.FC<Props> = ({ store }) => {
|
|
|
}
|
|
|
}
|
|
|
return <ScrollViewHoc load={load} filterClassName='.searchTs' navHeight={indexStore.navHeight}>
|
|
|
- <View style={{ display: "flex", flexFlow: 'column' }}>
|
|
|
- {/* 轮播 */}
|
|
|
- {indexConfig['banners'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
- <BannerBox data={indexStore?.indexBanners || []} />
|
|
|
- </View>}
|
|
|
- {/* 今日热门 */}
|
|
|
- {indexConfig['hot_books'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
- <BookHead showBtn={indexStore?.indexHotBooks?.showRightButton} title={indexStore?.indexHotBooks?.name || "今日热书"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
- Taro.navigateTo({ url: `/pages/indexMore/index?title=今日热书&dataName=indexHotBooks` })
|
|
|
- }}></BookHead>
|
|
|
- <View ><BookboxRowMiddle {...indexStore?.indexHotBooks?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.[0]} /></View>
|
|
|
- <View className='w row'>
|
|
|
- {
|
|
|
- indexStore?.indexHotBooks?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
- if (index > 0 && index < 5) {
|
|
|
+ <TopNavBar1 {...{
|
|
|
+ tab: true,
|
|
|
+ tabVal: [{ value: 0, text: "男生" }, { value: 1, text: "女生" }],
|
|
|
+ backgroundColor: '#fff',
|
|
|
+ color: "#333",
|
|
|
+ search: true,
|
|
|
+ }}>
|
|
|
+ <View style={{ display: "flex", flexFlow: 'column' }}>
|
|
|
+ {/* 轮播 */}
|
|
|
+ {indexConfig['banners'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
+ <BannerBox data={indexStore?.indexBanners || []} />
|
|
|
+ </View>}
|
|
|
+ {/* 今日热门 */}
|
|
|
+ {indexConfig['hot_books'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
+ <BookHead showBtn={indexStore?.indexHotBooks?.showRightButton} title={indexStore?.indexHotBooks?.name || "今日热书"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
+ Taro.navigateTo({ url: `/pages/indexMore/index?title=今日热书&dataName=indexHotBooks` })
|
|
|
+ }}></BookHead>
|
|
|
+ <View ><BookboxRowMiddle {...indexStore?.indexHotBooks?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.[0]} /></View>
|
|
|
+ <View className='w row'>
|
|
|
+ {
|
|
|
+ indexStore?.indexHotBooks?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
+ if (index > 0 && index < 5) {
|
|
|
+ return <View key={index}><BookboxColumnSmall {...item} /></View>
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>}
|
|
|
+ {/* 热门分类 */}
|
|
|
+ {indexConfig['hot_category'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
+ <BookHead showBtn={indexStore?.indexHotCategory?.showRightButton} title={indexStore?.indexHotCategory?.name || "热门分类"} fitTitle="全部分类" imgUrl={require('../../icon/right.png')} fitOnBack={() => { Taro.switchTab({ url: '/pages/classify/index' }) }} />
|
|
|
+ <BookHotTabs hotValue={indexStore?.indexHotCategory?.bookCategoryList || []} onBack={(value) => {
|
|
|
+ getHotBooks(value)
|
|
|
+ }} />
|
|
|
+ <View className='w row4'>
|
|
|
+ {
|
|
|
+ bookStore?.bookList?.records?.map((item, index) => {
|
|
|
return <View key={index}><BookboxColumnSmall {...item} /></View>
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- </View>
|
|
|
- </View>}
|
|
|
- {/* 热门分类 */}
|
|
|
- {indexConfig['hot_category'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
- <BookHead showBtn={indexStore?.indexHotCategory?.showRightButton} title={indexStore?.indexHotCategory?.name || "热门分类"} fitTitle="全部分类" imgUrl={require('../../icon/right.png')} fitOnBack={() => { Taro.switchTab({ url: '/pages/classify/index' }) }} />
|
|
|
- <BookHotTabs hotValue={indexStore?.indexHotCategory?.bookCategoryList || []} onBack={(value) => {
|
|
|
- getHotBooks(value)
|
|
|
- }} />
|
|
|
- <View className='w row4'>
|
|
|
- {
|
|
|
- bookStore?.bookList?.records?.map((item, index) => {
|
|
|
- return <View key={index}><BookboxColumnSmall {...item} /></View>
|
|
|
- })
|
|
|
- }
|
|
|
- </View>
|
|
|
- </View>}
|
|
|
- {/* 重磅新书 new_books*/}
|
|
|
- {indexConfig['new_books'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
- <BookHead showBtn={indexStore?.indexNewBooks?.showRightButton} title={indexStore?.indexNewBooks?.name || "重磅新书"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
- Taro.navigateTo({ url: `/pages/indexMore/index?title=重磅新书&dataName=indexNewBooks` })
|
|
|
- }} />
|
|
|
- <View className='w row'>
|
|
|
- {
|
|
|
- indexStore?.indexNewBooks?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
- if (index < 3) {
|
|
|
- return <View key={index}><BookboxColumnBig {...item} /></View>
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- </View>
|
|
|
- </View>}
|
|
|
- {/* 热门推荐 hot_rec*/}
|
|
|
- {indexConfig['hot_rec'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
- <BookHead showBtn={indexStore?.indexHotRec?.showRightButton} title={indexStore?.indexHotRec?.name || "热门推荐"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
- Taro.navigateTo({ url: `/pages/indexMore/index?title=热门推荐&dataName=indexHotRec` })
|
|
|
- }} />
|
|
|
- <View className='w row'>
|
|
|
- {
|
|
|
- indexStore?.indexHotRec?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
- if (index < 3) {
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>}
|
|
|
+ {/* 重磅新书 new_books*/}
|
|
|
+ {indexConfig['new_books'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
+ <BookHead showBtn={indexStore?.indexNewBooks?.showRightButton} title={indexStore?.indexNewBooks?.name || "重磅新书"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
+ Taro.navigateTo({ url: `/pages/indexMore/index?title=重磅新书&dataName=indexNewBooks` })
|
|
|
+ }} />
|
|
|
+ <View className='w row'>
|
|
|
+ {
|
|
|
+ indexStore?.indexNewBooks?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
+ if (index < 3) {
|
|
|
+ return <View key={index}><BookboxColumnBig {...item} /></View>
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>}
|
|
|
+ {/* 热门推荐 hot_rec*/}
|
|
|
+ {indexConfig['hot_rec'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
+ <BookHead showBtn={indexStore?.indexHotRec?.showRightButton} title={indexStore?.indexHotRec?.name || "热门推荐"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
+ Taro.navigateTo({ url: `/pages/indexMore/index?title=热门推荐&dataName=indexHotRec` })
|
|
|
+ }} />
|
|
|
+ <View className='w row'>
|
|
|
+ {
|
|
|
+ indexStore?.indexHotRec?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
+ if (index < 3) {
|
|
|
+ return <View key={index}><BookboxRowMiddle {...item} /></View>
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>}
|
|
|
+ {/* 口碑佳作 best_reviews*/}
|
|
|
+ {indexConfig['best_reviews'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
+ <BookHead showBtn={indexStore?.indexBestReviews?.showRightButton} title={indexStore?.indexBestReviews?.name || "口碑佳作"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
+ Taro.navigateTo({ url: `/pages/indexMore/index?title=口碑佳作&dataName=indexBestReviews` })
|
|
|
+ }} />
|
|
|
+ <View className='w row'>
|
|
|
+ {
|
|
|
+ indexStore?.indexBestReviews?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
+ if (index < 4) {
|
|
|
+ return <View key={index}><BookboxColumnSmall {...item} /></View>
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>}
|
|
|
+ {/* 经典热书 classic_books*/}
|
|
|
+ {indexConfig['classic_books'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
+ <BookHead showBtn={indexStore?.indexClassicBooks?.showRightButton} title={indexStore?.indexClassicBooks?.name || "经典热书"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
+ Taro.navigateTo({ url: `/pages/indexMore/index?title=经典热书&dataName=indexClassicBooks` })
|
|
|
+ }} />
|
|
|
+ <View className='w row'>
|
|
|
+ {
|
|
|
+ indexStore?.indexClassicBooks?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
+ if (index < 8) {
|
|
|
+ return <View key={index}><BookboxColumnSmall {...item} /></View>
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>}
|
|
|
+ {/* 必看好书 best_books*/}
|
|
|
+ {indexConfig['best_books'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
+ <BookHead showBtn={indexStore?.indexBestBooks?.showRightButton} title={indexStore?.indexBestBooks?.name || "必看好书"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
+ Taro.navigateTo({ url: `/pages/indexMore/index?title=必看好书&dataName=indexBestBooks` })
|
|
|
+ }} />
|
|
|
+ <View className='w row'>
|
|
|
+ {
|
|
|
+ indexStore?.indexBestBooks?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
+ if (index < 3) {
|
|
|
+ return <View key={index}><BookboxRowMiddle {...item} /></View>
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>}
|
|
|
+ {/* 猜你喜欢 guess_like*/}
|
|
|
+ {indexConfig['guess_like'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
+ <BookHead showBtn={indexStore?.indexGuessLike?.showRightButton} title={indexStore?.indexGuessLike?.name || "猜你喜欢"} />
|
|
|
+ <View className='w row'>
|
|
|
+ {
|
|
|
+ indexStore?.indexGuessLike?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.records?.map((item, index) => {
|
|
|
return <View key={index}><BookboxRowMiddle {...item} /></View>
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- </View>
|
|
|
- </View>}
|
|
|
- {/* 口碑佳作 best_reviews*/}
|
|
|
- {indexConfig['best_reviews'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
- <BookHead showBtn={indexStore?.indexBestReviews?.showRightButton} title={indexStore?.indexBestReviews?.name || "口碑佳作"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
- Taro.navigateTo({ url: `/pages/indexMore/index?title=口碑佳作&dataName=indexBestReviews` })
|
|
|
- }} />
|
|
|
- <View className='w row'>
|
|
|
- {
|
|
|
- indexStore?.indexBestReviews?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
- if (index < 4) {
|
|
|
- return <View key={index}><BookboxColumnSmall {...item} /></View>
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- </View>
|
|
|
- </View>}
|
|
|
- {/* 经典热书 classic_books*/}
|
|
|
- {indexConfig['classic_books'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
- <BookHead showBtn={indexStore?.indexClassicBooks?.showRightButton} title={indexStore?.indexClassicBooks?.name || "经典热书"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
- Taro.navigateTo({ url: `/pages/indexMore/index?title=经典热书&dataName=indexClassicBooks` })
|
|
|
- }} />
|
|
|
- <View className='w row'>
|
|
|
- {
|
|
|
- indexStore?.indexClassicBooks?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
- if (index < 8) {
|
|
|
- return <View key={index}><BookboxColumnSmall {...item} /></View>
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- </View>
|
|
|
- </View>}
|
|
|
- {/* 必看好书 best_books*/}
|
|
|
- {indexConfig['best_books'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
- <BookHead showBtn={indexStore?.indexBestBooks?.showRightButton} title={indexStore?.indexBestBooks?.name || "必看好书"} fitTitle="更多" imgUrl={require('../../icon/right.png')} fitOnBack={() => {
|
|
|
- Taro.navigateTo({ url: `/pages/indexMore/index?title=必看好书&dataName=indexBestBooks` })
|
|
|
- }} />
|
|
|
- <View className='w row'>
|
|
|
- {
|
|
|
- indexStore?.indexBestBooks?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
- if (index < 3) {
|
|
|
- return <View key={index}><BookboxRowMiddle {...item} /></View>
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- </View>
|
|
|
- </View>}
|
|
|
- {/* 猜你喜欢 guess_like*/}
|
|
|
- {indexConfig['guess_like'] && <View style={{ order: indexConfig['banners'].eq }}>
|
|
|
- <BookHead showBtn={indexStore?.indexGuessLike?.showRightButton} title={indexStore?.indexGuessLike?.name || "猜你喜欢"} />
|
|
|
- <View className='w row'>
|
|
|
- {
|
|
|
- indexStore?.indexGuessLike?.[app?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.records?.map((item, index) => {
|
|
|
- return <View key={index}><BookboxRowMiddle {...item} /></View>
|
|
|
- })
|
|
|
- }
|
|
|
- </View>
|
|
|
- </View>}
|
|
|
- </View>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>}
|
|
|
+ </View>
|
|
|
+ </TopNavBar1>
|
|
|
+
|
|
|
</ScrollViewHoc>
|
|
|
};
|
|
|
-export default TopNavBar(inject('store')(observer(Index)), {
|
|
|
- tab: true,
|
|
|
- tabVal: [{ value: 0, text: "男生" }, { value: 1, text: "女生" }],
|
|
|
- backgroundColor: '#fff',
|
|
|
- color: "#333",
|
|
|
- search: true
|
|
|
-});
|
|
|
+export default inject('store')(observer(Index))
|