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