主题只用系统7的,以及从职站获取systemIds,获取多个系统的项目

dev_2022-03-03
yujialong 3 years ago
parent 44bbe8c6c0
commit 8e8097923b
  1. 20
      src/components/TestPanel.vue
  2. 19
      src/components/codemirror.vue
  3. 7
      src/config/index.js
  4. 19
      src/main.js
  5. 19
      src/views/Home.vue

@ -117,8 +117,8 @@
<div :class="['toggle-panel', {active: pannelVisible}]"> <div :class="['toggle-panel', {active: pannelVisible}]">
<div @click="togglePannel"> <div @click="togglePannel">
<img :src="require(`@/assets/images/system/${systemId}/left.png`)" alt class="c-p" v-if="pannelVisible" /> <img :src="require(`@/assets/images/system/${$config.defaultSystem}/left.png`)" alt class="c-p" v-if="pannelVisible" />
<img :src="require(`@/assets/images/system/${systemId}/right.png`)" alt class="c-p" v-if="!pannelVisible" /> <img :src="require(`@/assets/images/system/${$config.defaultSystem}/right.png`)" alt class="c-p" v-if="!pannelVisible" />
</div> </div>
</div> </div>
</div> </div>
@ -130,12 +130,13 @@ import util from '@/util'
export default { export default {
data() { data() {
return { return {
systemId: Number(util.getCookie('systemId') || 1), systemId: util.getCookie('systemId') || 1,
classId: util.getCookie('classId'), classId: util.getCookie('classId'),
className: util.getCookie('className') ? decodeURI(util.getCookie('className')) : '', className: util.getCookie('className') ? decodeURI(util.getCookie('className')) : '',
courseId: util.getCookie('courseId'), courseId: util.getCookie('courseId'),
projectId: util.getCookie('projectId') ? Number(util.getCookie('projectId')) : '', projectId: util.getCookie('projectId') ? Number(util.getCookie('projectId')) : '',
assessmentId: util.getCookie('assessmentId'), assessmentId: util.getCookie('assessmentId'),
curSystemId: 1,
projectPermissions: 0, // (0 1 2) projectPermissions: 0, // (0 1 2)
isSubmit: false, // isSubmit: false, //
entryTime: new Date(), entryTime: new Date(),
@ -232,6 +233,9 @@ export default {
projectName: project.projectName projectName: project.projectName
}] }]
} }
const { systemId } = project
this.curSystemId = systemId
this.$parent.getModelStatus(systemId)
this.curReq = curReq // judgmentIditem this.curReq = curReq // judgmentIditem
this.points = points this.points = points
this.taskList = points // this.taskList = points //
@ -240,7 +244,7 @@ export default {
this.experimentDescription = project.experimentDescription this.experimentDescription = project.experimentDescription
this.experimentHint = project.experimentHint this.experimentHint = project.experimentHint
this.hintOpen = !res.projectManage.hintOpen // 01 this.hintOpen = !res.projectManage.hintOpen // 01
this.$emit('tell', projectId, this.points) this.$emit('tell', projectId, systemId, this.points)
const isAss = this.projectPermissions == 1 // const isAss = this.projectPermissions == 1 //
this.text = isAss ? '剩余' : '已用' this.text = isAss ? '剩余' : '已用'
this.countVal = isAss ? (new Date(this.endTime).getTime() - Date.now()) / 1000 : 0 // 0 this.countVal = isAss ? (new Date(this.endTime).getTime() - Date.now()) / 1000 : 0 // 0
@ -349,7 +353,7 @@ export default {
const item = points.find(n => n.judgmentId === e.judgmentId) const item = points.find(n => n.judgmentId === e.judgmentId)
if (item && item.code) this.$set(e, 'code', item.code) if (item && item.code) this.$set(e, 'code', item.code)
}) })
this.$emit('tell', projectId, this.points) this.$emit('tell', projectId, this.curSystemId, this.points)
this.$emit('recoveryCode', newJudgmentId + '') // tab this.$emit('recoveryCode', newJudgmentId + '') // tab
}).catch(res => {}) }).catch(res => {})
} else { } else {
@ -357,7 +361,7 @@ export default {
const item = points.find(n => n.judgmentId === e.judgmentId) const item = points.find(n => n.judgmentId === e.judgmentId)
if (item && item.code) this.$set(e, 'code', item.code) if (item && item.code) this.$set(e, 'code', item.code)
}) })
this.$emit('tell', projectId, this.points) this.$emit('tell', projectId, this.curSystemId, this.points)
this.$emit('recoveryCode') this.$emit('recoveryCode')
} }
}).catch(() => { }).catch(() => {
@ -419,7 +423,7 @@ export default {
e.answer = '' e.answer = ''
e.retResult = '' e.retResult = ''
}) })
this.$emit('tell', this.projectId, points) this.$emit('tell', this.projectId, this.curSystemId, points)
this.$emit('recoveryCode') this.$emit('recoveryCode')
this.startCount() this.startCount()
}, },
@ -471,7 +475,7 @@ export default {
projectName, projectName,
assessmentId: this.assessmentId ? this.assessmentId : '', assessmentId: this.assessmentId ? this.assessmentId : '',
totalScore: 100, // 100 totalScore: 100, // 100
systemId: this.systemId, systemId: this.curSystemId,
purpose: this.experimentTarget, // purpose: this.experimentTarget, //
attributesReqList attributesReqList
} }

