|
|
|
@ -5,6 +5,7 @@ |
|
|
|
|
<p v-else>{{ curriculumName }}</p> |
|
|
|
|
<el-button class="back btn" type="primary" @click="back">退出实验</el-button> |
|
|
|
|
</div> |
|
|
|
|
<template v-if="!notAllowed"> |
|
|
|
|
<div class="top"> |
|
|
|
|
<div class="language"> |
|
|
|
|
<p v-if="$config.isHh" style="font-size: 18px">{{ $config.title }}</p> |
|
|
|
@ -26,7 +27,8 @@ |
|
|
|
|
|
|
|
|
|
<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"> |
|
|
|
|
<el-tab-pane v-for="(item, i) in workbench" :key="item.judgmentId" :label="item.name" |
|
|
|
|
:value="item.judgmentId"> |
|
|
|
|
<codemirror v-if="!language" :ref="'code' + i" :key="codeKey" :projectId.sync="projectId" |
|
|
|
|
:systemId.sync="systemId" :code.sync="item.code" :finalCode.sync="item.finalCode" |
|
|
|
|
:judgmentId="item.judgmentId" :codeId.sync="item.codeId" :answer.sync="item.answer" |
|
|
|
@ -38,10 +40,12 @@ |
|
|
|
|
</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 v-if="isSubmit" class="mask"></div> |
|
|
|
|
</template> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
@ -82,7 +86,8 @@ export default { |
|
|
|
|
], |
|
|
|
|
curTab: '', // 选中后绑定的对象 |
|
|
|
|
workbench: [], // 判分点切换列表 |
|
|
|
|
codeKey: 1 // 编辑器索引 |
|
|
|
|
codeKey: 1, // 编辑器索引 |
|
|
|
|
notAllowed: 0, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
@ -90,22 +95,32 @@ export default { |
|
|
|
|
testPanel |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
const opened = localStorage.getItem('opened') |
|
|
|
|
if (opened || opened === '0') { |
|
|
|
|
localStorage.setItem('opened', +opened + 1) |
|
|
|
|
// 保证同一个浏览器只有一个当前系统能打开 |
|
|
|
|
const opened = +localStorage.getItem('opened') |
|
|
|
|
if (opened) { |
|
|
|
|
localStorage.setItem('opened', opened + 1) |
|
|
|
|
this.notAllowed = 1 |
|
|
|
|
this.$alert('我们注意到您当前已尝试打开多个实验页面。为保证实验的公平性和诚信,系统仅允许单个实验页面处于活跃状态。', '提示', { |
|
|
|
|
confirmButtonText: '退出当前页面', |
|
|
|
|
showClose: false, |
|
|
|
|
callback: action => { |
|
|
|
|
this.back() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
localStorage.setItem('opened', 1) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 页面离开后当前活跃的标识处理 |
|
|
|
|
window.addEventListener('unload', function () { |
|
|
|
|
const opened = localStorage.getItem('opened') |
|
|
|
|
const opened = +localStorage.getItem('opened') |
|
|
|
|
if (opened) { |
|
|
|
|
localStorage.setItem('opened', +opened - 1) |
|
|
|
|
localStorage.setItem('opened', opened - 1) |
|
|
|
|
} else { |
|
|
|
|
localStorage.removeItem('opened') |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
console.log(11, localStorage.getItem('opened')) |
|
|
|
|
document.onkeydown = function (event) { |
|
|
|
|
var e = event || window.event || arguments.callee.caller.arguments[0]; |
|
|
|
|
|
|
|
|
@ -142,7 +157,6 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 跳转我的数据 |
|
|
|
|
toData () { |
|
|
|
|
return console.log(11, localStorage.getItem('opened')) |
|
|
|
|
this.$router.push('/data') |
|
|
|
|
}, |
|
|
|
|
// 长时间未点击页面,就自动退出页面 |
|
|
|
|