yujialong 4 years ago
parent 4517a24ffd
commit 5d872fb19d
  1. 4
      src/components/TestPanel.vue
  2. 59
      src/components/codemirror.vue
  3. 14
      src/views/Home.vue

@ -194,7 +194,7 @@ export default {
startTime: '',
stopTime: '',
isSelected: false,
userId: ''
userId: '',
};
},
watch: {
@ -262,7 +262,6 @@ export default {
this.getQueryProject();
}else{
this.getProjects();
}
this.assessmentId && this.projectId && this.checkVer()
this.codeId && this.codeIds.push(this.codeId)
@ -463,7 +462,6 @@ export default {
}
this.$get(`${this.api.queryTestProject}`,data).then(res => {
this.handleData(res.message,2)
}).catch(res => {});
},
selectProject(){

@ -12,12 +12,6 @@
ref="myCmGenerate"
></codemirror>
<el-button
v-if="picSrc"
type="warning"
@click="picVisible = true"
style="width:100px;position:absolute;z-index:99;background:#239685;color:#fff;right: 160px;bottom:15px;border-color: #239685"
>查看图片</el-button>
<el-button
type="warning"
@click="AnswerTips()"
@ -27,16 +21,23 @@
</div>
<div class="code-right answer">
<p class="text-wrapper">{{modifys}}</p>
<div class="pic-wrap" v-if="picSrc">
<div style="margin-bottom: 5px;text-align: center">
<img class="pic" :src="picSrc" alt="">
</div>
<el-button type="primary" size="mini" @click="$refs.picLink.click()" style="background:#239685;color:#fff;border-color: #239685">下载图片</el-button>
<a ref="picLink" style="display: none;" download="运行结果.png" :href="picSrc">下载图片</a>
</div>
<div class="code_yes" v-show="this.isError == 0">
<img src="../assets/img/yes.png" alt />运行成功
</div>
<div class="code_error" v-show="this.isError == 1">
<img src="../assets/img/error.png" alt />
{{num-1}}行出现错误
{{num}}行出现错误
<!-- <el-button
style="color:rgba(255,49,49,1);background:rgba(255,255,255,1);margin-left:80px"
>求助</el-button>-->
<el-button @click="getQueryAnswer()" v-show="ShowAssessmentId">提示</el-button>
<el-button class="tips-btn" @click="getQueryAnswer()" v-show="ShowAssessmentId">提示</el-button>
<el-dialog title="答案提示" center :visible.sync="error">
<el-tabs>
<el-tab-pane label="参考答案">{{answer}}</el-tab-pane>
@ -44,16 +45,6 @@
</el-dialog>
</div>
</div>
<el-dialog title="查看结果" :visible.sync="picVisible" center class="dialog" :close-on-click-modal="false" :fullscreen="true" :append-to-body="true">
<div style="text-align: center">
<img class="pic" :src="picSrc" alt="">
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="$refs.picLink.click()" style="background:#239685;color:#fff;border-color: #239685">下载图片</el-button>
</span>
<a ref="picLink" style="display: none;" download="运行结果.png" :href="picSrc">下载图片</a>
</el-dialog>
</div>
</template>
@ -210,7 +201,7 @@ export default {
//
if (this.codeId == "") {
this.$post(this.api.AddCode, {
code: "#-*-coding:utf-8-*-" + "\n" + this.exampleData,
code: this.exampleData,
projectId: this.projectId,
// projectId: 305,
judgmentPointsId: this.workbench1,
@ -251,7 +242,8 @@ export default {
type: "warning"
});
} else {
if (this.exampleData.indexOf("input") != -1) {
// return console.log(11,/^((?!#).*?(,|\(|\[|\{|\s)+)?input(?!\w)(,|\(|\)|\[|\]|\{|\}|\s)?/m.test(this.exampleData))
if (/^((?!#).*?(,|\(|\[|\{|\s)+)?input(?!\w)(,|\(|\)|\[|\]|\{|\}|\s)?/m.test(this.exampleData)) {
this.$prompt("请输入...", "提示", {
confirmButtonText: "确定"
}).then(({ value }) => {
@ -259,7 +251,7 @@ export default {
this.datas.push(value);
this.$post(this.api.ChangeCode, {
datas: this.datas,
code: "#-*-coding:utf-8-*-" + "\n" + this.exampleData
code: this.exampleData
})
.then(res => {
this.exampleData = res.message;
@ -267,12 +259,12 @@ export default {
.catch(err => {
console.log(err);
});
});
}).catch(err => {})
} else {
this.loadIns = Loading.service()
//()
this.$post(this.api.UpdateCode, {
code: "#-*-coding:utf-8-*-" + "\n" + this.exampleData,
code: this.exampleData,
codeId: this.codeId,
submit: this.submit //(0,1)
})
@ -309,7 +301,7 @@ export default {
UpdateCode() {
//()
this.$post(this.api.UpdateCode, {
code: "#-*-coding:utf-8-*-" + "\n" + this.exampleData,
code: this.exampleData,
codeId: this.codeId,
submit: this.submit //(0,1)
})
@ -394,7 +386,7 @@ export default {
height: 30px;
line-height: 30px;
}
.code-right ::v-deep .el-button {
.code-right ::v-deep .tips-btn {
margin-top: 10px;
height: 40px;
width: 90px;
@ -404,9 +396,9 @@ export default {
background: rgba(255, 49, 49, 1);
color: rgba(255, 255, 255, 1);
}
.code-right ::v-deep .el-button:hover,
.el-button:focus,
.el-button:active {
.code-right ::v-deep .tips-btn:hover,
.tips-btn:focus,
.tips-btn:active {
background: rgba(255, 49, 49, 1);
color: rgba(255, 255, 255, 1);
}
@ -479,4 +471,15 @@ export default {
border-radius: 0;
background: #dddddd;
}
.pic-wrap{
position: absolute;
left: 0;
right: 0;
bottom: 5px;
text-align: center;
.pic{
max-width: 80%;
vertical-align: middle;
}
}
</style>

@ -1,7 +1,7 @@
<template>
<div>
<div class="flex header">
<p>Python程序设计实验教学系统</p>
<p>python可视化</p>
<div class="bt">
<el-button type="primary" @click="back()">退出实验</el-button>
</div>
@ -102,6 +102,7 @@ export default {
autoStart: true,
sendSync: true,
entryTime: formatDate('yyyy-MM-dd hh:mm:ss'),
assessmentId: '',
defaultVal: sessionStorage.getItem("timer")
? parseInt(sessionStorage.getItem("timer"))
: 0
@ -112,6 +113,7 @@ export default {
testPanel
},
mounted() {
this.assessmentId = this.getCookie("assessmentId");
this.addLeaveEvent()
if (window.history && window.history.pushState) {
//
@ -166,12 +168,12 @@ export default {
if (item.code.codeId == 0) {
item.code.codeId = "";
}
if (this.projectPermissions == "0") {
item.code.codeId = "";
item.code.code = "";
}
// if (this.projectPermissions == "0") {
// item.code.codeId = "";
// item.code.code = "";
// }
});
this.workbench[0].code.codeId && (this.codeId = this.workbench[0].code.codeId)
this.assessmentId && (this.codeId = this.workbench[0].code.codeId)
})
.catch(err => {
console.log(err);

Loading…
Cancel
Save