var app = new Vue({
    el:"#app",
    data:function(){
      return {
        d:{},
        name:"",
        mobile:"",
        zipCode:"",
        agentCompanyname:"",
        deledate:"2019年11月26号"
      }
  
    },
    created:function(){
      var that=this;
      console.log(window.location.search);
      var params =window.location.search.substr(1).match(new RegExp("(^|&)" + "params" + "=([^&]*)(&|$)", "i"));
      if(params){
        var data = params[2];
        data = decodeURIComponent(data);
        if(data){
          var d = data.split(";");
          if(d.length==11){
            d[6]=decodeURIComponent(d[6]);
            var o={type:d[0],applyName:d[1],identityCard:d[2],
              tmFormType:d[3],colorizedPicUrl:d[4],
              picUrl:d[5],applyAddr:d[6]};
            this.d=o;
            this.name=d[7];
            this.mobile=d[8];
            this.zipCode=d[9];
            this.agentCompanyname = d[10];
          }
          console.log(this.d);
          console.log(this.name);
          console.log(this.mobile);
          console.log(this.zipCode);
          console.log(this.agentCompanyname);
        }
      }
      this.deledate = this.getDate();
    },
    methods:{
      getDate(){
        var d = new Date();
        var year = d.getFullYear();
        var month = (d.getMonth() + 1) >=10? (d.getMonth() + 1) : "0" + (d.getMonth() + 1);
        var date = d.getDate() >=10 ? d.getDate() : "0" + d.getDate();
        var tempDate = year + "年" + month + "月" + date+"日";
        return tempDate;
      },
      postReq(path,data){
        return axios.post(path,data).then(function(r){
          return r.data?r.data:null;
        })
      },
      getReq(path, data) {
        var self = this;
        return new Promise(function(resv,reject){
          axios.get(path, { params: data, "headers": { "codepath": self.currentCodePath, "companyid": self.currentCompany ? self.currentCompany.id : "" } }).then(function (r) {
            if (r && r.data && r.data.status == -99) {
              self.$store.state.currentUser = null;
              self.hideMask();
              self.$message({
                type: 'error',
                message: '请检查权限.'
              });
                resv(null);
            } else {
              if (r.data && r.data.bizmsg && r.data.bizmsg != "empty") {
                self.$message({
                  message: r.data.bizmsg,
                  type: 'warning'
                });
              }
              if (r.data.status < 0) {
                self.$message({
                  type: 'error',
                  message: r.data.msg
                });
              }
                resv(r.data ? r.data : null);
            }
          }).catch(function(e){
            reject(e);
          });
        });

      },
  
    }
});
  