添加python4个版本的切换

master
yujialong 5 months ago
parent 9f37d8be0a
commit 190bfe4fb8
  1. 10
      src/components/TestPanel.vue
  2. 6
      src/components/codemirror.vue
  3. 5
      src/config/index.js
  4. 55
      src/views/Home.vue

@ -335,7 +335,7 @@ export default {
const { data } = await this.$get(`${this.api.getTheMostRecentlyRunProject}`, {
cid: this.courseId
})
if (data.length) this.projectId = data[0].projectId
if (data && data.length) this.projectId = data[0].projectId
} else {
Cookie.set('admin-loaded', 1) //
}
@ -642,9 +642,9 @@ export default {
this.isSelected = true
await this.getEntryTime()
this.countVal = this.entryTime
this.setSubmit(false)
await this.getProDetail()
this.getCache()
this.setSubmit(false)
this.grade = '00'
this.pannelTab = 'first'
this.clearReport()
@ -755,7 +755,7 @@ export default {
confirmSubmit () {
if (this.submiting) return false
this.submiting = true
const isVscode = this.$parent.language // vscode
const isVscode = this.$parent.language === 'vscode' // vscode
const { taskList } = this
const pointList = this.$parent.workbench
let msg = '此操作将视为结束考试,是否继续?'
@ -788,7 +788,7 @@ export default {
cid: this.courseId,
projectId: this.projectId,
userAnswer: e.codeResult || null,
type: 0,
type: 'vscode',
sort: i
})
this.$parent.workbench[i].answer = e.codeResult
@ -805,7 +805,7 @@ export default {
bcId: pointList[0].judgmentId,
cid: this.courseId,
projectId: this.projectId,
type: 0
type: this.$parent.language
}).then(res => { }).catch(err => {
this.submiting = false
})

@ -522,7 +522,7 @@ export default {
bcId: this.judgmentId,
cid: this.courseId,
projectId: this.projectId,
type: 0,
type: Cookie.get('admin-language'),
sort: this.index
}, {
headers: {
@ -652,7 +652,7 @@ export default {
bcId,
cid,
projectId,
type: 0,
type: Cookie.get('admin-language'),
sort: this.index
}).then(res => {
this.$emit('update:finalCode', code)
@ -680,7 +680,7 @@ export default {
bcId,
cid,
projectId,
type: 0,
type: Cookie.get('admin-language'),
sort: this.index
}).then(res => {
this.$emit('update:finalCode', code)

@ -2,7 +2,8 @@ import Cookie from 'js-cookie'
const url = location.host
const isDev = process.env.NODE_ENV === 'development' //是否本地
const isTest = url.includes('121.37.12.51') //测试服
// const isTest = url.includes('121.37.12.51') //测试服
const isTest = true //测试服
const isHh = url.includes('10.196.131.73') //是否是河海版本
const isPro = url.includes('occupationlab.com') //是否职站生产
const isZxy = url.includes('izhixinyun.com') //是否智信云
@ -13,7 +14,7 @@ let host = location.origin + '/'
let bankPath = `${location.origin}/banksystem` // 银行系统
// 121.37.12.51 | 192.168.31.151
if (isDev) {
host = 'http://192.168.31.217:9000/'
host = 'http://192.168.31.51:9000/'
// host = 'http://121.37.12.51:9000/'
// host = 'https://occupationlab.com/'
bankPath = `http://${location.hostname}:8093`

@ -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];

Loading…
Cancel
Save