This commit is contained in:
joylink_cuiweidong 2020-07-23 16:43:01 +08:00
commit 81bfb35e67
10 changed files with 127 additions and 80 deletions

View File

@ -161,7 +161,9 @@ export function StationStandList() {
}
this.loadpromise = function(jlmap3ddata,standsdata,jlmapstanddata,scene,assetloader){
return new Promise(function(resolve, reject){
console.log(jlmap3ddata);
console.log(standsdata);
console.log(jlmapstanddata);
let stations = jlmap3ddata.stationstandlist.list;
let num;
let num2;

View File

@ -17,11 +17,15 @@ import store from '@/store/index_APP_TARGET';
var clock = new THREE.Clock();
export function Jl3ddeviceNew(dom,group,token,skinCode) {
window.speechSynthesis.getVoices()
let voices = speechSynthesis.getVoices();
var scope = this;
let helpbox,textplane;
let daochamodel;
let psdtexturemap = [];
let psdVoiceStationList = [];
this.dom = dom;
this.nowcode = null;
@ -114,6 +118,48 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
for(let i=0,leni=mapnetdata.sectionList.length;i<leni;i++){
lableCodeMap[mapnetdata.sectionList[i].name] = mapnetdata.sectionList[i].code;
}
let stationStandList = mapnetdata.stationStandList;
let psdList = mapnetdata.psdList;
for(let i=0,leni=stationStandList.length;i<leni;i++){
for(let j=0,lenj=psdList.length;j<lenj;j++){
if(stationStandList[i].code == psdList[j].standCode){
psdVoiceStationList[psdList[j].code] = {
stationCode:stationStandList[i].stationCode,
right:stationStandList[i].right,
finlStationName:"",
nowStationName:""
}
j = lenj;
}
}
}
let stationList = [];
for(let i=0,leni=mapnetdata.stationList.length;i<leni;i++){
if(mapnetdata.stationList[i].depot == false){
stationList.push(mapnetdata.stationList[i]);
}
}
// console.log(mapnetdata.stationList);
for(let k in psdVoiceStationList){
for(let i=0,leni=stationList.length;i<leni;i++){
// console.log("---------------");
// console.log("---------------");
if(psdVoiceStationList[k].stationCode == stationList[i].code){
psdVoiceStationList[k].nowStationName = stationList[i].name;
if(psdVoiceStationList[k].right){
psdVoiceStationList[k].finlStationName = stationList[leni-1].name;
}else{
psdVoiceStationList[k].finlStationName = stationList[0].name;
}
i = leni;
}
}
}
console.log(psdVoiceStationList);
});
document.addEventListener( "mousedown", onselect, false );
@ -300,7 +346,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
if (data._type == "Psd") {
scope.modelmanager.standmodel.code = data.code;
scope.showmodel = scope.modelmanager.standmodel.mesh;
scope.scene.add(scope.showmodel);
@ -508,6 +553,10 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
scope.modelmanager.standmodel.action.time = 0;
scope.modelmanager.standmodel.action.timeScale = 1;
scope.modelmanager.standmodel.action.play();
console.log(data);
console.log();
localVoicePlay("开往"+psdVoiceStationList[data.code].finlStationName+"方向的列车进站了!");
}
if (data.open == "0" ) {
@ -796,5 +845,31 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
return data;
}
let voiceSelect;
localVoiceInit();
function localVoiceInit(){
let voices = speechSynthesis.getVoices();
for(let i = 0; i < voices.length; i++) {
if(voices[i].name == "Microsoft Huihui Desktop - Chinese (Simplified)"){
voiceSelect = voices[i];
break;
}
}
}
function localVoicePlay(playText) {
localVoiceCancel();
let toSpeak = new SpeechSynthesisUtterance(playText);
toSpeak.rate = 0.7;
toSpeak.voice = voiceSelect;
window.speechSynthesis.speak(toSpeak);
}
function localVoiceCancel() {
window.speechSynthesis.cancel();
}
}

View File

@ -24,7 +24,7 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
//console.log(mapdata);
//console.log(data);
//console.log(scope);
console.log(data);
let sceneload = scene;
let backdata = scope;
let jlmap3ddata = mapdata;

View File

@ -21,9 +21,9 @@ class TransformHandle {
view.show();
} else {
view.hide();
}
}
view.dirty();
view.dirty();
}
// 视图进行缩放/平移

