Commit 5ae180bd authored by 毛线's avatar 毛线

对接tk

parent 0e7dadb3
import { Message } from 'element-ui'
import { getToken } from '@/utils/auth' // 验权
const whiteList = ['/loading', '/login', '/test', '/index/test'] // 不重定向白名单
const whiteList = ['/loading', '/login', '/test', '/index/test', '/goToGame'] // 不重定向白名单
export default ({ app, redirect, route }) => {
const { fullPath, path } = route
......
<template>
<div/>
</template>
<script>
import { setToken, setImToken, setUserData, } from '@/utils/auth' // 验权
export default {
data() {
return {}
},
created() {
// https://app-dev.eslotsys.com/goToGame?ticket=a079fbdf3ac4463f9dd67632d990c940
const { ticket } = this.$route.query
if (ticket) {
this.network().getInfo(ticket)
}
},
methods: {
network() {
return {
getInfo: (ticket) => {
const params = {
ticket,
}
this.$request({
url: '/api/gaming/getGagingInfoByTicket',
method: 'get',
params,
}).then(({ data }) => {
const { deviceId, imToken, redirectUrl, token } = data
setUserData({ token, openImToken: imToken })
const query = {
redirectUrl,
deviceId,
}
console.log('query', query)
this.$request({
url: '/api/gaming',
method: 'post',
data: {
deviceId,
},
}).then(({ data }) => {
this.$router.replace({ path: '/loading', query, })
})
})
},
}
},
},
}
</script>
......@@ -195,7 +195,11 @@ export default {
break
case 10004: // 退出设备成功
case 10015: // 后台提出游戏
this.$router.replace('/device')
if (this.$route.query.redirectUrl) {
location.replace(this.$route.query.redirectUrl)
} else {
this.$router.replace('/device')
}
break
case 10002: // 即将超出最大未操作时长,60秒后将踢出游戏
Message({
......
......@@ -123,7 +123,18 @@ export default {
const token = getToken()
if (token) {
this.GetBaseInfo().then(() => {
this.$router.replace('/device')
const { redirectUrl, deviceId } = this.$route.query
if (deviceId) {
const params = {
id: deviceId,
}
const query = {
redirectUrl,
}
this.$router.replace({ path: `/game/${deviceId}`, params, query })
} else {
this.$router.replace('/device')
}
}).catch(() => {
this.$router.replace('/login')
})
......
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