diff --git a/src/main/java/com/we/controller/PhotographController.java b/src/main/java/com/we/controller/PhotographController.java index 36c4b6645f43fb7b3d2303149f32561e66bf907f..df4c62f414b7c6480357ee4b7a5fa04ba8a73d54 100644 --- a/src/main/java/com/we/controller/PhotographController.java +++ b/src/main/java/com/we/controller/PhotographController.java @@ -35,9 +35,9 @@ public class PhotographController { */ @RequestMapping("/photoUpload") @ResponseBody - public String fileUpload(@RequestParam("op") String op, @RequestParam("base64url") String base64url) { + public int fileUpload(@RequestParam("op") String op, @RequestParam("base64url") String base64url) { if (!"takePhoto".equals(op)) { - return "false"; + return -1; } BASE64Decoder decoder = new BASE64Decoder(); String baseurl = base64url.replace("data:image/png;base64,", ""); @@ -55,9 +55,9 @@ public class PhotographController { out.flush(); out.close(); - return "true"; + return 1; } catch (Exception e) { - return "false"; + return 0; } } diff --git a/src/main/resources/templates/photograph/photo.html b/src/main/resources/templates/photograph/photo.html index 80c0492f291482b563bf6a9ee85244679611a685..256222dc8e9cf0415bbfa1b38c9910c9bccc3ea6 100644 --- a/src/main/resources/templates/photograph/photo.html +++ b/src/main/resources/templates/photograph/photo.html @@ -136,14 +136,13 @@ var base64url = cas.toDataURL('image/png'); //转换为base64地址形式 base64url=base64url.replace("\r","") $.post("/photograph/photoUpload", {op:"takePhoto",base64url:base64url }, function(data) { - var result=parseInt($.trim(data.result)); - if(result==-1){ - $.messager.show({title:"温馨提示",msg:"输入的信息不完整,确认后重新提交。",timeout:3000,showType:'slide'}) - }else if(result>0){ - $.messager.show({title:"成功提示",msg:"头像更新成功",timeout:3000,showType:'slide'}) + if(data==-1){ + alert("输入的信息不完整,确认后重新提交"); + }else if(data>0){ + alert("头像更新成功"); //$('#attendance_info').css('color','green').text("已提交"); }else{ - $.messager.alert("失败提示","头像更新失败,请稍后重试...",'error') + alert("头像更新失败,请稍后重试..."); } }, "JSON"); //关闭裁剪框