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

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

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

@ -11,10 +11,10 @@
<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> <p>编程语言</p>
<el-select v-model="language" @change="languageChange"> <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-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> @click="openVscode">打开Vscode新窗口</el-button>
</div> </div>
<div class="inline-center"> <div class="inline-center">
@ -29,7 +29,7 @@
<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" <el-tab-pane v-for="(item, i) in workbench" :key="item.judgmentId" :label="item.name"
:value="item.judgmentId"> :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" :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"
:retResult.sync="item.retResult" :photoUrl.sync="item.photoUrl" :index="i" :curTab.sync="curTab" :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', // curriculumName: Cookie.get('admin-curriculumName') ? decodeURIComponent(Cookie.get('admin-curriculumName')) : 'python', //
assessmentId: Cookie.get('admin-assessmentId'), // id assessmentId: Cookie.get('admin-assessmentId'), // id
mallId: Cookie.get('admin-mallId'), mallId: Cookie.get('admin-mallId'),
language: +Cookie.get('admin-language') || 0, // language: Cookie.get('admin-language') || 'python3.7.9', //
projectId: '', projectId: '',
systemId: '', systemId: '',
modelIsShow: false, // modelIsShow: false, //
projectPermissions: 0, // (0 1 2) projectPermissions: 0, // (0 1 2)
languages: [ languages: [
{ {
id: 0, name: 'python3.7.9'
name: 'Python'
}, },
{ {
id: 1, name: 'python3.9'
name: 'Vscode' },
{
name: 'python3.10'
},
{
name: 'python3.12.4'
},
{
name: 'vscode'
}, },
], ],
curTab: '', // curTab: '', //
workbench: [], // workbench: [], //
codeKey: 1, // codeKey: 1, //
notAllowed: 0, notAllowed: 1,
}; };
}, },
components: { components: {
@ -96,20 +103,22 @@ export default {
testPanel testPanel
}, },
mounted () { mounted () {
const opened = +localStorage.getItem('opened') Cookie.get('admin-language') || Cookie.set('admin-language', 'python3.7.9')
if (opened) { // const opened = +localStorage.getItem('opened')
localStorage.setItem('opened', opened + 1) // if (opened) {
this.notAllowed = 1 // localStorage.setItem('opened', opened + 1)
this.$alert('我们注意到您当前已尝试打开多个实验页面。为保证实验的公平性和诚信,系统仅允许单个实验页面处于活跃状态。', '提示', { // this.$alert('', '', {
confirmButtonText: '退出当前页面', // confirmButtonText: '退',
showClose: false, // showClose: false,
beforeClose: () => { // beforeClose: () => {
Util.exit() // Util.exit()
}, // },
}) // })
} else { // } else {
localStorage.setItem('opened', 1) // this.notAllowed = 0
} // localStorage.setItem('opened', 1)
// }
this.notAllowed = 0
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];

Loading…
Cancel
Save