Commit 726b2fc7 authored by 毛线's avatar 毛线

三方跳转im登录问题处理

parent bd770735
import { Message } from 'element-ui'
import { getToken } from '@/utils/auth' // 验权
const whiteList = ['/loading', '/loading/', '/login', '/login/', '/test', '/index/test', '/goToGame/'] // 不重定向白名单
const whiteList = ['/loading', '/loading/', '/login', '/login/', '/test', '/index/test', '/goToGame/', '/goToGame'] // 不重定向白名单
export default ({ app, redirect, route }) => {
const { fullPath, path } = route
......
......@@ -3,6 +3,7 @@
</template>
<script>
import { mapMutations } from 'vuex'
import { setToken, setImToken, setUserData, } from '@/utils/auth' // 验权
export default {
data() {
......@@ -16,6 +17,9 @@ export default {
}
},
methods: {
...mapMutations([
'SetImToken',
]),
network() {
return {
getInfo: (ticket) => {
......@@ -29,6 +33,7 @@ export default {
}).then(({ data }) => {
const { deviceId, imToken, redirectUrl, token } = data
setUserData({ token, openImToken: imToken })
this.SetImToken(imToken)
const query = {
redirectUrl,
deviceId,
......@@ -44,7 +49,9 @@ export default {
method: 'get',
}).then(({ data }) => {
const { deviceId, redirectUrl } = query
console.log('判断是否在其他设备')
if (!data) { // 没有在其他设备
console.log('没有在其他设备')
// 加入设备
this.$request({
url: '/api/gaming',
......@@ -59,7 +66,9 @@ export default {
}
const { id } = data
if (id) {
console.log('进入设备')
if (this.$route.name !== 'index-game') {
console.log('重定向')
this.$router.replace(`/game?id=${id}&redirectUrl=${redirectUrl}`)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment