From b50a0496477d010428314bd42653c44fa63a85c8 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 22 May 2018 22:46:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=85=A8=E5=B1=80ajax?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/user/service/UserServiceImpl.java | 1 - src/main/resources/static/ruoyi/js/common.js | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java b/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java index d9a73810..d8fdd4d6 100644 --- a/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java @@ -5,7 +5,6 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.framework.shiro.service.PasswordService; diff --git a/src/main/resources/static/ruoyi/js/common.js b/src/main/resources/static/ruoyi/js/common.js index ee27e835..0ae96093 100644 --- a/src/main/resources/static/ruoyi/js/common.js +++ b/src/main/resources/static/ruoyi/js/common.js @@ -167,3 +167,16 @@ function createMenuItem(dataUrl, menuName) { } return false; } + +//设置全局ajax超时处理 +$.ajaxSetup({ + complete: function(XMLHttpRequest, textStatus) { + if (textStatus == "parsererror") { + $.modalConfirm("登陆超时!请重新登陆!", function() { + window.location.href = ctx + "login"; + }) + } else if (textStatus == "error") { + $.modalAlert("请求超时!请稍后再试!", 'warning'); + } + } +});