解决砍价页面未登录情况下,跳转登录页面无法回跳的问题
This commit is contained in:
1
App.vue
1
App.vue
@ -2,7 +2,6 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
// debugger
|
|
||||||
const updateManager = uni.getUpdateManager()
|
const updateManager = uni.getUpdateManager()
|
||||||
updateManager.onCheckForUpdate(function (res) {
|
updateManager.onCheckForUpdate(function (res) {
|
||||||
// 请求完新版本信息的回调
|
// 请求完新版本信息的回调
|
||||||
|
@ -276,7 +276,6 @@
|
|||||||
this.getBargainHelpCount();
|
this.getBargainHelpCount();
|
||||||
},
|
},
|
||||||
openAlone: function () {
|
openAlone: function () {
|
||||||
debugger
|
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/detail/" + this.bargain.productId
|
path: "/detail/" + this.bargain.productId
|
||||||
});
|
});
|
||||||
@ -307,7 +306,6 @@
|
|||||||
that.bargainPartake = parseInt(this.partake);
|
that.bargainPartake = parseInt(this.partake);
|
||||||
}
|
}
|
||||||
|
|
||||||
debugger;
|
|
||||||
that.getBargainHelpCountStart();
|
that.getBargainHelpCountStart();
|
||||||
that.getBargainDetail();
|
that.getBargainDetail();
|
||||||
that.getBargainShare(0);
|
that.getBargainShare(0);
|
||||||
@ -346,7 +344,6 @@
|
|||||||
goPoster: function () {
|
goPoster: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
that.getBargainShare(that.bargainId);
|
that.getBargainShare(that.bargainId);
|
||||||
debugger
|
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/activity/Poster/index",
|
path: "/pages/activity/Poster/index",
|
||||||
query: {
|
query: {
|
||||||
@ -356,7 +353,6 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
goList: function () {
|
goList: function () {
|
||||||
debugger
|
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/activity/GoodsBargain/index"
|
path: "/pages/activity/GoodsBargain/index"
|
||||||
});
|
});
|
||||||
@ -529,15 +525,13 @@
|
|||||||
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
debugger
|
// this.$yrouter.push({
|
||||||
debugger
|
// path: "/pages/activity/DargainDetails/index",
|
||||||
this.$yrouter.push({
|
// query: {
|
||||||
path: "/pages/activity/DargainDetails/index",
|
// id: that.bargainId,
|
||||||
query: {
|
// partake: that.userInfo.uid
|
||||||
id: that.bargainId,
|
// }
|
||||||
partake: that.userInfo.uid
|
// });
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getBargainHelpCount: function () {
|
getBargainHelpCount: function () {
|
||||||
|
@ -40,9 +40,13 @@ const vuexStore = new Vuex.Store({
|
|||||||
state.token = null;
|
state.token = null;
|
||||||
state.userInfo = null
|
state.userInfo = null
|
||||||
let spread = cookie.get('spread')
|
let spread = cookie.get('spread')
|
||||||
console.log(spread, 'spread')
|
let redirect = cookie.get('redirect')
|
||||||
cookie.clearAll()
|
let outTime = setTimeout(() => {
|
||||||
cookie.set('spread', spread)
|
clearTimeout(outTime)
|
||||||
|
cookie.clearAll()
|
||||||
|
cookie.set('redirect', redirect)
|
||||||
|
cookie.set('spread', spread)
|
||||||
|
}, 100)
|
||||||
},
|
},
|
||||||
backgroundColor(state, color) {
|
backgroundColor(state, color) {
|
||||||
state.color = color;
|
state.color = color;
|
||||||
@ -134,6 +138,7 @@ const vuexStore = new Vuex.Store({
|
|||||||
state,
|
state,
|
||||||
commit
|
commit
|
||||||
}, user) {
|
}, user) {
|
||||||
|
|
||||||
commit("updateUserInfo", user);
|
commit("updateUserInfo", user);
|
||||||
},
|
},
|
||||||
changeAuthorizationPage({
|
changeAuthorizationPage({
|
||||||
|
@ -335,11 +335,9 @@ export const handleGetUserInfo = () => {
|
|||||||
getUserInfo().then(res => {
|
getUserInfo().then(res => {
|
||||||
console.log('获取用户信息')
|
console.log('获取用户信息')
|
||||||
store.dispatch('setUserInfo', res.data)
|
store.dispatch('setUserInfo', res.data)
|
||||||
|
|
||||||
console.log('获取用户信息后跳转回显的页面')
|
console.log('获取用户信息后跳转回显的页面')
|
||||||
|
|
||||||
let redirect = cookie.get('redirect')
|
|
||||||
|
|
||||||
|
let redirect = cookie.get('redirect')
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
reLaunch({
|
reLaunch({
|
||||||
path: redirect,
|
path: redirect,
|
||||||
@ -347,14 +345,13 @@ export const handleGetUserInfo = () => {
|
|||||||
});
|
});
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reLaunch({
|
reLaunch({
|
||||||
path: '/pages/home/index',
|
path: '/pages/home/index',
|
||||||
// query
|
// query
|
||||||
});
|
});
|
||||||
|
|
||||||
// var pages = getCurrentPages() //获取加载的页面
|
// var pages = getCurrentPages() //获取加载的页面
|
||||||
// debugger
|
|
||||||
// var currentPage = pages[pages.length - 1] //获取当前页面的对象
|
// var currentPage = pages[pages.length - 1] //获取当前页面的对象
|
||||||
// let url = "/pages/home/index"
|
// let url = "/pages/home/index"
|
||||||
// let query = {}
|
// let query = {}
|
||||||
@ -390,7 +387,6 @@ export const handleGetUserInfo = () => {
|
|||||||
// });
|
// });
|
||||||
// } else {
|
// } else {
|
||||||
// let redirect = cookie.get('redirect')
|
// let redirect = cookie.get('redirect')
|
||||||
// debugger
|
|
||||||
// if (redirect) {
|
// if (redirect) {
|
||||||
|
|
||||||
// reLaunch({
|
// reLaunch({
|
||||||
@ -498,7 +494,6 @@ export const handleLoginStatus = (location, complete, fail, success) => {
|
|||||||
|
|
||||||
// 是否可以访问
|
// 是否可以访问
|
||||||
let isAuth = false
|
let isAuth = false
|
||||||
|
|
||||||
console.log('即将跳转', location, parseUrl(location))
|
console.log('即将跳转', location, parseUrl(location))
|
||||||
|
|
||||||
// 从 location 中获取当前url,location typeof string || object
|
// 从 location 中获取当前url,location typeof string || object
|
||||||
@ -521,6 +516,7 @@ export const handleLoginStatus = (location, complete, fail, success) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
if (isAuth) {
|
if (isAuth) {
|
||||||
// 有token
|
// 有token
|
||||||
if (path == '/pages/home/index' || path == '/pages/shop/GoodsClass/index' || path == '/pages/shop/ShoppingCart/index' || path == '/pages/user/User/index') {
|
if (path == '/pages/home/index' || path == '/pages/shop/GoodsClass/index' || path == '/pages/shop/ShoppingCart/index' || path == '/pages/user/User/index') {
|
||||||
@ -640,11 +636,12 @@ export function routerPermissions(url, type) {
|
|||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
|
console.log(path)
|
||||||
// 如果不是小程序跳转到登录页
|
// 如果不是小程序跳转到登录页
|
||||||
|
cookie.set('redirect', path)
|
||||||
push({
|
push({
|
||||||
path: '/pages/user/Login/index',
|
path: '/pages/user/Login/index',
|
||||||
})
|
})
|
||||||
cookie.set('redirect', path)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user