后端程序
@RequestMapping("{phone}")
public Result sendCode(@PathVariable String phone) throws BaseException {
//判断手机号是否符合格式
if (!phone.matches(Constants.RegConstant.PHONE_REGSTR)) {
throw new BaseException(ResultEnum.PHONE_ERROR);
}
userService.sendCode(phone);
return new Result(true, StatusCode.OK,"发送成功",null);
}
我在前端
this.postRequest("api/register/"+this.codeType,{"phone":this.phone,"codeType":this.codeType}).then(resp=>{
if(resp && resp.data.flag==true){
this.phone=resp.phone;
this.codeType=resp.code;
var path = this.$route.query.redirect;
this.$router.replace({path: path == '/' || path == undefined ? '/home' : path});
}else{
this.$message.error("手机号码或验证码错误");
}
});
该怎么获取phone和code