修改三维课程大铁组件

This commit is contained in:
sunzhenyu 2021-09-10 18:27:28 +08:00
parent 5714bae120
commit 25a9f51dab
9 changed files with 906 additions and 10 deletions

View File

@ -823,7 +823,6 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
// console.log(trainmodel.openleft);
// console.log(trainmodel.openright);
if(trainmodel.code == data.code){
console.log(data);
if(trainmodel.right == "0"){
if(data.doorCode == "2"){
@ -1008,6 +1007,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
}
function signalupdate(data) {
code = data.code;
console.log(data);
if(data.red == 1){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;

View File

@ -55,13 +55,16 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
let animateManager = new AnimateManager();
let controlManager = new ControlManager( dom,scene,lessonData,lessonIndex);
let assetModelManager = new AssetModelManager(scope,scene,controlManager);
assetModelManager.lessonAssetsLoader(lessonData).then((result) => {
scope.nowSceneType = lessonData.lessonProgress[0].progressScene;
animateManager.initAnimation(assetModelManager);
controlManager.init(animateManager.actions,assetModelManager);
controlManager.init(animateManager.actions,assetModelManager,lessonData.trainDeviceData);
startLesson();
animate();

View File

@ -13,6 +13,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
this.controls = {};
this.nowCamera = null;
this.eventHitMode = false;
let modelManager;
let nowRole = "";
let roleMode = false;
@ -25,6 +26,9 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
let eventTrigger;
let nowActions;
let trainDeviceMode = false;
let trainDeviceList = [];
let renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setClearColor(new THREE.Color(0x000000));
renderer.setViewport( 0, 0, dom.offsetWidth, dom.offsetHeight);
@ -227,9 +231,14 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
this.init = function(actions){
this.init = function(actions,assetModelManager,trainDeviceData){
// worldOctree.fromGraphNode( standstationPZ );
actionList = actions;
modelManager = assetModelManager;
if(trainDeviceData){
trainDeviceMode = true;
trainDeviceList = trainDeviceData;
}
}
this.updatePos = function(pos){
@ -262,6 +271,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
// console.log("mousedown-----------------------");
// console.log(raycasterBoxs);
// console.log(roleMode);
if(raycasterBoxs.length>0 && roleMode){
var mouse = new THREE.Vector2();
@ -302,6 +312,32 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
}
}
}
if(trainDeviceMode == true){
var mouse = new THREE.Vector2();
var raycaster = new THREE.Raycaster();
mouse.x = ( event.clientX / dom.offsetWidth ) * 2 - 1;
mouse.y = - ( event.clientY / dom.offsetHeight ) * 2 + 1;
raycaster.setFromCamera(mouse,scope.nowCamera);
var intersects = raycaster.intersectObject( modelManager.otherModel.children[1],true);
if(intersects.length>0){
for(let td=0;td<trainDeviceList.length;td++){
if(trainDeviceList[td].id == intersects[0].object.name){
trainDeviceList[td].color = "#fff";
trainDeviceList[td].value = "已检查";
}
}
}
}
} );

View File

@ -22,7 +22,6 @@ let delta;
let scene;
export function Lesson3dEditor(dom,lessonData) {
// let stats = new Stats();
// dom.appendChild( stats.dom );
let lessonIndex = 0;

View File

@ -0,0 +1,461 @@
export function ZzwwTrain() {
let scope = this;
this.deviceList = [
{
id:"ZLQ",
name:"止轮器",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"FD",
name:"风笛",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"SD",
name:"上灯",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"SDD",
name:"上大灯",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"XDD",
name:"下大灯",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"YGQ",
name:"雨X刮器",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"DFBL",
name:"挡风玻璃",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"BYC",
name:"百叶窗",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"DCFS",
name:"调车扶手",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"XTB",
name:"下踏板",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"CG",
name:"车钩",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"GS",
name:"钩舌",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"CG1",
name:"车钩",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZJSM",
name:"折角塞门",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZDGRG",
name:"制动管软管",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZDGRG1",
name:"制动管软管",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"FCD",
name:"防尘堵",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"AQL",
name:"安全链",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"AQL1",
name:"安全链",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"PZQ",
name:"排障器",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"PZQ1",
name:"排障器",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"PSQ",
name:"排石器",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"PSQ1",
name:"排石器1",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZJF",
name:"中继阀",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZYFG",
name:"作用风缸",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZDSM",
name:"制动塞门",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"",
name:"",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZDSM1",
name:"制动塞门",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"JCXHCGQ",
name:"信号传感器",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"TJ",
name:"托架",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"KYJ",
name:"空压机",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"KYJPD",
name:"空压机皮带",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"PDYL",
name:"皮带压轮",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZXTH",
name:"轴箱弹簧",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZXDG",
name:"轴箱端盖",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"YYJZQ",
name:"液压减震器",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"CLTM",
name:"车轮踏面",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"QYZ",
name:"牵引座",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"QYG",
name:"牵引杆",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"GB",
name:"拐臂",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"SDCGQ",
name:"速度传感器",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZDG",
name:"制动缸",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZW",
name:"闸瓦",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZWT",
name:"闸瓦托",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZWTZG",
name:"闸瓦调整杆",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"RYX",
name:"燃油箱",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"YW",
name:"油位",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"XDCX",
name:"蓄电池箱",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"RLZDJAZZ",
name:"人力制动机",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZFG",
name:"总风缸",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"XYQ",
name:"消音器",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"JCXHCGQ1",
name:"信号传感器",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"KLQ",
name:"空滤器",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"GWS",
name:"钩尾销",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"FDJ",
name:"发动机",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"CL",
name:"车轮",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"CZ",
name:"车轴",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"CDZ",
name:"传动轴",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"CZCLX",
name:"车轴齿轮箱",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"CZCLX1",
name:"车轴齿轮箱1",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"ZJHXX",
name:"中间换向箱",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"GDZ",
name:"固定轴",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"CC",
name:"车窗",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"CM",
name:"车门",
color:"#ff0000",
status:"",
value:"未检查",
},
{
id:"BPX",
name:"备品箱",
color:"#ff0000",
status:"",
value:"未检查",
}
];
}

View File

@ -54,6 +54,16 @@
v-show="lessonTools[3].isShow ">
</Job-Pane>
<TrainTest-Pane
:trainDeviceData='trainDeviceData'
:lessonData='lessonData'
:lessonEditIndex='lessonEditIndex'
ref="jobpane"
v-show="lessonTools[5].isShow ">
</TrainTest-Pane>
<Tool-Bar v-show="lessonTools[4].isShow "></Tool-Bar>
<div id="lesson3ddraw" class="lesson3ddraw">
@ -132,12 +142,13 @@
import ExplainPane from '@/views/jlmap3d/lesson3dedit/tools/explainpane';
import JobPane from '@/views/jlmap3d/lesson3dedit/tools/jobpane';
import ToolBar from '@/views/jlmap3d/lesson3dedit/tools/toolbar';
import TrainTestPane from '@/views/jlmap3d/lesson3dedit/tools/traintestpane';
import { Lesson3dEditor } from '@/jlmap3d/lesson3dedit/lesson3deditor.js';
import { LessonData } from '@/jlmap3d/lesson3dedit/model/lessondata.js';
import { JobPaneData } from '@/jlmap3d/lesson3dedit/toolsmodel/jobpanedata.js';
import { ZzwwTrain } from '@/jlmap3d/lesson3dedit/toolsmodel/zzwwtrain.js';
import { getLesson3dData,updateLesson3dData } from '@/api/jmap/lesson3d';
export default {
@ -152,7 +163,8 @@
ProcessLog,
ExplainPane,
JobPane,
ToolBar
ToolBar,
TrainTestPane
},
data() {
return {
@ -175,6 +187,7 @@
}
},
jobPaneData:{},
trainDeviceData:{},
lessonEditIndex:0,
lessonTools:[
{
@ -202,6 +215,11 @@
type:"",
isShow:false,
},
{
name:"大铁车检组件",
type:"",
isShow:false,
},
],
}
},
@ -232,7 +250,12 @@
this.lessonData = new LessonData();
this.jobPaneData = new JobPaneData();
this.trainDeviceData = new ZzwwTrain();
let loadData;
if(data.data.data){
loadData = JSON.parse(data.data.data);
@ -241,8 +264,12 @@
this.examMode = loadData.setup.examMode;
this.jobPaneData.dataList = loadData.toolJobPane;
this.$refs.jobpane.initJobList(this.jobPaneData.dataList);
this.lessonTools = loadData.lessonTools;
if(this.lessonTools[5].isShow){
loadData.trainDeviceData = this.trainDeviceData.deviceList;
}
this.lessonData.loadLessonProgress(loadData.lessonProgress);
}else{
this.lessonData.initLessonProgress();

View File

@ -0,0 +1,175 @@
<template>
<div class="traintestpaneover" :style="{'background-image': 'url('+lessonbg+')'}">
<div class="traintesttittle"> 待检查设备:</div>
<div class="addtraintestdivs" :style="{'color':item.color}" v-for="(item,index) in trainDeviceData.deviceList" @click="selsectTrainDevice(item)">
{{item.name}}:{{item.value}}
</div>
<!-- <div class="addtraintestdiv"
:style="{'background-image': 'url('+localstatic+'/lesson3d/addbutton.png)'}"
@click="addjob(index)"></div> -->
</div>
</template>
<script>
import Vue from 'vue';
import localStore from 'storejs';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
//
export default {
name: 'TrainTestPane',
props:['trainDeviceData','lessonData','lessonEditIndex'],
components: {
},
data() {
return {
localstatic:JL3D_LOCAL_STATIC,
jobList:[],
showJobList:false,
showJob:false,
selectedJob:null,
lessonbg:JL3D_LOCAL_STATIC+"/lesson3d/lessonbg.png",
lkgwbg:JL3D_LOCAL_STATIC+"/lesson3d/lkgw.png",
jobpic:JL3D_LOCAL_STATIC+"/lesson3d/jobpic.png",
}
},
computed: {
},
watch: {
},
mounted() {
// this.initJobList();
},
beforeDestroy() {
},
methods: {
openList(){
if(this.showJobList ==false){
this.showJobList = true;
// this.showJob = true;
}else{
this.showJobList = false;
this.selectedJob = null;
}
},
initJobList(data){
this.jobList = data;
},
selectJob(item){
this.selectedJob = item;
},
addjob(index){
this.selectedJob.controlList[index].data.push({
cname:this.generateUUID(),
text:"内容",
explainRole:"角色",
nextNode:"null",
sceneId:this.lessonData.lessonData.lessonProgress[this.lessonEditIndex].id,
type:"",
});
},
selsectTrainDevice(selectTool,jobList){
},
generateUUID() {
var d = new Date().getTime();
if (window.performance && typeof window.performance.now === "function") {
d += performance.now(); //use high-precision timer if available
}
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
},
},
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.traintestpaneover{
position: absolute;
width:300px;
height:350px;
overflow-y:auto;
overflow-x:hidden;
border:solid 2px #000;
color:#fff;
left:0;
bottom:0;
z-index:1;
}
.traintestdivtext{
// position: absolute;
bottom: 0;
font-size: 25px;
text-align: center;
}
.traintesttabmsg{
width:300px;
height:100px;
border:solid 2px #000;
// position: relative;
}
.traintesttabmsgtext{
width:200px;
height:90px;
// margin-top: 5px;
// margin-left: 2px;
border:solid 2px #000;
color:#fff;
position: absolute;
font-size: 25px;
right:10px;
top:10px;
}
.traintesttittle{
font-size: 30px;
color:#fff;
}
.addtraintestdivs{
width:98%;
margin: 1%;
border:solid 2px #000;
}
.statraintestdivs{
width:50%;
margin: 1%;
border:solid 2px #000;
}
.addtraintestdiv{
width:98%;
height:64px;
margin: 1%;
border:solid 2px #000;
background-repeat: no-repeat;
}
</style>

View File

@ -78,6 +78,14 @@
@changeCameraPos="changeCameraPos">
</Tool-Bar>
<TrainTest-Pane
:trainDeviceData='trainDeviceData'
:lessonData='lessonData'
:lessonPlayIndex='lessonPlayIndex'
ref="jobpane"
v-show="lessonTools[5].isShow ">
</TrainTest-Pane>
<Result-Tips
:examStatus='examStatus'
ref="rtui">
@ -136,12 +144,14 @@
import ExplainPane from '@/views/jlmap3d/lesson3dplayer/tools/explainpane';
import JobPane from '@/views/jlmap3d/lesson3dplayer/tools/jobpane';
import ToolBar from '@/views/jlmap3d/lesson3dplayer/tools/toolbar';
import TrainTestPane from '@/views/jlmap3d/lesson3dplayer/tools/traintestpane';
import { Lesson3dPlayer } from '@/jlmap3d/lesson3d/lesson3dplayer.js';
import { LessonData } from '@/jlmap3d/lesson3d/model/lessondata.js';
import { JobPaneData } from '@/jlmap3d/lesson3d/toolsmodel/jobpanedata.js';
import { ZzwwTrain } from '@/jlmap3d/lesson3dedit/toolsmodel/zzwwtrain.js';
import { getLesson3dData,updateLesson3dData } from '@/api/jmap/lesson3d';
@ -158,7 +168,8 @@
ExplainPane,
JobPane,
ToolBar,
ResultTips
ResultTips,
TrainTestPane
},
data() {
return {
@ -203,6 +214,7 @@
}
},
jobPaneData:{},
trainDeviceData:{},
lessonPlayIndex:0,
lessonTools:[
{
@ -225,6 +237,11 @@
name:"导航工具栏",
isShow:false,
},
{
name:"大铁车检组件",
type:"",
isShow:false,
},
],
}
},
@ -257,6 +274,7 @@
this.lessonData = new LessonData();
this.jobPaneData = new JobPaneData();
this.trainDeviceData = new ZzwwTrain();
let loadData;
@ -280,7 +298,9 @@
this.$refs.jobpane.initJobList(this.jobPaneData.dataList);
this.lessonTools = loadData.lessonTools;
this.lessonData.loadLessonProgress(loadData.lessonProgress);
if(this.lessonTools[5].isShow){
loadData.trainDeviceData = this.trainDeviceData.deviceList;
}
}else{
this.lessonData.initLessonProgress();

View File

@ -0,0 +1,175 @@
<template>
<div class="traintestpaneover" :style="{'background-image': 'url('+lessonbg+')'}">
<div class="traintesttittle"> 待检查设备:</div>
<div class="addtraintestdivs" :style="{'color':item.color}" v-for="(item,index) in trainDeviceData.deviceList" @click="selsectTrainDevice(item)">
{{item.name}}:{{item.value}}
</div>
<!-- <div class="addtraintestdiv"
:style="{'background-image': 'url('+localstatic+'/lesson3d/addbutton.png)'}"
@click="addjob(index)"></div> -->
</div>
</template>
<script>
import Vue from 'vue';
import localStore from 'storejs';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
//
export default {
name: 'TrainTestPane',
props:['trainDeviceData','lessonData','lessonPlayIndex'],
components: {
},
data() {
return {
localstatic:JL3D_LOCAL_STATIC,
jobList:[],
showJobList:false,
showJob:false,
selectedJob:null,
lessonbg:JL3D_LOCAL_STATIC+"/lesson3d/lessonbg.png",
lkgwbg:JL3D_LOCAL_STATIC+"/lesson3d/lkgw.png",
jobpic:JL3D_LOCAL_STATIC+"/lesson3d/jobpic.png",
}
},
computed: {
},
watch: {
},
mounted() {
// this.initJobList();
},
beforeDestroy() {
},
methods: {
openList(){
if(this.showJobList ==false){
this.showJobList = true;
// this.showJob = true;
}else{
this.showJobList = false;
this.selectedJob = null;
}
},
initJobList(data){
this.jobList = data;
},
selectJob(item){
this.selectedJob = item;
},
addjob(index){
this.selectedJob.controlList[index].data.push({
cname:this.generateUUID(),
text:"内容",
explainRole:"角色",
nextNode:"null",
sceneId:this.lessonData.lessonData.lessonProgress[this.lessonEditIndex].id,
type:"",
});
},
selsectTrainDevice(selectTool,jobList){
},
generateUUID() {
var d = new Date().getTime();
if (window.performance && typeof window.performance.now === "function") {
d += performance.now(); //use high-precision timer if available
}
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
},
},
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.traintestpaneover{
position: absolute;
width:300px;
height:350px;
overflow-y:auto;
overflow-x:hidden;
border:solid 2px #000;
color:#fff;
left:0;
bottom:0;
z-index:1;
}
.traintestdivtext{
// position: absolute;
bottom: 0;
font-size: 25px;
text-align: center;
}
.traintesttabmsg{
width:300px;
height:100px;
border:solid 2px #000;
// position: relative;
}
.traintesttabmsgtext{
width:200px;
height:90px;
// margin-top: 5px;
// margin-left: 2px;
border:solid 2px #000;
color:#fff;
position: absolute;
font-size: 25px;
right:10px;
top:10px;
}
.traintesttittle{
font-size: 30px;
color:#fff;
}
.addtraintestdivs{
width:98%;
margin: 1%;
border:solid 2px #000;
}
.statraintestdivs{
width:50%;
margin: 1%;
border:solid 2px #000;
}
.addtraintestdiv{
width:98%;
height:64px;
margin: 1%;
border:solid 2px #000;
background-repeat: no-repeat;
}
</style>