Parcourir la source

feat: 仪表盘数据

outaozhen il y a 5 ans
Parent
commit
4d0a74d6a3
2 fichiers modifiés avec 1 ajouts et 35 suppressions
  1. 0 32
      src/models/dashboard.js
  2. 1 3
      src/pages/workbench/Dashboard/index.jsx

+ 0 - 32
src/models/dashboard.js

@@ -1,32 +0,0 @@
-import consts from '@/consts'
-import { queryDashboard } from '@/services/dashboard'
-
-export default {
-  namespace: 'dashboard',
-  state: {
-    data: []
-  },
-  // 用于处理异步操作和业务逻辑,由action触发,但不能修改state
-  effects: {
-    *fetch({ payload }, { call, put }) {
-      const response = yield call(queryDashboard, payload)
-      if (response && response.code === consts.RET_CODE.SUCCESS) {
-        yield put({
-          type: 'show',
-          payload: response.data
-        })
-      }
-      // console.log(response)
-    }
-  },
-  // reducers:用于处理同步操作,由action触发,可修改state
-  reducers: {
-    // action:是由reducers及effects的触发器,一般是第一个对象,如:{type:'add',payload:todo}
-    show(state, action) {
-      return {
-        ...state,
-        data: action.payload.dashboard
-      }
-    }
-  }
-}

+ 1 - 3
src/pages/workbench/Dashboard/index.jsx

@@ -17,10 +17,8 @@ const Dashboard = () => {
       data: { reminderData = [], leaderboard = [] } = { reminderData: [], leaderboard: [] }
     } = await queryDashboard(payload)
     if (code === consts.RET_CODE.SUCCESS) {
-      setState({ ...state, data: reminderData, leaderboard })
+      setState({ ...state, reminderData, leaderboard })
     }
-    console.log(reminderData)
-    console.log(leaderboard)
   }
   useEffect(() => {
     initData()