|
@@ -24,17 +24,19 @@ const Index: React.FC<Props> = ({ store }) => {
|
|
|
// 首页配置信息
|
|
|
const indexConfig = useMemo(() => {
|
|
|
let obj = {}
|
|
|
- appInfoStore.appComponent?.forEach((item, index) => {
|
|
|
+ let thatPage = appInfoStore?.appInfo?.appPageComponentList.find(item => item.pagePath === 'pages/index/index')
|
|
|
+ let thatWd = thatPage?.appComponentListVOS?.find(item => item.workDirection === bookStore.workDirection)
|
|
|
+ thatWd?.appComponentListVOS?.forEach((item, index) => {
|
|
|
return obj[item.componentType] = { ...item, eq: index }
|
|
|
})
|
|
|
return obj
|
|
|
- }, [indexComponents, pageShow])
|
|
|
+ }, [indexComponents, pageShow, bookStore.workDirection])
|
|
|
// 页面显示请求数据
|
|
|
useEffect(() => {
|
|
|
- if (pageShow && appInfoStore.token) {
|
|
|
+ if (pageShow) {
|
|
|
indexCompontent()
|
|
|
}
|
|
|
- }, [pageShow, appInfoStore.token, , bookStore.workDirection, appInfoStore.appComponent]); // Dependency array, runs effect only once on mount and unmount
|
|
|
+ }, [pageShow, appInfoStore.token, bookStore.workDirection, appInfoStore.appInfo]); // Dependency array, runs effect only once on mount and unmount
|
|
|
// 使用 useDidShow 代替 onShow
|
|
|
useDidShow(() => {
|
|
|
// 分享消息配置
|
|
@@ -97,10 +99,10 @@ const Index: React.FC<Props> = ({ store }) => {
|
|
|
<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?.shortBookInfoListVOS?.[0]} /></View>
|
|
|
+ <View ><BookboxRowMiddle {...indexStore?.indexHotBooks?.[appInfoStore?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.[0]} /></View>
|
|
|
<View className='w row'>
|
|
|
{
|
|
|
- indexStore?.indexHotBooks?.shortBookInfoListVOS?.map((item, index) => {
|
|
|
+ indexStore?.indexHotBooks?.[appInfoStore?.appInfo?.appCategory === 1 ? "longBookInfoAppVOS" : "shortBookInfoAppVOS"]?.map((item, index) => {
|
|
|
if (index > 0 && index < 5) {
|
|
|
return <View key={index}><BookboxColumnSmall {...item} /></View>
|
|
|
}
|
|
@@ -110,7 +112,7 @@ const Index: React.FC<Props> = ({ store }) => {
|
|
|
</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' }) }} />
|
|
|
+ <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)
|
|
|
}} />
|
|
@@ -126,7 +128,7 @@ const Index: React.FC<Props> = ({ store }) => {
|
|
|
};
|
|
|
export default TopNavBar(inject('store')(observer(Index)), {
|
|
|
tab: true,
|
|
|
- tabVal: [{ value: "男生", text: "男生" }, { value: "女生", text: "女生" }],
|
|
|
+ tabVal: [{ value: 0, text: "男生" }, { value: 1, text: "女生" }],
|
|
|
backgroundColor: '#fff',
|
|
|
color: "#333",
|
|
|
search: true
|