diff --git a/src/components/learningRecord/learningRecord.tsx b/src/components/learningRecord/learningRecord.tsx index dea1629..c54c2c4 100644 --- a/src/components/learningRecord/learningRecord.tsx +++ b/src/components/learningRecord/learningRecord.tsx @@ -8,6 +8,7 @@ import styles from './learningRecord.module.scss' import Spin from "@/components/spinner"; import {Profile} from "@/store"; import Taro from "@tarojs/taro"; +import debounce from "@/utils/debounce"; const tabList: TabList[] = [ { @@ -64,11 +65,15 @@ const LearningRecord: FC = ({userId, style, className}) => { Taro.navigateTo({url: '/pages/login/login'}) return } - getStatistics(tab?.value! as StatisticsParam) + // getStatistics(tab?.value! as StatisticsParam) + debounce(()=>{ + // console.log(this,'this') + getStatistics(tab?.value! as StatisticsParam) + }) } useEffect(() => { - userId && getStatistics(tabList[0].value) + userId && setTimeout(() => {getStatistics(tabList[0].value)},500) }, [userId]) return ( diff --git a/src/pages/my/my.tsx b/src/pages/my/my.tsx index e0f8ec3..a51abe9 100644 --- a/src/pages/my/my.tsx +++ b/src/pages/my/my.tsx @@ -21,7 +21,6 @@ interface List { src: string, type?: number } - function jump(token: string | null, type?: number) { if (!token) { Taro.navigateTo({url: '/pages/login/login'}) @@ -169,6 +168,7 @@ const My: FC = () => { + ) } diff --git a/src/pages/preview/search/search/components/list.tsx b/src/pages/preview/search/search/components/list.tsx index e99f42a..88c0e32 100644 --- a/src/pages/preview/search/search/components/list.tsx +++ b/src/pages/preview/search/search/components/list.tsx @@ -97,7 +97,7 @@ const SearchList: FC = ({name,clear}) => { className='scrollview' scrollY scrollWithAnimation - style={{height:`${globalData.windowHeight-60}px`,backgroundColor:`#f5f5f5`}} + style={{height:`${globalData.windowHeight-140}px`,backgroundColor:`#f5f5f5`}} onScrollToLower={onScrollToLower} > { loading && } diff --git a/src/pages/preview/search/search/index.config.ts b/src/pages/preview/search/search/index.config.ts index 4fdde3a..23c20dd 100644 --- a/src/pages/preview/search/search/index.config.ts +++ b/src/pages/preview/search/search/index.config.ts @@ -1,5 +1,3 @@ export default definePageConfig({ - navigationBarTitleText: '搜索', - navigationBarBackgroundColor:'#F2F8F6', - onReachBottomDistance: 50 + navigationStyle: 'custom' }) diff --git a/src/pages/preview/search/search/index.module.scss b/src/pages/preview/search/search/index.module.scss index 9dddadd..88d34c3 100644 --- a/src/pages/preview/search/search/index.module.scss +++ b/src/pages/preview/search/search/index.module.scss @@ -1,6 +1,10 @@ page{ background-color:#F2F8F6; - padding-left: 30rpx; + + .navBox{ + position: fixed; + width:750rpx; + } .searchBox{ width: 690rpx; height: 68rpx; diff --git a/src/pages/preview/search/search/index.tsx b/src/pages/preview/search/search/index.tsx index 554655f..4641474 100644 --- a/src/pages/preview/search/search/index.tsx +++ b/src/pages/preview/search/search/index.tsx @@ -8,6 +8,7 @@ import SearchList from './components/list' const Search:FC = () => { + const globalData = Taro.getApp().globalData const [value, setValue] = useState('') const [recentSearch, setRecentSearch] = useState([]) const [hotSearch,setHotSearch] = useState([]) @@ -55,10 +56,25 @@ const Search:FC = () => { Taro.setStorageSync('recentSearch', [...new Set(recentSearch)]) } + function navBack(){ + Taro.navigateBack() + } return ( + + + + + + + 搜索 + + + + + { show ? @@ -106,9 +122,10 @@ const Search:FC = () => { } - { setShow(false)}} show={show} round={true} overlay={true} overlayStyle={'background:rgba(0,0,0,0)'} > + {setShow(false)}} onClickOverlay={()=>{ setShow(false)}} show={show} round={true} overlay={true} overlayStyle={'background:rgba(0,0,0,0)'} > + ) diff --git a/src/utils/debounce.ts b/src/utils/debounce.ts new file mode 100644 index 0000000..0ef681f --- /dev/null +++ b/src/utils/debounce.ts @@ -0,0 +1,12 @@ +let timeout:any = null +function debounce(func, wait = 500) { + console.log(arguments[0],'arguments') + timeout && clearTimeout(timeout) + timeout = setTimeout(() => { + console.log('执行') + typeof func === 'function' && func() + }, wait) +} + +export default debounce +