修改代码

This commit is contained in:
ival 2019-11-15 16:29:11 +08:00
parent f9129558a6
commit a60b41398b
9 changed files with 129 additions and 142 deletions

View File

@ -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;
}
}

View File

@ -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;

View File

@ -531,6 +531,7 @@ const map = {
state.map = map;
state.mapDevice = parser(map, map.skinVO.code);
} else {
state.map = null;
state.mapDevice = {};
}
},

View File

@ -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'; // 杜闪

View File

@ -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(() => {

View File

@ -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订阅失败');
}

View File

@ -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';

View File

@ -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} });

View File

@ -7,7 +7,7 @@
<script>
import MapCommon from './common/index';
import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, displayTopic, planTopic, designDisplayTopic} from '@/utils/stomp';
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
import { sendCommand } from '@/api/jmap/training';
import { getSessionStorage } from '@/utils/auth';
@ -105,21 +105,12 @@ export default {
async subscribe() {
this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': getToken() };
if (this.mode === 'plan') {
creatSubscribe(planTopic, header);
} else {
creatSubscribe(this.isDesignPlatform ? designDisplayTopic : displayTopic, header);
}
creatSubscribe(displayTopic, header);
await this.$store.dispatch('training/setHasSubscribed');
},
clearSubscribe() {
if (this.mode === 'plan') {
clearSubscribe(planTopic);
} else {
clearSubscribe(this.isDesignPlatform ? designDisplayTopic : displayTopic);
}
clearSubscribe(displayTopic);
},
sendDeviceChangeEvent(data, header) {
//