From 760c2edfddaba7770828c0d65097abd9be26aba0 Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Fri, 6 Mar 2020 20:31:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=A1=B5=E9=9D=A2=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=80=BC=E4=BC=9A=E5=8F=A0=E5=8A=A0=E5=8F=8A=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=80=BC=E4=BC=9A=E6=8D=A2=E6=88=90=E5=9C=A8=E5=8F=A6?= =?UTF-8?q?=E5=A4=96=E4=B8=80=E4=B8=AA=E8=AF=BE=E5=A0=82=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=8D=E5=AF=B9=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/paths/statics/index.js | 10 ++++++---- public/react/src/redux/actions/static.js | 4 +++- public/react/src/redux/reducers/staticReducer.js | 4 +++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/paths/statics/index.js b/public/react/src/modules/paths/statics/index.js index aa5592cd4..b4eeec035 100644 --- a/public/react/src/modules/paths/statics/index.js +++ b/public/react/src/modules/paths/statics/index.js @@ -23,7 +23,7 @@ const App = (props) => { total, staticList, changeParams, - initTotal + initTotal, } = props; // const [datas, setDatas] = useState([]); // const [sortedInfo, setSortedInfo] = useState({}); @@ -212,7 +212,8 @@ const App = (props) => { sorter: (a, b) => a.cost_time - b.cost_time } ]; - + + useEffect(() => { changeParams({ page: 1 @@ -224,6 +225,7 @@ const App = (props) => { pathId && staticList(pathId); } + // const { // study_count, // course_study_count, @@ -249,7 +251,6 @@ const App = (props) => { // 恢复初始值 changeParams(params); initTotal(); - console.log(staticList) pathId && staticList(pathId); } @@ -335,8 +336,9 @@ const mapStateToProps = (state) => { return { subject_info, other_info, - total + total, } + }; const mapDispatchToProps = (dispatch) => ({ diff --git a/public/react/src/redux/actions/static.js b/public/react/src/redux/actions/static.js index bc689c868..77c4e0267 100644 --- a/public/react/src/redux/actions/static.js +++ b/public/react/src/redux/actions/static.js @@ -12,13 +12,15 @@ import { fetchStaticList } from "../../services/staticService"; export const staticList = (id) => { return (dispatch, getState) => { const { params, total_count, other_info } = getState().staticReducer; - if (other_info.length===20||total_count !== 0 && total_count === other_info.length) return; + // console.log('统计数据=====>>>>>', params); + // if (total_count !== 0 && total_count === other_info.length) return; fetchStaticList(id, params).then(res => { // console.log('统计数据=====>>>>>', res); const {data} = res; if (data.status === 0) { dispatch({ type: types.GET_STATIC_INFO, + other_info:data.data.other_info, payload: data.data }); } diff --git a/public/react/src/redux/reducers/staticReducer.js b/public/react/src/redux/reducers/staticReducer.js index 7d2202d03..3790b2638 100644 --- a/public/react/src/redux/reducers/staticReducer.js +++ b/public/react/src/redux/reducers/staticReducer.js @@ -38,12 +38,14 @@ const initalState = { const staticReducer = (state = initalState, action) => { const { payload = {}, type } = action; const {subject_info, other_info = [], total = {}, total_count} = payload; + switch (type) { case types.GET_STATIC_INFO: return { ...state, subject_info, - other_info: state.other_info.concat(other_info), + other_info, + // other_info: state.other_info.concat(other_info), total, total_count, params: Object.assign({}, state.params, { page: state.params.page + 1 })