From 1c31659852f8360cc0fdfac26aff51e54b8b8b67 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 27 十二月 2024 17:21:58 +0800 Subject: [PATCH] 添加排名展示;优化展示方式 --- src/stores/satellite-grid.js | 41 +++++++++++++++++++++++++++++++++-------- 1 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/stores/satellite-grid.js b/src/stores/satellite-grid.js index 2b83df2..d88a13f 100644 --- a/src/stores/satellite-grid.js +++ b/src/stores/satellite-grid.js @@ -4,15 +4,40 @@ import { useFetchData } from '@/composables/fetchData'; // 鍗槦閬ユ祴缃戞牸 -export const usesatelliteGridStore = defineStore('satelliteGrid', () => { - const gridGropiList = ref([]); - const { loading, fetchData } = useFetchData(); +export const useSatelliteGridStore = defineStore('satelliteGrid', () => { + // 缃戞牸淇℃伅 + const gridInfo = ref([]); + // 缃戞牸鏁版嵁缁� + const gridDataList = ref([]); - function fetchGridGroup(area) { - return fetchData((page, pageSize) => { - return gridApi.fetchGridGroup(area, page, pageSize).then((res) => { - return res; - }); + // 鑾峰彇缃戞牸淇℃伅 + function fetchGridCell(groupId) { + return gridApi.fetchGridCell(groupId).then((res) => { + gridInfo.value = res.data; }); } + + // 鑾峰彇閬ユ祴鍗曟棩鏁版嵁淇℃伅 + function fetchGridData(groupId) { + return gridApi.fetchGridData(groupId).then((res) => { + gridDataList.value = res.data; + }); + } + + // 鑾峰彇閬ユ祴鍗曟棩鍏蜂綋缃戞牸鐩戞祴鏁版嵁 + function fetchGridDataDetail(gridData) { + return gridApi + .fetchGridDataDetail(gridData.id, gridData.groupId) + .then((res) => { + gridData.dataDetail = res.data; + }); + } + + return { + gridInfo, + gridDataList, + fetchGridCell, + fetchGridData, + fetchGridDataDetail + }; }); -- Gitblit v1.9.3