index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. <Hot ref="quiskObj" v-if="current === 'tagging'" />
  16. <Monitor ref="quiskObj" v-if="current === 'monitor'" />
  17. </RightFillPano>
  18. <Teleport to=".laser-layer">
  19. <div class="quisks" v-if="!isEdit && !currentIsFullView">
  20. <div class="quisk-item fun-ctrl" @click="quiskAdd('tagging')">
  21. <ui-icon type="label" />
  22. <span>标签</span>
  23. </div>
  24. <!-- <div class="quisk-item fun-ctrl" @click="quiskAdd('monitor')">
  25. <ui-icon type="a-animation_s" />
  26. <span>监控</span>
  27. </div> -->
  28. </div>
  29. </Teleport>
  30. </template>
  31. <script lang="ts" setup>
  32. import { isEdit, monitors, taggings } from "@/store";
  33. import Hot from "./hot/index.vue";
  34. import Monitor from "./monitor/index.vue";
  35. import { RightFillPano } from "@/layout";
  36. import { nextTick, reactive, ref, watchEffect } from "vue";
  37. import { currentIsFullView } from "@/utils/full";
  38. const current = ref("tagging");
  39. const tabs = reactive([
  40. { key: "tagging", text: "标签()" },
  41. // { key: "monitor", text: "监控()" },
  42. ]);
  43. watchEffect(() => {
  44. tabs[0].text = `标签(${taggings.value.length})`;
  45. // tabs[1].text = `监控(${monitors.value.length})`;
  46. });
  47. const quiskObj = ref<any>();
  48. const quiskAdd = async (key: string) => {
  49. current.value = key;
  50. await nextTick();
  51. quiskObj.value.add();
  52. };
  53. </script>
  54. <style lang="scss" scoped>
  55. .tabs {
  56. height: 60px;
  57. border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  58. display: flex;
  59. margin: -20px;
  60. margin-bottom: 20px;
  61. > span {
  62. flex: 1;
  63. display: flex;
  64. align-items: center;
  65. justify-content: center;
  66. position: relative;
  67. transition: color 0.3s ease;
  68. cursor: pointer;
  69. max-width: 50%;
  70. font-size: 16px;
  71. &::after {
  72. content: "";
  73. transition: height 0.3s ease;
  74. position: absolute;
  75. background-color: #00c8af;
  76. left: 0;
  77. right: 0;
  78. bottom: 0;
  79. height: 0;
  80. }
  81. &:hover,
  82. &.active {
  83. color: #00c8af;
  84. }
  85. &.active::after {
  86. height: 3px;
  87. }
  88. }
  89. }
  90. .quisks {
  91. position: absolute;
  92. bottom: 20px;
  93. left: 50%;
  94. transform: translateX(-50%);
  95. display: flex;
  96. align-items: center;
  97. .quisk-item {
  98. width: 80px;
  99. height: 80px;
  100. border-radius: 10px;
  101. background: rgba(27, 27, 28, 0.8);
  102. color: #ffffff;
  103. display: flex;
  104. flex-direction: column;
  105. align-items: center;
  106. justify-content: center;
  107. &:not(:last-child) {
  108. margin-right: 20px;
  109. }
  110. span {
  111. margin-top: 6px;
  112. font-size: 14px;
  113. }
  114. .icon {
  115. font-size: 22px;
  116. }
  117. }
  118. }
  119. </style>