🐞 fix(ID1001526): 【面料优选】-功能{-首页}:商品列表,商品下拉加载时间较久
【【面料优选】-功能{-首页}:商品列表,商品下拉加载时间较久】 https://www.tapd.cn/53459131/bugtrace/bugs/view/1153459131001001526
This commit is contained in:
parent
8498144294
commit
84419dd835
@ -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.75:50001/lymarket`
|
||||||
// export const BASE_URL = `http://192.168.0.89: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://10.0.0.5:50001/lymarket`
|
||||||
// export const BASE_URL = `http://192.168.0.89:40001/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 = `http://192.168.1.165:40001/lymarket` // 王霞
|
||||||
// export const BASE_URL = 'https://test.zzfzyc.com/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:40001/lymarket` // 发
|
||||||
// export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发
|
// export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发
|
||||||
// export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发
|
// export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发
|
||||||
|
|||||||
@ -41,7 +41,6 @@ const LabAndImg = ({ value, onClick, showStatus = false, round = false, name = '
|
|||||||
// }, [value])
|
// }, [value])
|
||||||
|
|
||||||
const img = useMemo(() => {
|
const img = useMemo(() => {
|
||||||
console.log('update img')
|
|
||||||
if (value?.texture_url) {
|
if (value?.texture_url) {
|
||||||
const imgs = value.texture_url.split(',').map((item) => {
|
const imgs = value.texture_url.split(',').map((item) => {
|
||||||
return formatImgUrl(item, suffix)
|
return formatImgUrl(item, suffix)
|
||||||
|
|||||||
@ -47,7 +47,7 @@ const InfiniteScroll = ({
|
|||||||
safeAreaInsetBottom = true,
|
safeAreaInsetBottom = true,
|
||||||
enableLoadMoreStatus = true,
|
enableLoadMoreStatus = true,
|
||||||
children,
|
children,
|
||||||
lowerThresholdNum = 5,
|
lowerThresholdNum = 30,
|
||||||
paddingBottom = 0,
|
paddingBottom = 0,
|
||||||
refresherTriggered = false,
|
refresherTriggered = false,
|
||||||
refresherEnabled = false,
|
refresherEnabled = false,
|
||||||
|
|||||||
@ -1,17 +1,13 @@
|
|||||||
import Taro, { useDidShow, useShareAppMessage } from '@tarojs/taro'
|
import Taro, { useDidShow, useShareAppMessage } from '@tarojs/taro'
|
||||||
import { Text, View } from '@tarojs/components'
|
import { Text, View } from '@tarojs/components'
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import classnames from 'classnames'
|
|
||||||
import styles from './search.module.scss'
|
import styles from './search.module.scss'
|
||||||
import Goods from './components/goods'
|
|
||||||
import Search from '@/components/search'
|
import Search from '@/components/search'
|
||||||
import { alert, goLink } from '@/common/common'
|
import { alert, goLink } from '@/common/common'
|
||||||
import { AddSearchHistoryApi, GetHotSearchApi, GetSearchHistoryApi } from '@/api/search'
|
import { AddSearchHistoryApi, GetHotSearchApi, GetSearchHistoryApi } from '@/api/search'
|
||||||
import { SCENE, SEARCH_EMPTY_IMAGE } from '@/common/constant'
|
import { SCENE, SEARCH_EMPTY_IMAGE } from '@/common/constant'
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
import Empty from '@/components/empty'
|
import Empty from '@/components/empty'
|
||||||
import { dataLoadingStatus, debounce, getFilterData } from '@/common/util'
|
|
||||||
import InfiniteScroll from '@/components/infiniteScroll'
|
|
||||||
import { GetProductListApi, mallsearchHistorydelete } from '@/api/material'
|
import { GetProductListApi, mallsearchHistorydelete } from '@/api/material'
|
||||||
import IconFont from '@/components/iconfont/iconfont'
|
import IconFont from '@/components/iconfont/iconfont'
|
||||||
|
|
||||||
@ -57,7 +53,6 @@ export default () => {
|
|||||||
const { fetchData: addFetchData } = AddSearchHistoryApi()
|
const { fetchData: addFetchData } = AddSearchHistoryApi()
|
||||||
const addSearchHistory = async() => {
|
const addSearchHistory = async() => {
|
||||||
await addFetchData(addSearchField.current)
|
await addFetchData(addSearchField.current)
|
||||||
// goLink('/pages/searchList/searchList', {key: addSearchField.current.key})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认输入框词
|
// 默认输入框词
|
||||||
@ -67,19 +62,11 @@ export default () => {
|
|||||||
const searchEvent = (e, status = true) => {
|
const searchEvent = (e, status = true) => {
|
||||||
addSearchField.current.key = e
|
addSearchField.current.key = e
|
||||||
setdefaultValue(e)
|
setdefaultValue(e)
|
||||||
// if (e == '') {
|
|
||||||
// alert.error('请输入关键词')
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
// addSearchField.current.key = e
|
|
||||||
addSearchHistory()
|
addSearchHistory()
|
||||||
// status && addSearchHistory()
|
// status && addSearchHistory()
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/pages/searchList/searchList?key=${addSearchField.current.key}`,
|
url: `/pages/searchList/searchList?key=${addSearchField.current.key}`,
|
||||||
})
|
})
|
||||||
|
|
||||||
// setSearchData(val => ({ ...val, page: 1, size: 10, code_or_name: e }))
|
|
||||||
// getProductList()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeSearch = useCallback((e) => {
|
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 { fetchData: deleteFetch } = mallsearchHistorydelete()
|
||||||
const handDelete = async() => {
|
const handDelete = async() => {
|
||||||
@ -232,22 +188,6 @@ export default () => {
|
|||||||
searchData?.historyField.length === 0 && <Empty picUrl={SEARCH_EMPTY_IMAGE} text="无搜索历史"></Empty>
|
searchData?.historyField.length === 0 && <Empty picUrl={SEARCH_EMPTY_IMAGE} text="无搜索历史"></Empty>
|
||||||
}
|
}
|
||||||
</>
|
</>
|
||||||
{/* {
|
|
||||||
searchData.showIndex === 2 && <View className={styles.reslutBox}>
|
|
||||||
<View className={styles.reslutTitle}>搜索结果</View>
|
|
||||||
<View className={styles.scrollBox}>
|
|
||||||
<InfiniteScroll selfonScrollToLower={getScrolltolower} statusMore={statusMore}>
|
|
||||||
{
|
|
||||||
materialList?.list.map((item) => {
|
|
||||||
return (
|
|
||||||
<Goods clickItem={() => goLink(`/pages/details/index?id=${item.id}`)} key={item} data={item}></Goods>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</InfiniteScroll>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
} */}
|
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,7 @@ export default () => {
|
|||||||
|
|
||||||
// 上拉加载数据
|
// 上拉加载数据
|
||||||
const pageNum = useRef({ size: searchField.size, page: searchField.page })
|
const pageNum = useRef({ size: searchField.size, page: searchField.page })
|
||||||
const getScrolltolower = () => {
|
const getScrollToLower = () => {
|
||||||
if (materialList.list.length < materialList.total) {
|
if (materialList.list.length < materialList.total) {
|
||||||
pageNum.current.page++
|
pageNum.current.page++
|
||||||
const size = pageNum.current.size * pageNum.current.page
|
const size = pageNum.current.size * pageNum.current.page
|
||||||
@ -231,7 +231,14 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
<View className={styles.list}>
|
<View className={styles.list}>
|
||||||
<View className={styles.scroll}>
|
<View className={styles.scroll}>
|
||||||
<InfiniteScroll refresherEnabled selfOnRefresherRefresh={getRefresherRefresh} refresherTriggered={refresherTriggeredStatus} safeAreaInsetBottom={false} selfonScrollToLower={getScrolltolower} statusMore={statusMore}>
|
<InfiniteScroll
|
||||||
|
refresherEnabled
|
||||||
|
selfOnRefresherRefresh={getRefresherRefresh}
|
||||||
|
refresherTriggered={refresherTriggeredStatus}
|
||||||
|
safeAreaInsetBottom={false}
|
||||||
|
selfonScrollToLower={getScrollToLower}
|
||||||
|
statusMore={statusMore}
|
||||||
|
>
|
||||||
<View className={styles.product_list}>
|
<View className={styles.product_list}>
|
||||||
{materialList.list?.map((item) => {
|
{materialList.list?.map((item) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user