View File

@ -59,3 +59,26 @@ export function formatDuring(mss) {
export function prefixIntrger(num, length) {
return (Array(length).join('0') + num).slice(-length);
}
/** 根据秒计算时间hh:mm:ss */
export function computationTime(time) {
let hours = Math.floor(time / 3600);
const newTime = time % 3600;
let minutes = Math.floor(newTime / 60) + '';
let seconds = newTime % 60;
if (hours < 0) {
hours = '00';
} else if (hours < 10) {
hours = '0' + hours;
}
if (minutes < 0) {
minutes = '00';
} else if (minutes < 10) {
minutes = '0' + minutes;
}
if (seconds < 0) {
seconds = '00';
} else if (seconds < 10) {
seconds = '0' + seconds;
}
return hours + ':' + minutes + ':' + seconds;
}

View File

@ -47,11 +47,13 @@ StompClient.prototype = {
that.subscribeMap.forEach((subscribe) => {
that.subscribe(subscribe.dest, subscribe.handler);
});
}, ()=> {
}, (e)=> {
console.log('socket连接错误:' + e);
this.status = false;
});
// sock断开回调
that.clientIns.ws.onclose = () => {
that.status = false;
console.info(`通信连接已断开!`);
checkLoginLine().then((resp) => {
if (resp.code == 200) {
@ -83,6 +85,14 @@ StompClient.prototype = {
console.info(`尝试第${count || 1}次连接.`);
// Message.warning(`正在尝试第${count || 1}次通讯连接。`);
const that = this;
if (this.clientIns) { // 初始化stomp和websocket
if (this.clientIns.connected) {
this.clientIns.disconnect();
}
this.websocket.close();
this.websocket = null;
this.clientIns = null;
}
setTimeout(() => {
that.connect();
}, reconnectInterval[that.count] || reconnectInterval[reconnectInterval.length - 1] );

View File

@ -30,6 +30,7 @@
import Question from './question';
import localStore from 'storejs';
import { postCompetitionTheory, getTheoryQuestion, quitCurrentRace } from '@/api/competition';
import { computationTime } from '@/utils/date';
export default {
components: {
@ -125,7 +126,7 @@ export default {
const storeValue = new Date().getTime();
localStore.set(storeKey, storeValue);
}
this.countdownTime = this.computationTime(this.theoryExamTime);
this.countdownTime = computationTime(this.theoryExamTime);
this.countdown = setInterval(() => {
if (this.theoryExamTime <= 0) {
@ -135,7 +136,7 @@ export default {
this.commit();
}
this.theoryExamTime--;
this.countdownTime = this.computationTime(this.theoryExamTime);
this.countdownTime = computationTime(this.theoryExamTime);
}, 1000);
}
}).catch(error => { this.$message.error(`加载考试详情失败:${error.message}`); });
@ -199,28 +200,6 @@ export default {
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'theoryAnswers';
localStore.set(storeKey, this.theoryAnswersMap);
},
computationTime(time) {
let hours = Math.floor(time / 3600);
const newTime = time % 3600;
let minutes = Math.floor(newTime / 60) + '';
let seconds = newTime % 60;
if (hours < 0) {
hours = '00';
} else if (hours < 10) {
hours = '0' + hours;
}
if (minutes < 0) {
minutes = '00';
} else if (minutes < 10) {
minutes = '0' + minutes;
}
if (seconds < 0) {
seconds = '00';
} else if (seconds < 10) {
seconds = '0' + seconds;
}
return hours + ':' + minutes + ':' + seconds;
}
}
};

View File

@ -85,6 +85,7 @@ import Vue from 'vue';
import localStore from 'storejs';
import MembersManage from './memberManage/membersManage';
import AddMember from './memberManage/addMember';
import { computationTime } from '@/utils/date';
export default {
name: 'JointTrainingDraft',
@ -389,11 +390,12 @@ export default {
this.deviceShow = false;
}
},
/* 设置仿真初始时间以及运行状态 */
async loadSimulationInfo() {
const resp = await getSimulationInfoNew(this.group);
debugger;
if (resp && resp.code == 200 && resp.data && !resp.data.dataError) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
this.questId = Number(resp.data.questId) || 0;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
this.$store.dispatch('map/setRunPlanStatus', resp.data.planRunning);
if (resp.data.planRunning) {
@ -406,6 +408,7 @@ export default {
this.$messageBox('此地图数据正在维护中,无法运行!');
}
},
/* 获取个人仿真信息*/
async getUserRole() {
const res = await getSimulationUserInfo(this.group);
const data = res.data || {};
@ -446,7 +449,7 @@ export default {
} else {
this.practicalTime = this.practicalExamTime * 60;
}
this.countdownTime = this.computationTime(this.practicalTime);
this.countdownTime = computationTime(this.practicalTime);
paperResp.data.practicalQuestions.forEach(elem => {
this.questionList.push({name: elem.question.name, description:elem.question.description});
});
@ -469,7 +472,6 @@ export default {
setSimulationPrdType(swch) {
// Admin Dispatcher STATION_SUPERVISOR Audience Driver MAINTAINER IBP:IBP
switch (this.userRole) {
// case 'ADMIN': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'ADMIN'); this.hideIbp(); break;
case 'DISPATCHER':
this.$store.dispatch('training/setPrdType', '02');
this.$store.dispatch('training/setRoles', 'DISPATCHER');
@ -499,6 +501,7 @@ export default {
break;
}
},
/* 竞赛系统倒计时 */
startCounting() {
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'practical';
const startTime = localStore.get(storeKey);
@ -514,7 +517,7 @@ export default {
this.$refs.demonMenu.submit();
}
this.practicalTime--;
this.countdownTime = this.computationTime(this.practicalTime);
this.countdownTime = computationTime(this.practicalTime);
}, 1000);
},
async getTrainDetail() {
@ -541,28 +544,6 @@ export default {
faultChooseShow() { //
this.$refs.faultChoose.doShow();
},
computationTime(time) {
let hours = Math.floor(time / 3600);
const newTime = time % 3600;
let minutes = Math.floor(newTime / 60) + '';
let seconds = newTime % 60;
if (hours < 0) {
hours = '00';
} else if (hours < 10) {
hours = '0' + hours;
}
if (minutes < 0) {
minutes = '00';
} else if (minutes < 10) {
minutes = '0' + minutes;
}
if (seconds < 0) {
seconds = '00';
} else if (seconds < 10) {
seconds = '0' + seconds;
}
return hours + ':' + minutes + ':' + seconds;
},
showdriving() {
this.panelShow = true;
this.drivingShow = false;

View File

@ -32,7 +32,6 @@
<script>
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
// import { getStationList } from '@/api/runplan';
import { getByGroupStationList } from '@/api/jmap/map';
import { getEveryDayRunPlanNew } from '@/api/simulation';
@ -92,12 +91,6 @@ export default {
chiShowStation: '',
kmRangeCoordMap: {},
runPlanData: {},
swch: '02',
swchList: [
{ value: '01', name: this.$t('joinTraining.local') },
{ value: '02', name: this.$t('joinTraining.lineAdjustment') },
{ value: '07', name: '大屏'}
],
runing: false,
userId: ''
};

View File

@ -8,7 +8,6 @@
import MapCommon from './common/index';
import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
import { getSessionStorage } from '@/utils/auth';
export default {
name: 'MapSystemDraft',
@ -21,7 +20,6 @@ export default {
stomp: null,
currentMap: null,
mode: '',
isDesignPlatform: false,
group: ''
};
},
@ -44,11 +42,6 @@ export default {
this.simulationError(val);
}
}
// '$store.state.socket.simulationReset': function (val) {
// if (val) {
// this.simulationReset(val);
// }
// }
},
mounted() {
window.onbeforeunload = this.clearSubscribe;
@ -60,7 +53,6 @@ export default {
this.$store.dispatch('config/resetCanvasOffset');
}, 100);
});
this.isDesignPlatform = getSessionStorage('project').startsWith('design');
},
beforeDestroy() {
this.clearSubscribe();
@ -91,14 +83,6 @@ export default {
}).catch(() => {
});
},
// async simulationReset() {
// await this.$store.dispatch('map/clearJlmapTrainView');
// await this.$store.dispatch('map/setTrainWindowShow', false);
// await this.$store.dispatch('training/over');
// await this.$store.dispatch('socket/setSimulationReset'); //
// await this.$store.dispatch('socket/setSimulationStart');
// await this.$store.dispatch('training/setMapDefaultState');
// },
async subscribe() {
this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': getToken() };