index.vue 3.3 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 && !custom.full">
  20. <div class="quisk-item fun-ctrl" @click="quiskAdd('guide')">
  21. <ui-icon type="a-guide_s" />
  22. <span>{{ $t("guide.guide.name") }}</span>
  23. </div>
  24. <div class="quisk-item fun-ctrl" @click="quiskAdd('animation')">
  25. <ui-icon type="a-animation_s" />
  26. <span>{{ $t("am.name1") }}</span>
  27. </div>
  28. <div class="quisk-item fun-ctrl" @click="quiskAdd('path')">
  29. <ui-icon type="a-path_s" />
  30. <span>{{ $t("path.name1") }}</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 { ui18n } from "@/lang";
  42. import router from "@/router";
  43. import { currentIsFullView } from "@/utils/full";
  44. import { custom } from "@/env";
  45. const current = ref("path");
  46. const tabs = reactive([
  47. { key: "path", text: ui18n.t("guide.pathName", { count: "0" }) },
  48. { key: "guide", text: ui18n.t("guide.guideName", { count: "0" }) },
  49. ]);
  50. watchEffect(() => {
  51. tabs[0].text = ui18n.t("guide.pathName", { count: paths.value.length });
  52. tabs[1].text = ui18n.t("guide.guideName", { count: guides.value.length });
  53. });
  54. const quiskObj = ref<any>();
  55. const quiskAdd = async (key: string) => {
  56. if (key === "animation") {
  57. router.push({ name: key });
  58. } else {
  59. current.value = key;
  60. await nextTick();
  61. quiskObj.value.add();
  62. }
  63. };
  64. </script>
  65. <style lang="scss" scoped>
  66. .tabs {
  67. height: 60px;
  68. border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  69. display: flex;
  70. margin: -20px;
  71. margin-bottom: 20px;
  72. > span {
  73. flex: 1;
  74. display: flex;
  75. align-items: center;
  76. justify-content: center;
  77. position: relative;
  78. transition: color 0.3s ease;
  79. cursor: pointer;
  80. font-size: 16px;
  81. &::after {
  82. content: "";
  83. transition: height 0.3s ease;
  84. position: absolute;
  85. background-color: #00c8af;
  86. left: 0;
  87. right: 0;
  88. bottom: 0;
  89. height: 0;
  90. }
  91. &:hover,
  92. &.active {
  93. color: #00c8af;
  94. }
  95. &.active::after {
  96. height: 3px;
  97. }
  98. }
  99. }
  100. .quisks {
  101. position: absolute;
  102. bottom: 20px;
  103. left: 50%;
  104. transform: translateX(-50%);
  105. display: flex;
  106. align-items: center;
  107. .quisk-item {
  108. width: 80px;
  109. height: 80px;
  110. border-radius: 10px;
  111. background: rgba(27, 27, 28, 0.8);
  112. color: #ffffff;
  113. display: flex;
  114. flex-direction: column;
  115. align-items: center;
  116. justify-content: center;
  117. &:not(:last-child) {
  118. margin-right: 20px;
  119. }
  120. span {
  121. margin-top: 6px;
  122. font-size: 14px;
  123. }
  124. .icon {
  125. font-size: 22px;
  126. }
  127. }
  128. }
  129. </style>