|
@@ -24,9 +24,9 @@ const Index = forwardRef((props: Props) => {
|
|
const { bookStore, classifyStore, indexStore } = props.store
|
|
const { bookStore, classifyStore, indexStore } = props.store
|
|
const { getBookPageList } = useApi()
|
|
const { getBookPageList } = useApi()
|
|
const [pageShow, setPageShow] = useState(false)//防止小程序切换页面组件不会被真实卸载,阻止不必要的操作
|
|
const [pageShow, setPageShow] = useState(false)//防止小程序切换页面组件不会被真实卸载,阻止不必要的操作
|
|
- const [isFixed, setIsFixed] = useState(false)
|
|
|
|
const [open, setOpen] = useState(false)
|
|
const [open, setOpen] = useState(false)
|
|
const [showEmpty, setShowEmpty] = useState(false)
|
|
const [showEmpty, setShowEmpty] = useState(false)
|
|
|
|
+ const [isSetOpen, setIsSetOpen] = useState(true)
|
|
// 获取分类列表
|
|
// 获取分类列表
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
if (pageShow) {
|
|
if (pageShow) {
|
|
@@ -42,7 +42,7 @@ const Index = forwardRef((props: Props) => {
|
|
showEmpty && setShowEmpty(false)
|
|
showEmpty && setShowEmpty(false)
|
|
categoryId.id != 0 && classifyStore.categoryId && getList({ workDirection, categoryId: categoryId.id, pageNum: 1, pageSize: 10 }).then((res: any) => {
|
|
categoryId.id != 0 && classifyStore.categoryId && getList({ workDirection, categoryId: categoryId.id, pageNum: 1, pageSize: 10 }).then((res: any) => {
|
|
if (res?.data?.data?.total === 0) {
|
|
if (res?.data?.data?.total === 0) {
|
|
- !showEmpty && setShowEmpty(true)
|
|
|
|
|
|
+ !showEmpty && setShowEmpty(true)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -108,32 +108,36 @@ const Index = forwardRef((props: Props) => {
|
|
return {}
|
|
return {}
|
|
})
|
|
})
|
|
return (
|
|
return (
|
|
-
|
|
|
|
<View className='index'>
|
|
<View className='index'>
|
|
- {bookStore?.classifyData?.length > 0 && <View style={isFixed ? { position: 'fixed', background: "#fff" } : { background: "#fff" }} className='classList'>
|
|
|
|
|
|
+ {bookStore?.classifyData?.length > 0 && <View style={{ background: "#fff" }} className='classList' onClick={() => { setIsSetOpen(false) }}>
|
|
<BookTypeTabs open={open} onCallback={setOpen} typeValue={bookStore?.classifyData} typeTabIndex={classifyStore.categoryId} workDirection={bookStore.workDirection} ></BookTypeTabs>
|
|
<BookTypeTabs open={open} onCallback={setOpen} typeValue={bookStore?.classifyData} typeTabIndex={classifyStore.categoryId} workDirection={bookStore.workDirection} ></BookTypeTabs>
|
|
</View>}
|
|
</View>}
|
|
- <ScrollViewHoc callback={(top) => {
|
|
|
|
- if (top > 100 && open) {
|
|
|
|
- setOpen(false)
|
|
|
|
- }
|
|
|
|
- if (top < 100 && !open) {
|
|
|
|
- setOpen(true)
|
|
|
|
- }
|
|
|
|
- }} load={load} refresh={refresh} reloadState={open} filterClassName='.classList' navHeight={indexStore.navHeight}>
|
|
|
|
- <View className='w row for_top1 pd_btm'>
|
|
|
|
- {
|
|
|
|
- bookStore?.bookList?.records?.length > 0 && bookStore?.bookList?.records?.map((item, index) => {
|
|
|
|
- return <>
|
|
|
|
- <View key={item.bookId} ><BookboxRowBig {...item} /></View>
|
|
|
|
- </>
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- {
|
|
|
|
- showEmpty && <Empty />
|
|
|
|
- }
|
|
|
|
- </View>
|
|
|
|
- </ScrollViewHoc>
|
|
|
|
|
|
+ <View onTouchStart={() => { setIsSetOpen(true) }}>
|
|
|
|
+ <ScrollViewHoc
|
|
|
|
+ callback={(top) => {
|
|
|
|
+ if (isSetOpen) {
|
|
|
|
+ if (top > 100 && open) {
|
|
|
|
+ setOpen(false)
|
|
|
|
+ }
|
|
|
|
+ if (top < 100 && !open) {
|
|
|
|
+ setOpen(true)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }} load={load} refresh={refresh} reloadState={open} filterClassName='.classList' navHeight={indexStore.navHeight}>
|
|
|
|
+ <View className='w row for_top1 pd_btm'>
|
|
|
|
+ {
|
|
|
|
+ bookStore?.bookList?.records?.length > 0 && bookStore?.bookList?.records?.map((item, index) => {
|
|
|
|
+ return <>
|
|
|
|
+ <View key={item.bookId} ><BookboxRowBig {...item} /></View>
|
|
|
|
+ </>
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ {
|
|
|
|
+ showEmpty && <Empty />
|
|
|
|
+ }
|
|
|
|
+ </View>
|
|
|
|
+ </ScrollViewHoc>
|
|
|
|
+ </View>
|
|
</View>
|
|
</View>
|
|
|
|
|
|
);
|
|
);
|