<template>
  <div id="conSignIndex" class="indexClass" :style="mainStyle" prizeName="prizeName">
    <component
      ref="dataRef"
      v-for="(value, key, index) in componentsData"
      :key="index"
      :is="key"
      :isTemplate='isTemplate'
      :styleData="value.styleData"
      :datas="value.datas"
      :keyData="value.keyData"

    ></component>
  </div>
</template>

<script>
import Vue from 'vue';
import dataJson from '../../src/data.json';
import basicCom from '../components/logicalComponent/basicCom/basicMain.vue';
import rotalTable from '../components/logicalComponent/luckyDraw/rotaryTable.vue';
import signPrize from '../components/basisComponent/signPrize/signPrize.vue'; //签到我的奖品
import calendar from '../components/logicalComponent/calendar/calendar.vue'; //日历
import winnersRecord from '../components/logicalComponent/winnersRecord/winnersRecord.vue';
import recommendGood from '../components/logicalComponent/recommend/RecommendGood.vue'; //店长推荐
import { getQueryObject } from '../util/tools';

import 'vant/lib/index.css';
import { Toast, CountDown, Notify } from 'vant';
Vue.use(Toast, Notify, CountDown);

export default {
  name: 'ConSignIndex',
  components: {
    basicCom,
    signPrize,
    calendar,
    recommendGood,
    winnersRecord,
    rotalTable
  },
  data() {
    return {
       isTemplate:false,//是否是B端的模板浏览
      mainStyle: {
        'padding-bottom': '40px',
        background: ' #fd1d25',
        'min-height': '100vh',
        width: '100%'
      }, //整个背景样式
      componentsData: {
        basicCom: {
          isShow: true,
          styleData: {},
          datas: {},
          keyData: {}
        },
        signPrize: {
          isShow: true,
          styleData: {
            position: 'relative',
            signPrizeDiv: {
              color: '#fff',
              position: 'absolute',
              top: '2.10rem',
              right: '0'
            },
            imageSignStyle: {
              width: '0.48rem',
              height: '1.30rem'
            },
            imagePrizeStyle: {
              width: '0.48rem',
              height: '1.30rem'
            }
          },
          datas: {
            signIcon: '//img10.360buyimg.com/imgzone/jfs/t1/146927/5/18498/7791/5fd5ce6aEeebda4a8/f04dab40c50a5419.png',
            prizeIcon: '//img10.360buyimg.com/imgzone/jfs/t1/136363/39/19560/7683/5fd5ce6aE575b121c/a83dd0cc7c5f50d3.png'
          },
          keyData: {
            signPrizeStyle: 'signPrizeStyle',
            signIcon: 'signIcon',
            prizeIcon: 'prizeIcon',
            signPrizeDiv: 'signPrizeDiv',
            imageSignStyle: 'imageSignStyle',
            imagePrizeStyle: 'imagePrizeStyle'
          }
        },

        calendar: {
          isShow: true,
          styleData: {},
          datas: {
          },
          keyData: {
            restDrawCount: 'restDrawCount'
          }
        },

        winnersRecord: {
          isShow: true,
          styleData: {},
          datas: {},
          keyData: {
            userImg: 'userImg',
            nickName: 'nickName',
            prizeName: 'prizeName'
          }
        },

      }
    };
  },
  // 父beforeCreated ->父created ->父beforeMounted ->子beforeCreated ->子created ->子beforeMounted ->子mounted -> 父mounted

  mounted() {
    this.initAppData()
  },

  methods: {
    initAppData(){
      console.log('0000000000000000000000')
      let index = 0
      for(let i in this.componentsData){
        this.$refs.dataRef[index].initData()
        index = index + 1
      }
    },
    //签到结果
    callBackEmit(callBackEvent) {
      callBackEvent(this.componentsData,this.$refs.dataRef);
    }
  }
};
</script>

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