<template>
  <el-dialog
    :visible.sync="dialogVisible"
    width="90%"
    style="height: 98%"
    :before-close="handleClose"
    top="5vh"
    lock-scroll
  >
    <div class="title" slot="title">
      <div class="divider"></div>
      <div class="label">{{ title }}</div>
    </div>
    <div class="dialog-content">
      <NormalStyle
        :displayDetail="displayDetail"
        v-if="displayDetail.themeType == '1'"
      />
      <div v-else-if="displayDetail.themeType == '2'">中国风主题</div>
      <div v-else-if="displayDetail.themeType == '3'">红色主题</div>
      <div class="dialog-footer">
        <el-button type="primary" @click="handleClose">关闭</el-button>
      </div>
    </div>
  </el-dialog>
</template>

<script>
import NormalStyle from "./templates/NormalStyle.vue";
import ChStyle from "./templates/ChStyle.vue";
export default {
  name: "PreviewDialog",
  components: {
    NormalStyle,
    ChStyle,
  },
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    displayDetail: {
      type: Object,
      default: () => ({}),
    },
  },
  computed: {
    title() {
      return "预览——" + this.displayDetail.title;
    },
  },
  watch: {
    visible: {
      handler: function (value) {
        this.dialogVisible = value;
      },
      immediate: true,
      deep: true,
    },
  },
  data() {
    return {
      dialogVisible: false,
    };
  },

  methods: {
    handleClose(done) {
      this.$emit("handleClose");
    },
  },
};
</script>

<style lang='scss' scoped>
.title {
  display: flex;
  margin-bottom: 16px;
  .divider {
    width: 8px;
    border-left: 4px solid #409eff;
    margin-right: 8px;
  }
  .label {
    font-weight: bold;
  }
}
.dialog-content {
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  .relate {
    flex: 1;
  }
  .dialog-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 40px;
  }
}

.video-container {
  background-color: #000;
  display: flex;
  justify-content: center;
}
.el-dialog__body {
  padding: 0 20px 30px 20px;
}
</style>