diff --git a/.env.development b/.env.development index 44f32c558..75fe8ce84 100644 --- a/.env.development +++ b/.env.development @@ -5,10 +5,10 @@ NODE_ENV = 'development' # base api # VUE_APP_BASE_API = 'https://joylink.club/jlcloud' # VUE_APP_BASE_API = 'http://192.168.3.4:9000' -VUE_APP_BASE_API = 'http://192.168.3.6:9000' -VUE_APP_VOICE_API = 'http://119.3.163.89/oss/joylink' -VUE_APP_UPLOAD_API = 'http://joylink.club/jlfile' -VUE_APP_BASE_SITE='https://test.joylink.club/cbtc' +# VUE_APP_BASE_API = 'http://192.168.3.6:9000' +# VUE_APP_VOICE_API = 'http://119.3.163.89/oss/joylink' +# VUE_APP_UPLOAD_API = 'http://joylink.club/jlfile' +# VUE_APP_BASE_SITE='https://test.joylink.club/cbtc' # VUE_APP_VOICE_API = 'http://192.168.8.110:9008' diff --git a/.env.heb b/.env.heb index 3dacc354d..ba476b42d 100644 --- a/.env.heb +++ b/.env.heb @@ -3,7 +3,7 @@ NODE_ENV = 'production' VUE_APP_PRO = 'local' # base api -VUE_APP_BASE_API = 'http://160.20.60.15:9000' -VUE_APP_VOICE_API = 'http://160.20.60.15/oss/joylink' -VUE_APP_UPLOAD_API = 'http://160.20.60.15' -VUE_APP_BASE_SITE='http://160.20.60.15' +# VUE_APP_BASE_API = 'http://160.20.60.15:9000' +# VUE_APP_VOICE_API = 'http://160.20.60.15/oss/joylink' +# VUE_APP_UPLOAD_API = 'http://160.20.60.15' +# VUE_APP_BASE_SITE='http://160.20.60.15' diff --git a/.env.ntyl b/.env.ntyl index 23049259f..8aebc8513 100644 --- a/.env.ntyl +++ b/.env.ntyl @@ -3,7 +3,7 @@ NODE_ENV = 'production' VUE_APP_PRO = 'ntyl' # base api -VUE_APP_BASE_API = 'https://joylink.club/jlcloud' -VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink' -VUE_APP_UPLOAD_API = 'https://upload.joylink.club' -VUE_APP_BASE_SITE='https://joylink.club/cbtc' +# VUE_APP_BASE_API = 'https://joylink.club/jlcloud' +# VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink' +# VUE_APP_UPLOAD_API = 'https://upload.joylink.club' +# VUE_APP_BASE_SITE='https://joylink.club/cbtc' diff --git a/.env.production b/.env.production index 5e5c8ac94..594d4ddea 100644 --- a/.env.production +++ b/.env.production @@ -2,7 +2,7 @@ NODE_ENV = 'production' # base api -VUE_APP_BASE_API = 'https://joylink.club/jlcloud' -VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink' -VUE_APP_UPLOAD_API = 'https://joylink.club/jlfile/' -VUE_APP_BASE_SITE='https://joylink.club/cbtc' +# VUE_APP_BASE_API = 'https://joylink.club/jlcloud' +# VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink' +# VUE_APP_UPLOAD_API = 'https://upload.joylink.club' +# VUE_APP_BASE_SITE='https://joylink.club/cbtc' diff --git a/.env.staging b/.env.staging index 789da186f..522c97e6b 100644 --- a/.env.staging +++ b/.env.staging @@ -2,7 +2,7 @@ NODE_ENV = 'test' # base api -VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud' -VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink' -VUE_APP_UPLOAD_API = 'https://upload.joylink.club' -VUE_APP_BASE_SITE='https://test.joylink.club/cbtc' +# VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud' +# VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink' +# VUE_APP_UPLOAD_API = 'https://upload.joylink.club' +# VUE_APP_BASE_SITE='https://test.joylink.club/cbtc' diff --git a/src/api/company.js b/src/api/company.js index d7f0ce9c2..03d20ac50 100644 --- a/src/api/company.js +++ b/src/api/company.js @@ -309,3 +309,10 @@ export function getUserDuration(params) { params }); } +/** 获取单位二维码 */ +export function getCompanyQrCode(orgId) { + return request({ + url: `/api/company/${orgId}/qrCode`, + method: 'get' + }); +} diff --git a/src/api/jlmap3d/assets3d.js b/src/api/jlmap3d/assets3d.js index ea1a8238c..96d40a2cf 100644 --- a/src/api/jlmap3d/assets3d.js +++ b/src/api/jlmap3d/assets3d.js @@ -1,10 +1,10 @@ import request from '@/utils/request'; - +import store from '@/store/index'; const publicPath = process.env.VUE_APP_PRO == 'local' ? '' : '/cbtc'; export const JL3D_LOCAL_STATIC = publicPath+"/static"; -const BASE_UPLOAD_API = process.env.VUE_APP_UPLOAD_API; -export const BASE_ASSET_API = process.env.VUE_APP_VOICE_API; +const BASE_UPLOAD_API = store.state.user.uploadUrl; +export const BASE_ASSET_API = store.state.user.resourcesUrl; // console.log(JL3D_LOCAL_STATIC); // console.log(BASE_UPLOAD_API); // console.log(BASE_ASSET_API); diff --git a/src/api/jmap/lesson3d.js b/src/api/jmap/lesson3d.js index 3ad13e5fd..d75da8142 100644 --- a/src/api/jmap/lesson3d.js +++ b/src/api/jmap/lesson3d.js @@ -1,5 +1,5 @@ import request from '@/utils/request'; - +//获取三维课程草稿列表 export function getLesson3dDrftList(params) { return request({ url: `/api/draft3dLesson/paging`, @@ -7,7 +7,7 @@ export function getLesson3dDrftList(params) { params: params }); } - +//获取三维课程草稿数据 export function getLesson3dData(lessonId) { return request({ url: `/api/draft3dLesson/${lessonId}`, @@ -15,13 +15,47 @@ export function getLesson3dData(lessonId) { params: '' }); } +//获取三维课程发布数据 +export function getPublishLesson3dData(lessonId) { + return request({ + url: `/api/lesson3d/${lessonId}`, + method: 'get', + params: '' + }); +} +//上架课程 +export function onlineLesson3d(lessonId) { + return request({ + url: `/api/lesson3d/${lessonId}/online`, + method: 'put', + params: '' + }); +} +//下架课程 +export function offlineLesson3d(lessonId) { + return request({ + url: `/api/lesson3d/${lessonId}/offline`, + method: 'put', + params: '' + }); +} + +export function getSelectLesson3dList(params) { + return request({ + url: `/api/lesson3d/list`, + method: 'get', + params: params + }); +} + + //查询发布课程 -export function publishedLesson3d() { +export function publishedLesson3d(params) { return request({ url: `/api/lesson3d/paging`, method: 'get', - params: '' + params: params }); } @@ -39,7 +73,7 @@ export function publishLesson3d(lessonId) { return request({ url: `/api/draft3dLesson/${lessonId}/publish`, method: 'post', - data: "" + data: '' }); } diff --git a/src/api/upload.js b/src/api/upload.js index c2ea6b1de..735f35be4 100644 --- a/src/api/upload.js +++ b/src/api/upload.js @@ -10,7 +10,7 @@ export const meansUrl = `/api/upload/MEANS?appId=${productIdentify}`; // export const regulationUrl = `/api/upload/regulation?appId=${productIdentify}`; export function getUrl(relatedUrl) { - return `${process.env.VUE_APP_UPLOAD_API}${relatedUrl}`; + return `${this.$store.state.user.uploadUrl}${relatedUrl}`; } export function uploadFile(url, data) { diff --git a/src/components/QuillEditor/index.vue b/src/components/QuillEditor/index.vue index 17795b027..f6338219d 100644 --- a/src/components/QuillEditor/index.vue +++ b/src/components/QuillEditor/index.vue @@ -75,9 +75,9 @@ export default { loading: true, name: 'file', size: 3, - action: `${process.env.VUE_APP_UPLOAD_API}/api/upload/PICTURE?appId=00001&appSecret=joylink00001`, + action: `${this.$store.state.user.uploadUrl}/api/upload/PICTURE?appId=00001&appSecret=joylink00001`, response: (res) => { - return `${process.env.VUE_APP_VOICE_API}${res.data}`; + return `${this.$store.state.user.resourcesUrl}${res.data}`; }, error: () => { that.$message.error('图片上传失败,请检查网络状态'); }, sizeError: () => { that.$message.error('图片上传失败,图片大小限制3MB'); } // 图片超过大小的回调 diff --git a/src/i18n/langs/en/lesson.js b/src/i18n/langs/en/lesson.js index 1f8e634e1..4760d2e75 100644 --- a/src/i18n/langs/en/lesson.js +++ b/src/i18n/langs/en/lesson.js @@ -74,7 +74,9 @@ export default { courseDescription: 'Course description', editCourse: 'Edit course', createCourse: 'Create course', - courseRelease: 'Course release', + courseRelease: 'Course offonline', + courseOnline: 'Course online', + courseOffline: 'Course offonline', releaseAssociatedCity: 'Release associated city:', releaseAssociatedMap: 'Release associated map:', trainingSequence: 'Training sequence', diff --git a/src/i18n/langs/en/tip.js b/src/i18n/langs/en/tip.js index 0909ac866..ed03798ba 100644 --- a/src/i18n/langs/en/tip.js +++ b/src/i18n/langs/en/tip.js @@ -123,6 +123,8 @@ export default { coursePublishSuccessful: 'Successful course release', coursePublishFailed: 'Course launch failed', + offlineSuccessful: 'Successful offline', + offlineFailed: 'Course offline', startOperationHint: 'This operation will start the task. Do you want to continue?', cancelsTaskHint: 'This action cancels the task. Do you want to continue?', automaticGenerationTrainingSuccess: 'Automatic generation of training success', diff --git a/src/i18n/langs/zh/lesson.js b/src/i18n/langs/zh/lesson.js index 1c346cad1..5344bee9c 100644 --- a/src/i18n/langs/zh/lesson.js +++ b/src/i18n/langs/zh/lesson.js @@ -74,6 +74,8 @@ export default { editCourse: '编辑课程', createCourse: '创建课程', courseRelease: '课程发布', + courseOnline: '课程上架', + courseOffline: '课程下架', releaseAssociatedCity: '发布关联城市:', releaseAssociatedMap: '发布关联地图:', trainingSequence: '实训排序', @@ -124,4 +126,3 @@ export default { copy: '复制', prdType:'产品类型' }; - diff --git a/src/i18n/langs/zh/tip.js b/src/i18n/langs/zh/tip.js index 851cb3b31..dc374fbc5 100644 --- a/src/i18n/langs/zh/tip.js +++ b/src/i18n/langs/zh/tip.js @@ -123,6 +123,8 @@ export default { trainModelNameRepeat: '列车模型数据重复', coursePublishSuccessful: '课程发布成功', coursePublishFailed: '课程发布失败', + offlineSuccessful: '课程下架成功', + offlineFailed: '课程下架失败', startOperationHint: '此操作将开始任务, 是否继续?', cancelsTaskHint: '此操作将取消任务, 是否继续?', automaticGenerationTrainingSuccess: '自动生成实训成功', diff --git a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js index 824f66be9..f18e8a17d 100644 --- a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js +++ b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js @@ -1,6 +1,5 @@ import StompClient from '@/utils/sock'; - -import { getBaseUrl } from '@/utils/baseUrl' +import store from '@/store/index'; import { getToken } from '@/utils/auth'; // 定于仿真socket接口 @@ -43,7 +42,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri let header = {'X-Token': getToken() }; let connectmsg = { type:'init', - baseurl:getBaseUrl(), + baseurl:store.state.user.baseUrl, topic:this.topic, token:getToken(), }; @@ -364,7 +363,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri // if(data.code = "336"){ // console.log(data); // } - + if(rails.sectionrail[data.section]){ if(data.section != updateTrainModel.nowsection){ updateTrainModel.nowsection = data.section; updateTrainModel.curve = rails.sectionrail[data.section].lineleft; @@ -522,6 +521,10 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri } } + }else{ + updateTrainModel.position.x = -100000; + } + } @@ -537,203 +540,168 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri trainmodel.code = data.code; trainmodel.nowcode = data.code; } + if(rails.sectionrail[data.section]){ + //改变当前列车行驶的区段code + if(data.section != trainmodel.nowsection){ + trainmodel.nowsection = data.section; + trainmodel.curve = rails.sectionrail[data.section].lineleft; + } - //改变当前列车行驶的区段code - if(data.section != trainmodel.nowsection){ - trainmodel.nowsection = data.section; - trainmodel.curve = rails.sectionrail[data.section].lineleft; - } + //判断转向 + if(trainmodel.right != data.right){ - //判断转向 - if(trainmodel.right != data.right){ + if(data.right == "0"){ + trainmodel.right = "0"; + trainmodel.rotation.y = Math.PI; + let point = trainmodel.curve.getPointAt(data.offset); + trainmodel.position.x = point.x; + for (let tl=0; tl=0;an--){ + actions["traindoor"].top[an].stop(); + } + trainmodel.openright = "1"; + for(let an=actions["traindoor"].down.length-1;an>=0;an--){ + actions["traindoor"].down[an].reset(); + actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration; + actions["traindoor"].down[an].timeScale = 1; + actions["traindoor"].down[an].play(); + } + }else if(trainmodel.openright == "1"){ + trainmodel.openright = "0"; + for(let an=actions["traindoor"].down.length-1;an>=0;an--){ + actions["traindoor"].down[an].stop(); + } + trainmodel.openleft = "1"; + for(let an=actions["traindoor"].top.length-1;an>=0;an--){ + actions["traindoor"].top[an].reset(); + actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration; + actions["traindoor"].top[an].timeScale = 1; + actions["traindoor"].top[an].play(); + } + } - if(trainmodel.openleft == "1"){ - trainmodel.openleft = "0"; - for(let an=actions["traindoor"].top.length-1;an>=0;an--){ - actions["traindoor"].top[an].stop(); + }else{ + trainmodel.right = "1"; + trainmodel.rotation.y = 0; + let point = trainmodel.curve.getPointAt(data.offset); + trainmodel.position.x = point.x; + for (let tl=0; tl=0;an--){ - actions["traindoor"].down[an].reset(); - actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration; - actions["traindoor"].down[an].timeScale = 1; - actions["traindoor"].down[an].play(); - } - }else if(trainmodel.openright == "1"){ - trainmodel.openright = "0"; - for(let an=actions["traindoor"].down.length-1;an>=0;an--){ - actions["traindoor"].down[an].stop(); - } - trainmodel.openleft = "1"; - for(let an=actions["traindoor"].top.length-1;an>=0;an--){ - actions["traindoor"].top[an].reset(); - actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration; - actions["traindoor"].top[an].timeScale = 1; - actions["traindoor"].top[an].play(); - } - } - }else{ - trainmodel.right = "1"; - trainmodel.rotation.y = 0; - let point = trainmodel.curve.getPointAt(data.offset); - trainmodel.position.x = point.x; - for (let tl=0; tl=0;an--){ + actions["traindoor"].top[an].stop(); + } + trainmodel.openright = "1"; + for(let an=actions["traindoor"].down.length-1;an>=0;an--){ + actions["traindoor"].down[an].reset(); + actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration; + actions["traindoor"].down[an].timeScale = 1; + actions["traindoor"].down[an].play(); + } + }else if(trainmodel.openright == "1"){ + trainmodel.openright = "0"; + for(let an=actions["traindoor"].down.length-1;an>=0;an--){ + actions["traindoor"].down[an].stop(); + } + trainmodel.openleft = "1"; + for(let an=actions["traindoor"].top.length-1;an>=0;an--){ + actions["traindoor"].top[an].reset(); + actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration; + actions["traindoor"].top[an].timeScale = 1; + actions["traindoor"].top[an].play(); + } + } - if(trainmodel.openleft == "1"){ - trainmodel.openleft = "0"; - for(let an=actions["traindoor"].top.length-1;an>=0;an--){ - actions["traindoor"].top[an].stop(); - } - trainmodel.openright = "1"; - for(let an=actions["traindoor"].down.length-1;an>=0;an--){ - actions["traindoor"].down[an].reset(); - actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration; - actions["traindoor"].down[an].timeScale = 1; - actions["traindoor"].down[an].play(); - } - }else if(trainmodel.openright == "1"){ - trainmodel.openright = "0"; - for(let an=actions["traindoor"].down.length-1;an>=0;an--){ - actions["traindoor"].down[an].stop(); - } - trainmodel.openleft = "1"; - for(let an=actions["traindoor"].top.length-1;an>=0;an--){ - actions["traindoor"].top[an].reset(); - actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration; - actions["traindoor"].top[an].timeScale = 1; - actions["traindoor"].top[an].play(); - } } } - } - - if(trainmodel.curve && trainmodel.offset != data.offset){ - trainmodel.offset = data.offset; - let pos = trainmodel.curve.getPointAt(data.offset); - trainmodel.position.x = pos.x; - // trainmodel.children[0].position.z = pos.z; - if(data.right == "0"){ - if(-trainmodel.children[0].position.z != pos.z || trainmodel.children[0].position.y != pos.y){ - trainmodel.children[0].up = new THREE.Vector3(1,0,0); - let tangent = trainmodel.curve.getTangentAt(data.offset).normalize(); - trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); - let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); - trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); - trainmodel.children[0].rotation.x = -Math.PI/2; - let newRotationZ = trainmodel.children[0].rotation.z; - trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y; - trainmodel.children[0].rotation.y = -newRotationZ; - - let rotas = { - posr:pos, - roty:trainmodel.children[0].rotation.y, - rotz:trainmodel.children[0].rotation.z - } - trainmodel.children[1].rotalist.push(rotas); - let offsetz = pos.z + trainmodel.children[0].position.z; - trainmodel.children[0].position.z -= offsetz; - - // let offsety = pos.y - trainmodel.children[0].position.y; - // trainmodel.children[0].position.y += offsetz; - // trainmodel.position.z = point.z; - - } - if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){ - - for(let rs = 1;rs=trainmodel.children[rs].rotalist[0].posr.x){ - - if(rs != trainmodel.children.length-1){ - let asd = trainmodel.children[rs].rotalist[0]; - trainmodel.children[rs+1].rotalist.push(asd); - - } - //let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12]; - - trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz; - trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty; - trainmodel.children[rs].rotalist.splice(0,1) - xh--; - }else{ - xh = trainmodel.children[rs].rotalist.length; - } - } - //console.log(trainmodel.children[rs].rotalist.length); + if(trainmodel.curve && trainmodel.offset != data.offset){ + trainmodel.offset = data.offset; + let pos = trainmodel.curve.getPointAt(data.offset); + trainmodel.position.x = pos.x; + // trainmodel.children[0].position.z = pos.z; + if(data.right == "0"){ + if(-trainmodel.children[0].position.z != pos.z || trainmodel.children[0].position.y != pos.y){ + trainmodel.children[0].up = new THREE.Vector3(1,0,0); + let tangent = trainmodel.curve.getTangentAt(data.offset).normalize(); + trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); + let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); + trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); + trainmodel.children[0].rotation.x = -Math.PI/2; + let newRotationZ = trainmodel.children[0].rotation.z; + trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y; + trainmodel.children[0].rotation.y = -newRotationZ; + let rotas = { + posr:pos, + roty:trainmodel.children[0].rotation.y, + rotz:trainmodel.children[0].rotation.z } + trainmodel.children[1].rotalist.push(rotas); + let offsetz = pos.z + trainmodel.children[0].position.z; + trainmodel.children[0].position.z -= offsetz; + // let offsety = pos.y - trainmodel.children[0].position.y; + // trainmodel.children[0].position.y += offsetz; + // trainmodel.position.z = point.z; } - // console.log(trainmodel.rotalist); - } + if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){ - }else{ - // - let rotas = { - posr:null, - roty:null, - rotz:null, - }; - if(trainmodel.children[0].position.z < pos.z ){ - trainmodel.children[0].up = new THREE.Vector3(-1,0,0); - let tangent = trainmodel.curve.getTangentAt(data.offset).normalize(); - trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); - let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); - trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); - trainmodel.children[0].rotation.x = -Math.PI/2; - trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y; - trainmodel.children[0].rotation.y = 0; + for(let rs = 1;rs pos.z){ - trainmodel.children[0].up = new THREE.Vector3(1,0,0); - let tangent = trainmodel.curve.getTangentAt(data.offset).normalize(); - trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); - let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); - trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); - trainmodel.children[0].rotation.x = -Math.PI/2; - trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y; - trainmodel.children[0].rotation.y = 0; + let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].position.y); + trainmodel.children[rs].position.y += offsety; - rotas.posr = pos; - // rotas.roty = trainmodel.children[0].rotation.y; - rotas.rotz = trainmodel.children[0].rotation.z; + for(let xh=0;xh=trainmodel.children[rs].rotalist[0].posr.x){ - let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z); - trainmodel.children[0].position.z += offsetz; - } + if(rs != trainmodel.children.length-1){ + let asd = trainmodel.children[rs].rotalist[0]; + trainmodel.children[rs+1].rotalist.push(asd); - if(trainmodel.children[0].position.y != pos.y){ - if(rotas.posr == null){ + } + //let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12]; + + trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz; + trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty; + trainmodel.children[rs].rotalist.splice(0,1) + xh--; + }else{ + xh = trainmodel.children[rs].rotalist.length; + } + } + //console.log(trainmodel.children[rs].rotalist.length); + + } + + + } + // console.log(trainmodel.rotalist); + } + + }else{ + // + let rotas = { + posr:null, + roty:null, + rotz:null, + }; + if(trainmodel.children[0].position.z < pos.z ){ trainmodel.children[0].up = new THREE.Vector3(-1,0,0); let tangent = trainmodel.curve.getTangentAt(data.offset).normalize(); trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); @@ -744,64 +712,96 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri trainmodel.children[0].rotation.y = 0; rotas.posr = pos; - rotas.roty = trainmodel.children[0].rotation.y; + // rotas.roty = trainmodel.children[0].rotation.y; + rotas.rotz = trainmodel.children[0].rotation.z; + + let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z); + trainmodel.children[0].position.z += offsetz; + }else if(trainmodel.children[0].position.z > pos.z){ + trainmodel.children[0].up = new THREE.Vector3(1,0,0); + let tangent = trainmodel.curve.getTangentAt(data.offset).normalize(); + trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); + let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); + trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); + trainmodel.children[0].rotation.x = -Math.PI/2; + trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y; + trainmodel.children[0].rotation.y = 0; + + rotas.posr = pos; + // rotas.roty = trainmodel.children[0].rotation.y; rotas.rotz = trainmodel.children[0].rotation.z; let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z); trainmodel.children[0].position.z += offsetz; - let offsety = parseFloat(pos.y) - parseFloat(trainmodel.children[0].position.y); - trainmodel.children[0].position.y += offsety; - }else{ - rotas.roty = trainmodel.children[0].rotation.y; - let offsety = parseFloat(rotas.posr.y) - parseFloat(trainmodel.children[0].position.y); - trainmodel.children[0].position.y += offsety; } - } - if(rotas.posr!= null){ - trainmodel.children[1].rotalist.push(rotas); - } + if(trainmodel.children[0].position.y != pos.y){ + if(rotas.posr == null){ + trainmodel.children[0].up = new THREE.Vector3(-1,0,0); + let tangent = trainmodel.curve.getTangentAt(data.offset).normalize(); + trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); + let radians = Math.acos(trainmodel.children[0].up.dot(tangent)); + trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians); + trainmodel.children[0].rotation.x = -Math.PI/2; + trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y; + trainmodel.children[0].rotation.y = 0; + + rotas.posr = pos; + rotas.roty = trainmodel.children[0].rotation.y; + rotas.rotz = trainmodel.children[0].rotation.z; + + let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z); + trainmodel.children[0].position.z += offsetz; + let offsety = parseFloat(pos.y) - parseFloat(trainmodel.children[0].position.y); + trainmodel.children[0].position.y += offsety; + }else{ + rotas.roty = trainmodel.children[0].rotation.y; + let offsety = parseFloat(rotas.posr.y) - parseFloat(trainmodel.children[0].position.y); + trainmodel.children[0].position.y += offsety; + } + } + + if(rotas.posr!= null){ + trainmodel.children[1].rotalist.push(rotas); + } - if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){ - for(let rs = 1;rs 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){ + for(let rs = 1;rs 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){ - for(let rs = 1;rs<6;rs++){ - //console.log(rs); - if(trainlisttest.list[code].children[rs].rotalist[0]){ - let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]); - - trainlisttest.list[code].children[rs].position.z += offsetz; - - for(let xh=0;xh=trainlisttest.list[code].children[rs].rotalist[0].posr.x){ - // if(trainlisttest.list[code].groupNumber == "005"){ - // console.log("rs:"+rs); - // console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]); - // console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x); - // } - if(rs != 5){ - let asd = trainlisttest.list[code].children[rs].rotalist[0]; - trainlisttest.list[code].children[rs+1].rotalist.push(asd); - - } - - trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota; - trainlisttest.list[code].children[rs].rotalist.splice(0,1) - xh--; - }else{ - xh = trainlisttest.list[code].children[rs].rotalist.length; - } - } - //console.log(trainlisttest.list[code].children[rs].rotalist.length); - } - } - } - - - - } else if (data.right == '0') { // 向左 - trainlisttest.list[code].right = '0'; - trainlisttest.list[code].progress = 1-data.offset; - // trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack; - // if(rails.sectionrail[data.section].standTrack){ - // trainlisttest.list[code].statsstop = 0; - // } - let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress); - - trainlisttest.list[code].rotation.y = Math.PI; - trainlisttest.list[code].position.x = point.x; - trainlisttest.list[code].position.y = 0; - - // for (let tl=0; tl<6; tl++) { - // trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z); - // } - - // trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright; - // if(data.next){ - // trainlisttest.list[code].nextcode = data.next; - // trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright; - // trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact; - // } - // trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact; - trainlisttest.list[code].status = '0'; - if(-trainlisttest.list[code].children[0].position.z != point.z){ - - - trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0); - let tangent = rails.sectionrail[data.section].lineright.getTangentAt(data.offset).normalize(); + if(trainlisttest.list[code].children[0].position.z != point.z){ + trainlisttest.list[code].children[0].up = new THREE.Vector3(1,0,0); + let tangent = rails.sectionrail[data.section].lineleft.getTangentAt(data.offset).normalize(); trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize(); let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent)); trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians); trainlisttest.list[code].children[0].rotation.x = -Math.PI/2; trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y; trainlisttest.list[code].children[0].rotation.y = 0; - let rotas = { posr:point, rota:trainlisttest.list[code].children[0].rotation.z } trainlisttest.list[code].children[1].rotalist.push(rotas); - let offsetz = point.z + trainlisttest.list[code].children[0].position.z; - trainlisttest.list[code].children[0].position.z -= offsetz; - // trainlisttest.list[code].position.z = point.z; - } - if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){ - for(let rs = 1;rs<6;rs++){ + let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z); + trainlisttest.list[code].children[0].position.z += offsetz; + } + if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){ + for(let rs = 1;rs<6;rs++){ //console.log(rs); if(trainlisttest.list[code].children[rs].rotalist[0]){ + let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]); - let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z); - trainlisttest.list[code].children[rs].position.z -= offsetz; + trainlisttest.list[code].children[rs].position.z += offsetz; for(let xh=0;xh=trainlisttest.list[code].children[rs].rotalist[0].posr.x){ + // if(trainlisttest.list[code].groupNumber == "005"){ + // console.log("rs:"+rs); + // console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]); + // console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x); + // } if(rs != 5){ let asd = trainlisttest.list[code].children[rs].rotalist[0]; trainlisttest.list[code].children[rs+1].rotalist.push(asd); } - //let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12]; trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota; trainlisttest.list[code].children[rs].rotalist.splice(0,1) @@ -503,17 +424,101 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) { } } //console.log(trainlisttest.list[code].children[rs].rotalist.length); - } + } + } + + } else if (data.right == '0') { // 向左 + trainlisttest.list[code].right = '0'; + trainlisttest.list[code].progress = 1-data.offset; + // trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack; + // if(rails.sectionrail[data.section].standTrack){ + // trainlisttest.list[code].statsstop = 0; + // } + let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress); + + trainlisttest.list[code].rotation.y = Math.PI; + trainlisttest.list[code].position.x = point.x; + trainlisttest.list[code].position.y = 0; + + // for (let tl=0; tl<6; tl++) { + // trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z); + // } + + // trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright; + // if(data.next){ + // trainlisttest.list[code].nextcode = data.next; + // trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright; + // trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact; + // } + // trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact; + trainlisttest.list[code].status = '0'; + if(-trainlisttest.list[code].children[0].position.z != point.z){ + + + trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0); + let tangent = rails.sectionrail[data.section].lineright.getTangentAt(data.offset).normalize(); + trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize(); + let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent)); + trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians); + trainlisttest.list[code].children[0].rotation.x = -Math.PI/2; + trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y; + trainlisttest.list[code].children[0].rotation.y = 0; + + let rotas = { + posr:point, + rota:trainlisttest.list[code].children[0].rotation.z + } + trainlisttest.list[code].children[1].rotalist.push(rotas); + let offsetz = point.z + trainlisttest.list[code].children[0].position.z; + trainlisttest.list[code].children[0].position.z -= offsetz; + // trainlisttest.list[code].position.z = point.z; + } - // console.log(trainlisttest.list[code].rotalist); + if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){ + + for(let rs = 1;rs<6;rs++){ + //console.log(rs); + if(trainlisttest.list[code].children[rs].rotalist[0]){ + + let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z); + trainlisttest.list[code].children[rs].position.z -= offsetz; + + for(let xh=0;xh=0;an--){ - actions[code].top[an].stop(); + for (let tl=1; tl=0;an--){ - actions[code].down[an].reset(); - actions[code].down[an].time = actions[code].down[an]._clip.duration; - actions[code].down[an].timeScale = 1; - actions[code].down[an].play(); - } - }else if(trainlisttest.list[code].openright == "1"){ - trainlisttest.list[code].openright = "0"; - for(let an=actions[code].down.length-1;an>=0;an--){ - actions[code].down[an].stop(); - } - trainlisttest.list[code].openleft = "1"; - for(let an=actions[code].top.length-1;an>=0;an--){ - actions[code].top[an].reset(); - actions[code].top[an].time = actions[code].top[an]._clip.duration; - actions[code].top[an].timeScale = 1; - actions[code].top[an].play(); - } - } - - } - if(data.right == "1"){ - trainlisttest.list[code].right = "1"; - trainlisttest.list[code].rotation.y = 0; - let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset); - trainlisttest.list[code].position.x = point.x; - trainlisttest.list[code].children[0].rotalist = []; - trainlisttest.list[code].children[0].position.z = parseFloat(point.z); - for (let tl=1; tl=0;an--){ - actions[code].top[an].stop(); - } - trainlisttest.list[code].openright = "1"; - for(let an=actions[code].down.length-1;an>=0;an--){ - actions[code].down[an].reset(); - actions[code].down[an].time = actions[code].down[an]._clip.duration; - actions[code].down[an].timeScale = 1; - actions[code].down[an].play(); - } - }else if(trainlisttest.list[code].openright == "1"){ - trainlisttest.list[code].openright = "0"; - for(let an=actions[code].down.length-1;an>=0;an--){ - actions[code].down[an].stop(); - } - trainlisttest.list[code].openleft = "1"; - for(let an=actions[code].top.length-1;an>=0;an--){ - actions[code].top[an].reset(); - actions[code].top[an].time = actions[code].top[an]._clip.duration; - actions[code].top[an].timeScale = 1; - actions[code].top[an].play(); - } - } - } - } - - // console.log(data); - - if(trainlisttest.list[code].dispose == "0"){ - if (data.right == '1') { // 向右 - trainlisttest.list[code].right = '1'; - trainlisttest.list[code].progress = data.offset; - // trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack; - // if(rails.sectionrail[data.section].standTrack){ - // trainlisttest.list[code].statsstop = 0; - // } - let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress); - trainlisttest.list[code].rotation.y = 0; - trainlisttest.list[code].position.x = point.x; - trainlisttest.list[code].position.y = 0; - - // for (let tl=0; tl 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){ - for(let rs = 1;rs=trainlisttest.list[code].children[rs].rotalist[0].posr.x){ - // if(trainlisttest.list[code].groupNumber == "005"){ - // console.log("rs:"+rs); - // console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]); - // console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x); - // } - if(rs != (trainlisttest.list[code].children.length-1)){ - let asd = trainlisttest.list[code].children[rs].rotalist[0]; - trainlisttest.list[code].children[rs+1].rotalist.push(asd); - - } - - trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rotz; - trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty; - trainlisttest.list[code].children[rs].rotalist.splice(0,1) - xh--; - }else{ - xh = trainlisttest.list[code].children[rs].rotalist.length; - } - } - //console.log(trainlisttest.list[code].children[rs].rotalist.length); + if(trainlisttest.list[code].openleft == "1"){ + trainlisttest.list[code].openleft = "0"; + for(let an=actions[code].top.length-1;an>=0;an--){ + actions[code].top[an].stop(); + } + trainlisttest.list[code].openright = "1"; + for(let an=actions[code].down.length-1;an>=0;an--){ + actions[code].down[an].reset(); + actions[code].down[an].time = actions[code].down[an]._clip.duration; + actions[code].down[an].timeScale = 1; + actions[code].down[an].play(); + } + }else if(trainlisttest.list[code].openright == "1"){ + trainlisttest.list[code].openright = "0"; + for(let an=actions[code].down.length-1;an>=0;an--){ + actions[code].down[an].stop(); + } + trainlisttest.list[code].openleft = "1"; + for(let an=actions[code].top.length-1;an>=0;an--){ + actions[code].top[an].reset(); + actions[code].top[an].time = actions[code].top[an]._clip.duration; + actions[code].top[an].timeScale = 1; + actions[code].top[an].play(); } } - // } + } + if(data.right == "1"){ + trainlisttest.list[code].right = "1"; + trainlisttest.list[code].rotation.y = 0; + let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset); + trainlisttest.list[code].position.x = point.x; + trainlisttest.list[code].children[0].rotalist = []; + trainlisttest.list[code].children[0].position.z = parseFloat(point.z); + for (let tl=1; tl=0;an--){ + actions[code].top[an].stop(); + } + trainlisttest.list[code].openright = "1"; + for(let an=actions[code].down.length-1;an>=0;an--){ + actions[code].down[an].reset(); + actions[code].down[an].time = actions[code].down[an]._clip.duration; + actions[code].down[an].timeScale = 1; + actions[code].down[an].play(); + } + }else if(trainlisttest.list[code].openright == "1"){ + trainlisttest.list[code].openright = "0"; + for(let an=actions[code].down.length-1;an>=0;an--){ + actions[code].down[an].stop(); + } + trainlisttest.list[code].openleft = "1"; + for(let an=actions[code].top.length-1;an>=0;an--){ + actions[code].top[an].reset(); + actions[code].top[an].time = actions[code].top[an]._clip.duration; + actions[code].top[an].timeScale = 1; + actions[code].top[an].play(); + } + } + } + } - trainlisttest.list[code].right = '0'; - trainlisttest.list[code].progress = 1-data.offset; - // trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack; - // if(rails.sectionrail[data.section].standTrack){ - // trainlisttest.list[code].statsstop = 0; - // } - let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress); + // console.log(data); - trainlisttest.list[code].rotation.y = Math.PI; - trainlisttest.list[code].position.x = point.x; - trainlisttest.list[code].position.y = 0; + if(trainlisttest.list[code].dispose == "0"){ + if (data.right == '1') { // 向右 + trainlisttest.list[code].right = '1'; + trainlisttest.list[code].progress = data.offset; + // trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack; + // if(rails.sectionrail[data.section].standTrack){ + // trainlisttest.list[code].statsstop = 0; + // } + let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress); + trainlisttest.list[code].rotation.y = 0; + trainlisttest.list[code].position.x = point.x; + trainlisttest.list[code].position.y = 0; - // for (let tl=0; tl 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){ - - for(let rs = 1;rs 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){ + for(let rs = 1;rs=trainlisttest.list[code].children[rs].rotalist[0].posr.x){ + // if(trainlisttest.list[code].groupNumber == "005"){ + // console.log("rs:"+rs); + // console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]); + // console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x); + // } if(rs != (trainlisttest.list[code].children.length-1)){ let asd = trainlisttest.list[code].children[rs].rotalist[0]; trainlisttest.list[code].children[rs+1].rotalist.push(asd); + } - let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12]; - trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty; + trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rotz; + trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty; trainlisttest.list[code].children[rs].rotalist.splice(0,1) xh--; }else{ @@ -422,17 +335,109 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { } } //console.log(trainlisttest.list[code].children[rs].rotalist.length); - } + } + // } + + } else if (data.right == '0') { // 向左 + + trainlisttest.list[code].right = '0'; + trainlisttest.list[code].progress = 1-data.offset; + // trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack; + // if(rails.sectionrail[data.section].standTrack){ + // trainlisttest.list[code].statsstop = 0; + // } + let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress); + + trainlisttest.list[code].rotation.y = Math.PI; + trainlisttest.list[code].position.x = point.x; + trainlisttest.list[code].position.y = 0; + + // for (let tl=0; tl 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){ + + for(let rs = 1;rs { scope.nowSceneType = lessonData.lessonProgress[0].progressScene; animateManager.initAnimation(assetModelManager); diff --git a/src/jlmap3d/main/loaders/AssetLoader.js b/src/jlmap3d/main/loaders/AssetLoader.js index c9f0daef6..6b59d5165 100644 --- a/src/jlmap3d/main/loaders/AssetLoader.js +++ b/src/jlmap3d/main/loaders/AssetLoader.js @@ -4,13 +4,9 @@ import { import { Assetmaterial } from '@/jlmap3d/main/loaders/model/Assetmaterial'; -import { - getBaseUrl -} from '@/utils/baseUrl'; import { Loading } from 'element-ui'; -const BASE_API = getBaseUrl(); import { JL3D_LOCAL_STATIC, BASE_ASSET_API diff --git a/src/layout/components/Entry.vue b/src/layout/components/Entry.vue index 9aebf7261..1e9df0c17 100644 --- a/src/layout/components/Entry.vue +++ b/src/layout/components/Entry.vue @@ -142,7 +142,7 @@ export default { // } else { // href = 'https://joylink.club/docs'; // } - href = process.env.VUE_APP_BASE_SITE + '/docs/'; + href = this.$store.state.user.baseSite + '/docs/'; window.open(href, '_blank'); }, goEmpty() {}, diff --git a/src/permission.js b/src/permission.js index f7fd84604..de434e11c 100644 --- a/src/permission.js +++ b/src/permission.js @@ -7,7 +7,7 @@ import 'nprogress/nprogress.css'; import { setToken, getToken, removeToken, getSessionStorage } from '@/utils/auth'; import { getBaseUrlByProject } from '@/api/projectServer'; import localStore from 'storejs'; -import { getBaseUrl } from '@/utils/baseUrl'; +import { handlerUrl } from '@/utils/baseUrl'; const whiteList = ['/login', '/design/login', '/gzzbxy/relay', '/authorization', '/AUSline', '/AUStool', '/demo', '/thirdLogin']; // 不重定向白名单 @@ -90,13 +90,13 @@ router.beforeEach( async (to, from, next) => { if (!store.state.user.baseUrl && project && loginInfo[project]) { try { const resp = await getBaseUrlByProject(ProjectCode[project]); - if (resp && resp.data && resp.data.domainName) { - store.dispatch('setBaseUrl', resp.data.domainName); - } else { - store.dispatch('setBaseUrl', getBaseUrl()); - } + const urlData = handlerUrl(resp.data); + store.dispatch('setBaseUrl', urlData.BASE_API); + store.dispatch('setResourcesUrl', urlData.VOICE_API); + store.dispatch('setUploadUrl', urlData.UPLOAD_API); + store.dispatch('setBaseSite', urlData.BASE_SITE); } catch (e) { - store.dispatch('setBaseUrl', getBaseUrl()); + console.error(e); } } document.title = loginInfo[project || 'login'] ? loginInfo[project || 'login'].browserTitle || loginInfo[project || 'login'].title : ''; diff --git a/src/scripts/ProjectConfig.js b/src/scripts/ProjectConfig.js index 87458d76f..c377ae14b 100644 --- a/src/scripts/ProjectConfig.js +++ b/src/scripts/ProjectConfig.js @@ -60,7 +60,7 @@ export const loginInfo = { xzexam:{ title: '城市轨道交通标准化培训软件', loginPath: '/login?project=xzexam', - loginParam: 'DEFAULT', + loginParam: 'SAY', loginTitle: '空串', logoWidth: '140px', navigationLogoWidth: '120px', @@ -729,7 +729,8 @@ export const ProjectCode = { hls: 'DEFAULT', designhls: 'DEFAULT', say: 'SAY', - designsay: 'SAY' + designsay: 'SAY', + xzexam:'SAY', }; /** 嵌入第三方平台 导航栏右上角 清空 */ export const ThirdLoginList = ['richor', 'designrichor', 'richorygy', 'designrichorygy']; diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 937e1b456..ee9f742b7 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -21,7 +21,10 @@ const user = { companyAdmin: false, companyName: '', companyProjectList: [], - baseUrl:'' + baseUrl:'', + resourcesUrl: '', + uploadUrl: '', + baseSite: '' }, mutations: { @@ -81,6 +84,15 @@ const user = { }, setBaseUrl: (state, baseUrl) => { state.baseUrl = baseUrl; + }, + setResourcesUrl: (state, resourcesUrl) => { + state.resourcesUrl = resourcesUrl; + }, + setUploadUrl: (state, uploadUrl) => { + state.uploadUrl = uploadUrl; + }, + setBaseSite: (state, baseSite) => { + state.baseSite = baseSite; } }, @@ -213,6 +225,15 @@ const user = { setBaseUrl ({commit}, baseUrl) { commit('setBaseUrl', baseUrl); }, + setResourcesUrl({commit}, resourcesUrl) { + commit('setResourcesUrl', resourcesUrl); + }, + setUploadUrl({commit}, uploadUrl) { + commit('setUploadUrl', uploadUrl); + }, + setBaseSite({commit}, baseSite) { + commit('setBaseSite', baseSite); + }, setToken({commit}, token) { commit('SET_TOKEN', token); } diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 85ac2f3b5..15d13d61e 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -1,6 +1,29 @@ -export function getBaseUrl() { +import store from '@/store/index'; +// 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 = 'http://114.116.51.125/jlcloud'; +// // BASE_API = 'http://192.168.8.152:9000'; // 袁琪 +// // BASE_API = 'http://192.168.8.172:9200'; // 旭强 +// // BASE_API = 'http://192.168.8.109:9000'; // 张赛 +// // BASE_API = 'http://192.168.8.140:9000'; // 杜康 +// // BASE_API = 'http://b29z135112.zicp.vip'; +// // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 +// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 +// } else { +// BASE_API = process.env.VUE_APP_BASE_API; +// } +// return BASE_API; +// } +export function handlerUrl(data) { let BASE_API; + let VOICE_API; + let UPLOAD_API; + let BASE_SITE; if (process.env.NODE_ENV === 'development') { + // const data = null; // BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://114.116.51.125/jlcloud'; @@ -11,8 +34,31 @@ export function getBaseUrl() { // BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 - } else { - BASE_API = process.env.VUE_APP_BASE_API; + // BASE_API = data && data.domainName ? 'https://' + data.domainName : BASE_API; + BASE_API = data && data.domainName ? 'http://' + data.domainName : BASE_API; + VOICE_API = data && data.resourcesDomainName ? 'https://' + data.resourcesDomainName : 'https://joylink.club/oss/joylink'; + UPLOAD_API = 'http://joylink.club/jlfile'; + BASE_SITE = 'https://test.joylink.club/cbtc'; + } else if (process.env.NODE_ENV === 'test') { + BASE_API = data && data.domainName ? 'https://' + data.domainName : 'https://test.joylink.club/jlcloud'; + VOICE_API = data && data.resourcesDomainName ? 'https://' + data.resourcesDomainName : 'https://joylink.club/oss/joylink'; + UPLOAD_API = 'http://joylink.club/jlfile'; + BASE_SITE = 'https://test.joylink.club/cbtc'; + } else if (process.env.NODE_ENV === 'production' && process.env.VUE_APP_PRO === 'local') { + BASE_API = 'http://160.20.60.15:9000'; + VOICE_API = 'http://160.20.60.15/oss/joylink'; + UPLOAD_API = 'http://160.20.60.15'; + BASE_SITE = 'http://160.20.60.15'; + } else if (process.env.NODE_ENV === 'production' && process.env.VUE_APP_PRO === 'ntyl') { + BASE_API = 'https://joylink.club/jlcloud'; + VOICE_API = 'https://joylink.club/oss/joylink'; + UPLOAD_API = 'http://joylink.club/jlfile'; + BASE_SITE = 'https://joylink.club/cbtc'; + } else if (process.env.NODE_ENV === 'production') { + BASE_API = data && data.domainName ? 'https://' + data.domainName : 'https://joylink.club/jlcloud'; + VOICE_API = data && data.resourcesDomainName ? 'https://' + data.resourcesDomainName : 'https://joylink.club/oss/joylink'; + UPLOAD_API = 'http://joylink.club/jlfile'; + BASE_SITE = 'https://joylink.club/cbtc'; } - return BASE_API; + return {BASE_API, VOICE_API, UPLOAD_API, BASE_SITE}; } diff --git a/src/utils/indexedDb.js b/src/utils/indexedDb.js index 1fe60c2b9..ee9992d3f 100644 --- a/src/utils/indexedDb.js +++ b/src/utils/indexedDb.js @@ -1,9 +1,9 @@ import Vue from 'vue'; -import { getBaseUrl } from '@/utils/baseUrl'; +import store from '@/store/index'; // 创建或者打开数据库 export function openIndexedDB() { - const baseUrl = getBaseUrl(); + const baseUrl = store.state.user.baseUrl; const indexedDBName = baseUrl.replace(/http.?:\/\/(.*)[\/|:].*/, '$1'); const request = window.indexedDB.open(indexedDBName, 1); request.onerror = function (event) { diff --git a/src/utils/request.js b/src/utils/request.js index 2a5ad9f77..5673dd619 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -4,17 +4,17 @@ import qs from 'qs'; import { i18n } from '@/main.js'; import { MessageBox } from 'element-ui'; import { getToken } from '@/utils/auth'; -import { getBaseUrl } from '@/utils/baseUrl'; +import { handlerUrl } from '@/utils/baseUrl'; import { EventBus } from '@/scripts/event-bus'; import ConstConfig from '@/scripts/ConstConfig'; import Vue from 'vue'; import router from '../router/index'; -const BASE_API = getBaseUrl(); +const urlData = handlerUrl(); // 创建axios实例 const service = axios.create({ - baseURL: BASE_API, // api的base_url + baseURL: urlData.BASE_API, // api的base_url withCredentials: true, // 跨域请求时是否需要使用凭证 timeout: 600000 // 请求超时时间 }); diff --git a/src/utils/sock.js b/src/utils/sock.js index 16b000d8a..dc4347a03 100644 --- a/src/utils/sock.js +++ b/src/utils/sock.js @@ -1,16 +1,15 @@ import { getToken } from '@/utils/auth'; import { checkLoginLine } from '@/api/login'; -import { getBaseUrl } from '@/utils/baseUrl'; import { MessageBox } from 'element-ui'; import store from '@/store/index'; import Stomp from 'stompjs'; const isDev = process.env.NODE_ENV === 'development'; const isTest = process.env.NODE_ENV === 'test'; -const websocketUrl = `${getBaseUrl()}/joylink-websocket?token=`; const reconnectInterval = [1000, 3000, 5000, 10000, 30000, 60000]; var StompClient = function (headers) { + const websocketUrl = `${store.state.user.baseUrl}/joylink-websocket?token=`; this.url = websocketUrl + getToken(); this.headers = headers || {}; this.subscribeMap = new Map(); // 已订阅,对象{dest:'', handler:function, sub: Object} diff --git a/src/views/drts/scene/trainingResult.vue b/src/views/drts/scene/trainingResult.vue index 3351a9942..3405096df 100644 --- a/src/views/drts/scene/trainingResult.vue +++ b/src/views/drts/scene/trainingResult.vue @@ -95,7 +95,7 @@ export default { resultMap: {}, loading: false, audioPlayId: '', - baseUrl:process.env.VUE_APP_VOICE_API + baseUrl:this.$store.state.user.resourcesUrl }; }, watch: { diff --git a/src/views/drts/scene/voiceTraining.vue b/src/views/drts/scene/voiceTraining.vue index 2e1997c9b..d4cdff366 100644 --- a/src/views/drts/scene/voiceTraining.vue +++ b/src/views/drts/scene/voiceTraining.vue @@ -84,7 +84,7 @@ export default { recordSendingId: null, audioDataMap: {}, audioPlayId: '', - baseUrl:process.env.VUE_APP_VOICE_API + baseUrl:this.$store.state.user.resourcesUrl }; }, watch: { diff --git a/src/views/editor/index.vue b/src/views/editor/index.vue index a1e85ad1f..80ccd2b96 100644 --- a/src/views/editor/index.vue +++ b/src/views/editor/index.vue @@ -26,7 +26,7 @@ export default { }, // 接收父组件的方法 computed: { action() { - return `${process.env.VUE_APP_UPLOAD_API}${pictureUrl}`; + return `${this.$store.state.user.uploadUrl}${pictureUrl}`; }, draft() { return this.$route.query.draft; @@ -56,7 +56,7 @@ export default { }); uploadFile(action, that.formData).then(resp => { - const imgUrl = process.env.VUE_APP_VOICE_API + resp.data; + const imgUrl = this.$store.state.user.resourcesUrl + resp.data; insertImgFn(imgUrl); }).catch(error => { console.log(error); }); }; diff --git a/src/views/jlmap3d/drive/jl3ddrive.vue b/src/views/jlmap3d/drive/jl3ddrive.vue index d04b8cce9..efa228ca0 100644 --- a/src/views/jlmap3d/drive/jl3ddrive.vue +++ b/src/views/jlmap3d/drive/jl3ddrive.vue @@ -590,6 +590,7 @@ export default { }, updatetrainlist(){ getSimulationTrainlistNew(this.group).then(netdata => { + console.log(netdata); this.options = []; this.trainlist = netdata.data; for(let i=0;i + +
+
确认是否删除
+ + + 删除 + 取消 + + +
+ + + + + + + + diff --git a/src/views/jlmap3d/lesson3dedit/component/lessonsetup.vue b/src/views/jlmap3d/lesson3dedit/component/lessonsetup.vue index 1490f7c3c..f0de49810 100644 --- a/src/views/jlmap3d/lesson3dedit/component/lessonsetup.vue +++ b/src/views/jlmap3d/lesson3dedit/component/lessonsetup.vue @@ -71,9 +71,6 @@ } }, onSubmit() { - console.log(this.form.scene); - console.log(this.form.role); - console.log('submit!'); this.showSetup = false; this.$emit('lessonCreate', { name: this.form.name, type: this.form.type }); }, diff --git a/src/views/jlmap3d/lesson3dedit/lesson3dedit.vue b/src/views/jlmap3d/lesson3dedit/lesson3dedit.vue index 41ec6d6e9..920527ffd 100644 --- a/src/views/jlmap3d/lesson3dedit/lesson3dedit.vue +++ b/src/views/jlmap3d/lesson3dedit/lesson3dedit.vue @@ -302,6 +302,7 @@ saveData.setup.examMode = this.examMode; saveData.setup.checkedRole = this.checkedRole; + console.log(saveData); this.netData.data = JSON.stringify(saveData); // console.log(); updateLesson3dData(this.$route.query.lessonId,this.netData).then(data => { diff --git a/src/views/jlmap3d/lesson3dplayer/lesson3dplayer.vue b/src/views/jlmap3d/lesson3dplayer/lesson3dplayer.vue index 424071f86..2a3a79e42 100644 --- a/src/views/jlmap3d/lesson3dplayer/lesson3dplayer.vue +++ b/src/views/jlmap3d/lesson3dplayer/lesson3dplayer.vue @@ -144,7 +144,7 @@ import { JobPaneData } from '@/jlmap3d/lesson3d/toolsmodel/jobpanedata.js'; import { ZzwwTrain } from '@/jlmap3d/lesson3dedit/toolsmodel/zzwwtrain.js'; - import { getLesson3dData,updateLesson3dData } from '@/api/jmap/lesson3d'; + import { getLesson3dData,updateLesson3dData,getPublishLesson3dData} from '@/api/jmap/lesson3d'; import { JL3D_LOCAL_STATIC,BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js'; @@ -248,15 +248,77 @@ window.startLesson = this.startLesson; window.updataExamStatus = this.updataExamStatus; window.lessonEnd = this.lessonEnd; - this.init(this.$route.query.lessonId); + console.log(this.$route.query.lessonType); + if(this.$route.query.lessonType == "publish"){ + this.initPublish(this.$route.query.lessonId); + }else{ + this.initDraft(this.$route.query.lessonId); + } }, beforeDestroy() { }, methods: { - init(lessonId){ + initDraft(lessonId){ getLesson3dData(lessonId).then(data => { + console.log(data); + this.netData.name = data.data.name; + this.netData.type = data.data.type; + + let dom = document.getElementById('lesson3ddraw'); + + this.lessonData = new LessonData(); + this.jobPaneData = new JobPaneData(); + this.trainDeviceData = new ZzwwTrain(); + let loadData; + + + if(data.data.data){ + this.lessonMsg = { + lessonTittle:data.data.name, + userId:data.data.userId, + userJob:"", + }; + loadData = JSON.parse(data.data.data); + if(this.$route.query.examMode == 1){ + this.examMode = true; + }else{ + this.examMode = loadData.setup.examMode; + } + if(loadData.setup.checkedRole.length == 0){ + this.showSelectJob = false; + } + this.selectJobList = loadData.setup.checkedRole; + this.jobPaneData.dataList = loadData.toolJobPane; + this.$refs.jobpane.initJobList(this.jobPaneData.dataList); + this.lessonTools = loadData.lessonTools; + this.lessonData.loadLessonProgress(loadData.lessonProgress); + if(this.lessonTools[5]){ + loadData.trainDeviceData = this.trainDeviceData.deviceList; + }else{ + this.lessonTools[5] = { + name:"大铁车检组件", + type:"", + isShow:false, + }; + } + }else{ + + this.lessonData.initLessonProgress(); + this.$refs.jobpane.initJobList(this.jobPaneData.dataList); + this.jl3d.initNowRole(); + } + // console.log("loaddata----------------"); + // console.log(loadData); + // console.log(this.lessonMsg); + this.jl3d = new Lesson3dPlayer(dom,loadData,this.lessonPlayIndex); + }).catch(() => { + }); + }, + initPublish(lessonId){ + getPublishLesson3dData(lessonId).then(data => { + console.log(data); this.netData.name = data.data.name; this.netData.type = data.data.type; @@ -400,7 +462,7 @@ if(type == "jump"){ this.lessonPlayIndex = action.nextNode; } - + this.jl3d.changeIndex(this.lessonPlayIndex); }, actionEvent(type,action,mesh){ diff --git a/src/views/jlmap3d/lesson3dplayer/tools/explainpane.vue b/src/views/jlmap3d/lesson3dplayer/tools/explainpane.vue index b2556c520..2beddaa7a 100644 --- a/src/views/jlmap3d/lesson3dplayer/tools/explainpane.vue +++ b/src/views/jlmap3d/lesson3dplayer/tools/explainpane.vue @@ -1,6 +1,6 @@ @@ -106,22 +126,15 @@ export default { background-size:100%; } - .lesson3dSelectButton{ - position:absolute; - width: 20%; - height: 30%; - position:absolute; + + .display-draft { + /* z-index: 1000; */ + position: absolute; + width:100%; text-align: center; - font-size: 50px; - line-height:150px; - background-size: 100%; - background-repeat: no-repeat; - color:#FFF; - cursor:pointer; + bottom: 50px; } - - diff --git a/src/views/lesson/lesson3d.vue b/src/views/lesson/lesson3d.vue index 10c0a5084..855d85a6e 100644 --- a/src/views/lesson/lesson3d.vue +++ b/src/views/lesson/lesson3d.vue @@ -1,24 +1,40 @@