实验报告等

openf12
yujialong 1 year ago
parent 981ed55a11
commit f1d56abefe
  1. 31
      src/components/TestPanel.vue
  2. 10
      src/components/codemirror.vue
  3. 226
      src/views/Report.vue

@ -191,12 +191,13 @@ export default {
competitionId: Cookie.get('admin-competitionId'),
stageId: Cookie.get('admin-stageId'),
teamId: Cookie.get('admin-teamId'),
mallId: Cookie.get('admin-mallId'),
resultsDetails: Cookie.get('admin-resultsDetails'),
resultAnnouncementTime: Cookie.get('admin-resultAnnouncementTime'),
curriculumName: Cookie.get('admin-curriculumName') ? unescape(Cookie.get('admin-curriculumName')) : 'python', //
curSystemId: 1,
projectPermissions: 0, // (0 1 2)
isSubmit: false, //
isSubmit: Cookie.get('admin-isSubmit') == 'true' ? true : false, //
entryTime: new Date(),
startTime: Cookie.get('admin-startTime'),
endTime: Cookie.get('admin-stopTime'),
@ -233,6 +234,10 @@ export default {
if (this.assessmentId) { // assessmentIdcompetitionId)
this.getAssList()
} else { //
if (Cookie.get('doneProjectId')) {
this.projectId = +Cookie.get('doneProjectId')
}
Cookie.remove('doneProjectId')
//
this.getList().then(() => {
let cache = localStorage.getItem('codeCache') //
@ -277,7 +282,7 @@ export default {
},
//
getProDetail () {
const projectId = this.projectId
const { projectId } = this
return new Promise((resolve, reject) => {
this.$get(this.api.getProjectDetail, {
projectId,
@ -339,6 +344,12 @@ export default {
this.$parent.loadIns.close()
this.$parent.loaded = true
},
// isSubmit
setSubmit (status) {
this.isSubmit = status
newmain.$emit('isSubmit', status)
Cookie.set('admin-isSubmit', status)
},
//
getAssList () {
this.$post(`${this.api.pageStuAssessment}`, {
@ -346,14 +357,13 @@ export default {
pageSize: 10000
}).then(res => {
const list = res.list
const assessmentId = this.assessmentId
const { assessmentId } = this
let done = false
const classId = this.classId
// reportIdclassIdclassId
if (list.find(e => e.assessmentId == assessmentId && e.reportId && e.classId == classId)) {
done = true
this.isSubmit = true
newmain.$emit('isSubmit', this.isSubmit)
this.setSubmit(true)
this.$message.error('你已经提交过该考核!')
setTimeout(_ => {
history.back() //
@ -518,15 +528,15 @@ export default {
this.getProDetail().then(() => {
this.getCache()
}).catch(res => { })
this.isSubmit = false
this.setSubmit(false)
this.countVal = 0
this.grade = '00'
this.pannelTab = 'first'
this.$emit('recoveryCode') //
newmain.$emit('isSubmit', this.isSubmit) //
},
//
toReport () {
Cookie.set('doneProjectId', this.projectId) // id,id
this.$router.push(`/report?reportId=${this.reportId}`)
},
//
@ -534,8 +544,7 @@ export default {
this.reloadCount()
this.grade = '00'
localStorage.removeItem('codeCache')
this.isSubmit = false
newmain.$emit('isSubmit', this.isSubmit)
this.setSubmit(false)
const points = this.points
// codecodeId,
points.map(e => {
@ -616,12 +625,12 @@ export default {
competitionId: this.competitionId,
stageId: this.stageId,
teamId: this.teamId,
mallId: this.mallId
}
this.$post(this.api.submit, data).then(({ retInfo, reportId }) => {
localStorage.removeItem('codeCache')
this.isSubmit = true
newmain.$emit('isSubmit', this.isSubmit)
this.setSubmit(true)
clearInterval(this.statusTimer)
let list = retInfo
let taskList = this.taskList

@ -195,7 +195,7 @@ export default {
runResult: '', //
isError: false, //
errLine: '', //
isSubmit: false, //
isSubmit: Cookie.get('admin-isSubmit') == 'true' ? true : false, //
runEnable: false, //
tipsVisible: false, //
picSrcList: [],
@ -608,6 +608,9 @@ export default {
<style lang="scss" scoped>
.code-wrap {
position: relative;
.code-mirror {
line-height: 30px;
}
}
.left {
position: relative;
@ -686,11 +689,6 @@ export default {
opacity: 0.9;
}
}
/deep/.CodeMirror-wrap pre.CodeMirror-line,
.CodeMirror-wrap pre.CodeMirror-line-like {
height: 30px;
line-height: 30px;
}
.result-right {
background-color: rgba(43, 40, 22, 1);
}

@ -2,112 +2,165 @@
<!-- 实验报告 -->
<div class="wrap">
<breadcrumb data="返回实验/我的数据"></breadcrumb>
<div class="content" :class="{loading}" id="pdfDom">
<div style="text-align: right" v-if="!loading">
<el-button size="mini" @click="editReport">
<div class="content"
:class="{loading}"
id="pdfDom">
<div style="text-align: right"
v-if="!loading">
<el-button size="mini"
@click="editReport">
{{ editing ? "保存" : "编辑" }}
</el-button>
<el-button type="primary" size="mini" @click="exportPage">导出报告</el-button>
<el-button type="primary"
size="mini"
@click="exportPage">导出报告</el-button>
</div>
<h6 class="r-title">标准实验报告</h6>
<div class="info">
<h6 class="l-title">
<img src="@/assets/images/report1.png" alt="">
<img src="@/assets/images/report1.png"
alt="">
基本信息
</h6>
<ul :class="['info-list', {edit: editing}]">
<li>
<label>学生姓名</label>
<el-input v-if="editing" v-model="infoData.userName" disabled></el-input>
<el-input v-if="editing"
v-model="infoData.userName"
disabled></el-input>
<span v-else>{{ infoData.userName }}</span>
</li>
<li>
<label>学生学号</label>
<el-input v-if="editing" v-model="infoData.workNumber" disabled></el-input>
<el-input v-if="editing"
v-model="infoData.workNumber"
disabled></el-input>
<span v-else>{{ infoData.workNumber }}</span>
</li>
<li>
<label>实验时间</label>
<el-input v-if="editing" v-model="infoData.submitTime" disabled></el-input>
<el-input v-if="editing"
v-model="infoData.submitTime"
disabled></el-input>
<span v-else>{{ infoData.submitTime }}</span>
</li>
<li>
<label>实验成绩</label>
<el-input v-if="editing" v-model="infoData.score" disabled></el-input>
<div v-else class="score-wrap">
<el-input v-if="editing"
v-model="infoData.score"
disabled></el-input>
<div v-else
class="score-wrap">
<em>{{ infoData.score }}</em>
<img src="@/assets/images/point.png" alt="">
<img src="@/assets/images/point.png"
alt="">
</div>
</li>
<li>
<label>学生班级</label>
<el-input v-if="editing" v-model="infoData.className"></el-input>
<el-input v-if="editing"
v-model="infoData.className"></el-input>
<span v-else>{{ infoData.className }}</span>
</li>
<li>
<label>指导老师</label>
<el-input v-if="editing" v-model="infoData.instructor"></el-input>
<el-input v-if="editing"
v-model="infoData.instructor"></el-input>
<span v-else>{{ infoData.instructor }}</span>
</li>
<li>
<label>实验学时</label>
<el-input v-if="editing" v-model="infoData.period"></el-input>
<el-input v-if="editing"
v-model="infoData.period"></el-input>
<span v-else>{{ infoData.period }}</span>
</li>
</ul>
<div class="m-b-20">
<h6 class="l-title">
<img src="@/assets/images/report2.png" alt="">
<img src="@/assets/images/report2.png"
alt="">
实验项目名称
</h6>
<el-input v-if="editing" v-model="infoData.projectName" type="textarea"></el-input>
<div v-else class="pre-wrap" v-html="infoData.projectName"></div>
<el-input v-if="editing"
v-model="infoData.projectName"
type="textarea"></el-input>
<div v-else
class="pre-wrap"
v-html="infoData.projectName"></div>
</div>
<div class="m-b-20">
<h6 class="l-title">
<img src="@/assets/images/report3.png" alt="">
<img src="@/assets/images/report3.png"
alt="">
实验目的
</h6>
<quill v-if="editing" :border="true" v-model="infoData.purpose" :height="150" />
<div v-else :class="['pre-wrap', {edit: editing}]" v-html="infoData.purpose"></div>
<quill v-if="editing"
:border="true"
v-model="infoData.purpose"
:height="150" />
<div v-else
:class="['pre-wrap', {edit: editing}]"
v-html="infoData.purpose"></div>
</div>
<div class="m-b-20">
<h6 class="l-title">
<img src="@/assets/images/report4.png" alt="">
<img src="@/assets/images/report4.png"
alt="">
实验数据
</h6>
<el-table :data="expData" class="table" border stripe header-align="center">
<el-table-column type="index" label="序号" align="center" width="60">
<el-table :data="expData"
class="table"
border
stripe
header-align="center">
<el-table-column type="index"
label="序号"
align="center"
width="60">
<template slot-scope="scope">
{{ scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="judgmentName" label="判分点" width="270" align="center"></el-table-column>
<el-table-column v-if='project' prop="judgmentName" label="考核点" align="center" width="150">
<el-table-column prop="judgmentName"
label="判分点"
width="200"
align="center"></el-table-column>
<el-table-column v-if='project'
prop="judgmentName"
label="考核点"
align="center"
width="150">
<template slot-scope="scope">
<div v-for="(item, index) in scope.row.lcRuleRecords" :key="index">
<div v-for="(item, index) in scope.row.lcRuleRecords"
:key="index">
<span>
<span>{{index+1}}. </span>{{item.name}}
</span>
</div>
</template>
</el-table-column>
<el-table-column prop="ruleAnswer" label="参考答案" style='word-wrap: break-word'>
<el-table-column prop="ruleAnswer"
label="参考答案"
style='word-wrap: break-word'>
<template slot-scope="scope">
<div v-if='scope.row.lcRuleRecords'>
<div v-for="(item, index) in scope.row.lcRuleRecords" :key="index">
<div v-for="(item, index) in scope.row.lcRuleRecords"
:key="index">
<span>
<span>{{index+1}}. </span>{{item.ruleAnswer}}
</span>
</div>
</div>
<div v-else v-html="scope.row.referenceAnswer"></div>
<div v-else
v-html="scope.row.referenceAnswer"></div>
</template>
</el-table-column>
<el-table-column prop="userAnswer" label="学生答案">
<el-table-column prop="userAnswer"
label="学生答案">
<template slot-scope="scope">
<div v-if='scope.row.lcRuleRecords'>
<div v-for="(item, index) in scope.row.lcRuleRecords" :key="index">
<div v-for="(item, index) in scope.row.lcRuleRecords"
:key="index">
<span v-if='item.userAnswer'>
<span>{{index+1}}. </span>{{item.userAnswer}}
</span>
@ -116,23 +169,52 @@
</span>
</div>
</div>
<div v-else v-html='scope.row.answer' style='white-space: pre-wrap'></div>
<div v-else
v-html='scope.row.answer'
style='white-space: pre-wrap'></div>
</template>
</el-table-column>
<el-table-column prop="runResult"
label="学生运行结果"
align="center">
<template slot-scope="scope">
<div class="m-b-20"
v-html='scope.row.runResult'
style='white-space: pre-wrap'></div>
<template v-if="scope.row.runThePictureList">
<img v-for="(img, i) in scope.row.runThePictureList" :key="i" width="200" class="result-pic" :src="img" alt="">
<img v-for="(img, i) in scope.row.runThePictureList"
:key="i"
width="200"
class="result-pic"
:src="img"
alt="">
</template>
</template>
</el-table-column>
<el-table-column prop="quesScore" label="分值" width="80" align="center"></el-table-column>
<el-table-column prop="score" label="得分" width="80" align="center"></el-table-column>
<el-table-column prop="quesScore"
label="分值"
width="80"
align="center"></el-table-column>
<el-table-column prop="score"
label="得分"
width="80"
align="center"></el-table-column>
</el-table>
</div>
<div class="m-b-20">
<h6 class="l-title">
<img src="@/assets/images/report5.png" alt="">
<img src="@/assets/images/report5.png"
alt="">
实验总结与体会
</h6>
<quill v-show="editing" :border="true" v-model="infoData.summarize" :height="150" :index="1" />
<div v-show="!editing" class="pre-wrap" v-html="infoData.summarize"></div>
<quill v-show="editing"
:border="true"
v-model="infoData.summarize"
:height="150"
:index="1" />
<div v-show="!editing"
class="pre-wrap"
v-html="infoData.summarize"></div>
</div>
</div>
</div>
@ -145,7 +227,7 @@ import util from '@/util'
import breadcrumb from '@/components/breadcrumb'
import quill from "@/components/quill";
export default {
data() {
data () {
return {
reportId: this.$route.query.reportId,
title: "实验报告",
@ -155,7 +237,7 @@ export default {
editing: false,
loadIns: null,
loading: false,
project:false,
project: false,
userScores: []
};
},
@ -163,11 +245,11 @@ export default {
breadcrumb,
quill
},
mounted() {
mounted () {
this.getData()
},
methods: {
getData() { //
getData () { //
const { reportId } = this
this.$get(`${this.api.reportDetail}?reportId=${reportId}`).then(({ report, userScores }) => {
this.form = report
@ -195,14 +277,14 @@ export default {
this.$post(this.api.editExperimentalData, {
reportId,
data: JSON.stringify(userScores)
}).then(res => {}).catch(err => {})
}).then(res => { }).catch(err => { })
} else {
this.handleList(userScores.find(e => e.lcRuleRecords) ? userScores : JSON.parse(data))
}
}).catch(res => {})
}).catch(res => { })
},
//
handleList(list) {
handleList (list) {
this.project = list.find(e => e.lcRuleRecords) // lcRuleRecords
if (this.project) {
list.map(e => {
@ -218,12 +300,15 @@ export default {
} else { // pythonuserScores
list.forEach(e => {
const item = this.userScores.find(n => n.judgmentId == e.judgmentId)
if (item && item.runThePictureList) e.runThePictureList = item.runThePictureList
if (item) {
if (item.runThePictureList) e.runThePictureList = item.runThePictureList
if (item.runResult) e.runResult = item.runResult
}
})
}
this.expData = list
},
exportPage() {
exportPage () {
const form = Object.assign(this.form, this.infoData)
const list = JSON.parse(JSON.stringify(this.expData))
list.map((e, i) => {
@ -248,18 +333,18 @@ export default {
}).then(res => {
this.loadIns.close();
this.loading = false;
util.downloadFileDirect(`实验报告.docx`,new Blob([res]))
util.downloadFileDirect(`实验报告.docx`, new Blob([res]))
}).catch(res => {
this.loadIns.close();
this.loading = false;
})
},
editReport() { //
editReport () { //
if (this.editing) {
this.$post(`${this.api.updateReport}`, this.infoData).then(res => {
this.editing = false;
this.$message.success('修改成功')
}).catch(err => {});
}).catch(err => { });
} else {
this.editing = true;
}
@ -275,22 +360,26 @@ export default {
.wrap {
padding: 12px 300px 20px;
}
code, kbd, samp{
font-family: 'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif;
code,
kbd,
samp {
font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, 'microsoft yahei',
arial, STHeiTi, sans-serif;
word-wrap: break-word;
white-space: pre-wrap;
}
/deep/ pre{
/deep/ pre {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
word-break:break-all;
overflow:hidden;
word-break: break-all;
overflow: hidden;
font-size: 12px;
font-weight:400;
font-family:'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif
font-weight: 400;
font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, 'microsoft yahei',
arial, STHeiTi, sans-serif;
}
.content {
padding: 16px 0;
@ -306,17 +395,17 @@ code, kbd, samp{
}
.info {
padding: 20px 16px;
border: 1px solid #E1E6F2;
border: 1px solid #e1e6f2;
}
.l-title{
.l-title {
display: flex;
align-items: center;
padding: 5px 8px;
margin-bottom: 12px;
font-size: 14px;
color: #333;
background-color: #F7F9FC;
img{
background-color: #f7f9fc;
img {
margin-right: 5px;
}
}
@ -343,7 +432,7 @@ code, kbd, samp{
span {
min-width: 150px;
padding: 0 10px 3px;
border-bottom: 1px solid #E1E6F2;
border-bottom: 1px solid #e1e6f2;
}
/deep/.el-input {
width: 174px;
@ -352,7 +441,7 @@ code, kbd, samp{
.score-wrap {
position: relative;
min-width: 150px;
border-bottom: 1px solid #E1E6F2;
border-bottom: 1px solid #e1e6f2;
em {
position: absolute;
top: -12px;
@ -360,7 +449,7 @@ code, kbd, samp{
font-family: din;
font-size: 30px;
font-weight: 600;
color: #0B1D30;
color: #0b1d30;
}
img {
position: absolute;
@ -368,16 +457,17 @@ code, kbd, samp{
left: 0;
}
}
/deep/.el-textarea .el-textarea__inner, .pre-wrap {
/deep/.el-textarea .el-textarea__inner,
.pre-wrap {
min-height: 72px;
padding: 10px 16px;
font-size: 14px;
color: #333;
&.edit {
color: #ABB3C6;
border: 1px solid #CACFDB;
color: #abb3c6;
border: 1px solid #cacfdb;
border-radius: 4px;
background-color: #F6F7F9;
background-color: #f6f7f9;
}
}
/deep/ .table th {

Loading…
Cancel
Save