提交 34a26eab authored 作者: 王鹏飞's avatar 王鹏飞

登录回调修改

上级 8c5b8e20
......@@ -42,6 +42,7 @@ window.G = Vue.prototype.$GLOBAL = {
*/
Vue.prototype.VueEvent = new Vue()
Vue.prototype.wx = window.wx.miniProgram
/* 创建实例之前,通过导航守卫,处理部分逻辑,如:是否直接进入系统 */
// const before = createBefore()
/* 导航守卫 */
......@@ -58,5 +59,3 @@ window.G.$instance_vue = new Vue({
// 获取环境
store.dispatch('getEnv')
// 获取环境
store.dispatch('getUser')
......@@ -76,11 +76,14 @@ export default {
if (this.isWeapp) {
// 小程序
wx.miniProgram.navigateTo({
url: `/pages/web/index?src=${window.location.origin}/login`
url: `/pages/web/index?src=${
window.location.origin
}/login?is_weapp=1&redirect_uri=${encodeURIComponent(map[name])}`
})
} else {
this.$router.push({ name: 'login' })
}
return
}
if (this.isWeapp) {
// 小程序
......
......@@ -52,6 +52,9 @@ export default {
}
},
computed: {
isWeapp() {
return this.$store.state.isWeapp
},
// 重定向地址
redirectURI() {
const { query } = this.$route
......@@ -99,12 +102,15 @@ export default {
})
this.$store.commit('setToken', response.data.TGC)
wx.miniProgram.postMessage({ data: { token: response.data.TGC } })
if (this.isWeapp) {
wx.miniProgram.navigateBack()
return
}
if (this.redirectURI) {
window.location.href = this.redirectURI
} else {
this.$router.replace('/')
}
// this.$router.replace('/')
} else {
this.$toast(response.msg)
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论