增加日历

This commit is contained in:
李瑞
2025-09-08 23:23:19 +08:00
parent 4d79c79a97
commit 8a1a2af1e9
5 changed files with 19 additions and 62 deletions

View File

@@ -51,11 +51,12 @@ export const useGlobalStore = create<GlobalStore>()((set, get) => ({
// 获取位置信息
getCurrentLocationInfo: () => {
getCurrentLocation().then((res) => {
return getCurrentLocation().then((res) => {
set({
getLocationLoading: false,
location: res || {},
});
return res;
});
},

View File

@@ -18,9 +18,10 @@ import dateRangeUtils from '@/utils/dateRange'
// 完整的 Store 类型
type TennisStore = ListState & ListActions;
const toDate = dateRangeUtils?.formatDate(new Date())
const defaultFilterOptions: IFilterOptions = {
dateRange: [new Date(), new Date()], // 日期区间
dateRangeQuick: '',
dateRange: [toDate, toDate], // 日期区间
timeSlot: "", // 时间段
ntrp: [1, 5], // NTRP 水平区间
venueType: "", // 场地类型
@@ -124,7 +125,6 @@ export const useListStore = create<TennisStore>()((set, get) => ({
getSearchParams: () => {
const state = get();
const filterOptions = state?.filterOptions || {};
console.log('===1111filterOptions', filterOptions)
const distanceQuickFilter = state?.distanceQuickFilter || {};
const params = {
pageOption: state.pageOption,
@@ -133,10 +133,7 @@ export const useListStore = create<TennisStore>()((set, get) => ({
title: state.searchValue,
ntrpMin: filterOptions?.ntrp?.[0],
ntrpMax: filterOptions?.ntrp?.[1],
dateRange: [
dateRangeUtils.formatDate(filterOptions?.dateRange?.[0]),
dateRangeUtils.formatDate(filterOptions?.dateRange?.[1])
],
dateRange: filterOptions?.dateRange,
},
order: distanceQuickFilter?.quick,
lat: state?.location?.latitude,
@@ -152,7 +149,8 @@ export const useListStore = create<TennisStore>()((set, get) => ({
const { error, data, loading, gamesNum } = payload;
const saveKey = isSearchResult ? "searchResultData" : "matches";
const saveData = { error, loading, gamesNum, [saveKey]: data };
set(saveData);
console.log('===saveData', saveData)
set({...saveData});
},
// 获取列表数据(常规搜索)