sign.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <ui-group-option class="sign-guide">
  3. <div class="info">
  4. <div class="guide-cover">
  5. <span class="img"></span>
  6. <!-- @click="playSceneGuide(paths, undefined, true)" -->
  7. <ui-icon type="preview" class="icon" ctrl v-if="path.points.length" />
  8. </div>
  9. <div>
  10. <p>{{ path.name }}</p>
  11. </div>
  12. </div>
  13. <div class="actions" v-if="edit">
  14. <ui-more
  15. :options="menus"
  16. style="margin-left: 20px"
  17. @click="(action: keyof typeof actions) => actions[action]()"
  18. />
  19. </div>
  20. </ui-group-option>
  21. </template>
  22. <script setup lang="ts">
  23. import { Path } from "@/store";
  24. import { playSceneGuide } from "@/sdk";
  25. const props = withDefaults(defineProps<{ path: Path; edit?: boolean }>(), {
  26. edit: true,
  27. });
  28. const emit = defineEmits<{
  29. (e: "delete"): void;
  30. (e: "edit"): void;
  31. }>();
  32. const menus = [
  33. { label: "编辑", value: "edit" },
  34. { label: "删除", value: "delete" },
  35. ];
  36. const actions = {
  37. edit: () => emit("edit"),
  38. delete: () => emit("delete"),
  39. };
  40. </script>
  41. <style lang="scss" scoped>
  42. .sign-guide {
  43. display: flex;
  44. justify-content: space-between;
  45. align-items: center;
  46. padding: 20px 0;
  47. border-bottom: 1px solid var(--colors-border-color);
  48. &:first-child {
  49. border-top: 1px solid var(--colors-border-color);
  50. }
  51. .info {
  52. flex: 1;
  53. display: flex;
  54. align-items: center;
  55. .guide-cover {
  56. position: relative;
  57. &::after {
  58. content: "";
  59. position: absolute;
  60. inset: 0;
  61. background: rgba(0, 0, 0, 0.2);
  62. }
  63. .icon {
  64. position: absolute;
  65. z-index: 1;
  66. left: 50%;
  67. top: 50%;
  68. transform: translate(-50%, -50%);
  69. font-size: 16px;
  70. }
  71. .img {
  72. width: 48px;
  73. height: 48px;
  74. object-fit: cover;
  75. border-radius: 4px;
  76. overflow: hidden;
  77. background-color: rgba(255, 255, 255, 0.6);
  78. display: block;
  79. }
  80. }
  81. div {
  82. margin-left: 10px;
  83. p {
  84. color: #fff;
  85. font-size: 14px;
  86. margin-bottom: 6px;
  87. }
  88. }
  89. }
  90. .actions {
  91. flex: none;
  92. }
  93. }
  94. </style>