|
|
@ -1,57 +1,69 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div v-show="loaded"> |
|
|
|
<div v-show="loaded"> |
|
|
|
<div class="header" :class="{hh: $config.isHh}"> |
|
|
|
<div class="header" |
|
|
|
<img v-if="$config.isHh" src="@/assets/images/logo-hh.png" alt="" class="logo"> |
|
|
|
:class="{hh: $config.isHh}"> |
|
|
|
|
|
|
|
<img v-if="$config.isHh" |
|
|
|
|
|
|
|
src="@/assets/images/logo-hh.png" |
|
|
|
|
|
|
|
alt="" |
|
|
|
|
|
|
|
class="logo"> |
|
|
|
<p v-else>{{curriculumName}}</p> |
|
|
|
<p v-else>{{curriculumName}}</p> |
|
|
|
<el-button class="back btn" type="primary" @click="back">退出实验</el-button> |
|
|
|
<el-button class="back btn" |
|
|
|
|
|
|
|
type="primary" |
|
|
|
|
|
|
|
@click="back">退出实验</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="top"> |
|
|
|
<div class="top"> |
|
|
|
<div class="language"> |
|
|
|
<div class="language"> |
|
|
|
<p v-if="$config.isHh" style="font-size: 18px">{{$config.title}}</p> |
|
|
|
<p v-if="$config.isHh" |
|
|
|
|
|
|
|
style="font-size: 18px">{{$config.title}}</p> |
|
|
|
<p>编程语言</p> |
|
|
|
<p>编程语言</p> |
|
|
|
<el-input placeholder="请输入内容" v-model="language" :disabled="true"></el-input> |
|
|
|
<el-input placeholder="请输入内容" |
|
|
|
|
|
|
|
v-model="language" |
|
|
|
|
|
|
|
:disabled="true"></el-input> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="inline-center"> |
|
|
|
<div class="inline-center"> |
|
|
|
<el-tooltip class="item" effect="dark" content="支持导入其它数据用于实验,总上传的文件大小不可以超过10M" placement="bottom"> |
|
|
|
<el-tooltip class="item" |
|
|
|
<i class="info el-icon-warning" style="margin-right: 10px"></i> |
|
|
|
effect="dark" |
|
|
|
|
|
|
|
content="支持导入其它数据用于实验,总上传的文件大小不可以超过10M" |
|
|
|
|
|
|
|
placement="bottom"> |
|
|
|
|
|
|
|
<i class="info el-icon-warning" |
|
|
|
|
|
|
|
style="margin-right: 10px"></i> |
|
|
|
</el-tooltip> |
|
|
|
</el-tooltip> |
|
|
|
<el-button type="primary" size="small" icon="el-icon-document" @click="toData">我的数据</el-button> |
|
|
|
<el-button type="primary" |
|
|
|
|
|
|
|
size="small" |
|
|
|
|
|
|
|
icon="el-icon-document" |
|
|
|
|
|
|
|
@click="toData">我的数据</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="tab"> |
|
|
|
<div class="tab"> |
|
|
|
<el-tabs v-model="curTab" type="card" @tab-click="judChange"> |
|
|
|
<el-tabs v-model="curTab" |
|
|
|
<el-tab-pane |
|
|
|
type="card" |
|
|
|
v-for="(item, i) in workbench" |
|
|
|
@tab-click="judChange"> |
|
|
|
:key="item.judgmentId" |
|
|
|
<el-tab-pane v-for="(item, i) in workbench" |
|
|
|
:label="item.name" |
|
|
|
:key="item.judgmentId" |
|
|
|
:value="item.judgmentId" |
|
|
|
:label="item.name" |
|
|
|
> |
|
|
|
:value="item.judgmentId"> |
|
|
|
<codemirror |
|
|
|
<codemirror :ref="'code' + i" |
|
|
|
:ref="'code' + i" |
|
|
|
:key="codeKey" |
|
|
|
:key="codeKey" |
|
|
|
:projectId.sync="projectId" |
|
|
|
:projectId.sync="projectId" |
|
|
|
:systemId.sync="systemId" |
|
|
|
:systemId.sync="systemId" |
|
|
|
:code.sync="item.code" |
|
|
|
:code.sync="item.code" |
|
|
|
:judgmentId="item.judgmentId" |
|
|
|
:judgmentId="item.judgmentId" |
|
|
|
:codeId.sync="item.codeId" |
|
|
|
:codeId.sync="item.codeId" |
|
|
|
:answer.sync="item.answer" |
|
|
|
:answer.sync="item.answer" |
|
|
|
:retResult.sync="item.retResult" |
|
|
|
:retResult.sync="item.retResult" |
|
|
|
:modelIsShow.sync="modelIsShow" |
|
|
|
:modelIsShow.sync="modelIsShow" |
|
|
|
@cache="leavePage"></codemirror> |
|
|
|
@cache="leavePage" |
|
|
|
|
|
|
|
></codemirror> |
|
|
|
|
|
|
|
</el-tab-pane> |
|
|
|
</el-tab-pane> |
|
|
|
</el-tabs> |
|
|
|
</el-tabs> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="menu"> |
|
|
|
<div class="menu"> |
|
|
|
<testPanel |
|
|
|
<testPanel @tell="setPoints" |
|
|
|
@tell="setPoints" |
|
|
|
@recoveryCode="recoveryCode" |
|
|
|
@recoveryCode="recoveryCode" |
|
|
|
ref="mainindex" |
|
|
|
ref="mainindex" |
|
|
|
:workbench.sync="workbench"></testPanel> |
|
|
|
:workbench.sync="workbench" |
|
|
|
|
|
|
|
></testPanel> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
@ -62,7 +74,7 @@ import codemirror from "../components/codemirror"; |
|
|
|
import Cookie from 'js-cookie' |
|
|
|
import Cookie from 'js-cookie' |
|
|
|
import { Loading } from 'element-ui' |
|
|
|
import { Loading } from 'element-ui' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
loaded: false, // 页面是否加载完的标识,页面默认隐藏,一进来先显示加载条,接口加载完后再显示页面,不然一开始会一闪而过没有样式的页面 |
|
|
|
loaded: false, // 页面是否加载完的标识,页面默认隐藏,一进来先显示加载条,接口加载完后再显示页面,不然一开始会一闪而过没有样式的页面 |
|
|
|
loadIns: null, // loading实例 |
|
|
|
loadIns: null, // loading实例 |
|
|
@ -71,6 +83,7 @@ export default { |
|
|
|
courseId: Cookie.get('admin-courseId'), // 课程id |
|
|
|
courseId: Cookie.get('admin-courseId'), // 课程id |
|
|
|
curriculumName: Cookie.get('admin-curriculumName') ? unescape(Cookie.get('admin-curriculumName')) : 'python', // 课程名称 |
|
|
|
curriculumName: Cookie.get('admin-curriculumName') ? unescape(Cookie.get('admin-curriculumName')) : 'python', // 课程名称 |
|
|
|
assessmentId: Cookie.get('admin-assessmentId'), // 考核id |
|
|
|
assessmentId: Cookie.get('admin-assessmentId'), // 考核id |
|
|
|
|
|
|
|
mallId: Cookie.get('admin-mallId'), |
|
|
|
projectId: '', |
|
|
|
projectId: '', |
|
|
|
systemId: '', |
|
|
|
systemId: '', |
|
|
|
modelIsShow: false, // 导入模型按钮是否显示 |
|
|
|
modelIsShow: false, // 导入模型按钮是否显示 |
|
|
@ -85,7 +98,7 @@ export default { |
|
|
|
codemirror, |
|
|
|
codemirror, |
|
|
|
testPanel |
|
|
|
testPanel |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted () { |
|
|
|
this.loadIns = Loading.service({ |
|
|
|
this.loadIns = Loading.service({ |
|
|
|
background: 'rgba(255, 255, 255, .1)' |
|
|
|
background: 'rgba(255, 255, 255, .1)' |
|
|
|
}) |
|
|
|
}) |
|
|
@ -95,12 +108,12 @@ export default { |
|
|
|
this.leavePage() |
|
|
|
this.leavePage() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
beforeRouteLeave(to, from, next) { |
|
|
|
beforeRouteLeave (to, from, next) { |
|
|
|
next(this.leavePage()) |
|
|
|
next(this.leavePage()) |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
// 页面离开的时候缓存未提交的代码(只有未提交状态下才会调用该接口) |
|
|
|
// 页面离开的时候缓存未提交的代码(只有未提交状态下才会调用该接口) |
|
|
|
leavePage() { |
|
|
|
leavePage () { |
|
|
|
const list = this.workbench |
|
|
|
const list = this.workbench |
|
|
|
// 未提交,且有判分点,才需要缓存 |
|
|
|
// 未提交,且有判分点,才需要缓存 |
|
|
|
if (!this.$refs.mainindex.isSubmit && list.length) { |
|
|
|
if (!this.$refs.mainindex.isSubmit && list.length) { |
|
|
@ -119,7 +132,7 @@ export default { |
|
|
|
cid: this.courseId, |
|
|
|
cid: this.courseId, |
|
|
|
projectId: this.projectId |
|
|
|
projectId: this.projectId |
|
|
|
} |
|
|
|
} |
|
|
|
this.$post(this.api.saveCache,data).then(res => {}).catch(e => {}) |
|
|
|
this.$post(this.api.saveCache, data).then(res => { }).catch(e => { }) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -129,17 +142,17 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取导入模型按钮展示状态 |
|
|
|
// 获取导入模型按钮展示状态 |
|
|
|
getModelStatus(systemId) { |
|
|
|
getModelStatus (systemId) { |
|
|
|
this.$post(`${this.api.checkIsShowBySystemId}?systemId=${systemId}`).then(res => { |
|
|
|
this.$post(`${this.api.checkIsShowBySystemId}?systemId=${systemId}`).then(res => { |
|
|
|
this.modelIsShow = !res.isShow // 0为展示 1为不展示 |
|
|
|
this.modelIsShow = !res.isShow // 0为展示 1为不展示 |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 跳转我的数据 |
|
|
|
// 跳转我的数据 |
|
|
|
toData() { |
|
|
|
toData () { |
|
|
|
this.$router.push('/data') |
|
|
|
this.$router.push('/data') |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 长时间未点击页面,就自动退出页面 |
|
|
|
// 长时间未点击页面,就自动退出页面 |
|
|
|
autoLogout() { |
|
|
|
autoLogout () { |
|
|
|
let lastTime = new Date().getTime() |
|
|
|
let lastTime = new Date().getTime() |
|
|
|
let logout = false |
|
|
|
let logout = false |
|
|
|
// 页面点击后赋值当前时间 |
|
|
|
// 页面点击后赋值当前时间 |
|
|
@ -148,15 +161,15 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
// 每秒钟判断一次,如果当前时间距离上次点击页面的试卷超过了设置的时间,就退出登录 |
|
|
|
// 每秒钟判断一次,如果当前时间距离上次点击页面的试卷超过了设置的时间,就退出登录 |
|
|
|
setInterval(() => { |
|
|
|
setInterval(() => { |
|
|
|
if((new Date().getTime() - lastTime) > this.$config.autoLogoutTime){ |
|
|
|
if ((new Date().getTime() - lastTime) > this.$config.autoLogoutTime) { |
|
|
|
logout || this.$message.error('用户登录过期,请重新登录') |
|
|
|
logout || this.$message.error('用户登录过期,请重新登录') |
|
|
|
logout = true |
|
|
|
logout = true |
|
|
|
setTimeout(this.back,1500) |
|
|
|
setTimeout(this.back, 1500) |
|
|
|
} |
|
|
|
} |
|
|
|
},1000) |
|
|
|
}, 1000) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 判分规则切换 |
|
|
|
// 判分规则切换 |
|
|
|
judChange() { |
|
|
|
judChange () { |
|
|
|
this.$nextTick(_ => { |
|
|
|
this.$nextTick(_ => { |
|
|
|
const code = this.$refs['code' + this.curTab][0].$refs.codemirror.codemirror // 获取codemirror实例 |
|
|
|
const code = this.$refs['code' + this.curTab][0].$refs.codemirror.codemirror // 获取codemirror实例 |
|
|
|
code.focus() // 编辑器聚焦 |
|
|
|
code.focus() // 编辑器聚焦 |
|
|
@ -164,12 +177,12 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 重置编辑器 |
|
|
|
// 重置编辑器 |
|
|
|
recoveryCode(curTab = '0') { |
|
|
|
recoveryCode (curTab = '0') { |
|
|
|
this.curTab = curTab |
|
|
|
this.curTab = curTab |
|
|
|
this.codeKey++ |
|
|
|
this.codeKey++ |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 退出实验 |
|
|
|
// 退出实验 |
|
|
|
back() { |
|
|
|
back () { |
|
|
|
let href = this.$config.isDev ? |
|
|
|
let href = this.$config.isDev ? |
|
|
|
`http://${location.hostname}:8082/#/` : |
|
|
|
`http://${location.hostname}:8082/#/` : |
|
|
|
`${location.origin}${this.fromManager ? |
|
|
|
`${location.origin}${this.fromManager ? |
|
|
@ -185,12 +198,12 @@ export default { |
|
|
|
href += `match/list` |
|
|
|
href += `match/list` |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 练习 |
|
|
|
// 练习 |
|
|
|
href += `station/preview?courseId=${this.courseId}&curriculumName=${this.curriculumName}` |
|
|
|
href += `station/preview?courseId=${this.courseId}&curriculumName=${this.curriculumName}&mallId=${this.mallId}` |
|
|
|
} |
|
|
|
} |
|
|
|
location.href = href |
|
|
|
location.href = href |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 赋值项目id、项目列表 |
|
|
|
// 赋值项目id、项目列表 |
|
|
|
setPoints(projectId, systemId, workbench) { |
|
|
|
setPoints (projectId, systemId, workbench) { |
|
|
|
this.projectId = projectId |
|
|
|
this.projectId = projectId |
|
|
|
this.systemId = systemId |
|
|
|
this.systemId = systemId |
|
|
|
this.workbench = workbench |
|
|
|
this.workbench = workbench |
|
|
@ -209,7 +222,7 @@ export default { |
|
|
|
height: 58px; |
|
|
|
height: 58px; |
|
|
|
line-height: 58px; |
|
|
|
line-height: 58px; |
|
|
|
background-color: #f8f8f8; |
|
|
|
background-color: #f8f8f8; |
|
|
|
&.hh{ |
|
|
|
&.hh { |
|
|
|
padding: 10px 0; |
|
|
|
padding: 10px 0; |
|
|
|
line-height: normal; |
|
|
|
line-height: normal; |
|
|
|
} |
|
|
|
} |
|
|
@ -218,7 +231,7 @@ export default { |
|
|
|
font-size: 20px; |
|
|
|
font-size: 20px; |
|
|
|
color: rgba(51, 51, 51, 1); |
|
|
|
color: rgba(51, 51, 51, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
.logo{ |
|
|
|
.logo { |
|
|
|
width: 200px; |
|
|
|
width: 200px; |
|
|
|
margin-left: 10px; |
|
|
|
margin-left: 10px; |
|
|
|
} |
|
|
|
} |
|
|
@ -287,7 +300,7 @@ export default { |
|
|
|
color: #bfbfbf; |
|
|
|
color: #bfbfbf; |
|
|
|
cursor: pointer; |
|
|
|
cursor: pointer; |
|
|
|
&:hover { |
|
|
|
&:hover { |
|
|
|
opacity: .9; |
|
|
|
opacity: 0.9; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |