去掉localStorage里的代码缓存,只保留接口缓存

master
yujialong 6 months ago
parent ac1914bf1d
commit ac88afa39b
  1. 35
      src/api/index.js
  2. 552
      src/components/TestPanel.vue
  3. 1
      src/components/codemirror.vue
  4. 160
      src/views/Home.vue

@ -1,6 +1,6 @@
import config from '@/config'
export default {
getCurrentTime : `competition/competition/management/getCurrentTime`,
getCurrentTime: `competition/competition/management/getCurrentTime`,
getProjectDetail: 'occupationlab/occupationlab/projectManage/getProjectDetail',
submit: 'python/python/submit',
runPythonCode: 'python/python/runPythonCode',
@ -14,10 +14,10 @@ export default {
getPurchasedTableByCategory: `data/data/myDate/getPurchasedTableByCategory`,
previewData: `data/data/preview`,
lookupTableFile: `occupationlab/python/table/data/lookupTableFile`,
downloadData:`${config.host}data/data/download`,
downloadData: `${config.host}data/data/download`,
getDetailById: 'occupationlab/occupationlab/assessment/getDetailById',
pageStuAssessment: 'occupationlab/occupationlab/assessment/pageStuAssessment',
queryUserInfoDetails: `users/users/userAccount/queryUserInfoDetails`,
queryUserInfoDetails: `users/users/userAccount/queryUserInfoDetails`,
modelClassList: `nakadai/nakadai/model/reference/modelClassList`,
studentModelList: `nakadai/nakadai/model/student/studentModelList`,
referenceDemoList: `nakadai/nakadai/model/reference/demo/referenceDemoList`,
@ -32,18 +32,19 @@ export default {
exportLabReport: `occupationlab/occupationlab/achievement/exportLabReport`,
reportDetail: `occupationlab/occupationlab/achievement/reportDetail`,
getCompetition: `competition/competition/management/getCompetition`,
whetherCanPaste: `nakadai/nakadai/model/demo/whetherCanPaste`,
displayListOrNotByStudent: `nakadai/nakadai/model/demo/displayListOrNotByStudent`,
modelClassListByStudent: `nakadai/nakadai/model/student/modelClassListByStudent`,
studentModelListBySystem: `nakadai/nakadai/model/student/studentModelListBySystem`,
detailsOfGoods: `nakadai/mall/detailsOfGoods`,
importCode: `occupationlab/occupationlab/experimentalReport/importCode`,
removeImport: `occupationlab/occupationlab/experimentalReport/removeImport`,
getStartTime: `python/python/getStartTime`,
getProductSystemTheme: `nakadai/mall/getProductSystemTheme`,
heartbeatDetection : `nakadai/message/heartbeatDetection`,
heartbeatDetectionRabbit : `python/rabbitMessage/heartbeatDetection`,
createQueue : `python/rabbitMessage/createQueue`,
endRunningProcess : `python/python/endRunningProcess`,
sendMessageToUser : `python/rabbitMessage/sendMessageToUser`,
whetherCanPaste: `nakadai/nakadai/model/demo/whetherCanPaste`,
displayListOrNotByStudent: `nakadai/nakadai/model/demo/displayListOrNotByStudent`,
modelClassListByStudent: `nakadai/nakadai/model/student/modelClassListByStudent`,
studentModelListBySystem: `nakadai/nakadai/model/student/studentModelListBySystem`,
detailsOfGoods: `nakadai/mall/detailsOfGoods`,
importCode: `occupationlab/occupationlab/experimentalReport/importCode`,
removeImport: `occupationlab/occupationlab/experimentalReport/removeImport`,
getStartTime: `python/python/getStartTime`,
getProductSystemTheme: `nakadai/mall/getProductSystemTheme`,
heartbeatDetection: `nakadai/message/heartbeatDetection`,
heartbeatDetectionRabbit: `python/rabbitMessage/heartbeatDetection`,
createQueue: `python/rabbitMessage/createQueue`,
endRunningProcess: `python/python/endRunningProcess`,
sendMessageToUser: `python/rabbitMessage/sendMessageToUser`,
deleteTheLastUncommittedRecord: `python/python/deleteTheLastUncommittedRecord`,
}

@ -1,123 +1,75 @@
<template>
<div :class="['panel', {active: pannelVisible}]"
id="panel">
<el-container class="scrollbar"
id="container"
v-show="pannelVisible">
<el-header class="panel-header"
id="panelHeader">
<div class="project">
<div class="inline-center">
<p class="whitespace-nowrap">实训项目</p>
<el-tooltip effect="dark"
content="点击右侧“下三角”按钮可切换实验项目"
placement="bottom">
<i class="info el-icon-warning"
style="margin-left: 10px"></i>
</el-tooltip>
</div>
<el-select v-model="projectId"
placeholder="请选择"
class="select"
:disabled="projectPermissions != 0"
@change="selectProject"
style="flex: 1">
<el-option v-for="(item, i) in projectList"
:key="item.projectId"
:label="i + 1 + '. ' + item.projectName"
:value="item.projectId"></el-option>
</el-select>
</div>
<div class="item">
<div class="count">
实训{{text}}时间
<span>{{day}}</span>
<span>{{hour}}</span>小时
<span>{{minutes}}</span>
<span>{{seconds}}</span>
</div>
</div>
<div v-if="!competitionId"
class="item">
<div>
总得分
<span class="total-score">{{grade}}</span>
</div>
</div>
<div class="actions">
<el-button @click="toggleReport"
v-if="$parent.language && !isSubmit && !competitionId">填写实验报告</el-button>
<el-button @click="toReport"
v-if="isSubmit && !competitionId">查看实验报告</el-button>
<el-button class="reload"
@click="reloadConfirm"
v-show="projectPermissions == 0">重新开始</el-button>
<el-button type="primary"
class="submit btn"
@click="confirmSubmit"
:disabled="isSubmit || !projectList.length">提交</el-button>
</div>
<div :class="['panel', { active: pannelVisible }]" id="panel">
<el-container class="scrollbar" id="container" v-show="pannelVisible">
<el-header class="panel-header" id="panelHeader">
<div class="project">
<div class="inline-center">
<p class="whitespace-nowrap">实训项目</p>
<el-tooltip effect="dark" content="点击右侧“下三角”按钮可切换实验项目" placement="bottom">
<i class="info el-icon-warning" style="margin-left: 10px"></i>
</el-tooltip>
</div>
<el-select v-model="projectId" placeholder="请选择" class="select" :disabled="projectPermissions != 0"
@change="selectProject" style="flex: 1">
<el-option v-for="(item, i) in projectList" :key="item.projectId" :label="i + 1 + '. ' + item.projectName"
:value="item.projectId"></el-option>
</el-select>
</div>
<div class="item">
<div class="count">
实训{{ text }}时间
<span>{{ day }}</span>
<span>{{ hour }}</span>小时
<span>{{ minutes }}</span>
<span>{{ seconds }}</span>
</div>
</div>
<div v-if="!competitionId" class="item">
<div>
总得分
<span class="total-score">{{ grade }}</span>
</div>
</div>
<div class="actions">
<el-button @click="toggleReport" v-if="$parent.language && !isSubmit && !competitionId">填写实验报告</el-button>
<el-button @click="toReport" v-if="isSubmit && !competitionId">查看实验报告</el-button>
<el-button class="reload" @click="reloadConfirm" v-show="projectPermissions == 0">重新开始</el-button>
<el-button type="primary" class="submit btn" @click="confirmSubmit"
:disabled="isSubmit || !projectList.length">提交</el-button>
</div>
</el-header>
<div class="report-wrap"
v-if="reportVisible">
<div class="report-wrap" v-if="reportVisible">
<i class="el-icon-caret-top close-report"></i>
<el-table class="report-table"
:data="taskList"
:max-height="tableHeight">
<el-table-column prop="name"
label="判分点"
width="210"
align="center"></el-table-column>
<el-table-column prop="score"
label="答案"
align="center">
<el-table class="report-table" :data="taskList" :max-height="tableHeight">
<el-table-column prop="name" label="判分点" width="210" align="center"></el-table-column>
<el-table-column prop="score" label="答案" align="center">
<template slot-scope="scope">
<codemirror v-model="scope.row.code"
:options="cmOption"
class="code-mirror"
:ref="'codemirror' + scope.$index"
@ready="() => ready(scope.$index)"></codemirror>
<codemirror v-model="scope.row.code" :options="cmOption" class="code-mirror"
:ref="'codemirror' + scope.$index" @ready="() => ready(scope.$index)"></codemirror>
</template>
</el-table-column>
<el-table-column prop="score"
label="运行结果"
align="center">
<el-table-column prop="score" label="运行结果" align="center">
<template slot-scope="scope">
<quill class="quill"
:tools="false"
:border="true"
v-model="scope.row.codeResult"
:height="300"
:index="1" />
<quill class="quill" :tools="false" :border="true" v-model="scope.row.codeResult" :height="300"
:index="1" />
</template>
</el-table-column>
</el-table>
</div>
<el-container id="infoContainer"
v-else>
<el-aside id="aside"
width="30%">
<el-container id="infoContainer" v-else>
<el-aside id="aside" width="30%">
<div class="aside-header">
<div :class="['p-title color', 'system' + $themeId]">
<i class="el-icon-s-order"></i>
<p>实验目标</p>
</div>
<div class="goal">
<div v-if="pd.experimentTargetType == 0 || !pd.experimentTargetType"
class="ql-snow">
<div class="ql-editor"
v-html="pd.experimentTarget"></div>
<div v-if="pd.experimentTargetType == 0 || !pd.experimentTargetType" class="ql-snow">
<div class="ql-editor" v-html="pd.experimentTarget"></div>
</div>
<mavon-editor v-else
class="md"
v-model="pd.experimentTarget"
defaultOpen="preview"
:ishljs="true"
:subfield="false"
:editable="false"
:toolbarsFlag="false"
boxShadowStyle="none" />
<mavon-editor v-else class="md" v-model="pd.experimentTarget" defaultOpen="preview" :ishljs="true"
:subfield="false" :editable="false" :toolbarsFlag="false" boxShadowStyle="none" />
</div>
</div>
<div class="aside-footer">
@ -128,39 +80,24 @@
<div>
<el-row>
<el-col :span="24">
<el-card shadow="never"
:border="false">
<el-table class="task-table"
:data="taskList"
:stripe="true">
<el-card shadow="never" :border="false">
<el-table class="task-table" :data="taskList" :stripe="true">
<el-table-column type="index"></el-table-column>
<el-table-column prop="name"
label="判分点"
align="center"></el-table-column>
<el-table-column prop="score"
label="分值"
width="60"
align="center"></el-table-column>
<el-table-column prop="name" label="判分点" align="center"></el-table-column>
<el-table-column prop="score" label="分值" width="60" align="center"></el-table-column>
<template v-if="!competitionId">
<el-table-column label="结果"
width="60"
align="center">
<el-table-column label="结果" width="60" align="center">
<template slot-scope="scope">
<template v-if="isSubmit">
<template v-if="!competitionId">
<i v-if="scope.row.finishedResult"
class="el-icon-check right"></i>
<i v-else
class="el-icon-close wrong"></i>
<i v-if="scope.row.finishedResult" class="el-icon-check right"></i>
<i v-else class="el-icon-close wrong"></i>
</template>
<template v-else>-</template>
</template>
</template>
</el-table-column>
<el-table-column prop="score"
label="得分"
width="60"
align="center">
<el-table-column prop="score" label="得分" width="60" align="center">
<template slot-scope="scope">
<template v-if="isSubmit">{{ competitionId ? '-' : scope.row.examScore }}</template>
</template>
@ -174,93 +111,52 @@
</div>
</el-aside>
<el-main id="main">
<el-tabs class="info-tab"
v-model="pannelTab"
type="card">
<el-tab-pane label="项目背景"
name="first">
<div v-if="pd.experimentDescriptionType == 0 || !pd.experimentDescriptionType"
class="ql-snow">
<div class="ql-editor"
v-html="pd.experimentDescription"></div>
<el-tabs class="info-tab" v-model="pannelTab" type="card">
<el-tab-pane label="项目背景" name="first">
<div v-if="pd.experimentDescriptionType == 0 || !pd.experimentDescriptionType" class="ql-snow">
<div class="ql-editor" v-html="pd.experimentDescription"></div>
</div>
<mavon-editor v-else
class="md"
v-model="pd.experimentDescription"
defaultOpen="preview"
:subfield="false"
:editable="false"
:toolbarsFlag="false"
boxShadowStyle="none" />
<mavon-editor v-else class="md" v-model="pd.experimentDescription" defaultOpen="preview" :subfield="false"
:editable="false" :toolbarsFlag="false" boxShadowStyle="none" />
</el-tab-pane>
<el-tab-pane label="实验要求"
name="second">
<el-tab-pane label="实验要求" name="second">
<el-collapse v-model="curReq">
<el-collapse-item v-for="item in points"
:name="item.judgmentId"
:key="item.judgmentId">
<el-collapse-item v-for="item in points" :name="item.judgmentId" :key="item.judgmentId">
<template slot="title">
<i class="el-icon-s-ticket"></i>
<div class="break-all des"
v-html="item.name"></div>
<div class="break-all des" v-html="item.name"></div>
</template>
<div v-if="item.experimentalRequirementsType == 0 || !item.experimentalRequirementsType"
class="ql-snow">
<div class="ql-editor"
v-html="item.experimentalRequirements"></div>
class="ql-snow">
<div class="ql-editor" v-html="item.experimentalRequirements"></div>
</div>
<mavon-editor v-else
class="md"
v-model="item.experimentalRequirements"
defaultOpen="preview"
:ishljs="true"
:subfield="false"
:editable="false"
:toolbarsFlag="false"
boxShadowStyle="none" />
<mavon-editor v-else class="md" v-model="item.experimentalRequirements" defaultOpen="preview"
:ishljs="true" :subfield="false" :editable="false" :toolbarsFlag="false" boxShadowStyle="none" />
</el-collapse-item>
</el-collapse>
</el-tab-pane>
<el-tab-pane label="实验提示"
name="third"
v-if="hintOpen">
<div v-if="pd.experimentHintType == 0 || !pd.experimentHintType"
class="ql-snow">
<div class="ql-editor"
v-html="pd.experimentHint"></div>
<el-tab-pane label="实验提示" name="third" v-if="hintOpen">
<div v-if="pd.experimentHintType == 0 || !pd.experimentHintType" class="ql-snow">
<div class="ql-editor" v-html="pd.experimentHint"></div>
</div>
<mavon-editor v-else
class="md"
v-model="pd.experimentHint"
defaultOpen="preview"
:ishljs="true"
:subfield="false"
:editable="false"
:toolbarsFlag="false"
boxShadowStyle="none" />
<mavon-editor v-else class="md" v-model="pd.experimentHint" defaultOpen="preview" :ishljs="true"
:subfield="false" :editable="false" :toolbarsFlag="false" boxShadowStyle="none" />
</el-tab-pane>
</el-tabs>
</el-main>
</el-container>
</el-container>
<div :class="['toggle-panel', {active: pannelVisible}]">
<div :class="['toggle-panel', { active: pannelVisible }]">
<!-- <div @click="togglePannel"> -->
<i class="el-icon-rank drag-icon"
id="drag"></i>
<img :src="require(`@/assets/images/system/${$themeId}/left.png`)"
alt
class="c-p"
@click="togglePannel"
v-if="pannelVisible" />
<img :src="require(`@/assets/images/system/${$themeId}/right.png`)"
alt
class="c-p"
@click="togglePannel"
v-if="!pannelVisible" />
<i class="el-icon-rank drag-icon" id="drag"></i>
<img :src="require(`@/assets/images/system/${$themeId}/left.png`)" alt class="c-p" @click="togglePannel"
v-if="pannelVisible" />
<img :src="require(`@/assets/images/system/${$themeId}/right.png`)" alt class="c-p" @click="togglePannel"
v-if="!pannelVisible" />
</div>
</div>
</template>
@ -440,13 +336,7 @@ export default {
//
this.getList().then(() => {
if (!this.isSubmit) {
let cache = localStorage.getItem('codeCache') //
//
if (cache) {
this.getCache(JSON.parse(cache))
} else {
this.getCache()
}
this.getCache()
} else {
this.closeLoad()
}
@ -620,120 +510,85 @@ export default {
}).catch(res => { })
},
//
async getCache (cache) {
async getCache () {
if (this.isSubmit) {
this.closeLoad()
return false
}
const pId = cache ? cache.projectId : ''
const projectId = Number(pId || this.projectId)
const projectId = +this.projectId
const cid = this.courseId
const { assessmentId } = this
const list = this.projectList
let points = []
if (pId && cache.judgmentIdList && !Cookie.get('admin-projectId')) {
cache.judgmentIdList.map(e => {
points.push({
judgmentId: e
})
})
} else {
//
points = JSON.parse(JSON.stringify(this.points))
}
const points = JSON.parse(JSON.stringify(this.points))
//
if (cache && cache.empty && list.find(e => e.projectId === projectId) && !Cookie.get('admin-projectId')) {
if (Cookie.get('admin-projectId') && !this.competitionId) {
Cookie.remove('admin-projectId')
} else {
if (Cookie.get('admin-projectId') && this.projectPermissions == 0) {
Cookie.remove('admin-projectId')
}
let newJudgmentId = '' //
const promiseList = [] // promise
let hasCache = 0 //
points.map((e, i) => {
const judgmentId = e.judgmentId
promiseList.push(new Promise((resolve, reject) => {
this.$post(this.api.getLastCache, {
competitionId: this.competitionId,
assessmentId: assessmentId ? Number(assessmentId) : '',
bcId: judgmentId,
projectId, // id
cid // id
}).then(res => {
this.closeLoad()
const result = res.runRecord
//
if (result) {
hasCache = 1
if (newJudgmentId === '') newJudgmentId = i
e.finalCode = result.code
e.code = result.code
e.codeId = result.id
e.answer = result.runResult
e.retResult = result.retResult
e.photoUrl = result.runPhotoUrl
}
resolve()
}).catch(res => {
reject()
this.closeLoad()
})
}))
})
//
Promise.all(promiseList).then(_ => {
hasCache && this.$confirm('是否要继续上次的操作记录?', '提示', {
confirmButtonText: '是',
cancelButtonText: '否',
type: 'success',
closeOnClickModal: false
}).then(() => {
this.projectId = projectId
this.getProDetail()
}
this.closeLoad()
localStorage.removeItem('codeCache')
} else {
if (Cookie.get('admin-projectId') && this.projectPermissions == 0) {
Cookie.remove('admin-projectId')
}
let newJudgmentId = '' //
const promiseList = [] // promise
let hasCache = 0 //
points.map((e, i) => {
const judgmentId = e.judgmentId
promiseList.push(new Promise((resolve, reject) => {
this.$post(this.api.getLastCache, {
//
this.points.map(e => {
const item = points.find(n => n.judgmentId === e.judgmentId)
item.finalCode && this.$set(e, 'finalCode', item.finalCode)
item.code && this.$set(e, 'code', item.code)
item.codeId && this.$set(e, 'codeId', item.codeId)
item.answer && this.$set(e, 'answer', item.answer)
item.photoUrl && this.$set(e, 'photoUrl', item.photoUrl)
this.$set(e, 'retResult', isNaN(item.retResult) ? '' : item.retResult)
})
this.$emit('tell', projectId, this.curSystemId, this.points)
this.$emit('recoveryCode')
}).catch(() => {
points.map(async (e) => {
await this.$post(this.api.deleteTheLastUncommittedRecord, {
competitionId: this.competitionId,
assessmentId: assessmentId ? Number(assessmentId) : '',
bcId: judgmentId,
bcId: e.judgmentId,
projectId, // id
cid // id
}).then(res => {
this.closeLoad()
const result = res.runRecord
//
if (result) {
hasCache = 1
if (newJudgmentId === '') newJudgmentId = i
e.finalCode = result.code
e.code = result.code
e.codeId = result.id
e.answer = result.runResult
e.retResult = result.retResult
e.photoUrl = result.runPhotoUrl
}
resolve()
}).catch(res => {
reject()
this.closeLoad()
})
}))
})
//
Promise.all(promiseList).then(_ => {
hasCache && this.$confirm('是否要继续上次的操作记录?', '提示', {
confirmButtonText: '是',
cancelButtonText: '否',
type: 'success',
closeOnClickModal: false
}).then(() => {
localStorage.removeItem('codeCache') //
this.projectId = projectId
// id
if (pId) {
this.getProDetail().then(() => {
this.points.map(e => {
const item = points.find(n => n.judgmentId === e.judgmentId)
if (item) {
item.finalCode && this.$set(e, 'finalCode', item.finalCode)
item.code && this.$set(e, 'code', item.code)
item.codeId && this.$set(e, 'codeId', item.codeId)
item.answer && this.$set(e, 'answer', item.answer)
item.photoUrl && this.$set(e, 'photoUrl', item.photoUrl)
this.$set(e, 'retResult', isNaN(item.retResult) ? '' : item.retResult)
}
})
this.$emit('tell', projectId, this.curSystemId, this.points)
this.$emit('recoveryCode', newJudgmentId + '') // tab
}).catch(res => { })
} else {
this.points.map(e => {
const item = points.find(n => n.judgmentId === e.judgmentId)
item.finalCode && this.$set(e, 'finalCode', item.finalCode)
item.code && this.$set(e, 'code', item.code)
item.codeId && this.$set(e, 'codeId', item.codeId)
item.answer && this.$set(e, 'answer', item.answer)
item.photoUrl && this.$set(e, 'photoUrl', item.photoUrl)
this.$set(e, 'retResult', isNaN(item.retResult) ? '' : item.retResult)
})
this.$emit('tell', projectId, this.curSystemId, this.points)
this.$emit('recoveryCode')
}
}).catch(() => {
//
localStorage.removeItem('codeCache')
})
})
}
})
},
//
getAssStatus () {
@ -822,7 +677,6 @@ export default {
async reload () {
this.reloadCount()
this.grade = '00'
localStorage.removeItem('codeCache')
this.setSubmit(false)
const points = this.points
// codecodeId,
@ -870,7 +724,6 @@ export default {
}
},
vscodeRunCode (data) {
console.log("🚀 ~ vscodeRunCode ~ data:", data, this.$parent.workbench)
const i = +data.sort
this.$parent.workbench[i].codeId = data.codeId
this.$parent.workbench[i].retResult = 1
@ -995,7 +848,6 @@ export default {
}
this.$post(this.api.submit, data).then(({ retInfo, reportId }) => {
localStorage.removeItem('codeCache')
this.setSubmit(true)
this.reportVisible = false
let list = retInfo
@ -1316,24 +1168,29 @@ export default {
margin: 0px 20px 10px 10px;
overflow: hidden;
}
.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
height: auto !important;
flex-wrap: wrap;
height: auto !important;
.project {
display: inline-flex;
align-items: center;
width: 28%;
}
.item {
font-size: 16px;
margin: 0 10px;
padding: 20px 0;
}
.count {
margin-left: -40px;
span {
padding: 5px 15px;
margin: 0 5px;
@ -1344,149 +1201,187 @@ export default {
border-radius: 18px;
}
}
.total-score {
padding: 10px;
font-size: 14px;
text-align: center;
border-radius: 6px;
}
.submit {
width: 106px;
font-size: 16px;
}
.reload {
color: #d0d0d0;
font-size: 16px;
background-color: #202020;
}
}
.whitespace-nowrap {
white-space: nowrap;
white-space: nowrap;
}
/deep/.des {
font-size: 16px;
font-family: 'Microsoft YaHei';
img {
max-width: 100%;
}
}
/deep/.ql-editor {
font-family: 'Microsoft Yahei';
font-size: 13px;
.ql-syntax {
font-family: 'Microsoft Yahei';
}
}
/deep/.el-collapse-item__wrap {
border-bottom: none;
}
/deep/.el-collapse-item__header {
border-bottom: none;
}
/deep/.el-icon-s-ticket:before {
padding: 5px;
font-size: 16px;
}
/deep/.el-collapse-item__arrow {
margin: 0 5px 0 0;
}
/deep/.info-tab.el-tabs--card {
.el-tabs__item {
font-size: 16px;
}
.el-tabs__item.is-active {
color: #fff;
}
.el-tabs__header .el-tabs__nav {
border: none;
}
.el-tabs__header .el-tabs__item {
border-left: none;
}
.el-tabs__header {
padding: 5px 20px;
border-bottom: none;
}
& > .el-tabs__content {
&>.el-tabs__content {
margin: 0 20px;
max-height: calc(60vh - 70px);
overflow: auto;
}
}
/deep/.el-collapse {
border-bottom: none;
border-top: none;
}
.el-aside {
margin-bottom: 10px;
color: #333;
background-color: #fff;
}
.el-aside /deep/[class*=' el-icon-'],
[class^='el-icon-'] {
line-height: 40px;
font-size: 16px;
}
.aside-header {
margin: 0px 10px 10px 10px;
background-color: #fff;
}
.aside-footer {
margin: 0px 10px 10px 10px;
background-color: #fff;
}
.p-title {
display: flex;
justify-content: center;
height: 40px;
&.system4 {
background-size: 100% 58px;
}
&.system7,
&.system9 {
background-size: 100% 40px;
}
&.system8,
&.system6 {
background-size: 100% 61px;
}
p {
padding-left: 10px;
line-height: 40px;
font-size: 16px;
color: #fff;
}
i {
color: #fff;
}
}
/deep/.el-card__body {
padding: 0;
}
/deep/.task-table {
font-size: 12px;
thead {
color: #fff;
font-size: 10px;
}
th > .cell {
th>.cell {
font-weight: 100;
}
td,
th.is-leaf {
border-bottom: 0 !important;
}
.el-table__cell {
padding: 6px 0;
}
}
.goal {
padding: 10px 0;
margin: 0 10px;
font-size: 14px;
}
/deep/.select {
min-width: 180px;
min-width: 180px;
.el-select__caret:before {
content: '\e78f';
padding: 3px;
@ -1494,12 +1389,15 @@ export default {
color: #fff;
border-radius: 50%;
}
.el-input__icon {
line-height: 60px;
}
.el-input {
padding: 10px 0;
}
.el-input--suffix .el-input__inner {
height: 40px !important;
padding-right: 50px;
@ -1514,6 +1412,7 @@ export default {
white-space: nowrap;
}
}
.panel {
z-index: 1000;
position: relative;
@ -1522,16 +1421,20 @@ export default {
left: 0;
width: 0;
height: 0;
.toggle-panel {
position: absolute;
top: 60%;
text-align: center;
&.active {
left: 100%;
}
img {
height: 150px;
}
.drag-icon {
font-size: 20px;
line-height: 1;
@ -1539,45 +1442,56 @@ export default {
cursor: pointer;
}
}
&.active {
position: fixed;
width: 85%;
height: 70%;
.toggle-panel {
top: 38%;
}
}
}
/deep/.el-container {
height: 100%;
&.is-vertical {
background-color: #f5f5f5;
}
}
.right {
color: #00af00;
font-size: 20px;
}
.wrong {
color: #f00;
font-size: 20px;
}
.info {
color: #bfbfbf;
cursor: pointer;
&:hover {
opacity: 0.9;
}
}
/deep/.report-table.el-table {
th {
background-color: #c6daff !important;
}
}
.report-wrap {
position: relative;
padding-top: 5px;
}
.close-report {
z-index: 2;
position: absolute;
@ -1587,41 +1501,47 @@ export default {
color: #c6daff;
cursor: pointer;
}
/deep/.v-note-wrapper {
min-height: 0;
height: auto;
font-family: 'Microsoft Yahei';
.v-note-panel .v-note-show {
font-family: 'Microsoft Yahei';
overflow: visible;
.v-show-content {
font-family: 'Microsoft Yahei';
overflow: visible;
}
pre,
code {
font-family: 'Microsoft Yahei';
}
}
}
.text-danger {
color: #f56c6c;
}
@media (max-width: 1550px) {
.panel-header {
.count {
margin-left: 0;
}
}
.panel-header {
.count {
margin-left: 0;
}
}
}
@media (max-width: 1400px) {
.panel-header {
.actions {
position: absolute;
top: 70px;
right: 30px;
}
}
.panel-header {
.actions {
position: absolute;
top: 70px;
right: 30px;
}
}
}
</style>

@ -704,7 +704,6 @@ export default {
if (data) {
const photo = data.photoUrl
const result = data.runResult || ''
// this.$emit('cache') //
if (this.loadIns) this.loadIns.close()
this.picSrcList = []
this.$emit('update:photoUrl', '')

@ -1,93 +1,47 @@
<template>
<div v-show="loaded">
<div class="header"
:class="{hh: $config.isHh}">
<img v-if="$config.isHh"
src="@/assets/images/logo-hh.png"
alt=""
class="logo">
<p v-else>{{curriculumName}}</p>
<el-button class="back btn"
type="primary"
@click="back">退出实验</el-button>
<div class="header" :class="{ hh: $config.isHh }">
<img v-if="$config.isHh" src="@/assets/images/logo-hh.png" alt="" class="logo">
<p v-else>{{ curriculumName }}</p>
<el-button class="back btn" type="primary" @click="back">退出实验</el-button>
</div>
<div class="top">
<div class="language">
<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>
<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-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-select>
<el-button v-if="language"
class="open-vs"
type="primary"
size="small"
@click="openVscode">打开Vscode新窗口</el-button>
<el-button v-if="language" class="open-vs" type="primary" size="small"
@click="openVscode">打开Vscode新窗口</el-button>
</div>
<div class="inline-center">
<el-tooltip class="item"
effect="dark"
content="支持导入其它数据用于实验,总上传的文件大小不可以超过10M"
placement="bottom">
<i class="info el-icon-warning"
style="margin-right: 10px"></i>
<el-tooltip class="item" effect="dark" content="支持导入其它数据用于实验,总上传的文件大小不可以超过10M" placement="bottom">
<i class="info el-icon-warning" style="margin-right: 10px"></i>
</el-tooltip>
<el-button type="primary"
size="small"
icon="el-icon-document"
@click="toData">我的数据</el-button>
<el-button type="primary" size="small" icon="el-icon-document" @click="toData">我的数据</el-button>
</div>
</div>
<div class="tab">
<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"
: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"
:modelIsShow.sync="modelIsShow"
@cache="leavePage"></codemirror>
<iframe v-else
class="vscode"
:src="Config.vscodeUrl"
frameborder="0"
width="100%"></iframe>
<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"
: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"
:modelIsShow.sync="modelIsShow"></codemirror>
<iframe v-else class="vscode" :src="Config.vscodeUrl" frameborder="0" width="100%"></iframe>
</el-tab-pane>
</el-tabs>
</div>
<div class="menu">
<testPanel @tell="setPoints"
@recoveryCode="recoveryCode"
ref="mainindex"
:workbench.sync="workbench"></testPanel>
<testPanel @tell="setPoints" @recoveryCode="recoveryCode" ref="mainindex" :workbench.sync="workbench"></testPanel>
</div>
<div v-if="isSubmit"
class="mask"></div>
<div v-if="isSubmit" class="mask"></div>
</div>
</template>
@ -136,6 +90,22 @@ export default {
testPanel
},
mounted () {
const opened = localStorage.getItem('opened')
if (opened || opened === '0') {
localStorage.setItem('opened', +opened + 1)
} else {
localStorage.setItem('opened', 1)
}
window.addEventListener('unload', function () {
const opened = localStorage.getItem('opened')
if (opened) {
localStorage.setItem('opened', +opened - 1)
} else {
localStorage.removeItem('opened')
}
});
console.log(11, localStorage.getItem('opened'))
document.onkeydown = function (event) {
var e = event || window.event || arguments.callee.caller.arguments[0];
@ -153,31 +123,8 @@ export default {
this.isSubmit = isSubmit
})
this.autoLogout()
//
window.onbeforeunload = () => {
this.leavePage()
}
},
beforeRouteLeave (to, from, next) {
next(this.leavePage())
},
methods: {
//
leavePage () {
const list = this.workbench
//
if (!this.$refs.mainindex.isSubmit && list.length) {
const cache = {
projectId: Number(this.projectId),
judgmentIdList: this.workbench.map(e => e.judgmentId)
}
//
if (!list.some(e => e.code)) {
cache.empty = true //
}
localStorage.setItem('codeCache', JSON.stringify(cache)) // ididid
}
},
//
getModelStatus (systemId) {
this.$post(`${this.api.displayListOrNotByStudent}?systemId=${systemId}`).then(res => {
@ -195,6 +142,7 @@ export default {
},
//
toData () {
return console.log(11, localStorage.getItem('opened'))
this.$router.push('/data')
},
// 退
@ -262,31 +210,37 @@ export default {
[v-cloak] {
display: none;
}
.header {
display: flex;
justify-content: space-between;
height: 58px;
line-height: 58px;
background-color: #f8f8f8;
&.hh {
padding: 10px 0;
line-height: normal;
}
p {
margin-left: 18px;
font-size: 20px;
color: rgba(51, 51, 51, 1);
}
.logo {
width: 200px;
margin-left: 10px;
}
.back {
padding: 23px 50px;
border: none;
border-radius: 0;
}
}
/deep/.top {
display: flex;
justify-content: space-between;
@ -294,20 +248,25 @@ export default {
height: 60px;
padding: 0 15px;
line-height: 60px;
.language {
display: inline-flex;
align-items: center;
}
p {
font-size: 16px;
margin-right: 15px;
}
.el-input {
width: 200px;
}
.el-input .el-input__inner {
border-radius: 30px;
}
.open-vs {
margin-left: 20px;
}
@ -316,47 +275,60 @@ export default {
.vscode {
height: calc(100vh - 186px);
}
.menu {
position: relative;
z-index: 1000;
}
::v-deep .el-dialog--center {
width: 400px;
}
::v-deep .el-dialog__headerbtn .el-icon-close:before {
padding: 3px;
border-radius: 50%;
}
/deep/.tab {
height: 50px;
line-height: 50px;
.el-tabs__header {
margin-bottom: 0;
}
.el-tabs__item.is-active {
color: #333;
}
.el-icon-circle-plus-outline:before {
font-size: 16px;
}
.el-tabs--card > .el-tabs__header {
.el-tabs--card>.el-tabs__header {
border-bottom: none;
}
.el-tabs--card > .el-tabs__header .el-tabs__nav {
.el-tabs--card>.el-tabs__header .el-tabs__nav {
border: none;
}
.el-tabs--card > .el-tabs__header .el-tabs__item {
.el-tabs--card>.el-tabs__header .el-tabs__item {
border-left: none;
border-bottom: none;
}
}
.info {
color: #bfbfbf;
cursor: pointer;
&:hover {
opacity: 0.9;
}
}
.mask {
z-index: 999;
position: absolute;

Loading…
Cancel
Save