From 3ab60f8352497ae56e39cd25af50a2f845f943b1 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 3 Sep 2019 11:02:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/exercise/ExerciseDisplay.js | 7 ++- .../user/usersInfo/banks/BanksIndex.js | 7 +++ .../user/usersInfo/banks/BanksTabIndex.js | 13 ++++- .../usersInfo/banks/ExerciseBanksDetail.js | 54 +++++++++++++++++++ 4 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 public/react/src/modules/user/usersInfo/banks/ExerciseBanksDetail.js diff --git a/public/react/src/modules/courses/exercise/ExerciseDisplay.js b/public/react/src/modules/courses/exercise/ExerciseDisplay.js index a0296476f..984f96114 100644 --- a/public/react/src/modules/courses/exercise/ExerciseDisplay.js +++ b/public/react/src/modules/courses/exercise/ExerciseDisplay.js @@ -53,11 +53,14 @@ class ExerciseDisplay extends Component{ componentDidMount = () => { const Id = this.props.match.params.Id if (Id) { - const url = `/exercises/${Id}.json` + const url = `/${this.props.urlPath || 'exercises'}/${Id}.json` axios.get(url) .then((response) => { if (response.data.status == 0) { - this.setState({...response.data}) + response.data.exercise_description = response.data.exercise_description || response.data.description + response.data.exercise_name = response.data.exercise_name || response.data.name + response.data.exercise_status = response.data.exercise_status == undefined ? 1 : response.data.exercise_status + this.setState({...response.data}) } }) .catch(function (error) { diff --git a/public/react/src/modules/user/usersInfo/banks/BanksIndex.js b/public/react/src/modules/user/usersInfo/banks/BanksIndex.js index 916601420..6a303f62b 100644 --- a/public/react/src/modules/user/usersInfo/banks/BanksIndex.js +++ b/public/react/src/modules/user/usersInfo/banks/BanksIndex.js @@ -149,6 +149,13 @@ class BanksIndex extends Component{ />) } }> + { + return () + } + }> import('./PollBanksContent'), loading: Loading, }) +// 试卷详情 +const ExerciseBanksDetail = Loadable({ + loader: () => import('./ExerciseBanksDetail'), + loading: Loading, +}); class BanksTabIndex extends Component{ constructor(props){ @@ -53,7 +58,13 @@ class BanksTabIndex extends Component{ > } - + { + return () + } + }> { + + } + detailFetchCallback = (result) => { + let Id=this.props.match.params.Id; + + const crumbData={ + title: result.data.exercise && result.data.exercise.name, + is_public: result.data.exercise && result.data.exercise.is_public, + crumbArray:[ + {content:'详情'}, + ] + } + const menuData={ + tab:'0',//tab选中的index + menuArray:[//tab以及tab路由 + {to:`/banks/exercise/${Id}`,content:'内容详情'} + ], + category:'exercise',//毕设选题 + tos: `/banks/exercise/${Id}/edit`, + id: Id, + + } + this.props.initPublic(crumbData,menuData); + } + + render(){ + let { pollDetail } = this.state + + return( +
+ + +
+ ) + } +} +export default ExerciseBanksDetail