整体修改

master
yujialong 4 years ago
parent 5d872fb19d
commit e6136be286
  1. 19
      README.md
  2. 4
      src/assets/element-variables.scss
  3. BIN
      src/assets/img/bg1.png
  4. BIN
      src/assets/img/btn.png
  5. BIN
      src/assets/img/header.png
  6. BIN
      src/assets/img/left.png
  7. BIN
      src/assets/img/right.png
  8. BIN
      src/assets/img/yes.png
  9. 1
      src/assets/styles/var.scss
  10. 165
      src/components/TestPanel.vue
  11. 147
      src/components/codemirror.vue
  12. 16
      src/config/index.js
  13. 3
      src/main.js
  14. 11
      src/utils/api.js
  15. 121
      src/views/Home.vue
  16. 3
      vue.config.js

@ -1,19 +0,0 @@
# python_demo
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

@ -1,6 +1,6 @@
/* 改变主题色变量 */ /* 改变主题色变量 */
@import 'styles/var.scss';
$--color-primary: #239685; $--color-primary: $main-color;
/* 改变 icon 字体路径变量,必需 */ /* 改变 icon 字体路径变量,必需 */

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

@ -0,0 +1 @@
$main-color: #5786fc;

@ -3,7 +3,7 @@
<el-container class="scrollbar" v-if="ishow"> <el-container class="scrollbar" v-if="ishow">
<el-header> <el-header>
<div class="flex between"> <div class="flex between">
<div class="flex"> <div class="flex" style="width: 28%">
<p>实训项目</p> <p>实训项目</p>
<el-select <el-select
v-model="value1" v-model="value1"
@ -11,6 +11,7 @@
class="select" class="select"
:disabled="projectPermissions != 0" :disabled="projectPermissions != 0"
@change="selectProject" @change="selectProject"
style="flex: 1"
> >
<el-option <el-option
v-for="item in value" v-for="item in value"
@ -43,7 +44,7 @@
v-show="projectPermissions == 0" v-show="projectPermissions == 0"
@click="reload" @click="reload"
>重新开始</el-button> >重新开始</el-button>
<el-button style="margin-right:7px" @click="Submit()" :disabled="isSubmit">提交</el-button> <el-button class="submit-btn" style="margin-right:7px" @click="Submit()" :disabled="isSubmit">提交</el-button>
</div> </div>
</div> </div>
</el-header> </el-header>
@ -55,7 +56,9 @@
<p>实验目标</p> <p>实验目标</p>
</div> </div>
<div class="font_css"> <div class="font_css">
<p class="experimentalGoal">{{experimentalGoal}}</p> <div class="experimentalGoal">
<div class="break-all" v-html="experimentalGoal"></div>
</div>
</div> </div>
</div> </div>
<div class="aside-footer"> <div class="aside-footer">
@ -94,7 +97,9 @@
</el-aside> </el-aside>
<el-main> <el-main>
<el-tabs v-model="activeName" type="card"> <el-tabs v-model="activeName" type="card">
<el-tab-pane label="案例" name="first">{{caseDescription}}</el-tab-pane> <el-tab-pane label="案例" name="first">
<div class="break-all" v-html="caseDescription"></div>
</el-tab-pane>
<el-tab-pane label="实验要求" name="second"> <el-tab-pane label="实验要求" name="second">
<el-collapse v-model="activeNames"> <el-collapse v-model="activeNames">
<el-collapse-item v-for="(loop, index) in points" :key="index"> <el-collapse-item v-for="(loop, index) in points" :key="index">
@ -102,11 +107,13 @@
<i class="el-icon-s-ticket"></i> <i class="el-icon-s-ticket"></i>
<span style="font-size:16px">{{loop.judgmentPointsName}}</span> <span style="font-size:16px">{{loop.judgmentPointsName}}</span>
</template> </template>
<div>{{loop.experimentalRequirements}}</div> <div class="break-all" v-html="loop.experimentalRequirements"></div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="实验提示" name="fifth" >{{experimentSuggests}}</el-tab-pane> <el-tab-pane label="实验提示" name="fifth" >
<div class="break-all" v-html="experimentSuggests"></div>
</el-tab-pane>
</el-tabs> </el-tabs>
</el-main> </el-main>
</el-container> </el-container>
@ -154,6 +161,7 @@ function formatDate(fmt,date) {
export default { export default {
data() { data() {
return { return {
systemId: this.$config.systemId,
test: [], test: [],
ishow: false, ishow: false,
grade: "00", grade: "00",
@ -195,6 +203,8 @@ export default {
stopTime: '', stopTime: '',
isSelected: false, isSelected: false,
userId: '', userId: '',
workbenchCus: this.workbench,
isRecovery: false
}; };
}, },
watch: { watch: {
@ -233,6 +243,10 @@ export default {
codeId: { codeId: {
type: Number, type: Number,
default: 0 default: 0
},
workbench: {
type: Array,
default: []
} }
}, },
computed: { computed: {
@ -262,6 +276,29 @@ export default {
this.getQueryProject(); this.getQueryProject();
}else{ }else{
this.getProjects(); this.getProjects();
let codeCache = localStorage.getItem('codeCache')
if(codeCache){
codeCache = JSON.parse(codeCache)
if(codeCache.systemId && codeCache.systemId == this.$config.systemId){
this.$confirm('是否要继续上次的实验?', '提示', {
confirmButtonText: '是',
cancelButtonText: '否',
type: 'success'
}).then(() => {
this.value1 = codeCache.projectId
this.workbenchCus = codeCache.workbench
this.isRecovery = true
this.selectProject()
let codeIds = []
codeCache.workbench.map(n => codeIds.push(n.code.codeId))
codeIds = codeIds.filter(n => n)
this.codeIds = codeIds
this.$emit('recoveryCode',codeCache.workbench1)
}).catch(() => {
localStorage.removeItem('codeCache')
})
}
}
} }
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)
@ -271,6 +308,14 @@ export default {
let codeId = this.codeid; let codeId = this.codeid;
this.codeIds.push(codeId); this.codeIds.push(codeId);
}); });
// tableData
newmain.$on("updateJud", item => {
let list = this.tableData
list.map(n => {
if(n.judgmentPointsId == item.id) n.isError = item.isError
})
this.tableData = list
});
}, },
methods: { methods: {
checkVer() { checkVer() {
@ -288,12 +333,30 @@ export default {
// //
reload() { reload() {
this.$post(this.api.DeleteCodes, this.codeIds).then(res => { this.$post(this.api.DeleteCodes, this.codeIds).then(res => {
this.getClearTime(); this.getClearTime()
this.$router.go(0); localStorage.removeItem('codeCache')
this.startCountFn(); this.codeIds = []
this.isSubmit = false
newmain.$emit("isSubmit", this.isSubmit)
let workbench = this.workbench
workbench.map(n => {
n.code = {
code: '',
codeId: ''
}
})
this.$emit('recoveryCode',workbench)
let tableData = this.tableData
tableData.map(n => {
delete n.score
delete n.right
})
this.tableData = JSON.parse(JSON.stringify(tableData))
this.startCountFn()
}); });
}, },
Submit() { Submit() {
if(!this.codeIds.length) return this.$message.error('请先完成实验')
this.$confirm("此操作将视为结束考试, 是否继续?", "提示", { this.$confirm("此操作将视为结束考试, 是否继续?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
@ -326,9 +389,23 @@ export default {
} }
}) })
.then(res => { .then(res => {
this.assessmentId && (this.isSubmit = true); localStorage.removeItem('codeCache')
this.isSubmit = true
newmain.$emit("isSubmit", this.isSubmit); newmain.$emit("isSubmit", this.isSubmit);
this.tableData = res.message; let list = res.message
let workbench = this.workbenchCus.length ? this.workbenchCus : this.workbench
let result = []
workbench.map(n => {
result.push(list.find(e => e.judgmentPointsId == n.judgmentPointsId))
})
let tableData = this.tableData
result.map(n => {
if(tableData.find(e => e.judgmentPointsId == n.judgmentPointsId).isError){
n.score = 0
n.right = -1
}
})
this.tableData = result
// //
var s = 0; var s = 0;
this.tableData.forEach(element => { this.tableData.forEach(element => {
@ -381,11 +458,12 @@ export default {
this.projectId = type == 2 ? project[0].projectId : this.projectId this.projectId = type == 2 ? project[0].projectId : this.projectId
if(type == 2) this.getQueryProject(0,1) if(type == 2) this.getQueryProject(0,1)
this.projectPermissions = type == 1 ? project[0].projectPermissions : this.projectPermissions this.projectPermissions = type == 1 ? project[0].projectPermissions : this.projectPermissions
this.$emit("tell", this.value1, this.projectPermissions); this.$emit("tell", this.value1, this.projectPermissions,this.isRecovery ? this.workbenchCus : []);
this.experimentalGoal = project[0].experimentalGoal; this.experimentalGoal = project[0].experimentalGoal;
this.caseDescription = project[0].caseDescription; this.caseDescription = project[0].caseDescription;
this.experimentSuggests = project[0].experimentSuggests; this.experimentSuggests = project[0].experimentSuggests;
this.actEndTime = project[0].endTime; this.actEndTime = project[0].endTime;
this.isRecovery = false
}, },
getQueryProject(projectId,type) { getQueryProject(projectId,type) {
//++++ //++++
@ -457,8 +535,9 @@ export default {
}, },
getProjects(){ getProjects(){
let data = { let data = {
systemId: 5, systemId: this.systemId,
schoolId: this.schoolId // schoolId: this.schoolId
schoolId: ''
} }
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)
@ -467,7 +546,12 @@ export default {
selectProject(){ selectProject(){
this.isSelected = true this.isSelected = true
this.assessmentId = '' this.assessmentId = ''
this.judgmentPointsIds = []
this.codeIds = []
this.getQueryProject(this.value1) this.getQueryProject(this.value1)
this.isSubmit = false
this.countVal = 0
newmain.$emit("isSubmit", this.isSubmit)
}, },
counterFn(counterTime) { counterFn(counterTime) {
let leave1 = counterTime % (24 * 3600 * 1); // let leave1 = counterTime % (24 * 3600 * 1); //
@ -523,15 +607,16 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.break-all{
word-break: break-all;
}
.m_step { .m_step {
height: 150px; height: 150px;
width: 35px;
cursor: pointer; cursor: pointer;
display: block !important; display: block !important;
} }
.n_step { .n_step {
height: 150px; height: 150px;
width: 35px;
cursor: pointer; cursor: pointer;
display: block !important; display: block !important;
} }
@ -544,6 +629,7 @@ export default {
font-size: 16px; font-size: 16px;
margin: 0px 20px 10px 10px; margin: 0px 20px 10px 10px;
white-space: pre-wrap; white-space: pre-wrap;
background: #fff url(../assets/img/bg1.png) top right no-repeat;
} }
::v-deep .el-collapse-item__wrap { ::v-deep .el-collapse-item__wrap {
@ -558,7 +644,7 @@ export default {
::v-deep .el-icon-s-ticket:before { ::v-deep .el-icon-s-ticket:before {
font-size: 16px; font-size: 16px;
padding: 5px; padding: 5px;
color: #239685; color: $main-color;
} }
::v-deep .el-collapse-item__arrow { ::v-deep .el-collapse-item__arrow {
margin: 0 5px 0 0; margin: 0 5px 0 0;
@ -568,7 +654,7 @@ export default {
font-size: 12px; font-size: 12px;
padding: 1px; padding: 1px;
margin-left: 10px; margin-left: 10px;
background-color: #239685; background-color: $main-color;
border-radius: 50%; border-radius: 50%;
color: #ffffff; color: #ffffff;
} }
@ -593,7 +679,7 @@ export default {
} }
::v-deep .el-tabs__item.is-active { ::v-deep .el-tabs__item.is-active {
color: #fff; color: #fff;
background-color: #239685; background-color: $main-color;
} }
::v-deep .el-tabs__header { ::v-deep .el-tabs__header {
padding: 5px 20px; padding: 5px 20px;
@ -618,8 +704,8 @@ export default {
background-color: #fff; background-color: #fff;
} }
.header_h { .header_h {
height: 40px; height: 50px;
background-color: #239685; background: url(../assets/img/header.png) 0 0/100% 100% no-repeat;
justify-content: center; justify-content: center;
} }
.header_h i { .header_h i {
@ -631,13 +717,17 @@ export default {
color: #fff; color: #fff;
padding-left: 10px; padding-left: 10px;
} }
/deep/.el-card{
border: 0;
border-radius: 0;
}
// //
::v-deep .el-card__body { ::v-deep .el-card__body {
padding: 0; padding: 0;
} }
::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td { ::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
background: #fff9e6; background: #eef7ff;
} }
::v-deep .el-table td, ::v-deep .el-table td,
.el-table th.is-leaf { .el-table th.is-leaf {
@ -649,20 +739,28 @@ export default {
::v-deep .el-table thead { ::v-deep .el-table thead {
color: #ffffff; color: #ffffff;
font-size: 10px; font-size: 10px;
th{
padding: 5px 0;
}
} }
::v-deep .el-table th, ::v-deep .el-table th,
.el-table tr { .el-table tr {
background-color: #202020; background-color: #badfff;
} }
::v-deep .el-table { ::v-deep .el-table {
font-size: 12px; font-size: 12px;
color: #202020; color: #202020;
} }
/deep/.el-collapse-item__content{
padding-left: 10px;
padding-right: 10px;
}
//.el-header //.el-header
.el-header { .el-header {
color: #333; color: #333;
padding: 0 12px; padding: 0 12px 0 20px;
} }
.between { .between {
justify-content: space-between; justify-content: space-between;
@ -693,12 +791,11 @@ export default {
content: "\e78f"; content: "\e78f";
font-size: 16px; font-size: 16px;
padding: 3px; padding: 3px;
background-color: #239685; background-color: $main-color;
border-radius: 50%; border-radius: 50%;
color: #ffffff; color: #ffffff;
} }
.select ::v-deep .el-input--suffix .el-input__inner { .select ::v-deep .el-input--suffix .el-input__inner {
width: 90%;
color: #333; color: #333;
font-size: 14px; font-size: 14px;
border-radius: 30px; border-radius: 30px;
@ -712,7 +809,6 @@ export default {
} }
.select ::v-deep .el-input { .select ::v-deep .el-input {
width: 80%;
padding: 10px 0; padding: 10px 0;
} }
// //
@ -731,25 +827,30 @@ export default {
text-align: center; text-align: center;
} }
.gradeSpan { .gradeSpan {
color: #ffffff; color: #878787;
padding: 10px; padding: 10px;
font-size: 14px; font-size: 14px;
background: #000000; background: #e0e0e0;
border-radius: 6px; border-radius: 6px;
text-align: center; text-align: center;
} }
// //
.el-header ::v-deep .el-button { .el-header ::v-deep .el-button {
background-color: #239685; background-color: $main-color;
color: #fff; color: #fff;
border: none; border: none;
margin: 5px 0px 5px 5px; margin: 5px 0px 5px 5px;
font-size: 16px; font-size: 16px;
} }
.el-header .submit-btn{
padding-left: 30px;
padding-right: 30px;
background: $main-color url(../assets/img/btn.png) 0 0/100% 100% no-repeat;
}
.el-header ::v-deep .el-button:hover, .el-header ::v-deep .el-button:hover,
.el-button:focus, .el-button:focus,
.el-button:active { .el-button:active {
background-color: #239685; background-color: $main-color;
color: #fff; color: #fff;
} }
@ -779,7 +880,7 @@ export default {
} }
// //
.scrollbar ::-webkit-scrollbar-thumb { .scrollbar ::-webkit-scrollbar-thumb {
background-color: #239685; background-color: $main-color;
border-radius: 3px; border-radius: 3px;
box-shadow: inset 0 0 5px #dddddd; box-shadow: inset 0 0 5px #dddddd;
} }

@ -11,12 +11,13 @@
@input="onCmCodeChange" @input="onCmCodeChange"
ref="myCmGenerate" ref="myCmGenerate"
></codemirror> ></codemirror>
<div v-if="isSubmit" class="code-mask"></div>
<el-button <el-button
class="func-btn"
type="warning" type="warning"
@click="AnswerTips()" @click="AnswerTips()"
:disabled="isAnswerTips" :disabled="isAnswerTips"
style="width:100px;position:absolute;z-index:99;background:#239685;color:#fff;right: 50px;bottom:15px;border-color: #239685"
>运行</el-button> >运行</el-button>
</div> </div>
<div class="code-right answer"> <div class="code-right answer">
@ -25,7 +26,7 @@
<div style="margin-bottom: 5px;text-align: center"> <div style="margin-bottom: 5px;text-align: center">
<img class="pic" :src="picSrc" alt=""> <img class="pic" :src="picSrc" alt="">
</div> </div>
<el-button type="primary" size="mini" @click="$refs.picLink.click()" style="background:#239685;color:#fff;border-color: #239685">下载图片</el-button> <el-button class="download-btn" type="primary" size="mini" @click="$refs.picLink.click()">下载图片</el-button>
<a ref="picLink" style="display: none;" download="运行结果.png" :href="picSrc">下载图片</a> <a ref="picLink" style="display: none;" download="运行结果.png" :href="picSrc">下载图片</a>
</div> </div>
<div class="code_yes" v-show="this.isError == 0"> <div class="code_yes" v-show="this.isError == 0">
@ -40,7 +41,9 @@
<el-button class="tips-btn" @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="参考答案">
<div class="answer-wrap" v-html="answer"></div>
</el-tab-pane>
</el-tabs> </el-tabs>
</el-dialog> </el-dialog>
</div> </div>
@ -114,6 +117,7 @@ export default {
picVisible: false, picVisible: false,
picSrc: '', picSrc: '',
loadIns: null, loadIns: null,
submiting: false,
cmOption: { cmOption: {
scrollbarStyle: "native", scrollbarStyle: "native",
tabSize: 2, // tab tabSize: 2, // tab
@ -172,7 +176,7 @@ export default {
methods: { methods: {
onCmReady3() { onCmReady3() {
this.$refs.myCmGenerate.codemirror.setSize("auto", "750px"); this.$refs.myCmGenerate.codemirror.setSize("auto", "calc(100vh - 167px)");
}, },
onCmFocus(instance, event) {}, onCmFocus(instance, event) {},
getCookie(cookie_name) { getCookie(cookie_name) {
@ -195,32 +199,50 @@ export default {
}, },
onCmCodeChange(instance, obj) { onCmCodeChange(instance, obj) {
this.submit = 0; if(!this.submiting){
this.projectId = this.projectId; this.submiting = true
this.studentId = this.getCookie("studentId");
//
if (this.codeId == "") {
this.$post(this.api.AddCode, {
code: this.exampleData,
projectId: this.projectId,
// projectId: 305,
judgmentPointsId: this.workbench1,
studentId: this.studentId,
// studentId: 54,
submit: this.submit
})
.then(res => {
this.codeId = res.message;
newmain.$emit("codeid", this.codeId);
})
.catch(err => {});
} else {
//
// this.timer = setTimeout(this.UpdateCode, 300000);
this.submit = 0; this.submit = 0;
this.projectId = this.projectId;
this.userId = this.getCookie("userId");
this.studentId = this.getCookie("studentId");
//
if (this.codeId == "") {
this.$post(this.api.AddCode, {
code: this.exampleData,
projectId: this.projectId,
// projectId: 305,
judgmentPointsId: this.workbench1,
userId: parseInt(this.userId),
studentId: this.studentId,
// studentId: 54,
submit: this.submit
})
.then(res => {
this.codeId = res.message;
this.submiting = false
newmain.$emit("codeid", this.codeId);
})
.catch(err => {});
} else {
//
// this.timer = setTimeout(this.UpdateCode, 300000);
this.submit = 0;
}
} }
}, },
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()
},
AnswerTips() { AnswerTips() {
// this.$post(this.api.AddCode, { // this.$post(this.api.AddCode, {
// // headers: {code: "#-*-coding:utf-8-*-"}, // // headers: {code: "#-*-coding:utf-8-*-"},
@ -242,8 +264,8 @@ export default {
type: "warning" type: "warning"
}); });
} else { } else {
// return console.log(11,/^((?!#).*?(,|\(|\[|\{|\s)+)?input(?!\w)(,|\(|\)|\[|\]|\{|\}|\s)?/m.test(this.exampleData)) // if (/^((?!#).*?(,|\(|\[|\{|\s)+)?input(?!\w)(,|\(|\)|\[|\]|\{|\}|\s)?/m.test(this.exampleData)) {
if (/^((?!#).*?(,|\(|\[|\{|\s)+)?input(?!\w)(,|\(|\)|\[|\]|\{|\}|\s)?/m.test(this.exampleData)) { if (false) {
this.$prompt("请输入...", "提示", { this.$prompt("请输入...", "提示", {
confirmButtonText: "确定" confirmButtonText: "确定"
}).then(({ value }) => { }).then(({ value }) => {
@ -261,7 +283,9 @@ export default {
}); });
}).catch(err => {}) }).catch(err => {})
} else { } else {
this.loadIns = Loading.service() this.loadIns = Loading.service({
background: 'transparent'
})
//() //()
this.$post(this.api.UpdateCode, { this.$post(this.api.UpdateCode, {
code: this.exampleData, code: this.exampleData,
@ -272,16 +296,32 @@ export default {
this.loadIns.close() this.loadIns.close()
this.picSrc = '' this.picSrc = ''
if(typeof res.message == 'string'){ if(typeof res.message == 'string'){
this.picSrc = res.message this.isError = res.message.isError;
this.modifys = ''
this.picSrc = `${res.message}?id=${new Date().getTime()}`
newmain.$emit("updateJud",{
id: res.data.judgmentPointsId,
isError: res.data.isError
})
}else{ }else{
this.isError = res.message.isError; this.isError = res.message.isError;
newmain.$emit("updateJud",{
id: res.data.judgmentPointsId,
isError: res.data.isError
})
var modify = res.message.result; var modify = res.message.result;
this.modifys = modify; this.modifys = modify;
this.after = modify.substring( this.after = modify.substring(
modify.indexOf("line") + 4, modify.indexOf("line") + 4,
modify.length modify.length
); );
this.num = parseInt(this.after); this.num = parseInt(this.after);
if(this.projectId == 593){
let str = /\d+\.\d+/.exec(modify)
if(str.length){
this.modifys = str[0]
}
}
} }
}) })
.catch(err => { .catch(err => {
@ -369,12 +409,6 @@ export default {
color: #fff !important; color: #fff !important;
background-color: #333 !important; background-color: #333 !important;
} }
// .answer ::v-deep .el-tabs__item.is-active:hover,
// .el-tabs__item.is-active:focus,
// .el-tabs__item.is-active:active {
// color: #333 !important;
// background-color: #239685 !important;
// }
::v-deep .CodeMirror-wrap pre.CodeMirror-line, ::v-deep .CodeMirror-wrap pre.CodeMirror-line,
.CodeMirror-wrap pre.CodeMirror-line-like { .CodeMirror-wrap pre.CodeMirror-line-like {
@ -415,7 +449,7 @@ export default {
margin-right: 10px; margin-right: 10px;
} }
.code_yes { .code_yes {
color: #239685; color: $main-color;
background-color: rgba(43, 40, 22, 1); background-color: rgba(43, 40, 22, 1);
} }
.code_error { .code_error {
@ -430,13 +464,14 @@ export default {
left: 20px; left: 20px;
right: 20px; right: 20px;
padding: 0 10px; padding: 0 10px;
// padding-right: 20px;
box-sizing: border-box; box-sizing: border-box;
} }
.code-right p { .code-right p {
font-size: 18px; font-size: 18px;
margin: 10px; margin: 10px;
position: absolute; position: absolute;
height: calc(100vh - 230px);
overflow: auto;
} }
.code-right { .code-right {
width: 500px; width: 500px;
@ -448,7 +483,7 @@ export default {
.button ::v-deep .el-button--warning:hover, .button ::v-deep .el-button--warning:hover,
.el-button--warning:focus, .el-button--warning:focus,
.el-button--warning:active { .el-button--warning:active {
background: #239685; background: $main-color;
color: #333; color: #333;
} }
.flex { .flex {
@ -461,7 +496,7 @@ export default {
} }
// //
.scrollbar ::-webkit-scrollbar-thumb { .scrollbar ::-webkit-scrollbar-thumb {
background-color: #239685; background-color: $main-color;
border-radius: 3px; border-radius: 3px;
box-shadow: inset 0 0 5px #dddddd; box-shadow: inset 0 0 5px #dddddd;
} }
@ -482,4 +517,32 @@ export default {
vertical-align: middle; vertical-align: middle;
} }
} }
.code-mask{
z-index: 2;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.func-btn{
width:100px;
position:absolute;
z-index:99;
background:$main-color;
color:#fff !important;
right: 50px;
bottom:15px;
border-color: $main-color;
}
.download-btn{
background:$main-color;
color:#fff;
border-color: $main-color
}
/deep/.answer-wrap{
img{
max-width: 100%;
}
}
</style> </style>

@ -0,0 +1,16 @@
export default {
/**
* @description 配置显示在浏览器标签的title
*/
title: '大数据分析实验教学系统',
/**
* @description 是否使用国际化默认为false
* 如果不使用则需要在路由中给需要在菜单中展示的路由设置meta: {title: 'xxx'}
* 用来在菜单中显示文字
*/
locale: 'zh',
/**
* @description 跳转子系统链接
*/
systemId: 8
}

@ -16,6 +16,7 @@ import "codemirror/lib/codemirror.css";
import vuescroll from "vuescroll"; //引入vuescroll import vuescroll from "vuescroll"; //引入vuescroll
import "vuescroll/dist/vuescroll.css"; //引入vuescroll样式 import "vuescroll/dist/vuescroll.css"; //引入vuescroll样式
import VueDraggableResizable from 'vue-draggable-resizable' import VueDraggableResizable from 'vue-draggable-resizable'
import config from '@/config'
// optionally import default styles // optionally import default styles
import 'vue-draggable-resizable/dist/VueDraggableResizable.css' import 'vue-draggable-resizable/dist/VueDraggableResizable.css'
@ -32,6 +33,8 @@ Vue.prototype.$post = post;
Vue.prototype.$del = del; Vue.prototype.$del = del;
Vue.prototype.$put = put; Vue.prototype.$put = put;
Vue.prototype.$config = config
Vue.config.productionTip = false; Vue.config.productionTip = false;
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {

@ -1,6 +1,11 @@
// let host = 'http://192.168.0.113' // 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://www.liuwanr.cn/python' let host = ''
if(location.host.includes('liuwanr.cn')){
host = 'http://www.liuwanr.cn/python'
}else{
host = 'http://www.occupationlab.com/python'
}
export default { export default {
QueryProject: `${host}/python/queryProject`, //项目选择下拉框+项目信息+判分点信息展示 QueryProject: `${host}/python/queryProject`, //项目选择下拉框+项目信息+判分点信息展示

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<div class="flex header"> <div class="flex header">
<p>python可视化</p> <p>{{$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>
@ -21,6 +21,7 @@
:value="item.judgmentPointsId" :value="item.judgmentPointsId"
> >
<codemirror <codemirror
:key="codeKey"
:projectId.sync="projectId" :projectId.sync="projectId"
:code.sync="item.code.code" :code.sync="item.code.code"
:workbench1="item.judgmentPointsId" :workbench1="item.judgmentPointsId"
@ -33,12 +34,14 @@
<div class="menu"> <div class="menu">
<testPanel <testPanel
@tell="getQueryIndex" @tell="getQueryIndex"
@recoveryCode="recoveryCode"
ref="mainindex" ref="mainindex"
:autoStart="autoStart" :autoStart="autoStart"
:sendSync="sendSync" :sendSync="sendSync"
:defaultVal="defaultVal" :defaultVal="defaultVal"
@getDataFromChild="getDataFromChild" @getDataFromChild="getDataFromChild"
:codeId="codeId" :codeId="codeId"
:workbench="workbench"
:key="codeId" :key="codeId"
></testPanel> ></testPanel>
</div> </div>
@ -76,6 +79,7 @@ export default {
return { return {
// //
isShow: false, isShow: false,
projectPermissions: 0, //(0 1 2)
ops: { ops: {
vuescroll: {}, vuescroll: {},
scrollPanel: {}, scrollPanel: {},
@ -94,7 +98,7 @@ export default {
codeId: 0, codeId: 0,
value: "Python", value: "Python",
workbench1: "", // workbench1: "", //
workbench: {}, workbench: [],
editableTabs: [], editableTabs: [],
tabIndex: 2, tabIndex: 2,
name: "", name: "",
@ -105,16 +109,27 @@ export default {
assessmentId: '', assessmentId: '',
defaultVal: sessionStorage.getItem("timer") defaultVal: sessionStorage.getItem("timer")
? parseInt(sessionStorage.getItem("timer")) ? parseInt(sessionStorage.getItem("timer"))
: 0 : 0,
codeKey: 1,
host: location.host.includes('liuwanr.cn') ? 'http://www.liuwanr.cn/' : 'http://www.occupationlab.com/'
}; };
}, },
components: { components: {
codemirror, codemirror,
testPanel testPanel
}, },
beforeDestroy(){
let data = {
studentId: this.studentId,
startTime: this.entryTime,
endTime: formatDate('yyyy-MM-dd hh:mm:ss'),
projectId: this.projectId
}
this.$post(this.api.saveEvaluation,data).then(res => {})
this.leavePage()
},
mounted() { mounted() {
this.assessmentId = this.getCookie("assessmentId"); this.assessmentId = this.getCookie("assessmentId");
this.addLeaveEvent()
if (window.history && window.history.pushState) { if (window.history && window.history.pushState) {
// //
history.pushState(null, null, document.URL); history.pushState(null, null, document.URL);
@ -125,34 +140,46 @@ export default {
window.removeEventListener("popstate", this.goBack, false); window.removeEventListener("popstate", this.goBack, false);
}, },
methods: { methods: {
leavePage(){
if(!this.$refs.mainindex.isSubmit && !this.assessmentId && this.workbench.length){
let workbench = this.workbench
if(workbench.some(n => n.code.code)){
let codeCache = {
systemId: this.$config.systemId,
projectId: this.projectId,
workbench1: this.workbench1,
workbench
}
localStorage.setItem('codeCache',JSON.stringify(codeCache))
}
}
},
goBack() { goBack() {
console.log("点击了浏览器的返回按钮"); this.leavePage()
this.$router.replace({ path: "/" }); history.back()
}, },
getDataFromChild(data) { getDataFromChild(data) {
sessionStorage.setItem("timer", parseInt(data)); sessionStorage.setItem("timer", parseInt(data));
}, },
addLeaveEvent(){ recoveryCode(workbench){
this.$once('hook:beforeDestroy', function () { this.workbench = workbench
let data = { this.codeKey++
studentId: this.studentId, this.workbench1 = '0'
startTime: this.entryTime, },
endTime: formatDate('yyyy-MM-dd hh:mm:ss'), reload(){
projectId: this.projectId this.$refs.mainindex.reload()
}
this.$post(this.api.saveEvaluation,data).then(res => {});
})
}, },
back() { back() {
// window.location = "http://www.liuwanr.cn:8080/client/#/student"; this.leavePage()
// window.location = "http://www.occupationlab.com/client/#/student"; if(this.projectPermissions){
// history.back() location.href = `${this.host}hrClient/#/dashboard#2`
location.href = 'http://www.liuwanr.cn/hrClient/#/dashboard#1' }else{
location.href = `${this.host}hrClient/#/dashboard#1`
}
this.$refs.mainindex.getClearTime(); this.$refs.mainindex.getClearTime();
}, },
// //
getQueryIndex(value1, projectPermissions) { getQueryIndex(value1, projectPermissions,workBench) {
// //
this.projectId = value1; this.projectId = value1;
this.projectPermissions = projectPermissions; this.projectPermissions = projectPermissions;
@ -163,16 +190,20 @@ export default {
// studentId: 54 // studentId: 54
}) })
.then(res => { .then(res => {
this.workbench = res.message; if(workBench.length){
this.workbench.map(item => { this.workbench = workBench
if (item.code.codeId == 0) { }else{
item.code.codeId = ""; this.workbench = res.message;
} this.workbench.map(item => {
// if (this.projectPermissions == "0") { if (item.code.codeId == 0) {
// item.code.codeId = ""; item.code.codeId = "";
// item.code.code = ""; }
// } if (this.projectPermissions == "0") {
}); item.code.codeId = "";
item.code.code = "";
}
});
}
this.assessmentId && (this.codeId = this.workbench[0].code.codeId) this.assessmentId && (this.codeId = this.workbench[0].code.codeId)
}) })
.catch(err => { .catch(err => {
@ -222,7 +253,7 @@ export default {
} }
::v-deep .el-dialog__headerbtn .el-icon-close:before { ::v-deep .el-dialog__headerbtn .el-icon-close:before {
padding: 3px; padding: 3px;
background-color: #239685; background-color: $main-color;
border-radius: 50%; border-radius: 50%;
color: #ffffff; color: #ffffff;
} }
@ -239,7 +270,7 @@ export default {
} }
.tab ::v-deep .el-tabs__item.is-active { .tab ::v-deep .el-tabs__item.is-active {
color: #fff; color: #fff;
background-color: #239685; background-color: $main-color;
} }
.tab ::v-deep .el-icon-circle-plus-outline:before { .tab ::v-deep .el-icon-circle-plus-outline:before {
font-size: 16px; font-size: 16px;
@ -275,7 +306,7 @@ export default {
width: 10%; width: 10%;
} }
.center ::v-deep .el-input.is-disabled .el-input__inner { .center ::v-deep .el-input.is-disabled .el-input__inner {
// border-color: #239685; // border-color: $main-color;
border-radius: 30px; border-radius: 30px;
} }
// //
@ -287,24 +318,28 @@ export default {
.el-button--primary:hover, .el-button--primary:hover,
.el-button--primary:active { .el-button--primary:active {
border: none; border: none;
background-color: #239685; background-color: $main-color;
} }
.bt ::v-deep .el-button { .bt ::v-deep .el-button {
padding: 23px 50px;
border-radius: 0; border-radius: 0;
border: none; border: none;
} }
.bt .restart{
color: #868686;
background-color: #e0e0e0;
}
.header p { .header p {
font-size: 16px; font-size: 20px;
font-weight: 700; color: #333;
color: rgba(51, 51, 51, 1);
margin-left: 18px; margin-left: 18px;
} }
.header { .header {
background-color: #f8f8f8; background-color: #f8f8f8;
justify-content: space-between; justify-content: space-between;
height: 40px; height: 58px;
line-height: 40px; line-height: 58px;
} }
// //
p { p {
@ -320,7 +355,7 @@ p {
} }
// //
::v-deep ::-webkit-scrollbar-thumb { ::v-deep ::-webkit-scrollbar-thumb {
background-color: #239685; background-color: $main-color;
border-radius: 3px; border-radius: 3px;
-webkit-box-shadow: inset 0 0 5px #dddddd; -webkit-box-shadow: inset 0 0 5px #dddddd;
} }
@ -349,7 +384,7 @@ p {
content: "\e78f"; content: "\e78f";
font-size: 16px; font-size: 16px;
padding: 3px; padding: 3px;
background-color: #239685; background-color: $main-color;
border-radius: 50%; border-radius: 50%;
color: #ffffff; color: #ffffff;
} }

@ -12,6 +12,9 @@ module.exports = {
lintOnSave: true, lintOnSave: true,
css: { css: {
loaderOptions: { loaderOptions: {
sass: {
prependData: `@import "@/assets/styles/var.scss";`
},
postcss: { postcss: {
plugins: [ plugins: [
postcss postcss

Loading…
Cancel
Save