From d0d23553677200eb068e1d7018ab98893c46ee23 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 18 Nov 2019 09:18:07 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BB=BF=E7=9C=9F=E9=A1=B5=E9=9D=A2=E4=BB=A3=E7=A0=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/display/tipExamList.vue | 45 +++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/src/views/display/tipExamList.vue b/src/views/display/tipExamList.vue index f18a56c2f..fc87ab7e5 100644 --- a/src/views/display/tipExamList.vue +++ b/src/views/display/tipExamList.vue @@ -104,7 +104,8 @@ export default { updateTime: '' }, detailShow: false, - examIndex: 0 + examIndex: 0, + scanInter:null }; }, computed: { @@ -115,12 +116,7 @@ export default { return this.$store.state.exam.totalTime - this.$store.state.exam.usedTime; }, formatRemainTime() { - if (this.remainTime < 0) { - this.$message.success(this.$t('display.exam.autoSubmit')); - this.submit(); - } - - return timeFormat(this.remainTime); + return this.remainTime >= 0 ? timeFormat(this.remainTime) : ''; }, isFirst() { return this.examIndex == 0; @@ -129,8 +125,15 @@ export default { return this.examIndex == this.trainingList.length - 1; } }, - mounted() { - this.loadInitData(); + watch: { + '$store.state.map.mapViewLoadedCount': function() { + this.$store.dispatch('exam/stopCountTime'); + this.loadInitData(); + this.$store.dispatch('exam/countUsedTime'); + } + }, + beforeDestroy() { + this.clearScanCommit(); }, methods: { backList() { @@ -170,13 +173,13 @@ export default { this.detailShow = false; }, // 获取试题列表 - loadInitData() { + async loadInitData() { // 刷新考试列表 refreshExamList(this.$route.query.userExamId).then(response => { this.examName = response.data.examName; - 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 => { }); + this.$store.commit('exam/setUsedTime', response.data.usedTime); + this.$store.commit('exam/setTotalTime', response.data.duration); + this.$store.commit('trainingList/setTrainingList', response.data.userExamQuestionsVOs); const obj = { trainingId: '', id: '' @@ -190,6 +193,7 @@ export default { obj.id = response.data.userExamQuestionsVOs[0].id; } this.selectedTraining(obj); + this.scanCommit(); }).catch(error => { // 如果时50009则表示考试已完成,不能再次进行y if (error.code === 500009) { @@ -199,9 +203,22 @@ export default { } }); - this.shrink(); }, + scanCommit() { + this.clearScanCommit(); + this.scanInter = setInterval(()=>{ + if (this.remainTime < 0) { + this.$message.success(this.$t('display.exam.autoSubmit')); + this.clearScanCommit(); + this.submit(); + } + }, 1000); + }, + clearScanCommit() { + clearInterval(this.scanInter); + this.scanInter = null; + }, nextExam() { const obj = { trainingId: '', From 78761243e43a0d5a3767bf854f414183e1235872 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 18 Nov 2019 09:43:07 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=89=A7=E6=9C=AC=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E8=A7=92=E8=89=B2=E4=BB=A3=E7=A0=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/display/menuSchema.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/display/menuSchema.vue b/src/views/display/menuSchema.vue index 736b49874..6eb9975bf 100644 --- a/src/views/display/menuSchema.vue +++ b/src/views/display/menuSchema.vue @@ -172,7 +172,7 @@ export default { this.$refs.addQuest.doShow(); }, viewScriptRoles() { - const row = {id: this.$route.query.scriptId}; + const row = {id: this.$route.query.scriptId, group:this.$route.query.group}; this.$refs.addQuest.handleLoad(1, row); }, selectQuest(row, id, mapLocation, roleName) { From 72d7fc96eab39c4a46ee297915e306d23d6d987e Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Mon, 18 Nov 2019 10:34:18 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 2 +- src/store/modules/socket.js | 10 +++++----- src/views/display/menuDemon.vue | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/App.vue b/src/App.vue index 3f4e9e915..1df44d27d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -27,7 +27,7 @@ export default { this.subscribeMessage(val); } }, - '$store.state.socket.beLogout': async function(val) { + '$store.state.socket.beLogoutCount': async function(val) { this.$alert(this.$t('tip.logoutTips'), this.$t('tip.hint'), { confirmButtonText: this.$t('tip.confirm'), callback: action => { diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index 5cf7a1512..7dbfbb80b 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -9,9 +9,6 @@ function handle(state, data) { case 'Order_Pay_Result': // 订单支付结果消息 state.payOrder = msg; break; - case 'Be_Logged_Out': // 重复登录被登出 - state.beLogout = msg; - break; case 'JointTraining_Room': // 综合演练室-房间消息 if (!path.includes('/plan') || !path.includes('/dp/')) { state.jointRoomInfo = msg; // 房间信息 @@ -74,6 +71,9 @@ function handle(state, data) { case 'JointTraining_Device': state.realDeviceInfo++; break; + case 'Be_Logged_Out': // 重复登录被登出 + state.beLogoutCount++; + break; case 'Simulation_Control_Pause': // 暂停中 store.dispatch('scriptRecord/updateSimulationPause', msg); break; @@ -196,7 +196,6 @@ const socket = { state: { payOrder: {}, // 支付消息 - beLogout: {}, // 被登出 jointRoomInfo: {}, // 受邀请房间信息 chatContent: {}, // 聊天室聊天内容 roleList: [], // 设置角色信息 @@ -223,7 +222,8 @@ const socket = { permissionOver: {}, // 权限结束 tipOperateCount: 0, // 任务结束提示消息 - realDeviceInfo: 0 // 真实设备信息 + realDeviceInfo: 0, // 真实设备信息 + beLogoutCount: 0 // 被登出 }, getters: { diff --git a/src/views/display/menuDemon.vue b/src/views/display/menuDemon.vue index cb8245a09..19d364f8f 100644 --- a/src/views/display/menuDemon.vue +++ b/src/views/display/menuDemon.vue @@ -186,8 +186,6 @@ export default { }, back() { this.$store.dispatch('training/over').then(() => { - EventBus.$emit('runPlanStop'); - EventBus.$emit('chatSubscribeStop'); history.go(-1); Notification.closeAll(); }); From 744bd60d9e62e9bf327b740e41f738a66177acba Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 18 Nov 2019 12:28:08 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/GlobalPlugin.js | 132 +++++++++--------- src/views/designUser/mapmanage/create.vue | 6 +- src/views/designUser/mapmanage/edit.vue | 2 +- src/views/display/demon/addQuest.vue | 4 +- src/views/display/designIndex.vue | 1 + .../editTool/menus/createEmptyPlan.vue | 4 +- .../editTool/menus/editPlanName.vue | 4 +- .../editTool/menus/modifyingTask.vue | 1 + src/views/scriptManage/create.vue | 26 ++-- .../scriptManage/scriptRecord/command.vue | 8 +- 10 files changed, 101 insertions(+), 87 deletions(-) diff --git a/src/scripts/GlobalPlugin.js b/src/scripts/GlobalPlugin.js index 8c78dc5fb..aa39bf649 100644 --- a/src/scripts/GlobalPlugin.js +++ b/src/scripts/GlobalPlugin.js @@ -12,90 +12,90 @@ Vue.component('QueryListPage', QueryListPage); Vue.component('TurnbackBar', TurnbackBar); Vue.prototype.$ConstSelect = (function() { - ConstConfig.ConstSelect.translate = function(value, codeName) { - if (codeName) { - const obj = this[codeName].filter(function(item) { - return item.value === value; - })[0]; - return obj && obj.label; - } - }; - return ConstConfig.ConstSelect; + ConstConfig.ConstSelect.translate = function(value, codeName) { + if (codeName) { + const obj = this[codeName].filter(function(item) { + return item.value === value; + })[0]; + return obj && obj.label; + } + }; + return ConstConfig.ConstSelect; })(); Vue.prototype.$Dictionary = Dictionary; Vue.prototype.__windowResizeFlag = false; Vue.prototype.$addWindowResizeListener = function(cb) { - window.addEventListener('resize', function() { - if (!Vue.__windowResizeFlag) { - Vue.__windowResizeFlag = true; - setTimeout(function() { - Vue.__windowResizeFlag = false; - cb(); - }, 100); - } - }); + window.addEventListener('resize', function() { + if (!Vue.__windowResizeFlag) { + Vue.__windowResizeFlag = true; + setTimeout(function() { + Vue.__windowResizeFlag = false; + cb(); + }, 100); + } + }); }; Vue.prototype.$theme = new Theme(); Vue.prototype.$messageBox = function(msge) { - if (this.$confirm) { - this.$confirm(`${msge || this.$t('global.processFailure')}!`, this.$t('global.tips'), { - confirmButtonText: this.$t('global.confirm'), - type: 'warning', - showCancelButton: false, - center: true - }).then(() => { - }).catch(() => { - }); - } + if (this.$confirm) { + this.$confirm(`${msge || this.$t('global.processFailure')}`, this.$t('global.tips'), { + confirmButtonText: this.$t('global.confirm'), + type: 'warning', + showCancelButton: false, + center: true + }).then(() => { + }).catch(() => { + }); + } }; Vue.prototype.$convertField = function(fieldValue, enumList, converFormat, isList = false) { - const arr = []; - if (enumList && converFormat && converFormat.length >= 2) { - const value = converFormat[0]; - const label = converFormat[1]; - if (isList) { - enumList.forEach((element, i) => { - fieldValue.forEach((v, j) => { - if ('' + fieldValue[j] === '' + enumList[i][value]) { - arr.push(enumList[i][label]); - } - }); - }); - } else { - for (let i = 0; i < enumList.length; i++) { - if ('' + fieldValue === '' + enumList[i][value]) { - return enumList[i][label]; - } - } - } - } + const arr = []; + if (enumList && converFormat && converFormat.length >= 2) { + const value = converFormat[0]; + const label = converFormat[1]; + if (isList) { + enumList.forEach((element, i) => { + fieldValue.forEach((v, j) => { + if ('' + fieldValue[j] === '' + enumList[i][value]) { + arr.push(enumList[i][label]); + } + }); + }); + } else { + for (let i = 0; i < enumList.length; i++) { + if ('' + fieldValue === '' + enumList[i][value]) { + return enumList[i][label]; + } + } + } + } - return isList ? arr: ''; + return isList ? arr : ''; }; Vue.prototype.$convertSpecifiedField = function(dataDict, enumList, key, value, fieldList) { - if (dataDict && enumList && fieldList && enumList.length && fieldList.length) { - fieldList.forEach(field => { - enumList.forEach(elem => { - if (elem[key] === dataDict[field]) { - dataDict[field] = elem[value]; - } - }); - }); - } + if (dataDict && enumList && fieldList && enumList.length && fieldList.length) { + fieldList.forEach(field => { + enumList.forEach(elem => { + if (elem[key] === dataDict[field]) { + dataDict[field] = elem[value]; + } + }); + }); + } }; Vue.prototype.$convertList = function(FromList, ToList, checktypeFunction) { - if (FromList) { - ToList.length = 0; - FromList.forEach(elem => { - if (checktypeFunction(elem)) { - ToList.push({ value: elem.code, label: elem.name }); - } - }); - } + if (FromList) { + ToList.length = 0; + FromList.forEach(elem => { + if (checktypeFunction(elem)) { + ToList.push({ value: elem.code, label: elem.name }); + } + }); + } }; diff --git a/src/views/designUser/mapmanage/create.vue b/src/views/designUser/mapmanage/create.vue index f65309de0..4a36b9ca4 100644 --- a/src/views/designUser/mapmanage/create.vue +++ b/src/views/designUser/mapmanage/create.vue @@ -15,7 +15,7 @@ - + @@ -32,7 +32,7 @@ - + @@ -96,7 +96,7 @@ export default { { required: true, message: this.$t('rules.pleaseSelectMapSource'), trigger: 'change' } ], name: [ - { required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'change' } + { required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'blur' } ] }, cityList: [] diff --git a/src/views/designUser/mapmanage/edit.vue b/src/views/designUser/mapmanage/edit.vue index 95b479ac5..cbbd3a8bb 100644 --- a/src/views/designUser/mapmanage/edit.vue +++ b/src/views/designUser/mapmanage/edit.vue @@ -14,7 +14,7 @@ - + diff --git a/src/views/display/demon/addQuest.vue b/src/views/display/demon/addQuest.vue index f8eccfeea..84ae3bfdb 100644 --- a/src/views/display/demon/addQuest.vue +++ b/src/views/display/demon/addQuest.vue @@ -176,11 +176,11 @@ export default { } }, - async confirm() { + confirm() { const roleName = this.memberList.find(elem=>{ return elem.id == this.form.role; }); - this.$emit('selectQuest', this.row, this.form.role, this.mapLocation, roleName.role); this.doClose(); this.roleDoClose(); + this.$emit('selectQuest', this.row, this.form.role, this.mapLocation, roleName.role); }, roleDoClose() { diff --git a/src/views/display/designIndex.vue b/src/views/display/designIndex.vue index 59196191a..b4986477e 100644 --- a/src/views/display/designIndex.vue +++ b/src/views/display/designIndex.vue @@ -35,6 +35,7 @@ :offset="offset" :group="group" @switchMode="switchMode" + @selectQuest="selectQuest" />