FloorSwitch.vue 6.1 KB

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