From 84419dd835c33702dd1f542e3e14f735fc0e7571 Mon Sep 17 00:00:00 2001 From: xuan Date: Wed, 15 Mar 2023 10:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(ID1001526):=20=E3=80=90?= =?UTF-8?q?=E9=9D=A2=E6=96=99=E4=BC=98=E9=80=89=E3=80=91-=E5=8A=9F?= =?UTF-8?q?=E8=83=BD{-=E9=A6=96=E9=A1=B5}=EF=BC=9A=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E5=95=86=E5=93=81=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=97=B6=E9=97=B4=E8=BE=83=E4=B9=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【【面料优选】-功能{-首页}:商品列表,商品下拉加载时间较久】 https://www.tapd.cn/53459131/bugtrace/bugs/view/1153459131001001526 --- src/common/constant.ts | 4 +- src/components/LabAndImg/index.tsx | 1 - src/components/infiniteScroll/index.tsx | 2 +- src/pages/searchList/search.tsx | 60 ------------------------- src/pages/searchList/searchList.tsx | 11 ++++- 5 files changed, 12 insertions(+), 66 deletions(-) diff --git a/src/common/constant.ts b/src/common/constant.ts index 02a6fb2..74bd374 100644 --- a/src/common/constant.ts +++ b/src/common/constant.ts @@ -1,11 +1,11 @@ -export const BASE_URL = CURRENT_BASE_URL +// export const BASE_URL = CURRENT_BASE_URL // export const BASE_URL = `http://192.168.0.75:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:50001/lymarket` // export const BASE_URL = `http://10.0.0.5:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:40001/lymarket` // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 // export const BASE_URL = 'https://test.zzfzyc.com/lymarket' // 测试环境 -// export const BASE_URL = 'https://pre.zzfzyc.com/lymarket' // 预发布 +export const BASE_URL = 'https://pre.zzfzyc.com/lymarket' // 预发布 // export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发 // export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发 // export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 diff --git a/src/components/LabAndImg/index.tsx b/src/components/LabAndImg/index.tsx index d3d4a4b..6e13f1b 100644 --- a/src/components/LabAndImg/index.tsx +++ b/src/components/LabAndImg/index.tsx @@ -41,7 +41,6 @@ const LabAndImg = ({ value, onClick, showStatus = false, round = false, name = ' // }, [value]) const img = useMemo(() => { - console.log('update img') if (value?.texture_url) { const imgs = value.texture_url.split(',').map((item) => { return formatImgUrl(item, suffix) diff --git a/src/components/infiniteScroll/index.tsx b/src/components/infiniteScroll/index.tsx index f119bcf..30e9aee 100644 --- a/src/components/infiniteScroll/index.tsx +++ b/src/components/infiniteScroll/index.tsx @@ -47,7 +47,7 @@ const InfiniteScroll = ({ safeAreaInsetBottom = true, enableLoadMoreStatus = true, children, - lowerThresholdNum = 5, + lowerThresholdNum = 30, paddingBottom = 0, refresherTriggered = false, refresherEnabled = false, diff --git a/src/pages/searchList/search.tsx b/src/pages/searchList/search.tsx index f2533ed..b905b43 100644 --- a/src/pages/searchList/search.tsx +++ b/src/pages/searchList/search.tsx @@ -1,17 +1,13 @@ import Taro, { useDidShow, useShareAppMessage } from '@tarojs/taro' import { Text, View } from '@tarojs/components' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import classnames from 'classnames' import styles from './search.module.scss' -import Goods from './components/goods' import Search from '@/components/search' import { alert, goLink } from '@/common/common' import { AddSearchHistoryApi, GetHotSearchApi, GetSearchHistoryApi } from '@/api/search' import { SCENE, SEARCH_EMPTY_IMAGE } from '@/common/constant' import useLogin from '@/use/useLogin' import Empty from '@/components/empty' -import { dataLoadingStatus, debounce, getFilterData } from '@/common/util' -import InfiniteScroll from '@/components/infiniteScroll' import { GetProductListApi, mallsearchHistorydelete } from '@/api/material' import IconFont from '@/components/iconfont/iconfont' @@ -57,7 +53,6 @@ export default () => { const { fetchData: addFetchData } = AddSearchHistoryApi() const addSearchHistory = async() => { await addFetchData(addSearchField.current) - // goLink('/pages/searchList/searchList', {key: addSearchField.current.key}) } // 默认输入框词 @@ -67,19 +62,11 @@ export default () => { const searchEvent = (e, status = true) => { addSearchField.current.key = e setdefaultValue(e) - // if (e == '') { - // alert.error('请输入关键词') - // return false - // } - // addSearchField.current.key = e addSearchHistory() // status && addSearchHistory() Taro.navigateTo({ url: `/pages/searchList/searchList?key=${addSearchField.current.key}`, }) - - // setSearchData(val => ({ ...val, page: 1, size: 10, code_or_name: e })) - // getProductList() } const changeSearch = useCallback((e) => { @@ -105,37 +92,6 @@ export default () => { } } - // 获取面料列表 - // const [materialList, setMaterialList] = useState<{ list: any[]; total: number }>({ list: [], total: 0 }) - // const { fetchData: materialFetchData, state: materialState } = GetProductListApi() - // const getProductList = async() => { - // const { data } = await materialFetchData(getFilterData(searchData)) - // setMaterialList({ list: data.list, total: data.total }) - // Taro.stopPullDownRefresh() - // } - - // 上拉加载数据 - const pageNum = useRef({ size: searchData.size, page: searchData.page }) - // const getScrolltolower = () => { - // if (materialList.list.length < materialList.total) { - // pageNum.current.page++ - // const size = pageNum.current.size * pageNum.current.page - // setSearchData({ ...searchData, size }) - // } - // } - - // 监听筛选条件变化 - // useEffect(() => { - // if (searchData.code_or_name !== '') { - // getProductList() - // } - // }, [searchData.code_or_name]) - - // 数据加载状态 - // const statusMore = useMemo(() => { - // return dataLoadingStatus({ list: materialList.list, total: materialList.total, status: materialState.loading }) - // }, [materialList, materialState]) - // 删除历史搜索 const { fetchData: deleteFetch } = mallsearchHistorydelete() const handDelete = async() => { @@ -232,22 +188,6 @@ export default () => { searchData?.historyField.length === 0 && } - {/* { - searchData.showIndex === 2 && - 搜索结果 - - - { - materialList?.list.map((item) => { - return ( - goLink(`/pages/details/index?id=${item.id}`)} key={item} data={item}> - ) - }) - } - - - - } */} ) } diff --git a/src/pages/searchList/searchList.tsx b/src/pages/searchList/searchList.tsx index 9345ecd..b5daa6b 100644 --- a/src/pages/searchList/searchList.tsx +++ b/src/pages/searchList/searchList.tsx @@ -91,7 +91,7 @@ export default () => { // 上拉加载数据 const pageNum = useRef({ size: searchField.size, page: searchField.page }) - const getScrolltolower = () => { + const getScrollToLower = () => { if (materialList.list.length < materialList.total) { pageNum.current.page++ const size = pageNum.current.size * pageNum.current.page @@ -231,7 +231,14 @@ export default () => { - + {materialList.list?.map((item) => { return (