This commit is contained in:
ival 2021-03-17 18:06:45 +08:00
parent 520c95a00c
commit b4bf5114c6

View File

@ -25,7 +25,6 @@
</template> </template>
<script> <script>
// import { getTrainingDetailNew } from '@/api/jmap/training';
import TipTrainingDetail from './tipTrainingDetail'; import TipTrainingDetail from './tipTrainingDetail';
import LeftSlider from './LeftSlider'; import LeftSlider from './LeftSlider';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
@ -68,6 +67,7 @@ export default {
}, },
data() { data() {
return { return {
result: {},
timeInterval: null, timeInterval: null,
TrainingMode: TrainingMode, TrainingMode: TrainingMode,
trainingObj:{}, trainingObj:{},
@ -100,13 +100,16 @@ export default {
return timeFormat(this.usedTime); return timeFormat(this.usedTime);
}, },
isShowLeftSlider() { isShowLeftSlider() {
return this.$route.query.lessonId != '0'; return this.$route.query.lessonId != '0' && !this.isOther;
}, },
prdType() { prdType() {
return this.$route.query.prdType; return this.$route.query.prdType;
}, },
project() { project() {
return getSessionStorage('project'); return getSessionStorage('project');
},
isOther() {
return this.$route.query.from == 'kzfmooc';
} }
}, },
watch: { watch: {
@ -217,7 +220,6 @@ export default {
} }
}, },
endCommit() { endCommit() {
// this.$store.dispatch('training/setStopCountTime');
const mode = { const mode = {
mode: this.demoMode, mode: this.demoMode,
id: this.trainingObj.id, id: this.trainingObj.id,
@ -226,6 +228,7 @@ export default {
}; };
endTrainingNew(mode, this.group).then(response => { endTrainingNew(mode, this.group).then(response => {
const data = response.data; const data = response.data;
this.result = data;
this.$store.dispatch('training/judgeFinish', data).then(rsp => { this.$store.dispatch('training/judgeFinish', data).then(rsp => {
this.$store.dispatch('training/setStopCountTime'); this.$store.dispatch('training/setStopCountTime');
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
@ -259,7 +262,7 @@ export default {
usedTime: this.usedTime usedTime: this.usedTime
}; };
endTrainingNew(mode, this.group).then(response => { endTrainingNew(mode, this.group).then(response => {
// const data = response.data; this.result = response.data;
this.$store.dispatch('training/end', null); this.$store.dispatch('training/end', null);
this.$store.dispatch('training/setStopCountTime'); this.$store.dispatch('training/setStopCountTime');
this.$store.dispatch('training/setScore', 0); this.$store.dispatch('training/setScore', 0);
@ -278,7 +281,9 @@ export default {
}, },
back() { back() {
Notification.closeAll(); Notification.closeAll();
if (this.$route.params.mode == 'record') { if (this.isOther) {
EventBus.$emit('demoResult', this.result);
} else if (this.$route.params.mode == 'record') {
/** 如果是演示返回时,需要重新创建仿真*/ /** 如果是演示返回时,需要重新创建仿真*/
trainingNotifyNew({ trainingId: this.$route.query.trainingId }).then(resp => { trainingNotifyNew({ trainingId: this.$route.query.trainingId }).then(resp => {
this.$router.push({ path: `${UrlConfig.lesson.record}/${this.$route.query.trainingId}/${this.$route.query.trainingName}`, query: { group: resp.data } }); this.$router.push({ path: `${UrlConfig.lesson.record}/${this.$route.query.trainingId}/${this.$route.query.trainingName}`, query: { group: resp.data } });