index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <RightFillPano>
  3. <template #header>
  4. <div class="tabs" :class="{ disabled: isEdit }">
  5. <span
  6. v-for="tab in tabs"
  7. :key="tab.key"
  8. :class="{ active: tab.key === current }"
  9. @click="current = tab.key"
  10. >
  11. {{ tab.text }}
  12. </span>
  13. </div>
  14. </template>
  15. <GuideEdit v-if="current === 'guide'" ref="quiskObj" />
  16. <PathEdit v-if="current === 'path'" ref="quiskObj" />
  17. </RightFillPano>
  18. <Teleport to=".laser-layer">
  19. <div class="quisks" v-if="!isEdit && !currentIsFullView">
  20. <div class="quisk-item fun-ctrl" @click="quiskAdd('guide')">
  21. <ui-icon type="a-guide_s" />
  22. <span>导览</span>
  23. </div>
  24. <div class="quisk-item fun-ctrl" @click="quiskAdd('animation')">
  25. <ui-icon type="a-animation_s" />
  26. <span>动画</span>
  27. </div>
  28. <div class="quisk-item fun-ctrl" @click="quiskAdd('path')">
  29. <ui-icon type="a-path_s" />
  30. <span>路线</span>
  31. </div>
  32. </div>
  33. </Teleport>
  34. </template>
  35. <script lang="ts" setup>
  36. import { RightFillPano } from "@/layout";
  37. import GuideEdit from "./guide/edit.vue";
  38. import PathEdit from "./path/edit.vue";
  39. import { nextTick, reactive, ref, watchEffect } from "vue";
  40. import { guides, isEdit, paths } from "@/store";
  41. import router from "@/router";
  42. import { currentIsFullView } from "@/utils/full";
  43. import { SDK, sdk as _sdk } from "@/sdk";
  44. const current = ref("path");
  45. const tabs = reactive([
  46. { key: "path", text: "路线()" },
  47. { key: "guide", text: "导览()" },
  48. ]);
  49. watchEffect(() => {
  50. tabs[1].text = `导览(${guides.value.length})`;
  51. tabs[0].text = `路线(${paths.value.length})`;
  52. });
  53. const quiskObj = ref<any>();
  54. const quiskAdd = async (key: string) => {
  55. if (key === "animation") {
  56. router.push({ name: key });
  57. } else {
  58. current.value = key;
  59. await nextTick();
  60. quiskObj.value.add();
  61. }
  62. };
  63. </script>
  64. <style lang="scss" scoped>
  65. .tabs {
  66. height: 60px;
  67. border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  68. display: flex;
  69. margin: -20px;
  70. margin-bottom: 20px;
  71. > span {
  72. flex: 1;
  73. display: flex;
  74. align-items: center;
  75. justify-content: center;
  76. position: relative;
  77. transition: color 0.3s ease;
  78. cursor: pointer;
  79. font-size: 16px;
  80. &::after {
  81. content: "";
  82. transition: height 0.3s ease;
  83. position: absolute;
  84. background-color: #00c8af;
  85. left: 0;
  86. right: 0;
  87. bottom: 0;
  88. height: 0;
  89. }
  90. &:hover,
  91. &.active {
  92. color: #00c8af;
  93. }
  94. &.active::after {
  95. height: 3px;
  96. }
  97. }
  98. }
  99. .quisks {
  100. position: absolute;
  101. bottom: 20px;
  102. left: 50%;
  103. transform: translateX(-50%);
  104. display: flex;
  105. align-items: center;
  106. .quisk-item {
  107. width: 80px;
  108. height: 80px;
  109. border-radius: 10px;
  110. background: rgba(27, 27, 28, 0.8);
  111. color: #ffffff;
  112. display: flex;
  113. flex-direction: column;
  114. align-items: center;
  115. justify-content: center;
  116. &:not(:last-child) {
  117. margin-right: 20px;
  118. }
  119. span {
  120. margin-top: 6px;
  121. font-size: 14px;
  122. }
  123. .icon {
  124. font-size: 22px;
  125. }
  126. }
  127. }
  128. </style>