openf12
yujialong 1 year ago
parent 2652e3b412
commit eb864e33c4
  1. 20
      src/components/TestPanel.vue
  2. 79
      src/components/codemirror.vue
  3. 29
      src/main.js

@ -100,7 +100,7 @@
<el-aside id="aside" <el-aside id="aside"
width="30%"> width="30%">
<div class="aside-header"> <div class="aside-header">
<div :class="['p-title color', 'system' + systemId]"> <div :class="['p-title color', 'system' + $themeId]">
<i class="el-icon-s-order"></i> <i class="el-icon-s-order"></i>
<p>实验目标</p> <p>实验目标</p>
</div> </div>
@ -110,7 +110,7 @@
</div> </div>
</div> </div>
<div class="aside-footer"> <div class="aside-footer">
<div :class="['p-title color', 'system' + systemId]"> <div :class="['p-title color', 'system' + $themeId]">
<i class="el-icon-s-management"></i> <i class="el-icon-s-management"></i>
<p>实验任务</p> <p>实验任务</p>
</div> </div>
@ -897,6 +897,12 @@ export default {
togglePannel () { togglePannel () {
document.querySelector('#panel').style.left = 0 document.querySelector('#panel').style.left = 0
this.pannelVisible = !this.pannelVisible this.pannelVisible = !this.pannelVisible
// if (this.pannelVisible) {
// document.querySelector('#toggle').onmousedown = null
// document.querySelector('#toggle').onmousedown = togglePannel
// } else {
this.drag()
// }
}, },
// //
timeFormat (param) { timeFormat (param) {
@ -938,6 +944,9 @@ export default {
}, },
// //
drag () { drag () {
document.querySelector('.scrollbar').onmousedown = null
document.querySelector('#toggle').onmousedown = null
const el = document.querySelector('#panel') const el = document.querySelector('#panel')
const drag = e => { const drag = e => {
if (this.dragIds.includes(e.target.id)) { if (this.dragIds.includes(e.target.id)) {
@ -962,7 +971,6 @@ export default {
} }
} }
} }
// document.querySelector('#header').onmousedown = drag
document.querySelector('.scrollbar').onmousedown = drag document.querySelector('.scrollbar').onmousedown = drag
@ -992,7 +1000,7 @@ export default {
document.onmouseup = null document.onmouseup = null
} }
} }
document.querySelector('#toggle').onmousedown = drag1 document.querySelector('#toggle').onmousedown = this.pannelVisible ? this.togglePannel : drag1
} }
} }
}; };
@ -1123,7 +1131,6 @@ export default {
&.system4 { &.system4 {
background-size: 100% 58px; background-size: 100% 58px;
} }
&.system5,
&.system7, &.system7,
&.system9 { &.system9 {
background-size: 100% 40px; background-size: 100% 40px;
@ -1132,9 +1139,6 @@ export default {
&.system6 { &.system6 {
background-size: 100% 61px; background-size: 100% 61px;
} }
&.system10 {
background-size: 104% 61px;
}
p { p {
padding-left: 10px; padding-left: 10px;
line-height: 40px; line-height: 40px;

@ -506,42 +506,49 @@ export default {
projectId, projectId,
type: 0 type: 0
}).then(res => { }).then(res => {
const data = res.code //
const photo = data.photoUrl if (res.code) {
const result = data.runResult || '' const data = res.code
this.$emit('cache') // const photo = data.photoUrl
this.loadIns.close() const result = data.runResult || ''
this.picSrcList = [] this.$emit('cache') //
if (photo) this.picSrcList = photo.split(',') this.loadIns.close()
this.$emit('update:codeId', res.codeId) // coddeId this.picSrcList = []
this.$emit('update:answer', result) // if (photo) this.picSrcList = photo.split(',')
this.$emit('update:retResult', data.retResult) // this.$emit('update:codeId', res.codeId) // coddeId
let imgList = '' this.$emit('update:answer', result) //
let firtImg = '' this.$emit('update:retResult', data.retResult) //
try { let imgList = ''
imgList = eval(result) let firtImg = ''
} catch (error) { } try {
if (imgList && imgList.length) firtImg = imgList[0] imgList = eval(result)
// } catch (error) { }
if (photo) { if (imgList && imgList.length) firtImg = imgList[0]
this.isError = data.retResult // //
const text = result.replace(photo, '') // if (photo) {
this.runResult = text this.isError = data.retResult //
this.picSrcList = photo.split(',') const text = result.replace(photo, '') //
this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length)) this.runResult = text
} else if (imgList instanceof Array && imgList.length && typeof firtImg === 'string' && (firtImg.includes('.jpg') || firtImg.includes('.png') || firtImg.includes('img'))) { this.picSrcList = photo.split(',')
/** this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length))
* 这段是为要下载图片的项目案例写的后端会返回图片名称的数组前端负责循环这个数组然后下载下来 } else if (imgList instanceof Array && imgList.length && typeof firtImg === 'string' && (firtImg.includes('.jpg') || firtImg.includes('.png') || firtImg.includes('img'))) {
*/ /**
imgList.map((n, i) => { * 这段是为要下载图片的项目案例写的后端会返回图片名称的数组前端负责循环这个数组然后下载下来
util.downloadFile(`${i + 1}.jpg`, n) */
}) imgList.map((n, i) => {
this.isError = 0 util.downloadFile(`${i + 1}.jpg`, n)
this.runResult = '下载完成' })
} else { this.isError = 0
this.isError = data.retResult this.runResult = '下载完成'
this.runResult = result } else {
this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length)) this.isError = data.retResult
this.runResult = result
this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length))
}
} else if (res.data && res.data.current) {
//
this.$message.success(`当前队列有${res.data.current - 1}人在排队,请稍等!`)
this.loadIns.close()
} }
}).catch(res => { }).catch(res => {
this.isError = false this.isError = false

@ -10,17 +10,38 @@ import config from '@/config'
import api from './api'; import api from './api';
import Cookie from 'js-cookie' import Cookie from 'js-cookie'
Vue.prototype.$themeId = 4 Vue.prototype.$themeId = 9
axios.get(config.host + api.detailsOfGoods + '?mallId=' + Cookie.get('admin-mallId'), { axios.get(config.host + api.detailsOfGoods + '?mallId=' + Cookie.get('admin-mallId'), {
headers: { headers: {
token: Cookie.get('admin-token') token: Cookie.get('admin-token')
}, },
}).then(({ data }) => { }).then(({ data }) => {
console.log(33, data.orderDetails.mall.themeId) console.log(33, data.orderDetails.mall.themeId)
const themeId = data.orderDetails.mall.themeId || 4 const themeId = data.orderDetails.mall.themeId || 9
// const themeId = 14
Vue.prototype.$themeId = themeId Vue.prototype.$themeId = themeId
require(`@/styles/theme/theme${themeId}.scss`) // require(`@/styles/theme/theme${themeId}.scss`)
if (themeId == 1) {
import('@/styles/theme/theme1.scss')
} else if (themeId == 2) {
import('@/styles/theme/theme2.scss')
} else if (themeId == 3) {
import('@/styles/theme/theme3.scss')
} else if (themeId == 4) {
import('@/styles/theme/theme4.scss')
} else if (themeId == 5) {
import('@/styles/theme/theme5.scss')
} else if (themeId == 6) {
import('@/styles/theme/theme6.scss')
} else if (themeId == 7) {
import('@/styles/theme/theme7.scss')
} else if (themeId == 8) {
import('@/styles/theme/theme8.scss')
} else if (themeId == 9) {
import('@/styles/theme/theme9.scss')
} else if (themeId == 10) {
import('@/styles/theme/theme10.scss')
}
}).catch(e => {}) }).catch(e => {})
import { import {

Loading…
Cancel
Save