代码里有图片的情况下,图片名加上时间戳

ui
jialong.yu 3 years ago
parent bf85c63e2f
commit 0e57c10c13
  1. 10
      src/components/TestPanel.vue
  2. 19
      src/components/codemirror.vue
  3. 5
      src/views/Home.vue

@ -233,7 +233,7 @@ export default {
this.experimentHint = project.experimentHint
// this.actEndTime = project[0].endTime
this.hintOpen = !res.projectManage.hintOpen // 01
this.$emit("tell", projectId, this.projectPermissions, this.points)
this.$emit('tell', projectId, this.points)
if (this.projectPermissions == 1) {
this.text = "剩余"
var interval = setInterval(() => {
@ -272,7 +272,7 @@ export default {
} else {
this.text = "已用";
//
this.createTime = new Date().getTime();
this.createTime = new Date().getTime()
//
if (this.autoStart) {
this.startCount()
@ -307,7 +307,7 @@ export default {
const item = this.points.find(e => e.judgmentId === judgmentId)
if (item) item.code = code
// debugger
this.$emit("tell", this.projectId, this.projectPermissions, this.points)
this.$emit('tell', projectId, this.points)
this.$emit('recoveryCode', judgmentId + '')
}).catch(() => {
localStorage.removeItem('codeCache')
@ -347,6 +347,8 @@ export default {
//
submit() {
const pointList = this.$parent.workbench
// debugger
console.log(pointList)
if(!pointList.find(e => e.codeId)) return this.$message.error('请先完成实验')
this.$confirm("此操作将视为结束考试, 是否继续?", "提示", {
confirmButtonText: "确定",
@ -367,6 +369,7 @@ export default {
e.codeId && attributesReqList.push({
codeId: e.codeId,
bcId: e.judgmentId,
score: e.score,
isSubmit: 0
})
})
@ -381,6 +384,7 @@ export default {
projectId,
projectName,
assessmentId: this.assessmentId ? this.assessmentId : '',
totalScore: 100,
systemId: 1,
purpose: this.experimentTarget,
attributesReqList

@ -235,7 +235,8 @@ export default {
},
runCode(isWhile) { // isWhiletruewhile
if (!this.isSubmit) {
if (!this.codeVal) {
let code = this.codeVal
if (!code) {
this.$message({
message: "警告哦,内容为空不可运行",
type: "warning"
@ -244,7 +245,7 @@ export default {
let inputTextReg = this.inputTextReg
let inputFuncReg = /input\(['|"]/g
// input
if (inputTextReg.test(this.codeVal)) {
if (inputTextReg.test(code)) {
let sourceCode = this.codeVal
sourceCode = sourceCode.replace(inputTextReg,val => {
return val.replace(/\\n/g,"")
@ -272,7 +273,6 @@ export default {
}else{
this.runResult = modify
}
this.errLine = parseInt(modify.substring(modify.indexOf("line") + 4, modify.length))
this.isError = res.message.isError
}else if(result.includes('validing:')){
@ -284,9 +284,13 @@ export default {
this.loadIns = Loading.service({
background: 'transparent'
})
// savefig(python),savefig
code = code.replace(/\.savefig\(([\u4e00-\u9fa5\w]*?['"])/mg, str => {
return str + Date.now()
})
// Python
this.$post(this.api.runPythonCode, {
code: this.codeVal,
code,
bcId: this.workbench1,
cid: this.courseId,
projectId: this.projectId
@ -296,10 +300,12 @@ export default {
const result = data.runResult
this.loadIns.close()
this.picSrc = ''
this.$emit('update:codeId', res.codeId)
if(photo){
this.isError = data.retResult
this.runResult = ''
this.picSrc = `${photo}?id=${new Date().getTime()}`
const text = result.replace(photo, '')
this.runResult = text
this.picSrc = photo
}else{
//
// 7
@ -319,7 +325,6 @@ export default {
this.isError = data.retResult
this.runResult = result
this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length))
this.$emit('update:codeId', res.codeId)
}
}
}).catch(res => {

@ -133,10 +133,9 @@ export default {
this.$refs.mainindex.getClearTime();
},
// id
getQueryIndex(projectId, projectPermissions, workBench) {
getQueryIndex(projectId, workbench) {
this.projectId = projectId
this.projectPermissions = projectPermissions
this.workbench = workBench
this.workbench = workbench
},
}
};

Loading…
Cancel
Save