2019-07-26 13:32:43 +08:00
|
|
|
|
<template>
|
2019-08-19 10:31:11 +08:00
|
|
|
|
<div>
|
|
|
|
|
<div class="display-card" :style="{top: offset + 'px'}">
|
|
|
|
|
<el-row style="vertical-align:middle; ">
|
|
|
|
|
<span class="display-time">{{ formatTrainingUsedTime }}</span>
|
|
|
|
|
</el-row>
|
2019-07-26 13:32:43 +08:00
|
|
|
|
</div>
|
2019-08-19 10:31:11 +08:00
|
|
|
|
<div class="display-draft">
|
|
|
|
|
<el-button-group>
|
|
|
|
|
<el-button type="success" :disabled="isDisable" :loading="startLoading" @click="start">开始</el-button>
|
|
|
|
|
<el-button type="danger" :disabled="!isDisable" @click="end">结束</el-button>
|
|
|
|
|
<el-button type="primary" class="back" @click="back">返回</el-button>
|
|
|
|
|
</el-button-group>
|
|
|
|
|
</div>
|
|
|
|
|
<tip-exam-list @refresh="refresh" />
|
|
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2019-08-19 10:31:11 +08:00
|
|
|
|
import TipExamList from './tipExamList';
|
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
|
import { Notification } from 'element-ui';
|
|
|
|
|
import { startTraining } from '@/api/jmap/training';
|
|
|
|
|
import { exitFullscreen } from '@/utils/screen';
|
|
|
|
|
import { timeFormat } from '@/utils/date';
|
|
|
|
|
import { refreshExamList, finishOneExamQuestion } from '@/api/management/userexam';
|
|
|
|
|
import { launchFullscreen } from '@/utils/screen';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
2019-08-19 10:31:11 +08:00
|
|
|
|
export default {
|
|
|
|
|
name: 'MenuExam',
|
|
|
|
|
components: {
|
|
|
|
|
TipExamList
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
group: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
offset: {
|
|
|
|
|
type: Number,
|
|
|
|
|
required: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
isDisable: false,
|
|
|
|
|
startLoading: false,
|
|
|
|
|
training: {
|
|
|
|
|
id: '',
|
|
|
|
|
name: '',
|
|
|
|
|
remarks: ''
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
...mapGetters('map', [
|
|
|
|
|
'mapDeviceStatus'
|
|
|
|
|
]),
|
|
|
|
|
formatTrainingUsedTime() {
|
|
|
|
|
return timeFormat(this.$store.state.training.usedTime);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
tipInfo(opt) {
|
|
|
|
|
if (opt && opt.hasOwnProperty('color') && opt.hasOwnProperty('message')) {
|
|
|
|
|
const h = this.$createElement;
|
|
|
|
|
this.$notify({
|
|
|
|
|
title: '提示',
|
|
|
|
|
message: h('i', { style: 'color:' + opt.color }, '请点击开始考试操作')
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
start() {
|
|
|
|
|
this.$store.dispatch('menuOperation/setButtonOperation', null);
|
|
|
|
|
this.startLoading = true;
|
|
|
|
|
if (this.$route.query.trainingId) {
|
|
|
|
|
this.isDisable = true;
|
|
|
|
|
startTraining({ id: this.$route.query.trainingId }, this.group).then(response => {
|
|
|
|
|
this.$store.dispatch('training/examModeStart');
|
|
|
|
|
this.$store.dispatch('map/clearJlmapTrainView').then(() => {
|
|
|
|
|
this.$store.dispatch('training/setMapDefaultState').then(() => {
|
|
|
|
|
this.$store.dispatch('training/emitTipFresh');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
this.startLoading = false;
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.isDisable = false;
|
|
|
|
|
this.startLoading = false;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.startLoading = true;
|
|
|
|
|
this.$messageBox(`请选择试题`);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
end() {
|
|
|
|
|
if (this.$route.query.trainingId) {
|
|
|
|
|
this.isDisable = false;
|
|
|
|
|
if (this.$store.state.training.started) {
|
|
|
|
|
const model = {
|
|
|
|
|
id: this.$route.query.examQuestionId,
|
|
|
|
|
usedTime: this.$store.state.training.usedTime,
|
|
|
|
|
group: this.group
|
|
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
2019-08-19 10:31:11 +08:00
|
|
|
|
this.$store.dispatch('training/end', null);
|
|
|
|
|
finishOneExamQuestion(model).then(response => {
|
|
|
|
|
this.$store.dispatch('training/emitTipFresh');
|
|
|
|
|
this.init();
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$store.dispatch('training/emitTipFresh');
|
|
|
|
|
this.$messageBox(`结束实训错误`);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.isDisable = true;
|
|
|
|
|
this.$messageBox(`请先开始考试`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
back() {
|
|
|
|
|
this.$confirm('是否放弃本次考试?', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.$emit('quit');
|
|
|
|
|
this.$router.push({ path: `/exam/home` });
|
|
|
|
|
Notification.closeAll();
|
|
|
|
|
exitFullscreen();
|
|
|
|
|
}).catch(() => {
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
2019-08-19 10:31:11 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
init() {
|
|
|
|
|
this.$store.dispatch('exam/countUsedTime');
|
|
|
|
|
launchFullscreen();
|
|
|
|
|
// 刷新考试列表
|
|
|
|
|
refreshExamList(this.$route.query.userExamId).then(response => {
|
|
|
|
|
this.$store.dispatch('exam/setUsedTime', response.data.usedTime);
|
|
|
|
|
this.$store.dispatch('exam/setTotalTime', response.data.duration);
|
|
|
|
|
this.$store.dispatch('trainingList/setTrainingList', response.data.userExamQuestionsVOs).then(response => { });
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
// 如果时50009则表示考试已完成,不能再次进行y
|
|
|
|
|
if (error.code === 500009) {
|
|
|
|
|
this.$router.replace({ path: `/exam/result/${this.$route.params.userExamId}` });
|
|
|
|
|
} else {
|
|
|
|
|
this.$messageBox(`刷新列表失败`);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
refresh() {
|
|
|
|
|
this.isDisable = false;
|
|
|
|
|
this.$store.dispatch('training/end', null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
|
</script>
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
|
|
|
|
|
.display-card {
|
|
|
|
|
z-index: 9;
|
|
|
|
|
display: inline;
|
|
|
|
|
position: absolute;
|
2019-07-26 15:52:50 +08:00
|
|
|
|
// float: left;
|
2019-07-26 13:32:43 +08:00
|
|
|
|
left: 160px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.display-time {
|
|
|
|
|
background-color: white;
|
|
|
|
|
display: -moz-inline-box;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
border: 1px solid lightskyblue;
|
|
|
|
|
width: 100px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-family: "Microsoft" !important;
|
|
|
|
|
font-size: 18px !important;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
color: black;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.display-draft {
|
|
|
|
|
position: absolute;
|
|
|
|
|
float: right;
|
|
|
|
|
right: 15px;
|
|
|
|
|
bottom: 15px;
|
|
|
|
|
|
|
|
|
|
.back {
|
|
|
|
|
z-index: 100000;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tip-body-box {
|
|
|
|
|
position: relative;
|
|
|
|
|
height: 430px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.reminder-box {
|
|
|
|
|
position: absolute;
|
|
|
|
|
float: left;
|
|
|
|
|
left: 15px;
|
|
|
|
|
bottom: 15px;
|
|
|
|
|
width: 650px;
|
|
|
|
|
height: 470px;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
z-index: 500;
|
|
|
|
|
/* transition: height 0.5s; */
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
|
|
|
|
.tip-title {
|
|
|
|
|
width: 100%;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
height: 40px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
flex-direction: row-reverse;
|
|
|
|
|
background-color: #409EFF;
|
|
|
|
|
cursor: move;
|
|
|
|
|
border-radius: 5px 5px 0 0;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.drag-right,
|
|
|
|
|
.drag-left {
|
|
|
|
|
width: 10px;
|
|
|
|
|
cursor: e-resize;
|
|
|
|
|
background-color: yellow;
|
|
|
|
|
height: 100%;
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.drag-left {
|
|
|
|
|
left: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.drag-bottom {
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 10px;
|
|
|
|
|
cursor: s-resize;
|
|
|
|
|
background-color: yellow;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tip-body {
|
|
|
|
|
height: 366px;
|
|
|
|
|
padding: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tip-foot {
|
|
|
|
|
width: 100%;
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: 0px;
|
|
|
|
|
bottom: 0px;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
padding: 10px 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
flex-direction: row-reverse;
|
|
|
|
|
|
|
|
|
|
.btn {
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
|
float: right;
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
background-color: #d2d2d2;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/deep/ {
|
|
|
|
|
.el-tree-node__content {
|
|
|
|
|
margin-bottom: 4px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
|
|
|
|
|
background-color: #d6e5f7;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-19 10:31:11 +08:00
|
|
|
|
</style>
|