Gao xiaosong 4 years ago
parent
commit
cd942b5349
  1. 1
      App.vue
  2. 20
      pages/activity/DargainDetails/index.vue
  3. 11
      store/index.js
  4. 13
      utils/index.js

1
App.vue

@ -2,7 +2,6 @@
import Vue from 'vue'
export default {
onLaunch: function() {
// debugger
const updateManager = uni.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
//

20
pages/activity/DargainDetails/index.vue

@ -276,7 +276,6 @@
this.getBargainHelpCount();
},
openAlone: function () {
debugger
this.$yrouter.push({
path: "/detail/" + this.bargain.productId
});
@ -307,7 +306,6 @@
that.bargainPartake = parseInt(this.partake);
}
debugger;
that.getBargainHelpCountStart();
that.getBargainDetail();
that.getBargainShare(0);
@ -346,7 +344,6 @@
goPoster: function () {
var that = this;
that.getBargainShare(that.bargainId);
debugger
this.$yrouter.push({
path: "/pages/activity/Poster/index",
query: {
@ -356,7 +353,6 @@
});
},
goList: function () {
debugger
this.$yrouter.push({
path: "/pages/activity/GoodsBargain/index"
});
@ -529,15 +525,13 @@
})
.catch(() => {
debugger
debugger
this.$yrouter.push({
path: "/pages/activity/DargainDetails/index",
query: {
id: that.bargainId,
partake: that.userInfo.uid
}
});
// this.$yrouter.push({
// path: "/pages/activity/DargainDetails/index",
// query: {
// id: that.bargainId,
// partake: that.userInfo.uid
// }
// });
});
},
getBargainHelpCount: function () {

11
store/index.js

@ -40,9 +40,13 @@ const vuexStore = new Vuex.Store({
state.token = null;
state.userInfo = null
let spread = cookie.get('spread')
console.log(spread, 'spread')
cookie.clearAll()
cookie.set('spread', spread)
let redirect = cookie.get('redirect')
let outTime = setTimeout(() => {
clearTimeout(outTime)
cookie.clearAll()
cookie.set('redirect', redirect)
cookie.set('spread', spread)
}, 100)
},
backgroundColor(state, color) {
state.color = color;
@ -134,6 +138,7 @@ const vuexStore = new Vuex.Store({
state,
commit
}, user) {
commit("updateUserInfo", user);
},
changeAuthorizationPage({

13
utils/index.js

@ -335,11 +335,9 @@ export const handleGetUserInfo = () => {
getUserInfo().then(res => {
console.log('获取用户信息')
store.dispatch('setUserInfo', res.data)
console.log('获取用户信息后跳转回显的页面')
let redirect = cookie.get('redirect')
let redirect = cookie.get('redirect')
if (redirect) {
reLaunch({
path: redirect,
@ -347,14 +345,13 @@ export const handleGetUserInfo = () => {
});
return
}
reLaunch({
path: '/pages/home/index',
// query
});
// var pages = getCurrentPages() //获取加载的页面
// debugger
// var currentPage = pages[pages.length - 1] //获取当前页面的对象
// let url = "/pages/home/index"
// let query = {}
@ -390,7 +387,6 @@ export const handleGetUserInfo = () => {
// });
// } else {
// let redirect = cookie.get('redirect')
// debugger
// if (redirect) {
// reLaunch({
@ -498,7 +494,6 @@ export const handleLoginStatus = (location, complete, fail, success) => {
// 是否可以访问
let isAuth = false
console.log('即将跳转', location, parseUrl(location))
// 从 location 中获取当前url,location typeof string || object
@ -521,6 +516,7 @@ export const handleLoginStatus = (location, complete, fail, success) => {
}
return new Promise((resolve, reject) => {
if (isAuth) {
// 有token
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 {
console.log(path)
// 如果不是小程序跳转到登录页
cookie.set('redirect', path)
push({
path: '/pages/user/Login/index',
})
cookie.set('redirect', path)
}
}

Loading…
Cancel
Save