diff --git a/src/app.config.ts b/src/app.config.ts index 520ea16..4d9d8bf 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -170,7 +170,6 @@ export default { root: 'pages/collection', pages: [ 'index', - 'collectionClass/index', 'collectionDetail/index', ], }, diff --git a/src/common/constant.ts b/src/common/constant.ts index acf2dbc..917685d 100644 --- a/src/common/constant.ts +++ b/src/common/constant.ts @@ -1,4 +1,4 @@ -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` @@ -13,7 +13,7 @@ export const BASE_URL = CURRENT_BASE_URL // export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境 // export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 // export const BASE_URL = 'http://192.168.1.7:50002/lymarket' // 添 -// export const BASE_URL = 'http://192.168.1.28:50002/lymarket' // 婷 +export const BASE_URL = 'http://192.168.1.28:50002/lymarket' // 婷 // export const BASE_URL = `http://192.168.1.42:50002/lymarket` // 杰 // CDN @@ -24,11 +24,16 @@ export const UPLOAD_CDN_URL = 'https://v0.api.upyun.com/' // cdn export const IMG_CND_Prefix = CURRENT_ENV.includes('production') ? 'https://cdn.zzfzyc.com' : 'https://test.cdn.zzfzyc.com' // export const IMG_CND_Prefix = CURRENT_ENV.includes('production') ? 'https://cdn.zzfzyc.com' : 'https://cdn.zzfzyc.com' +export const SEARCH_EMPTY_IMAGE = `${IMG_CND_Prefix}/search_empty.png` +export const COLLECTION_EMPTY_IMAGE = `${IMG_CND_Prefix}/mall/collection_empty.png` // 在线支付图片baseUrl export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_CAP_HTML_TO_IMAGE_BASE_URL // export const CAP_HTML_TO_IMAGE_BASE_URL = 'http://192.168.1.127:8081' - +// 获取CND资源 +export const getCDNSource = (suffix: string) => { + return IMG_CND_Prefix + suffix +} // 上传图片视频 export const CDN_UPLOAD_IMG = `${UPLOAD_CDN_URL || ''}` diff --git a/src/components/empty/index.module.scss b/src/components/empty/index.module.scss new file mode 100644 index 0000000..97da4bd --- /dev/null +++ b/src/components/empty/index.module.scss @@ -0,0 +1,20 @@ +.mainBox { + height: calc(100vh - 200px); + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + + .pic { + width: 522px; + height: 322px; + // opacity: 0.3; + margin-bottom: 24px; + } + + .text { + font-size: 26px; + color: $color_font_two; + font-weight: 400; + } +} diff --git a/src/components/empty/index.tsx b/src/components/empty/index.tsx new file mode 100644 index 0000000..1eb51ab --- /dev/null +++ b/src/components/empty/index.tsx @@ -0,0 +1,22 @@ +import { Image, View } from '@tarojs/components' +import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react' +import styles from '../empty/index.module.scss' + +interface PropsObj { + picUrl?: string + text?: string +} +const Empty = (pros: PropsObj) => { + const { + picUrl = '', + text = '无搜索历史', + } = pros + + return ( + + + {text} + + ) +} +export default memo(Empty) diff --git a/src/components/infiniteScroll/index.tsx b/src/components/infiniteScroll/index.tsx index 5a41811..a68b582 100644 --- a/src/components/infiniteScroll/index.tsx +++ b/src/components/infiniteScroll/index.tsx @@ -4,6 +4,8 @@ import { memo, useMemo, useState } from 'react' import LoadingCard from '../loadingCard' import style from './index.module.scss' import DotLoading from '@/components/dotLoading' +import Empty from '../empty' +import { SEARCH_EMPTY_IMAGE } from '@/common/constant' export type StatusParam = 0|1|2|3 @@ -22,8 +24,9 @@ interface Params { selfOnRefresherRestore?: () => void selfOnRefresherAbort?: () => void paddingBottom?: number - refresherTriggered?: true|false - refresherEnabled?: true|false + refresherTriggered?: boolean + refresherEnabled?: boolean + emptySlot?: React.ReactNode } const InfiniteScroll = ({ styleObj, @@ -34,7 +37,7 @@ const InfiniteScroll = ({ selfOnRefresherRefresh, selfOnRefresherRestore, selfOnRefresherAbort, - hasMore = true, + emptySlot, children, lowerThresholdNum = 5, paddingBottom = 0, @@ -110,7 +113,7 @@ const InfiniteScroll = ({ } {(statusMore == 0) && } - {(statusMore == 1) && } + {statusMore == 1 && (emptySlot || )} } diff --git a/src/pages/collection/index.tsx b/src/pages/collection/index.tsx index 8df1c93..81028da 100644 --- a/src/pages/collection/index.tsx +++ b/src/pages/collection/index.tsx @@ -10,7 +10,7 @@ import MoveCollectionPopup from './components/moveCollectionPopup' import InfiniteScroll from '@/components/infiniteScroll' import MCheckbox from '@/components/checkbox/index' import Search from '@/components/searchBar' -import { dataLoadingStatus, getFilterData } from '@/common/util' +import { dataLoadingStatus, debounce, getFilterData } from '@/common/util' import { alert, goLink } from '@/common/common' import { DelFavoriteProductApi, FavoriteListApi } from '@/api/favorite' import useLogin from '@/use/useLogin' @@ -18,6 +18,8 @@ import IconText from '@/components/iconText' import LayoutBlock from '@/components/layoutBlock' import IconFont from '@/components/iconfont/iconfont' import NormalButton from '@/components/normalButton' +import Empty from '@/components/empty' +import { COLLECTION_EMPTY_IMAGE } from '@/common/constant' // 消息机制 export const collectionEvents = new Events() // 勾选map @@ -110,9 +112,9 @@ const Collection = () => { const [searchData, setSearchData] = useState('') // 是否首次进入 const isFirst = useRef(true) - const onSearch = useCallback((e) => { + const onSearch = useCallback(debounce((e) => { setSearchData(() => e) - }, []) + }, 400), []) // 获取列表 const { fetchData: fetchDataList, state: favoriteState } = FavoriteListApi() @@ -306,6 +308,7 @@ const Collection = () => { } > {favoriteData.list?.map((item: any, key) => (