var app = new Vue({
  el:"#app",
  data:function(){
    return {
      channelcode:"",
      code:"",
    }
  },
  created:function(){
    var channelcode=window.location.search.substr(1).match(new RegExp("(^|&)" + "channelcode" + "=([^&]*)(&|$)", "i"));
    if(channelcode!= null){
      this.channelcode=unescape(channelcode[2]);
    }
    this.findchannel();
    var code=window.location.search.substr(1).match(new RegExp("(^|&)" + "code" + "=([^&]*)(&|$)", "i"));
    if(code!= null){
      this.code=unescape(code[2]);
    }else{
      this.$message.warning("传递参数code错误");
    }

  },
  methods:{
    postReq(path,data){
      return axios.post(path,data).then(function(r){
        return r.data?r.data:null;
      })
    },
    need(){
      window.location.href="https://boss.gongsibao.com/needh5?"+"code="+this.code+"&channelcode="+this.channelcode
    },
    findchannel:function(){
      if(this.channelcode==""){
        this.$message.warning("传递参数channelcode错误");
        return false;
      }
      var params={
        channelcode:this.channelcode
      };
      var that=this;
      this.$root.postReq("/web/channelCtl/getChannelItem",params).then(function(d){
        console.log("---------------------dddd-----------");
        console.log(d);
        if(d.code==1){
          $("#needh5").text(d.data);
          $("#app").css("visibility","visible");
        }
        $("#app").css("visibility","visible");
    })
  },


  },

});
