@RequestMapping(value = "/delBelowImg")
@Transactional
public R delBelowFile(@RequestParam Map params,HttpServletRequest request){
try {
belowFileService.delBelowFile(params);
} catch (Exception e) {
logger.error("删除失败",e);
logger.error(e.getMessage(),e);
throw new RRException(e.getMessage());
}
return R.ok();
}
普通ajax,可以直接通过data传参,后台接受,这样是没问题的
$.ajax({
type: "GET",
url: baseURL + "/upload/delBelowImg",
contentType: "application/json",
data: {
filePath: item.imgName,
id: vm.belowPurchase.id,
belowFileId: item.id
},
success: function(r) {
if (r.code === 0) {
layer.msg("操作成功");
that.swiper();
} else {
layer.msg(r.msg);
}
}
});
但vue如果也是用data传参,就不行了,因为vue在ajax的基础上又进行了封装,如果非要传data格式的数据,则需要后台将接受类型@RequestParam 改为 @RequestBody
或者在vue中将vue中的传参类型data改为params