Browse Source

用户登录记录returnUrl

yangc 8 years ago
parent
commit
d6b275c7a9

+ 1 - 1
components/common/buyOrCar/buyComponent.vue

@@ -11,7 +11,7 @@
     methods: {
       buyNow: function (isBuy) {
         if (!this.$store.state.option.user.logged) {
-          this.$http.get('/login/page').then(response => {
+          this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
             if (response.data) {
               this.$router.push('/auth/login')
             }

+ 2 - 2
components/default/Header.vue

@@ -80,10 +80,10 @@
         this.$router.push('/auth/logout')
       },
       onLoginClick () {
-        this.$http.get('/login/page').then(response => {
+        this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
           if (response.data) {
             this.$router.push('/auth/login')
-     //       window.location.href = response.data.content
+//            window.location.href = response.data.content
           }
         })
         // TODO 待Account Center改版

+ 10 - 15
components/default/RightBar.vue

@@ -145,35 +145,30 @@
         this.$store.dispatch('user/deleteHistory', {id: id})
         this.$store.dispatch('user/loadHistory')
       },
+      goLogin: function () {
+        this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
+          if (response.data) {
+            this.$router.push('/auth/login')
+          }
+        })
+      },
       goHistory: function () {
         if (!this.user.logged) {
-          this.$http.get('/login/page').then(response => {
-            if (response.data) {
-              this.$router.push('/auth/login')
-            }
-          })
+          this.goLogin()
         } else {
           window.location.href = '/user#/browsingHistory'
         }
       },
       goCart: function () {
         if (!this.user.logged) {
-          this.$http.get('/login/page').then(response => {
-            if (response.data) {
-              this.$router.push('/auth/login')
-            }
-          })
+          this.goLogin()
         } else {
           window.location.href = '/user#/cart'
         }
       },
       goWebChat: function () {
         if (!this.user.logged) {
-          this.$http.get('/login/page').then(response => {
-            if (response.data) {
-              this.$router.push('/auth/login')
-            }
-          })
+          this.goLogin()
         } else {
           // 获得窗口的垂直位置
           let iTop = (window.screen.availHeight - 30 - 600) / 2

+ 1 - 1
components/product/component/ComponentDetail.vue

@@ -110,7 +110,7 @@
           this.$store.dispatch('product/saveEntity', {componentid: id, kind: kind})
           this.collectList = true
         } else {
-          this.$http.get('/login/page').then(response => {
+          this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
             if (response.data) {
               this.$router.push('/auth/login')
             }

+ 1 - 1
components/store/CommodityInfo.vue

@@ -280,7 +280,7 @@ export default {
     },
     buyNow: function (isBuy, item) {
       if (!this.$store.state.option.user.logged) {
-        this.$http.get('/login/page').then(response => {
+        this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
           if (response.data) {
             this.$router.push('/auth/login')
           }

+ 1 - 1
components/store/RecommendProduct.vue

@@ -44,7 +44,7 @@
     methods: {
       buyNow: function (isBuy, item) {
         if (!this.$store.state.option.user.logged) {
-          this.$http.get('/login/page').then(response => {
+          this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
             if (response.data) {
               this.$router.push('/auth/login')
             }

+ 1 - 1
components/store/common/StoreHeader.vue

@@ -98,7 +98,7 @@ export default {
     },
     focus (id, name) {
       if (!this.user.logged) {
-        this.$http.get('/login/page').then(response => {
+        this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
           if (response.data) {
             this.$router.push('/auth/login')
           }

+ 1 - 1
nuxt.config.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://www.usoftmall.com/' : 'http://192.168.253.60:9090/platform-b2c/')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://www.usoftmall.com/' : 'http://192.168.253.123:8080/platform-b2c/')
 
 module.exports = {
   router: {

+ 1 - 2
pages/auth/login.vue

@@ -36,7 +36,7 @@ export default {
       })
     },
     async crossAfter (content) {
-      if (!content && content === '') {
+      if (!content || content === '') {
         this.$router.replace('/')
       }
 
@@ -44,7 +44,6 @@ export default {
         let { data } = await this.$http.post('/login/crossAfter', {}, { params: { replyTxt: content } })
 
         this.$store.dispatch('loadUserInfo', data)
-
         window.location.href = data.returnUrl || '/'
       } catch (err) {
         this.$router.replace('/')