Jelajahi Sumber

页面加载功能调整

hejq 7 tahun lalu
induk
melakukan
cc2e7306e7
1 mengubah file dengan 14 tambahan dan 1 penghapusan
  1. 14 1
      src/main/webapp/resources/js/common/common.js

+ 14 - 1
src/main/webapp/resources/js/common/common.js

@@ -15,7 +15,7 @@ function getAccountInfo() {
 
             $('.x-login').find('.title').text(data.content.name);
 
-            $('.x-login').click(function () {
+            $('.title').click(function () {
 				window.location.href = "/resetPassword";
             });
 		}
@@ -26,16 +26,29 @@ function getAccountInfo() {
  * 退出登录
  */
 function Logout() {
+    $.ajaxSetup({cache : false });
     $.ajax('logout', {
         method: 'POST',
         async: false,
         success: function() {
+            clearAllCookie();
             window.location.href = "/signIn";
         },
         error: function (error) {
             toastr.error(error);
         }
     });
+    window.location.href = "/signIn";
+}
+
+//清除所有cookie函数
+function clearAllCookie() {
+    var keys = document.cookie.match(/[^ =;]+(?=\=)/g);
+    if (keys) {
+        for(var i = keys.length; i--;) {
+            document.cookie = keys[i] + '=0;expires=' + new Date(0).toUTCString();
+        }
+    }
 }
 
 $(function() {