From 576d1160a9e925ea9e869c4407ac57e7638cab6a Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 7 Aug 2019 15:06:56 +0800 Subject: [PATCH 001/108] =?UTF-8?q?=E5=A4=87=E6=B3=A8=EF=BC=8C=E8=BF=99?= =?UTF-8?q?=E4=B8=AA=E6=94=B9=E5=8A=A8=E6=B2=A1=E5=90=AF=E7=94=A8=EF=BC=8C?= =?UTF-8?q?=E5=8F=AA=E6=98=AF=E5=81=9A=E4=B8=AA=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/editormd/lib/marked.min.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/editormd/lib/marked.min.js b/public/editormd/lib/marked.min.js index 636c21b01..519296797 100644 --- a/public/editormd/lib/marked.min.js +++ b/public/editormd/lib/marked.min.js @@ -2,6 +2,10 @@ * marked v0.3.3 - a markdown parser * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) * https://github.com/chjj/marked + + 备注,这个改动没启用,只是做个记录: + br不转成br + 加了个 if (cap[0] != '
' && cap[0] != '
') { out+=this.options.sanitize?escape(cap[0]):cap[0]; } */ (function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose){loose=next}}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq); this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script"||cap[1]==="style",text:cap[0]});continue}if((!bq&&top)&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else{if(this.options.pedantic){this.rules=inline.pedantic}}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^/i.test(cap[0])){this.inLink=false}}src=src.substring(cap[0].length);out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue From 24bf86ca6af2b58054c2e339bae2d5713e791eac Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 7 Aug 2019 16:11:24 +0800 Subject: [PATCH 002/108] =?UTF-8?q?=09=09=09=09=09//=20=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E5=8F=91=E7=94=9F404=EF=BC=8C?= =?UTF-8?q?=E5=88=99=E9=9A=941s=E5=90=8E=E5=86=8D=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E6=9C=AC=E6=8E=A5=E5=8F=A3=EF=BC=9B=EF=BC=88?= =?UTF-8?q?=E5=9B=A0=E4=B8=BAucloud=E4=B8=BB=E4=BB=8E=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E6=9C=89=E5=BB=B6=E8=BF=9F=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/context/TPIContextProvider.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index 0f2f68a75..006c0af49 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -498,7 +498,7 @@ pop_box_new(htmlvalue, 480, 182); return resData } - fetchAll(stageId) { + fetchAll(stageId, noTimeout) { if (window.__fetchAllFlag == true ) { console.log('TPIContextProvider call fetchAll repeatly!') @@ -544,6 +544,13 @@ pop_box_new(htmlvalue, 480, 182); return; } if (response.data.status == 404) { + // 如果第一次发生404,则隔1s后再调用一次本接口;(因为ucloud主从同步可能有延迟) + if (!noTimeout) { + setTimeout(() => { + this.fetchAll(stageId, true) + }, 1000) + return; + } window.location.href = '/myshixuns/not_found' return; } From 508605289781f53237fad0c62fe8d022620603c1 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 7 Aug 2019 17:01:20 +0800 Subject: [PATCH 003/108] response.data.message --- public/react/src/modules/courses/coursesPublic/Addcourses.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index a9d30f2b6..8c9709fee 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -248,7 +248,7 @@ class Addcourses extends Component{ }else{ - notification.open({ + response.data.message && notification.open({ message:"提示", description:response.data.message }); From 09b893c86d8db94038bebdf7c96e6cc70504c736 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 7 Aug 2019 17:14:02 +0800 Subject: [PATCH 004/108] =?UTF-8?q?=E8=B5=84=E6=96=99=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 2 +- public/react/src/modules/tpm/TPMIndexHOC.js | 29 +++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 56b386288..a35d3293a 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -659,8 +659,8 @@ submittojoinclass=(value)=>{ {AccountProfiletype===true?this.hideAccountProfile()} - {...this.state} {...this.props} + {...this.state} />:""} 高校智能化教学与实训平台 diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 0361b090f..0b4f312e4 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -10,6 +10,8 @@ import axios from 'axios'; import './TPMIndex.css' import LoginDialog from '../login/LoginDialog'; +import AccountProfile from '../user/AccountProfile'; + import Trialapplication from "../login/Trialapplication"; // import "antd/dist/antd.css"; // import '../../css/educoder/edu-common.css' @@ -76,7 +78,8 @@ export function TPMIndexHOC(WrappedComponent) { Footerdown:undefined, coursedata: {}, - isRender: false + isRender: false, + AccountProfiletype: false } } @@ -300,11 +303,26 @@ export function TPMIndexHOC(WrappedComponent) { isRender: true }) } + checkIfLogin = () => { return this.state.current_user && this.state.current_user.login != '' } + + hideAccountProfile = () => { + this.setState({ + hideAccountProfile: false + }) + } + showProfileCompleteDialog = () => { + this.setState({ + hideAccountProfile: true + }) + } + checkIfProfileCompleted = () => { + return this.state.current_user && this.state.current_user.profile_completed + } render() { - let{Headertop,Footerdown, isRender}=this.state; + let{Headertop,Footerdown, isRender, AccountProfiletype}=this.state; const common = { isSuperAdmin:this.isSuperAdmin, isAdminOrCreator:this.isAdminOrCreator, @@ -319,6 +337,8 @@ export function TPMIndexHOC(WrappedComponent) { showLoginDialog: this.showLoginDialog, checkIfLogin: this.checkIfLogin, + showProfileCompleteDialog: this.showProfileCompleteDialog, + checkIfProfileCompleted: this.checkIfProfileCompleted, } return (
@@ -327,6 +347,11 @@ export function TPMIndexHOC(WrappedComponent) { {...this.state} {...this.props} /> : ""} + {AccountProfiletype===true ? this.hideAccountProfile()} + {...this.state} + {...this.props} + />:""} {/* 注释掉了1440 影响到了手机屏幕的展示 */} {/* graduation_groups && !!graduation_groups.length */} - { this.hasGraduationModule() &&
- 答辩组: - -
} - { course_groups && !!course_groups.length &&
- 管理权限: - -
} +

