import Config from '../../../../utils/config'; import { newdogchipView } from '../../services/index'; import { Toast } from 'antd-mobile'; export default { state: { dog1: {}, dog2: {}, dog3: {}, dog4: {}, dog5: {}, dog6: {}, dog7: {}, dog8: {}, dog9: {}, dog10: {}, dog11: {}, dog12: {}, dog13: {}, dog14: {}, }, reducers: { updateState(state, { payload }) { return { ...state, ...payload, }; }, clean(state, { payload }) { return { dog1: {}, dog2: {}, dog3: {}, dog4: {}, dog5: {}, dog6: {}, dog7: {}, dog8: {}, dog9: {}, dog10: {}, dog11: {}, dog12: {}, dog13: {}, dog14: {}, }; }, }, effects: { *newdogchipView({ payload }, { call, put }) { Toast.loading('查询中', 0); const { rc, msg, data } = yield call(newdogchipView, { ...payload }); Toast.hide(); if (rc === Config.constant.codeSuccess) { yield put({ type: 'updateState', payload: { ...data, }, }); } else { Toast.fail(msg); } }, }, subscriptions: { // setupHistory({ dispatch, history }) { // history.listen(location => {}); // }, }, };