+
",
- 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
- 请先上传本关任务的所有代码文件、标准图片等所有必要的文件到
- 版本库
- 学员任务文件 该文件将直接显示给学生,需要学生在其中填写代码
+ 请先上传本关任务的所有代码文件、标准图片等所有必要的文件到
+ 版本库
+ 学员任务文件 该文件将直接显示给学生,需要学生在其中填写代码 评测执行文件 该文件由平台执行,用来测试平台学员代码是否正确 评测执行文件 该文件由平台执行,用来测试平台学员代码是否正确 效果展现方式
- 图片:处理或输出图片类型的任务,请选填此项 该选项用来配置学员评测本关任务时,查看效果页上需要展现的文件类型 待处理图片路径
- 该路径下的文件将在学员评测本关任务时,作为原始图片显示在查看效果页,供学员参考,任务为图片处理时请指定该路径,并注意与程序文件所在文件夹分开
- 标准答案图片路径
- 该路径下的文件将在学员评测本关任务时,作为参考答案显示在查看效果页,供学员参考任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开
- 学员答案文件路径
- 学员评测本关任务时生成的文件将保存在该路径下,并作为实际输出显示在查看效果页,供学员确认任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开
- 测试集 测试集和系统评分规则
- 得分规范:
-
+ className="fa fa-exclamation-circle mr3">必填项
+ 效果展现方式
+ 图片:处理或输出图片类型的任务,请选填此项 该选项用来配置学员评测本关任务时,查看效果页上需要展现的文件类型 待处理图片路径
+ 该路径下的文件将在学员评测本关任务时,作为原始图片显示在查看效果页,供学员参考,任务为图片处理时请指定该路径,并注意与程序文件所在文件夹分开
+ 标准答案图片路径
+ 该路径下的文件将在学员评测本关任务时,作为参考答案显示在查看效果页,供学员参考任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开
+ 学员答案文件路径
+ 学员评测本关任务时生成的文件将保存在该路径下,并作为实际输出显示在查看效果页,供学员确认任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开
+ 测试集 测试集和系统评分规则
+ 得分规范:
+
系统评分占比:
- *
- 组{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'}}
+ >%
- {/*
-
- 新增测试集
-
- 温馨提示:建议公开测试集和隐藏测试集结合使用,降低作弊的几率;隐藏测试集,在“提交评测”时也将被自动检测
+
+ 新增测试集
+
+ 温馨提示:建议公开测试集和隐藏测试集结合使用,降低作弊的几率;隐藏测试集,在“提交评测”时也将被自动检测
- {/*文件导航*/}
- {
- main.length===0?"":main.map((item,key)=>{
- return(
- this.goblakepath(item.path,key)}>{item.val}
- )
- })
- }
- {/*文件*/}
- {trees === undefined || trees === null ? "" : trees.map((item, key) => {
- return(
-
-
+ {/*文件导航*/}
+ {
+ main.length===0?"":main.map((item,key)=>{
+ return(
+ this.goblakepath(item.path,key)}>{item.val}
+ )
+ })
+ }
+ {/*文件*/}
+ {trees === undefined || trees === null ? "" : trees.map((item, key) => {
+ return(
+
+
- 可以通过设置图片路径和学员答案文件路径,展示代码对应的图片效果
- apk/exe:写可执行文件的任务,请选填此项
- 可以通过设置学员答案文件路径,展示二维码以供扫码下载
- txt:输出txt文档类型的任务,请选填此项
- 可以通过学员答案文件路径设置,展示txt文件内容
- html:web类型的任务,请选填此项
- 可以通过Web路由设置,展示html效果预览页
-
+ 可以通过设置图片路径和学员答案文件路径,展示代码对应的图片效果
+ apk/exe:写可执行文件的任务,请选填此项
+ 可以通过设置学员答案文件路径,展示二维码以供扫码下载
+ txt:输出txt文档类型的任务,请选填此项
+ 可以通过学员答案文件路径设置,展示txt文件内容
+ html:web类型的任务,请选填此项
+ 可以通过Web路由设置,展示html效果预览页
+