<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">
      <BlueStyle
        v-if="displayDetail.themeType == '1'"
        :displayDetail="displayDetail"
        :dicts="dicts"
      />
      <ChStyle
      v-if="displayDetail.themeType == '2'"
      :displayDetail="displayDetail"
      :dicts="dicts"
    />
    <RedStyle
      v-if="displayDetail.themeType == '3'"
      :displayDetail="displayDetail"
      :dicts="dicts"
    />
      <div class="dialog-footer">
        <el-button type="primary" @click="handleClose">关闭</el-button>
      </div>
    </div>
  </el-dialog>
</template>

<script>
import BlueStyle from "./templates/BlueStyle.vue";
// import NormalStyle from "./components/NormalStyle.vue";
import ChStyle from "./templates/ChStyle.vue";
import RedStyle from "./templates/RedStyle.vue";
import NavBar from '@/components/NavBar';
import Footer from '@/components/Footer';
import { mapGetters } from "vuex";
export default {
  name: "PreviewDialog",
  components: {
    BlueStyle,
    ChStyle,
    RedStyle,
    NavBar,
    Footer
  },
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    displayDetail: {
      type: Object,
      default: () => ({}),
    },
  },

  computed: {
    ...mapGetters(["dicts"]),
    title() {
      return "预览——" + this.displayDetail.title;
    },
  },

  watch: {
    visible: {
      handler: function (value) {
        this.dialogVisible = value;
      },
      immediate: true,
      deep: true,
    },
  },
  data() {
    return {
      dialogVisible: false,
    };
  },
  async mounted() {
    await this.$store.dispatch("dict/getDictList", [
      "displayType",
      "displayCharacter",
    ]);
  },
  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>