<template>
  <div class="mw-cpt a-fade-in"
       :ref="item.tempOnlyId"
       :title="item.componentName"
       :class="{'z-focused': isFocused}"
       @click="focusCpt">

    <!-- 党建声音-轮播图组件 -->
    <div class="voice_swiper"
         v-if="item.componentFrontId==='resi-topList-voice-hotNewsSwiper'">
      <div class="d-cpt-wrap">
        <div class="d-cpt-subwrap">
          <img v-if="item.demoData.pic"
               :src="item.demoData.pic">
          <img v-else
               src="@/assets/img/modules/wx-mini/index-set/page/swiper-bg.png">
          <!-- <div>
            <span>{{ item.demoData.title }}</span>
            <i></i>
            <i></i>
            <i></i>
            <i class="z-on"></i>
          </div> -->
        </div>
      </div>
    </div>

    <!-- 党建声音-最新发布 -->
    <div class="voice_news"
         v-else-if="item.componentFrontId==='resi-functionList-voice-newsList'">
      <div class="content">
        <div class="d-cpt-title">党建声音</div>
        <div class="list">
          <div class="item"
               :key="subindex"
               v-for="(subitem, subindex) in item.demoData.list">
            <div class="news_title">{{ subitem.title }}</div>
            <img v-if="subitem.pic"
                 :src="subitem.pic">
            <img v-else
                 src="@/assets/img/modules/wx-mini/index-set/page/news-pic2.png">
            <div class="news_grid">
              <img src="@/assets/img/modules/wx-mini/index-set/pavilion.png">
              <span>来源：{{ subitem.author }}</span>
              <span class="f-fr">{{ subitem.date }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 党建声音-特色文章组件 -->
    <div class="voice_news"
         v-else-if="item.componentFrontId==='resi-functionList-voice-newsList2'">
      <div class="content">
        <div class="d-cpt-title">党建声音</div>
        <div class="list">
          <div class="item"
               :key="subindex"
               v-for="(subitem, subindex) in item.demoData.list">
            <img v-if="subitem.pic"
                 :src="subitem.pic">
            <img v-else
                 src="@/assets/img/modules/wx-mini/index-set/page/news-pic.png">
            <div class="news_title">{{ subitem.title }}</div>
            <div class="news_grid">
              <img src="@/assets/img/modules/wx-mini/index-set/pavilion.png">
              <span>来源：{{ subitem.author }}</span>
              <span class="f-fr">{{ subitem.date }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>

  </div>
</template>

<script>

export default {
  name: 'cptItem',
  data () {
    return {}
  },
  components: {
  },
  props: {
    isFocused: Boolean,
    item: Object
  },
  methods: {

    focusCpt () {
      this.$emit('focusCpt', this.item)
    }
  }
}
</script>
<style lang="scss" src="@/assets/scss/modules/wx-mini/voice.scss"></style>
