swkk.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <script src="//4dkk.4dage.com/v4/sdk/4.2.0/kankan-sdk-deps.js"></script>
  9. <script src="//4dkk.4dage.com/v4/sdk/4.2.0/kankan-sdk.js"></script>
  10. <style>
  11. * {
  12. margin: 0;
  13. padding: 0;
  14. box-sizing: border-box;
  15. }
  16. html,
  17. body {
  18. width: 100%;
  19. height: 100%;
  20. overflow: hidden;
  21. }
  22. .box {
  23. width: 100%;
  24. height: 100%;
  25. }
  26. [xui_min_map] {
  27. width: 150px !important;
  28. height: 150px !important;
  29. right: 0px;
  30. top: 70px;
  31. transition: right .5s;
  32. pointer-events: none !important;
  33. }
  34. .inco {
  35. transition: bottom 0.5s;
  36. position: absolute;
  37. bottom: 234px;
  38. right: 8px;
  39. width: 160px;
  40. height: 36px;
  41. background-color: rgba(0, 0, 0, .4);
  42. border-radius: 18px;
  43. z-index: 11;
  44. display: flex;
  45. justify-content: space-around;
  46. padding: 0 10px 0 15px;
  47. }
  48. .inco>div {
  49. cursor: pointer;
  50. width: 33%;
  51. height: 100%;
  52. display: flex;
  53. justify-content: center;
  54. align-items: center;
  55. background-size: 36px 36px;
  56. background-repeat: no-repeat;
  57. background-position: center;
  58. }
  59. .inco1 {
  60. background-image: url('./img/inco1Ac.png');
  61. width: 22% !important;
  62. }
  63. .inco2 {
  64. background-image: url('./img/inco2.png');
  65. }
  66. .inco3 {
  67. background-image: url('./img/inco3.png');
  68. }
  69. .loading {
  70. position: absolute;
  71. top: 0;
  72. left: 0;
  73. z-index: 12;
  74. width: 100%;
  75. height: 100%;
  76. background-color: black;
  77. display: flex;
  78. justify-content: center;
  79. align-items: center;
  80. }
  81. .loading .loadBox {
  82. color: #fff;
  83. text-align: center;
  84. letter-spacing: 2px;
  85. width: 110px;
  86. height: 110px;
  87. background: rgba(0, 0, 0, 0.5);
  88. border-radius: 2px;
  89. }
  90. .loadIcon {
  91. width: 60px;
  92. height: 60px;
  93. position: relative;
  94. overflow: hidden;
  95. margin: 10px auto;
  96. }
  97. .loadIcon img {
  98. height: 60px;
  99. position: absolute;
  100. left: 0;
  101. top: 0;
  102. animation: loading 1s steps(15) infinite;
  103. }
  104. @keyframes loading {
  105. 100% {
  106. left: -900px;
  107. }
  108. }
  109. .mapShow {
  110. transition: right .5s;
  111. position: absolute;
  112. top: 77px;
  113. right: 150px;
  114. background-color: rgba(0, 0, 0, .3);
  115. width: 20px;
  116. height: 30px;
  117. z-index: 10;
  118. border-radius: 8px 0px 0 8px;
  119. display: flex;
  120. justify-content: center;
  121. align-items: center;
  122. }
  123. .mapShow img {
  124. width: 16px;
  125. height: 16px;
  126. }
  127. .mapShow .up {
  128. display: none;
  129. }
  130. </style>
  131. </head>
  132. <body>
  133. <div class="loading">
  134. <div class="loadBox">
  135. <div class="loadIcon">
  136. <img src="./img/loading.png" alt="">
  137. </div>
  138. <div class="txt">加载中</div>
  139. </div>
  140. </div>
  141. <!-- 显示和隐藏小地图 -->
  142. <div class="mapShow">
  143. <img class="down" src="./img/down.svg" alt="">
  144. <img class="up" src="./img/up.svg" alt="">
  145. </div>
  146. <div class="box"></div>
  147. <div class="inco">
  148. <div class="inco1 active" title="全景漫游"></div>
  149. <div class="inco2" title="俯视图"></div>
  150. <div class="inco3" title="迷你模型"></div>
  151. </div>
  152. </body>
  153. <script>
  154. // 给vue页面调用收起
  155. var incoMove = function (val) {
  156. let dom = document.querySelector('.inco')
  157. if (val) dom.style.bottom = '24px'
  158. else dom.style.bottom = '234px'
  159. }
  160. // 获取地址栏信息
  161. let GetQueryString = (name) => {
  162. let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  163. let r = window.location.search.substr(1).match(reg);
  164. if (r != null) return unescape(r[2]);
  165. return "";
  166. }
  167. let num = GetQueryString('m')
  168. var kankan = new KanKan({
  169. dom: '.box',
  170. num
  171. })
  172. kankan.use('MinMap', {
  173. theme: {
  174. camera_fillStyle: "#C48871"
  175. }
  176. })
  177. kankan.render()
  178. kankan.Scene.on('loaded', () => {
  179. document.querySelector('.loading').style.display = 'none'
  180. //设置地面logo
  181. kankan.Scene.setFloorLogo({
  182. url: 'img/diBiao.png'
  183. })
  184. })
  185. let mapJT = document.querySelector('.mapShow')
  186. let doms = document.querySelectorAll('.inco div')
  187. kankan.Camera.on('mode.afterChange', ({
  188. fromMode,
  189. toMode,
  190. floorIndex
  191. }) => {
  192. if (toMode == 'panorama') {
  193. doms[0].classList.add('active')
  194. doms[1].classList.remove('active')
  195. doms[2].classList.remove('active')
  196. doms[0].style.backgroundImage = "url(./img/inco1Ac.png)"
  197. doms[1].style.backgroundImage = "url(./img/inco2.png)"
  198. doms[2].style.backgroundImage = "url(./img/inco3.png)"
  199. mapJT.style.display = 'flex'
  200. }
  201. })
  202. doms.forEach((v, i) => {
  203. v.onclick = function () {
  204. let className = v.getAttribute('class')
  205. if (className.includes('active')) return
  206. if (i == 0) {
  207. doms[0].classList.add('active')
  208. doms[1].classList.remove('active')
  209. doms[2].classList.remove('active')
  210. doms[0].style.backgroundImage = "url(./img/inco1Ac.png)"
  211. doms[1].style.backgroundImage = "url(./img/inco2.png)"
  212. doms[2].style.backgroundImage = "url(./img/inco3.png)"
  213. mapJT.style.display = 'flex'
  214. kankan.Camera.panorama()
  215. } else if (i == 1) {
  216. doms[0].classList.remove('active')
  217. doms[1].classList.add('active')
  218. doms[2].classList.remove('active')
  219. doms[0].style.backgroundImage = "url(./img/inco1.png)"
  220. doms[1].style.backgroundImage = "url(./img/inco2Ac.png)"
  221. doms[2].style.backgroundImage = "url(./img/inco3.png)"
  222. mapJT.style.display = 'none'
  223. kankan.Camera.floorplan()
  224. } else {
  225. doms[0].classList.remove('active')
  226. doms[1].classList.remove('active')
  227. doms[2].classList.add('active')
  228. doms[0].style.backgroundImage = "url(./img/inco1.png)"
  229. doms[1].style.backgroundImage = "url(./img/inco2.png)"
  230. doms[2].style.backgroundImage = "url(./img/inco3Ac.png)"
  231. mapJT.style.display = 'none'
  232. kankan.Camera.dollhouse()
  233. }
  234. }
  235. })
  236. let down = document.querySelector('.down')
  237. let up = document.querySelector('.up')
  238. down.onclick = () => {
  239. down.style.display = 'none'
  240. up.style.display = 'block'
  241. let mapDom = document.querySelector('.show')
  242. mapDom.style.right = '-150px'
  243. mapJT.style.right = 0
  244. }
  245. up.onclick = () => {
  246. down.style.display = 'block'
  247. up.style.display = 'none'
  248. let mapDom = document.querySelector('.show')
  249. mapDom.style.right = '0px'
  250. mapJT.style.right = '150px'
  251. }
  252. </script>
  253. </html>