提交联调

ui
jialong.yu 3 years ago
parent 85994d8519
commit aa01c8e99a
  1. 67
      src/components/TestPanel.vue
  2. 61
      src/components/codemirror.vue
  3. 2
      src/config/index.js
  4. 18
      src/util/index.js
  5. 4
      src/views/Home.vue

@ -73,21 +73,25 @@
<el-table :data="taskList" :stripe="true" height="405">
<el-table-column type="index"></el-table-column>
<el-table-column prop="name" label="判分标准" align="center"></el-table-column>
<el-table-column prop="right" label="完成结果" align="center">
<el-table-column label="完成结果" align="center">
<template slot-scope="scope">
<template v-if="isSubmit">
<i
v-if="scope.row.right=='0'"
class="el-icon-check"
style="color:green;font-size:20px"
v-if="scope.row.finishedResult"
class="el-icon-check right"
></i>
<i
v-else-if="scope.row.right=='-1'"
class="el-icon-close"
style="color:red;font-size:20px"
v-else
class="el-icon-close wrong"
></i>
</template>
</template>
</el-table-column>
<el-table-column prop="score" label="得分" align="center">
<template slot-scope="scope">
<template v-if="isSubmit">{{ scope.row.score }}</template>
</template>
</el-table-column>
<el-table-column prop="score1" label="得分" align="center"></el-table-column>
</el-table>
</el-card>
</el-col>
@ -302,14 +306,15 @@ export default {
localStorage.removeItem('codeCache')
this.isSubmit = false
newmain.$emit('isSubmit', this.isSubmit)
const points = this.points
points.map(e => {
e.code = ''
e.codeId = ''
e.answer = ''
})
this.$emit('tell', this.projectId, points)
this.$emit('recoveryCode')
this.startCount()
// let taskList = this.taskList
// taskList.map(n => {
// delete n.score
// delete n.right
// })
// this.taskList = JSON.parse(JSON.stringify(taskList))
},
//
submit() {
@ -358,23 +363,20 @@ export default {
localStorage.removeItem('codeCache')
this.isSubmit = true
newmain.$emit('isSubmit', this.isSubmit)
let list = res.message
let result = []
let list = res.retInfo
let taskList = this.taskList
result.map(n => {
if(taskList.find(e => e.judgmentPointsId == n.judgmentPointsId).isError){
n.score = 0
n.right = -1
var score = 0
taskList.map(e => {
let item = list.find(n => n.judgmentPointsId === e.judgmentId)
if (item) {
e.score = item.score
e.finishedResult = item.finishedResult
} else {
e.score = 0
}
score += e.score
})
this.taskList = result
//
var s = 0;
this.taskList.forEach(element => {
// this.test = element.score;
// s += this.test;
this.grade = s;
});
this.grade = util.handleZero(score)
})
.catch(err => {})
}).catch(() => {})
@ -441,7 +443,6 @@ export default {
cursor: pointer;
display: block !important;
}
//el-main
.el-main {
width: 60%;
background-color: #fff;
@ -689,4 +690,12 @@ export default {
border-radius: 0;
background: #dddddd;
}
.right {
color: #00af00;
font-size: 20px;
}
.wrong {
color: #f00;
font-size: 20px;
}
</style>

@ -161,24 +161,12 @@ export default {
ready() {
this.$refs.myCmGenerate.codemirror.setSize("auto", "calc(100vh - 149px)");
},
//
downloadFile(fileName,url) {
var x = new XMLHttpRequest()
x.open("GET", url, true)
x.responseType = 'blob'
x.onload=function(e) {
var url = window.URL.createObjectURL(x.response)
var a = document.createElement('a')
a.href = url
a.download = fileName
a.click()
}
x.send()
},
// pythoninputinputexitexit
// exitinputpythonexitexitinput
//
// input
/**
* python代码里如果有input函数的话是做了单独的处理的原理是先把所有input函数都替换成exit函数再在exit函数里加上特定标识再通过接口传给后端去执行
* 因为exit函数是跟input有类似的效果就是都会产生阻塞所以python引擎一旦遇到exit进程就会被停止然后返回exit函数里面的值而这个值就是上面说的特定标识加上原本这个input函数里的值
* 然后就可以通过这个返回的值来提示给用户让用户继续输入
* 下面这个函数就是递归执行这个input输入过程的函数
*/
confirmInput(msg){
let receiveResult = msg.replace('validing:','')
this.runResult += receiveResult
@ -299,37 +287,36 @@ export default {
const data = res.code
const photo = data.photoUrl
const result = data.runResult
this.$emit('cache')
this.$emit('cache') //
this.loadIns.close()
this.picSrc = ''
this.$emit('update:codeId', res.codeId)
this.$emit('update:answer', result)
if(photo){
this.isError = ''
const text = result.replace(photo, '')
this.$emit('update:codeId', res.codeId) // coddeId
this.$emit('update:answer', result) //
let imgList = ''
try {
imgList = eval(result)
} catch (error) {}
//
if (photo) {
this.isError = '' //
const text = result.replace(photo, '') //
this.runResult = text
this.picSrc = photo
}else{
//
// 7
if(0){
if(result instanceof Array && result.length && (result[0].includes('.jpg') || result[0].includes('.png') || result[0].includes('.gif'))){
result.map((n,i) => {
this.downloadFile(`${i+1}.jpg`,n)
} else if (imgList instanceof Array && imgList.length && (imgList[0].includes('.jpg') || imgList[0].includes('.png') || imgList[0].includes('img'))) {
/**
* 这段是为要下载图片的项目案例写的后端会返回图片名称的数组前端负责循环这个数组然后下载下来
* 只有该系统有这段代码因为其他7个系统没有下载图片的项目后续如果加了直接把这段代码复制过去即可
*/
imgList.map((n,i) => {
util.downloadFile(`${i+1}.jpg`,n)
})
this.isError = 0
this.runResult = '下载完成'
}else{
this.isError = 0
this.runResult = data.runResult
this.errLine = parseInt(result.substring(modify.indexOf("line") + 4, modify.length))
}
} else {
this.isError = data.retResult
this.runResult = result
this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length))
}
}
}).catch(res => {
res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。')
this.loadIns.close()

@ -7,7 +7,7 @@ if(isHh) {
host = "http://10.196.131.73/";
} else if(isBeta) {
host = "http://39.108.250.202:9000/";
host = "http://192.168.31.151:9000/";
// host = "http://192.168.31.151:9000/";
} else if(isPro) {
host = "http://www.occupationlab.com/";
} else {

@ -38,5 +38,23 @@ export default {
}
}
return fmt
},
// 下载文件
downloadFile(fileName,url) {
var x = new XMLHttpRequest()
x.open("GET", url, true)
x.responseType = 'blob'
x.onload=function(e) {
var url = window.URL.createObjectURL(x.response)
var a = document.createElement('a')
a.href = url
a.download = fileName
a.click()
}
x.send()
},
// 小于0前面加上0
handleZero (num) {
return num < 10 ? '0' + num : num
}
}

@ -74,7 +74,7 @@ export default {
}
},
methods: {
//
//
leavePage(){
const list = this.workbench
if(!this.$refs.mainindex.isSubmit && list.length && list.some(e => e.code)){
@ -82,7 +82,7 @@ export default {
projectId: this.projectId,
judgmentId: list[Number(this.curTab)].judgmentId
}
localStorage.setItem('codeCache', JSON.stringify(cache))
localStorage.setItem('codeCache', JSON.stringify(cache)) // ididid
list.map(e => {
if (e.code) {
let data = {

Loading…
Cancel
Save