From a60b41398bc3c284757922cf855e2ea1a2d1dcd6 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Fri, 15 Nov 2019 16:29:11 +0800 Subject: [PATCH] =?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/jmap/map.js | 6 +- src/store/modules/exam.js | 222 +++++++++++++++--------------- src/store/modules/map.js | 1 + src/utils/baseUrl.js | 4 +- src/utils/request.js | 5 +- src/utils/stomp.js | 15 +- src/views/display/menuExam.vue | 1 - src/views/display/tipExamList.vue | 2 +- src/views/mapsystem/index.vue | 15 +- 9 files changed, 129 insertions(+), 142 deletions(-) diff --git a/src/jmap/map.js b/src/jmap/map.js index 2b3fd0603..ab9c990ad 100644 --- a/src/jmap/map.js +++ b/src/jmap/map.js @@ -64,7 +64,7 @@ class Jlmap { loadStyle(lineCode) { return selectLineCode(lineCode); - }ine + } loadDefaultState() { const defaultStateDict = {}; @@ -186,8 +186,8 @@ class Jlmap { } for (var prop in elem) { - if (elem[prop] != oDevice[prop]) { - deepAssign(oDevice, elem); + if (oDevice[prop] != elem[prop]) { + oDevice[prop] = elem[prop]; return true; } } diff --git a/src/store/modules/exam.js b/src/store/modules/exam.js index 593ebef87..1c10e3576 100644 --- a/src/store/modules/exam.js +++ b/src/store/modules/exam.js @@ -1,121 +1,117 @@ import store from '@/store'; const exam = { - namespaced: true, + namespaced: true, - state: { - started: false, // 考试状态 - usedTime: 0, // 考试当前所用时间 - totalTime: 0, // 考试总时间 - timeInterval: null, // 计时器 - suspend: false, // 暂停 - ruleList: [], // 考试规则列表 - courseDetail: {}, // 课程详情 - courseList: [] // 课程列表 - }, - getters: { - started: (state) => { - return state.started; - }, - usedTime: (state) => { - return state.usedTime; - }, - totalTime: (state) => { - return state.totalTime; - }, - suspend: (state) => { - return state.suspend; - } - }, - mutations: { - setStarted: (state, started) => { - state.started = started; - }, - setSuspend: (state, suspend) => { - state.suspend = suspend; - }, - setUsedTime: (state, usedTime) => { - state.usedTime = usedTime; - }, - setTotalTime: (state, totalTime) => { - state.totalTime = totalTime; - }, - countUsedTime: (state) => { - if (state.timeInterval) { - clearInterval(state.timeInterval); - state.timeInterval = null; - } - state.timeInterval = setInterval(() => { - if (!state.suspend) { - state.usedTime++; - } - }, 1000); - }, - stopCountTime: (state) => { - if (state.timeInterval) { - clearInterval(state.timeInterval); - state.timeInterval = null; - } - }, - setRuleList: (state, ruleList) => { - state.ruleList = ruleList; - }, - setCourseDetail: (state, courseDetail) => { - state.courseDetail = courseDetail; - }, - setCourse: (state, courseList) => { - state.courseList = courseList; - } - }, - actions: { - start({ commit }) { - commit('setStarted', true); - commit('setSuspend', false); - commit('setUsedTime', 0); - commit('countUsedTime'); - }, - over({ commit }) { - commit('setStarted', false); - commit('setSuspend', true); - commit('setUsedTime', 0); - commit('stopCountTime'); - }, - isOver() { - const trainingList = store.getters['trainingList/trainingList']; - const doList = trainingList.filter(elem => { - if (elem.usedTime !== undefined) return true; - }); + state: { + started: false, // 考试状态 + usedTime: 0, // 考试当前所用时间 + totalTime: 0, // 考试总时间 + timeInterval: null, // 计时器 + suspend: false, // 暂停 + ruleList: [], // 考试规则列表 + courseDetail: {}, // 课程详情 + courseList: [] // 课程列表 + }, + getters: { + started: (state) => { + return state.started; + }, + usedTime: (state) => { + return state.usedTime; + }, + totalTime: (state) => { + return state.totalTime; + }, + suspend: (state) => { + return state.suspend; + } + }, + mutations: { + setStarted: (state, started) => { + state.started = started; + }, + setSuspend: (state, suspend) => { + state.suspend = suspend; + }, + setUsedTime: (state, usedTime) => { + state.usedTime = usedTime; + }, + setTotalTime: (state, totalTime) => { + state.totalTime = totalTime; + }, + countUsedTime: (state) => { + if (state.timeInterval) { + clearInterval(state.timeInterval); + state.timeInterval = null; + } + state.timeInterval = setInterval(() => { + if (!state.suspend) { + state.usedTime++; + } + }, 1000); + }, + stopCountTime: (state) => { + if (state.timeInterval) { + clearInterval(state.timeInterval); + state.timeInterval = null; + } + }, + setRuleList: (state, ruleList) => { + state.ruleList = ruleList; + }, + setCourseDetail: (state, courseDetail) => { + state.courseDetail = courseDetail; + }, + setCourse: (state, courseList) => { + state.courseList = courseList; + } + }, + actions: { + start({ commit }) { + commit('setStarted', true); + commit('setSuspend', false); + commit('setUsedTime', 0); + commit('countUsedTime'); + }, + over({ commit }) { + commit('setStarted', false); + commit('setSuspend', true); + commit('setUsedTime', 0); + commit('stopCountTime'); + }, + isOver() { + const trainingList = store.getters['trainingList/trainingList']; + const doList = trainingList.filter(elem => { + if (elem.usedTime !== undefined) return true; + }); - if (doList.length >= trainingList.length) { - return true; - } - }, - setSuspend({ commit }, suspend) { - commit('setSuspend', suspend); - }, - setUsedTime({ state }, usedTime) { - if (usedTime) { - state.usedTime = usedTime; - } - }, - setTotalTime({ commit }, totalTime) { - if (totalTime) { - commit('setTotalTime', totalTime); - } - }, - countUsedTime({ commit }) { - commit('countUsedTime'); - }, - setRuleList({ commit }, ruleList) { - commit('setRuleList', ruleList); - }, - setCourseDetail({ commit }, courseDetail) { - commit('setCourseDetail', courseDetail); - }, - setCourse({ commit }, course) { - commit('setCourse', course); - } - } + if (doList.length >= trainingList.length) { + return true; + } + }, + setSuspend({ commit }, suspend) { + commit('setSuspend', suspend); + }, + setUsedTime({ commit }, usedTime) { + commit('setUsedTime', usedTime || 0); + }, + setTotalTime({ commit }, totalTime) { + commit('setTotalTime', totalTime || 0); + }, + countUsedTime({ commit }) { + commit('countUsedTime'); + }, + setRuleList({ commit }, ruleList) { + commit('setRuleList', ruleList); + }, + setCourseDetail({ commit }, courseDetail) { + commit('setCourseDetail', courseDetail); + }, + setCourse({ commit }, course) { + commit('setCourse', course); + } + } }; export default exam; diff --git a/src/store/modules/map.js b/src/store/modules/map.js index b6ae172a4..7455c6f2f 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -531,6 +531,7 @@ const map = { state.map = map; state.mapDevice = parser(map, map.skinVO.code); } else { + state.map = null; state.mapDevice = {}; } }, diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 55be58dc3..34202c02f 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -2,8 +2,8 @@ export function getBaseUrl() { let BASE_API; if (process.env.NODE_ENV === 'development') { - // BASE_API = 'https://joylink.club/jlcloud'; - BASE_API = 'https://test.joylink.club/jlcloud'; + BASE_API = 'https://joylink.club/jlcloud'; + // BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.41:9000'; // 杜闪 diff --git a/src/utils/request.js b/src/utils/request.js index 6a561e08d..389cd3150 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,5 +1,6 @@ import axios from 'axios'; import store from '../store'; +import { i18n } from '@/main.js'; import { MessageBox } from 'element-ui'; import { getToken } from '@/utils/auth'; import { getBaseUrl } from '@/utils/baseUrl'; @@ -42,8 +43,8 @@ service.interceptors.response.use( EventBus.$emit('viewLoading', false); // eslint-disable-next-line no-undef EventBus.$emit('clearCheckLogin'); - MessageBox.confirm(this.$t('tip.logoutTips'), this.$t('tip.hint'), { - confirmButtonText: this.$t('tip.confirmLogin'), + MessageBox.confirm(i18n.t('tip.logoutTips'), i18n.t('tip.hint'), { + confirmButtonText: i18n.t('tip.confirmLogin'), showCancelButton: false, type: 'warning' }).then(() => { diff --git a/src/utils/stomp.js b/src/utils/stomp.js index 9e0d89833..4dc8a198f 100644 --- a/src/utils/stomp.js +++ b/src/utils/stomp.js @@ -2,24 +2,23 @@ import Vue from 'vue'; import StompClient from '@/utils/sock'; import store from '@/store'; -export const displayTopic = '/user/queue/simulation'; // 其他仿真topic -export const planTopic = '/user/queue/simulation/plan'; // 测试运行仿真 -export const designDisplayTopic = '/user/queue/simulation/design'; // 设计平台仿真订阅路径 +export const displayTopic = '/user/queue/simulation/design'; // 其他仿真topic export const perpetualTopic = '/user/topic/message'; // 公用topic export const commonTopic = '/topic/message'; // 公共topic(不区分用户) // 建立连接并订阅地址 export function creatSubscribe(topic, header) { - // if ([displayTopic, planTopic, designDisplayTopic].includes(topic)) { - // topic = `${topic}/${header.group}`; - // } - try { if (!Vue.prototype.$stomp) { Vue.prototype.$stomp = new StompClient(); } - Vue.prototype.$stomp.subscribe(topic, callback, header); + Vue.prototype.$stomp.subscribe( + // [displayTopic].includes(topic) ? `${topic}/${header.group}` : topic, + topic, + callback, + header + ); } catch (error) { console.error('websocket订阅失败'); } diff --git a/src/views/display/menuExam.vue b/src/views/display/menuExam.vue index ec13c0292..bea135bf7 100644 --- a/src/views/display/menuExam.vue +++ b/src/views/display/menuExam.vue @@ -20,7 +20,6 @@ import TipExamList from './tipExamList'; 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'; diff --git a/src/views/display/tipExamList.vue b/src/views/display/tipExamList.vue index 9cc73ee45..e027bf221 100644 --- a/src/views/display/tipExamList.vue +++ b/src/views/display/tipExamList.vue @@ -180,6 +180,7 @@ export default { trainingId: '', id: '' }; + if (this.$route.query.examQuestionId && this.$route.query.trainingId) { obj.trainingId = this.$route.query.trainingId; obj.id = this.$route.query.examQuestionId; @@ -260,7 +261,6 @@ export default { }); }, submit() { - // exitFullscreen(); this.$store.dispatch('exam/over').then(() => { this.$store.dispatch('trainingList/clearTrainingList'); this.$router.replace({ path: `/trainingPlatform/result/${this.$route.query.userExamId}`, query: {subSystem: this.$route.query.subSystem} }); diff --git a/src/views/mapsystem/index.vue b/src/views/mapsystem/index.vue index f4f3a55a3..5aa195834 100644 --- a/src/views/mapsystem/index.vue +++ b/src/views/mapsystem/index.vue @@ -7,7 +7,7 @@