Merge remote-tracking branch 'origin/test'

# Conflicts:
#	.env.production
This commit is contained in:
joylink_fanyuhong 2022-01-05 17:58:55 +08:00
commit 5bf48a83f0
64 changed files with 1336 additions and 940 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -309,3 +309,10 @@ export function getUserDuration(params) {
params
});
}
/** 获取单位二维码 */
export function getCompanyQrCode(orgId) {
return request({
url: `/api/company/${orgId}/qrCode`,
method: 'get'
});
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -74,6 +74,8 @@ export default {
editCourse: '编辑课程',
createCourse: '创建课程',
courseRelease: '课程发布',
courseOnline: '课程上架',
courseOffline: '课程下架',
releaseAssociatedCity: '发布关联城市:',
releaseAssociatedMap: '发布关联地图:',
trainingSequence: '实训排序',
@ -124,4 +126,3 @@ export default {
copy: '复制',
prdType:'产品类型'
};

View File

@ -123,6 +123,8 @@ export default {
trainModelNameRepeat: '列车模型数据重复',
coursePublishSuccessful: '课程发布成功',
coursePublishFailed: '课程发布失败',
offlineSuccessful: '课程下架成功',
offlineFailed: '课程下架失败',
startOperationHint: '此操作将开始任务, 是否继续?',
cancelsTaskHint: '此操作将取消任务, 是否继续?',
automaticGenerationTrainingSuccess: '自动生成实训成功',

View File

@ -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<trainmodel.children.length; tl++) {
trainmodel.children[tl].position.z = point.z;
}
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<trainmodel.children.length; tl++) {
trainmodel.children[tl].position.z = point.z;
}
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.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<trainmodel.children.length; tl++) {
trainmodel.children[tl].position.z = point.z;
}
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();
}
}
}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<trainmodel.children.length; tl++) {
trainmodel.children[tl].position.z = point.z;
}
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.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.length;rs++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) + parseFloat(trainmodel.children[rs].position.z);
trainmodel.children[rs].position.z -= offsetz;
let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].position.y);
trainmodel.children[rs].position.y += offsety;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+10)>=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<trainmodel.children.length;rs++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
rotas.posr = pos;
// rotas.roty = trainmodel.children[0].rotation.y;
rotas.rotz = trainmodel.children[0].rotation.z;
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) + parseFloat(trainmodel.children[rs].position.z);
trainmodel.children[rs].position.z -= offsetz;
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;
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.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+10)>=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<trainmodel.children.length;rs++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
trainmodel.children[rs].position.z += offsetz;
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.length;rs++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
trainmodel.children[rs].position.z += offsetz;
let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].matrixWorld.elements[13]);
trainmodel.children[rs].position.y += offsety;
let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].matrixWorld.elements[13]);
trainmodel.children[rs].position.y += offsety;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-10)<=trainmodel.children[rs].rotalist[0].posr.x){
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-10)<=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);
if(rs != trainmodel.children.length-1){
let asd = trainmodel.children[rs].rotalist[0];
trainmodel.children[rs+1].rotalist.push(asd);
}
if(trainmodel.children[rs].rotalist[0].roty != null){
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty;
}
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
xh = trainmodel.children[rs].rotalist.length;
}
if(trainmodel.children[rs].rotalist[0].roty != null){
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty;
}
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz;
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.children[rs].rotalist.length);
}
}
}
}
}
// let pos = ;
}
function initall(data){
@ -1006,94 +1006,98 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
}
function signalupdate(data) {
code = data.code;
if(signallist.list[code]){
if(data.command == 'No'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 红 */
if(data.command == 'R'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 绿 */
if(data.command == 'G'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 黄 */
if(data.command == 'Y'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 月白 */
if(data.command == 'W'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 蓝 */
if(data.command == 'B'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 红黄 */
if(data.command == 'RY'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
if(data.command == 'No'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 红 */
if(data.command == 'R'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 绿 */
if(data.command == 'G'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 黄 */
if(data.command == 'Y'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 月白 */
if(data.command == 'W'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 蓝 */
if(data.command == 'B'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 红黄 */
if(data.command == 'RY'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
}
function initswitch(data) {
code = data.code;
if (data.command == 'NP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
actions[code].command = data.command;
} else if (data.command == 'RP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
actions[code].command = data.command;
if(actions[code]){
if (data.command == 'NP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
actions[code].command = data.command;
} else if (data.command == 'RP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
actions[code].command = data.command;
}
}
}
function switchupdate(data) {
code = data.code;
if (actions[code].command != data.command) {
if (actions[code].command != data.command && actions[code]) {
if (data.command == 'NP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();

View File

@ -20,9 +20,9 @@ import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import { sendCommandNew } from '@/api/jmap/training';
import store from '@/store/index';
var clock = new THREE.Clock();
@ -176,7 +176,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:'/user/queue/simulation/jl3d/'+group,
token:getToken(),
};

View File

@ -15,7 +15,7 @@ import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import store from '@/store/index';
import { getToken } from '@/utils/auth';
import { sendCommandNew } from '@/api/jmap/training';
@ -174,7 +174,7 @@ export function Jl3dOtherVR(dom,group,skinCode) {
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:'/user/queue/simulation/jl3d/'+group,
token:getToken(),
};

View File

@ -10,9 +10,9 @@ import { ModelManagerVR } from '@/jlmap3d/jl3dmaintainer/jl3dTrainRescue/trainre
import { VRButton } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/VRButton.js';
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import { sendCommandNew } from '@/api/jmap/training';
import store from '@/store/index';
var clock = new THREE.Clock();
@ -170,7 +170,7 @@ export function Jl3dTrainRescueVr(dom,group,skinCode) {
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:'/user/queue/simulation/jl3d/'+group,
token:getToken(),
};

View File

@ -2,8 +2,8 @@ import StompClient from '@/utils/sock';
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';
// 定于仿真socket接口
export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
@ -45,7 +45,7 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
let header = {'X-Token': getToken() };
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:this.topic,
token:getToken(),
};
@ -325,175 +325,96 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
function trainrunnew(data){
let code = data.code;
if(trainlisttest.list[code].right != data.right){
if(rails.sectionrail[data.section]){
if(trainlisttest.list[code].right != data.right){
if(data.right == "0"){
trainlisttest.list[code].right = "0";
trainlisttest.list[code].rotation.y = Math.PI;
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
trainlisttest.list[code].position.x = point.x;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = point.z;
}
}else{
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;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = point.z;
if(data.right == "0"){
trainlisttest.list[code].right = "0";
trainlisttest.list[code].rotation.y = Math.PI;
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
trainlisttest.list[code].position.x = point.x;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = point.z;
}
}else{
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;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = point.z;
}
}
}
}
// console.log(data);
// 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;
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<6; tl++) {
// trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
// }
// 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].lineleft;
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
// if(data.next){
// trainlisttest.list[code].nextcode = data.next;
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
// }
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '1';
// if(data.next){
// trainlisttest.list[code].nextcode = data.next;
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
// }
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '1';
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 = 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]);
trainlisttest.list[code].children[rs].position.z += offsetz;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=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.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=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<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=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)
xh--;
}else{
xh = trainlisttest.list[code].children[rs].rotalist.length;
}
}
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
}
}
// console.log(trainlisttest.list[code].rotalist);
}
}
}
}else{
trainlisttest.list[code].position.x = -100000;
}
}
function trainrun(data){
let code = data.code;
@ -871,95 +876,75 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
function signalupdate(data) {
code = data.code;
if(data.command == 'No'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
if(signallist.list[code]){
if(data.command == 'No'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 红 */
if(data.command == 'R'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 绿 */
if(data.command == 'G'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 黄 */
if(data.command == 'Y'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 月白 */
if(data.command == 'W'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 蓝 */
if(data.command == 'B'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 红黄 */
if(data.command == 'RY'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
}
/** 红 */
if(data.command == 'R'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 绿 */
if(data.command == 'G'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 黄 */
if(data.command == 'Y'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 月白 */
if(data.command == 'W'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 蓝 */
if(data.command == 'B'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
/** 红黄 */
if(data.command == 'RY'){
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
}
function initswitch(data) {
code = data.code;
if (data.command == 'NP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
actions[code].command = data.command;
} else if (data.command == 'RP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
actions[code].command = data.command;
}
}
function switchupdate(data) {
code = data.code;
if (actions[code].command != data.command) {
if(actions[code]){
if (data.command == 'NP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
@ -976,6 +961,32 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
actions[code].command = data.command;
}
}
}
function switchupdate(data) {
code = data.code;
if(actions[code]){
if (actions[code].command != data.command) {
if (data.command == 'NP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
actions[code].command = data.command;
} else if (data.command == 'RP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
actions[code].command = data.command;
}
}
}
}
function simulationreset(data){
for(let i=0;i<trainlisttest.group.children.length;i++){

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,8 +1,8 @@
import { AssetModel } from '@/jlmap3d/main/loaders/model/Assetmodel';
import { Assetmaterial } from '@/jlmap3d/main/loaders/model/Assetmaterial';
import { getBaseUrl } from '@/utils/baseUrl';
import store from '@/store/index';
import { Loading } from 'element-ui';
const BASE_API = getBaseUrl();
const BASE_API = store.state.user.baseUrl;
import { JL3D_LOCAL_STATIC,BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
let signal5 = {

View File

@ -1,6 +1,6 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import store from '@/store/index';
import { getToken } from '@/utils/auth';
// 定于仿真socket接口
@ -45,7 +45,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
let header = {'X-Token': getToken() };
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:this.topic,
token:getToken(),
};

View File

@ -2,7 +2,7 @@ import StompClient from '@/utils/sock';
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
import { getBaseUrl } from '@/utils/baseUrl'
import store from '@/store/index';
import { getToken } from '@/utils/auth';
// 定于仿真socket接口
@ -46,7 +46,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let header = {'X-Token': getToken() };
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:this.topic,
token:getToken(),
};
@ -165,256 +165,169 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
function trainRunNew(data){
let code = data.code;
if(trainlisttest.list[code].right != data.right){
if(data.right == "0"){
if(rails.sectionrail[data.section]){
if(trainlisttest.list[code].right != data.right){
if(data.right == "0"){
trainlisttest.list[code].right = "0";
trainlisttest.list[code].rotation.y = Math.PI;
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
trainlisttest.list[code].children[0].rotalist = [];
trainlisttest.list[code].right = "0";
trainlisttest.list[code].rotation.y = Math.PI;
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
trainlisttest.list[code].children[0].rotalist = [];
trainlisttest.list[code].children[0].position.z = parseFloat(-point.z);
trainlisttest.list[code].children[0].position.z = parseFloat(-point.z);
for (let tl=1; tl<trainlisttest.list[code].children.length; tl++) {
trainlisttest.list[code].children[tl].rotalist = [];
trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z;
}
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();
for (let tl=1; tl<trainlisttest.list[code].children.length; tl++) {
trainlisttest.list[code].children[tl].rotalist = [];
trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z;
}
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<trainlisttest.list[code].children.length; tl++) {
trainlisttest.list[code].children[tl].rotalist = [];
trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z;
}
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();
}
}
}
}
// 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<trainlisttest.list[code].children.length; tl++) {
// trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
// }
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
// if(data.next){
// trainlisttest.list[code].nextcode = data.next;
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
// }
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '1';
if(trainlisttest.list[code].children[0].position.z != point.z || trainlisttest.list[code].children[0].position.y != point.y){
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;
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
// trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
let rotas = {
posr:point,
roty:trainlisttest.list[code].children[0].rotation.y,
rotz:trainlisttest.list[code].children[0].rotation.z
}
trainlisttest.list[code].children[1].rotalist.push(rotas);
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
trainlisttest.list[code].children[0].position.z += offsetz;
let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
trainlisttest.list[code].children[0].position.y += offsety;
}
// 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<trainlisttest.list[code].children.length;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;
let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
trainlisttest.list[code].children[rs].position.y += offsety;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=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<trainlisttest.list[code].children.length; tl++) {
trainlisttest.list[code].children[tl].rotalist = [];
trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z;
}
} else if (data.right == '0') { // 向左
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();
}
}
}
}
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<trainlisttest.list[code].children.length; tl++) {
// trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
// }
// for (let tl=0; tl<trainlisttest.list[code].children.length; 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';
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
if(-trainlisttest.list[code].children[0].position.z != point.z || trainlisttest.list[code].children[0].position.y != point.y){
// if(data.next){
// trainlisttest.list[code].nextcode = data.next;
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
// }
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '1';
if(trainlisttest.list[code].children[0].position.z != point.z || trainlisttest.list[code].children[0].position.y != point.y){
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].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;
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0;
trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
// trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
let rotas = {
posr:point,
roty:trainlisttest.list[code].children[0].rotation.y,
rotz: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;
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
trainlisttest.list[code].children[0].position.z += offsetz;
let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
trainlisttest.list[code].children[0].position.y += offsety;
// 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<trainlisttest.list[code].children.length;rs++){
}
// 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<trainlisttest.list[code].children.length;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;
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;
let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
trainlisttest.list[code].children[rs].position.y += offsety;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=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<trainlisttest.list[code].children.length; 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].position.y != point.y){
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;
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0;
trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
let rotas = {
posr:point,
roty:trainlisttest.list[code].children[0].rotation.y,
rotz: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;
let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
trainlisttest.list[code].children[0].position.y += offsety;
// 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<trainlisttest.list[code].children.length;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;
let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
trainlisttest.list[code].children[rs].position.y += offsety;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=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].rotalist.splice(0,1)
xh--;
}else{
xh = trainlisttest.list[code].children[rs].rotalist.length;
}
}
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
}
}
// console.log(trainlisttest.list[code].rotalist);
// }
}
}
}else{
trainlisttest.list[code].position.x = -1000000;
}
}
function trainrun(data){
let code = data.code;
@ -868,26 +873,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
function initswitch(data) {
code = data.code;
if (data.command == 'NP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
actions[code].command = data.command;
} else if (data.command == 'RP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
actions[code].command = data.command;
}
}
function switchupdate(data) {
code = data.code;
if (actions[code].command != data.command) {
if(actions[code]){
if (data.command == 'NP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
@ -905,6 +891,30 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
}
}
}
function switchupdate(data) {
code = data.code;
if(actions[code]){
if (actions[code].command != data.command) {
if (data.command == 'NP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = 0;
actions[code].action.timeScale = 1;
actions[code].action.play();
actions[code].command = data.command;
} else if (data.command == 'RP') {
// sectionlist.switchs.modellist[j].normal = data.normal;
actions[code].action.reset();
actions[code].action.time = actions[code].action._clip.duration;
actions[code].action.timeScale = -1;
actions[code].action.play();
actions[code].command = data.command;
}
}
}
}
function simulationreset(data){
for(let i=0;i<trainlisttest.group.children.length;i++){
trainlisttest.group.children[i].dispose = true;

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,6 +1,5 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -29,7 +29,6 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
// let stats = new Stats();
// dom.appendChild( stats.dom );
let scope = this;
this.dom = dom;
this.nowSceneType = "";
@ -65,6 +64,8 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
let loadingInstance = Loading.service({ fullscreen: true });
let assetModelManager = new AssetModelManager(scope,scene,controlManager);
console.log(lessonData);
assetModelManager.lessonAssetsLoader(lessonData).then((result) => {
scope.nowSceneType = lessonData.lessonProgress[0].progressScene;
animateManager.initAnimation(assetModelManager);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 // 请求超时时间
});

View File

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

View File

@ -95,7 +95,7 @@ export default {
resultMap: {},
loading: false,
audioPlayId: '',
baseUrl:process.env.VUE_APP_VOICE_API
baseUrl:this.$store.state.user.resourcesUrl
};
},
watch: {

View File

@ -84,7 +84,7 @@ export default {
recordSendingId: null,
audioDataMap: {},
audioPlayId: '',
baseUrl:process.env.VUE_APP_VOICE_API
baseUrl:this.$store.state.user.resourcesUrl
};
},
watch: {

View File

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

View File

@ -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<netdata.data.length;i++){

View File

@ -0,0 +1,85 @@
<template>
<div id="" class="lessondeletediv" v-show="showDelete">
<div style="text-align:center;top:10%;font-size:30px">确认是否删除</div>
<el-form ref="form" >
<el-form-item style="text-align:center;margin-left: 0px;margin-top: 5%;" >
<el-button type="primary" @click="onSubmit">删除</el-button>
<el-button @click="unSubmit" >取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import Vue from 'vue';
import localStore from 'storejs';
export default {
name: 'LessonDelete',
components: {
},
data() {
return {
showDelete:false,
deleteId:'',
}
},
computed: {
},
watch: {
},
mounted() {
},
beforeDestroy() {
},
methods: {
deleteView(id){
if(this.showDelete == false){
this.showDelete = true;
this.deleteId = id;
}else{
this.showDelete = false;
}
},
onSubmit() {
this.showDelete = false;
this.$emit('lessonDelete',this.deleteId);
},
unSubmit(){
this.showDelete = false;
},
},
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.lessondeletediv {
position: absolute;
width: 20%;
height: 10%;
top:45%;
left:40%;
background-color: #fff;
border-radius: 18px;
border:solid 2px #000;
z-index: 5;
}
</style>

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<template>
<div class="explainpanediv"
v-if="lessonData.lessonData.lessonProgress[lessonPlayIndex]"
v-if="lessonData.lessonData.lessonProgress[lessonPlayIndex] && lessonData.lessonData.lessonProgress[lessonPlayIndex].explainPane.text != ''"
:style="{'background-image': 'url('+lessonbg+')'}">
<div class="explainpanetittle" >

View File

@ -2,7 +2,7 @@
<div class="stepstipsdiv"
v-if="lessonData.lessonData.lessonProgress[lessonPlayIndex]"
:style="{'background-image': 'url('+lessonbg+')'}">
<div class="stepstipstittle" >
<div class="stepstipstittle" v-if="lessonData.lessonData.lessonProgress[lessonPlayIndex].explainPane.text != ''">
当前情况
<!-- {{lessonData.lessonData.lessonProgress[lessonPlayIndex].stepTipsData.tittle}} -->
</div>

View File

@ -2,46 +2,56 @@
<div class="jl3dmap3dMaintainer">
<div class="jl3dmap3dMaintainerSelect" :style="{'background-color': '#e4eaea'}">
<div style="position:absolute;left:25%;top:10%;font-size:80px;">
<div style="position:absolute;width:50%;left:25%;top:10%;text-align:center;font-size:80px;">
<el-row>
城市轨道交通标准化培训软件
</el-row>
<el-row style="font-size:40px;">
课程模式选择:
<el-switch
v-model="examMode"
active-text="考试模式"
inactive-text="教学模式">
</el-switch>
</el-row>
</div>
<div style="width:40%;height:70%;position:absolute;left:30%;top:25%;font-size:30px">
<el-table
:data="lessonData"
style="width: 100%;"
highlight-current-row
max-height="700"
>
<el-table-column
label="课程名称"
prop="name">
</el-table-column>
<el-table-column
align="right">
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/ck.png)'}"
style="left:15%;top:25%;" @click=""></div>
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/hk.png)'}"
style="left:40%;top:25%;" @click=""></div>
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/jy.png)'}"
style="left:65%;top:25%;" @click="enterPlayer(32)"></div>
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/yx.png)'}"
style="left:15%;top:60%;" @click=""></div>
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/zf.png)'}"
style="left:40%;top:60%;" @click=""></div>
<div class="lesson3dSelectButton"
:style="{'background-image': 'url('+localStatic+'/other/xr51.png)'}"
style="left:65%;top:60%;" @click=""></div>
<template slot-scope="scope">
<el-button
size="mini"
@click="goDetail(scope.row)">进入课程</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="display-draft">
<el-button-group>
<el-button style="width:200px"type="primary" @click="quit">退出</el-button>
</el-button-group>
</div>
</div>
</div>
</template>
<script>
import { getSelectLesson3dList } from '@/api/jmap/lesson3d';
import { ProjectIcon } from '@/scripts/ProjectConfig';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import bgPsdImg from '@/assets/bg_psd.png';
@ -57,7 +67,14 @@ export default {
data() {
return {
localStatic:JL3D_LOCAL_STATIC,
examMode:false,
lessonType:'publish',
lessonData:[],
search: '',
};
},
beforeDestroy() {
@ -66,17 +83,20 @@ export default {
// document.querySelector("link[rel*='icon']").href = loginInfo[this.$route.query.project].linkIcon || ProjectIcon[this.$route.query.project];
},
mounted() {
getSelectLesson3dList().then(response => {
console.log(response);
this.lessonData = response.data;
}).catch(() => {
});
// console.log("");
},
methods: {
enterPlayer:function (id) {
// this.$router.push({ path: '/jlmap3d/lcjy', query: {} });
this.$router.push({ path: '/design/jlmap3d/lesson3dplayer', query: {lessonId:id} });
goDetail( row) {
this.$router.push({ path: '/design/jlmap3d/lesson3dplayer', query: {lessonId: row.id,lineCode: this.$route.query.lineCode,examMode:this.examMode,lessonType:this.lessonType} });
},
quit() {
history.go(-1);
},
}
};
</script>
@ -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;
}
</style>

View File

@ -1,24 +1,40 @@
<template>
<div class="joylink-card">
<div class="lesson-header">
<div class="lesson-list">草稿{{ $t('lesson.courseList') }}</div>
<div class="but-group">
<el-button size="mini" type="primary" @click="lessonSetupCreate">{{ $t('lesson.newConstruction') }}</el-button>
</div>
<div class="joylink-card">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="草稿数据管理" name="first">
<div class="but-group">
<el-button size="mini" type="primary" @click="lessonSetupCreate">{{ $t('lesson.newConstruction') }}</el-button>
</div>
<QueryListPage ref="queryListPageCourse" :card-padding="50" :query-form="queryFormCourse" :pager-config="pagerConfigCourse" :query-list="queryListCourse" style="width: 91%;margin-left:4%;margin-top:20px;" />
</el-tab-pane>
<el-tab-pane label="发布数据管理" name="second">
<QueryListPage ref="queryListPage" :card-padding="50" :query-form="queryFormPublish" :pager-config="pagerConfigPublish" :query-list="queryListPublish" style="width: 91%;margin-left:4%;margin-top:20px;" />
</el-tab-pane>
</el-tabs>
</div>
<QueryListPage ref="queryListPage" :card-padding="50" :query-form="queryForm" :pager-config="pagerConfig" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;" />
<publish-create ref="publishCreate" @refresh="refresh" />
<publish-lesson ref="publishLesson" @refresh="refresh" />
<lesson-detail ref="lessonDetail" />
<Lesson-Setup ref="lessonsetup" @lessonCreate="lessonCreate"></Lesson-Setup>
<Lesson-Delete ref="lessondelete" @lessonDelete="lessonDelete"></Lesson-Delete>
</div>
</template>
<script>
// import { releaseOrCancel } from '@/api/lesson3d';
import { getLesson3dDrftList,createLesson3d,updateLesson3dBasic,delLesson3d,publishLesson3d } from '@/api/jmap/lesson3d';
import { getLesson3dDrftList,createLesson3d,updateLesson3dBasic,delLesson3d,publishedLesson3d,publishLesson3d,onlineLesson3d,offlineLesson3d } from '@/api/jmap/lesson3d';
// import { delLesson } from '@/api/jmap/lesson3d';
@ -30,26 +46,37 @@ import ConstConfig from '@/scripts/ConstConfig';
import LessonSetup from '@/views/jlmap3d/lesson3dedit/component/lessonsetup';
import LessonDelete from '@/views/jlmap3d/lesson3dedit/component/lessondelete';
export default {
name: 'Lesson3d',
components: {
PublishCreate,
PublishLesson,
LessonDetail,
LessonSetup
LessonSetup,
LessonDelete
},
data() {
return {
loading: false,
pagerConfig: {
activeName: 'first',
pagerConfigCourse: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
pagerConfigPublish: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryFormCourse: {
show: false
},
queryList: {
query: this.queryFunction,
queryFormPublish: {
show: false
},
queryListCourse: {
query: this.queryFunctionCourse,
selectCheckShow: false,
indexShow: true,
columns: [
@ -84,14 +111,13 @@ export default {
}
},
{
name: this.$t('lesson.notRelease'),
name: this.$t('lesson.courseRelease'),
handleClick: this.release,
type: 'primary',
showControl: (row) => {
return row.status !== '1';
}
},
{
name: this.$t('global.delete'),
handleClick: this.deleteLesson,
@ -104,7 +130,56 @@ export default {
]
}
]
}
},
queryListPublish: {
query: this.queryFunctionPublish,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '三维课程名称',
prop: 'name'
},
{
title: '三维课程类型',
prop: 'type'
},
{
title: '创建人',
prop: 'userId'
},
{
title: '创建时间',
prop: 'createTime'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '400',
buttons: [
{
name: this.$t('lesson.courseOnline'),
handleClick: this.online,
type: 'primary',
showControl: (row) => {
return row.status !== '1';
}
},
{
name: this.$t('lesson.courseOffline'),
handleClick: this.offonline,
type: 'primary',
showControl: (row) => {
return row.status !== '1';
}
},
]
}
]
},
};
},
@ -128,9 +203,12 @@ export default {
mounted() {
},
methods: {
queryFunction(params) {
queryFunctionCourse(params) {
return getLesson3dDrftList(params);
},
queryFunctionPublish(params) {
return publishedLesson3d(params);
},
handlerStatus(row) {
let lessonStatus = '';
switch (row.status) {
@ -149,8 +227,11 @@ export default {
}
return lessonStatus;
},
handleClick(tab, event) {
// console.log(tab, event);
},
refresh() {
this.$refs.queryListPage.refresh(true);
this.$refs.queryListPageCourse.refresh(true);
},
lessonSetupCreate() {
this.$refs.lessonsetup.setupView();
@ -168,27 +249,56 @@ export default {
});
},
lessonDelete(deleteId){
delLesson3d(deleteId).then(response => {
this.$message.success(this.$t('tip.successfullyDelete'));
this.loading = true;
this.refresh();
this.loading = false;
}).catch(() => {
this.$messageBox(this.$t('tip.failDelete'));
});
},
publish(index, row) {
row.mapId = this.$route.params.mapId;
row.cityCode = this.$route.query.cityCode;
this.$refs.publishLesson.doShow(row);
},
deleteLesson(index, row) {
this.$refs.lessondelete.deleteView(row.id);
// console.log(row);
delLesson3d(row.id).then(response => {
this.$message.success(this.$t('tip.successfullyDelete'));
this.loading = true;
this.refresh();
this.loading = false;
}).catch(() => {
this.$messageBox(this.$t('tip.failDelete'));
});
},
release(){
release(index, row){
publishLesson3d(row.id).then(response => {
this.$message.success(this.$t('tip.coursePublishSuccessful'));
this.loading = true;
this.refresh();
this.loading = false;
}).catch(() => {
this.$messageBox(this.$t('tip.coursePublishFailed'));
});
},
online(index, row){
onlineLesson3d(row.id).then(response => {
this.$message.success(this.$t('tip.coursePublishSuccessful'));
this.loading = true;
this.refresh();
this.loading = false;
}).catch(() => {
this.$messageBox(this.$t('tip.coursePublishFailed'));
});
},
offonline(index, row){
offlineLesson3d(row.id).then(response => {
this.$message.success(this.$t('tip.offlineSuccessful'));
this.loading = true;
this.refresh();
this.loading = false;
}).catch(() => {
this.$messageBox(this.$t('tip.offlineFailed'));
});
},
goDetail(index, row) {
console.log(row);

View File

@ -204,7 +204,7 @@ export default {
},
avatarUrl(val) {
if (val && val.creatorAvatarPath) {
return process.env.VUE_APP_VOICE_API + val.creatorAvatarPath;
return this.$store.state.user.resourcesUrl + val.creatorAvatarPath;
} else {
return 'https://joylink.club/oss/wxmicro_assistant/userhead/defaultuser.png';
}

View File

@ -84,7 +84,7 @@ export default {
// yuyin:yuyin,
currentAudioIndex:0,
isPlay:false,
baseUrl:process.env.VUE_APP_VOICE_API
baseUrl: this.$store.state.user.resourcesUrl
};
},
watch:{

View File

@ -7,7 +7,7 @@
</template>
<script>
import { getCompanyListPaging, deleteCompany } from '@/api/company';
import { getCompanyListPaging, deleteCompany, getCompanyQrCode } from '@/api/company';
import EditCompany from './add';
import QrCode from '@/components/QrCode';
import { ProjectList } from '@/scripts/ProjectConfig';
@ -126,15 +126,20 @@ export default {
this.$router.push({ path: `/system/companyManage/orgDetail`, query: { orgId: row.id } });
},
handleGenerateQrCode(index, row) {
let state = 2;
if (process.env.NODE_ENV === 'production') {
state = 3;
}
const param = {
url: `https://joylink.club/oss/joylink/company?state=${state}_${row.id}`,
title: '单位二维码'
};
this.$refs.qrCode.doShow(param);
// let state = 2;
// if (process.env.NODE_ENV === 'production') {
// state = 3;
// }
getCompanyQrCode(row.id).then(resp => {
const param = {
url: resp.data,
title: '单位二维码'
};
this.$refs.qrCode.doShow(param);
}).catch(() => {
this.$message.error('获取单位二维码失败!');
});
}
}
};

View File

@ -94,7 +94,7 @@ export default {
return this.projectMap[getSessionStorage('project')];
},
projectList() {
return [{value: 'default', label: '默认'}, ...ProjectList];
return [{value: 'default', label: '默认'}, { value: 'test', label: '测试' }, ...ProjectList];
}
},
mounted() {

View File

@ -57,7 +57,7 @@ export default {
},
computed: {
action() {
return `${process.env.VUE_APP_UPLOAD_API}${meansUrl}`;
return `${this.$store.state.user.uploadUrl}${meansUrl}`;
},
form() {
const form = {

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js');
// import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js');
// import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js');
// import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js');
// import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js');
// import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js');
// import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';

View File

@ -1,6 +1,5 @@
// importScripts('sockjs.js');
// import { getToken } from '@/utils/auth';
// import { getBaseUrl } from '@/utils/baseUrl';
// import SockJS from 'sockjs-client';
// const websocketUrl = 'ws://test.joylink.club/jlcloud/joylink-websocket?token=';