B2identify.ts 558 B

12345678910111213141516171819202122232425262728
  1. import { FourTableType } from '@/pages/B_enterTibet/B1collect/type'
  2. // 初始化状态
  3. const initState = {
  4. // 列表数据
  5. tableInfo: {
  6. list: [] as FourTableType[],
  7. total: 0
  8. }
  9. }
  10. // 定义 action 类型
  11. type Props = {
  12. type: 'B2/getList'
  13. payload: { list: FourTableType[]; total: number }
  14. }
  15. // reducer
  16. export default function userReducer(state = initState, action: Props) {
  17. switch (action.type) {
  18. // 获取列表数据
  19. case 'B2/getList':
  20. return { ...state, tableInfo: action.payload }
  21. default:
  22. return state
  23. }
  24. }