实训调整

This commit is contained in:
fan 2022-08-31 17:03:10 +08:00
parent a1dd644078
commit e935e29001
5 changed files with 55 additions and 16 deletions

View File

@ -8,7 +8,8 @@ const training = {
simulationPause: false, // 实训 暂停判断
stepOrder: 1,
operateOrder: 0,
stepOverCount: 0
stepOverCount: 0,
trainingScore: ''
},
getters: {
teachMode: (state) => {
@ -28,6 +29,9 @@ const training = {
},
stepOverCount: (state) => {
return state.stepOverCount;
},
trainingScore: (state) => {
return state.trainingScore;
}
},
mutations: {
@ -63,6 +67,9 @@ const training = {
},
clearStepOverCount: (state) => {
state.clearStepOverCount = 0;
},
setTrainingScore: (state, score) => {
state.trainingScore = score;
}
},
actions: {
@ -99,6 +106,9 @@ const training = {
clearStepOverCount: ({commit}) => {
commit('clearStepOverCount');
},
setTrainingScore: ({commit}, score) => {
commit('setTrainingScore', score);
},
checkTrainingOperate:({commit, state}, trainingOperate) => {
return new Promise((resolve, reject) => {
const stepList = JSON.parse(state.trainingDetail.stepJson);

View File

@ -10,6 +10,7 @@
<el-radio-button :label="TrainingMode.PRACTICE">{{ $t('display.lesson.practiceMode') }}</el-radio-button>
<el-radio-button :label="TrainingMode.TEST">{{ $t('display.lesson.testMode') }}</el-radio-button>
</el-radio-group>
<span v-if="demoMode === TrainingMode.TEST" class="display-score">{{ $t('display.lesson.score') }}{{ trainingScore }}</span>
</div>
<TrainingList ref="trainingList" @editBlob="editBlob" />
</div>
@ -44,6 +45,9 @@ export default {
},
trainingSwitch() {
return this.$store.state.trainingNew.trainingSwitch;
},
trainingScore() {
return this.$store.state.trainingNew.trainingScore;
}
},
mounted() {
@ -109,4 +113,20 @@ export default {
overflow: hidden;
z-index: 35;
}
.display-score {
background-color: black;
display: -moz-inline-box;
display: inline-block;
text-align: left;
border: 1px solid lightskyblue;
width: 100px;
height: 32px;
line-height: 24px;
border-radius: 4px;
padding-left: 2px;
margin-left: 10px;
font-family: "Microsoft" !important;
font-size: 18px !important;
color: #fff;
}
</style>

View File

@ -78,6 +78,7 @@ export default {
this.$store.dispatch('trainingNew/changeTeachMode', '');
},
mounted() {
this.$store.dispatch('trainingNew/setTrainingScore', '');
},
methods: {
overallTranslation(flag) {
@ -96,6 +97,7 @@ export default {
handlerStart() {
startTraining(this.group, {mode: this.teachMode}).then(() => {
this.$store.dispatch('trainingNew/trainingStart');
this.$store.dispatch('trainingNew/setTrainingScore', '');
}).catch(() => {
this.$message.error('开始实训失败!');
});
@ -109,10 +111,11 @@ export default {
});
},
handlerEnd() {
endTraining(this.group).then(() => {
endTraining(this.group).then((resp) => {
this.$store.dispatch('trainingNew/trainingEnd');
this.$store.dispatch('socket/clearTrainingStepTip');
this.$store.dispatch('trainingNew/clearStepOrder');
this.$store.dispatch('trainingNew/setTrainingScore', resp.data);
}).catch(() => {
this.$message.error('结束实训失败!');
});

View File

@ -191,6 +191,7 @@ export default {
setOperations(data) {
if (data) {
this.tableData[data.index].operations = data.stepDetail.operations;
}
},
handleDelete(index, row) {

View File

@ -13,12 +13,12 @@
<el-row style="font-size: 16px;padding: 5px;overflow: hidden;word-wrap: break-word;">
<el-col :span="4">操作详情</el-col>
<el-col :span="20">
<!-- <div v-for="item in stepDetail.operations" :key="item">
<!--<div v-for="item in stepDetail.operations" :key="item">
<div>{{ item }}</div>
</div>-->
<template v-for="(item, index) in stepDetail.operations">
<div :key="index">
<el-tag closable @close="deleteOperation(index)">
<el-tag :type="tagIndex === index? 'success':''" closable @close="deleteOperation(index)" @click="changeTagIndex(index)">
{{ covertString(item) }}
</el-tag>
</div>
@ -41,6 +41,7 @@ export default {
dialogVisible: false,
dialogWidth: 500,
dataIndex: 0,
tagIndex: 0,
stepDetail: {
id: '',
description: '',
@ -66,8 +67,6 @@ export default {
methods: {
doShow(data) {
if (data) {
// this.stepDetail = data;
// console.log(this.stepDetail, 'stepDetail');
this.stepDetail.id = data.data.id;
this.stepDetail.description = data.data.description;
this.stepDetail.operations = data.data.operations || [];
@ -79,10 +78,22 @@ export default {
this.dialogVisible = true;
},
deleteOperation(index) {
if (this.tagIndex === index) {
this.tagIndex = 0;
}
this.stepDetail.operations.splice(index, 1);
},
changeTagIndex(index) {
this.tagIndex = index;
},
backStepList() {
this.$emit('backStepList', { index: this.dataIndex, stepDetail: this.stepDetail });
const tipPosition = {};
if (this.stepDetail.operations[this.tagIndex]) {
tipPosition.domId = this.stepDetail.operations[this.tagIndex].domId;
tipPosition.deviceCode = this.stepDetail.operations[this.tagIndex].deviceCode;
tipPosition.operateIndex = this.tagIndex;
}
this.$emit('backStepList', { index: this.dataIndex, stepDetail: this.stepDetail, tipPosition: tipPosition });
this.dialogVisible = false;
this.stepDetail = {
id: '',
@ -90,15 +101,9 @@ export default {
operations: []
};
this.dataIndex = 0;
this.tagIndex = 0;
},
covertString(data) {
// const datate = {
// deviceCode: '',
// userOperationType: '',
// domId: '',
// operationType: '',
// params: ''
// };
const userOperationTypeMap = {
rightClick: '右键点击',
leftClick: '左键点击',
@ -137,8 +142,8 @@ export default {
.editContentTabLable{
position: absolute;
background: #fff;
border-radius: 5px 0px 0px 5px ;
padding: 5px 0px;
border-radius: 5px 0 0 5px ;
padding: 5px 0;
width: 23px;
text-align: center;
left: 50%;