diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index dad5993e9..55569e072 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -52,7 +52,7 @@ export function initAxiosInterceptors(props) { //proxy="http://47.96.87.25:48080" proxy="https://pre-newweb.educoder.net" proxy="https://test-newweb.educoder.net" - //proxy="http://192.168.2.63:3001" + proxy="https://test-jupyterweb.educoder.net" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index d025443cf..f405aece6 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -1,16 +1,16 @@ -import React, { Component } from 'react'; +import React, {Component} from 'react'; -import { Redirect } from 'react-router'; +import {Redirect} from 'react-router'; import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; import PropTypes from 'prop-types'; -import { Rating ,Progress} from "@icedesign/base"; +import {Rating, Progress} from "@icedesign/base"; -import {Modal,Input,Radio,Pagination,message,Spin,Icon,Tooltip,Rate} from 'antd'; +import {Modal, Input, Radio, Pagination, message, Spin, Icon, Tooltip, Rate} from 'antd'; -import AccountProfile from"../user/AccountProfile"; +import AccountProfile from "../user/AccountProfile"; import 'antd/lib/pagination/style/index.css'; @@ -27,516 +27,599 @@ const Search = Input.Search; const RadioGroup = Radio.Group; class TPMBanner extends Component { - constructor(props) { - super(props) - this.state={ - Forkvisible: false, - Senttothetype:false, - Senttothevcalue:undefined, - courses_count:1, - course_list:[], - pagenum:1, - publishbox:"", - publishboxstatus:0, - pages:1, - Issuevisible:false, - evaluation_set_position:[], - tag_position:[], - Forkauthentication:false, - can_fork:undefined, - certi_url:undefined, - showradios:false, - startbtn:false, - Searchvalue:"", - startshixunCombattype:false, - shixunsmessage:"", - shixunsreplace:false, - hidestartshixunsreplacevalue:"", - isIE:false, - Forkvisibletype: false, - isSpin:false, - Senttothevcaluetype:false, - jupyterbool:false, - } - } - - // star_info:[0, 0, 0, 0, 0, 0], - // star_infos:[0, 0, 0, 0, 0, 0], - // shixunsDetails:{}, - // shixunId: undefined, - // componentWillReceiveProps(newProps, newContext){ - // this.setState({ - // shixunsDetails: newProps.shixunsDetails - // }); - // } - - IEVersion=()=>{ - var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 - var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器 - var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 - var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1; - if(isIE) { - var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); - reIE.test(userAgent); - var fIEVersion = parseFloat(RegExp["$1"]); - if(fIEVersion == 7) { - return 7; - } else if(fIEVersion == 8) { - return 8; - } else if(fIEVersion == 9) { - return 9; - } else if(fIEVersion == 10) { - return 10; - } else { - return 6;//IE版本<=7 - } - } else if(isEdge) { - return 'edge';//edge - } else if(isIE11) { - return 11; //IE11 - }else{ - return -1;//不是ie浏览器 - } + constructor(props) { + super(props) + this.state = { + Forkvisible: false, + Senttothetype: false, + Senttothevcalue: undefined, + courses_count: 1, + course_list: [], + pagenum: 1, + publishbox: "", + publishboxstatus: 0, + pages: 1, + Issuevisible: false, + evaluation_set_position: [], + tag_position: [], + Forkauthentication: false, + can_fork: undefined, + certi_url: undefined, + showradios: false, + startbtn: false, + Searchvalue: "", + startshixunCombattype: false, + shixunsmessage: "", + shixunsreplace: false, + hidestartshixunsreplacevalue: "", + isIE: false, + Forkvisibletype: false, + isSpin: false, + Senttothevcaluetype: false, + jupyterbool: false, } - componentDidMount() { - let thiisie=this.IEVersion(); - if(thiisie!=-1){ - this.setState({ - isIE:true - }) - }else{ - this.setState({ - isIE:false - }) + } + + // star_info:[0, 0, 0, 0, 0, 0], + // star_infos:[0, 0, 0, 0, 0, 0], + // shixunsDetails:{}, + // shixunId: undefined, + // componentWillReceiveProps(newProps, newContext){ + // this.setState({ + // shixunsDetails: newProps.shixunsDetails + // }); + // } + + IEVersion = () => { + var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 + var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器 + var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 + var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1; + if (isIE) { + var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); + reIE.test(userAgent); + var fIEVersion = parseFloat(RegExp["$1"]); + if (fIEVersion == 7) { + return 7; + } else if (fIEVersion == 8) { + return 8; + } else if (fIEVersion == 9) { + return 9; + } else if (fIEVersion == 10) { + return 10; + } else { + return 6;//IE版本<=7 } + } else if (isEdge) { + return 'edge';//edge + } else if (isIE11) { + return 11; //IE11 + } else { + return -1;//不是ie浏览器 } - /* - * Fork - * */ - copyForkvisible = () => { - let {shixunsDetails} = this.props; - if (shixunsDetails.can_fork === null) { - this.setState({ - Forkvisible: true - }) - } else { - this.setState({ - Forkvisible: false, - Forkauthentication: true, - can_fork: shixunsDetails.can_fork.can_fork, - certi_url: shixunsDetails.can_fork.certi_url, - }) - } + } + componentDidMount() { + let thiisie = this.IEVersion(); + if (thiisie != -1) { + this.setState({ + isIE: true + }) + } else { + this.setState({ + isIE: false + }) + } + } + + /* + * Fork + * */ + copyForkvisible = () => { + let {shixunsDetails} = this.props; + if (shixunsDetails.can_fork === null) { + this.setState({ + Forkvisible: true + }) + } else { + this.setState({ + Forkvisible: false, + Forkauthentication: true, + can_fork: shixunsDetails.can_fork.can_fork, + certi_url: shixunsDetails.can_fork.certi_url, + }) } - hideForkvisible = () => { + } + + hideForkvisible = () => { + this.setState({ + Forkvisible: false, + Forkauthentication: false + }) + } + + addForkvisible = () => { + this.setState({ + Forkvisibletype: true, + }) + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/copy.json"; + axios.post(url).then((response) => { + if (response.data.status === 401) { + + } else { this.setState({ - Forkvisible: false, - Forkauthentication:false + Forkvisible: false, + Forkauthentication: false, + // Forkvisibletype:false }) + window.location.href = "/shixuns/" + response.data.shixun + "/challenges"; + } + + }).catch((error) => { + console.log(error) + }); + + } + /* + * 发送至按钮 + * */ + Senttothe = () => { + if (this.props.checkIfLogin() === false) { + this.props.showLoginDialog() + return } - addForkvisible = () => { + // if(this.props.checkIfProfileCompleted()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } + // + // if(this.props.checkIfProfessionalCertification()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/search_user_courses.json"; + this.setState({ + Senttothetype: true + }) + + axios.get(url, { + params: { + page: 1, + limit: 10 + } + }).then((response) => { this.setState({ - Forkvisibletype: true, + courses_count: response.data.courses_count, + course_list: response.data.course_list }) - let id = this.props.match.params.shixunId; - let url = "/shixuns/" + id + "/copy.json"; - axios.post(url).then((response) => { - if(response.data.status===401){ - - }else{ - this.setState({ - Forkvisible: false, - Forkauthentication: false, - // Forkvisibletype:false - }) - window.location.href = "/shixuns/" + response.data.shixun + "/challenges"; - } + }).catch((error) => { + console.log(error) + }); + } + + SenttotheSearch = (value) => { + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/search_user_courses.json?search=" + value; + axios.get(encodeURI(url), { + params: { + page: 1, + limit: 10 + } + }).then((response) => { + this.setState({ + courses_count: response.data.courses_count, + course_list: response.data.course_list, + pages: 1, + Searchvalue: value + }) + }).catch((error) => { + console.log(error) + }); + } + + onChangeSenttothevcalue = (e) => { + this.setState({ + Senttothevcalue: e.target.value + }) + } + onChangesendeSenttothe = (pageNumber) => { + let {Searchvalue} = this.state; + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/search_user_courses.json?search=" + Searchvalue; + axios.get(url, { + params: { + page: pageNumber, + limit: 10 + } + }).then((response) => { + this.setState({ + courses_count: response.data.courses_count, + course_list: response.data.course_list, + pagenum: pageNumber, + pages: pageNumber + }) + }).catch((error) => { + console.log(error) + }); + } + sendeSenttothevcalue = () => { - }).catch((error) => { - console.log(error) - }); + let {Senttothevcalue} = this.state; + if (Senttothevcalue === undefined) { + this.setState({ + Senttothevcaluetype: true + }) + return } - /* - * 发送至按钮 - * */ - Senttothe=()=>{ - if(this.props.checkIfLogin()===false){ - this.props.showLoginDialog() - return - } - - // if(this.props.checkIfProfileCompleted()===false){ - // this.setState({ - // AccountProfiletype:true - // }) - // return - // } - // - // if(this.props.checkIfProfessionalCertification()===false){ - // this.setState({ - // AccountProfiletype:true - // }) - // return - // } - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json"; - this.setState({ - Senttothetype:true - }) + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/send_to_course.json"; + axios.post(url, { + course_id: Senttothevcalue + }).then((response) => { - axios.get(url, { - params: { - page:1, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list - }) - }).catch((error) => { - console.log(error) - }); + this.props.showSnackbar(response.data.message); + this.setState({ + Senttothetype: false, + Searchvalue: "", + pages: 1 + }) + // window.location.href = response.data.url; + // response.data.course_id + this.props.history.replace(response.data.first_category_url); + + }).catch((error) => { + console.log(error) + }); + + } + + hideSenttothevcalue = () => { + this.setState({ + Senttothetype: false, + Searchvalue: "", + pages: 1 + }) + + + } + + /* + * 撤销发布按钮 + * */ + + ModalCancel = () => { + this.setState({ + Modalstype: false + }) + } + ModalSave = () => { + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/cancel_publish.json"; + axios.get(url).then((response) => { + this.props.showSnackbar(response.data.message); + window.location.reload() + }).catch((error) => { + console.log(error) + }); + } + cancel_publish = () => { + this.setState({ + Modalstype: true, + Modalstopval: "是否确认撤销发布?", + ModalCancel: this.ModalCancel, + ModalSave: this.ModalSave, + }) + } + + + /* + * 申请发布按钮 + * */ + applyrelease = () => { + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/publish.json"; + axios.get(url).then((response) => { + let evaluation_set_position + if (response.data.evaluation_set_position === null) { + evaluation_set_position = [] + } else { + evaluation_set_position = response.data.evaluation_set_position + } + this.setState({ + Issuevisible: true, + tag_position: response.data.tag_position, + evaluation_set_position: evaluation_set_position, + publishboxstatus: response.data.status, + }) + }).catch((error) => { + console.log(error) + }); + }; + + hiddenIssuevisible = (val) => { + this.setState({ + Issuevisible: false + }) + if (val === 0 || val === 1) { + window.location.reload() } - SenttotheSearch=(value)=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json?search="+value; - axios.get(encodeURI(url), { - params: { - page:1, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list, - pages:1, - Searchvalue:value - }) - }).catch((error) => { - console.log(error) - }); - } + } + + //重置按钮 + // resetshixunCombat=(id)=>{ + // let zrl="/myshixuns/"+id+"/reset_my_game.json"; + // axios.get(zrl).then((response) => { + // window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; + // message.success('重置成功'); + // }).catch((error) => { + // console.log(error) + // }); + // } + + // reset_my_game + hidestartshixunsreplace = (url) => { + this.setState({ + isSpin: true, + }) + axios.get(url).then((response) => { + if (response.status === 200) { + // let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; + // this.props.history.push(path); + message.success('重置成功,正在进入实训!'); + this.startshixunCombat(response.data.shixun_identifier, 1); + this.setState({ + shixunsreplace: false, + isSpin: false, + }) - onChangeSenttothevcalue=(e)=>{ - this.setState({ - Senttothevcalue:e.target.value - }) - } - onChangesendeSenttothe=(pageNumber)=>{ - let{Searchvalue}=this.state; - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json?search="+Searchvalue; - axios.get(url, { - params: { - page:pageNumber, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list, - pagenum: pageNumber, - pages: pageNumber - }) - }).catch((error) => { - console.log(error) - }); - } - 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, - Searchvalue:"", - pages:1 - }) - // window.location.href = response.data.url; - // response.data.course_id - this.props.history.replace(response.data.first_category_url); + // message.success('重置成功,正在进入实训!'); + // this.startshixunCombat(); + } + } + ).catch((error) => { + this.setState({ + startbtn: false, + shixunsreplace: false, + isSpin: false + }) + }); - }).catch((error) => { - console.log(error) - }); + } - } - hideSenttothevcalue=()=>{ + //开始实战按钮 + startshixunCombat = (id, reset) => { + + if(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true){ + if (this.props.checkIfLogin() === false) { + this.props.showLoginDialog() + return + } + + if (this.props.checkIfProfileCompleted() === false) { this.setState({ - Senttothetype:false, - Searchvalue:"", - pages:1 + AccountProfiletype: true }) + return + } + // if(this.props.checkIfProfessionalCertification()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } - } - - /* - * 撤销发布按钮 - * */ - - ModalCancel=()=>{ - this.setState({ - Modalstype:false - }) - } - ModalSave=()=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/cancel_publish.json"; - axios.get(url).then((response) => { - this.props.showSnackbar(response.data.message); - window.location.reload() - }).catch((error) => { - console.log(error) - }); - } - cancel_publish=()=>{ - this.setState({ - Modalstype:true, - Modalstopval:"是否确认撤销发布?", - ModalCancel:this.ModalCancel, - ModalSave:this.ModalSave, - }) - } + let {shixunsDetails} = this.props + if (shixunsDetails.shixun_status > 1) { + this.setState({ + startbtn: true, + hidestartshixunsreplacevalue: "" + }) + } else { + this.setState({ + hidestartshixunsreplacevalue: "" + }) + } - /* - * 申请发布按钮 - * */ - applyrelease=()=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/publish.json"; - axios.get(url).then((response) => { - let evaluation_set_position - if(response.data.evaluation_set_position===null){ - evaluation_set_position=[] - }else{ - evaluation_set_position=response.data.evaluation_set_position - } + let url = "/shixuns/" + id + "/jupyter_exec.json"; + if (reset) { + url += '?reset=' + reset + } + axios.get(url).then((response) => { + if (response.status === 200) { + if (response.data.status === -2) { + // this.resetshixunCombat(response.data.message); this.setState({ - Issuevisible:true, - tag_position:response.data.tag_position, - evaluation_set_position:evaluation_set_position, - publishboxstatus:response.data.status, + startbtn: false, + shixunsreplace: true, + hidestartshixunsreplacevalue: response.data.message + ".json" }) - }).catch((error) => { - console.log(error) - }); - }; - - hiddenIssuevisible=(val)=>{ - this.setState({ - Issuevisible:false - }) - if(val===0||val===1){ - window.location.reload() - } + // this.shixunexec(response.data.message+".json") + } else if (response.data.status === -1) { + console.log(response) + } else if (response.data.status === -3) { + this.setState({ + shixunsmessage: response.data.message, + startshixunCombattype: true, + startbtn: false + }) + } else { + // let path="/tasks/"+response.data.game_identifier; + // this.props.history.push(path); - } - //重置按钮 - // resetshixunCombat=(id)=>{ - // let zrl="/myshixuns/"+id+"/reset_my_game.json"; - // axios.get(zrl).then((response) => { - // window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; - // message.success('重置成功'); - // }).catch((error) => { - // console.log(error) - // }); - // } + // this.context.router.history.push(path); + if (response.data.status != 401) { + window.location.href = "/tasks/" + response.data.identifier+`/jupyter`; + } - // reset_my_game - hidestartshixunsreplace=(url)=>{ + } + } + }).catch((error) => { this.setState({ - isSpin:true, + startbtn: false }) - axios.get(url).then((response) => { - if(response.status===200){ - // let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; - // this.props.history.push(path); - message.success('重置成功,正在进入实训!'); - this.startshixunCombat(response.data.shixun_identifier, 1); - this.setState({ - shixunsreplace:false, - isSpin:false, - }) - - // message.success('重置成功,正在进入实训!'); - // this.startshixunCombat(); - }} - ).catch((error) => { - this.setState({ - startbtn:false, - shixunsreplace:false, - isSpin:false - }) - }); - - } - + }); + }else{ + if (this.props.checkIfLogin() === false) { + this.props.showLoginDialog() + return + } - //开始实战按钮 - startshixunCombat=(id, reset)=>{ + if (this.props.checkIfProfileCompleted() === false) { + this.setState({ + AccountProfiletype: true + }) + return + } - if(this.props.checkIfLogin()===false){ - this.props.showLoginDialog() - return - } + // if(this.props.checkIfProfessionalCertification()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } - if(this.props.checkIfProfileCompleted()===false){ - this.setState({ - AccountProfiletype:true - }) - return - } + let {shixunsDetails} = this.props + if (shixunsDetails.shixun_status > 1) { + this.setState({ + startbtn: true, + hidestartshixunsreplacevalue: "" + }) + } else { + this.setState({ + hidestartshixunsreplacevalue: "" + }) + } - // if(this.props.checkIfProfessionalCertification()===false){ - // this.setState({ - // AccountProfiletype:true - // }) - // return - // } - let {shixunsDetails} = this.props - if( shixunsDetails.shixun_status>1){ + let url = "/shixuns/" + id + "/shixun_exec.json"; + if (reset) { + url += '?reset=' + reset + } + axios.get(url).then((response) => { + if (response.status === 200) { + if (response.data.status === -2) { + // this.resetshixunCombat(response.data.message); this.setState({ - startbtn:true, - hidestartshixunsreplacevalue:"" + startbtn: false, + shixunsreplace: true, + hidestartshixunsreplacevalue: response.data.message + ".json" }) - }else{ + // this.shixunexec(response.data.message+".json") + } else if (response.data.status === -1) { + console.log(response) + } else if (response.data.status === -3) { this.setState({ - hidestartshixunsreplacevalue:"" + shixunsmessage: response.data.message, + startshixunCombattype: true, + startbtn: false }) - } - + } else { + // let path="/tasks/"+response.data.game_identifier; + // this.props.history.push(path); - let url="/shixuns/"+id+"/shixun_exec.json" ; - if (reset) { - url += '?reset=' + reset - } - axios.get(url).then((response) => { - if(response.status===200){ - if(response.data.status===-2){ - // this.resetshixunCombat(response.data.message); - this.setState({ - startbtn:false, - shixunsreplace:true, - hidestartshixunsreplacevalue:response.data.message+".json" - }) - // this.shixunexec(response.data.message+".json") - }else if(response.data.status===-1){ - console.log(response) - }else if(response.data.status===-3){ - this.setState({ - shixunsmessage:response.data.message, - startshixunCombattype:true, - startbtn:false - }) - }else{ - // let path="/tasks/"+response.data.game_identifier; - // this.props.history.push(path); - - - // this.context.router.history.push(path); - if(response.data.status!=401){ - window.location.href = "/tasks/"+response.data.game_identifier; - } - - } - } - }).catch((error) => { - this.setState({ - startbtn:false - }) - }); - } - tocertification=()=>{ - let{certi_url}=this.state; - this.setState({ - Forkauthentication:false - }) - window.location.href=certi_url; - } + // this.context.router.history.push(path); + if (response.data.status != 401) { + window.location.href = "/tasks/" + response.data.game_identifier; + } - SenttotheValue=(e)=>{ + } + } + }).catch((error) => { this.setState({ - Searchvalue:e.target.value + startbtn: false }) + }); } - hidestartshixunCombattype=()=>{ - this.setState({ - startshixunCombattype:false - }) - } - hideAccountProfile=()=>{ - this.setState({ - AccountProfiletype:false - }) - } - - - showonMouseOver=()=>{ - $("#ratePanel").show(); - this.setState({ - showradios:true - }) - } - - hideonMouseOut=()=>{ - $("#ratePanel").hide(); - this.setState({ - showradios:false - }) - } - - render() { - let { - Forkvisible, - Senttothetype, - Senttothevcalue, - evaluation_set_position, - Forkauthentication, - can_fork, - certi_url, - tag_position, - courses_count, - course_list, - Issuevisible, - publishboxstatus, - showradios, - startbtn, - Searchvalue, - startshixunCombattype, - shixunsmessage, - pages, - shixunsreplace, - hidestartshixunsreplacevalue, - Forkvisibletype, - AccountProfiletype, - isIE} = this.state; - let {shixunsDetails, shixunId, star_info, star_infos} = this.props; - let challengeBtnTipText = ''; - let challengeBtnText = '模拟实战'; - // let star_info=[] + } + + tocertification = () => { + let {certi_url} = this.state; + this.setState({ + Forkauthentication: false + }) + window.location.href = certi_url; + } + + SenttotheValue = (e) => { + this.setState({ + Searchvalue: e.target.value + }) + } + + hidestartshixunCombattype = () => { + this.setState({ + startshixunCombattype: false + }) + } + + hideAccountProfile = () => { + this.setState({ + AccountProfiletype: false + }) + } + + + showonMouseOver = () => { + $("#ratePanel").show(); + this.setState({ + showradios: true + }) + } + + hideonMouseOut = () => { + $("#ratePanel").hide(); + this.setState({ + showradios: false + }) + } + + render() { + let { + Forkvisible, + Senttothetype, + Senttothevcalue, + evaluation_set_position, + Forkauthentication, + can_fork, + certi_url, + tag_position, + courses_count, + course_list, + Issuevisible, + publishboxstatus, + showradios, + startbtn, + Searchvalue, + startshixunCombattype, + shixunsmessage, + pages, + shixunsreplace, + hidestartshixunsreplacevalue, + Forkvisibletype, + AccountProfiletype, + isIE + } = this.state; + let {shixunsDetails, shixunId, star_info, star_infos} = this.props; + let challengeBtnTipText = ''; + let challengeBtnText = '模拟实战'; + // let star_info=[] // if (shixunsDetails.status === 0) { // // } else if (shixunsDetails.status === 1) { @@ -545,265 +628,270 @@ class TPMBanner extends Component { // challengeBtnTipText = '开始学习并完成实战任务' // // } - if(shixunsDetails!=undefined){ - if (shixunsDetails.shixun_status === 0 ) { - challengeBtnText = '继续实战' - } else if (shixunsDetails.shixun_status === 1) { - challengeBtnText = '查看实战' - } else if (shixunsDetails.shixun_status === 3) { - challengeBtnText = '继续实战' - }else{ - challengeBtnText = "开始实战" - } + if (shixunsDetails != undefined) { + if (shixunsDetails.shixun_status === 0) { + challengeBtnText = '继续实战' + } else if (shixunsDetails.shixun_status === 1) { + challengeBtnText = '查看实战' + } else if (shixunsDetails.shixun_status === 3) { + challengeBtnText = '继续实战' + } else { + challengeBtnText = "开始实战" } + } + + // let list=shixunsDetails.task_operation; + // if(list!=undefined){ + // if (shixunsDetails.status === 0 ) { + // for(var i=0; i; + const MyRate = ({defaultValue, ...rest}) => { + let myValue = defaultValue; + // console.log(myValue-Math.floor(myValue)) + // if (myValue < Math.ceil(myValue)) { + // myValue = Math.floor(myValue) + 0.5; // } - const radioStyle = { - display: 'block', - height: '30px', - lineHeight: '30px', - }; - - const antIcon = ; - const MyRate = ({ defaultValue, ...rest }) => { - let myValue = defaultValue; - // console.log(myValue-Math.floor(myValue)) - // if (myValue < Math.ceil(myValue)) { - // myValue = Math.floor(myValue) + 0.5; - // } - - return ; - }; - return ( - - shixunsDetails===undefined?"": -
-
- - {AccountProfiletype===true?this.hideAccountProfile()} - {...this.props} - {...this.state} - />:""} - - - {this.state.Modalstype===true?:""} - -
-

