提交 a6ce3467 编写于 作者: W wenguang

头像上传图片成功校验

上级 d5ed8531
......@@ -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;
}
}
......
......@@ -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");
//关闭裁剪框
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册