修改hooks中store的调用方式

This commit is contained in:
wzy-warehouse
2026-05-07 13:08:30 +08:00
parent 68715dea2b
commit 009dc83476
7 changed files with 94 additions and 81 deletions
+13 -9
View File
@@ -6,6 +6,10 @@ import { useScene } from '../useScene';
import { useRainstormDeduction } from '../rainstorm/useRainstormDeduction';
export const useRightHandle = () => {
const statusStore = useStatusStore();
const leftLegendStore = useLeftLegendStore();
const scene = useScene();
const rainstormDeduction = useRainstormDeduction();
/**
* 暴雨模拟
* @param status - 状态
@@ -13,23 +17,23 @@ export const useRightHandle = () => {
const rainstormSimulation = (status: unknown) => {
if (status as boolean) {
// 显示步骤
useRainstormDeduction().showStep();
rainstormDeduction.showStep();
// 开启暴雨模拟:显示降雨栅格图层
useStatusStore().weatherLayers.showRainfallGrid.loading = true;
useStatusStore().weatherLayers.showRainfallGrid.show = true;
statusStore.weatherLayers.showRainfallGrid.loading = true;
statusStore.weatherLayers.showRainfallGrid.show = true;
// 添加图例
useRainstormDeduction().addLegend();
rainstormDeduction.addLegend();
} else {
// 关闭暴雨模拟:隐藏降雨栅格图层
useStatusStore().weatherLayers.showRainfallGrid.show = false;
statusStore.weatherLayers.showRainfallGrid.show = false;
// 删除图例
delete useLeftLegendStore().legendListInfo.precipitation;
delete leftLegendStore.legendListInfo.precipitation;
// 隐藏步骤条
useStatusStore().uiComponents.stepBar.show = false;
statusStore.uiComponents.stepBar.show = false;
}
};
@@ -38,9 +42,9 @@ export const useRightHandle = () => {
*/
const resetScene = () => {
CesiumUtilsSingleton.clearAllResources('custom');
useScene().resetScene();
scene.resetScene();
// 隐藏加载
useStatusStore().appLoadingCompleted = true;
statusStore.appLoadingCompleted = true;
};
/**