+ + return ; + }; + + console.log(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter) + + return ( + + shixunsDetails === undefined ? "" : +

+
+ + {AccountProfiletype === true ? this.hideAccountProfile()} + {...this.props} + {...this.state} + /> : ""} + + + {this.state.Modalstype === true ? : ""} + +
+

{shixunsDetails.name} { - shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" : - - - + shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" : + + + } -

-
- {/**/} -
    -
  • - 学习人数 - {shixunsDetails.stu_num} -
  • - {/*
  • */} - {/*经验值*/} - {/*{shixunsDetails.experience}*/} - {/*
  • */} -
  • - 难度级别 - {shixunsDetails.diffcult} - -
  • +

    +
    + {/**/} +
      +
    • + 学习人数 + {shixunsDetails.stu_num} +
    • + {/*
    • */} + {/*经验值*/} + {/*{shixunsDetails.experience}*/} + {/*
    • */} +
    • + 难度级别 + {shixunsDetails.diffcult} + +
    -
    this.showonMouseOver()} onMouseOut={()=>this.hideonMouseOut()}> -
    学员评分
    -
    - -
    -
    this.hideonMouseOut()}> -
    - -
    -
    -
    +
    this.showonMouseOver()} + onMouseOut={() => this.hideonMouseOut()}> +
    学员评分
    +
    + +
    +
    this.hideonMouseOut()}> +
    + +
    +
    +
    {star_infos[0]}分 - 总评分 -
    - {showradios === true ? - - : ""} -
    -
    -
    -
    -
    -
    - {showradios === true ? - - : ""} -
    - - {star_infos[1]}% -
    -
    -
    - {showradios === true ? - - : ""} -
    - - {star_infos[2]}% -
    -
    -
    - {showradios === true ? - - : ""} -
    - - {star_infos[3]}% -
    -
    -
    - {showradios === true ? - - : ""} -
    - - {star_infos[4]}% -
    -
    -
    - {showradios === true ? - - : ""} -
    - - {star_infos[5]}% -
    -
    + className="font-24 color-yellow-ff lineh-20 mb10 ml20">{star_infos[0]}分 + 总评分 +
    + {showradios === true ? + + : ""}
    +
    +
    +
    +
    + {showradios === true ? + + : ""} +
    + + {star_infos[1]}% +
    +
    +
    + {showradios === true ? + + : ""} +
    + + {star_infos[2]}% +
    +
    +
    + {showradios === true ? + + : ""} +
    + + {star_infos[3]}% +
    +
    +
    + {showradios === true ? + + : ""} +
    + + {star_infos[4]}% +
    +
    +
    + {showradios === true ? + + : ""} +
    + + {star_infos[5]}% +
    +
    +
    +
    { - startbtn === false && shixunsDetails.shixun_status != -1 ? - - this.startshixunCombat(this.props.match.params.shixunId)} - className="fr user_default_btn task-btn-orange font-18" - id="shixun_operation" data-remote="true" - > - {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.shixun_status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"} - - - : "" + startbtn === false && shixunsDetails.shixun_status != -1 ? + + this.startshixunCombat(this.props.match.params.shixunId)} + className="fr user_default_btn task-btn-orange font-18" + id="shixun_operation" data-remote="true" + > + {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.shixun_status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"} + + + : "" } -
    -

    目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!

    -
    -
    - {/*取消*/} - 知道啦 -
    - {/*

    */} - {/*知道了*/} - {/*

    */} +
    +

    目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!

    +
    +
    + {/*取消*/} + 知道啦 +
    + {/*

    */} + {/*知道了*/} + {/*

    */}
    - +
    -

    实训已经更新了,正在为您重置!

    +

    实训已经更新了,正在为您重置!

    -
    +
    - + { - startbtn === true ? - 开启中 : "" + startbtn === true ? + 开启中 : "" } {/*{*/} @@ -815,172 +903,173 @@ class TPMBanner extends Component { {/*}*/} {shixunsDetails.shixun_status === 0 && this.props.identity < 5 ? - 申请发布 : "" + 申请发布 : "" } - { - publishboxstatus === 0 ?
    -

    - 发布申请已提交,请等待管理员的审核
    -

    -
    : publishboxstatus === 1 ? -
    -

    - 发布申请已提交,请等待管理员的审核
    - • 我们将在1-2个工作日内完成审核 -

    -
    : publishboxstatus === 2 ?
    -

    - 第 - { - evaluation_set_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关评测设置尚未完成,无法申请发布 -

    -
    : publishboxstatus === 3 ? -
    -

    - 每一个关卡至少需要一个技能标签
    - 第 - { - tag_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关尚未设置技能标签,请补充 -

    -
    : -
    -

    - 尚未创建任务的实训,不能申请发布 -

    -
    - } - + { + publishboxstatus === 0 ?
    +

    + 发布申请已提交,请等待管理员的审核
    +

    +
    : publishboxstatus === 1 ? +
    +

    + 发布申请已提交,请等待管理员的审核
    + • 我们将在1-2个工作日内完成审核 +

    +
    : publishboxstatus === 2 ?
    +

    + 第 + { + evaluation_set_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关评测设置尚未完成,无法申请发布 +

    +
    : publishboxstatus === 3 ? +
    +

    + 每一个关卡至少需要一个技能标签
    + 第 + { + tag_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关尚未设置技能标签,请补充 +

    +
    : +
    +

    + 尚未创建任务的实训,不能申请发布 +

    +
    + } +
    {shixunsDetails.shixun_status === 1 && this.props.identity < 5 ? - 撤销发布 : "" + 撤销发布 : "" } { - - - 发送至 - - + + + 发送至 + + } -
    -
    - -
    - 选择的实训将会发送到指定课堂 -
    - -
    - this.SenttotheSearch(value)} - style={{width: '100%'}} - /> -
    - - -
    12?"cdefault ":"cdefault "}> -
    -
      - - { - course_list === undefined ? "" : course_list.map((item, key) => { - return ( - {item.name} - ) - }) - } - -
    -
    -
    - {this.state.Senttothevcaluetype===true?
    请选择你要发送的课堂
    :""} -
    12 ? "block" : "none"}}> - -
    - -
    -
    -
    -
    - 取消 - 确定 -
    + + +
    12 ? "cdefault " : "cdefault "}> +
    +
      + + { + course_list === undefined ? "" : course_list.map((item, key) => { + return ( + {item.name} + ) + }) + } + +
    +
    +
    + {this.state.Senttothevcaluetype === true ?
    请选择你要发送的课堂
    : ""} +
    12 ? "block" : "none"}}> + +
    + +
    +
    +
    +
    + 取消 + 确定 +
    -
    +
    -
    +
    {shixunsDetails.shixun_status === 3 && 已关闭 } - {shixunsDetails.shixun_status === -1 && - 已删除 - } + {shixunsDetails.shixun_status === -1 && + 已删除 + } - {this.props.identity < 8&&shixunsDetails.shixun_status != -1 ?
    - + {this.props.identity < 8 && shixunsDetails.shixun_status != -1 ? +
    + - - {Forkvisibletype===true? + {Forkvisibletype === true ? - : + :
    -

    复制将在后台执行,平台将为你创建
    一个新的同名实训和内容,请问是否继续?

    -
    -
    - 取消 - 确定 -
    +

    复制将在后台执行,平台将为你创建
    一个新的同名实训和内容,请问是否继续?

    +
    +
    + 取消 + 确定 +
    } @@ -1017,40 +1106,41 @@ class TPMBanner extends Component {
    -

    {can_fork}
    请问是否前往进行认证?

    -
    -
    - 取消 - 确定 -
    +

    {can_fork}
    请问是否前往进行认证?

    +
    +
    + 取消 + 确定 +
    {!!shixunsDetails.fork_num && - {shixunsDetails.fork_num} + {shixunsDetails.fork_num} } -
    :""} +
    : ""} + +
    +
    +
    正在等待管理员的审核。在审核通过前,可以随时撤销发布 +
    -
-
正在等待管理员的审核。在审核通过前,可以随时撤销发布
-
- - ); - } + ); + } } export default TPMBanner; diff --git a/public/react/src/modules/tpm/TPMDataset.js b/public/react/src/modules/tpm/TPMDataset.js index 897fbe221..91322d18e 100644 --- a/public/react/src/modules/tpm/TPMDataset.js +++ b/public/react/src/modules/tpm/TPMDataset.js @@ -89,7 +89,7 @@ class TPMDataset extends Component { } mysonChange = (e) => { - console.log(`全选checked = ${e.target.checked}`); + // console.log(`全选checked = ${e.target.checked}`); if (e.target.checked === true) { let mydata=[]; let datas=[]; diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js index 1e6980216..b72a4e43f 100644 --- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js +++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js @@ -64,6 +64,7 @@ class Shixuninformation extends Component { choice_main_type:this.props.data.shixun.choice_main_type, choice_small_type:this.props.data.shixun.choice_small_type, choice_standard_scripts:this.props.data.shixun.choice_standard_scripts, + shixunmemoMDvalue:this.props.data.shixun.evaluate_script, }) this.props.form.setFieldsValue({ @@ -316,7 +317,10 @@ class Shixuninformation extends Component { let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false; console.log(operateauthority) const {getFieldDecorator} = this.props.form; - const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state; + const {languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state; + + console.log("1222") + console.log(choice_standard_scripts) const {shixun_service_configs}=this.props; const uploadProps = { width: 600, @@ -478,6 +482,7 @@ class Shixuninformation extends Component { })(