FloorSwitch.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <div
  3. class="floor-switch"
  4. :class="{ disable: flying, showTours: showTours }"
  5. v-if="floors.length > 1 && mode != 'panorama'"
  6. >
  7. <ul>
  8. {{
  9. floors
  10. }}
  11. <li
  12. v-if="mode != 'floorplan'"
  13. :class="{ active: 'all' == floorId }"
  14. @click.stop="onGotoFloor('all')"
  15. >
  16. <b></b><span>{{ $t("common.all") }}</span>
  17. </li>
  18. <li
  19. v-for="item in floors"
  20. :key="item.id"
  21. :class="{ active: item.id == floorId }"
  22. @click.stop="onGotoFloor(item.id)"
  23. >
  24. <b></b><span>{{ item.name }}</span>
  25. </li>
  26. </ul>
  27. </div>
  28. </template>
  29. <script setup>
  30. import { computed } from "vue";
  31. import { useStore } from "vuex";
  32. import { useApp } from "@/app";
  33. import { onMounted } from "vue";
  34. const store = useStore();
  35. const mode = computed(() => store.getters.mode);
  36. const flying = computed(() => store.getters["flying"]);
  37. const floors = computed(() => store.getters["scene/floors"]);
  38. const floorId = computed(() => store.getters.floorId);
  39. const showTours = computed(() => store.getters["tour/showTours"]);
  40. const onGotoFloor = (id) => {
  41. store.commit("setFloor", id);
  42. };
  43. onMounted(() => {
  44. useApp().then((sdk) =>
  45. sdk.Camera.on("mode.beforeChange", ({ toMode, floorIndex }) => {
  46. console.log("mode.beforeChange,", toMode, floorIndex);
  47. // store.commit("mode", toMode);
  48. if (toMode && toMode !== "dollhouse") {
  49. store.commit("setFloorId", floorIndex);
  50. }
  51. })
  52. );
  53. });
  54. </script>
  55. <style lang="scss" scoped>
  56. .floor-switch {
  57. pointer-events: all;
  58. position: absolute;
  59. bottom: calc(100% + 5px);
  60. left: 20px;
  61. z-index: 10;
  62. transition: bottom 0.1s;
  63. ul,
  64. li {
  65. padding: 0;
  66. margin: 0;
  67. }
  68. ul {
  69. position: relative;
  70. z-index: 2;
  71. }
  72. li {
  73. cursor: pointer;
  74. display: flex;
  75. align-items: center;
  76. position: relative;
  77. height: 50px;
  78. &:first-child {
  79. b {
  80. &::before {
  81. display: none;
  82. }
  83. }
  84. &.active {
  85. b {
  86. &::after {
  87. bottom: -10px;
  88. }
  89. }
  90. }
  91. }
  92. &:last-child {
  93. b {
  94. &::after {
  95. display: none;
  96. }
  97. }
  98. &.active {
  99. b {
  100. &::before {
  101. top: -10px;
  102. }
  103. }
  104. }
  105. }
  106. b {
  107. position: relative;
  108. width: 16px;
  109. height: 16px;
  110. background-color: #1c1c1c;
  111. border-radius: 50%;
  112. box-shadow: 0px 0px 2px 1px #404040;
  113. cursor: pointer;
  114. &::before {
  115. content: "";
  116. position: absolute;
  117. top: -5px;
  118. left: 50%;
  119. margin-left: -3px;
  120. background: #1c1c1c;
  121. width: 6px;
  122. height: 6px;
  123. }
  124. &::after {
  125. content: "";
  126. position: absolute;
  127. bottom: -5px;
  128. left: 50%;
  129. margin-left: -3px;
  130. background: #1c1c1c;
  131. width: 6px;
  132. height: 6px;
  133. }
  134. }
  135. span {
  136. margin-left: 10px;
  137. font-size: 14px;
  138. //color: #939393;
  139. cursor: pointer;
  140. color: #eeeeee;
  141. text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.5);
  142. }
  143. &.active {
  144. b {
  145. left: -6px;
  146. width: 28px;
  147. height: 28px;
  148. border: solid 6px #1c1c1c;
  149. background-color: #404040;
  150. box-shadow: 0px 0px 2px 1px #404040;
  151. &::before {
  152. top: -10px;
  153. }
  154. &::after {
  155. bottom: -10px;
  156. }
  157. }
  158. span {
  159. margin-left: 0;
  160. position: relative;
  161. display: flex;
  162. align-items: center;
  163. justify-content: center;
  164. height: 32px;
  165. color: rgba(255, 255, 255, 0.88);
  166. border: solid 4px #1c1c1c;
  167. background-color: #404040;
  168. border-radius: 32px;
  169. box-shadow: 0px 0px 2px 1px #404040;
  170. padding: 0px 10px;
  171. text-shadow: none;
  172. &::before {
  173. content: "";
  174. position: absolute;
  175. left: -10px;
  176. background: #1c1c1c;
  177. width: 7px;
  178. height: 4px;
  179. box-shadow: -2px 0px 2px 1px #404040;
  180. }
  181. &::after {
  182. content: "";
  183. position: absolute;
  184. left: -16px;
  185. background: #1c1c1c;
  186. width: 6px;
  187. height: 11px;
  188. border-radius: 50%;
  189. }
  190. }
  191. }
  192. }
  193. &::after {
  194. content: "";
  195. position: absolute;
  196. left: 5px;
  197. top: 20px;
  198. bottom: 20px;
  199. width: 6px;
  200. background: #1c1c1c;
  201. box-shadow: 0px 0px 2px 1px #404040;
  202. z-index: 1;
  203. }
  204. }
  205. [is-mobile] {
  206. .floor-switch {
  207. bottom: 2.5rem;
  208. &.showTours {
  209. bottom: 5rem;
  210. }
  211. li {
  212. height: 45px;
  213. &:first-child {
  214. &.active {
  215. b {
  216. &::after {
  217. bottom: -6px;
  218. }
  219. }
  220. }
  221. }
  222. &:last-child {
  223. &.active {
  224. b {
  225. &::before {
  226. top: -6px;
  227. }
  228. }
  229. }
  230. }
  231. b {
  232. width: 14px;
  233. height: 14px;
  234. &::before {
  235. top: -3px;
  236. left: 50%;
  237. margin-left: -2px;
  238. width: 4px;
  239. height: 4px;
  240. }
  241. &::after {
  242. bottom: -3px;
  243. left: 50%;
  244. margin-left: -2px;
  245. width: 4px;
  246. height: 4px;
  247. }
  248. }
  249. span {
  250. font-size: 0.36842rem;
  251. }
  252. &.active {
  253. b {
  254. left: -3px;
  255. width: 20px;
  256. height: 20px;
  257. border: solid 4px #1c1c1c;
  258. &::before {
  259. top: -6px;
  260. }
  261. &::after {
  262. bottom: -6px;
  263. }
  264. }
  265. span {
  266. height: 30px;
  267. border: solid 3px #1c1c1c;
  268. border-radius: 30px;
  269. padding: 0px 10px;
  270. margin-left: 5px;
  271. &::before {
  272. left: -11px;
  273. width: 10px;
  274. height: 4px;
  275. box-shadow: -2px 0px 1px 1px #404040;
  276. }
  277. &::after {
  278. left: -14px;
  279. width: 3px;
  280. height: 6px;
  281. border-radius: 40%;
  282. }
  283. }
  284. }
  285. }
  286. &::after {
  287. left: 5px;
  288. top: 20px;
  289. bottom: 20px;
  290. width: 4px;
  291. }
  292. }
  293. @media (orientation: landscape) {
  294. .floor-switch {
  295. bottom: 1rem;
  296. li {
  297. span {
  298. font-size: 0.25rem;
  299. }
  300. }
  301. }
  302. }
  303. }
  304. </style>