From 23f61a9c950f677d0794cf8c73657754c3137f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 25 Jul 2019 11:45:22 +0800 Subject: [PATCH] Merge branches 'dev_aliyun' and 'master' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun # Conflicts: # public/react/src/modules/courses/exercise/Testpapersettinghomepage.js --- .../src/modules/courses/new/CoursesNew.js | 6 +- .../modules/courses/poll/PollDetailIndex.js | 400 +++++++++--------- .../paths/PathDetail/DetailCardsEditAndAdd.js | 2 +- 3 files changed, 198 insertions(+), 210 deletions(-) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index fce6cd732..c8b090b8b 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -192,7 +192,7 @@ class CoursesNew extends Component { ).then((response) => { // debugger if (response.data.status === 0) { - this.goback + this.goback() } }).catch((error) => { console.log(error) @@ -235,9 +235,7 @@ class CoursesNew extends Component { } ).then((response) => { if (response.status === 200) { - if (response.data.course_id != undefined) { - window.location.href = "/courses/" + response.data.course_id+"/students"; - } + this.goback() } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index cbcdd1533..8e3f78d5c 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -22,179 +22,169 @@ import axios from 'axios' const map={1:"未发布",2:"提交中",3:"已截止",4:"已结束"} class PollDetailIndex extends Component{ - constructor(props){ - super(props); - this.state={ - tab:["0"], - pollDetail:undefined, - user_permission:undefined, - DownloadType:false, - DownloadMessageval:undefined, - } - } - - getPollInfo=()=>{ - console.log(this.props); - let pollId=this.props.match.params.pollId; - let url=`/polls/${pollId}/common_header.json` - axios.get(url).then((result)=>{ - if(result.status==200){ - this.setState({ - pollDetail:result.data, - user_permission:result.data.user_permission - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - - componentDidMount(){ - const query =this.props.location.search; - if(query.indexOf("?")!=-1){ - const type = query.split('?'); - let name = type[1].split("tab="); - name = String(name).split(","); - name = decodeURI(name[1]); - if(name!=undefined && name!="" && name!="undefined"){ - this.setState({ - tab:[name] - }) - } - } - - this.getPollInfo(); - } - - //切换tab - changeTab=(e)=>{ - this.setState({ - tab:e.key - }) - } - - /// 确认是否下载 - confirmysl(url){ - axios.get(url).then((response) => { - if(response.data.status&&response.data.status===-1){ - - }else if(response.data.status&&response.data.status===-2){ - if(response.data.message === "100"){ - // 已超出文件导出的上限数量(100 ),建议: - - this.setState({ - DownloadType:true, - DownloadMessageval:100 - }) - }else { - //因附件资料超过500M - this.setState({ - DownloadType:true, - DownloadMessageval:500 - }) - } - }else { - this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); - } - }).catch((error) => { - console.log(error) - }); - } - - Downloadcal=()=>{ - this.setState({ - DownloadType:false, - DownloadMessageval:undefined - }) - } - goback=()=>{ - - let courseId=this.props.match.params.coursesId; - if(courseId===undefined){ - this.props.history.push("/courses"); - }else{ - this.props.history.push(this.props.current_user.first_category_url); + constructor(props){ + super(props); + this.state={ + tab:["0"], + pollDetail:undefined, + user_permission:undefined, + DownloadType:false, + DownloadMessageval:undefined, } + } + + getPollInfo=()=>{ + console.log(this.props); + let pollId=this.props.match.params.pollId; + let url=`/polls/${pollId}/common_header.json` + axios.get(url).then((result)=>{ + if(result.status==200){ + this.setState({ + pollDetail:result.data, + user_permission:result.data.user_permission + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + componentDidMount(){ + const query =this.props.location.search; + if(query.indexOf("?")!=-1){ + const type = query.split('?'); + let name = type[1].split("tab="); + name = String(name).split(","); + name = decodeURI(name[1]); + if(name!=undefined && name!="" && name!="undefined"){ + this.setState({ + tab:[name] + }) + } + } + + this.getPollInfo(); + } + + //切换tab + changeTab=(e)=>{ + this.setState({ + tab:e.key + }) + } + + /// 确认是否下载 + confirmysl(url){ + axios.get(url).then((response) => { + if(response.data.status&&response.data.status===-1){ + + }else if(response.data.status&&response.data.status===-2){ + if(response.data.message === "100"){ + // 已超出文件导出的上限数量(100 ),建议: + + this.setState({ + DownloadType:true, + DownloadMessageval:100 + }) + }else { + //因附件资料超过500M + this.setState({ + DownloadType:true, + DownloadMessageval:500 + }) + } + }else { + this.props.showNotification(`正在下载中`); + window.open("/api"+url, '_blank'); + } + }).catch((error) => { + console.log(error) + }); + } + Downloadcal=()=>{ + this.setState({ + DownloadType:false, + DownloadMessageval:undefined + }) } - render(){ - let {tab,pollDetail,user_permission}=this.state; - - const isAdmin =this.props.isAdmin(); - const isStudent = this.props.isStudent(); - return( -
- this.goback()}>{this.props.coursedata.name}
- >
-
- {pollDetail && pollDetail.polls_name}
-
+ render(){
+ let {tab,pollDetail,user_permission}=this.state;
+
+ const isAdmin =this.props.isAdmin();
+ const isStudent = this.props.isStudent();
+ return(
+
+
+ {pollDetail && pollDetail.polls_name}
+