From 908e1a201d9215c7285136d98af8740c30b22d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 10 Aug 2019 11:28:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 20 +++++++++---------- .../shixunHomework/ShixunWorkReport.js | 7 +++++++ .../modules/paths/PathDetail/DetailCards.js | 8 ++++++++ .../paths/PathDetail/PathDetailIndex.js | 9 +++++++++ public/react/src/modules/tpm/TPMBanner.js | 17 +++++++++++++++- .../tpm/shixunchild/Challenges/Challenges.js | 9 ++++++++- 6 files changed, 58 insertions(+), 12 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index c09a2cbe7..174b163d8 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -20,16 +20,16 @@ let hashTimeout // TODO 开发期多个身份切换 let debugType ="" -if (isDev) { - const _search = window.location.search; - let parsed = {}; - if (_search) { - parsed = queryString.parse(_search); - } - debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' : - window.location.search.indexOf('debug=s') != -1 ? 'student' : - window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' -} +// if (isDev) { +// const _search = window.location.search; +// let parsed = {}; +// if (_search) { +// parsed = queryString.parse(_search); +// } +// debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' : +// window.location.search.indexOf('debug=s') != -1 ? 'student' : +// window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' +// } window._debugType = debugType; export function initAxiosInterceptors(props) { diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index 565121e1b..6b27a666b 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -75,10 +75,15 @@ class ShixunWorkReport extends Component { let homeworkid=this.props.match.params.homeworkid; let url = `/student_works/${homeworkid}/shixun_work_report.json` axios.get(url).then((result) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 407||response.data.status === 408) { + + }else{ this.setState({ data:result.data, spinning:false }) + } + }).catch((error) => { console.log(error) this.setState({ @@ -111,6 +116,8 @@ class ShixunWorkReport extends Component { } render() { let{data} =this.state; + console.log(data) + console.log(this.props) let category_id=data===undefined?"":data.category===null?"":data.category.category_id; let homework_common_id=data===undefined?"":data.homework_common_id; let homeworkid=this.props.match.params.homeworkid; diff --git a/public/react/src/modules/paths/PathDetail/DetailCards.js b/public/react/src/modules/paths/PathDetail/DetailCards.js index 21165ff57..1dd93daa8 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCards.js +++ b/public/react/src/modules/paths/PathDetail/DetailCards.js @@ -193,12 +193,20 @@ class DetailCards extends Component{ } startgameid=(id)=>{ + + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + if(this.props.current_user&&this.props.current_user.profile_completed===false){ this.setState({ AccountProfiletype:true }) return } + + let url = "/shixuns/" + id + "/shixun_exec.json"; axios.get(url).then((response) => { diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index 36537e7d0..1d233a775 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -326,6 +326,15 @@ class PathDetailIndex extends Component{ return(