Interaction.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div class="interaction" v-show="isShowDialog && current.info.leftInfo[0]">
  3. <SerialFrames
  4. :frame-total-num="72"
  5. :frame-interval="45"
  6. :image-src-func="getImg"
  7. :auto-play="true"
  8. :repeat="true"
  9. />
  10. <Transition>
  11. <div class="dialog">
  12. <p v-for="item in current.info.leftInfo" :key="item">{{ item || '暂无' }}</p>
  13. </div>
  14. </Transition>
  15. </div>
  16. </template>
  17. <script setup>
  18. import { computed, ref, watch } from "vue"
  19. const roleImg = utils.getImageUrl(`guide-role.png`)
  20. const props = defineProps({
  21. list: Array,
  22. currentTimeIdx: Number
  23. })
  24. const current = computed(() => props.list[props.currentTimeIdx])
  25. let timer = null
  26. const isShowDialog = ref(true)
  27. const getImg = (index) => {
  28. return utils.getImageUrl(`role/active/guide_${(index - 1).toString().padStart(5, '0')}.png`)
  29. }
  30. const handleShow = () => {
  31. if (timer) {
  32. clearTimeout(timer)
  33. timer = null
  34. }
  35. isShowDialog.value = true
  36. timer = setTimeout(() => {
  37. isShowDialog.value = false
  38. }, current.value.info.voiceDuration * 1000);
  39. }
  40. defineExpose({
  41. handleShow
  42. })
  43. watch(current, () => {
  44. handleShow()
  45. })
  46. </script>
  47. <style lang="scss" scoped>
  48. .interaction {
  49. position: absolute;
  50. bottom: 0;
  51. left: 3rem;
  52. display: flex;
  53. pointer-events: none;
  54. .dialog {
  55. max-width: 30rem;
  56. background-color: rgba(255, 244, 220, 0.6);
  57. backdrop-filter: blur(20px);
  58. box-shadow: inset 0px 1px 3px 0px #FFF3D1;
  59. margin-left: -5rem;
  60. color: #514C41;
  61. padding: 1rem;
  62. font-size: 0.88rem;
  63. pointer-events: none;
  64. align-self: flex-start;
  65. >p{
  66. line-height: 1.5;
  67. text-indent: 1.76rem;
  68. }
  69. &::before {
  70. content: '';
  71. clip-path: polygon(100% 0, 70% 100%, 100% 50%);
  72. display: inline-block;
  73. width: 4rem;
  74. height: 2rem;
  75. background-color: rgba(255, 244, 220, 0.6);
  76. backdrop-filter: blur(20px);
  77. position: absolute;
  78. right: 99.9%;
  79. z-index: -1;
  80. bottom: -1rem;
  81. }
  82. }
  83. }
  84. </style>