container.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <div class="canvas-layout">
  3. <div class="scene-canvas" ref="sceneLayoutRef" />
  4. </div>
  5. </template>
  6. <script setup lang="ts">
  7. import {onMounted, ref, watchEffect} from "vue";
  8. import {customMap, disabledMap, setupLaser, useLoading, useParams} from "@/hook";
  9. import {store} from "@/store";
  10. import {currentApp} from "@/store/app";
  11. import {axios} from "@/dbo/";
  12. import {Loading} from '@kankan/components/index'
  13. import {Mode} from "@/sdk";
  14. import {api} from "@/store/sync";
  15. const emit = defineEmits<{ (e: 'loaded'): void }>()
  16. const sceneLayoutRef = ref<HTMLCanvasElement>();
  17. onMounted(async () => {
  18. console.log(currentApp.basePath);
  19. console.log("加载场景数据")
  20. await useLoading(
  21. setupLaser({
  22. sceneSelector: sceneLayoutRef.value,
  23. num: useParams().m,
  24. store: store,
  25. isDebug: useParams().test,
  26. getFileUrl: api.getFile,
  27. webSite: "",
  28. axios: null,
  29. basePath: currentApp.basePath,
  30. })
  31. );
  32. console.log("场景数据加载完成")
  33. emit('loaded')
  34. setTimeout(() => {
  35. watchEffect(() => {
  36. const doms = Array.from(sceneLayoutRef.value.querySelectorAll("#navCube, #home")) as HTMLElement[]
  37. console.log("====>", disabledMap.mode)
  38. if (!disabledMap.mode) {
  39. if (customMap.mode === Mode.pano) {
  40. doms.forEach(dom => {
  41. dom.style.display = "none"
  42. })
  43. } else {
  44. doms.forEach(dom => {
  45. dom.style.display = "block"
  46. })
  47. }
  48. }
  49. })
  50. Loading.hideAll()
  51. }, 1000)
  52. });
  53. </script>
  54. <style scoped lang="scss">
  55. .canvas-layout {
  56. width : 100%;
  57. height : 100%;
  58. position: relative;
  59. z-index: 0;
  60. }
  61. .scene-canvas {
  62. width : 100%;
  63. height: 100%;
  64. }
  65. .dire-canvas {
  66. position: absolute;
  67. right: 0;
  68. top: 0;
  69. }
  70. </style>
  71. <style lang="scss">
  72. .canvas-layout {
  73. #navCube,
  74. #home {
  75. right: var(--boundMargin) !important;
  76. top: var(--boundMargin) !important;
  77. }
  78. #home {
  79. display: flex;
  80. align-items: center;
  81. justify-content: center;
  82. width: 20px !important;
  83. height: 20px !important;
  84. font-family: "iconfont" !important;
  85. font-size: 20px;
  86. color: #fff;
  87. font-style: normal;
  88. -webkit-font-smoothing: antialiased;
  89. background: none !important;
  90. z-index: 1;
  91. color: #fff;
  92. &:before {
  93. content: "\e73e";
  94. pointer-events: none;
  95. }
  96. }
  97. }
  98. </style>