AudioCompare.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <!-- -->
  2. <template>
  3. <div class="compara-content">
  4. <template v-if="wavblob">
  5. <div
  6. :class="type == 'full' ? 'compare-box-big' : 'compare-box'"
  7. v-if="!isR"
  8. >
  9. <AudioLine
  10. :mp3="url"
  11. :getCurTime="getCurTime"
  12. :ref="'audioLine' + index"
  13. :audioId="'artPraAudioId' + index"
  14. :stopAudio="stopAudio"
  15. :width="555"
  16. :hideSlider="true"
  17. :bg="bg"
  18. :ed="ed"
  19. @handleChangeStopAudio="handleChangeStopAudio"
  20. @sentPause="sentPause"
  21. @playChange="getPlayStatus"
  22. :type="type"
  23. />
  24. </div>
  25. <div :class="type == 'full' ? 'compare-box-big' : 'compare-box'" v-else>
  26. <audio-red
  27. v-if="sentIndex == index"
  28. :mp3="wavblob"
  29. :isCompare="true"
  30. :themeColor="themeColor"
  31. @sentPause="sentPause"
  32. @getPlayStatus="getPlayStatus"
  33. :type="type"
  34. />
  35. </div>
  36. </template>
  37. <template v-else>
  38. <img
  39. :src="
  40. type == 'full'
  41. ? require('../../../assets/NPC/compare-disable-24.png')
  42. : require('../../../assets/NPC/compare-disable.png')
  43. "
  44. :class="[
  45. 'compare-disable',
  46. type == 'full' ? 'compare-disable-big' : '',
  47. ]"
  48. />
  49. </template>
  50. </div>
  51. </template>
  52. <script>
  53. import AudioLine from "./AudioLine.vue";
  54. import AudioRed from "./components/AudioRed.vue";
  55. export default {
  56. components: {
  57. AudioLine,
  58. AudioRed,
  59. },
  60. props: [
  61. "isRecord",
  62. "wavblob",
  63. "url",
  64. "bg",
  65. "ed",
  66. "index",
  67. "sentIndex",
  68. "getCurTime",
  69. "sentPause",
  70. "stopAudio",
  71. "handleChangeStopAudio",
  72. "themeColor",
  73. "type",
  74. "getPlayStatus",
  75. ],
  76. data() {
  77. return {
  78. isR: false,
  79. };
  80. },
  81. computed: {},
  82. watch: {
  83. isRecord: {
  84. handler(newVal, oldVal) {
  85. if (this.sentIndex == this.index) {
  86. this.isR = newVal;
  87. }
  88. },
  89. deep: true,
  90. },
  91. },
  92. //方法集合
  93. methods: {},
  94. //生命周期 - 创建完成(可以访问当前this实例)
  95. created() {},
  96. //生命周期 - 挂载完成(可以访问DOM元素)
  97. mounted() {},
  98. beforeCreate() {}, //生命周期 - 创建之前
  99. beforeMount() {}, //生命周期 - 挂载之前
  100. beforeUpdate() {}, //生命周期 - 更新之前
  101. updated() {}, //生命周期 - 更新之后
  102. beforeDestroy() {}, //生命周期 - 销毁之前
  103. destroyed() {}, //生命周期 - 销毁完成
  104. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  105. };
  106. </script>
  107. <style lang='scss' scoped>
  108. //@import url(); 引入公共css类
  109. .compare-box {
  110. width: 16px;
  111. height: 16px;
  112. margin-left: 8px;
  113. &-big {
  114. width: 24px;
  115. height: 24px;
  116. margin-left: 0px;
  117. }
  118. }
  119. .compare-disable {
  120. width: 16px;
  121. height: 16px;
  122. display: block;
  123. margin-left: 8px;
  124. &-big {
  125. width: 24px;
  126. height: 24px;
  127. display: block;
  128. margin-left: 0px;
  129. }
  130. }
  131. </style>