health.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { createSlice } from "@reduxjs/toolkit";
  2. interface HealthState {
  3. windows: any;
  4. mode: string;
  5. selTab: number;
  6. refreshs: any; //刷新数据时间点
  7. title: string;
  8. eatArchived:any;
  9. }
  10. const initialState: HealthState = {
  11. windows: null,
  12. mode: 'DAY',
  13. selTab: 0,
  14. refreshs: [],
  15. title: '',
  16. eatArchived:null,
  17. }
  18. const healthSlice = createSlice({
  19. name: 'health',
  20. initialState,
  21. reducers: {
  22. setWindows(state, action) {
  23. state.windows = action.payload
  24. },
  25. setMode(state, action) {
  26. state.mode = action.payload
  27. },
  28. setTab(state, action) {
  29. state.selTab = action.payload
  30. },
  31. setRefreshs(state, action) {
  32. state.refreshs = action.payload
  33. },
  34. setTitle(state, action) {
  35. state.title = action.payload
  36. },
  37. setEatArchived(state,action){
  38. state.eatArchived = action.payload
  39. }
  40. }
  41. })
  42. export const { setWindows, setMode, setTab, setRefreshs,setTitle,setEatArchived } = healthSlice.actions;
  43. export default healthSlice.reducer;