diff --git a/.gitignore b/.gitignore index 29bc8ac..889a9a6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,4 @@ *.iml .idea/ /.idea/ -/out/ -config.properties \ No newline at end of file +/out/ \ No newline at end of file diff --git a/src/main/java/com/lxyer/config/interceptor/LoginInterceptor.java b/src/main/java/com/lxyer/config/interceptor/LoginInterceptor.java index 0582472..2d4771b 100644 --- a/src/main/java/com/lxyer/config/interceptor/LoginInterceptor.java +++ b/src/main/java/com/lxyer/config/interceptor/LoginInterceptor.java @@ -24,7 +24,7 @@ public class LoginInterceptor implements Interceptor { if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With"))){ }else { - controller.render("/user/login.html"); + controller.redirect("/user/login"); } }else { inv.invoke(); diff --git a/src/main/webapp/res/mods/index.js b/src/main/webapp/res/mods/index.js index 07ee9bf..d2a6af7 100644 --- a/src/main/webapp/res/mods/index.js +++ b/src/main/webapp/res/mods/index.js @@ -72,10 +72,10 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'face'], f if(typeof res === 'string'){ res = JSON.parse(res); } - if(res.retcode === 0) { + if(res.code === 1) { success && success(res); } else { - layer.msg(res.retinfo || res.code, {shift: 6}); + layer.msg(res.msg || res.code, {shift: 6}); options.error && options.error(); } }, error: function(e){ diff --git a/src/main/webapp/res/mods/jie.js b/src/main/webapp/res/mods/jie.js index fd67a03..3fb668d 100644 --- a/src/main/webapp/res/mods/jie.js +++ b/src/main/webapp/res/mods/jie.js @@ -77,7 +77,7 @@ layui.define(['fly','laypage'], function(exports){ del: function(div){ layer.confirm('确认删除该求解么?', function(index){ layer.close(index); - fly.json('/os/content/set', { + fly.json('/content/set', { id: div.data('id') ,v: -1 ,field:"status" @@ -90,7 +90,7 @@ layui.define(['fly','laypage'], function(exports){ //设置置顶、状态 ,set: function(div){ var othis = $(this); - fly.json('/os/content/set', { + fly.json('/content/set', { id: div.data('id') ,v: othis.attr('v') ,field: othis.attr('field') @@ -102,7 +102,7 @@ layui.define(['fly','laypage'], function(exports){ //收藏 ,collect: function(div){ var othis = $(this), type = othis.data('type'); - fly.json('/os/content/collect', { + fly.json('/content/collect', { contentId: div.data('id') ,ok: type === 'add'? 1:-1 }, function(res){ @@ -231,13 +231,9 @@ layui.define(['fly','laypage'], function(exports){ form.on('submit(jie-add)', function(data){ var bean = {}; ["contentId","title", "content", "type"].forEach(function (value) { - bean[value] = data.field[value]; + bean["content."+value] = data.field[value]; }); - console.log(bean); - - fly.json("/os/content/save",{ - bean:JSON.stringify(bean) - },function (res) { + fly.json("/jie/save",bean,function (res) { layer.msg("发布成功",{time:2000},function () { location.href = "/"; }); @@ -251,7 +247,7 @@ layui.define(['fly','laypage'], function(exports){ }); console.log(bean); - fly.json("/os/comment/save",{ + fly.json("/comment/save",{ bean:JSON.stringify(bean) },function (res) { layer.msg("回复成功",{time:2000},function () {