vue-axios

      axios({
        method: 'post',
        url: '/zhuang/token',
        data: get,
      }).then(function(data){
        ling=data.data.data.access_token;
        console.log(data);
        setTimeout(function(){
            console.log(ling);
            //发送注册请求
            let name=that.name
            let password=that.password

            let date={
                "registered_method": "mobile",
                "mobile": name,
                "password": password
            };
            axios({
                method: 'post',
                url: '/zhuang/users',
                data: date,
                headers: {Authorization:"Bearer "+ling}
              }).then(function(data){
                alert('注册成功,请登录');
                that.name='';
                that.password='';
              },function(){
                alert('注册失败')
              });
        },1000)
      })

  

posted @ 2017-08-04 18:18  fm060  阅读(143)  评论(0)    收藏  举报