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( +

+ +
+

+ {this.props.coursedata.name} + > + 问卷 + > + 问卷详情 +

+

+ {pollDetail && pollDetail.polls_name} + - this.goback()}>返回 -

-
-
-
- - 答题列表 - { - (isAdmin || (isStudent && pollDetail && pollDetail.show_result == 1 && pollDetail.polls_status == 3 && user_permission && user_permission.current_status==1)) && 统计结果 - } - { isAdmin && 问卷预览 } - 设置 - -
- { - isAdmin && - + this.props.history.goBack()}>返回 +

+
+
+
+ + 答题列表 + { + (isAdmin || (isStudent && pollDetail && pollDetail.show_result == 1 && pollDetail.polls_status == 3 && user_permission && user_permission.current_status==1)) && 统计结果 + } + { isAdmin && 问卷预览 } + 设置 + +
+ { + isAdmin && + 编辑问卷 - {/* 立即发布 */} - { - user_permission && user_permission.poll_unpublish_count > 0 ? -
  • - -
  • - :"" - } - {/* 立即截止、撤销发布 */} - { - user_permission && user_permission.poll_publish_count > 0 ? -
  • - -
  • - :"" - } - {/* { + {/* 立即发布 */} + { + user_permission && user_permission.poll_unpublish_count > 0 ? +
  • + +
  • + :"" + } + {/* 立即截止、撤销发布 */} + { + user_permission && user_permission.poll_publish_count > 0 ? +
  • + +
  • + :"" + } + {/* { user_permission && user_permission.poll_publish_count>0 ?
  • :"" } */} - this.confirmysl("/polls/"+this.props.match.params.pollId+"/commit_result.xlsx")} href="javascript:void(0);">导出统计 + this.confirmysl("/polls/"+this.props.match.params.pollId+"/commit_result.xlsx")} href="javascript:void(0);">导出统计 - } - { - isStudent && - + } + { + isStudent && + { - user_permission && user_permission.current_status!=3 ? - - { user_permission && user_permission.current_status ==0 ? "继续答题" : user_permission.current_status == 1 ? "查看答题" : "开始答题" } - - :"" - } + user_permission && user_permission.current_status!=3 ? + + { user_permission && user_permission.current_status ==0 ? "继续答题" : user_permission.current_status == 1 ? "查看答题" : "开始答题" } + + :"" + } - } - -
  • - - { - // 答题列表 - parseInt(tab[0])==0 && - } - { - // 统计结果 - parseInt(tab[0])==1 && - } - - { - //问卷预览 - parseInt(tab[0])==2 && - } - { - //设置 - parseInt(tab[0])==3 && - } - -
    -
    -
    - ) - } + } + +
    + + { + // 答题列表 + parseInt(tab[0])==0 && + } + { + // 统计结果 + parseInt(tab[0])==1 && + } + + { + //问卷预览 + parseInt(tab[0])==2 && + } + { + //设置 + parseInt(tab[0])==3 && + } + +
    +
    +
    + ) + } } export default PollDetailIndex \ No newline at end of file diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js index 5534dd415..1c6ee09e6 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js @@ -402,7 +402,7 @@ class DetailCardsEditAndAdd extends Component{
    *
    - +
    名称不能为空
    必填项