From 21462cd45e37ee2f42489cd43b46e24314756636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 9 Oct 2019 10:57:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=B7=B3=E8=BD=AC=E4=BD=93?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesDetail/CoursesBanner.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 437471436..8bd1e980e 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -55,7 +55,11 @@ class CoursesBanner extends Component { } } componentDidMount() { - + if(this.props.match.path==="/courses/:coursesId"){ + if(this.props.user!=undefined){ + this.props.history.push(this.props.user.first_category_url) + } + } this.onloadupdatabanner() on('updatabanner', this.updatabanner) axios.interceptors.response.use((response) => { @@ -69,9 +73,17 @@ class CoursesBanner extends Component { } return response; }, (error) => { - }); } + componentDidUpdate(prevProps) { + if(prevProps.user!=this.props.user){ + if(this.props.match.path==="/courses/:coursesId"){ + if(this.props.user!=undefined){ + this.props.history.push(this.props.user.first_category_url) + } + } + } + } componentWillUnmount() { off('updatabanner', this.updatabanner) }