openf12
yujialong 2 years ago
parent ac2f86b339
commit c53b018596
  1. 15
      public/index.html
  2. 3
      src/api/index.js
  3. 239
      src/components/TestPanel.vue
  4. 295
      src/components/codemirror.vue
  5. 6
      src/config/index.js
  6. 977
      src/views/Data.vue
  7. 49
      src/views/Home.vue

@ -1,15 +1,20 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <!-- <meta http-equiv="X-Frame-Options" content="deny" /> -->
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
</head> </head>
<body> <body>
<noscript> <noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong
>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
properly without JavaScript enabled. Please enable it to
continue.</strong
>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->

@ -21,6 +21,7 @@ export default {
getDetailById: 'occupationlab/occupationlab/assessment/getDetailById', getDetailById: 'occupationlab/occupationlab/assessment/getDetailById',
pageStuAssessment: 'occupationlab/occupationlab/assessment/pageStuAssessment', pageStuAssessment: 'occupationlab/occupationlab/assessment/pageStuAssessment',
modelClassList: `nakadai/nakadai/model/reference/modelClassList`, modelClassList: `nakadai/nakadai/model/reference/modelClassList`,
studentModelList: `nakadai/nakadai/model/student/studentModelList`,
referenceDemoList: `nakadai/nakadai/model/reference/demo/referenceDemoList`, referenceDemoList: `nakadai/nakadai/model/reference/demo/referenceDemoList`,
referenceFindById: `nakadai/nakadai/model/reference/demo/findById`, referenceFindById: `nakadai/nakadai/model/reference/demo/findById`,
checkIsShowBySystemId: `nakadai/nakadai/model/reference/checkIsShowBySystemId`, checkIsShowBySystemId: `nakadai/nakadai/model/reference/checkIsShowBySystemId`,
@ -34,4 +35,6 @@ export default {
exportLabReport: `occupationlab/occupationlab/achievement/exportLabReport`, exportLabReport: `occupationlab/occupationlab/achievement/exportLabReport`,
reportDetail: `occupationlab/occupationlab/achievement/reportDetail`, reportDetail: `occupationlab/occupationlab/achievement/reportDetail`,
getCompetition: `competition/competition/management/getCompetition`, getCompetition: `competition/competition/management/getCompetition`,
whetherCanPaste: `nakadai/nakadai/model/demo/whetherCanPaste`,
displayListOrNotByStudent: `nakadai/nakadai/model/demo/displayListOrNotByStudent`,
} }

