<template>
  <div class="display-detail">
    <NormalStyle
      v-if="displayDetail.themeType == '1'"
      :displayDetail="displayDetail"
      :dicts="dicts"
      @reload="loadDetail"
    />
    <ChStyle
      v-if="displayDetail.themeType == '2'"
      :displayDetail="displayDetail"
      :dicts="dicts"
      @reload="loadDetail"
    />
    <RedStyle
      v-if="displayDetail.themeType == '3'"
      :displayDetail="displayDetail"
      :dicts="dicts"
      @reload="loadDetail"
    />
  </div>
</template>

<script>
import NormalStyle from "./components/NormalStyle.vue";
import ChStyle from "./components/ChStyle.vue";
import RedStyle from "./components/RedStyle.vue";
import { getDisplayById } from "@/api/display";
import { mapGetters } from "vuex";
export default {
  components: {
    NormalStyle,
    ChStyle,
    RedStyle,
  },

  data() {
    return {
      displayDetail: {},
    };
  },
  computed: {
    ...mapGetters(["dicts"]),
  },
  async mounted() {
    await this.$store.dispatch("dict/getDictList", [
      "display_type",
      "display_character",
    ]);
    this.loadDetail();
  },

  methods: {
    async loadDetail() {
      let exhibitionId = this.$route.params.exhibitionId;
      if (exhibitionId) {
        let res = await getDisplayById({ exhibitionId });
        if (res.code == 0) {
          this.displayDetail = res.data;
        }
      }
    },
  },
};
</script>

<style lang="scss" scoped>
</style>