am.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <Tabs v-model:activeKey="activeKey" width="100%">
  3. <TabPane key="setting" tab="设置">
  4. <ui-group borderBottom>
  5. <ui-group-option>
  6. <SignItem label="名称" not-apply>
  7. <ui-input
  8. width="100%"
  9. type="text"
  10. ref="nameInput"
  11. class="nameInput"
  12. placeholder="请输入名称"
  13. v-model="am.title"
  14. :maxlength="100"
  15. />
  16. </SignItem>
  17. </ui-group-option>
  18. <ui-group-option class="item">
  19. <span class="label">显示名称</span>
  20. <span class="oper"> <Switch v-model:checked="am.showTitle" /> </span>
  21. </ui-group-option>
  22. </ui-group>
  23. <ui-group borderBottom>
  24. <ui-group-option>
  25. <SignItem label="文字大小" @apply-global="$emit('applyGlobal', 'fontSize')">
  26. <Slider v-model:value="am.fontSize" :min="12" :max="60" :step="0.1" />
  27. </SignItem>
  28. </ui-group-option>
  29. </ui-group>
  30. <ui-group borderBottom>
  31. <ui-group-option>
  32. <SignItem
  33. label="可见范围"
  34. v-if="!am.globalVisibility"
  35. @apply-global="$emit('applyGlobal', 'globalVisibility')"
  36. >
  37. <Slider v-model:value="am.visibilityRange" :min="1" :max="1000" :step="0.1" />
  38. </SignItem>
  39. </ui-group-option>
  40. <ui-group-option>
  41. <ui-input
  42. type="checkbox"
  43. label="全部范围可视"
  44. :modelValue="!!am.globalVisibility"
  45. @update:modelValue="(v: boolean) => am.globalVisibility = v"
  46. />
  47. </ui-group-option>
  48. </ui-group>
  49. </TabPane>
  50. <TabPane key="animation" tab="动画">
  51. <ui-group borderBottom>
  52. <ui-group-option class="item">
  53. <span class="label">加帧</span>
  54. <span class="oper" @click="$emit('addFrame')">
  55. <ui-icon type="add" ctrl />
  56. </span>
  57. </ui-group-option>
  58. <ui-group-option class="item">
  59. <span class="label">路径</span>
  60. <span class="oper">
  61. <ui-icon @click="$emit('addPath')" type="add" ctrl />
  62. </span>
  63. </ui-group-option>
  64. <ui-group-option class="item">
  65. <span class="label">字幕</span>
  66. <span class="oper">
  67. <ui-icon @click="$emit('addSubtitle')" type="add" ctrl />
  68. </span>
  69. </ui-group-option>
  70. </ui-group>
  71. <ui-group borderBottom>
  72. <ui-group-option class="item">
  73. <span class="label">动作库</span>
  74. </ui-group-option>
  75. <ui-group-option class="actions">
  76. <div
  77. v-for="action in amActions"
  78. @click="$emit('addAction', { key: action.action, name: action.title })"
  79. >
  80. <img :src="action.url" />
  81. <span>{{ action.title }}</span>
  82. </div>
  83. </ui-group-option>
  84. </ui-group>
  85. </TabPane>
  86. </Tabs>
  87. </template>
  88. <script lang="ts" setup>
  89. import { Switch, Slider, TabPane, Tabs } from "ant-design-vue";
  90. import { AnimationModel } from "@/api";
  91. import SignItem from "@/views/tagging-position/sign-item.vue";
  92. import { ref } from "vue";
  93. import { amActions } from "@/store/animation";
  94. defineProps<{ am: AnimationModel }>();
  95. defineEmits<{
  96. (e: "addFrame" | "addPath" | "addSubtitle" | "addAction", preset?: any): void;
  97. (e: "applyGlobal", d: keyof AnimationModel): void;
  98. }>();
  99. const activeKey = ref("setting");
  100. </script>
  101. <style scoped lang="scss">
  102. .item {
  103. display: flex;
  104. align-items: center;
  105. justify-content: space-between;
  106. }
  107. .pin-position {
  108. position: absolute;
  109. left: 50%;
  110. transform: translate(-50%);
  111. width: 64px;
  112. height: 64px;
  113. background: rgba(27, 27, 28, 0.8);
  114. border-radius: 50%;
  115. bottom: 20px;
  116. z-index: 9;
  117. display: flex;
  118. align-items: center;
  119. justify-content: center;
  120. }
  121. .actions {
  122. display: flex;
  123. flex-wrap: wrap;
  124. div {
  125. width: calc((100% - 28px) / 3);
  126. background: #fff;
  127. margin-top: 7px;
  128. margin-bottom: 7px;
  129. height: 80px;
  130. cursor: pointer;
  131. position: relative;
  132. &::after {
  133. content: "";
  134. position: absolute;
  135. inset: 0;
  136. z-index: 1;
  137. background: rgba(0, 0, 0, 0.5);
  138. }
  139. span {
  140. position: absolute;
  141. z-index: 2;
  142. left: 50%;
  143. top: 50%;
  144. transform: translate(-50%, -50%);
  145. font-size: 16px;
  146. color: #fff;
  147. width: 100%;
  148. text-align: center;
  149. }
  150. &:nth-child(3n - 1) {
  151. margin-left: 14px;
  152. margin-right: 14px;
  153. }
  154. img {
  155. width: 100%;
  156. height: 100%;
  157. object-fit: cover;
  158. }
  159. }
  160. }
  161. </style>
  162. <style lang="scss">
  163. .animation-right .ui-editor-toolbox {
  164. padding-top: 0;
  165. .ant-tabs-tab {
  166. font-size: 16px;
  167. padding: 16px 10px;
  168. }
  169. }
  170. </style>