diff --git a/src/scripts/cmdPlugin/newHandler.js b/src/scripts/cmdPlugin/newHandler.js index 18a82be23..8fa32f7ae 100644 --- a/src/scripts/cmdPlugin/newHandler.js +++ b/src/scripts/cmdPlugin/newHandler.js @@ -101,21 +101,9 @@ class Handler { isLastVoiceStep() { return store.state.trainingNew.voiceStepList.length <= store.state.trainingNew.voiceStepIndex + 1; } - // 计算当前步骤得分 - computedScoring() { - const stepInfo = store.state.trainingNew.stepInfo; - const MyMemberId = store.state.training.myMemberId; - const scoringRules = store.state.trainingNew.scoringRules; - const scoringRule = scoringRules.find(rule => rule.memberId == MyMemberId); - if (scoringRule) { - const scoring = scoringRule.details.find(item => item.elementId == stepInfo.id); - store.dispatch('trainingNew/pushScoreList', scoring); - } - } nextStep() { const group = router.currentRoute.query.group; const stepInfo = store.state.trainingNew.stepInfo; - this.computedScoring(); endTrainingStep(group, stepInfo.id).then(resp => { store.dispatch('trainingNew/clearOperateOrder'); }).catch(e => { diff --git a/src/scripts/cmdPlugin/newValidateHandler.js b/src/scripts/cmdPlugin/newValidateHandler.js index 3c798b584..5171f7f2e 100644 --- a/src/scripts/cmdPlugin/newValidateHandler.js +++ b/src/scripts/cmdPlugin/newValidateHandler.js @@ -60,12 +60,17 @@ class ValidateHandler { if (valid && store.state.trainingNew.voiceStepIndex > -1) { !Handler.isLastVoiceStep() && store.dispatch('trainingNew/voiceStepIndexIncrease'); } else if (valid && Handler.isLastOperation()) { + store.dispatch('trainingNew/handleStepRecord', { type:'OVER', stepOperation, operate }); Handler.nextStep(); } else if (valid) { store.dispatch('trainingNew/operateOrderIncrease'); + store.dispatch('trainingNew/handleStepRecord', { type:'CONTINUE', stepOperation, operate }); Handler.judgeIsTextSendOperation(); } else { console.log(operate, stepOperation, '----------'); + if (store.state.trainingNew.voiceStepIndex < 0) { + store.dispatch('trainingNew/handleStepRecord', { type:'OVER', stepOperation, operate }); + } console.error('校验失败;'); } return valid; diff --git a/src/store/modules/trainingNew.js b/src/store/modules/trainingNew.js index cc638efca..2bf051bb5 100644 --- a/src/store/modules/trainingNew.js +++ b/src/store/modules/trainingNew.js @@ -16,11 +16,11 @@ const training = { scoringRules: [], // 当前实训评分规则 operateOrder: 0, // 操作order operateErrMsg: '', - scoreList: [], // 实训得分 draftStepList: null, // 显示的步骤列表 voiceStepList: [], // 实训特殊语音步骤列表 voiceStepIndex: -1, - examSwitch: false // 考试开始结束标注 + examSwitch: false, // 考试开始结束标注 + stepRecord: [] // 操作记录 }, getters: { teachMode: (state) => { @@ -51,7 +51,7 @@ const training = { state.trainingSwitch = flag; state.stepInfo = {}; state.operateOrder = 0; - state.scoreList = []; + state.stepRecord = []; }, setTrainingOperate: (state, trainingOperate) => { state.trainingOperate = trainingOperate; @@ -76,6 +76,7 @@ const training = { }, setStepInfo: (state, stepInfo) => { state.stepInfo = state.stepList.find(step => step.id === stepInfo.stepId); + state.stepRecord.push({ stepId: state.stepInfo.id, success: false, clientOperations: [] }); Handler.judgeIsTextSendOperation(); }, clearStepInfo: (state, stepInfo) => { @@ -92,10 +93,7 @@ const training = { state.operateOrder = 0; state.operateErrMsg = ''; state.scoringRules = []; - state.scoreList = []; - }, - pushScoreList: (state, scoring) => { - state.scoreList.push(scoring); + state.stepRecord = []; }, editDraftStepList: (state, draftStepList) => { state.draftStepList = draftStepList; @@ -114,6 +112,15 @@ const training = { }, setExamSwitch: (state, flag) => { state.examSwitch = flag; + }, + handleStepRecord: (state, { type, stepOperation, operate }) => { + const step = state.stepRecord[state.stepRecord.length - 1]; + if (!step.clientOperations.length || step.clientOperations[step.clientOperations.length - 1].id !== stepOperation.id) { + step.clientOperations.push({ id: stepOperation.id }); + } + if (type === 'OVER') { + step.success = true; + } } }, actions: { @@ -176,9 +183,6 @@ const training = { clearTrainingData: ({ commit }) => { commit('clearTrainingData'); }, - pushScoreList: ({ commit }, scoring) => { - commit('pushScoreList', scoring); - }, editDraftStepList: ({ commit }, draftStepList) => { commit('editDraftStepList', draftStepList); }, @@ -211,6 +215,9 @@ const training = { }, setExamSwitch: ({ commit }, flag) => { commit('setExamSwitch', flag); + }, + handleStepRecord: ({ commit }, { type, stepOperation, operate }) => { + commit('handleStepRecord', { type, stepOperation, operate }); } } }; diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index f84210e59..a1ab5af70 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -23,7 +23,7 @@ export function handlerUrl() { let OSS_URL; if (process.env.NODE_ENV === 'development') { // 开发分支 - BASE_API = 'http://192.168.3.233/rtss-server'; + // BASE_API = 'http://192.168.3.233/rtss-server'; // BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://114.116.51.125/jlcloud'; @@ -31,7 +31,7 @@ export function handlerUrl() { // BASE_API = 'http://192.168.3.94:9000'; // 旭强 // BASE_API = 'http://192.168.3.15:9000'; // 张赛 // BASE_API = 'http://192.168.3.5:9000'; // 夏增彬 - // BASE_API = 'http://192.168.3.37:9000'; // 卫志宏 + BASE_API = 'http://192.168.3.37:9000'; // 卫志宏 // BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 diff --git a/src/views/newMap/display/trainingList/testResult.vue b/src/views/newMap/display/trainingList/testResult.vue index 710dc6874..e0c069ebf 100644 --- a/src/views/newMap/display/trainingList/testResult.vue +++ b/src/views/newMap/display/trainingList/testResult.vue @@ -33,12 +33,13 @@ export default { handleClose() { this.dialogVisible = false; }, - doShow(scoreList, stepList, scoringRuleList) { - this.scoreList = scoreList; - this.stepList = stepList; - this.scoringRuleList = scoringRuleList; + doShow(score) { this.tableData = []; - this.scoringRuleList.forEach(item => { + const MyMemberId = this.$store.state.training.myMemberId; + this.scoringRuleList = this.$store.state.trainingNew.scoringRules.find(rule => rule.memberId == MyMemberId ); + console.log(this.scoringRuleList, this.$store.state.trainingNew.scoringRules); + this.stepList = this.$store.state.trainingNew.stepList; + this.scoringRuleList.details.forEach(item => { const desc = this.handleStepInfo(item.elementId); const score = this.handleScore(item.elementId); this.tableData.push({ desc: desc, score: score, totalScore: item.score }); @@ -50,8 +51,9 @@ export default { return stepInfo ? stepInfo.description : ''; }, handleScore(stepId) { - const rule = this.scoreList.find(item => stepId == item.elementId); - return rule ? rule.score : 0; + const rule = this.scoringRuleList.details.find(item => stepId == item.elementId); + const record = this.$store.state.trainingNew.stepRecord.find(item => stepId == item.stepId); + return record && record.success ? rule.score : 0; } } }; diff --git a/src/views/newMap/display/trainingList/trainingMenu.vue b/src/views/newMap/display/trainingList/trainingMenu.vue index f63d5e88f..0dbf68cab 100644 --- a/src/views/newMap/display/trainingList/trainingMenu.vue +++ b/src/views/newMap/display/trainingList/trainingMenu.vue @@ -171,33 +171,20 @@ export default { }); }, handlerEnd() { - const scoreList = this.$store.state.trainingNew.scoreList; - if (this.demoMode === ScriptMode.TEST && !this.examSwitch) { - const scoringRules = this.$store.state.trainingNew.scoringRules; - const scoringRule = scoringRules.find(rule => rule.memberId == this.$store.state.training.myMemberId); - this.$refs.testResult.doShow(scoreList, this.$store.state.trainingNew.stepList, scoringRule ? scoringRule.details : []); - } - endTraining(this.group, scoreList).then((resp) => { + endTraining(this.group, this.$store.state.trainingNew.stepRecord).then((resp) => { if (this.examSwitch) { - const scoringRules = this.$store.state.trainingNew.scoringRules; - const scoringRule = scoringRules.find(rule => rule.memberId == this.$store.state.training.myMemberId); - const trainAnswer = {}; - scoreList.forEach(item => { - trainAnswer[item.elementId] = item.score; - }); - scoringRule.forEach(rule => { - if (!trainAnswer[rule.elementId]) { - trainAnswer[rule.elementId] = 0; - } - }); const data = { subType: this.trainingDetail.type === 'SCENE' ? 5 : 4, - trainAnswer: trainAnswer + cosplayMemberId: this.$store.state.training.myMemberId, + trainDetail: this.$store.state.trainingNew.stepRecord }; EventBus.$emit('trainExamSubmit', data); + } else if (this.demoMode === ScriptMode.TEST) { + this.$refs.testResult.doShow(resp.data); } this.$store.dispatch('trainingNew/trainingEnd'); - }).catch(() => { + }).catch((e) => { + console.log(e, '****'); this.$message.error('结束实训失败!'); }); },