<template>
  <div id="index1" class="indexClass" :style="mainStyle" prizeName="prizeName" v-lz-scroll>
    <component
      ref="dataRef"
      v-for="(value, key, index) in componentsData"
      :key="index"
      :is="value.config.name"
      :isTemplate="isTemplate"
      :styleData="value.config.styleData"
      :datas="value.config.defaultDatas"
      :keyData="value.config.keyData"
    ></component>
  </div>
</template>

<script>
import Vue from 'vue';
import dataJson from '../../src/data.json';
import activity1Json from '../json/activity1Version2.json'
import activity2Json from '../json/activity2.json'
import activity3_1Json from '../json/activity3-1.json'
import activity3_2Json from '../json/activity3-2.json'
import activity4Json from '../json/activity4.json'
import activity5Json from '../json/activity5.json'
import activity6_1Json from '../json/activity6-1.json'
import activity6_2Json from '../json/activity6-2.json'
import activity7Json from '../json/activity7.json'
import activity8Json from '../json/activity8.json'
import activity9Json from '../json/activity9.json'
import activity21Json from '../json/activity21.json'
import activity30Json from '../json/activity30.json';
import activity31Json from '../json/activity31.json';
import activity32Json from '../json/activity32.json';
import activity33Json from '../json/activity33.json';
import activity34Json from '../json/activity34.json';
import activity40Json from '../json/activity40.json';
import activity38Json from '../json/activity38.json';
import activity46Json from '../json/activity46.json';
import activity37Json from '../json/activity37.json';
import activity36Json from '../json/activity36.json';
import activity49Json from '../json/activity49.json';
import activity50Json from '../json/activity50.json';
import activity51Json from '../json/activity51.json';
import activity52Json from '../json/activity52.json';
import activity55Json from '../json/activity55.json';
import activity60Json from '../json/activity60.json';
import activity64Json from '../json/activity64.json';
import activity65Json from '../json/activity65.json';
import activity68Json from '../json/activity68.json';
import activity69Json from '../json/activity69.json';
import activity70Json from '../json/activity70.json';
import activity71Json from '../json/activity71.json';
import { getQueryObject } from '../util/tools';
import { callShare4MiniProgram } from '../util/share';
// import a from '../components/logicalComponent/basicCom/basicMain.vue'
import 'vant/lib/index.css';
import store from '../store/store';


export default {
  name: 'Index1',
  data() {
    return {
      isTemplate: false, //是否是B端的模板浏览
      mainStyle: {
        'padding-bottom': '40px',
        background: ' #fd1d25',
        'min-height': '100vh',
        width: '100%'
      }, //整个背景样式
      componentsData: {}
    };
  },

  // 父beforeCreated ->父created ->父beforeMounted ->子beforeCreated ->子created ->子beforeMounted ->子mounted -> 父mounted

  created() {
    this.activityType = sessionStorage.getItem('activityType');
    this.templateId = sessionStorage.getItem('templateId');
    if (this.activityType == 1 || this.activityType == 10001) {
      var comAllData = activity1Json
    }else if(this.activityType == 2 || this.activityType == 10002){
      var comAllData = activity2Json
    }else if(this.activityType == 3 || this.activityType == 10003){
      if (this.templateId == '20201228083300ljqdsl01') {
        var comAllData = activity3_1Json
      }else if (this.templateId == '20201228083300ljqdsl02') {
         var comAllData = activity3_2Json
      }
    }else if(this.activityType == 4 || this.activityType == 10004){
      var comAllData = activity4Json
    }else if(this.activityType == 5 || this.activityType == 10005){
     var comAllData = activity5Json
    }else if(this.activityType == 6 || this.activityType == 10006){
      if (this.templateId == '20201228083300yqrhyl01') {
        var comAllData = activity6_1Json
      }else if(this.templateId == '20201228083300yqrhyl02'){
       var comAllData = activity6_2Json
      }
    }else if(this.activityType == 7 || this.activityType == 10007){
      var comAllData = activity7Json
    }else if(this.activityType == 10008){
      var comAllData = activity8Json
    }else if(this.activityType == 10009){
      var comAllData = activity9Json
    }else if(this.activityType == 10015){
      var comAllData = activity15Json
    }else if(this.activityType == 10021){
      var comAllData = activity21Json
    }else if(this.activityType == 10030){
      var comAllData = activity30Json
    }else if(this.activityType == 10031){
      var comAllData = activity31Json
    }else if(this.activityType == 10032){
      var comAllData = activity32Json
    }else if(this.activityType == 10033){
      var comAllData = activity33Json
    }else if(this.activityType == 10034){
      var comAllData = activity34Json
    }else if(this.activityType == 10040){
      var comAllData = activity40Json
    }else if(this.activityType == 10038){
      var comAllData = activity38Json
    }else if(this.activityType == 10055){
      var comAllData = activity55Json
    }else if(this.activityType == 10046){
      var comAllData = activity46Json
    }else if(this.activityType == 10037){
      var comAllData = activity37Json
    }else if(this.activityType == 10036){
      var comAllData = activity36Json
    }else if(this.activityType == 10049){
      var comAllData = activity49Json
    }else if(this.activityType == 10050){
      var comAllData = activity50Json
    }else if(this.activityType == 10051){
      var comAllData = activity51Json
    }else if(this.activityType == 10052){
      var comAllData = activity52Json
    }else if(this.activityType == 10060){
      var comAllData = activity60Json
    }else if(this.activityType == 10064){
      var comAllData = activity64Json
    }else if(this.activityType == 10065){
      var comAllData = activity65Json
    }else if(this.activityType == 10068){
      var comAllData = activity68Json
    }else if(this.activityType == 10069){
      var comAllData = activity69Json
    }else if(this.activityType == 10070){
      var comAllData = activity70Json
    }else if(this.activityType == 10071){
      var comAllData = activity71Json
    }

    //动态注册组件
    comAllData.comMessage.forEach(app => {
       Vue.component(app.config.name, res => require([`../${app.config.path}`], res).default);
    });
    this.mainStyle = comAllData.activityMessage.mainStyle;
    this.componentsData = comAllData.comMessage
  },

  methods: {}
};
</script>

<style lang="scss">
.a {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba($color: #000000, $alpha: 0.7);
  top: 0;
  bottom: 0;
  z-index: 200;
}
</style>
