|
|
|
@ -11,10 +11,10 @@ |
|
|
|
|
<p v-if="$config.isHh" style="font-size: 18px">{{ $config.title }}</p> |
|
|
|
|
<p>编程语言</p> |
|
|
|
|
<el-select v-model="language" @change="languageChange"> |
|
|
|
|
<el-option v-for="(item, i) in languages" :key="i" :label="item.name" :value="item.id"></el-option> |
|
|
|
|
<el-option v-for="(item, i) in languages" :key="i" :value="item.name"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
|
|
<el-button v-if="language" class="open-vs" type="primary" size="small" |
|
|
|
|
<el-button v-if="language === 'vscode'" class="open-vs" type="primary" size="small" |
|
|
|
|
@click="openVscode">打开Vscode新窗口</el-button> |
|
|
|
|
</div> |
|
|
|
|
<div class="inline-center"> |
|
|
|
@ -29,7 +29,7 @@ |
|
|
|
|
<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 v-if="!language" :ref="'code' + i" :key="codeKey" :projectId.sync="projectId" |
|
|
|
|
<codemirror v-if="language !== 'vscode'" :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" |
|
|
|
|
:retResult.sync="item.retResult" :photoUrl.sync="item.photoUrl" :index="i" :curTab.sync="curTab" |
|
|
|
@ -70,25 +70,32 @@ export default { |
|
|
|
|
curriculumName: Cookie.get('admin-curriculumName') ? decodeURIComponent(Cookie.get('admin-curriculumName')) : 'python', // 课程名称 |
|
|
|
|
assessmentId: Cookie.get('admin-assessmentId'), // 考核id |
|
|
|
|
mallId: Cookie.get('admin-mallId'), |
|
|
|
|
language: +Cookie.get('admin-language') || 0, // 编程语言 |
|
|
|
|
language: Cookie.get('admin-language') || 'python3.7.9', // 编程语言 |
|
|
|
|
projectId: '', |
|
|
|
|
systemId: '', |
|
|
|
|
modelIsShow: false, // 导入模型按钮是否显示 |
|
|
|
|
projectPermissions: 0, // 项目权限(0、练习 1、考核 2、竞赛) |
|
|
|
|
languages: [ |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: 'Python' |
|
|
|
|
name: 'python3.7.9' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: 'Vscode' |
|
|
|
|
name: 'python3.9' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: 'python3.10' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: 'python3.12.4' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: 'vscode' |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
curTab: '', // 选中后绑定的对象 |
|
|
|
|
workbench: [], // 判分点切换列表 |
|
|
|
|
codeKey: 1, // 编辑器索引 |
|
|
|
|
notAllowed: 0, |
|
|
|
|
notAllowed: 1, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
@ -96,20 +103,22 @@ export default { |
|
|
|
|
testPanel |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
const opened = +localStorage.getItem('opened') |
|
|
|
|
if (opened) { |
|
|
|
|
localStorage.setItem('opened', opened + 1) |
|
|
|
|
this.notAllowed = 1 |
|
|
|
|
this.$alert('我们注意到您当前已尝试打开多个实验页面。为保证实验的公平性和诚信,系统仅允许单个实验页面处于活跃状态。', '提示', { |
|
|
|
|
confirmButtonText: '退出当前页面', |
|
|
|
|
showClose: false, |
|
|
|
|
beforeClose: () => { |
|
|
|
|
Util.exit() |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
localStorage.setItem('opened', 1) |
|
|
|
|
} |
|
|
|
|
Cookie.get('admin-language') || Cookie.set('admin-language', 'python3.7.9') |
|
|
|
|
// const opened = +localStorage.getItem('opened') |
|
|
|
|
// if (opened) { |
|
|
|
|
// localStorage.setItem('opened', opened + 1) |
|
|
|
|
// this.$alert('我们注意到您当前已尝试打开多个实验页面。为保证实验的公平性和诚信,系统仅允许单个实验页面处于活跃状态。', '提示', { |
|
|
|
|
// confirmButtonText: '退出当前页面', |
|
|
|
|
// showClose: false, |
|
|
|
|
// beforeClose: () => { |
|
|
|
|
// Util.exit() |
|
|
|
|
// }, |
|
|
|
|
// }) |
|
|
|
|
// } else { |
|
|
|
|
// this.notAllowed = 0 |
|
|
|
|
// localStorage.setItem('opened', 1) |
|
|
|
|
// } |
|
|
|
|
this.notAllowed = 0 |
|
|
|
|
|
|
|
|
|
document.onkeydown = function (event) { |
|
|
|
|
var e = event || window.event || arguments.callee.caller.arguments[0]; |
|
|
|
|