yujialong 3 years ago
parent 336dcfdd48
commit 652082414c
  1. BIN
      public/favicon.ico
  2. BIN
      src/assets/img/logo-hh.png
  3. 37
      src/components/codemirror.vue
  4. 6
      src/config/index.js
  5. 2
      src/utils/api.js
  6. 4
      src/utils/http.js
  7. 14
      src/views/Home.vue

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@ -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;
} }

@ -4,10 +4,14 @@ export default {
* @description 域名切换liuwan职站测试环境occupationlab.com职站正式环境10.196.131.73河海版本 * @description 域名切换liuwan职站测试环境occupationlab.com职站正式环境10.196.131.73河海版本
*/ */
host: (process.env.NODE_ENV === 'development' || location.host.includes('liuwanr.cn')) ? 'http://www.liuwanr.cn/' : (location.host.includes('10.196.131.73') ? 'http://10.196.131.73/' : 'http://www.occupationlab.com/'), host: (process.env.NODE_ENV === 'development' || location.host.includes('liuwanr.cn')) ? 'http://www.liuwanr.cn/' : (location.host.includes('10.196.131.73') ? 'http://10.196.131.73/' : 'http://www.occupationlab.com/'),
/**
* @description 是否是河海版本
*/
isHh,
/** /**
* @description 配置显示在浏览器标签的title * @description 配置显示在浏览器标签的title
*/ */
title: isHh ? '智信云Python程序设计教学系统' : 'Python程序设计教学系统', title: isHh ? 'Python程序设计教学系统' : 'Python程序设计教学系统',
/** /**
* @description 是否使用国际化默认为false * @description 是否使用国际化默认为false
* 如果不使用则需要在路由中给需要在菜单中展示的路由设置meta: {title: 'xxx'} * 如果不使用则需要在路由中给需要在菜单中展示的路由设置meta: {title: 'xxx'}

@ -1,6 +1,6 @@
import config from '@/config' import config from '@/config'
// let host = 'http://192.168.31.125:8081/python'//林 // let host = 'http://192.168.31.125:8081/python'//林
// let host = 'http://192.168.31.152:8081/python'//榕 // let host = 'http://192.168.31.151:8081/python'//榕
let host = `${config.host}python` let host = `${config.host}python`
export default { export default {

@ -185,9 +185,7 @@ export function post(url, params) {
); );
break; break;
case 500: case 500:
this.$message.error( reject(res.data)
res.data.errmessage
);
break; break;
case 404: case 404:
this.$message.error( this.$message.error(

@ -1,13 +1,15 @@
<template> <template>
<div> <div>
<div class="flex header"> <div class="flex header" :class="{hh: $config.isHh}">
<p>{{$config.title}}</p> <img v-if="$config.isHh" src="../assets/img/logo-hh.png" alt="" class="logo">
<p v-else>{{$config.title}}</p>
<div class="bt"> <div class="bt">
<el-button type="primary" @click="back()">退出实验</el-button> <el-button type="primary" @click="back()">退出实验</el-button>
</div> </div>
</div> </div>
<div class="flex center"> <div class="flex center">
<p v-if="$config.isHh" style="font-size: 18px">{{$config.title}}</p>
<p>编程语言</p> <p>编程语言</p>
<el-input placeholder="请输入内容" v-model="value" :disabled="true"></el-input> <el-input placeholder="请输入内容" v-model="value" :disabled="true"></el-input>
</div> </div>
@ -352,6 +354,14 @@ export default {
justify-content: space-between; justify-content: space-between;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
&.hh{
padding: 10px 0;
line-height: normal;
}
.logo{
width: 200px;
margin-left: 10px;
}
} }
// //
p { p {

Loading…
Cancel
Save