| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import { createSlice } from "@reduxjs/toolkit";
- interface HealthState {
- windows: any;
- fast_with_sleep: any;
- long_fast:any;
- mode: string;
- selTab: number;
- refreshs: any; //刷新数据时间点
- title: string;
- eatArchived: any;
- showActionCircadian: boolean;
- isCompleted: boolean;
- }
- const initialState: HealthState = {
- windows: null,
- fast_with_sleep: null,
- long_fast:null,
- mode: 'DAY',
- selTab: 0,
- refreshs: [],
- title: '',
- eatArchived: null,
- showActionCircadian: false,
- isCompleted: false,
- }
- const healthSlice = createSlice({
- name: 'health',
- initialState,
- reducers: {
- setWindows(state, action) {
- state.windows = action.payload
- },
- setFastWithSleep(state, action) {
- state.fast_with_sleep = action.payload
- },
- setLongFast(state,action){
- state.long_fast = action.payload
- },
- setMode(state, action) {
- state.mode = action.payload
- },
- setTab(state, action) {
- state.selTab = action.payload
- },
- setRefreshs(state, action) {
- state.refreshs = action.payload
- },
- setTitle(state, action) {
- state.title = action.payload
- },
- setEatArchived(state, action) {
- state.eatArchived = action.payload
- },
- setShowActionTip(state, action) {
- const { isShow, isCompleted } = action.payload
- state.showActionCircadian = isShow
- state.isCompleted = isCompleted
- }
- }
- })
- export const { setWindows, setMode, setTab, setRefreshs, setTitle, setEatArchived, setShowActionTip, setFastWithSleep,setLongFast } = healthSlice.actions;
- export default healthSlice.reducer;
|