diff --git a/web/assets/js/util/utils.js b/web/assets/js/util/utils.js index 6b4e5ed942..2a35d9e991 100644 --- a/web/assets/js/util/utils.js +++ b/web/assets/js/util/utils.js @@ -10,6 +10,12 @@ class HttpUtil { Vue.prototype.$message.success(msg.msg); } else { Vue.prototype.$message.error(msg.msg); + if (msg.msg == '登录时效已过,请重新登录') { + setTimeout(()=> { + Vue.prototype.$message.warning("即将开始重新登录!") + setTimeout(()=> {window.location.reload()},3000) + },2000) + } } } diff --git a/web/controller/util.go b/web/controller/util.go index 0b214fdc9a..94e1e951fe 100644 --- a/web/controller/util.go +++ b/web/controller/util.go @@ -5,6 +5,7 @@ import ( "net" "net/http" "strings" + "time" "x-ui/config" "x-ui/logger" "x-ui/web/entity" @@ -82,7 +83,8 @@ func html(c *gin.Context, name string, title string, data gin.H) { func getContext(h gin.H) gin.H { a := gin.H{ - "cur_ver": config.GetVersion(), + "cur_ver": config.GetVersion(), + "timeStamp": time.Now().Unix(), } if h != nil { for key, value := range h { diff --git a/web/html/common/js.html b/web/html/common/js.html index b8ee57b2f8..d227f362cd 100644 --- a/web/html/common/js.html +++ b/web/html/common/js.html @@ -8,12 +8,13 @@ - - - - - - + + + + + + +