chao 4 سال پیش
والد
کامیت
762019fd11

+ 2 - 2
src/main/resources/static/js/account/login.js

@@ -91,7 +91,7 @@ var loginPage = new Vue({
                         _self.setStorages( _self.userData);
                         // 登录成功页面跳转
                         var loginBeforePath = getCookie("loginBeforePath");
-                        if (loginBeforePath) {
+                        if (loginBeforePath && loginBeforePath!=='undefined') {
                             window.location.href = loginBeforePath;
                         } else if (_self.userData.userIdentity*1 === 3) {
                             location.href = '/supplier/dashboard.html';
@@ -152,7 +152,7 @@ var loginPage = new Vue({
                         _self.setStorages( _self.userData);
                         // 登录成功页面跳转
                         var loginBeforePath = getCookie("loginBeforePath");
-                        if (loginBeforePath) {
+                        if (loginBeforePath && loginBeforePath!=='undefined') {
                             window.location.href = loginBeforePath;
                         } else if (_self.userData.userIdentity*1 === 3) {
                             location.href = '/supplier/dashboard.html';

+ 13 - 9
src/main/resources/static/js/base.js

@@ -335,11 +335,15 @@ function setCookie(cname,cvalue,exdays){
     }
 }
 function getCookie(cname){
-    var name = cname + "=";
-    var ca = document.cookie.split(';');
-    for(var i=0; i<ca.length; i++) {
-        var c = ca[i].trim();
-        if (c.indexOf(name)==0) { return c.substring(name.length,c.length); }
+    if (document.cookie) {
+        var name = cname + "=";
+        var ca = document.cookie.split(';');
+        for(var i=0; i<ca.length; i++) {
+            var c = ca[i].trim();
+            if (c && c.indexOf(name)===0) {
+                return c.substring(name.length,c.length);
+            }
+        }
     }
     return "";
 }
@@ -557,11 +561,11 @@ function setProductPrice(productList, productIds, userId, callback){
 }
 // 登录后返回登录前页面
 function toBeforePath(){
-    var beforePath = getCookie("loginBeforePath");
-    if (!beforePath) {
-        beforePath = '/index.html';
+    var loginBeforePath = getCookie("loginBeforePath");
+    if (loginBeforePath && loginBeforePath!=='undefined') {
+        window.location.href = loginBeforePath;
     }
-    window.location.href = beforePath;
+    window.location.href = '/index.html';
 }
 function toLogin() {//去登录
     setCookie("loginBeforePath", window.location.href);

+ 1 - 1
src/main/resources/templates/we_chat/redirect_uri.html

@@ -30,7 +30,7 @@
             };
             localStorage.setItem('userInfo',JSON.stringify(userData));
             var loginBeforePath = getCookie("loginBeforePath");
-            if (loginBeforePath) {
+            if (loginBeforePath && loginBeforePath!=='undefined') {
                 window.location.href = loginBeforePath;
             } else if (userData.userIdentity*1 === 3) {
                 location.href = '/supplier/dashboard.html';