sign.vue 2.2 KB

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