| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import consts from '@/consts'
- import { queryCompilationListV2 } from '@/services/product'
- export default {
- namespace: 'road',
- state: {
- compilationv2: {} // 个人
- },
- // 用于处理异步操作和业务逻辑,由action触发,但不能修改state
- effects: {
- *fetchCompilationv2({ payload }, { call, put }) {
- const response = yield call(queryCompilationListV2, payload)
- if (response && response.code === consts.RET_CODE.SUCCESS) {
- yield put({
- type: 'changeCompilationStatev2',
- payload: {
- key: payload?.projectType,
- data: response.data
- }
- })
- }
- }
- },
- // reducers:用于处理同步操作,由action触发,可修改state
- reducers: {
- // 通用reducer
- changeCompilationStatev2(state, action) {
- return {
- ...state,
- compilationv2: { ...state.compilationv2, [action.payload.key]: action.payload.data }
- }
- }
- }
- // reducers: {
- // changeCompilationState(state, action) {
- // return {
- // ...state,
- // compilation: { ...state.compilation, [action.payload.key]: action.payload.data }
- // }
- // }
- // }
- }
|