From e77ad0d04db7e95201a20a219e9786a2d5e05dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 24 Jul 2019 14:04:36 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=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 | 7 +++---- public/react/src/modules/courses/new/CoursesNew.js | 6 ++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 02d8c2be5..0666aadc3 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -18,10 +18,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) { // TODO 避免重复的请求 https://github.com/axios/axios#cancellation diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 1183b59e9..eb52a32f5 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -135,6 +135,8 @@ class CoursesNew extends Component { let {is_public,datatime} = this.state // console.log(is_public) + debugger + if (coursesId != undefined) { // 编辑 @@ -180,7 +182,7 @@ class CoursesNew extends Component { name: values.classroom, class_period: values.period, credit: parseFloat(values.credit), - end_date: datatime, + end_date: datatime===undefined?"":datatime, is_public: is_public === true || is_public === 1 ? 1 : 0, course_module_types: values.checkboxgroup, authentication: this.state.Realnamecertification, @@ -234,7 +236,7 @@ class CoursesNew extends Component { name: values.classroom, class_period: values.period, credit: parseFloat(values.credit), - end_date: datatime, + end_date: datatime===undefined?"":datatime, is_public: is_public === true || is_public === 1 ? 1 : 0, course_module_types: values.checkboxgroup, authentication: this.state.Realnamecertification, From 620dbd461e417dee210b4177fd8442d56aacad76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 24 Jul 2019 14:13:12 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../paths/PathDetail/PathDetailIndex.js | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index 7211fde5e..1731064c0 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -139,21 +139,20 @@ class PathDetailIndex extends Component{ let pathid=this.props.match.params.pathId; let url="/paths/"+pathid+".json"; axios.get(url).then((result)=>{ - if (result.data.status == 407 || result.data.status == 401) { + if (result.data.status === 407 || result.data.status === 401) { return; } - if(result.data.allow_visit===true){ - this.setState({ - detailInfoList:result.data, - items: getItems(result.data.members.length), - }) - }else{ - window.location.href = "/403"; - // this.setState({ - // Modalstype:true, - // Modalstopval:'你没有权限访问,请联系对应课程管理人员开通', - // }) - } + + if (result.data.status === 403) { + return; + } + + if(result.data.allow_visit===true){ + this.setState({ + detailInfoList:result.data, + items: getItems(result.data.members.length), + }) + } }).catch((error)=>{ console.log(error); @@ -168,6 +167,9 @@ class PathDetailIndex extends Component{ if (result.data.status == 407 || result.data.status == 401) { return; } + if (result.data.status === 403 ) { + return; + } if(result.data.allow_visit===true){ this.setState({ @@ -175,13 +177,8 @@ class PathDetailIndex extends Component{ items: getItems(result.data.members.length), user_id:undefined, }) - }else{ - window.location.href = "/403"; - // this.setState({ - // Modalstype:true, - // Modalstopval:'你没有权限访问,请联系对应课程管理人员开通', - // }) } + }).catch((error)=>{ console.log(error); }) From 486d025809db2d7bb798fb008488ffc1f9e72204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 24 Jul 2019 14:23:30 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=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 | 3 +- .../courses/coursesPublic/ShixunModal.js | 1 - .../tasks/GraduationTasksSubmitnew.js | 1 - .../topics/GraduateTopicDetailTable.js | 614 +++++++++--------- .../src/modules/courses/new/CoursesNew.js | 3 - .../react/src/modules/courses/poll/PollNew.js | 1 - .../shixunHomework/Listofworksstudentone.js | 2 +- public/react/src/modules/login/LoginDialog.js | 13 +- .../paths/PathDetail/DetailCardsEditAndAdd.js | 1 - public/react/src/modules/tpm/NewHeader.js | 3 - 10 files changed, 317 insertions(+), 325 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 0666aadc3..f79041105 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -18,7 +18,8 @@ function locationurl(list){ } // TODO 开发期多个身份切换 -const debugType =window.location.search.indexOf('debug=t') != -1 ? 'teacher' : +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) { diff --git a/public/react/src/modules/courses/coursesPublic/ShixunModal.js b/public/react/src/modules/courses/coursesPublic/ShixunModal.js index 56cecc51b..de9609d0f 100644 --- a/public/react/src/modules/courses/coursesPublic/ShixunModal.js +++ b/public/react/src/modules/courses/coursesPublic/ShixunModal.js @@ -82,7 +82,6 @@ class ShixunModal extends Component{ //勾选实训 shixunhomeworkedit=(list)=>{ -debugger let newpatheditarry=[]; if (this.props.singleChoose == true) { if (list.length > 0) { diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js index 355a514a4..50f2a4fde 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js @@ -117,7 +117,6 @@ class GraduationTasksSubmitnew extends Component{ } // 附件相关 START handleChange = (info) => { - debugger if (info.file.status === 'uploading') { let fileList = info.fileList; this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) }); diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailTable.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailTable.js index c9bd3f496..eae3fb43d 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailTable.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetailTable.js @@ -1,309 +1,307 @@ -import React,{ Component } from "react"; - -import '../../css/members.css' -import '../../css/busyWork.css' -import '../style.css' - -import { WordsBtn } from 'educoder' -import NoneData from '../../coursesPublic/NoneData' -import Modals from "../../../modals/Modals" -import axios from 'axios' -import { Modal,Select,Input } from "antd"; - -const Option = Select.Option -class GraduateTopicDetailTable extends Component{ - constructor(props){ - super(props); - this.state={ - modalsType:false, - modalsTopval:'', - operationId:undefined, - agreeFlag:false, - classesId:undefined, - agreeCheck:false, - visible:false, - un_addClass:undefined, - un_addClass_notice:"", - un_choose_notice:"" - } - } - // 拒绝 - aboutTopic=(id)=>{ - this.setState({ - modalsType:true, - modalsTopval:'是否确认拒绝学生选题?', - operationId:id - }) - } - cancelAboutTopic=()=>{ - this.setState({ - modalsType:false, - modalsTopval:'' - }) - } - sureAboutTopic=()=>{ - let{operationId}=this.state - let courseId=this.props.match.params.course_id; - let graduation_topic_id=this.props.match.params.graduation_topic_id; - let url =`/courses/${courseId}/graduation_topics/${graduation_topic_id}/refuse_student_topic.json?student_graduation_topic=`+operationId; - axios.post(url).then((result)=>{ - if(result.data.status==0){ - this.props.showNotification(`${result.data.message}`); - this.setState({ - modalsType:false, - modalsTopval:'' - }) - //成功后调用列表接口,刷新 - this.props.getDetailList(this.props.page); - } - }).catch((error)=>{ - console.log(error); - }) - this.setState({ - modalsType:false, - modalsTopval:'' - }) - } - - //同意 - agreeTopic=(id)=>{ - this.setState({ - agreeFlag:true, - operationId:id - }) - } - hideAgreeTopic=()=>{ - this.setState({ - agreeFlag:false, - classesId:undefined - }) - } - sureAgreeTopic=(count)=>{ - if(count > 0){ - debugger - let{tableData}=this.props; - let{operationId,classesId}=this.state - let courseId=this.props.match.params.course_id; - let name=tableData.group_list.filter(item=>item.group_id==classesId)[0].group_name; - this.agreeChoose(courseId,operationId,classesId,name); - }else{ - this.setState({ - un_choose_notice:"请先添加分班" - }) - } - } - - agreeChoose=(courseId,operationId,classesId,courseName)=>{ - let graduation_topic_id=this.props.match.params.graduation_topic_id; - let url =`/courses/${courseId}/graduation_topics/${graduation_topic_id}/accept_student_topic.json`; - axios.post(url,{ - student_graduation_topic_id:operationId, - group_id:classesId, - course_group_name:courseName - }).then((result)=>{ - if(result.data.status==0){ - this.props.showNotification(`${result.data.message}`); - this.setState({ - agreeFlag:false, - agreeCheck:true, - visible:false - }) - //成功后调用列表接口,刷新 - this.props.getDetailList(this.props.page); - } - }).catch((error)=>{ - console.log(error); - }) - } - - //切换分班 - changeClasses=(value)=>{ - debugger - this.setState({ - classesId:value - }) - } - - //新增分班 - topicAddClasses=()=>{ - this.setState({ - visible:true, - agreeFlag:false - }) - } - hideClasses=()=>{ - this.setState({ - visible:false, - classesId:undefined - }) - } - - //新建分班--输入分班 - inputClasses=(e)=>{ - this.setState({ - un_addClass:e.target.value - }) - } - - // 新建分班---确定 - sureAddClass=()=>{ - let {un_addClass}=this.state; - if(!un_addClass){ - this.setState({ - un_addClass_notice:"请输入分班名称" - }) - return; - } - console.log(this.props) - let{operationId}=this.state - let courseId=this.props.match.params.course_id; - this.agreeChoose(courseId,operationId,-1,un_addClass); - } - - render(){ - let {page,tableData}=this.props - let { modalsType,modalsTopval,agreeFlag,classesId,visible - ,un_addClass_notice - ,un_addClass, - un_choose_notice - } = this.state - const isAdmin =this.props.isAdmin(); - const isStudent =this.props.isStudent(); - const isNotMember=this.props.isNotMember(); - console.log(un_addClass_notice) - return( -
-
-
- 序号 - 姓名 - {isNotMember ?"" :学号} - 分班 - 选题时间 - 操作 - { - isAdmin && - 确认结果 - } - -
- {/* 拒绝弹框 */} - - {/* 同意弹框 */} - -
-

确认同意学生的选题,将学生加入我的分班

-
- 选择: -
- -

{un_choose_notice}

-
-
-
- 取消 - this.sureAgreeTopic(tableData.group_list.length)}>确定 -
-
-
- -
-
- 分班: -
- -