@ -42,7 +42,7 @@
</div> </div>
</div> </div>
<div class="result-right t-color" v-show="isError"> <div class="result-right t-color" v-show="isError">
<img :src="require(`@/assets/images/system/${systemId}/yes.png`)" alt />运行成功 <img :src="require(`@/assets/images/system/${$config.defaultSystem}/yes.png`)" alt />运行成功
</div> </div>
<div class="result-wrong" v-show="isError === 0"> <div class="result-wrong" v-show="isError === 0">
<img src="@/assets/images/error.png" alt /> <img src="@/assets/images/error.png" alt />
@ -69,7 +69,8 @@
show-checkbox show-checkbox
:check-strictly="true" :check-strictly="true"
node-key="id" node-key="id"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"> :props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"
v-loading="modelLoading">
</el-tree> </el-tree>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -128,13 +129,12 @@ import util from '@/util'
import config from '@/config' import config from '@/config'
const CANCEL_TOKEN = axios.CancelToken // input const CANCEL_TOKEN = axios.CancelToken // input
export default { export default {
props: ['judgmentId', 'code', 'codeId', 'projectId', 'retResult', 'modelIsShow'], props: ['judgmentId', 'code', 'codeId', 'projectId', 'systemId', 'retResult', 'modelIsShow'],
data() { data() {
return { return {
token: util.getCookie('admin-token'), token: util.getCookie('admin-token'),
assessmentId: util.getCookie('assessmentId'), // id assessmentId: util.getCookie('assessmentId'), // id
courseId: util.getCookie('courseId'), // id courseId: util.getCookie('courseId'), // id
systemId: util.getCookie('systemId'),
showTips: false, // showTips: false, //
answer: '', // answer: '', //
codeVal: this.code, codeVal: this.code,
@ -176,6 +176,8 @@ export default {
sourceCode: '', // inputexit sourceCode: '', // inputexit
requestTimer: null, // requestTimer: null, //
modelVisible: false, modelVisible: false,
modelLoading: false,
modelImporting: false,
modelData: [] modelData: []
}; };
}, },
@ -216,6 +218,7 @@ export default {
}, },
// //
importModel() { importModel() {
this.modelLoading = true
this.modelVisible = true this.modelVisible = true
// //
this.$post(`${this.api.modelClassList}?systemId=${this.systemId}`).then(res => { this.$post(`${this.api.modelClassList}?systemId=${this.systemId}`).then(res => {
@ -248,6 +251,7 @@ export default {
addType(data) addType(data)
Promise.all(promises).then(_ => { Promise.all(promises).then(_ => {
this.modelData = data this.modelData = data
this.modelLoading = false
}).catch(res => {}) }).catch(res => {})
}).catch(res => {}) }).catch(res => {})
}, },
@ -262,15 +266,20 @@ export default {
}, },
// //
submit() { submit() {
if (this.modelImporting) return false
const id = this.$refs.tree.getCheckedKeys() const id = this.$refs.tree.getCheckedKeys()
if (!id.length) return this.$message.error('请选择模型!') if (!id.length) return this.$message.error('请选择模型!')
this.modelImporting = true
this.$post(`${this.api.referenceFindById}?id=${id[0]}`).then(res => { this.$post(`${this.api.referenceFindById}?id=${id[0]}`).then(res => {
this.codeVal += '\n\n' + res.data.modelDemo // this.codeVal += (this.codeVal ? '\n\n' : '') + res.data.modelDemo //
this.modelVisible = false this.modelVisible = false
this.$nextTick(() => { this.$nextTick(() => {
const codemirror = this.$refs.codemirror.codemirror const codemirror = this.$refs.codemirror.codemirror
codemirror.focus() codemirror.focus()
codemirror.setCursor(codemirror.lineCount(), 0) codemirror.setCursor(codemirror.lineCount(), 0)
setTimeout(() => {
this.modelImporting = false
}, 2000)
}) })
}).catch(res => {}) }).catch(res => {})
}, },

@ -9,7 +9,6 @@ if (process.env.NODE_ENV === 'development') host = 'http://192.168.31.151:9000'
* python8个系统的id和名称 * python8个系统的id和名称
* id即systemId从cookie里取 * id即systemId从cookie里取
*/ */
const systemId = util.getCookie('systemId')
const pythonList = [ const pythonList = [
{ {
id: 1, id: 1,
@ -44,8 +43,6 @@ const pythonList = [
name: 'Python数据采集(爬虫)教学实验系统' name: 'Python数据采集(爬虫)教学实验系统'
} }
] ]
const systemItem = pythonList.find(e => e.id == systemId)
const title = systemItem ? systemItem.name : 'Python程序设计教学系统' // 如果有匹配的python系统,则取匹配到的python,否则,默认显示python程序设计,其他地方同理
export default { export default {
/** /**
* @description 域名 * @description 域名
@ -60,9 +57,9 @@ export default {
*/ */
isBeta, isBeta,
/** /**
* @description 配置显示在浏览器标签的title * @description 系统主题色
*/ */
title, defaultSystem: 7,
/** /**
* python子系统 * python子系统
**/ **/

@ -6,23 +6,7 @@ import ElementUI from 'element-ui'
import util from '@/util' import util from '@/util'
import '@/styles/index.scss'; import '@/styles/index.scss';
const systemId = util.getCookie('systemId') const systemId = util.getCookie('systemId')
if (systemId == 1) {
import('@/styles/theme/theme1.scss')
} else if (systemId == 4) {
import('@/styles/theme/theme4.scss')
} else if (systemId == 5) {
import('@/styles/theme/theme5.scss')
} else if (systemId == 6) {
import('@/styles/theme/theme6.scss')
} else if (systemId == 7) {
import('@/styles/theme/theme7.scss') import('@/styles/theme/theme7.scss')
} else if (systemId == 8) {
import('@/styles/theme/theme8.scss')
} else if (systemId == 9) {
import('@/styles/theme/theme9.scss')
} else if (systemId == 10) {
import('@/styles/theme/theme10.scss')
}
import api from './api'; import api from './api';
import { import {
post, post,
@ -53,7 +37,8 @@ Vue.prototype.$put = put;
Vue.prototype.$config = config Vue.prototype.$config = config
Vue.config.productionTip = false; Vue.config.productionTip = false;
document.title = config.title const curriculumName = util.getCookie('curriculumName')
document.title = curriculumName ? unescape(curriculumName) : 'python'
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
next() next()
}) })

@ -2,7 +2,7 @@
<div v-show="loaded"> <div v-show="loaded">
<div class="header" :class="{hh: $config.isHh}"> <div class="header" :class="{hh: $config.isHh}">
<img v-if="$config.isHh" src="@/assets/images/logo-hh.png" alt="" class="logo"> <img v-if="$config.isHh" src="@/assets/images/logo-hh.png" alt="" class="logo">
<p v-else>{{$config.title}}</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>
@ -24,6 +24,7 @@
:ref="'code' + i" :ref="'code' + i"
:key="codeKey" :key="codeKey"
:projectId.sync="projectId" :projectId.sync="projectId"
:systemId.sync="systemId"
:code.sync="item.code" :code.sync="item.code"
:judgmentId="item.judgmentId" :judgmentId="item.judgmentId"
:codeId.sync="item.codeId" :codeId.sync="item.codeId"
@ -57,9 +58,11 @@ export default {
return { return {
loaded: false, // loaded: false, //
loadIns: null, // loading loadIns: null, // loading
courseId: util.getCookie("courseId"), // id courseId: util.getCookie('courseId'), // id
assessmentId: util.getCookie("assessmentId"), // id curriculumName: util.getCookie('curriculumName') ? unescape(util.getCookie('curriculumName')) : 'python', //
systemId: util.getCookie('systemId'), assessmentId: util.getCookie('assessmentId'), // id
projectId: '',
systemId: '',
modelIsShow: false, // modelIsShow: false, //
projectPermissions: 0, // (0 1 2) projectPermissions: 0, // (0 1 2)
language: 'Python', // language: 'Python', //
@ -76,7 +79,6 @@ export default {
this.loadIns = Loading.service({ this.loadIns = Loading.service({
background: 'rgba(255, 255, 255, .1)' background: 'rgba(255, 255, 255, .1)'
}) })
this.getModelStatus()
this.autoLogout() this.autoLogout()
// //
window.onbeforeunload = () => { window.onbeforeunload = () => {
@ -108,8 +110,8 @@ export default {
} }
}, },
// //
getModelStatus() { getModelStatus(systemId) {
this.$post(`${this.api.checkIsShowBySystemId}?systemId=${this.systemId}`).then(res => { this.$post(`${this.api.checkIsShowBySystemId}?systemId=${systemId}`).then(res => {
this.modelIsShow = !res.isShow // 0 1 this.modelIsShow = !res.isShow // 0 1
}).catch(res => {}) }).catch(res => {})
}, },
@ -148,8 +150,9 @@ export default {
history.back() history.back()
}, },
// id // id
setPoints(projectId, workbench) { setPoints(projectId, systemId, workbench) {
this.projectId = projectId this.projectId = projectId
this.systemId = systemId
this.workbench = workbench this.workbench = workbench
}, },
} }

Loading…
Cancel
Save