From f9375c0726ec7743df0506a1845a4e29bffccae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Csunzy=E2=80=9D?= <“sunzhenyu@joylink.club”> Date: Thu, 30 Dec 2021 17:19:59 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=89=E4=BD=8D?= =?UTF-8?q?=E6=B2=99=E7=9B=98=E9=A9=BE=E9=A9=B6=E4=BD=8D=E7=BD=AE=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=89=E4=BD=8D=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/jmap/lesson3d.js | 44 +- src/i18n/langs/en/lesson.js | 4 +- src/i18n/langs/en/tip.js | 2 + src/i18n/langs/zh/lesson.js | 3 +- src/i18n/langs/zh/tip.js | 2 + .../jl3ddrive/moveupdate/DrivingConnectNew.js | 583 +++++++++--------- .../jl3dmaintainer/maintainerconnect.js | 459 +++++++------- .../connect/Jlmap3dSubscribeNew.js | 474 +++++++------- src/jlmap3d/lesson3d/lesson3dplayer.js | 3 +- src/utils/baseUrl.js | 4 +- src/views/jlmap3d/drive/jl3ddrive.vue | 1 + .../jlmap3d/lesson3dplayer/lesson3dplayer.vue | 70 ++- .../jlmap3d/otherproject/xzexam/xzexam.vue | 79 ++- src/views/lesson/lesson3d.vue | 148 ++++- 14 files changed, 1090 insertions(+), 786 deletions(-) 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/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..2b7f04e5b 100644 --- a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js +++ b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js @@ -364,7 +364,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 +522,10 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri } } + }else{ + updateTrainModel.position.x = -100000; + } + } @@ -537,203 +541,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 +713,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/utils/baseUrl.js b/src/utils/baseUrl.js index 85ac2f3b5..87acde9d9 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -2,7 +2,7 @@ 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://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'; // 旭强 @@ -10,7 +10,7 @@ export function getBaseUrl() { // 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'; // 张赛 + // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 } else { BASE_API = process.env.VUE_APP_BASE_API; } 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 { + 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/otherproject/xzexam/xzexam.vue b/src/views/jlmap3d/otherproject/xzexam/xzexam.vue index 8c71b4529..5353a1373 100644 --- a/src/views/jlmap3d/otherproject/xzexam/xzexam.vue +++ b/src/views/jlmap3d/otherproject/xzexam/xzexam.vue @@ -6,11 +6,21 @@
城市轨道交通标准化培训软件 - + + + 课程模式选择: + +
+
-
+ +
@@ -42,6 +52,7 @@ diff --git a/src/views/lesson/lesson3d.vue b/src/views/lesson/lesson3d.vue index 10c0a5084..6b29ad614 100644 --- a/src/views/lesson/lesson3d.vue +++ b/src/views/lesson/lesson3d.vue @@ -1,12 +1,27 @@