From 443e427a7eead02d0086a5d6d36c7d32a1355a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Sep 2019 10:34:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E5=BB=BA=E8=AF=BE?= =?UTF-8?q?=E5=A0=82=E6=96=B0=E5=BC=80=E9=A1=B5=20goback=20=E6=97=A0?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/new/CoursesNew.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index ec73cc17d..a2cc45916 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -335,11 +335,19 @@ class CoursesNew extends Component { // this.props.history.push(this.props.current_user.first_category_url); // } // window.history.go(-1) - if(id===undefined){ - this.props.history.goBack() - }else{ - this.props.history.push(this.props.current_user.first_category_url); - } + try { + if(id===undefined){ + this.props.history.push("/"); + }else{ + if(this.props.current_user.first_category_url===undefined){ + this.props.history.push("/"); + }else{ + this.props.history.push(this.props.current_user.first_category_url); + } + } + }catch (e) { + this.props.history.push("/"); + } }