Commit 6865fc55 by xinla

--no commit message

1 parent 742176ca
...@@ -34,7 +34,7 @@ export default { ...@@ -34,7 +34,7 @@ export default {
const noAuth = this.$router.app.$route.meta ? this.$router.app.$route.meta.noAuth : false const noAuth = this.$router.app.$route.meta ? this.$router.app.$route.meta.noAuth : false
if (!code && !noAuth) { if (!code && !noAuth) {
this.$toast('未获得授权') this.$dialog({ message: '未获得授权' })
} }
const noGetUser = this.$router.app.$route.meta ? this.$router.app.$route.meta.noAuth : false const noGetUser = this.$router.app.$route.meta ? this.$router.app.$route.meta.noAuth : false
...@@ -42,8 +42,17 @@ export default { ...@@ -42,8 +42,17 @@ export default {
// this.$toast('未获得授权') // this.$toast('未获得授权')
return return
} }
let userId = sessionStorage.getItem('userId')
//取缓存中的用户信息
if (userId) {
userId = JSON.parse(userId)
} else {
let { data } = await getUserInfo(code, this.agentId) let { data } = await getUserInfo(code, this.agentId)
this.$store.state.userId = data.userId // 存入sessionStorage,解决刷新重复code获取用户问题
sessionStorage.setItem('userId', JSON.stringify(data.userId))
userId = data.userId
}
this.$store.state.userId = userId
}) })
// this.$toast('userId:' + this.$store.state.userId) // this.$toast('userId:' + this.$store.state.userId)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!