diff --git a/src/app.config.ts b/src/app.config.ts
index ae26c3e..1cd60c5 100644
--- a/src/app.config.ts
+++ b/src/app.config.ts
@@ -1,6 +1,6 @@
export default defineAppConfig({
pages: [
- 'pages/publishBall/index',
+ // 'pages/publishBall/index',
'pages/list/index', // 列表页
'pages/search/index', // 搜索页
'pages/searchResult/index', // 搜索结果页面
diff --git a/src/components/CityFilter/index.tsx b/src/components/CityFilter/index.tsx
index 9784915..5af6117 100644
--- a/src/components/CityFilter/index.tsx
+++ b/src/components/CityFilter/index.tsx
@@ -9,7 +9,7 @@ import {DistanceFilterProps} from '../../../types/list/types'
const MenuComponent = (props: DistanceFilterProps) => {
- const { value, onChange, wrapperClassName, itemClassName, options, name } =
+ const { value, onChange, wrapperClassName, itemClassName, options, name, onOpen, onClose } =
props;
const [isChange, setIsChange] = useState(false);
const [iOpen, setIsOpen] = useState(false);
@@ -23,10 +23,12 @@ const MenuComponent = (props: DistanceFilterProps) => {
const handleOpen = () => {
setIsOpen(true);
+ onOpen && typeof onOpen === "function" && onOpen();
};
const handleClose = () => {
setIsOpen(false);
+ onClose && typeof onClose === "function" && onClose();
};
return (
diff --git a/src/components/DistanceQuickFilter/index.scss b/src/components/DistanceQuickFilter/index.scss
new file mode 100644
index 0000000..8ce9f96
--- /dev/null
+++ b/src/components/DistanceQuickFilter/index.scss
@@ -0,0 +1,91 @@
+.distanceQuickFilterWrap {
+ width: 100%;
+
+ .nut-menu-bar {
+ background-color: unset;
+ box-shadow: unset;
+ padding: 0 15px;
+ gap: 5px;
+ }
+
+ .nut-menu-title {
+ flex: unset;
+ box-sizing: border-box;
+ display: flex;
+ height: 28px;
+ padding: 4px 10px;
+ justify-content: center;
+ align-items: center;
+ gap: 2px;
+ border-radius: 999px;
+ border: 0.5px solid rgba(0, 0, 0, 0.06);
+ background: #ffffff;
+ font-size: 14px;
+ font-weight: 600;
+ line-height: 20px;
+ }
+
+ .nut-menu-title.active {
+ color: #000;
+ }
+
+ .nut-menu-container-wrap {
+ width: 100vw;
+ border-bottom-left-radius: 30px;
+ border-bottom-right-radius: 30px;
+ }
+
+ .nut-menu-container-item {
+ color: rgba(60, 60, 67, 0.60);
+ font-size: 14px;
+ font-weight: 600;
+ line-height: 20px;
+ }
+
+ .nut-menu-container-item.active {
+ flex-direction: row-reverse;
+ justify-content: space-between;
+ color: #000;
+ }
+
+ .positionWrap {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ width: 100%;
+ margin-bottom: 16px;
+ }
+
+ .title {
+ font-size: 14px;
+ font-weight: 600;
+ }
+
+ .cityName {
+ font-size: 13px;
+ font-weight: 400;
+ color: #3c3c43;
+ }
+
+ .distanceWrap {
+ margin-bottom: 16px;
+ width: 100%;
+ }
+
+ .distanceBubbleItem {
+ display: flex;
+ width: 80px;
+ height: 28px;
+ padding: 4px 10px;
+ justify-content: center;
+ align-items: center;
+ gap: 2px;
+ border-radius: 999px;
+ border: 0.5px solid rgba(0, 0, 0, 0.06);
+ }
+
+ .itemIcon {
+ width: 20px;
+ height: 20px;
+ }
+}
\ No newline at end of file
diff --git a/src/components/DistanceQuickFilter/index.tsx b/src/components/DistanceQuickFilter/index.tsx
new file mode 100644
index 0000000..5d82195
--- /dev/null
+++ b/src/components/DistanceQuickFilter/index.tsx
@@ -0,0 +1,81 @@
+import React, { useRef, useState } from "react";
+import { Menu, Button } from "@nutui/nutui-react-taro";
+import { Image } from "@tarojs/components";
+import img from "@/config/images";
+import Bubble from "../Bubble";
+import "./index.scss";
+
+const Demo3 = (props) => {
+ const {
+ cityOptions,
+ quickOptions,
+ onChange,
+ cityName,
+ quickName,
+ cityValue,
+ quickValue,
+ } = props;
+
+ const itemRef = useRef(null);
+
+ const handleChange = (name: string, value: string) => {
+ // setIsChange(true);
+ onChange && onChange(name, value);
+ (itemRef.current as any)?.toggle(false);
+ };
+
+ return (
+
+ );
+};
+export default Demo3;
diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx
index fd7b4db..53961f0 100644
--- a/src/components/Menu/index.tsx
+++ b/src/components/Menu/index.tsx
@@ -6,7 +6,7 @@ import { MenuFilterProps } from "../../../types/list/types";
import styles from "./index.module.scss";
const MenuComponent = (props: MenuFilterProps) => {
- const { options, value, onChange, wrapperClassName, itemClassName, name } =
+ const { options, value, onChange, wrapperClassName, itemClassName, name, onOpen, onClose,open } =
props;
const [isChange, setIsChange] = useState(false);
const [isOpen, setIsOpen] = useState(false);
@@ -18,10 +18,12 @@ const MenuComponent = (props: MenuFilterProps) => {
const handleOpen = () => {
setIsOpen(true);
+ onOpen && typeof onOpen === "function" && onOpen();
};
const handleClose = () => {
setIsOpen(false);
+ onClose && typeof onClose === "function" && onClose();
};
return (
diff --git a/src/components/SearchBar/index.module.scss b/src/components/SearchBar/index.module.scss
index cf5e343..493e867 100644
--- a/src/components/SearchBar/index.module.scss
+++ b/src/components/SearchBar/index.module.scss
@@ -5,6 +5,7 @@
--nutui-searchbar-input-text-color: #000000;
--nutui-searchbar-input-padding: 0 0 0 10px;
--nutui-searchbar-padding: 10px 0 0 0;
+ background-color: unset;
:global(.nut-searchbar-content) {
box-shadow: 0 4px 48px #00000014;
diff --git a/src/container/inputCustomerNavbar/index.tsx b/src/container/inputCustomerNavbar/index.tsx
index d922d2b..3414715 100644
--- a/src/container/inputCustomerNavbar/index.tsx
+++ b/src/container/inputCustomerNavbar/index.tsx
@@ -7,6 +7,7 @@ import { useGlobalState } from "@/store/global";
import { useListState } from "@/store/listStore";
import CustomNavbar from "@/components/CustomNavbar";
import { Input } from "@nutui/nutui-react-taro";
+import Taro from "@tarojs/taro";
interface IProps {
icon: string;
@@ -34,6 +35,12 @@ const ListHeader = (props: IProps) => {
getCurrentLocal();
}, []);
+ const handleInputClick = () => {
+ Taro.navigateTo({
+ url: "/pages/search/index",
+ });
+ }
+
return (
{
src={img.ICON_LIST_SEARCH_SEARCH}
/>
diff --git a/src/container/listContainer/index.scss b/src/container/listContainer/index.scss
index 89137be..d466de1 100644
--- a/src/container/listContainer/index.scss
+++ b/src/container/listContainer/index.scss
@@ -4,5 +4,19 @@
display: flex;
flex-direction: column;
gap: 5px;
- background-color: red;
+ // background-color: red;
+
+ .recommendTextWrapper {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 22px 10px;
+ }
+
+ .recommendText {
+ color: rgba(0, 0, 0, 0.85);
+ font-size: 14px;
+ font-weight: 500;
+ line-height: 24px;
+ }
}
\ No newline at end of file
diff --git a/src/container/listContainer/index.tsx b/src/container/listContainer/index.tsx
index 380b27d..6543a98 100644
--- a/src/container/listContainer/index.tsx
+++ b/src/container/listContainer/index.tsx
@@ -1,13 +1,18 @@
-import { View } from "@tarojs/components";
+import { View, Text } from "@tarojs/components";
import ListCard from "@/components/ListCard";
import ListLoadError from "@/components/ListLoadError";
import ListCardSkeleton from "@/components/ListCardSkeleton";
+import "./index.scss";
const ListContainer = (props) => {
- const { loading, data = [], error, reload } = props;
+ const { loading, data = [], error, reload, recommendList } = props;
- const renderList = () => {
- if (loading && data.length > 0) {
+ if (error) {
+ return ;
+ }
+
+ const renderList = (list) => {
+ if (loading && list.length === 0) {
return (
<>
{new Array(10).fill(0).map(() => {
@@ -17,17 +22,9 @@ const ListContainer = (props) => {
);
}
- if (error) {
- return ;
- }
-
- if (loading && data.length === 0) {
- return null;
- }
-
return (
<>
- {data.map((match, index) => (
+ {list?.map((match, index) => (
))}
>
@@ -35,13 +32,12 @@ const ListContainer = (props) => {
};
return (
-
- {renderList()}
+
+ {renderList(data)}
+
+ 搜索结果较少,已为你推荐其他内容
+
+ {renderList(recommendList)}
);
};
diff --git a/src/pages/list/index.module.scss b/src/pages/list/index.module.scss
index fb530ec..c046e9b 100644
--- a/src/pages/list/index.module.scss
+++ b/src/pages/list/index.module.scss
@@ -1,10 +1,10 @@
.listPage {
- background-color: #fafafa;
+ background-color: #fefefe;
.listTopSearchWrapper {
padding: 0 15px;
// position: sticky;
- background: #fefefe;
+ // background: #fefefe;
// z-index: 999;
}
diff --git a/src/pages/list/index.tsx b/src/pages/list/index.tsx
index fbe07c9..b76c3f0 100644
--- a/src/pages/list/index.tsx
+++ b/src/pages/list/index.tsx
@@ -12,6 +12,7 @@ import CustomerNavBar from "@/container/listCustomNavbar";
import InputCustomerBar from "@/container/inputCustomerNavbar";
import GuideBar from "@/components/GuideBar";
import ListContainer from "@/container/listContainer";
+import DistanceQuickFilter from "@/components/DistanceQuickFilter";
import img from "@/config/images";
const ListPage = () => {
@@ -24,6 +25,7 @@ const ListPage = () => {
isShowFilterPopup,
error,
matches,
+ recommendList,
loading,
fetchMatches,
refreshMatches,
@@ -119,7 +121,7 @@ const ListPage = () => {
Taro.navigateTo({
url: "/pages/search/index",
});
- }
+ };
return (
<>
@@ -162,30 +164,24 @@ const ListPage = () => {
/>
)}
- {/* 筛选 */}
-
- {/* 全城筛选 */}
-
- {/* 智能排序 */}
-
-
+
+ {/* 筛选 */}
+
+
{/* 列表内容 */}
{
searchSuggestion,
suggestionList,
isShowSuggestion,
- isShowInputCustomerNavBar,
} = useListState() || {};
const ref = useRef(null);
@@ -45,6 +43,10 @@ const ListSearch = () => {
updateState({ searchValue: value });
if (value) {
searchSuggestion(value);
+ } else {
+ updateState({
+ isShowSuggestion: false,
+ });
}
};
@@ -85,11 +87,11 @@ const ListSearch = () => {
/**
* @description 点击搜索
*/
- const handleSearch = () => {
+ const handleSearch = () => {
Taro.navigateTo({
url: `/pages/searchResult/index`,
});
- }
+ };
// 是否显示清空图标
const isShowClearIcon = searchValue && searchValue?.length > 0;
@@ -100,11 +102,6 @@ const ListSearch = () => {
return (
<>
- {!isShowInputCustomerNavBar ? (
-
- ) : (
-
- )}
{/* 搜索 */}
@@ -128,7 +125,9 @@ const ListSearch = () => {
/>
)}
- 搜索
+
+ 搜索
+
{/* 联想词 */}
diff --git a/src/pages/searchResult/index.config.ts b/src/pages/searchResult/index.config.ts
new file mode 100644
index 0000000..65e057f
--- /dev/null
+++ b/src/pages/searchResult/index.config.ts
@@ -0,0 +1,4 @@
+export default definePageConfig({
+ navigationBarTitleText: '搜索结果',
+ // navigationStyle: 'custom',
+})
diff --git a/src/pages/searchResult/index.scss b/src/pages/searchResult/index.scss
index 7702675..8812cee 100644
--- a/src/pages/searchResult/index.scss
+++ b/src/pages/searchResult/index.scss
@@ -1,3 +1,18 @@
-.menuFilter {
- color: red;
+.searchResultPage {
+ position: relative;
+
+ .searchResultFilterWrapper {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ padding: 5px 0px 10px 0px;
+ position: sticky;
+ top: -1px;
+ background-color: #fefefe;
+ z-index: 123;
+ }
+
+ .menuFilter {
+ padding: 0;
+ }
}
\ No newline at end of file
diff --git a/src/pages/searchResult/index.tsx b/src/pages/searchResult/index.tsx
index 6dd74eb..cc47c16 100644
--- a/src/pages/searchResult/index.tsx
+++ b/src/pages/searchResult/index.tsx
@@ -1,11 +1,11 @@
import { View } from "@tarojs/components";
-// import styles from "./index.scss";
-import CityFilter from "@/components/CityFilter";
-import Menu from "@/components/Menu";
import { useListState } from "@/store/listStore";
+import { useGlobalState } from "@/store/global";
import ListContainer from "@/container/listContainer";
import "./index.scss";
+import DistanceQuickFilter from "@/components/DistanceQuickFilter";
+import { useEffect } from "react";
const SearchResult = () => {
const {
@@ -14,11 +14,21 @@ const SearchResult = () => {
distanceQuickFilter,
updateState,
matches,
+ recommendList,
loading,
error,
refreshMatches,
+ fetchMatches,
} = useListState() || {};
+ const { statusNavbarHeightInfo } = useGlobalState() || {};
+ const { totalHeight } = statusNavbarHeightInfo || {}
+
+ useEffect(() => {
+ // 页面加载时获取数据
+ fetchMatches();
+ }, []);
+
// 距离筛选
const handleDistanceOrQuickChange = (name, value) => {
updateState({
@@ -30,30 +40,26 @@ const SearchResult = () => {
};
return (
-
+
{/* 筛选 */}
-
- {/* 全城筛选 */}
-
- {/* 智能排序 */}
-
+
+
{/* 列表内容 */}
()((set, get) => ({
// 初始状态
matches: [],
+ // 推荐列表
+ recommendList: [],
+ // 是否加载中
loading: false,
error: null,
// 搜索的value
@@ -89,8 +92,14 @@ export const useListStore = create()((set, get) => ({
suggestionList: [],
// 是否显示联想词
isShowSuggestion: false,
- // 是否显示搜索框自定义导航
+ // 列表页是否显示搜索框自定义导航
isShowInputCustomerNavBar: false,
+ // 结果页是否显示搜索框自定义导航
+ isShowResultInputCustomerNavBar: false,
+ // 打开距离筛选框
+ isOpenDistancePopup: false,
+ // 打开快捷筛选框
+ isOpenQuickFilterPopup: false,
// 获取比赛数据
fetchMatches: async (params) => {
@@ -125,6 +134,8 @@ export const useListStore = create()((set, get) => ({
})
set({
matches: list || rows || [],
+ recommendList: list || rows || [],
+ error: null,
loading: false,
gamesNum: count,
})
diff --git a/types/list/types.ts b/types/list/types.ts
index 3e6f846..144697a 100644
--- a/types/list/types.ts
+++ b/types/list/types.ts
@@ -21,6 +21,7 @@ export interface IFilterOptions {
}
export interface ListState {
matches: TennisMatch[]
+ recommendList: TennisMatch[]
loading: boolean
error: string | null
searchValue: string
@@ -45,6 +46,9 @@ export interface ListState {
suggestionList: string[]
isShowSuggestion: boolean
isShowInputCustomerNavBar: boolean
+ isShowResultInputCustomerNavBar: boolean
+ isOpenDistancePopup: boolean,
+ isOpenQuickFilterPopup: boolean,
}
export interface ListActions {
@@ -72,6 +76,8 @@ export interface MenuFilterProps {
wrapperClassName?: string;
itemClassName?: string;
name: string;
+ onOpen?: () => void;
+ onClose?: () => void;
}
// 距离筛选
@@ -82,6 +88,8 @@ export interface DistanceFilterProps {
wrapperClassName?: string;
itemClassName?: string;
name: string;
+ onOpen?: () => void;
+ onClose?: () => void;
}
// bubble 组件