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

@ -12,12 +12,6 @@
ref="myCmGenerate" ref="myCmGenerate"
></codemirror> ></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 <el-button
type="warning" type="warning"
@click="AnswerTips()" @click="AnswerTips()"
@ -27,16 +21,23 @@
</div> </div>
<div class="code-right answer"> <div class="code-right answer">
<p class="text-wrapper">{{modifys}}</p> <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"> <div class="code_yes" v-show="this.isError == 0">
<img src="../assets/img/yes.png" alt />运行成功 <img src="../assets/img/yes.png" alt />运行成功
</div> </div>
<div class="code_error" v-show="this.isError == 1"> <div class="code_error" v-show="this.isError == 1">
<img src="../assets/img/error.png" alt /> <img src="../assets/img/error.png" alt />
{{num-1}}行出现错误 {{num}}行出现错误
<!-- <el-button <!-- <el-button
style="color:rgba(255,49,49,1);background:rgba(255,255,255,1);margin-left:80px" style="color:rgba(255,49,49,1);background:rgba(255,255,255,1);margin-left:80px"
>求助</el-button>--> >求助</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-dialog title="答案提示" center :visible.sync="error">
<el-tabs> <el-tabs>
<el-tab-pane label="参考答案">{{answer}}</el-tab-pane> <el-tab-pane label="参考答案">{{answer}}</el-tab-pane>
@ -44,16 +45,6 @@
</el-dialog> </el-dialog>
</div> </div>
</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> </div>
</template> </template>
@ -210,7 +201,7 @@ export default {
// //
if (this.codeId == "") { if (this.codeId == "") {
this.$post(this.api.AddCode, { this.$post(this.api.AddCode, {
code: "#-*-coding:utf-8-*-" + "\n" + this.exampleData, code: this.exampleData,
projectId: this.projectId, projectId: this.projectId,
// projectId: 305, // projectId: 305,
judgmentPointsId: this.workbench1, judgmentPointsId: this.workbench1,
@ -251,7 +242,8 @@ export default {
type: "warning" type: "warning"
}); });
} else { } 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("请输入...", "提示", { this.$prompt("请输入...", "提示", {
confirmButtonText: "确定" confirmButtonText: "确定"
}).then(({ value }) => { }).then(({ value }) => {
@ -259,7 +251,7 @@ export default {
this.datas.push(value); this.datas.push(value);
this.$post(this.api.ChangeCode, { this.$post(this.api.ChangeCode, {
datas: this.datas, datas: this.datas,
code: "#-*-coding:utf-8-*-" + "\n" + this.exampleData code: this.exampleData
}) })
.then(res => { .then(res => {
this.exampleData = res.message; this.exampleData = res.message;
@ -267,12 +259,12 @@ export default {
.catch(err => { .catch(err => {
console.log(err); console.log(err);
}); });
}); }).catch(err => {})
} else { } else {
this.loadIns = Loading.service() this.loadIns = Loading.service()
//() //()
this.$post(this.api.UpdateCode, { this.$post(this.api.UpdateCode, {
code: "#-*-coding:utf-8-*-" + "\n" + this.exampleData, code: this.exampleData,
codeId: this.codeId, codeId: this.codeId,
submit: this.submit //(0,1) submit: this.submit //(0,1)
}) })
@ -309,7 +301,7 @@ export default {
UpdateCode() { UpdateCode() {
//() //()
this.$post(this.api.UpdateCode, { this.$post(this.api.UpdateCode, {
code: "#-*-coding:utf-8-*-" + "\n" + this.exampleData, code: this.exampleData,
codeId: this.codeId, codeId: this.codeId,
submit: this.submit //(0,1) submit: this.submit //(0,1)
}) })
@ -394,7 +386,7 @@ export default {
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
} }
.code-right ::v-deep .el-button { .code-right ::v-deep .tips-btn {
margin-top: 10px; margin-top: 10px;
height: 40px; height: 40px;
width: 90px; width: 90px;
@ -404,9 +396,9 @@ export default {
background: rgba(255, 49, 49, 1); background: rgba(255, 49, 49, 1);
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
} }
.code-right ::v-deep .el-button:hover, .code-right ::v-deep .tips-btn:hover,
.el-button:focus, .tips-btn:focus,
.el-button:active { .tips-btn:active {
background: rgba(255, 49, 49, 1); background: rgba(255, 49, 49, 1);
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
} }
@ -479,4 +471,15 @@ export default {
border-radius: 0; border-radius: 0;
background: #dddddd; background: #dddddd;
} }
.pic-wrap{
position: absolute;
left: 0;
right: 0;
bottom: 5px;
text-align: center;
.pic{
max-width: 80%;
vertical-align: middle;
}
}
</style> </style>

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

Loading…
Cancel
Save