|
@@ -25,7 +25,6 @@ const Index = forwardRef((props: Props) => {
|
|
|
const [pageShow, setPageShow] = useState(false)//防止小程序切换页面组件不会被真实卸载,阻止不必要的操作
|
|
|
const [open, setOpen] = useState(false)
|
|
|
const [showEmpty, setShowEmpty] = useState(false)
|
|
|
- const [isSetOpen, setIsSetOpen] = useState(true)
|
|
|
const [filterHeight, setFilterHeight] = useState(0)
|
|
|
const lastScrollTop = useRef(0); // 用于跟踪上一次滚动位置
|
|
|
// 获取分类列表
|
|
@@ -36,6 +35,7 @@ const Index = forwardRef((props: Props) => {
|
|
|
getBookCategoryList(workDirection).then((res: any) => {
|
|
|
if (res?.data?.code === 200) {
|
|
|
classifyStore.setData({ classifyData: res?.data?.data })
|
|
|
+ callBacn(false)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -84,7 +84,6 @@ const Index = forwardRef((props: Props) => {
|
|
|
if (res?.data?.data?.total === 0) {
|
|
|
setShowEmpty(true)
|
|
|
} else {
|
|
|
- console.log("isSetOpen", isSetOpen)
|
|
|
setShowEmpty(false)
|
|
|
}
|
|
|
resolve(true)
|
|
@@ -129,19 +128,19 @@ const Index = forwardRef((props: Props) => {
|
|
|
});
|
|
|
setOpen(b)
|
|
|
}
|
|
|
- useEffect(() => {
|
|
|
- callBacn(false)
|
|
|
- }, [])
|
|
|
+
|
|
|
return (
|
|
|
<View className='index'>
|
|
|
- {classifyStore?.classifyData?.length > 0 && <View style={{ background: "#fff" }} className='classList' onClick={() => { setIsSetOpen(false) }}>
|
|
|
+ {classifyStore?.classifyData?.length > 0 && <View style={{ background: "#fff" }} className='classList' >
|
|
|
<BookTypeTabs open={open} onCallback={callBacn} typeValue={classifyStore?.classifyData} typeTabIndex={classifyStore.categoryId} workDirection={classifyStore.workDirection} ></BookTypeTabs>
|
|
|
</View>}
|
|
|
<View>
|
|
|
|
|
|
</View>
|
|
|
<View onTouchStart={() => {
|
|
|
- setIsSetOpen(true)
|
|
|
+ if (open) {
|
|
|
+ callBacn(false);
|
|
|
+ }
|
|
|
}} >
|
|
|
<ScrollView
|
|
|
lowerThreshold={filterHeight}
|
|
@@ -163,9 +162,7 @@ const Index = forwardRef((props: Props) => {
|
|
|
// callBacn(true);
|
|
|
// }
|
|
|
// }
|
|
|
- if (open) {
|
|
|
- callBacn(false);
|
|
|
- }
|
|
|
+
|
|
|
// 更新 lastScrollTop 以供下一次判断
|
|
|
lastScrollTop.current = top;
|
|
|
}}
|