邵佳豪 3 years ago
parent
commit
106874c6d2
  1. 2
      src/app/babylon/controller/mode-manager.ts
  2. 13
      src/app/pages/init3D.guard.ts
  3. 2
      src/app/pages/plan/plan.component.ts

2
src/app/babylon/controller/mode-manager.ts

@ -28,7 +28,7 @@ export class ModeManager {
/**
*
*/
public static isDebug = true;
public static isDebug = false;

13
src/app/pages/init3D.guard.ts

@ -10,12 +10,21 @@ import { NzMessageService } from 'ng-zorro-antd/message';
})
export class init3DGuard implements CanActivate {
constructor(private router: Router, private http: HttpClient, private message: NzMessageService,) { }
constructor(private router: Router, private http: HttpClient, private message: NzMessageService,) { }
// 路由守卫
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot,): Promise<boolean> {
return this.getGasStationBaseInfo().then((res: any) => {
sessionStorage.setItem("3dSceneData", JSON.stringify(res))
if (true) //是superadmin,是内部制作账号
{
ModeManager.s_isMakeMode = true;
}
else {
ModeManager.s_isMakeMode = true;
}
let isMakeMode = ModeManager.s_isMakeMode
if (isMakeMode || res.hasBuildingInfo) {
return true
@ -30,7 +39,7 @@ export class init3DGuard implements CanActivate {
getGasStationBaseInfo() {
return new Promise((resolve, reject) => {
let params = { organizationUnitId: (JSON.parse(sessionStorage.getItem('userdataOfgasstation'))).organization.id }
this.http.get('/api/services/app/GasStation/Get', { params: params }).subscribe((data: any)=>{
this.http.get('/api/services/app/GasStation/Get', { params: params }).subscribe((data: any) => {
resolve(data.result)
})
})

2
src/app/pages/plan/plan.component.ts

@ -63,6 +63,7 @@ export class PlanComponent implements OnInit {
ServeManager.Init(this.buildingBISrv, this.objectsSrv);
this.canvas = this.element.nativeElement.querySelector('#center') as HTMLCanvasElement;
this.game.init(this.canvas);
this.companyData = (JSON.parse(sessionStorage.getItem('userdataOfgasstation'))).organization || {}
let editMode = sessionStorage.getItem('isGasStation')
if (editMode == 'false') {
@ -72,6 +73,7 @@ export class PlanComponent implements OnInit {
this.editMode = false
ModeManager.currentMode = ModeType.Look
}
//监听 delete键盘事件
this.eventManager.addGlobalEventListener('window', 'keydown', (event: any) => {
if (event.keyCode == 46) { //delete

Loading…
Cancel
Save