<template>
  <div class="layout-col-detail right-list-panel-fieldset">
    <div v-if="isRoot">
      <publishPlatformSite-config ref="siteConfig" :platformID="platformId" :platform-name="platformName"></publishPlatformSite-config>
    </div>
    <div v-else>
      <catalogDefault-template ref="catalogConfig" :ID="ID" :platform-id="platformId" :type="type" :content-type="contentType" :parent-id="parentId"></catalogDefault-template>
    </div>
  </div>
</template>
<script>
import catalogDefaultTemplate from '../../contentcore/catalogDefaultTemplate.vue'
import publishPlatformSiteConfig from '../../contentcore/publishPlatformSiteConfig.vue'
export default {
  components: {
    'catalogDefault-template': catalogDefaultTemplate,
    'publishPlatformSite-config': publishPlatformSiteConfig
  },
  props: {
    ID: {
      type: String,
      requried: false
    }
  },
  data() {
    return {
      platformId: 'pc',
      platformName: '',
      type: 'Default',
      contentType: 'Article',
      isRoot: false,
      parentId: 0
    }
  },
  mounted() {
    this.platformId = this.$route.query.platformId ? this.$route.query.platformId : 'pc'
    this.platformName = this.$route.query.platformName
    this.type = this.$route.query.type ? this.$route.query.type : 'Default'
    this.contentType = this.$route.query.contentType ? this.$route.query.contentType : 'Article'
    this.parentId = this.$route.query.parentId ? parseInt(this.$route.query.parentId) : 0
    if (String(this.ID) === '0' || !this.ID) {
      this.isRoot = true
      this.$nextTick(() => {
        this.$refs.siteConfig.init(this.platformId)
      })
    } else {
      this.$refs.catalogConfig.loadTemplateList(this.platformId)
    }
  }
}
</script>
<style>
</style>
