From c2962c961231478f1842d429b603b4e624a9a68f 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, 20 Jul 2019 15:31:37 +0800 Subject: [PATCH] =?UTF-8?q?=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 8 +++---- .../courses/coursesPublic/ShixunModal.js | 22 ++++++++++--------- .../src/modules/courses/new/CoursesNew.js | 8 ++++++- public/react/src/modules/home/shixunsHome.js | 16 +++++++------- public/react/src/modules/tpm/TPMBanner.js | 19 ++++++++++++---- 5 files changed, 46 insertions(+), 27 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 3f34ee7a6..b8e98fd8e 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -26,10 +26,9 @@ function locationurl(list){ } // TODO 开发期多个身份切换 -const debugType ="" -// window.location.search.indexOf('debug=t') != -1 ? 'teacher' : -// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin' -// window._debugType = debugType; +const debugType =window.location.search.indexOf('debug=t') != -1 ? 'teacher' : + window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin' +window._debugType = debugType; export function initAxiosInterceptors(props) { @@ -44,6 +43,7 @@ export function initAxiosInterceptors(props) { proxy="http://47.96.87.25:48080" + // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 const requestMap = {}; diff --git a/public/react/src/modules/courses/coursesPublic/ShixunModal.js b/public/react/src/modules/courses/coursesPublic/ShixunModal.js index f0caef87b..1fc218908 100644 --- a/public/react/src/modules/courses/coursesPublic/ShixunModal.js +++ b/public/react/src/modules/courses/coursesPublic/ShixunModal.js @@ -146,12 +146,22 @@ class ShixunModal extends Component{ } savecouseShixunModal=()=>{ + this.setState({ hometypepvisible:true }) let {coursesId,patheditarry,datas}=this.props; - let{category_id}=this.state; + if(patheditarry.length===0){ + this.setState({ + shixunmodelchke:true, + chekicmessage:"请先选择实训", + hometypepvisible:false + }) + + return + } + if (this.props.chooseShixun) { this.props.chooseShixun(patheditarry) this.setState({ @@ -159,15 +169,7 @@ class ShixunModal extends Component{ }) return; } - if(patheditarry.length===0){ - this.setState({ - shixunmodelchke:true, - chekicmessage:"请先选择实训", - hometypepvisible:false - }) - return - } let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json"; axios.post(url, { category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id), @@ -378,7 +380,7 @@ class ShixunModal extends Component{ - {this.state.chekicmessage} + {this.state.chekicmessage}
取消 确定 diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index e052ed1e3..eb1627e83 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -257,7 +257,13 @@ class CoursesNew extends Component { } goback = () => { - window.history.go(-1) + + if(this.props.match.params.coursesId===undefined){ + this.props.history.push("/courses"); + }else{ + this.props.history.push(`/courses/${this.props.match.params.coursesId}`); + } + // window.history.go(-1) } onCheckAllChange = (e) => { diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js index 780691e6c..5400368ec 100644 --- a/public/react/src/modules/home/shixunsHome.js +++ b/public/react/src/modules/home/shixunsHome.js @@ -361,7 +361,7 @@ class ShixunsHome extends Component { - {item.name} + {item.username} ) @@ -375,7 +375,7 @@ class ShixunsHome extends Component { - {item.name} + {item.username} ) @@ -389,7 +389,7 @@ class ShixunsHome extends Component { - {item.name} + {item.username} ) @@ -405,7 +405,7 @@ class ShixunsHome extends Component {
  • - {item.name} + {item.username}
  • ) @@ -437,7 +437,7 @@ class ShixunsHome extends Component { - {item.name} + {item.username} ) @@ -451,7 +451,7 @@ class ShixunsHome extends Component { - {item.name} + {item.username} ) @@ -465,7 +465,7 @@ class ShixunsHome extends Component { - {item.name} + {item.username} ) @@ -481,7 +481,7 @@ class ShixunsHome extends Component {
  • - {item.name} + {item.username}
  • ) diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index c9404a792..68113f133 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -39,7 +39,7 @@ class TPMBanner extends Component { this.state={ Forkvisible: false, Senttothetype:false, - Senttothevcalue:1, + Senttothevcalue:undefined, courses_count:1, course_list:[], pagenum:1, @@ -62,6 +62,7 @@ class TPMBanner extends Component { isIE:false, Forkvisibletype: false, isSpin:false, + Senttothevcaluetype:false } } @@ -233,12 +234,21 @@ class TPMBanner extends Component { }); } sendeSenttothevcalue=()=>{ + let {Senttothevcalue}=this.state; + + if(Senttothevcalue===undefined){ + this.setState({ + Senttothevcaluetype:true + }) + return + } let id = this.props.match.params.shixunId; let url="/shixuns/" + id +"/send_to_course.json"; axios.post(url,{ course_id:Senttothevcalue }).then((response) => { + this.props.showSnackbar(response.data.message); this.setState({ Senttothetype:false, @@ -466,6 +476,7 @@ class TPMBanner extends Component { shixunsreplace, hidestartshixunsreplacevalue, Forkvisibletype, + Senttothevcaluetype, isIE} = this.state; let {shixunsDetails, shixunId, star_info, star_infos} = this.props; let challengeBtnTipText = ''; @@ -839,7 +850,7 @@ class TPMBanner extends Component { />
    -
    12?"cdefault mb20":"cdefault mb50"}> +
    12?"cdefault ":"cdefault "}>
      @@ -855,8 +866,8 @@ class TPMBanner extends Component {
    - -
    + {this.state.Senttothevcaluetype===true?
    请选择你要发送的课堂
    :""} +
    12 ? "block" : "none"}} showQuickJumper defaultCurrent={1} current={pages} pageSize={12} total={courses_count} onChange={this.onChangesendeSenttothe}/>