<!--  -->
<template>
  <div class="compara-content">
    <template v-if="wavblob">
      <div
        :class="type == 'full' ? 'compare-box-big' : 'compare-box'"
        v-if="!isR"
      >
        <AudioLine
          :mp3="url"
          :getCurTime="getCurTime"
          :ref="'audioLine' + index"
          :audioId="'artPraAudioId' + index"
          :stopAudio="stopAudio"
          :width="555"
          :hideSlider="true"
          :bg="bg"
          :ed="ed"
          @handleChangeStopAudio="handleChangeStopAudio"
          @sentPause="sentPause"
          @playChange="getPlayStatus"
          :type="type"
        />
      </div>
      <div :class="type == 'full' ? 'compare-box-big' : 'compare-box'" v-else>
        <audio-red
          v-if="sentIndex == index"
          :mp3="wavblob"
          :isCompare="true"
          :themeColor="themeColor"
          @sentPause="sentPause"
          @getPlayStatus="getPlayStatus"
          :type="type"
        />
      </div>
    </template>
    <template v-else>
      <img
        :src="
          type == 'full'
            ? require('../../../assets/NPC/compare-disable-24.png')
            : require('../../../assets/NPC/compare-disable.png')
        "
        :class="[
          'compare-disable',
          type == 'full' ? 'compare-disable-big' : '',
        ]"
      />
    </template>
  </div>
</template>

<script>
import AudioLine from "./AudioLine.vue";
import AudioRed from "./components/AudioRed.vue";
export default {
  components: {
    AudioLine,
    AudioRed,
  },
  props: [
    "isRecord",
    "wavblob",
    "url",
    "bg",
    "ed",
    "index",
    "sentIndex",
    "getCurTime",
    "sentPause",
    "stopAudio",
    "handleChangeStopAudio",
    "themeColor",
    "type",
    "getPlayStatus",
  ],
  data() {
    return {
      isR: false,
    };
  },
  computed: {},
  watch: {
    isRecord: {
      handler(newVal, oldVal) {
        if (this.sentIndex == this.index) {
          this.isR = newVal;
        }
      },
      deep: true,
    },
  },
  //方法集合
  methods: {},
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
};
</script>
<style lang='scss' scoped>
//@import url(); 引入公共css类
.compare-box {
  width: 16px;
  height: 16px;
  margin-left: 8px;
  &-big {
    width: 24px;
    height: 24px;
    margin-left: 0px;
  }
}
.compare-disable {
  width: 16px;
  height: 16px;
  display: block;
  margin-left: 8px;
  &-big {
    width: 24px;
    height: 24px;
    display: block;
    margin-left: 0px;
  }
}
</style>