- {un_addClass_notice} -

-
-
-
- 取消 - 确定 -
-
-
-
- { - tableData.users_list && tableData.users_list.length > 0 && tableData.users_list.map((item,key)=>{ - return( -
  • - {parseInt(key+1)+(parseInt(page-1)*15)} - {item.student_name} - {isNotMember ?"" :{item.student_id}} - {item.class_group_name || "--"} - {item.selected_time} - { - isAdmin && - - { - item.result == "待确认" ? - - this.aboutTopic(`${item.id}`)}>拒绝 - this.agreeTopic(`${item.id}`)}>同意 - : - ( - item.result === "已拒绝" ? -- - : - this.aboutTopic(`${item.id}`)}>拒绝 - ) - } - - } - { - isStudent && - {item.result} - } - { - isAdmin && - {item.result=== "待确认"?"--":item.result} - } - { - isNotMember && -- - } - -
  • - ) - }) - } - { - tableData.users_list && tableData.users_list.length == 0 && - } -
    -
    -
    - ) - } -} +import React,{ Component } from "react"; + +import '../../css/members.css' +import '../../css/busyWork.css' +import '../style.css' + +import { WordsBtn } from 'educoder' +import NoneData from '../../coursesPublic/NoneData' +import Modals from "../../../modals/Modals" +import axios from 'axios' +import { Modal,Select,Input } from "antd"; + +const Option = Select.Option +class GraduateTopicDetailTable extends Component{ + constructor(props){ + super(props); + this.state={ + modalsType:false, + modalsTopval:'', + operationId:undefined, + agreeFlag:false, + classesId:undefined, + agreeCheck:false, + visible:false, + un_addClass:undefined, + un_addClass_notice:"", + un_choose_notice:"" + } + } + // 拒绝 + aboutTopic=(id)=>{ + this.setState({ + modalsType:true, + modalsTopval:'是否确认拒绝学生选题?', + operationId:id + }) + } + cancelAboutTopic=()=>{ + this.setState({ + modalsType:false, + modalsTopval:'' + }) + } + sureAboutTopic=()=>{ + let{operationId}=this.state + let courseId=this.props.match.params.course_id; + let graduation_topic_id=this.props.match.params.graduation_topic_id; + let url =`/courses/${courseId}/graduation_topics/${graduation_topic_id}/refuse_student_topic.json?student_graduation_topic=`+operationId; + axios.post(url).then((result)=>{ + if(result.data.status==0){ + this.props.showNotification(`${result.data.message}`); + this.setState({ + modalsType:false, + modalsTopval:'' + }) + //成功后调用列表接口,刷新 + this.props.getDetailList(this.props.page); + } + }).catch((error)=>{ + console.log(error); + }) + this.setState({ + modalsType:false, + modalsTopval:'' + }) + } + + //同意 + agreeTopic=(id)=>{ + this.setState({ + agreeFlag:true, + operationId:id + }) + } + hideAgreeTopic=()=>{ + this.setState({ + agreeFlag:false, + classesId:undefined + }) + } + sureAgreeTopic=(count)=>{ + if(count > 0){ + let{tableData}=this.props; + let{operationId,classesId}=this.state + let courseId=this.props.match.params.course_id; + let name=tableData.group_list.filter(item=>item.group_id==classesId)[0].group_name; + this.agreeChoose(courseId,operationId,classesId,name); + }else{ + this.setState({ + un_choose_notice:"请先添加分班" + }) + } + } + + agreeChoose=(courseId,operationId,classesId,courseName)=>{ + let graduation_topic_id=this.props.match.params.graduation_topic_id; + let url =`/courses/${courseId}/graduation_topics/${graduation_topic_id}/accept_student_topic.json`; + axios.post(url,{ + student_graduation_topic_id:operationId, + group_id:classesId, + course_group_name:courseName + }).then((result)=>{ + if(result.data.status==0){ + this.props.showNotification(`${result.data.message}`); + this.setState({ + agreeFlag:false, + agreeCheck:true, + visible:false + }) + //成功后调用列表接口,刷新 + this.props.getDetailList(this.props.page); + } + }).catch((error)=>{ + console.log(error); + }) + } + + //切换分班 + changeClasses=(value)=>{ + this.setState({ + classesId:value + }) + } + + //新增分班 + topicAddClasses=()=>{ + this.setState({ + visible:true, + agreeFlag:false + }) + } + hideClasses=()=>{ + this.setState({ + visible:false, + classesId:undefined + }) + } + + //新建分班--输入分班 + inputClasses=(e)=>{ + this.setState({ + un_addClass:e.target.value + }) + } + + // 新建分班---确定 + sureAddClass=()=>{ + let {un_addClass}=this.state; + if(!un_addClass){ + this.setState({ + un_addClass_notice:"请输入分班名称" + }) + return; + } + console.log(this.props) + let{operationId}=this.state + let courseId=this.props.match.params.course_id; + this.agreeChoose(courseId,operationId,-1,un_addClass); + } + + render(){ + let {page,tableData}=this.props + let { modalsType,modalsTopval,agreeFlag,classesId,visible + ,un_addClass_notice + ,un_addClass, + un_choose_notice + } = this.state + const isAdmin =this.props.isAdmin(); + const isStudent =this.props.isStudent(); + const isNotMember=this.props.isNotMember(); + console.log(un_addClass_notice) + return( +
    +
    +
    + 序号 + 姓名 + {isNotMember ?"" :学号} + 分班 + 选题时间 + 操作 + { + isAdmin && + 确认结果 + } + +
    + {/* 拒绝弹框 */} + + {/* 同意弹框 */} + +
    +

    确认同意学生的选题,将学生加入我的分班

    +
    + 选择: +
    + +

    {un_choose_notice}

    +
    +
    +
    + 取消 + this.sureAgreeTopic(tableData.group_list.length)}>确定 +
    +
    +
    + +
    +
    + 分班: +
    + +

    + {un_addClass_notice} +

    +
    +
    +
    + 取消 + 确定 +
    +
    +
    +
    + { + tableData.users_list && tableData.users_list.length > 0 && tableData.users_list.map((item,key)=>{ + return( +
  • + {parseInt(key+1)+(parseInt(page-1)*15)} + {item.student_name} + {isNotMember ?"" :{item.student_id}} + {item.class_group_name || "--"} + {item.selected_time} + { + isAdmin && + + { + item.result == "待确认" ? + + this.aboutTopic(`${item.id}`)}>拒绝 + this.agreeTopic(`${item.id}`)}>同意 + : + ( + item.result === "已拒绝" ? -- + : + this.aboutTopic(`${item.id}`)}>拒绝 + ) + } + + } + { + isStudent && + {item.result} + } + { + isAdmin && + {item.result=== "待确认"?"--":item.result} + } + { + isNotMember && -- + } + +
  • + ) + }) + } + { + tableData.users_list && tableData.users_list.length == 0 && + } +
    +
    +
    + ) + } +} export default GraduateTopicDetailTable; \ No newline at end of file diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index eb52a32f5..e819111c5 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -134,9 +134,6 @@ class CoursesNew extends Component { let coursesId = this.props.match.params.coursesId; let {is_public,datatime} = this.state // console.log(is_public) - - debugger - if (coursesId != undefined) { // 编辑 diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 675e355f3..cf415aa28 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2074,7 +2074,6 @@ class PollNew extends Component { //最小值 HandleGradationGroupChangee = (value, index, max, length) => { - debugger var minbool = false; var maxbool = false; let arr = this.state.adddom; diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 60a8512d5..db58e95fd 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -993,7 +993,7 @@ class Listofworksstudentone extends Component { } axios.post(urll, datasysl).then((result) => { console.log("980000000____________________"); - debugger + if(result === undefined){ return } diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js index 7629eeef2..395f2d9ba 100644 --- a/public/react/src/modules/login/LoginDialog.js +++ b/public/react/src/modules/login/LoginDialog.js @@ -337,6 +337,7 @@ class LoginDialog extends Component { } loginEDU=()=>{ + let {loginValue,passValue,regular,isGoingValue}=this.state; if(regular===1){ return @@ -372,14 +373,16 @@ class LoginDialog extends Component { this.setState({ isRender:false }) + this.props.Modifyloginvalue(); window.location.reload(); + } } - try { - this.props.Modifyloginvalue(); - }catch (e) { - - } + // try { + // this.props.Modifyloginvalue(); + // }catch (e) { + // + // } }).catch((error) => { console.log("356"); console.log(error) diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js index fc0a0fea9..5534dd415 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js @@ -298,7 +298,6 @@ class DetailCardsEditAndAdd extends Component{ //滑动到底判断 if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ // console.log("到达底部"); - debugger this.setState({ hometypepvisible:true }) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 37fac626d..d96c59381 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -487,7 +487,6 @@ submittojoinclass=(value)=>{ } showSearchOpen=(e)=>{ - debugger this.setState({ showSearchOpentype:true }) @@ -495,7 +494,6 @@ submittojoinclass=(value)=>{ } hideshowSearchOpen=(e)=>{ - debugger let {setevaluatinghides}=this.state; if(setevaluatinghides===true){ this.setState({ @@ -520,7 +518,6 @@ submittojoinclass=(value)=>{ } setevaluatinghides=()=>{ - debugger this.setState( { setevaluatinghides:true From 3801ca041ace173067715b8369f8013e9ec9a2c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 24 Jul 2019 14:46:55 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=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 | 3 +-- .../modules/courses/coursesPublic/PathModal.js | 15 +++++++++++---- .../modules/courses/coursesPublic/ShixunModal.js | 10 +++++++--- public/react/src/modules/tpm/NewHeader.js | 1 - 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index f79041105..0666aadc3 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -18,8 +18,7 @@ function locationurl(list){ } // TODO 开发期多个身份切换 -const debugType ="" - window.location.search.indexOf('debug=t') != -1 ? 'teacher' : +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) { diff --git a/public/react/src/modules/courses/coursesPublic/PathModal.js b/public/react/src/modules/courses/coursesPublic/PathModal.js index 10a298c90..43901c87a 100644 --- a/public/react/src/modules/courses/coursesPublic/PathModal.js +++ b/public/react/src/modules/courses/coursesPublic/PathModal.js @@ -91,7 +91,7 @@ class PathModal extends Component{ this.setState({ type:types, page:1, - newshixunmodallist:[] + newshixunmodallist:undefined }) this.funshixunpathlist(Searchvalue,types,true,1) } @@ -105,7 +105,7 @@ class PathModal extends Component{ SenttotheSearch=(value)=>{ this.setState({ page:1, - newshixunmodallist:[] + newshixunmodallist:undefined }) let{type}=this.state; this.funshixunpathlist(value,type,true,1) @@ -267,12 +267,19 @@ class PathModal extends Component{ margin-top:0px !important; height: 40px; } + `} - { newshixunmodallist&&newshixunmodallist.length===0?"":
    :newshixunmodallist&&newshixunmodallist.length===0?
    +
    + +

    暂时还没有相关数据哦!

    +
    :
    + style={{height:"204px"}}> { diff --git a/public/react/src/modules/courses/coursesPublic/ShixunModal.js b/public/react/src/modules/courses/coursesPublic/ShixunModal.js index de9609d0f..1ae63da90 100644 --- a/public/react/src/modules/courses/coursesPublic/ShixunModal.js +++ b/public/react/src/modules/courses/coursesPublic/ShixunModal.js @@ -329,7 +329,7 @@ class ShixunModal extends Component{
    + > + this.applyForAddOrgForm = form} schoolName={school} + {...propsWithoutForm}> {/*提示*/} -
    - - {getFieldDecorator('school', { - rules: [{required: true, message: "不能为空"}], - })( - - )} - - {/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/} - -
    -
    -
    + {/*
    */} + + {/*
    */}
    @@ -455,7 +473,6 @@ class CoursesNew extends Component { > {options} - )} {/*(错误示例:数据结构2017本部;数据结构2017秋季;数据结构2017电子商务1班)*/} @@ -605,7 +622,7 @@ class CoursesNew extends Component {
    -
    +
    (选中后本课堂对所有用户可见,否则仅本课堂成员可见)
    + +
    + + {getFieldDecorator('school', { + rules: [{required: true, message: "不能为空"}], + })( + + )} + + {/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/} + +
    +
    + + {searchlistscholl.length===0?
    + + 未找到包含“{school}”的高校, + 申请新增 + +
    :""} + +
    + + +
    - -
    + +
    diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js index 395f2d9ba..d3df6090e 100644 --- a/public/react/src/modules/login/LoginDialog.js +++ b/public/react/src/modules/login/LoginDialog.js @@ -411,6 +411,7 @@ class LoginDialog extends Component { this.handleDialogClose()} > {isRender===true? @@ -477,7 +478,7 @@ class LoginDialog extends Component { 登录
    -

    +

    ", - testIcon1: "
    " - }, - //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 - saveHTMLToTextarea: true, - // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 - dialogMaskOpacity: 0.6, - placeholder: placeholder, - imageUpload: true, - imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], - imageUploadURL: imageUrl,//url - onload: function () { - // this.previewing(); - $("#" + id + " [type=\"latex\"]").bind("click", function () { - editorName.cm.replaceSelection("```latex"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("```"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line - 1, 0); - }); - - $("#" + id + " [type=\"inline\"]").bind("click", function () { - editorName.cm.replaceSelection("$$$$"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); - editorName.cm.focus(); - }); - $("[type=\"inline\"]").attr("title", "行内公式"); - $("[type=\"latex\"]").attr("title", "多行公式"); - - window.md_elocalStorage(editorName, `exercise__${id}`, "Memochallengesnew"); - - callback && callback() - } - }); - return editorName; + var editorName = window.editormd(id, { + width: width, + height: high, + path: path, // "/editormd/lib/" + + syncScrolling: "single", + tex: true, + tocm: true, + emoji: true, + taskList: true, + codeFold: true, + searchReplace: true, + htmlDecode: "style,script,iframe", + sequenceDiagram: true, + autoFocus: false, + toolbarIcons: function () { + // Or return editormd.toolbarModes[name]; // full, simple, mini + // Using "||" set icons align right. + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] + }, + toolbarCustomIcons: { + testIcon: "
    ", + testIcon1: "
    " + }, + //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 + saveHTMLToTextarea: true, + // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 + dialogMaskOpacity: 0.6, + placeholder: placeholder, + imageUpload: true, + imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], + imageUploadURL: imageUrl,//url + onload: function () { + // this.previewing(); + $("#" + id + " [type=\"latex\"]").bind("click", function () { + editorName.cm.replaceSelection("```latex"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("```"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line - 1, 0); + }); + + $("#" + id + " [type=\"inline\"]").bind("click", function () { + editorName.cm.replaceSelection("$$$$"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); + editorName.cm.focus(); + }); + $("[type=\"inline\"]").attr("title", "行内公式"); + $("[type=\"latex\"]").attr("title", "多行公式"); + + window.md_elocalStorage(editorName, `exercise__${id}`, "Memochallengesnew"); + + callback && callback() + } + }); + return editorName; } export default class TPMevaluation extends Component { - constructor(props) { - super(props) - this.state = { - choice_url: undefined, - practice_url: undefined, - go_back_url: undefined, - task_pass_default: undefined, - submit_url: undefined, - value: 1, - evaluationlist:[], - shixunId:undefined, - power:false, - shixunfilepath:undefined, - evaluationvisible:false, - trees:undefined, - path:"", - main:[], - saveshixunfilepath:undefined, - selectpath:undefined, - shixunfilepathplay:undefined, - shixunfileexpectpicturepath:undefined, - shixunfilestandardpicturepath:undefined, - shixunfilepicturepath:undefined, - pathoptionvalue:-1, - showrepositoryurltiptype: false, - prev_challenge: undefined, - next_challenge: undefined, - StudentTaskPapers:false, - StudentTaskDocs:false, - selectpatharr:[], - handpathopt:false, - scorevalue:false, - markvalue:true, - scoretype:undefined - } - } - - - exerciseMD(initValue, id) { - - this.contentChanged = false; - const placeholder = ""; + constructor(props) { + super(props) + this.state = { + choice_url: undefined, + practice_url: undefined, + go_back_url: undefined, + task_pass_default: undefined, + submit_url: undefined, + value: 1, + evaluationlist:[], + shixunId:undefined, + power:false, + shixunfilepath:undefined, + evaluationvisible:false, + trees:undefined, + path:"", + main:[], + saveshixunfilepath:undefined, + selectpath:undefined, + shixunfilepathplay:undefined, + shixunfileexpectpicturepath:undefined, + shixunfilestandardpicturepath:undefined, + shixunfilepicturepath:undefined, + pathoptionvalue:-1, + showrepositoryurltiptype: false, + prev_challenge: undefined, + next_challenge: undefined, + StudentTaskPapers:false, + StudentTaskDocs:false, + selectpatharr:[], + handpathopt:false, + scorevalue:false, + markvalue:true, + scoretype:undefined + } + } + + + exerciseMD(initValue, id) { + + this.contentChanged = false; + const placeholder = ""; // amp; // 编辑时要传memoId - const imageUrl = `/api/attachments.json`; + const imageUrl = `/api/attachments.json`; // 创建editorMd - const exercise_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => { - setTimeout(() => { - exercise_editormd.resize() - exercise_editormd.cm && exercise_editormd.cm.refresh() - }, 500) - - if (initValue != undefined) { - exercise_editormd.setValue(initValue) - } - exercise_editormd.cm.on("change", (_cm, changeObj) => { - console.log('....contentChanged') - this.contentChanged = true; - }) - }); - this.exercise_editormd = exercise_editormd; - window.exercise_editormd = exercise_editormd; - - } - - componentDidMount() { - let id = this.props.match.params.shixunId; - let checkpointId=this.props.match.params.checkpointId; - this.setState({ - shixunId:id, - checkpointId:checkpointId - }) - let newchoice_url= "/shixuns/"+id+"/challenges/newquestion"; - let newpractice_url= "/shixuns/"+id+"/challenges/new"; - let newgo_back_url="/shixuns/"+id+"/challenges"; - - let url = "/shixuns/" + id + "/challenges/" + checkpointId + "/edit.json?tab=1"; - axios.get(url).then((response) => { - let newprev_challenge = response.data.prev_challenge; - let next_challenge = response.data.next_challenge; - if (newprev_challenge != undefined) { - if(newprev_challenge.st===0){ - newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint"; - }else{ - newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion"; - } - } - if (next_challenge != undefined) { - - if(next_challenge.st===0){ - next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editcheckpoint"; - }else{ - next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editquestion"; - } - } - let newevaluationlist=[] - if(response.data.test_sets.length===0){ - // let newlist=[ - // {hidden:0,input:"",output:"",score:50}, - // {hidden:1,input:"",output:"",score:50} - // ] - let newlist=[ - {input:"",output:"",score:50}, - {input:"",output:"",score:50} - ] - newevaluationlist=newlist - }else{ - newevaluationlist=response.data.test_sets - } - - this.setState({ - power: response.data.power, - evaluationlist:newevaluationlist, - shixunfilepath:response.data.path, - shixunfilepathplay:response.data.exec_path, - pathoptionvalue:response.data.show_type, - shixunfileexpectpicturepath:response.data.original_picture_path, - shixunfilestandardpicturepath:response.data.expect_picture_path, - shixunfilepicturepath:response.data.picture_path, - prev_challenge: newprev_challenge, - next_challenge: next_challenge, - choice_url: newchoice_url, // 导航中的新建选择题url - practice_url: newpractice_url, //string 导航中新建实践题url - go_back_url: newgo_back_url, //string 导航中的返回url - position: response.data.position, //int 关卡位置,导航栏中的第几关 - scorevalue:response.data.test_set_score, - markvalue:response.data.test_set_average, - }) - this.evaluationoninputvalueonload(); - if(response.data.power===false){ - this.props.showSnackbar("你没有权限修改"); - } - if(response.data.answer===undefined){ - this.answerMD("", "answerMD"); - }else{ - this.answerMD(response.data.answer, "answerMD"); - } - - }).catch((error) => { - console.log(error) - }); - - } - - - setevaluationlist=(newevaluationlist)=>{ - this.setState({ - evaluationlist:newevaluationlist - }) - } - - - addevaluationon=()=>{ - let {evaluationlist,markvalue}=this.state; - let newevaluationlist=evaluationlist; - // newevaluationlist.push({hidden:0,input:"",output:"",score:0}); - newevaluationlist.push({input:"",output:"",score:0}); - newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue); - this.setevaluationlist(newevaluationlist); - } - - del_test_array=(key)=>{ - let {evaluationlist,markvalue}=this.state; - let newevaluationlist=evaluationlist; - newevaluationlist.splice(key,1); - newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue); - this.setevaluationlist(newevaluationlist); - } - - getfilepath=(e,shixunfilepath)=>{ - this.setState({ - evaluationvisible: true, - selectpath:e.target.value, - selectpatharr:[], - }); - let id = this.props.match.params.shixunId; - let url ="/shixuns/"+id+"/repository.json"; - axios.post(url,{ - path: "" - }).then((response) => { - if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - - }else{ - this.setState({ - trees:response.data.trees, - saveshixunfilepath:shixunfilepath, - path:"", - main:[], - }) - } - - }).catch((error) => { - console.log(error) - }); - } - - sendgetfilepath=(newpath,type)=>{ - let id = this.props.match.params.shixunId; - let{path,main}=this.state; - let ary=main; - let paths=path; - - this.setState({ - selectpatharr:[], - }) - if(paths===""&&type==="tree"){ - newpath=newpath+"/"; - paths=""; - if(main.length===0){ - ary.push({val:"根目录/",path:""},{val:newpath,path:paths+newpath}) - }else{ - ary.push({val:newpath,path:paths+newpath}) - } - - }else if(paths!=""&&type==="tree"){ - newpath=newpath+"/"; - ary.push({val:newpath,path:paths+newpath}) - } - - - let url ="/shixuns/"+id+"/repository.json"; - if(type==="tree"){ - - axios.post(url,{ - path: paths+newpath - }).then((response) => { - if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - - }else{ - this.setState({ - trees:response.data.trees, - path:paths+newpath, - main:ary, - // selectpath:"" - }) - } - - }).catch((error) => { - console.log(error) - }); - } - - } - - goblakepath=(path,key)=>{ - let {main,selectpath} =this.state; - let newmain=[] - for(var i=0;i<=key;i++){ - newmain.push(main[i]) - } - let id = this.props.match.params.shixunId; - let url ="/shixuns/"+id+"/repository.json"; - axios.post(url,{ - path: path - }).then((response) => { - if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - - }else { - this.setState({ - trees: response.data.trees, - path: path, - main: newmain, - // selectpath:selectpath - }) - } - }).catch((error) => { - console.log(error) - }); - } - // delesavegetfilepath=(value)=>{ - // let {selectpatharr} = this.state - // let newarr =selectpatharr; - // let newselectpath=""; - // for(var i=0; i{ - let {selectpath,saveshixunfilepath} = this.state - // let newarr =selectpatharr; - // let arrtype=false; - // let arrsum=0; - // let newselectpath=""; - // newarr.push(value) - // if(newarr.length>1&&arrtype===false){ - // for(var i=0; i { + setTimeout(() => { + exercise_editormd.resize() + exercise_editormd.cm && exercise_editormd.cm.refresh() + }, 500) + + if (initValue != undefined) { + exercise_editormd.setValue(initValue) + } + exercise_editormd.cm.on("change", (_cm, changeObj) => { + console.log('....contentChanged') + this.contentChanged = true; + }) + }); + this.exercise_editormd = exercise_editormd; + window.exercise_editormd = exercise_editormd; + + } + + componentDidMount() { + let id = this.props.match.params.shixunId; + let checkpointId=this.props.match.params.checkpointId; + this.setState({ + shixunId:id, + checkpointId:checkpointId + }) + let newchoice_url= "/shixuns/"+id+"/challenges/newquestion"; + let newpractice_url= "/shixuns/"+id+"/challenges/new"; + let newgo_back_url="/shixuns/"+id+"/challenges"; + + let url = "/shixuns/" + id + "/challenges/" + checkpointId + "/edit.json?tab=1"; + axios.get(url).then((response) => { + let newprev_challenge = response.data.prev_challenge; + let next_challenge = response.data.next_challenge; + if (newprev_challenge != undefined) { + if(newprev_challenge.st===0){ + newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint"; }else{ - const type = selectpath.split(';'); - let types=false; - for(var i=0; i { + console.log(error) + }); + + } + + + setevaluationlist=(newevaluationlist)=>{ + this.setState({ + evaluationlist:newevaluationlist + }) + } + + + addevaluationon=()=>{ + let {evaluationlist,markvalue}=this.state; + let newevaluationlist=evaluationlist; + newevaluationlist.push({hidden:0,input:"",output:"",score:0}); + newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue); + this.setevaluationlist(newevaluationlist); + } + + del_test_array=(key)=>{ + let {evaluationlist,markvalue}=this.state; + let newevaluationlist=evaluationlist; + newevaluationlist.splice(key,1); + newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue); + this.setevaluationlist(newevaluationlist); + } + + getfilepath=(e,shixunfilepath)=>{ + this.setState({ + evaluationvisible: true, + selectpath:e.target.value, + selectpatharr:[], + }); + let id = this.props.match.params.shixunId; + let url ="/shixuns/"+id+"/repository.json"; + axios.post(url,{ + path: "" + }).then((response) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + + }else{ + this.setState({ + trees:response.data.trees, + saveshixunfilepath:shixunfilepath, + path:"", + main:[], + }) + } + + }).catch((error) => { + console.log(error) + }); + } + + sendgetfilepath=(newpath,type)=>{ + let id = this.props.match.params.shixunId; + let{path,main}=this.state; + let ary=main; + let paths=path; + + this.setState({ + selectpatharr:[], + }) + if(paths===""&&type==="tree"){ + newpath=newpath+"/"; + paths=""; + if(main.length===0){ + ary.push({val:"根目录/",path:""},{val:newpath,path:paths+newpath}) + }else{ + ary.push({val:newpath,path:paths+newpath}) + } + + }else if(paths!=""&&type==="tree"){ + newpath=newpath+"/"; + ary.push({val:newpath,path:paths+newpath}) + } + + + let url ="/shixuns/"+id+"/repository.json"; + if(type==="tree"){ + + axios.post(url,{ + path: paths+newpath + }).then((response) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - if(types===false){ - newselectpath=selectpath+value+ ";" + }else{ + this.setState({ + trees:response.data.trees, + path:paths+newpath, + main:ary, + // selectpath:"" + }) + } + + }).catch((error) => { + console.log(error) + }); + } + + } + + goblakepath=(path,key)=>{ + let {main,selectpath} =this.state; + let newmain=[] + for(var i=0;i<=key;i++){ + newmain.push(main[i]) + } + let id = this.props.match.params.shixunId; + let url ="/shixuns/"+id+"/repository.json"; + axios.post(url,{ + path: path + }).then((response) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + + }else { + this.setState({ + trees: response.data.trees, + path: path, + main: newmain, + // selectpath:selectpath + }) + } + }).catch((error) => { + console.log(error) + }); + } + // delesavegetfilepath=(value)=>{ + // let {selectpatharr} = this.state + // let newarr =selectpatharr; + // let newselectpath=""; + // for(var i=0; i{ + let {selectpath,saveshixunfilepath} = this.state + // let newarr =selectpatharr; + // let arrtype=false; + // let arrsum=0; + // let newselectpath=""; + // newarr.push(value) + // if(newarr.length>1&&arrtype===false){ + // for(var i=0; i{ + let {saveshixunfilepath,selectpath}=this.state; + this.setState({ + evaluationvisible: false, + [saveshixunfilepath]:selectpath + }); + } + evaluationhideModal=()=>{ + this.setState({ + evaluationvisible: false, + }); + } + handpathoptionvalue=(value)=>{ + this.setState({ + pathoptionvalue:value + }) + } + showrepositoryurltip=(type)=>{ + if(type===1){ + this.setState({ + showrepositoryurltiptype:true + }) + }else{ + this.setState({ + showrepositoryurltiptype:false + }) + } + } + + evaluationonChange=(e,key)=>{ + let {evaluationlist}=this.state; + let newevaluationlist=evaluationlist; + let newtype; + if(e===1){ + newtype=0; + }else{ + newtype=1; + } + // newevaluationlist[key].is_public=newtype; + // for(var i=0; i{ + let {evaluationlist,scoretype}=this.state; + + if(scoretype===key){ + this.setState({ + scoretype:undefined + }) + } + let newevaluationlist=evaluationlist; + let sum =parseInt(e.target.value); + if(isNaN(sum)){ + sum=0 + } + newevaluationlist[key].score=sum; + + this.setState({ + evaluationlist:newevaluationlist, + markvalue:false + }) + this.setevaluationlist(newevaluationlist); + } + + evaluationoninputvalue=(e,key,type)=>{ + $.fn.autoHeight = function(){ + function autoHeight(elem){ + elem.style.height = 'auto'; + elem.style.maxHeight = '140px'; + elem.scrollTop = 0; //防抖动 + elem.style.height = elem.scrollHeight + 'px'; + } + this.each(function(){ + autoHeight(this); + $(this).on('keyup', function(){ + autoHeight(this); + }); + }); + } + $('textarea[autoHeight]').autoHeight(); + + let {evaluationlist}=this.state; + let newevaluationlist=evaluationlist; + if(type==="sr"){ + newevaluationlist[key].input=e.target.value + }else if(type==="yq"){ + newevaluationlist[key].output=e.target.value + } + this.setevaluationlist(newevaluationlist); + } + + + evaluationoninputvalueonload=()=>{ + $.fn.autoHeight = function(){ + function autoHeight(elem){ + elem.style.height = 'auto'; + elem.style.maxHeight = '140px'; + elem.scrollTop = 0; //防抖动 + elem.style.height = elem.scrollHeight + 'px'; + } + this.each(function(){ + autoHeight(this); + $(this).on('keyup', function(){ + autoHeight(this); + }); + }); + } + $('textarea[autoHeight]').autoHeight(); + } + submitarbitrationevaluation=()=>{ + let{evaluationlist,shixunfilepath,shixunfilepathplay,shixunfileexpectpicturepath,shixunfilestandardpicturepath,shixunfilepicturepath,pathoptionvalue,scorevalue,markvalue}=this.state; + + + let newscorevalue; + if(scorevalue===false){ + newscorevalue=false + }else{ + //判断占比 + newscorevalue=true + + let sum=0; + for(var i=0; i100){ + this.props.showSnackbar("测试集的评分占比不能大于100"); + this.setState({ + scoretype:i + }) + return + } + sum=sum+evaluationlist[i].score + } + + if(sum>100||sum<100){ + this.props.showSnackbar("测试集的评分占比之和必须等于100"); + return + } + + + } + if(shixunfilepath===undefined||shixunfilepath===""||shixunfilepath===null){ + this.props.showSnackbar("学员任务文件路径为空"); + this.setState({ + StudentTaskPapers:true + }) + $('html').animate({ + scrollTop: 120 + }, 1000); + return + } + + if(shixunfilepathplay===undefined||shixunfilepathplay===""||shixunfilepathplay===null){ + this.props.showSnackbar("评测执行文件路径为空"); + this.setState({ + StudentTaskDocs:true + }) + $('html').animate({ + scrollTop: 130 + }, 1000); + return + } + + if(evaluationlist.length===0){ + this.props.showSnackbar("测试集不能为空"); + return + } + let id = this.props.match.params.shixunId; + let{checkpointId}=this.state; + let url = "/shixuns/"+id+"/challenges/"+checkpointId+".json"; + axios.put(url,{ + tab:1, + challenge:{ + path:shixunfilepath, + exec_path:shixunfilepathplay, + show_type:pathoptionvalue, + original_picture_path:shixunfileexpectpicturepath, + expect_picture_path:shixunfilestandardpicturepath, + picture_path:shixunfilepicturepath, + test_set_score:newscorevalue, + test_set_average:markvalue + }, + test_set:evaluationlist + } + ).then((response) => { + this.props.showSnackbar(response.data.messages); + // if(response.data.status===1){ + // window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=3" + // } + }).catch((error) => { + console.log(error) + }); + } + handpathoptionvalues=()=>{ + this.setState({ + handpathopt:true + }) + } + handpathoptionvaluess=()=>{ + this.setState({ + handpathopt:false + }) + } + saveselectpath=(e)=>{ + + this.setState({ + selectpath:e.target.value + }) + } + updatepath=(e,name)=>{ + this.setState({ + [name]:e.target.value + }) + } + + + oneditevaluationlist=(newevaluationlist,markvalue)=>{ + + if(markvalue===true){ + if(100%newevaluationlist.length===0){ + let sum=100/newevaluationlist.length; + for(var i=0; i{ - let {saveshixunfilepath,selectpath}=this.state; - this.setState({ - evaluationvisible: false, - [saveshixunfilepath]:selectpath - }); - } - evaluationhideModal=()=>{ - this.setState({ - evaluationvisible: false, - }); - } - handpathoptionvalue=(value)=>{ - this.setState({ - pathoptionvalue:value - }) - } - showrepositoryurltip=(type)=>{ - if(type===1){ - this.setState({ - showrepositoryurltiptype:true - }) - }else{ - this.setState({ - showrepositoryurltiptype:false - }) - } - } - - evaluationonChange=(e,key)=>{ - let {evaluationlist}=this.state; - let newevaluationlist=evaluationlist; - let newtype; - if(e===1){ - newtype=0; - }else{ - newtype=1; - } - // newevaluationlist[key].is_public=newtype; - // for(var i=0; i{ - let {evaluationlist,scoretype}=this.state; - - if(scoretype===key){ - this.setState({ - scoretype:undefined - }) - } - let newevaluationlist=evaluationlist; - let sum =parseInt(e.target.value); - if(isNaN(sum)){ - sum=0 - } - newevaluationlist[key].score=sum; - - this.setState({ - evaluationlist:newevaluationlist, - markvalue:false - }) - this.setevaluationlist(newevaluationlist); - } - - evaluationoninputvalue=(e,key,type)=>{ - $.fn.autoHeight = function(){ - function autoHeight(elem){ - elem.style.height = 'auto'; - elem.style.maxHeight = '140px'; - elem.scrollTop = 0; //防抖动 - elem.style.height = elem.scrollHeight + 'px'; - } - this.each(function(){ - autoHeight(this); - $(this).on('keyup', function(){ - autoHeight(this); - }); - }); - } - $('textarea[autoHeight]').autoHeight(); - - let {evaluationlist}=this.state; - let newevaluationlist=evaluationlist; - if(type==="sr"){ - newevaluationlist[key].input=e.target.value - }else if(type==="yq"){ - newevaluationlist[key].output=e.target.value - } - this.setevaluationlist(newevaluationlist); - } - - - evaluationoninputvalueonload=()=>{ - $.fn.autoHeight = function(){ - function autoHeight(elem){ - elem.style.height = 'auto'; - elem.style.maxHeight = '140px'; - elem.scrollTop = 0; //防抖动 - elem.style.height = elem.scrollHeight + 'px'; - } - this.each(function(){ - autoHeight(this); - $(this).on('keyup', function(){ - autoHeight(this); - }); - }); - } - $('textarea[autoHeight]').autoHeight(); - } - submitarbitrationevaluation=()=>{ - let{evaluationlist,shixunfilepath,shixunfilepathplay,shixunfileexpectpicturepath,shixunfilestandardpicturepath,shixunfilepicturepath,pathoptionvalue,scorevalue,markvalue}=this.state; - - - let newscorevalue; - if(scorevalue===false){ - newscorevalue=false - }else{ - //判断占比 - newscorevalue=true - - let sum=0; - for(var i=0; i100){ - this.props.showSnackbar("测试集的评分占比不能大于100"); - this.setState({ - scoretype:i - }) - return - } - sum=sum+evaluationlist[i].score - } - - if(sum>100||sum<100){ - this.props.showSnackbar("测试集的评分占比之和必须等于100"); - return - } - - - } - if(shixunfilepath===undefined||shixunfilepath===""||shixunfilepath===null){ - this.props.showSnackbar("学员任务文件路径为空"); - this.setState({ - StudentTaskPapers:true - }) - $('html').animate({ - scrollTop: 120 - }, 1000); - return - } - - if(shixunfilepathplay===undefined||shixunfilepathplay===""||shixunfilepathplay===null){ - this.props.showSnackbar("评测执行文件路径为空"); - this.setState({ - StudentTaskDocs:true - }) - $('html').animate({ - scrollTop: 130 - }, 1000); - return - } - - if(evaluationlist.length===0){ - this.props.showSnackbar("测试集不能为空"); - return - } - let id = this.props.match.params.shixunId; - let{checkpointId}=this.state; - let url = "/shixuns/"+id+"/challenges/"+checkpointId+".json"; - axios.put(url,{ - tab:1, - challenge:{ - path:shixunfilepath, - exec_path:shixunfilepathplay, - show_type:pathoptionvalue, - original_picture_path:shixunfileexpectpicturepath, - expect_picture_path:shixunfilestandardpicturepath, - picture_path:shixunfilepicturepath, - test_set_score:newscorevalue, - test_set_average:markvalue - }, - test_set:evaluationlist - } - ).then((response) => { - this.props.showSnackbar(response.data.messages); - // if(response.data.status===1){ - // window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=3" - // } - }).catch((error) => { - console.log(error) - }); - } - handpathoptionvalues=()=>{ - this.setState({ - handpathopt:true - }) - } - handpathoptionvaluess=()=>{ - this.setState({ - handpathopt:false - }) - } - saveselectpath=(e)=>{ - - this.setState({ - selectpath:e.target.value - }) - } - updatepath=(e,name)=>{ - this.setState({ - [name]:e.target.value - }) - } - - - oneditevaluationlist=(newevaluationlist,markvalue)=>{ - - if(markvalue===true){ - if(100%newevaluationlist.length===0){ - let sum=100/newevaluationlist.length; - for(var i=0; i{ - - let {markvalue,evaluationlist}=this.state; - let newevaluationlist=evaluationlist; - - if(e.target.value===true){ - newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue) - } - - this.setState({ - scorevalue: e.target.value, - evaluationlist:newevaluationlist - }); - - this.setevaluationlist(newevaluationlist); - } - - //均匀比例 - onChangemarkvalue=(e)=>{ - let {evaluationlist}=this.state; - - if(e.target.value===true){ - let newevaluationlist=evaluationlist; - newevaluationlist=this.oneditevaluationlist(newevaluationlist,e.target.value); - this.setevaluationlist(newevaluationlist); - } - - this.setState({ - markvalue: e.target.value, - }); - - } - render() { - - let { - choice_url, - practice_url, - go_back_url, - position, - evaluationlist, - shixunId, - checkpointId, - power, - shixunfileexpectpicturepath, - shixunfilestandardpicturepath, - shixunfilepicturepath, - shixunfilepath, - evaluationvisible, - trees, - path, - main, - selectpath, - shixunfilepathplay, - pathoptionvalue, - showrepositoryurltiptype, - prev_challenge, - next_challenge, - StudentTaskPapers, - StudentTaskDocs, - handpathopt, - scorevalue, - markvalue, - scoretype - } = this.state; - - let tab1url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/editcheckpoint"; - let tab2url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=2"; - let tab3url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=3"; - // console.log(this.props) - const radioStyle = { - display: 'block', - height: '30px', - lineHeight: '30px', - marginLeft: '20px', - }; - return ( - -
    -
    + } + + } + + return newevaluationlist + } + //选择得分规范 + onChangeRadioGroups=(e)=>{ + + let {markvalue,evaluationlist}=this.state; + let newevaluationlist=evaluationlist; + + if(e.target.value===true){ + newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue) + } + + this.setState({ + scorevalue: e.target.value, + evaluationlist:newevaluationlist + }); + + this.setevaluationlist(newevaluationlist); + } + + //均匀比例 + onChangemarkvalue=(e)=>{ + let {evaluationlist}=this.state; + + if(e.target.value===true){ + let newevaluationlist=evaluationlist; + newevaluationlist=this.oneditevaluationlist(newevaluationlist,e.target.value); + this.setevaluationlist(newevaluationlist); + } + + this.setState({ + markvalue: e.target.value, + }); + + } + render() { + + let { + choice_url, + practice_url, + go_back_url, + position, + evaluationlist, + shixunId, + checkpointId, + power, + shixunfileexpectpicturepath, + shixunfilestandardpicturepath, + shixunfilepicturepath, + shixunfilepath, + evaluationvisible, + trees, + path, + main, + selectpath, + shixunfilepathplay, + pathoptionvalue, + showrepositoryurltiptype, + prev_challenge, + next_challenge, + StudentTaskPapers, + StudentTaskDocs, + handpathopt, + scorevalue, + markvalue, + scoretype + } = this.state; + + let tab1url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/editcheckpoint"; + let tab2url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=2"; + let tab3url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=3"; + // console.log(this.props) + const radioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + marginLeft: '20px', + }; + return ( + +
    +
    - 第{position}关 - 返回 - - {prev_challenge === undefined ? "" : - 上一关 - } - - {next_challenge === undefined ? "" : - 下一关 - } - - 4||this.props.identity===undefined||this.props.status===2||this.props.status===1? "none":'block'}} - data-tip-down="新增代码编辑类型的任务">+ 实践类型 - 4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} - data-tip-down="新增选择题类型的任务">+ 选择题类型 - -
    - -
    - -
  • - 本关任务 -
  • - -
  • - 评测设置 -
  • - -
  • - 参考答案 -
  • -
    - -

    - 请先上传本关任务的所有代码文件、标准图片等所有必要的文件到 - 版本库 -

    - - -
    -
    -

    学员任务文件

    -
    - * -
    - this.updatepath(e,"shixunfilepath")} - onClick={(e)=>this.getfilepath(e,"shixunfilepath")} - /> -

    该文件将直接显示给学生,需要学生在其中填写代码

    -
    -
    + 第{position}关 + 返回 + + {prev_challenge === undefined ? "" : + 上一关 + } + + {next_challenge === undefined ? "" : + 下一关 + } + + 4||this.props.identity===undefined||this.props.status===2||this.props.status===1? "none":'block'}} + data-tip-down="新增代码编辑类型的任务">+ 实践类型 + 4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} + data-tip-down="新增选择题类型的任务">+ 选择题类型 + +
    + +
    + +
  • + 本关任务 +
  • + +
  • + 评测设置 +
  • + +
  • + 参考答案 +
  • +
    + +

    + 请先上传本关任务的所有代码文件、标准图片等所有必要的文件到 + 版本库 +

    + + +
    +
    +

    学员任务文件

    +
    + * +
    + this.updatepath(e,"shixunfilepath")} + onClick={(e)=>this.getfilepath(e,"shixunfilepath")} + /> +

    该文件将直接显示给学生,需要学生在其中填写代码

    +
    +
    必填项 -
    -
    -
    -
    - -
    -
    - -
    - - this.saveselectpath(e)} - value={selectpath}/> -
    - - this.evaluationenter()}>确定 - this.evaluationhideModal()}>取消 -
    -
    -
    - -
    -
    -

    评测执行文件

    -
    - * -
    - this.updatepath(e,"shixunfilepathplay")} - onClick={(e)=>this.getfilepath(e,"shixunfilepathplay")} - /> -

    该文件由平台执行,用来测试平台学员代码是否正确

    -
    -
    + className="fa fa-exclamation-circle mr3">必填项 +
    +
    +
    +
    + +
    +
    + +
    + + this.saveselectpath(e)} + value={selectpath}/> +
    + + this.evaluationenter()}>确定 + this.evaluationhideModal()}>取消 +
    +
    +
    + +
    +
    +

    评测执行文件

    +
    + * +
    + this.updatepath(e,"shixunfilepathplay")} + onClick={(e)=>this.getfilepath(e,"shixunfilepathplay")} + /> +

    该文件由平台执行,用来测试平台学员代码是否正确

    +
    +
    必填项 -
    -
    -
    -
    - - -
    -
    -

    效果展现方式

    -
    - - this.showrepositoryurltip(1)}> -
    - -
    -

    - 图片:处理或输出图片类型的任务,请选填此项
    - 可以通过设置图片路径和学员答案文件路径,展示代码对应的图片效果

    - apk/exe:写可执行文件的任务,请选填此项
    - 可以通过设置学员答案文件路径,展示二维码以供扫码下载

    - txt:输出txt文档类型的任务,请选填此项
    - 可以通过学员答案文件路径设置,展示txt文件内容

    - html:web类型的任务,请选填此项
    - 可以通过Web路由设置,展示html效果预览页 -

    -

    this.showrepositoryurltip(2)} - >知道了 -

    -
    -
    -

    该选项用来配置学员评测本关任务时,查看效果页上需要展现的文件类型

    -
    -
    - - - {pathoptionvalue===1?
    -
    -

    待处理图片路径

    -
    -
    - this.updatepath(e,"shixunfileexpectpicturepath")} - onClick={(e)=>this.getfilepath(e,"shixunfileexpectpicturepath")} - /> -

    - 该路径下的文件将在学员评测本关任务时,作为原始图片显示在查看效果页,供学员参考,任务为图片处理时请指定该路径,并注意与程序文件所在文件夹分开 -

    -
    -
    -
    -
    -
    :""} - - - {pathoptionvalue===1?
    -
    -

    标准答案图片路径

    -
    -
    - this.updatepath(e,"shixunfilestandardpicturepath")} - onClick={(e)=>this.getfilepath(e,"shixunfilestandardpicturepath")} - /> -

    - 该路径下的文件将在学员评测本关任务时,作为参考答案显示在查看效果页,供学员参考任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 -

    -
    -
    -
    -
    -
    :""} - - - {pathoptionvalue===-1?"":
    -
    -

    学员答案文件路径

    -
    -
    - this.updatepath(e,"shixunfilepicturepath")} - onClick={(e)=>this.getfilepath(e,"shixunfilepicturepath")} - placeholder="请在版本库中指定用来保存学员代码实际输出结果的路径。例:src/step1/outputimages"/> -

    - 学员评测本关任务时生成的文件将保存在该路径下,并作为实际输出显示在查看效果页,供学员确认任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 -

    -
    -
    -
    -
    -
    } - - -
    -
    - {/*

    测试集

    */} -

    测试集和系统评分规则

    -

    - 得分规范: - - - 通过全部测试集 - (学员评测,仅当所有测试集都正确时,才获得一次性奖励) - - - 通过部分测试集 - (学员评测,当至少有一组测试集正确时,即可获得其对应比例的奖励) - -

    - -

    + className="fa fa-exclamation-circle mr3">必填项 +

    +
    +
    +
    + + +
    +
    +

    效果展现方式

    +
    + + this.showrepositoryurltip(1)}> +
    + +
    +

    + 图片:处理或输出图片类型的任务,请选填此项
    + 可以通过设置图片路径和学员答案文件路径,展示代码对应的图片效果

    + apk/exe:写可执行文件的任务,请选填此项
    + 可以通过设置学员答案文件路径,展示二维码以供扫码下载

    + txt:输出txt文档类型的任务,请选填此项
    + 可以通过学员答案文件路径设置,展示txt文件内容

    + html:web类型的任务,请选填此项
    + 可以通过Web路由设置,展示html效果预览页 +

    +

    this.showrepositoryurltip(2)} + >知道了 +

    +
    +
    +

    该选项用来配置学员评测本关任务时,查看效果页上需要展现的文件类型

    +
    +
    + + + {pathoptionvalue===1?
    +
    +

    待处理图片路径

    +
    +
    + this.updatepath(e,"shixunfileexpectpicturepath")} + onClick={(e)=>this.getfilepath(e,"shixunfileexpectpicturepath")} + /> +

    + 该路径下的文件将在学员评测本关任务时,作为原始图片显示在查看效果页,供学员参考,任务为图片处理时请指定该路径,并注意与程序文件所在文件夹分开 +

    +
    +
    +
    +
    +
    :""} + + + {pathoptionvalue===1?
    +
    +

    标准答案图片路径

    +
    +
    + this.updatepath(e,"shixunfilestandardpicturepath")} + onClick={(e)=>this.getfilepath(e,"shixunfilestandardpicturepath")} + /> +

    + 该路径下的文件将在学员评测本关任务时,作为参考答案显示在查看效果页,供学员参考任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 +

    +
    +
    +
    +
    +
    :""} + + + {pathoptionvalue===-1?"":
    +
    +

    学员答案文件路径

    +
    +
    + this.updatepath(e,"shixunfilepicturepath")} + onClick={(e)=>this.getfilepath(e,"shixunfilepicturepath")} + placeholder="请在版本库中指定用来保存学员代码实际输出结果的路径。例:src/step1/outputimages"/> +

    + 学员评测本关任务时生成的文件将保存在该路径下,并作为实际输出显示在查看效果页,供学员确认任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 +

    +
    +
    +
    +
    +
    } + + +
    +
    + {/*

    测试集

    */} +

    测试集和系统评分规则

    +

    + 得分规范: + + + 通过全部测试集 + (学员评测,仅当所有测试集都正确时,才获得一次性奖励) + + + 通过部分测试集 + (学员评测,当至少有一组测试集正确时,即可获得其对应比例的奖励) + +

    + +

    系统评分占比: + value={markvalue} + onChange={this.onChangemarkvalue} + > 均分比例 自定义比例 -

    +

    -
    -
    +
    +
    -
    +
    - {evaluationlist===undefined?"":evaluationlist.length===0?"":evaluationlist.map((item,key)=>{ - return( -
    -

    - * - 组{key+1} - + {evaluationlist===undefined?"":evaluationlist.length===0?"":evaluationlist.map((item,key)=>{ + return( +

    +

    + * + 组{key+1} + {/*checked={item.is_public===1?false:true}*/} - this.editpercentage(e,key)} - value={item.score} /> + this.editpercentage(e,key)} + value={item.score} /> % + style={{display:scorevalue===true?'inline-block':'none'}} + >% - {/*this.evaluationonChange(item.hidden,key)} checked={item.hidden===1?true:false}>隐藏*/} + this.evaluationonChange(item.hidden,key)} checked={item.hidden===1?true:false}>隐藏 - - this.del_test_array(key)}> - - - -

    - - -
    - ) - })} - -
    -
    - -

    - - 新增测试集 - -

    -

    温馨提示:建议公开测试集和隐藏测试集结合使用,降低作弊的几率;隐藏测试集,在“提交评测”时也将被自动检测

    -
    -
    -
    - - -
    4||this.props.identity===undefined||power===false?"none":"block"}}> - 提交 - 取消 -
    - - -
    - - ) - } + + this.del_test_array(key)}> + + + +

    + + +
    + ) + })} + +
    +
    + +

    + + 新增测试集 + +

    +

    温馨提示:建议公开测试集和隐藏测试集结合使用,降低作弊的几率;隐藏测试集,在“提交评测”时也将被自动检测

    +
    +
    +
    + + +
    4||this.props.identity===undefined||power===false?"none":"block"}}> + 提交 + 取消 +
    + + +
    +
    + ) + } } diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 50c5af396..4006fb615 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -173,7 +173,9 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px} #log_reg_content{border-radius: 5px;background: #FFFFff;width: 100%;text-align: center;position: absolute;top: 165px; left: 0px;padding: 40px 30px;box-sizing: border-box} .log_nav{border-bottom:1px solid #eaeaea;} -.log_nav li{float: left;text-align: center;font-size: 16px;padding-bottom:15px;margin: 0px 20px;cursor: pointer;} +.log_nav li{float: left;text-align: center;font-size: 16px;padding-bottom:15px; + /*margin: 0px 20px;*/ + cursor: pointer;} .log_nav li.active{border-bottom: 2px solid #459be5;} .log-botton{width: 100%;text-align: center;color: #FFFFff!important;display: block;background: #cbcbcb;height: 45px;line-height: 45px;border-radius: 4px;letter-spacing: 2px;cursor: pointer} .log-botton:hover{color: #FFFFff!important;} From 1017a23d8fc907b90b468ec4ac4120fbab712980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 24 Jul 2019 17:36:54 +0800 Subject: [PATCH 15/19] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/login/Trialapplication.js | 2 +- public/react/src/modules/login/Trialapplicationysl.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index 313d5bce3..b64bb24b7 100644 --- a/public/react/src/modules/login/Trialapplication.js +++ b/public/react/src/modules/login/Trialapplication.js @@ -376,7 +376,7 @@ class Trialapplication extends Component { // console.log(this.props); return ( -
    +
    { isRenders === false ? "" : diff --git a/public/react/src/modules/login/Trialapplicationysl.js b/public/react/src/modules/login/Trialapplicationysl.js index dc9755fbe..ee4d6a9f9 100644 --- a/public/react/src/modules/login/Trialapplicationysl.js +++ b/public/react/src/modules/login/Trialapplicationysl.js @@ -394,7 +394,7 @@ class Trialapplicationysl extends Component { // console.log(this.props); return ( -
    +
    { isRenders === false ? "" : From 7a65ebaf7632d0851f75f357adf55d592f10f078 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 24 Jul 2019 17:54:14 +0800 Subject: [PATCH 16/19] =?UTF-8?q?=E9=99=84=E4=BB=B6=E7=9A=84=E6=9D=83?= =?UTF-8?q?=E9=99=90=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 33 ++++++++++++++++++++++- app/models/user.rb | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 014262aea..8eb7ffebc 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -2,7 +2,7 @@ # # 文件上传 class AttachmentsController < ApplicationController - before_action :require_login, :check_auth + before_action :require_login, :check_auth, except: [:show] before_action :find_file, only: %i[show destroy] include ApplicationHelper @@ -10,6 +10,8 @@ class AttachmentsController < ApplicationController def show # 1. 优先跳到cdn # 2. 如果没有cdn,send_file + candown = attachment_candown @file + tip_exception("您没有权限下载该附件") if !candown if @file.cloud_url.present? update_downloads(@file) redirect_to @file.cloud_url and return @@ -157,4 +159,33 @@ class AttachmentsController < ApplicationController end edu_setting('public_cdn_host') + "/" + path end + + def attachment_candown attachment + return true if current_user.admin? || current_user.business? + candown = false + if attachment.container && current_user.logged? + # 课堂资源、作业、毕设相关资源的权限判断 + if attachment.container.is_a?(Course) + course = attachment.container + candown = current_user.member_of_course?(course) || attachment.is_public == 1 + elsif attachment.container.is_a?(HomeworkCommon) || attachment.container.is_a?(GraduationTask) || attachment.container.is_a?(GraduationTopic) + course = attachment.container&.course + elsif attachment.container.is_a?(StudentWork) + course = attachment.container&.homework_common&.course + elsif attachment.container.is_a?(StudentWorksScore) + course = attachment.container&.student_work&.homework_common&.course + elsif attachment.container.is_a?(GraduationWork) + course = attachment.container&.graduation_task&.course + elsif attachment.container.is_a?(GraduationWorkScore) + course = attachment.container&.graduation_work&.graduation_task&.course + else + candown = true + end + + candown = !candown && course.present? ? current_user.member_of_course?(course) : candown + else + candown = true + end + candown + end end diff --git a/app/models/user.rb b/app/models/user.rb index 03c97b9f3..34576db66 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -250,7 +250,7 @@ class User < ApplicationRecord # 课堂成员 def member_of_course?(course) - course.course_members.exists?(user_id: id) + course&.course_members.exists?(user_id: id) end # 实训路径管理员:创建者或admin From 91bcb7bba46f7fb40981400102a04afed502814c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 24 Jul 2019 17:54:38 +0800 Subject: [PATCH 17/19] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cc1fc167e..c80ca2348 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -232,6 +232,14 @@ class ApplicationController < ActionController::Base User.current = User.find 12 end + if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除 + User.current = User.find 81403 + elsif params[:debug] == 'student' + User.current = User.find 8686 + elsif params[:debug] == 'admin' + User.current = User.find 1 + end + # User.current = User.find 81403 end From ab1039df4963e724248c773097f47f082bfb8083 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 24 Jul 2019 18:02:44 +0800 Subject: [PATCH 18/19] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=95=99=E5=B8=88?= =?UTF-8?q?=E5=92=8C=E5=8A=A9=E6=95=99=E7=9A=84=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index bb0737128..f5830adff 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -29,10 +29,10 @@ class CoursesController < ApplicationController :transfer_to_course_group, :delete_from_course, :search_users, :add_students_by_search, :get_historical_courses, :add_teacher_popup, :add_teacher] before_action :admin_allowed, only: [:set_invite_code_halt, :set_public_or_private, :change_course_admin, - :set_course_group, :delete_course_teacher, :create_group_by_importing_file] + :set_course_group, :create_group_by_importing_file] before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group, :change_course_teacher, :export_member_scores_excel, :course_group_list, - :teacher_application_review, :apply_teachers] + :teacher_application_review, :apply_teachers, :delete_course_teacher] before_action :validate_course_name, only: [:create, :update] before_action :find_board, only: :board_list before_action :validate_page_size, only: :mine From 4b388e090b74a950e4dfb5be88fb29ba1d4d90e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 24 Jul 2019 18:02:59 +0800 Subject: [PATCH 19/19] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/user/Interestpage.js | 2 ++ public/react/src/modules/user/InterestpageMax.js | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/user/Interestpage.js b/public/react/src/modules/user/Interestpage.js index dbca5a242..1054d620e 100644 --- a/public/react/src/modules/user/Interestpage.js +++ b/public/react/src/modules/user/Interestpage.js @@ -192,6 +192,8 @@ class InterestpageComponent extends Component { ints.push(this.state.gouxuans4[i].id); } } + console.log("195195"); + console.log(ints); if(ints.length<1){ this.openNotification("请至少选择一个您感兴趣的内容"); return diff --git a/public/react/src/modules/user/InterestpageMax.js b/public/react/src/modules/user/InterestpageMax.js index e0585ed33..6dc182154 100644 --- a/public/react/src/modules/user/InterestpageMax.js +++ b/public/react/src/modules/user/InterestpageMax.js @@ -182,10 +182,6 @@ class InterestpageMax extends Component { //兴趣页面点击 Interestcompletionpage(){ - - this.setState({ - setpagecomplet:true - }) if(this.state.gouxuans.length === 0){ this.openNotification("请选择职业"); return @@ -197,6 +193,8 @@ class InterestpageMax extends Component { ints.push(this.state.gouxuans4[i].id); } } + console.log("200200"); + console.log(ints); if(ints.length<1){ this.openNotification("请至少选择一个您感兴趣的内容"); return @@ -302,7 +300,7 @@ class InterestpageMax extends Component { ) })}
    - +