列晒筛选

This commit is contained in:
juguohong
2025-08-18 00:36:57 +08:00
parent db48e55b05
commit 169eaffb96
13 changed files with 193 additions and 50 deletions

View File

@@ -4,7 +4,6 @@
outline: none; // 移除浏览器默认的outline outline: none; // 移除浏览器默认的outline
background: #ffffff; background: #ffffff;
color: #333333; color: #333333;
font-size: 14px;
font-weight: 400; font-weight: 400;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
@@ -12,9 +11,8 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 8px;
white-space: nowrap; white-space: nowrap;
font-size: 14px; font-size: 12px;
border-radius: 28px; border-radius: 28px;
margin: 0; margin: 0;
width: 116px; width: 116px;

View File

@@ -20,5 +20,8 @@
.bubbleGrid { .bubbleGrid {
display: grid; display: grid;
width: 100%; width: 100%;
.bubbleOption {
width: 100%;
}
} }
} }

View File

@@ -122,7 +122,7 @@ const Bubble: React.FC<BubbleProps> = ({
className={styles.bubbleGrid} className={styles.bubbleGrid}
style={{ style={{
gridTemplateColumns: `repeat(${columns}, 1fr)`, gridTemplateColumns: `repeat(${columns}, 1fr)`,
gap: size === "small" ? "8px" : size === "large" ? "16px" : "12px", gap: size === "small" ? "6px" : size === "large" ? "16px" : "12px",
}} }}
> >
{options.map((option) => ( {options.map((option) => (
@@ -133,7 +133,7 @@ const Bubble: React.FC<BubbleProps> = ({
size={size} size={size}
disabled={disabled} disabled={disabled}
onClick={handleOptionClick} onClick={handleOptionClick}
itemClassName={itemClassName} itemClassName={itemClassName || styles.bubbleOption}
/> />
))} ))}
</div> </div>

View File

@@ -48,6 +48,7 @@
.cityName { .cityName {
font-size: 13px; font-size: 13px;
font-weight: 400; font-weight: 400;
color: #3C3C43;
} }
.distanceWrap { .distanceWrap {
margin-bottom: 16px; margin-bottom: 16px;

View File

@@ -1,6 +1,7 @@
import React, { useState, useEffect, useMemo } from "react"; import React, { useState, useEffect, useMemo } from "react";
import { Range } from "@nutui/nutui-react-taro"; import { Range } from "@nutui/nutui-react-taro";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
import TitleComponent from "../Title";
interface RangeProps { interface RangeProps {
min?: number; min?: number;
@@ -9,6 +10,7 @@ interface RangeProps {
value?: [number, number]; value?: [number, number];
onChange?: (value: [number, number]) => void; onChange?: (value: [number, number]) => void;
disabled?: boolean; disabled?: boolean;
className?: string;
} }
const NtrpRange: React.FC<RangeProps> = ({ const NtrpRange: React.FC<RangeProps> = ({
@@ -18,15 +20,15 @@ const NtrpRange: React.FC<RangeProps> = ({
value = [min, max], value = [min, max],
onChange, onChange,
disabled = false, disabled = false,
className,
}) => { }) => {
const [currentValue, setCurrentValue] = useState<[number, number]>(value); const [currentValue, setCurrentValue] = useState<[number, number]>(value);
useEffect(() => { useEffect(() => {
setCurrentValue(value); value && setCurrentValue(value);
}, [value]); }, [JSON.stringify(value || [])]);
const handleChange = (val: [number, number]) => { const handleChange = (val: [number, number]) => {
console.log("Range value changed:", val);
setCurrentValue(val); setCurrentValue(val);
onChange?.(val); onChange?.(val);
}; };
@@ -41,32 +43,33 @@ const NtrpRange: React.FC<RangeProps> = ({
const rangContent = useMemo(() => { const rangContent = useMemo(() => {
const [start, end] = currentValue || []; const [start, end] = currentValue || [];
if (start === min && end === max) { if (Number(start) === Number(min) && Number(end) === Number(max)) {
return "不限"; return "不限";
} }
return `${start.toFixed(1)} - ${end.toFixed(1)}之间`; return `${start.toFixed(1)} - ${end.toFixed(1)}之间`;
}, [currentValue, min, max]); }, [JSON.stringify(currentValue || []), min, max]);
return ( return (
<div className={styles.nutRange}> <div className={`${styles.nutRange} ${className ? className : ''} `}>
<div className={styles.nutRangeHeader}> <div className={styles.nutRangeHeader}>
<div className={styles.nutRangeHeaderLeft}> {/* <div className={styles.nutRangeHeaderLeft}>
<div className="ntrp-range__icon">icon</div> <div className="ntrp-range__icon">icon</div>
<h3 className={styles.nutRangeHeaderTitle}>NTRP水平区间</h3> <h3 className={styles.nutRangeHeaderTitle}>NTRP水平区间</h3>
</div> </div> */}
<TitleComponent title='NTRP水平区间'/>
<p className={styles.nutRangeHeaderContent}>{rangContent}</p> <p className={styles.nutRangeHeaderContent}>{rangContent}</p>
</div> </div>
<div> <div>
<div className={styles.rangeWrapper}> <div className={styles.rangeWrapper}>
<span className={styles.rangeWrapperMin}>{min}</span> <span className={styles.rangeWrapperMin}>{min.toFixed(1)}</span>
<Range <Range
range range
min={min} min={min}
max={max} max={max}
step={step} step={step}
value={currentValue} // value={currentValue}
onChange={handleChange} onEnd={handleChange}
disabled={disabled} disabled={disabled}
defaultValue={[min, max]} defaultValue={[min, max]}
className={styles.rangeHandle} className={styles.rangeHandle}
@@ -74,16 +77,10 @@ const NtrpRange: React.FC<RangeProps> = ({
minDescription={null} minDescription={null}
currentDescription={null} currentDescription={null}
marks={marks} marks={marks}
style={{ color: "gold" }}
/> />
<span className={styles.rangeWrapperMax}>{max}</span> <span className={styles.rangeWrapperMax}>{max.toFixed(1)}</span>
</div> </div>
</div> </div>
{/* 调试信息 */}
<div style={{ marginTop: "10px", fontSize: "12px", color: "#666" }}>
: {currentValue[0].toFixed(1)} - {currentValue[1].toFixed(1)}
</div>
</div> </div>
); );
}; };

View File

@@ -0,0 +1,23 @@
.searchBar {
--nutui-searchbar-padding: 10px 15px;
--nutui-searchbar-font-size: 16px;
--nutui-searchbar-input-height: 44px;
--nutui-searchbar-content-border-radius: 44px;
--nutui-searchbar-input-text-color: #000000;
--nutui-searchbar-input-padding: 0 0 0 10px;
--nutui-searchbar-padding:0 15px;
// --nutui-searchbar-background: #ffffff;
:global(.nut-searchbar-content) {
box-shadow: 0 4px 48px #00000014;
}
.searchBarRight {
width: 44px;
height: 44px;
border-radius: 50%;
border: 1px solid #0000000F;
background-color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
}

View File

@@ -0,0 +1,22 @@
import { SearchBar } from '@nutui/nutui-react-taro'
import styles from './index.module.scss'
const SearchBarComponent = () => {
return (
<>
<SearchBar
// leftIn={
// <div>123</div>
// }
right={
<div className={styles.searchBarRight}></div>
}
className={styles.searchBar}
placeholder='搜索上海的球局和场地'
/>
</>
)
}
export default SearchBarComponent

View File

@@ -0,0 +1,11 @@
.titleContainer {
display: flex;
align-items: center;
margin-bottom: 10px;
gap: 6px;
}
.title {
font-weight: 600;
font-size: 16px;
line-height: 20px;
}

View File

@@ -0,0 +1,19 @@
import styles from "./index.module.scss";
interface IProps {
title: string;
className?: string;
}
const TitleComponent = (props: IProps) => {
const { title, className } = props;
return (
<>
<div
className={`${styles.titleContainer} ${className ? className : ""} `}
>
<div></div>
<h1 className={styles.title}>{title}</h1>
</div>
</>
);
};
export default TitleComponent;

View File

@@ -0,0 +1,72 @@
import { Popup } from "@nutui/nutui-react-taro";
import Range from "../../components/Range";
import Bubble, { BubbleOption } from "../../components/Bubble";
import styles from "./filterPopup.module.scss";
import TitleComponent from "src/components/Title";
const timeOptions: BubbleOption[] = [
{ id: 1, label: "晨间 6:00-10:00", value: "morning" },
{ id: 2, label: "上午 10:00-12:00", value: "forenoon" },
{ id: 3, label: "中午 12:00-14:00", value: "noon" },
{ id: 4, label: "下午 14:00-18:00", value: "afternoon" },
{ id: 5, label: "晚上 18:00-22:00", value: "evening" },
{ id: 6, label: "夜间 22:00-24:00", value: "night" },
];
const locationOptions: BubbleOption[] = [
{ id: 1, label: "室内", value: "1" },
{ id: 2, label: "室外", value: "2" },
{ id: 3, label: "半室外", value: "3" },
];
const FilterPopup = () => {
return (
<>
<Popup
visible={true}
destroyOnClose
position="top"
round
closeOnOverlayClick={false}
onClose={() => {
// setShowTop(false)
}}
>
<div className={styles.filterPopupWrapper}>
{/* 时间气泡选项 */}
<Bubble
options={timeOptions}
value={(value) => {}}
onChange={(value) => {}}
layout="grid"
size="small"
columns={3}
/>
{/* 范围选择 */}
<Range
min={1.0}
max={5.0}
step={0.5}
className={styles.filterPopupRange}
/>
{/* 场次气泡选项 */}
<div>
<TitleComponent title="场地类型" />
<Bubble
options={locationOptions}
value={(value) => {}}
onChange={(value) => {}}
layout="grid"
size="small"
columns={3}
/>
</div>
</div>
</Popup>
</>
);
};
export default FilterPopup;

View File

@@ -0,0 +1,8 @@
.filterPopupWrapper {
$m18: 18px;
padding: $m18;
.filterPopupRange {
margin-top: $m18;
margin-bottom: $m18;
}
}

View File

@@ -1,5 +1,5 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '列表', navigationBarTitleText: '',
enablePullDownRefresh: true, enablePullDownRefresh: true,
backgroundTextStyle: 'dark' backgroundTextStyle: 'dark'
}) })

View File

@@ -4,6 +4,8 @@ import Bubble from "../../components/Bubble/example";
import Range from "../../components/Range/example"; import Range from "../../components/Range/example";
import Menu from "../../components/Menu/example"; import Menu from "../../components/Menu/example";
import CityFilter from "../../components/CityFilter/example"; import CityFilter from "../../components/CityFilter/example";
import SearchBar from "../../components/SearchBar";
import FilterPopup from "./FilterPopup";
import "./index.scss"; import "./index.scss";
import { useEffect } from "react"; import { useEffect } from "react";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
@@ -146,33 +148,20 @@ const ListPage = () => {
return ( return (
<div> <div>
{/* 状态信息栏 */} <SearchBar />
{lastRefreshTime && ( {/* 综合筛选 */}
<div <div>
style={{ <FilterPopup />
padding: "8px 16px", </div>
fontSize: "12px", {/* 筛选 */}
color: "#999", <div>
backgroundColor: "#f8f8f8", {/* 全城筛选 */}
borderBottom: "1px solid #eee", <CityFilter />
}} {/* 智能排序 */}
> <Menu />
: {formatRefreshTime(lastRefreshTime)} | {matches.length}{" "} </div>
</div>
)}
{/* 全城筛选 */}
<CityFilter />
{/* 菜单 */}
<Menu />
{/* 范围选择 */}
<Range />
{/* 气泡 */}
<Bubble />
{/* 列表内容 */} {/* 列表内容 */}
<List> <List>