@ -1,29 +1,30 @@
<template> <template>
<div :class="['panel', {active: pannelVisible}]" id="panel"> <div :class="['panel', {active: pannelVisible}]"
<el-container class="scrollbar" v-if="pannelVisible"> id="panel">
<el-header> <el-container class="scrollbar"
v-if="pannelVisible">
<el-header id="header">
<div class="panel-header"> <div class="panel-header">
<div class="project"> <div class="project">
<div class="inline-center"> <div class="inline-center">
<p>实训项目</p> <p>实训项目</p>
<el-tooltip effect="dark" content="点击右侧“下三角”按钮可切换实验项目" placement="bottom"> <el-tooltip effect="dark"
<i class="info el-icon-warning" style="margin-left: 10px"></i> content="点击右侧“下三角”按钮可切换实验项目"
placement="bottom">
<i class="info el-icon-warning"
style="margin-left: 10px"></i>
</el-tooltip> </el-tooltip>
</div> </div>
<el-select <el-select v-model="projectId"
v-model="projectId" placeholder="请选择"
placeholder="请选择" class="select"
class="select" :disabled="projectPermissions != 0"
:disabled="projectPermissions != 0" @change="selectProject"
@change="selectProject" style="flex: 1">
style="flex: 1" <el-option v-for="(item, i) in projectList"
> :key="item.projectId"
<el-option :label="i + 1 + '. ' + item.projectName"
v-for="(item, i) in projectList" :value="item.projectId"></el-option>
:key="item.projectId"
:label="i + 1 + '. ' + item.projectName"
:value="item.projectId"
></el-option>
</el-select> </el-select>
</div> </div>
<div class="item"> <div class="item">
@ -35,16 +36,23 @@
<span>{{seconds}}</span> <span>{{seconds}}</span>
</div> </div>
</div> </div>
<div v-if="!competitionId" class="item"> <div v-if="!competitionId"
class="item">
<div> <div>
总得分 总得分
<span class="total-score">{{grade}}</span> <span class="total-score">{{grade}}</span>
</div> </div>
</div> </div>
<div> <div>
<el-button @click="toReport" v-if="isSubmit && !competitionId">查看实验报告</el-button> <el-button @click="toReport"
<el-button class="reload" @click="reload" v-show="projectPermissions == 0">重新开始</el-button> v-if="isSubmit && !competitionId">查看实验报告</el-button>
<el-button type="primary" class="submit btn" @click="confirmSubmit" :disabled="isSubmit || !projectList.length">提交</el-button> <el-button class="reload"
@click="reload"
v-show="projectPermissions == 0">重新开始</el-button>
<el-button type="primary"
class="submit btn"
@click="confirmSubmit"
:disabled="isSubmit || !projectList.length">提交</el-button>
</div> </div>
</div> </div>
</el-header> </el-header>
@ -56,7 +64,8 @@
<p>实验目标</p> <p>实验目标</p>
</div> </div>
<div class="goal"> <div class="goal">
<div class="ql-editor" v-html="experimentTarget"></div> <div class="ql-editor"
v-html="experimentTarget"></div>
</div> </div>
</div> </div>
<div class="aside-footer"> <div class="aside-footer">
@ -67,30 +76,38 @@
<div> <div>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-card shadow="never" :border="false"> <el-card shadow="never"
<el-table :data="taskList" :stripe="true"> :border="false">
<el-table :data="taskList"
:stripe="true">
<el-table-column type="index"></el-table-column> <el-table-column type="index"></el-table-column>
<el-table-column prop="name" label="判分点" align="center"></el-table-column> <el-table-column prop="name"
<el-table-column prop="score" label="分值" width="60" align="center"></el-table-column> label="判分点"
align="center"></el-table-column>
<el-table-column prop="score"
label="分值"
width="60"
align="center"></el-table-column>
<template v-if="!competitionId"> <template v-if="!competitionId">
<el-table-column label="结果" width="60" align="center"> <el-table-column label="结果"
width="60"
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<template v-if="isSubmit"> <template v-if="isSubmit">
<template v-if="!competitionId"> <template v-if="!competitionId">
<i <i v-if="scope.row.finishedResult"
v-if="scope.row.finishedResult" class="el-icon-check right"></i>
class="el-icon-check right" <i v-else
></i> class="el-icon-close wrong"></i>
<i
v-else
class="el-icon-close wrong"
></i>
</template> </template>
<template v-else>-</template> <template v-else>-</template>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="score" label="得分" width="60" align="center"> <el-table-column prop="score"
label="得分"
width="60"
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<template v-if="isSubmit">{{ competitionId ? '-' : scope.row.examScore }}</template> <template v-if="isSubmit">{{ competitionId ? '-' : scope.row.examScore }}</template>
</template> </template>
@ -104,23 +121,34 @@
</div> </div>
</el-aside> </el-aside>
<el-main> <el-main>
<el-tabs v-model="pannelTab" type="card"> <el-tabs v-model="pannelTab"
<el-tab-pane label="项目背景" name="first"> type="card">
<div class="ql-editor" v-html="experimentDescription"></div> <el-tab-pane label="项目背景"
name="first">
<div class="ql-editor"
v-html="experimentDescription"></div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="实验要求" name="second"> <el-tab-pane label="实验要求"
name="second">
<el-collapse v-model="curReq"> <el-collapse v-model="curReq">
<el-collapse-item v-for="item in points" :name="item.judgmentId" :key="item.judgmentId"> <el-collapse-item v-for="item in points"
:name="item.judgmentId"
:key="item.judgmentId">
<template slot="title"> <template slot="title">
<i class="el-icon-s-ticket"></i> <i class="el-icon-s-ticket"></i>
<div class="break-all des" v-html="item.name"></div> <div class="break-all des"
v-html="item.name"></div>
</template> </template>
<div class="ql-editor" v-html="item.experimentalRequirements"></div> <div class="ql-editor"
v-html="item.experimentalRequirements"></div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="实验提示" name="fifth" v-if="hintOpen"> <el-tab-pane label="实验提示"
<div class="ql-editor" v-html="experimentHint"></div> name="fifth"
v-if="hintOpen">
<div class="ql-editor"
v-html="experimentHint"></div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-main> </el-main>
@ -129,8 +157,14 @@
<div :class="['toggle-panel', {active: pannelVisible}]"> <div :class="['toggle-panel', {active: pannelVisible}]">
<div @click="togglePannel"> <div @click="togglePannel">
<img :src="require(`@/assets/images/system/${$config.defaultSystem}/left.png`)" alt class="c-p" v-if="pannelVisible" /> <img :src="require(`@/assets/images/system/${$config.defaultSystem}/left.png`)"
<img :src="require(`@/assets/images/system/${$config.defaultSystem}/right.png`)" alt class="c-p" v-if="!pannelVisible" /> alt
class="c-p"
v-if="pannelVisible" />
<img :src="require(`@/assets/images/system/${$config.defaultSystem}/right.png`)"
alt
class="c-p"
v-if="!pannelVisible" />
</div> </div>
</div> </div>
</div> </div>
@ -145,7 +179,7 @@ import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css'; import 'quill/dist/quill.snow.css';
import 'quill/dist/quill.bubble.css'; import 'quill/dist/quill.bubble.css';
export default { export default {
data() { data () {
return { return {
token: Cookie.get('admin-token'), token: Cookie.get('admin-token'),
systemId: Cookie.get('admin-systemId') || 1, systemId: Cookie.get('admin-systemId') || 1,
@ -189,13 +223,13 @@ export default {
reportId: '' reportId: ''
}; };
}, },
mounted() { mounted () {
// 210 // 210
this.projectPermissions = this.assessmentId ? this.projectPermissions = this.assessmentId ?
1 : 1 :
this.competitionId ? this.competitionId ?
2 : 2 :
0 0
if (this.assessmentId) { // assessmentIdcompetitionId) if (this.assessmentId) { // assessmentIdcompetitionId)
this.getAssList() this.getAssList()
} else { // } else { //
@ -208,7 +242,7 @@ export default {
} else { } else {
this.getCache() this.getCache()
} }
}).catch(res => {}) }).catch(res => { })
if (this.competitionId) { if (this.competitionId) {
clearInterval(this.statusTimer) clearInterval(this.statusTimer)
this.statusTimer = setInterval(_ => { this.statusTimer = setInterval(_ => {
@ -220,14 +254,14 @@ export default {
}, },
methods: { methods: {
// //
getList(){ getList () {
let data = { let data = {
systemId: this.systemId, systemId: this.systemId,
cId: this.courseId, // id cId: this.courseId, // id
permissions: this.projectPermissions // // permissions: this.projectPermissions // //
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.$get(`${this.api.queryTestProject}`,data).then(res => { this.$get(`${this.api.queryTestProject}`, data).then(res => {
const list = res.projects const list = res.projects
this.projectList = list this.projectList = list
if (!this.projectPermissions && !this.projectId) this.projectId = list ? list[0].projectId : 0 // if (!this.projectPermissions && !this.projectId) this.projectId = list ? list[0].projectId : 0 //
@ -242,7 +276,7 @@ export default {
}) })
}, },
// //
getProDetail() { getProDetail () {
const projectId = this.projectId const projectId = this.projectId
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.$get(this.api.getProjectDetail, { this.$get(this.api.getProjectDetail, {
@ -251,6 +285,7 @@ export default {
}).then(res => { }).then(res => {
const points = res.projectJudgmentVos const points = res.projectJudgmentVos
const project = res.projectManage const project = res.projectManage
const mg = res.projectManage
const curReq = [] const curReq = []
// //
if (project.systemId == 11) { if (project.systemId == 11) {
@ -264,8 +299,8 @@ export default {
points.map((e, i) => { points.map((e, i) => {
e.code = '' // code e.code = '' // code
e.codeId = '' // codeIdcodeId e.codeId = '' // codeIdcodeId
e.answer = '' // e.answer = '' //
e.retResult = '' // (1 0) e.retResult = '' // (1 0)
curReq.push(e.judgmentId) curReq.push(e.judgmentId)
}) })
if (this.projectPermissions) { if (this.projectPermissions) {
@ -284,7 +319,7 @@ export default {
this.experimentTarget = project.experimentTarget this.experimentTarget = project.experimentTarget
this.experimentDescription = project.experimentDescription this.experimentDescription = project.experimentDescription
this.experimentHint = project.experimentHint this.experimentHint = project.experimentHint
this.hintOpen = !res.projectManage.hintOpen // 01 this.hintOpen = mg.founder ? !mg.hintOpenBySchool : !mg.hintOpen // 01
this.$emit('tell', projectId, systemId, this.points) this.$emit('tell', projectId, systemId, this.points)
const isPrac = this.projectPermissions == 0 // const isPrac = this.projectPermissions == 0 //
this.text = isPrac ? '已用' : '剩余' this.text = isPrac ? '已用' : '剩余'
@ -300,12 +335,12 @@ export default {
}) })
}, },
// loadingtrue // loadingtrue
closeLoad() { closeLoad () {
this.$parent.loadIns.close() this.$parent.loadIns.close()
this.$parent.loaded = true this.$parent.loaded = true
}, },
// //
getAssList(){ getAssList () {
this.$post(`${this.api.pageStuAssessment}`, { this.$post(`${this.api.pageStuAssessment}`, {
pageNum: 1, pageNum: 1,
pageSize: 10000 pageSize: 10000
@ -314,7 +349,7 @@ export default {
const assessmentId = this.assessmentId const assessmentId = this.assessmentId
let done = false let done = false
const classId = this.classId const classId = this.classId
// reportIdclassIdclassId // reportIdclassIdclassId
if (list.find(e => e.assessmentId == assessmentId && e.reportId && e.classId == classId)) { if (list.find(e => e.assessmentId == assessmentId && e.reportId && e.classId == classId)) {
done = true done = true
this.isSubmit = true this.isSubmit = true
@ -328,16 +363,16 @@ export default {
if (!done) { if (!done) {
this.getList().then(() => { this.getList().then(() => {
this.getCache() this.getCache()
}).catch(res => {}) }).catch(res => { })
// //
this.statusTimer = setInterval(_ => { this.statusTimer = setInterval(_ => {
this.getAssStatus() this.getAssStatus()
}, 1000) }, 1000)
} }
}).catch(res => {}) }).catch(res => { })
}, },
// //
getCache(cache) { getCache (cache) {
const pId = cache ? cache.projectId : '' const pId = cache ? cache.projectId : ''
const projectId = Number(pId || this.projectId) const projectId = Number(pId || this.projectId)
const cid = this.courseId const cid = this.courseId
@ -373,7 +408,7 @@ export default {
let hasCache = 0 // let hasCache = 0 //
points.map((e, i) => { points.map((e, i) => {
const judgmentId = e.judgmentId const judgmentId = e.judgmentId
promiseList.push(new Promise((resolve,reject) => { promiseList.push(new Promise((resolve, reject) => {
this.$post(this.api.getLastCache, { this.$post(this.api.getLastCache, {
assessmentId: assessmentId ? Number(assessmentId) : '', assessmentId: assessmentId ? Number(assessmentId) : '',
bcId: judgmentId, bcId: judgmentId,
@ -413,7 +448,7 @@ export default {
}) })
this.$emit('tell', projectId, this.curSystemId, this.points) this.$emit('tell', projectId, this.curSystemId, this.points)
this.$emit('recoveryCode', newJudgmentId + '') // tab this.$emit('recoveryCode', newJudgmentId + '') // tab
}).catch(res => {}) }).catch(res => { })
} else { } else {
this.points.map(e => { this.points.map(e => {
const item = points.find(n => n.judgmentId === e.judgmentId) const item = points.find(n => n.judgmentId === e.judgmentId)
@ -432,14 +467,14 @@ export default {
bcId: e.judgmentId, bcId: e.judgmentId,
projectId, projectId,
cid cid
}).then(res => {}).catch(() => {}) }).then(res => { }).catch(() => { })
}) })
}) })
}) })
} }
}, },
// //
getAssStatus() { getAssStatus () {
// //
this.isSubmit || this.$get(this.api.getDetailById, { this.isSubmit || this.$get(this.api.getDetailById, {
id: this.assessmentId id: this.assessmentId
@ -453,10 +488,10 @@ export default {
}) })
this.submit() this.submit()
} }
}).catch(res => {}) }).catch(res => { })
}, },
// //
getCompetitionStatus() { getCompetitionStatus () {
// //
this.isSubmit || this.$post(`${this.api.getCompetition}?competitionId=${this.competitionId}`).then(({ competition }) => { this.isSubmit || this.$post(`${this.api.getCompetition}?competitionId=${this.competitionId}`).then(({ competition }) => {
const stages = competition.competitionStage const stages = competition.competitionStage
@ -475,14 +510,14 @@ export default {
this.counter((endTime - now) / 1000) this.counter((endTime - now) / 1000)
} }
} }
}).catch(res => {}) }).catch(res => { })
}, },
// //
selectProject(){ selectProject () {
this.isSelected = true this.isSelected = true
this.getProDetail().then(() => { this.getProDetail().then(() => {
this.getCache() this.getCache()
}).catch(res => {}) }).catch(res => { })
this.isSubmit = false this.isSubmit = false
this.countVal = 0 this.countVal = 0
this.grade = '00' this.grade = '00'
@ -491,11 +526,11 @@ export default {
newmain.$emit('isSubmit', this.isSubmit) // newmain.$emit('isSubmit', this.isSubmit) //
}, },
// //
toReport() { toReport () {
this.$router.push(`/report?reportId=${this.reportId}`) this.$router.push(`/report?reportId=${this.reportId}`)
}, },
// //
reload() { reload () {
this.reloadCount() this.reloadCount()
this.grade = '00' this.grade = '00'
localStorage.removeItem('codeCache') localStorage.removeItem('codeCache')
@ -514,10 +549,10 @@ export default {
this.startCount() this.startCount()
}, },
// //
confirmSubmit() { confirmSubmit () {
const pointList = this.$parent.workbench const pointList = this.$parent.workbench
let msg = '此操作将视为结束考试,是否继续?' let msg = '此操作将视为结束考试,是否继续?'
if(pointList.find(e => !e.codeId && e.code)) msg = '有代码没有运行,该代码将不得分,确定提交?' if (pointList.find(e => !e.codeId && e.code)) msg = '有代码没有运行,该代码将不得分,确定提交?'
this.$confirm(msg, '提示', { this.$confirm(msg, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
@ -534,14 +569,14 @@ export default {
}).then(({ codeId }) => { }).then(({ codeId }) => {
this.$parent.workbench[0].codeId = codeId this.$parent.workbench[0].codeId = codeId
this.submit() this.submit()
}).catch(err => {}) }).catch(err => { })
} else { } else {
this.submit() this.submit()
} }
}).catch(() => {}) }).catch(() => { })
}, },
// //
submit() { submit () {
if (this.isSubmit) return false if (this.isSubmit) return false
const pointList = this.$parent.workbench const pointList = this.$parent.workbench
const date = new Date() const date = new Date()
@ -612,10 +647,10 @@ export default {
this.$parent.back() this.$parent.back()
} }
}) })
}).catch(err => {}) }).catch(err => { })
}, },
// //
editReport(reportId) { editReport (reportId) {
const data = [] const data = []
const ans = [] const ans = []
const promises = [] const promises = []
@ -647,20 +682,20 @@ export default {
this.$post(this.api.editExperimentalData, { this.$post(this.api.editExperimentalData, {
reportId, reportId,
data: JSON.stringify(data) data: JSON.stringify(data)
}).then(res => {}).catch(err => {}) }).then(res => { }).catch(err => { })
}) })
}, },
// //
togglePannel() { togglePannel () {
document.querySelector('#panel').style.left = 0 document.querySelector('#panel').style.left = 0
this.pannelVisible = !this.pannelVisible this.pannelVisible = !this.pannelVisible
}, },
// //
timeFormat(param) { timeFormat (param) {
return param < 10 ? '0' + param : param return param < 10 ? '0' + param : param
}, },
// //
reloadCount() { reloadCount () {
clearInterval(this.counterTimer) clearInterval(this.counterTimer)
this.countVal = '' this.countVal = ''
this.day = '00' this.day = '00'
@ -669,7 +704,7 @@ export default {
this.hour = '00' this.hour = '00'
}, },
// //
counter(counterTime) { counter (counterTime) {
let leave1 = counterTime % (24 * 3600) // let leave1 = counterTime % (24 * 3600) //
let leave2 = leave1 % 3600 // let leave2 = leave1 % 3600 //
let leave3 = leave2 % 60 // let leave3 = leave2 % 60 //
@ -687,25 +722,24 @@ export default {
this.seconds = seconds this.seconds = seconds
}, },
// //
startCount() { startCount () {
clearInterval(this.counterTimer) clearInterval(this.counterTimer)
this.counterTimer = setInterval(() => { this.counterTimer = setInterval(() => {
this.counter(this.projectPermissions ? this.countVal-- : this.countVal++) this.counter(this.projectPermissions ? this.countVal-- : this.countVal++)
}, 1000) }, 1000)
}, },
// //
drag() { drag () {
const el = document.querySelector('#panel') const el = document.querySelector('#panel')
let gap = 10 // let gap = 10 //
let parent = document.body let parent = document.body
el.onmousedown = e => { document.querySelector('#header').onmousedown = e => {
var x = e.clientX - el.offsetLeft var x = e.clientX - el.offsetLeft
var y = e.clientY - el.offsetTop var y = e.clientY - el.offsetTop
var left = 0 var left = 0
var top = 0 var top = 0
var boxer = document.querySelector(".boxer") document.onmousemove = function (eve) {
document.onmousemove = function(eve) {
left = eve.clientX - x left = eve.clientX - x
top = eve.clientY - y top = eve.clientY - y
// //
@ -786,7 +820,7 @@ export default {
} }
/deep/.des { /deep/.des {
font-size: 16px; font-size: 16px;
font-family: "Microsoft YaHei"; font-family: 'Microsoft YaHei';
img { img {
max-width: 100%; max-width: 100%;
} }
@ -836,8 +870,8 @@ export default {
color: #333; color: #333;
background-color: #fff; background-color: #fff;
} }
.el-aside /deep/[class*=" el-icon-"], .el-aside /deep/[class*=' el-icon-'],
[class^="el-icon-"] { [class^='el-icon-'] {
line-height: 40px; line-height: 40px;
font-size: 16px; font-size: 16px;
} }
@ -856,10 +890,13 @@ export default {
&.system4 { &.system4 {
background-size: 100% 58px; background-size: 100% 58px;
} }
&.system5, &.system7, &.system9 { &.system5,
&.system7,
&.system9 {
background-size: 100% 40px; background-size: 100% 40px;
} }
&.system8, &.system6 { &.system8,
&.system6 {
background-size: 100% 61px; background-size: 100% 61px;
} }
&.system10 { &.system10 {
@ -902,7 +939,7 @@ export default {
} }
/deep/.select { /deep/.select {
.el-select__caret:before { .el-select__caret:before {
content: "\e78f"; content: '\e78f';
padding: 3px; padding: 3px;
font-size: 16px; font-size: 16px;
color: #fff; color: #fff;
@ -971,7 +1008,7 @@ export default {
color: #bfbfbf; color: #bfbfbf;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
opacity: .9; opacity: 0.9;
} }
} }
</style> </style>

@ -1,83 +1,101 @@
<template> <template>
<div class="code-wrap flex"> <div class="code-wrap flex">
<div class="left"> <div class="left">
<codemirror <codemirror v-model="codeVal"
v-model="codeVal" :options="cmOption"
:options="cmOption" class="code-mirror"
class="code-mirror" @ready="ready"
@ready="ready" ref="codemirror"></codemirror>
ref="codemirror" <div v-if="isSubmit"
></codemirror> class="code-mask"></div>
<div v-if="isSubmit" class="code-mask"></div>
<div class="btns"> <div class="btns">
<span <span class="el-icon-delete del"
class="el-icon-delete del" @click="clearCode"></span>
@click="clearCode" <el-button v-if="modelIsShow"
></span> class="btn"
<el-button type="warning"
v-if="modelIsShow" @click="importModel">导入模型</el-button>
class="btn" <el-button class="run btn"
type="warning" type="primary"
@click="importModel" @click="runCode(false)"
>导入模型</el-button> :disabled="runEnable">运行</el-button>
<el-button
class="run btn"
type="primary"
@click="runCode(false)"
:disabled="runEnable"
>运行</el-button>
</div> </div>
</div> </div>
<div class="line"></div> <div class="line"></div>
<div class="code-right answer"> <div class="code-right answer">
<p :class="['text-wrapper', 'pic-num' + picSrcList.length]">{{ runResult }}</p> <p :class="['text-wrapper', 'pic-num' + picSrcList.length]">{{ runResult }}</p>
<div :class="['pic-wrap', {wrong: isError === 0}]" v-if="picSrcList.length"> <div :class="['pic-wrap', {wrong: isError === 0}]"
<div class="pic-item" v-for="(img, i) in picSrcList" :key="i"> v-if="picSrcList.length">
<el-image <div class="pic-item"
class="pic" v-for="(img, i) in picSrcList"
:src="img" :key="i">
:preview-src-list="picSrcList"> <el-image class="pic"
:src="img"
:preview-src-list="picSrcList">
</el-image> </el-image>
<el-button class="download-btn btn" type="primary" size="mini" @click="downloadPic(i)">下载图片</el-button> <el-button class="download-btn btn"
<a :ref="'picLink' + i" style="display: none;" download="运行结果.png" :href="img">下载图片</a> type="primary"
size="mini"
@click="downloadPic(i)">下载图片</el-button>
<a :ref="'picLink' + i"
style="display: none;"
download="运行结果.png"
:href="img">下载图片</a>
</div> </div>
</div> </div>
<div class="result-right t-color" v-show="isError"> <div class="result-right t-color"
<img :src="require(`@/assets/images/system/${$config.defaultSystem}/yes.png`)" alt />运行成功 v-show="isError">
<el-button class="tips-btn" @click="exportResult">导出结果</el-button> <img :src="require(`@/assets/images/system/${$config.defaultSystem}/yes.png`)"
alt />运行成功
<el-button class="tips-btn"
@click="exportResult">导出结果</el-button>
</div> </div>
<div class="result-wrong" v-show="isError === 0"> <div class="result-wrong"
<img src="@/assets/images/error.png" alt /> v-show="isError === 0">
<img src="@/assets/images/error.png"
alt />
{{errLine}}行出现错误 {{errLine}}行出现错误
<el-button class="tips-btn" @click="getTips" v-show="showTips">提示</el-button> <el-button class="tips-btn"
<el-dialog title="答案提示" center :close-on-click-modal="false" :visible.sync="tipsVisible"> @click="getTips"
v-show="showTips">提示</el-button>
<el-dialog title="答案提示"
center
:close-on-click-modal="false"
:visible.sync="tipsVisible">
<el-tabs> <el-tabs>
<el-tab-pane label="参考答案"> <el-tab-pane label="参考答案">
<div :class="['answer-wrap', {client: !fromManager}]" v-html="answer"></div> <div :class="['answer-wrap', {client: !fromManager}]"
v-html="answer"></div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-dialog> </el-dialog>
</div> </div>
</div> </div>
<!-- 导入模型 --> <!-- 导入模型 -->
<el-dialog title="请选择要导入的模型" :visible.sync="modelVisible" width="400px" :close-on-click-modal="false"> <el-dialog title="请选择要导入的模型"
:visible.sync="modelVisible"
width="400px"
:close-on-click-modal="false">
<div class="model-wrap"> <div class="model-wrap">
<el-tree <el-tree :data="modelData"
:data="modelData" ref="tree"
ref="tree" default-expand-all
default-expand-all @check-change="treeCheckChange"
@check-change="treeCheckChange" show-checkbox
show-checkbox :check-strictly="true"
:check-strictly="true" node-key="id"
node-key="id" :props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}" v-loading="modelLoading">
v-loading="modelLoading">
</el-tree> </el-tree>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer"
<el-button size="small" @click="modelVisible = false">取消</el-button> class="dialog-footer">
<el-button size="small" type="primary" @click="submit">导入</el-button> <el-button size="small"
@click="modelVisible = false">取消</el-button>
<el-button size="small"
type="primary"
@click="submit">导入</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -133,7 +151,7 @@ import config from '@/config'
const CANCEL_TOKEN = axios.CancelToken // input const CANCEL_TOKEN = axios.CancelToken // input
export default { export default {
props: ['judgmentId', 'code', 'codeId', 'projectId', 'systemId', 'retResult', 'modelIsShow'], props: ['judgmentId', 'code', 'codeId', 'projectId', 'systemId', 'retResult', 'modelIsShow'],
data() { data () {
return { return {
token: Cookie.get('admin-token'), token: Cookie.get('admin-token'),
assessmentId: Cookie.get('admin-assessmentId'), // id assessmentId: Cookie.get('admin-assessmentId'), // id
@ -189,11 +207,11 @@ export default {
codemirror codemirror
}, },
watch: { watch: {
codeVal(val) { codeVal (val) {
this.$emit("update:code", val) this.$emit("update:code", val)
} }
}, },
mounted() { mounted () {
if (!this.assessmentId) this.showTips = true if (!this.assessmentId) this.showTips = true
// //
newmain.$on("isSubmit", isSubmit => { newmain.$on("isSubmit", isSubmit => {
@ -204,16 +222,24 @@ export default {
methods: { methods: {
// //
ready() { ready () {
const code = this.$refs.codemirror.codemirror const code = this.$refs.codemirror.codemirror
code.setSize("auto", "calc(100vh - 167px)"); code.setSize("auto", "calc(100vh - 167px)");
code.on('keypress', function() {
//
this.$post(`${this.api.whetherCanPaste}?systemId=${this.systemId}`).then(res => {
// ()
res.data == 'false' && !this.fromManager && code.on('beforeChange', (istance, change) => {
change.origin === 'paste' && change.cancel()
})
}).catch(err => { })
code.on('keypress', function () {
// //
code.showHint() code.showHint()
}); });
}, },
// //
clearCode() { clearCode () {
this.codeVal = '' this.codeVal = ''
this.isError = '' this.isError = ''
this.runResult = '' this.runResult = ''
@ -222,46 +248,47 @@ export default {
this.$emit('update:retResult', '') // this.$emit('update:retResult', '') //
}, },
// //
importModel() { importModel () {
this.modelLoading = true this.modelLoading = true
this.modelVisible = true this.modelVisible = true
// //
this.$post(`${this.api.modelClassList}?systemId=${this.systemId}`).then(res => { this.$post(`${this.api.modelClassList}?systemId=${this.systemId}&founder=1`).then(({ data }) => {
const { data } = res
const promises = [] const promises = []
const addType = list => { const addType = list => {
list.map(e => { list.map(e => {
e.disabled = true e.disabled = true
// promise // promise
promises.push(new Promise((resolve,reject) => { promises.push(new Promise((resolve, reject) => {
this.$post(this.api.referenceDemoList, { this.$post(this.api.studentModelList, {
pageNum: 1, categoryId: e.id,
pageSize: 10000, pageNum: 1,
categoryId: e.id pageSize: 10000,
}).then(res => { systemId: +this.systemId,
let { records } = res.data founder: 1
records = records.filter(e => !e.isOpen) // }).then(({ data }) => {
records.map(n => { let { records } = data
n.categoryName = n.modelName records = records.filter(e => !e.isOpen) //
}) records.map(n => {
e.children = [...e.children, ...records] n.categoryName = n.modelName
resolve()
}).catch(res => {
reject()
}) })
})) e.children = [...e.children, ...records]
e.children && e.children.length && addType(e.children) resolve()
}) }).catch(res => {
} reject()
addType(data) })
Promise.all(promises).then(_ => { }))
this.modelData = data e.children && e.children.length && addType(e.children)
this.modelLoading = false })
}).catch(res => {}) }
}).catch(res => {}) addType(data)
Promise.all(promises).then(_ => {
this.modelData = data
this.modelLoading = false
}).catch(res => { })
}).catch(res => { })
}, },
// //
treeCheckChange(data, checked, indeterminate) { treeCheckChange (data, checked, indeterminate) {
const checkKey = this.$refs.tree.getCheckedKeys() const checkKey = this.$refs.tree.getCheckedKeys()
// //
if (checkKey.length > 1 && checked) { if (checkKey.length > 1 && checked) {
@ -270,7 +297,7 @@ export default {
} }
}, },
// //
submit() { submit () {
if (this.modelImporting) return false if (this.modelImporting) return false
const id = this.$refs.tree.getCheckedKeys() const id = this.$refs.tree.getCheckedKeys()
if (!id.length) return this.$message.error('请选择模型!') if (!id.length) return this.$message.error('请选择模型!')
@ -286,7 +313,7 @@ export default {
this.modelImporting = false this.modelImporting = false
}, 2000) }, 2000)
}) })
}).catch(res => {}) }).catch(res => { })
}, },
/** /**
* python代码里如果有input函数的话是做了单独的处理的原理是先把所有input函数都替换成exit函数再在exit函数里加上特定标识再通过接口传给后端去执行 * python代码里如果有input函数的话是做了单独的处理的原理是先把所有input函数都替换成exit函数再在exit函数里加上特定标识再通过接口传给后端去执行
@ -294,7 +321,7 @@ export default {
* 然后就可以通过这个返回的值来提示给用户让用户继续输入 * 然后就可以通过这个返回的值来提示给用户让用户继续输入
* 下面这个函数就是递归执行这个input输入过程的函数 * 下面这个函数就是递归执行这个input输入过程的函数
*/ */
confirmInput(msg){ confirmInput (msg) {
const receiveResult = msg.replace('validing:', '') const receiveResult = msg.replace('validing:', '')
this.runResult += receiveResult this.runResult += receiveResult
this.$prompt(receiveResult, '提示', { this.$prompt(receiveResult, '提示', {
@ -302,14 +329,14 @@ export default {
}).then(({ value }) => { }).then(({ value }) => {
this.runResult += `${value}\n` this.runResult += `${value}\n`
// exit // exit
this.sourceCode = this.sourceCode.replace(`exit('validing:${receiveResult.replace(/[\r\n]*/g,'')}')`, _ => { this.sourceCode = this.sourceCode.replace(`exit('validing:${receiveResult.replace(/[\r\n]*/g, '')}')`, _ => {
return `'${value}'` return `'${value}'`
}) })
this.sourceCode = this.sourceCode.replace(`exit("validing:${receiveResult.replace(/[\r\n]*/g,'')}")`, _ => { this.sourceCode = this.sourceCode.replace(`exit("validing:${receiveResult.replace(/[\r\n]*/g, '')}")`, _ => {
return `'${value}'` return `'${value}'`
}) })
clearTimeout(this.requestTimer) clearTimeout(this.requestTimer)
// AnswerTips // AnswerTips
this.requestTimer = setTimeout(() => { this.requestTimer = setTimeout(() => {
this.requestList.map(n => n('interrupt')) this.requestList.map(n => n('interrupt'))
@ -338,7 +365,7 @@ export default {
} else if (result.includes('validing:')) { } else if (result.includes('validing:')) {
this.isError = 1 this.isError = 1
this.confirmInput(result) this.confirmInput(result)
} else if(data.retResult) { } else if (data.retResult) {
this.isError = 1 this.isError = 1
this.runResult += result this.runResult += result
} }
@ -346,16 +373,16 @@ export default {
this.$emit('update:answer', this.runResult) // this.$emit('update:answer', this.runResult) //
this.$emit('update:retResult', data.retResult) // this.$emit('update:retResult', data.retResult) //
}).catch(e => { }).catch(e => {
if(e && e.message == 'interrupt'){ if (e && e.message == 'interrupt') {
this.runCode(true) this.runCode(true)
this.requestList = [] this.requestList = []
} }
}) })
}).catch(err => {}) }).catch(err => { })
}, },
// //
runCode(isWhile) { // isWhiletruewhile runCode (isWhile) { // isWhiletruewhile
if (!this.isSubmit) { if (!this.isSubmit) {
let code = this.codeVal let code = this.codeVal
if (!code) { if (!code) {
@ -372,17 +399,17 @@ export default {
// input // input
if (inputTextReg.test(code)) { if (inputTextReg.test(code)) {
code = code.replace(inputTextReg, val => { code = code.replace(inputTextReg, val => {
return val.replace(/\\n/g,"") return val.replace(/\\n/g, "")
}) })
this.codeVal = code this.codeVal = code
// inputexit"validing:"便 // inputexit"validing:"便
code = code.replace(inputFuncReg,val => { code = code.replace(inputFuncReg, val => {
return `exit(${val[val.length - 1]}validing:` return `exit(${val[val.length - 1]}validing:`
}) })
this.sourceCode = code this.sourceCode = code
if(!isWhile) this.runResult = '' if (!isWhile) this.runResult = ''
this.$post(this.api.runPythonCode, { this.$post(this.api.runPythonCode, {
code, code,
bcId, bcId,
@ -391,7 +418,7 @@ export default {
}).then(res => { }).then(res => {
const data = res.code const data = res.code
const result = data.runResult const result = data.runResult
if(result.includes('File ')){ if (result.includes('File ')) {
if (isWhile) { if (isWhile) {
this.runResult += result this.runResult += result
} else { } else {
@ -399,7 +426,7 @@ export default {
} }
this.errLine = parseInt(result.substring(result.indexOf('line') + 4, result.length)) this.errLine = parseInt(result.substring(result.indexOf('line') + 4, result.length))
this.isError = data.retResult this.isError = data.retResult
}else if(result.includes('validing:')){ } else if (result.includes('validing:')) {
this.isError = 1 this.isError = 1
this.confirmInput(result) this.confirmInput(result)
} }
@ -439,7 +466,7 @@ export default {
let firtImg = '' let firtImg = ''
try { try {
imgList = eval(result) imgList = eval(result)
} catch (error) {} } catch (error) { }
if (imgList && imgList.length) firtImg = imgList[0] if (imgList && imgList.length) firtImg = imgList[0]
// //
if (photo) { if (photo) {
@ -453,8 +480,8 @@ export default {
* 这段是为要下载图片的项目案例写的后端会返回图片名称的数组前端负责循环这个数组然后下载下来 * 这段是为要下载图片的项目案例写的后端会返回图片名称的数组前端负责循环这个数组然后下载下来
* 只有该系统有这段代码因为其他7个系统没有下载图片的项目后续如果加了直接把这段代码复制过去即可 * 只有该系统有这段代码因为其他7个系统没有下载图片的项目后续如果加了直接把这段代码复制过去即可
*/ */
imgList.map((n,i) => { imgList.map((n, i) => {
util.downloadFile(`${i+1}.jpg`,n) util.downloadFile(`${i + 1}.jpg`, n)
}) })
this.isError = 0 this.isError = 0
this.runResult = '下载完成' this.runResult = '下载完成'
@ -481,26 +508,26 @@ export default {
} }
}, },
// //
downloadPic(i) { downloadPic (i) {
this.$refs['picLink' + i][0].click() this.$refs['picLink' + i][0].click()
}, },
// //
exportResult() { exportResult () {
var FileSaver = require('file-saver'); var FileSaver = require('file-saver');
var blob = new Blob([this.runResult], {type: "text/plain;charset=utf-8"}); var blob = new Blob([this.runResult], { type: "text/plain;charset=utf-8" });
FileSaver.saveAs(blob, 'result.csv') FileSaver.saveAs(blob, 'result.csv')
}, },
// //
getTips() { getTips () {
this.tipsVisible = true this.tipsVisible = true
this.$get(this.api.queryBcJudgmentByBcId, { this.$get(this.api.queryBcJudgmentByBcId, {
bcId: this.judgmentId bcId: this.judgmentId
}).then(res => { }).then(res => {
this.answer = res.experimentCode this.answer = res.experimentCode
}).catch(err => {}) }).catch(err => { })
}, },
// //
dragSide() { dragSide () {
const left = document.querySelector('.left') const left = document.querySelector('.left')
const line = document.querySelector('.line') const line = document.querySelector('.line')
const right = document.querySelector('.code-right') const right = document.querySelector('.code-right')
@ -511,9 +538,9 @@ export default {
document.onmousemove = e => { document.onmousemove = e => {
let x = e.clientX let x = e.clientX
// //
if(x >= width * .1 && x <= width * .9) { if (x >= width * .1 && x <= width * .9) {
line.style.left = x + 'px' line.style.left = x + 'px'
left.style.width = x +'px' left.style.width = x + 'px'
right.style.width = document.querySelector('.code-wrap').clientWidth - (x + 5) + 'px' right.style.width = document.querySelector('.code-wrap').clientWidth - (x + 5) + 'px'
} }
} }
@ -531,7 +558,7 @@ export default {
.code-wrap { .code-wrap {
position: relative; position: relative;
} }
.left{ .left {
position: relative; position: relative;
width: 60%; width: 60%;
} }
@ -605,7 +632,7 @@ export default {
background-color: #f00; background-color: #f00;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
opacity: .9; opacity: 0.9;
} }
} }
/deep/.CodeMirror-wrap pre.CodeMirror-line, /deep/.CodeMirror-wrap pre.CodeMirror-line,
@ -693,7 +720,7 @@ export default {
margin: 0 auto 10px; margin: 0 auto 10px;
} }
} }
.code-mask{ .code-mask {
z-index: 2; z-index: 2;
position: absolute; position: absolute;
top: 0; top: 0;
@ -702,28 +729,28 @@ export default {
right: 0; right: 0;
} }
.btns { .btns {
z-index:99; z-index: 99;
position:absolute; position: absolute;
right: 50px; right: 50px;
bottom:15px; bottom: 15px;
display: flex; display: flex;
} }
.run{ .run {
width:100px; width: 100px;
color:#fff; color: #fff;
} }
.download-btn{ .download-btn {
color:#fff; color: #fff;
} }
/deep/.answer-wrap{ /deep/.answer-wrap {
&.client { &.client {
user-select: none; user-select: none;
} }
pre{ pre {
width: 100%; width: 100%;
white-space: pre-wrap; white-space: pre-wrap;
} }
img{ img {
max-width: 100%; max-width: 100%;
} }
} }

@ -10,9 +10,9 @@ let host = location.origin + '/'
let bankPath = `${location.origin}/banksystem` // 银行系统 let bankPath = `${location.origin}/banksystem` // 银行系统
// 121.37.12.51 | 192.168.31.151 // 121.37.12.51 | 192.168.31.151
if (isDev) { if (isDev) {
// host = 'http://192.168.31.51:9000/' host = 'http://192.168.31.152:9000/'
// host = 'http://192.168.31.116:9000/' // host = 'http://192.168.31.53:9000/'
host = 'http://121.37.12.51:9000/' // host = 'http://121.37.12.51:9000/'
// host = 'https://occupationlab.com/' // host = 'https://occupationlab.com/'
bankPath = `http://${location.hostname}:8093` bankPath = `http://${location.hostname}:8093`
} else if (isPro) { } else if (isPro) {

File diff suppressed because it is too large Load Diff

@ -17,9 +17,13 @@
<p v-if="$config.isHh" <p v-if="$config.isHh"
style="font-size: 18px">{{$config.title}}</p> style="font-size: 18px">{{$config.title}}</p>
<p>编程语言</p> <p>编程语言</p>
<el-input placeholder="请输入内容" <el-select v-model="language"
v-model="language" @change="languageChange">
:disabled="true"></el-input> <el-option v-for="(item, i) in languages"
:key="i"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</div> </div>
<div class="inline-center"> <div class="inline-center">
<el-tooltip class="item" <el-tooltip class="item"
@ -44,7 +48,8 @@
:key="item.judgmentId" :key="item.judgmentId"
:label="item.name" :label="item.name"
:value="item.judgmentId"> :value="item.judgmentId">
<codemirror :ref="'code' + i" <codemirror v-if="!language"
:ref="'code' + i"
:key="codeKey" :key="codeKey"
:projectId.sync="projectId" :projectId.sync="projectId"
:systemId.sync="systemId" :systemId.sync="systemId"
@ -55,6 +60,16 @@
:retResult.sync="item.retResult" :retResult.sync="item.retResult"
:modelIsShow.sync="modelIsShow" :modelIsShow.sync="modelIsShow"
@cache="leavePage"></codemirror> @cache="leavePage"></codemirror>
<!-- <img v-else
src="@/assets/images/vscode.png"
alt=""
width="100%"
height="700"> -->
<iframe v-else
class="vscode"
src="http://121.37.12.51:8088/?folder=/home/coder"
frameborder="0"
width="100%"></iframe>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
@ -88,7 +103,17 @@ export default {
systemId: '', systemId: '',
modelIsShow: false, // modelIsShow: false, //
projectPermissions: 0, // (0 1 2) projectPermissions: 0, // (0 1 2)
language: 'Python', // languages: [
{
id: 0,
name: 'Python'
},
{
id: 1,
name: 'Vscode'
},
],
language: 0, //
curTab: '', // curTab: '', //
workbench: [], // workbench: [], //
codeKey: 1 // codeKey: 1 //
@ -143,9 +168,13 @@ export default {
}, },
// //
getModelStatus (systemId) { getModelStatus (systemId) {
this.$post(`${this.api.checkIsShowBySystemId}?systemId=${systemId}`).then(res => { this.$post(`${this.api.displayListOrNotByStudent}?systemId=${systemId}`).then(res => {
this.modelIsShow = !res.isShow // 0 1 this.modelIsShow = res.studentSideShowsTheStatus == 'true' ? true : false
}).catch(res => { }) }).catch(res => { })
},
//
languageChange (id) {
}, },
// //
toData () { toData () {
@ -258,10 +287,14 @@ export default {
.el-input { .el-input {
width: 200px; width: 200px;
} }
.el-input.is-disabled .el-input__inner { .el-input .el-input__inner {
border-radius: 30px; border-radius: 30px;
} }
} }
.vscode {
height: calc(100vh - 186px);
}
.menu { .menu {
position: relative; position: relative;
z-index: 1000; z-index: 1000;

Loading…
Cancel
Save