|
|
@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div style="display:flex;"> |
|
|
|
<div style="display:flex;"> |
|
|
|
<div style="position:relative;width: 100%;" class="button"> |
|
|
|
<div class="left"> |
|
|
|
<codemirror |
|
|
|
<codemirror |
|
|
|
v-model="exampleData" |
|
|
|
v-model="exampleData" |
|
|
|
:value="codeid" |
|
|
|
:value="codeid" |
|
|
@ -150,7 +150,7 @@ export default { |
|
|
|
theme: "monokai", // 主题 |
|
|
|
theme: "monokai", // 主题 |
|
|
|
extraKeys: { Ctrl: "autocomplete" } // 可以用于为编辑器指定额外的键绑定,以及keyMap定义的键绑定 |
|
|
|
extraKeys: { Ctrl: "autocomplete" } // 可以用于为编辑器指定额外的键绑定,以及keyMap定义的键绑定 |
|
|
|
}, |
|
|
|
}, |
|
|
|
inputTextReg: /^((?!#).*?(,|\(|\[|\{|\s)+)?input(?!\w)\(['|"]([\s\S]+?)['|"]\)/m, |
|
|
|
inputTextReg: /^((?!#).*?(,|\(|\[|\{|\s)+)?input(?!\w)\(['|"]([\s\S]+?)['|"]\)/mg, |
|
|
|
inputReg: /^((?!#).*?(,|\(|\[|\{|\s)+)?(input(?!\w)\(['|"][\s\S]*?['|"]\))/m, |
|
|
|
inputReg: /^((?!#).*?(,|\(|\[|\{|\s)+)?(input(?!\w)\(['|"][\s\S]*?['|"]\))/m, |
|
|
|
exitTextReg: /exit(?!\w)\(['|"]([\s\S]+?)['|"]\)/m, |
|
|
|
exitTextReg: /exit(?!\w)\(['|"]([\s\S]+?)['|"]\)/m, |
|
|
|
exitNotValidReg: /exit(?!\w)\(['|"]([\s\S]+?)['|"]\)/m, |
|
|
|
exitNotValidReg: /exit(?!\w)\(['|"]([\s\S]+?)['|"]\)/m, |
|
|
@ -273,7 +273,7 @@ export default { |
|
|
|
this.$post(this.api.UpdateCode,{ |
|
|
|
this.$post(this.api.UpdateCode,{ |
|
|
|
code: this.sourceCode, |
|
|
|
code: this.sourceCode, |
|
|
|
codeId: this.codeId, |
|
|
|
codeId: this.codeId, |
|
|
|
submit: this.submit //是否点击运行(0未运行,1已运行) |
|
|
|
submit: this.submit |
|
|
|
}).then(res => { |
|
|
|
}).then(res => { |
|
|
|
let result = res.message.result |
|
|
|
let result = res.message.result |
|
|
|
if(result.includes('File ')){ |
|
|
|
if(result.includes('File ')){ |
|
|
@ -291,17 +291,23 @@ export default { |
|
|
|
}else if(!res.message.isError){ |
|
|
|
}else if(!res.message.isError){ |
|
|
|
this.isError = 0 |
|
|
|
this.isError = 0 |
|
|
|
this.modifys += result |
|
|
|
this.modifys += result |
|
|
|
|
|
|
|
newmain.$emit("updateJud",{ |
|
|
|
|
|
|
|
id: res.data.judgmentPointsId, |
|
|
|
|
|
|
|
isError: res.data.isError |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if(!res.message.isError){ |
|
|
|
|
|
|
|
// this.modifys += res.message.result |
|
|
|
|
|
|
|
// }else if(res.message.result.includes('validing:')){ |
|
|
|
|
|
|
|
// this.confirmInput(res.message.result) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
}).catch(err => {}) |
|
|
|
}).catch(err => {}) |
|
|
|
}).catch(err => {}) |
|
|
|
}).catch(err => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
AnswerTips() { |
|
|
|
AnswerTips() { |
|
|
|
|
|
|
|
// let inputTextReg = this.inputTextReg |
|
|
|
|
|
|
|
// let str = `server = int(input('您好!请问您需要什么帮助呢?1 存取款;2 货币兑换;3 咨询\n')` |
|
|
|
|
|
|
|
// str = str.replace(inputTextReg,val => { |
|
|
|
|
|
|
|
// console.log(val.replace(/\n/g,'')) |
|
|
|
|
|
|
|
// return val.replace(/\n/g,'') |
|
|
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
// console.log(str) |
|
|
|
|
|
|
|
// return |
|
|
|
if (this.isSubmit == "") { |
|
|
|
if (this.isSubmit == "") { |
|
|
|
this.submit = 1; |
|
|
|
this.submit = 1; |
|
|
|
if (this.codeid == "") { |
|
|
|
if (this.codeid == "") { |
|
|
@ -314,9 +320,9 @@ export default { |
|
|
|
let inputFuncReg = /input\(['|"]/g |
|
|
|
let inputFuncReg = /input\(['|"]/g |
|
|
|
if (inputTextReg.test(this.exampleData)) { |
|
|
|
if (inputTextReg.test(this.exampleData)) { |
|
|
|
let sourceCode = this.exampleData |
|
|
|
let sourceCode = this.exampleData |
|
|
|
sourceCode = sourceCode.replace(inputTextReg,val => { |
|
|
|
// sourceCode = sourceCode.replace(inputTextReg,val => { |
|
|
|
return val.replace(/[\r\n]/g,'') |
|
|
|
// return console.log(val.replace(/\n'/g,"'")) |
|
|
|
}) |
|
|
|
// }) |
|
|
|
// return console.log(11,sourceCode) |
|
|
|
// return console.log(11,sourceCode) |
|
|
|
|
|
|
|
|
|
|
|
sourceCode = sourceCode.replace(inputFuncReg,val => { |
|
|
|
sourceCode = sourceCode.replace(inputFuncReg,val => { |
|
|
@ -408,7 +414,8 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
.catch(res => { |
|
|
|
|
|
|
|
res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。') |
|
|
|
this.loadIns.close() |
|
|
|
this.loadIns.close() |
|
|
|
}); |
|
|
|
}); |
|
|
|
clearTimeout(this.timer); |
|
|
|
clearTimeout(this.timer); |
|
|
@ -452,6 +459,10 @@ export default { |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
|
|
|
|
|
.left{ |
|
|
|
|
|
|
|
position: relative; |
|
|
|
|
|
|
|
width: calc(100% - 400px); |
|
|
|
|
|
|
|
} |
|
|
|
.text-wrapper { |
|
|
|
.text-wrapper { |
|
|
|
white-space: pre-wrap; |
|
|
|
white-space: pre-wrap; |
|
|
|
} |
|
|
|
} |
|
|
|