@@ -339,6 +308,40 @@ class AddTeacherModal extends Component{

: } +
+ { this.hasGraduationModule() &&
+ 添加至答辩组: + +
} + + { course_groups && !!course_groups.length &&
+ 管理权限: + +
} +
) } From 9302b69fcdf7c84f60e4943cbab37434149e9263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 8 Aug 2019 10:46:40 +0800 Subject: [PATCH 020/108] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E7=A7=BB=E6=A4=8D=E5=88=B0=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMBanner.js | 23 +- .../modules/tpm/TPMsettings/TPMsettings.js | 390 +++++++++++++++--- .../tpm/TPMsettings/css/TPMsettings.css | 12 +- .../src/modules/tpm/newshixuns/Newshixuns.js | 8 +- .../modules/tpm/newshixuns/css/Newshixuns.css | 3 + .../src/modules/tpm/shixuns/css/TPMBanner.css | 5 + 6 files changed, 370 insertions(+), 71 deletions(-) diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 26e2350a6..b5059cf34 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -900,18 +900,25 @@ class TPMBanner extends Component { {this.state.Senttothevcaluetype===true?
请选择你要发送的课堂
:""} -
- 12 ? "block" : "none"}} +
12 ? "block" : "none"}}> + +
- 确定 +
+
+
+
+ 取消 + 确定 +
- 取消 -
+ +
diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index 2e34bcffb..ef79f739f 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -3,7 +3,7 @@ import React, { Component } from 'react'; import MonacoEditor from 'react-monaco-editor'; //MonacoDiffEditor 对比模式 -import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb} from 'antd'; +import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification} from 'antd'; // import "antd/dist/antd.css"; @@ -207,6 +207,7 @@ export default class TPMsettings extends Component { constructor(props) { super(props) this.state = { + fileList: [], commandLine: 0, Openpublic: 0, settingsData: undefined, @@ -268,7 +269,8 @@ export default class TPMsettings extends Component { pod_exist_time: undefined, pod_exist_timetype: false, shixunmemoMDvalue:"", - language:"" + language:"", + deleteisnot:true } } descriptionMD=(initValue, id)=> { @@ -1011,32 +1013,160 @@ export default class TPMsettings extends Component { }) } - sendsure_apply = () => { - let {sendsure_applyvalue} = this.state; - let url = "/shixuns/apply_shixun_mirror.json"; - axios.post(url, { - note: sendsure_applyvalue - }).then((response) => { - if (response.status === 200) { - if (response.data.status == 1) { - this.setState({ - postapplyvisible: false, - postapplytitle: true - }) - } + setlanguagewrite = (e)=>{ + this.setState({ + languagewrite: e.target.value + }) + } - } - }).catch((error) => { - console.log(error) - }); + setsystemenvironment = (e) => { + this.setState({ + systemenvironment: e.target.value + }) + } - } + settestcoderunmode = (e) => { + this.setState({ + testcoderunmode: e.target.value + }) - sendhideModaly = () => { - this.setState({ - postapplyvisible: false - }) - } + } + + sendsure_apply = () => { + let {languagewrite,systemenvironment,testcoderunmode} = this.state; + // console.log("点击确定") + // console.log("languagewrite"+languagewrite); + // console.log("systemenvironment"+systemenvironment); + // console.log("testcoderunmode"+testcoderunmode); + + // let attachment_ids = undefined + // if (this.state.fileList) { + // attachment_ids = this.state.fileList.map(item => { + // return item.response ? item.response.id : item.id + // }) + // } + if(languagewrite === undefined || languagewrite === "" ){ + // this.props.showNotification(`请填写该镜像是基于什么语言`); + this.setState({ + languagewritetype:true + }) + return + } + if(systemenvironment === undefined || systemenvironment === ""){ + // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`); + this.setState({ + systemenvironmenttype:true + }) + return; + + } + if(testcoderunmode === undefined || testcoderunmode === "") { + // this.props.showNotification(`请填写该镜像中测试代码运行方式`); + this.setState({ + testcoderunmodetype:true + }) + return; + } + var attachment_ids=undefined; + if (this.state.fileList) { + attachment_ids = this.state.fileList.map(item => { + return item.response ? item.response.id : item.id + }) + } + + if( attachment_ids === undefined || attachment_ids.length===0){ + + // notification.open( + // { + // message: '提示', + // description: + // '请上传附件!', + // + // } + // ) + this.setState({ + attachmentidstype:true + }) + return; + } + // console.log("attachment_ids"+attachment_ids); + + // alert(languagewrite +" "+systemenvironment +" "+testcoderunmode + " "+attachment_ids); + + var data={ + language:languagewrite, + runtime:systemenvironment, + run_method:testcoderunmode, + attachment_id:attachment_ids[0], + } + var url =`/shixuns/apply_shixun_mirror.json`; + axios.post(url,data + ).then((response) => { + + try { + if (response.data) { + // const { id } = response.data; + // if (id) { + if(this.state.file !== undefined){ + console.log("549"); + // this.deleteAttachment(this.state.file); + this.setState({ + file:undefined, + languagewrite:"", + systemenvironment:"", + testcoderunmode:"", + }) + }else { + this.setState({ + file:undefined, + languagewrite:"", + systemenvironment:"", + testcoderunmode:"", + }) + } + // this.props.showNotification('提交成功!'); + notification.open( + { + message: '提示', + description: + '提交成功!', + + } + ) + this.sendhideModaly() + // this.props.history.push(`/courses/${cid}/graduation_topics`); + // } + } + }catch (e) { + + } + + }) + + } + + sendhideModaly = () => { + this.setState({ + postapplyvisible: false, + }) + if(this.state.file !== undefined){ + console.log("580"); + // this.deleteAttachment(this.state.file); + this.setState({ + file:undefined, + languagewrite:"", + systemenvironment:"", + testcoderunmode:"", + }) + }else { + this.setState({ + file:undefined, + languagewrite:"", + systemenvironment:"", + testcoderunmode:"", + }) + } + } yeshidemodel = () => { this.setState({ @@ -1198,29 +1328,76 @@ export default class TPMsettings extends Component { }) } + handleChange = (info) => { + console.log("handleChange1"); + let fileList = info.fileList; + this.setState({ fileList:fileList, + deleteisnot:false}); + } + + onAttachmentRemove = (file) => { + confirm({ + title: '确定要删除这个附件吗?', + okText: '确定', + cancelText: '取消', + // content: 'Some descriptions', + onOk: () => { + console.log("665") + this.deleteAttachment(file) + }, + onCancel() { + console.log('Cancel'); + }, + }); + return false; + } + + deleteAttachment = (file) => { + console.log(file); + let id=file.response ==undefined ? file.id : file.response.id + const url = `/attachments/${id}.json` + axios.delete(url, { + }) + .then((response) => { + if (response.data) { + const { status } = response.data; + if (status == 0) { + // console.log('--- success') + + this.setState((state) => { + + const index = state.fileList.indexOf(file); + const newFileList = state.fileList.slice(); + newFileList.splice(index, 1); + return { + fileList: newFileList, + deleteisnot:true + }; + }); + } + } + }) + .catch(function (error) { + console.log(error); + }); + } + + - render() { + render() { let { postapplyvisible, - sendsure_applyvalue, postapplytitle, shixunnametype, shixunmaintype, evaluate_scripttype, - exec_timetype, traineetype, standard_scripts, - description, - evaluate_script, name, settingsData, webssh, use_scope, - shixunsstatus, shixunsID, - exec_time, - pod_exist_time, - pod_exist_timetype, can_copy, choice_standard_scripts, Executiveordervalue, @@ -1241,19 +1418,15 @@ export default class TPMsettings extends Component { standard_scriptsModal, standard_scriptsModals, SelectTheCommandtype, - status, - opers, - operss, - opersss, testscripttiptype, operateshixunstype, opening_time, - opensmail, scope_partmenttype, newuse_scope, scope_partments, shixunmemoMDvalue,delType, - shixun_service_configs + shixun_service_configs, + fileList, } = this.state; let options; @@ -1265,7 +1438,46 @@ export default class TPMsettings extends Component { ) }) } + const uploadProps = { + width: 600, + fileList, + multiple: true, + // https://github.com/ant-design/ant-design/issues/15505 + // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 + // showUploadList: false, + action: `${getUrl()}/api/attachments.json`, + onChange: this.handleChange, + onRemove: this.onAttachmentRemove, + beforeUpload: (file) => { + // console.log('beforeUpload', file.name); + const isLt150M = file.size / 1024 / 1024 < 50; + if (!isLt150M) { + // this.props.showNotification(`文件大小必须小于50MB`); + notification.open( + { + message: '提示', + description: + '文件大小必须小于50MB', + + } + ) + } + if(thiss.state.file !== undefined){ + console.log("763") + // thiss.deleteAttachment(thiss.state.file); + thiss.setState({ + file:file + }) + }else { + thiss.setState({ + file:file + }) + } + console.log("handleChange2"); + return isLt150M; + }, + } const dateFormat = 'YYYY-MM-DD HH:mm:ss'; let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false; @@ -1391,13 +1603,13 @@ export default class TPMsettings extends Component { }) } - {/**/} - {/*列表中没有?*/} - {/*申请新建*/} - {/*

*/} +

+ 列表中没有? + 申请新建 +

-
  • - +
  • + + style={{width:'89%',height:'100px'}} + onInput={this.setlanguagewrite} + value={this.state.languagewrite} + placeholder="请填写该镜像是基于什么语言:示例:Python" + id="demand_info"> +
  • +
    {this.state.languagewritetype===true?"请填写该镜像语言":""}
    +
  • + + +
  • +
    {this.state.systemenvironmenttype===true?"请填写该镜像语言系统环境":""}
    +
  • + + + +
  • +
    {this.state.testcoderunmodetype===true?"请填写该镜像测试代码运行方式":""}
    +
  • + +
    + { + this.state.deleteisnot=== true? + + + 上传附件 + (单个文件50M以内) + + + : + + + 上传附件 + (单个文件50M以内) + + + } +
    +
  • +
    + {this.state.attachmentidstype===true?"请上传附件":""} +
    +
  • + this.sendhideModaly()} + >取消 +
  • - this.sendsure_apply()} - className="task-btn task-btn-orange fr mr12">确定 - this.sendhideModaly()} - >取消
    +
    + + + {/*
    */}
    -
  • +
  • {this.state.languagewritetype===true?"请填写该镜像语言":""}
    -
  • +