openf12
yujialong 2 years ago
parent 91342b1d71
commit ac2f86b339
  1. 3
      src/components/TestPanel.vue
  2. 127
      src/views/Home.vue

@ -56,7 +56,7 @@
<p>实验目标</p>
</div>
<div class="goal">
<div class="break-all" v-html="experimentTarget"></div>
<div class="ql-editor" v-html="experimentTarget"></div>
</div>
</div>
<div class="aside-footer">
@ -898,7 +898,6 @@ export default {
.goal {
padding: 10px 0;
margin: 0 10px;
text-indent: 2em;
font-size: 14px;
}
/deep/.select {

@ -1,57 +1,69 @@
<template>
<div v-show="loaded">
<div class="header" :class="{hh: $config.isHh}">
<img v-if="$config.isHh" src="@/assets/images/logo-hh.png" alt="" class="logo">
<div class="header"
:class="{hh: $config.isHh}">
<img v-if="$config.isHh"
src="@/assets/images/logo-hh.png"
alt=""
class="logo">
<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 class="top">
<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>
<el-input placeholder="请输入内容" v-model="language" :disabled="true"></el-input>
<el-input placeholder="请输入内容"
v-model="language"
:disabled="true"></el-input>
</div>
<div class="inline-center">
<el-tooltip class="item" effect="dark" content="支持导入其它数据用于实验,总上传的文件大小不可以超过10M" placement="bottom">
<i class="info el-icon-warning" style="margin-right: 10px"></i>
<el-tooltip class="item"
effect="dark"
content="支持导入其它数据用于实验,总上传的文件大小不可以超过10M"
placement="bottom">
<i class="info el-icon-warning"
style="margin-right: 10px"></i>
</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 class="tab">
<el-tabs v-model="curTab" type="card" @tab-click="judChange">
<el-tab-pane
v-for="(item, i) in workbench"
:key="item.judgmentId"
:label="item.name"
:value="item.judgmentId"
>
<codemirror
:ref="'code' + i"
:key="codeKey"
:projectId.sync="projectId"
:systemId.sync="systemId"
:code.sync="item.code"
:judgmentId="item.judgmentId"
:codeId.sync="item.codeId"
:answer.sync="item.answer"
:retResult.sync="item.retResult"
:modelIsShow.sync="modelIsShow"
@cache="leavePage"
></codemirror>
<el-tabs v-model="curTab"
type="card"
@tab-click="judChange">
<el-tab-pane v-for="(item, i) in workbench"
:key="item.judgmentId"
:label="item.name"
:value="item.judgmentId">
<codemirror :ref="'code' + i"
:key="codeKey"
:projectId.sync="projectId"
:systemId.sync="systemId"
:code.sync="item.code"
:judgmentId="item.judgmentId"
:codeId.sync="item.codeId"
:answer.sync="item.answer"
:retResult.sync="item.retResult"
:modelIsShow.sync="modelIsShow"
@cache="leavePage"></codemirror>
</el-tab-pane>
</el-tabs>
</div>
<div class="menu">
<testPanel
@tell="setPoints"
@recoveryCode="recoveryCode"
ref="mainindex"
:workbench.sync="workbench"
></testPanel>
<testPanel @tell="setPoints"
@recoveryCode="recoveryCode"
ref="mainindex"
:workbench.sync="workbench"></testPanel>
</div>
</div>
</template>
@ -62,7 +74,7 @@ import codemirror from "../components/codemirror";
import Cookie from 'js-cookie'
import { Loading } from 'element-ui'
export default {
data() {
data () {
return {
loaded: false, //
loadIns: null, // loading
@ -71,6 +83,7 @@ export default {
courseId: Cookie.get('admin-courseId'), // id
curriculumName: Cookie.get('admin-curriculumName') ? unescape(Cookie.get('admin-curriculumName')) : 'python', //
assessmentId: Cookie.get('admin-assessmentId'), // id
mallId: Cookie.get('admin-mallId'),
projectId: '',
systemId: '',
modelIsShow: false, //
@ -85,7 +98,7 @@ export default {
codemirror,
testPanel
},
mounted() {
mounted () {
this.loadIns = Loading.service({
background: 'rgba(255, 255, 255, .1)'
})
@ -95,12 +108,12 @@ export default {
this.leavePage()
}
},
beforeRouteLeave(to, from, next) {
beforeRouteLeave (to, from, next) {
next(this.leavePage())
},
methods: {
//
leavePage() {
leavePage () {
const list = this.workbench
//
if (!this.$refs.mainindex.isSubmit && list.length) {
@ -119,7 +132,7 @@ export default {
cid: this.courseId,
projectId: this.projectId
}
this.$post(this.api.saveCache,data).then(res => {}).catch(e => {})
this.$post(this.api.saveCache, data).then(res => { }).catch(e => { })
}
})
} else {
@ -129,17 +142,17 @@ export default {
}
},
//
getModelStatus(systemId) {
getModelStatus (systemId) {
this.$post(`${this.api.checkIsShowBySystemId}?systemId=${systemId}`).then(res => {
this.modelIsShow = !res.isShow // 0 1
}).catch(res => {})
}).catch(res => { })
},
//
toData() {
toData () {
this.$router.push('/data')
},
// 退
autoLogout() {
autoLogout () {
let lastTime = new Date().getTime()
let logout = false
//
@ -148,15 +161,15 @@ export default {
}
// 退
setInterval(() => {
if((new Date().getTime() - lastTime) > this.$config.autoLogoutTime){
logout || this.$message.error('用户登录过期,请重新登录')
logout = true
setTimeout(this.back,1500)
if ((new Date().getTime() - lastTime) > this.$config.autoLogoutTime) {
logout || this.$message.error('用户登录过期,请重新登录')
logout = true
setTimeout(this.back, 1500)
}
},1000)
}, 1000)
},
//
judChange() {
judChange () {
this.$nextTick(_ => {
const code = this.$refs['code' + this.curTab][0].$refs.codemirror.codemirror // codemirror
code.focus() //
@ -164,13 +177,13 @@ export default {
})
},
//
recoveryCode(curTab = '0') {
recoveryCode (curTab = '0') {
this.curTab = curTab
this.codeKey++
},
// 退
back() {
let href = this.$config.isDev ?
back () {
let href = this.$config.isDev ?
`http://${location.hostname}:8082/#/` :
`${location.origin}${this.fromManager ?
'/admin' :
@ -185,12 +198,12 @@ export default {
href += `match/list`
} 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
},
// id
setPoints(projectId, systemId, workbench) {
setPoints (projectId, systemId, workbench) {
this.projectId = projectId
this.systemId = systemId
this.workbench = workbench
@ -209,7 +222,7 @@ export default {
height: 58px;
line-height: 58px;
background-color: #f8f8f8;
&.hh{
&.hh {
padding: 10px 0;
line-height: normal;
}
@ -218,7 +231,7 @@ export default {
font-size: 20px;
color: rgba(51, 51, 51, 1);
}
.logo{
.logo {
width: 200px;
margin-left: 10px;
}
@ -287,7 +300,7 @@ export default {
color: #bfbfbf;
cursor: pointer;
&:hover {
opacity: .9;
opacity: 0.9;
}
}
</style>
Loading…
Cancel
Save