<template>
  <el-dialog
    v-model="dialogFormVisible"
    :title="title"
    width="500px"
    @close="close"
  >
    <div v-if="isText">
      <span>{{ data.textContent }}</span>
    </div>
    <div v-else-if="isImage" style="text-align: center">
      <img :src="data.image" alt="" style="width: 90%" />
    </div>
    <div v-else-if="isVideo" style="text-align: center">
      <video :src="data.video" style="width: 90%"></video>
    </div>
    <div v-else-if="isVoice" style="text-align: center">
      <audio :src="data.voice"></audio>
    </div>
    <div v-else-if="isNews" style="text-align: center">
      <p>{{ data.news }}</p>
    </div>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      isText: false,
      isImage: false,
      isVoice: false,
      isVideo: false,
      isNews: false,
      dialogFormVisible: false,
      data: [],
    };
  },
  methods: {
    showData(row) {
      this.dialogFormVisible = true;
      this.title = '回复内容';
      this.data = row;
      if (row.msgType == 'text') {
        this.isText = true;
      } else {
        if (row.materialType == 'image') {
          this.isImage = true;
        } else if (row.materialType == 'voice') {
          this.isVoice = true;
        } else if (row.materialType == 'video') {
          this.isVideo = true;
        } else if (row.materialType == 'news') {
          this.isNews = true;
        }
      }
    },
  },
};
</script>

<style scoped></style>
