zhengjinyi 4 anni fa
parent
commit
6cce194fff

+ 25 - 20
src/main/resources/static/js/account/login.js

@@ -91,15 +91,18 @@ var loginPage = new Vue({
                         };
                         _self.setStorages( _self.userData);
                         // 登录成功页面跳转
-                        var beforePath = localStorage.getItem("loginBeforePath");
-                        if(_userIdentity == 4 || _userIdentity ==2){
-                            window.location.href = '/user/dashboard.html';
-                        }else if(_userIdentity == 3){
-                            window.location.href = '/supplier/dashboard.html';
-                        }else if (beforePath) {
-                            window.location.href = beforePath;
-                        }else {
-                            window.location.href = '/index.html';
+                        var forwardUrl = document.referrer;
+                        var getHrefUrl = $("#spiServer").val();
+                        if(forwardUrl=="" || forwardUrl==undefined || forwardUrl==null || forwardUrl == getHrefUrl){
+                            if(_userIdentity == 4 || _userIdentity ==2){
+                                location.href = '/user/dashboard.html';
+                            }else if(_userIdentity == 3){
+                                location.href = '/supplier/dashboard.html';
+                            }else{
+                                location.href="/index.html";
+                            }
+                        }else{
+                            location.href=""+forwardUrl+"";
                         }
                     }else if(response.code == -4){
                         window.location.href = '/bind.html';
@@ -136,7 +139,6 @@ var loginPage = new Vue({
                 UserApi.PostLoginAccount(params,function(response){
                     _self.loginLoading = false;
                     if(response.code === 0){
-                        console.log(response.data);
                         var _userIdentity = response.data.userIdentity;
                         _self.userData = {
                             account: response.data.account,
@@ -152,17 +154,20 @@ var loginPage = new Vue({
                             permission: response.data.userPermission,
                             token: response.data.token
                         };
-                       _self.setStorages( _self.userData);
+                        _self.setStorages( _self.userData);
                         // 登录成功页面跳转
-                        var beforePath = localStorage.getItem("loginBeforePath");
-                        if(_userIdentity == 4 || _userIdentity ==2){
-                            window.location.href = '/user/dashboard.html';
-                        }else if(_userIdentity == 3){
-                            window.location.href = '/supplier/dashboard.html';
-                        }else if (beforePath) {
-                            window.location.href = beforePath;
-                        }else {
-                            window.location.href = '/index.html';
+                        var forwardUrl = document.referrer;
+                        var getHrefUrl = $("#spiServer").val();
+                        if(forwardUrl=="" || forwardUrl==undefined || forwardUrl==null || forwardUrl == getHrefUrl){
+                            if(_userIdentity == 4 || _userIdentity ==2){
+                                location.href = '/user/dashboard.html';
+                            }else if(_userIdentity == 3){
+                                location.href = '/supplier/dashboard.html';
+                            }else{
+                                location.href="/index.html";
+                            }
+                        }else{
+                            location.href=""+forwardUrl+"";
                         }
                     } else {// 登录失败
                         CAIMEI.Alert(response.msg,'确定',false);

+ 1 - 1
src/main/resources/static/js/account/register-club.js

@@ -218,7 +218,7 @@ var registerPage = new Vue({
                         spId: response.data.serviceProviderID,
                         clubId: response.data.clubID,
                         shopId: response.data.shopID,
-                        identity: response.data.userIdentity,
+                        userIdentity: response.data.userIdentity,
                         permission: response.data.userPermission,
                         token: response.data.token
                     };

+ 1 - 1
src/main/resources/static/js/base.js

@@ -131,7 +131,7 @@ var globalHead = new Vue({
     mounted:function(){
         var userData = JSON.parse(window.localStorage.getItem('userInfo'));
         if(userData!=null){
-            this.userIdentity = userData.identity;
+            this.userIdentity = userData.userIdentity;
             this.shopId = userData.shopId;
         }
     }