添加程序选择
This commit is contained in:
@@ -19,9 +19,7 @@
|
||||
background-color: #fafafa !important;
|
||||
z-index: 1100 !important;
|
||||
box-sizing: border-box !important;
|
||||
max-height: auto !important;
|
||||
height: 380px !important;
|
||||
|
||||
max-height: 100vh !important;
|
||||
}
|
||||
|
||||
.nut-menu-container-content {
|
||||
@@ -30,7 +28,7 @@
|
||||
padding-right: 0px !important;
|
||||
padding-bottom: 0px !important;
|
||||
background-color: transparent !important;
|
||||
max-height: auto !important;
|
||||
max-height: 100vh !important;
|
||||
|
||||
}
|
||||
|
||||
@@ -121,6 +119,7 @@
|
||||
padding-top: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 280px;
|
||||
|
||||
.districtContent {
|
||||
display: flex;
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Menu } from "@nutui/nutui-react-taro";
|
||||
import { Image, View, ScrollView } from "@tarojs/components";
|
||||
import img from "@/config/images";
|
||||
import Bubble from "../Bubble";
|
||||
import { useListState } from "@/store/listStore";
|
||||
import "./index.scss";
|
||||
|
||||
const DistanceQuickFilterV2 = (props) => {
|
||||
@@ -24,6 +25,10 @@ const DistanceQuickFilterV2 = (props) => {
|
||||
const [changePosition, setChangePosition] = useState<number[]>([]);
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
|
||||
// 从 store 获取当前城市信息
|
||||
const { area } = useListState();
|
||||
const currentCity = area?.at(-1) || ""; // 获取省份/城市名称
|
||||
|
||||
// 全城筛选显示的标题 - 如果选择了行政区,显示行政区名称
|
||||
const getCityTitle = () => {
|
||||
if (districtValue) {
|
||||
@@ -56,6 +61,17 @@ const DistanceQuickFilterV2 = (props) => {
|
||||
const newData = new Set([...preState, index]);
|
||||
return Array.from(newData);
|
||||
});
|
||||
|
||||
// 处理互斥关系:距离筛选和行政区完全互斥
|
||||
if (name === cityName) {
|
||||
// 选择了距离筛选(包括"全城"),清空行政区选择
|
||||
onChange && onChange(districtName, "");
|
||||
} else if (name === districtName) {
|
||||
// 选择了行政区,将距离重置为"全城"(空字符串)
|
||||
onChange && onChange(cityName, "");
|
||||
}
|
||||
|
||||
// 触发当前选择的变化
|
||||
onChange && onChange(name, value);
|
||||
|
||||
// 控制隐藏
|
||||
@@ -82,7 +98,7 @@ const DistanceQuickFilterV2 = (props) => {
|
||||
>
|
||||
<div className="positionWrap">
|
||||
<p className="title">当前位置</p>
|
||||
<p className="cityName">上海市</p>
|
||||
<p className="cityName">{currentCity}</p>
|
||||
</div>
|
||||
<div className="distanceWrap">
|
||||
<Bubble
|
||||
|
||||
Reference in New Issue
Block a user