import {Device} from '../../base/Device';
import { WOW } from 'wowjs';
import {UAnimateContainer, UAnimate} from 'vue-wow';
/**
 * @author yeyuchao
 * @description menu
 */
export default {
  props:{
    headType:Number,
  },
  data() {
    return {
      headBlock:false,
      backgroundColor:"#FFFFFF",
      indexIcon:"",
      menuIcon:"",
      projectIcon:"",
      deviceMobile:false,
    };
  },
  mounted() {

  },
  components: {
    UAnimateContainer,
    UAnimate
  },
  created() {
    this.device = new Device();
    if(this.device.phone){
      this.deviceMobile = true;
    }
    if(this.headType === 0){
      if(this.deviceMobile){
        this.indexIcon="http://yun-image.elab-plus.com/images/index/1_objects@2x_2.png";
        this.menuIcon="https://dm.static.elab-plus.com/elabGuanWang/Menu-icon-Dark@2x.png";
        this.projectIcon="https://dm.static.elab-plus.com/elabGuanWang/Works-icon-Dark@2x.png";
      }else{
        this.indexIcon="http://yun-image.elab-plus.com/images/index/1_objects@2x_2.png";
        this.menuIcon="http://yun-image.elab-plus.com/images/index/1_objects@2x_3.png";
        this.projectIcon="http://yun-image.elab-plus.com/images/index/1_objects@2x_4.png";
      }
    }else if(this.headType === 3 || this.headType === 1 || this.headType === 4 || this.headType === 2 || this.headType === 5){
      if(this.headType !== 1 ){
        this.headBlock = true;
      }
      this.backgroundColor = "#2C2E34";
      if(this.deviceMobile){
        this.indexIcon="http://yun-image.elab-plus.com/images/contact/1_objects@2x_3.png";
        this.menuIcon="https://dm.static.elab-plus.com/elabGuanWang/Menu-icon-Light@2x.png";
        this.projectIcon="https://dm.static.elab-plus.com/elabGuanWang/Works-icon-Light@2x.png";
      }else {
        this.indexIcon="http://yun-image.elab-plus.com/images/contact/1_objects@2x_3.png";
        this.menuIcon="http://yun-image.elab-plus.com/images/contact/1_objects@2x_4.png";
        this.projectIcon="http://yun-image.elab-plus.com/images/contact/1_objects@2x_5.png";
      }
    }
    broadcast.$on('NewsIframeOpen',(val)=>{
      console.log("NewsIframeOpen:"+val.open);
      if(val.open){
        this.backgroundColor = "#FFFFFF";
        if(this.deviceMobile){
          this.indexIcon="http://yun-image.elab-plus.com/images/index/1_objects@2x_2.png";
          this.menuIcon="https://dm.static.elab-plus.com/elabGuanWang/Menu-icon-Dark@2x.png";
          this.projectIcon="https://dm.static.elab-plus.com/elabGuanWang/Works-icon-Dark@2x.png";
        }else{
          this.indexIcon="http://yun-image.elab-plus.com/images/index/1_objects@2x_2.png";
          this.menuIcon="http://yun-image.elab-plus.com/images/index/1_objects@2x_3.png";
          this.projectIcon="http://yun-image.elab-plus.com/images/index/1_objects@2x_4.png";
        }
      }else {
        this.backgroundColor = "#2C2E34";
        if(this.deviceMobile){
          this.indexIcon="http://yun-image.elab-plus.com/images/contact/1_objects@2x_3.png";
          this.menuIcon="https://dm.static.elab-plus.com/elabGuanWang/Menu-icon-Light@2x.png";
          this.projectIcon="https://dm.static.elab-plus.com/elabGuanWang/Works-icon-Light@2x.png";
        }else{
          this.indexIcon="http://yun-image.elab-plus.com/images/contact/1_objects@2x_3.png";
          this.menuIcon="http://yun-image.elab-plus.com/images/contact/1_objects@2x_4.png";
          this.projectIcon="http://yun-image.elab-plus.com/images/contact/1_objects@2x_5.png";
        }
      }
    })
  },
  methods:{
    getTarget() {
      return this.$el;
    },
    navigateToIndex(e){
      this.$router.push('/index');
    },
    navigateToProject(e){
      this.$router.push('/article');
    },
    navigateToOpenMenu(e){
      broadcast.$emit('menuClickEvent',"test");
    }
  }
};
