Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
eslotsys-game-nuxt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
毛线
eslotsys-game-nuxt
Commits
726b2fc7
Commit
726b2fc7
authored
Jul 26, 2023
by
毛线
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
三方跳转im登录问题处理
parent
bd770735
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
auth.js
middleware/auth.js
+1
-1
goToGame.vue
pages/goToGame.vue
+9
-0
No files found.
middleware/auth.js
View file @
726b2fc7
import
{
Message
}
from
'element-ui'
import
{
Message
}
from
'element-ui'
import
{
getToken
}
from
'@/utils/auth'
// 验权
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
})
=>
{
export
default
({
app
,
redirect
,
route
})
=>
{
const
{
fullPath
,
path
}
=
route
const
{
fullPath
,
path
}
=
route
...
...
pages/goToGame.vue
View file @
726b2fc7
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
mapMutations
}
from
'vuex'
import
{
setToken
,
setImToken
,
setUserData
,
}
from
'@/utils/auth'
// 验权
import
{
setToken
,
setImToken
,
setUserData
,
}
from
'@/utils/auth'
// 验权
export
default
{
export
default
{
data
()
{
data
()
{
...
@@ -16,6 +17,9 @@ export default {
...
@@ -16,6 +17,9 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
...
mapMutations
([
'SetImToken'
,
]),
network
()
{
network
()
{
return
{
return
{
getInfo
:
(
ticket
)
=>
{
getInfo
:
(
ticket
)
=>
{
...
@@ -29,6 +33,7 @@ export default {
...
@@ -29,6 +33,7 @@ export default {
}).
then
(({
data
})
=>
{
}).
then
(({
data
})
=>
{
const
{
deviceId
,
imToken
,
redirectUrl
,
token
}
=
data
const
{
deviceId
,
imToken
,
redirectUrl
,
token
}
=
data
setUserData
({
token
,
openImToken
:
imToken
})
setUserData
({
token
,
openImToken
:
imToken
})
this
.
SetImToken
(
imToken
)
const
query
=
{
const
query
=
{
redirectUrl
,
redirectUrl
,
deviceId
,
deviceId
,
...
@@ -44,7 +49,9 @@ export default {
...
@@ -44,7 +49,9 @@ export default {
method
:
'get'
,
method
:
'get'
,
}).
then
(({
data
})
=>
{
}).
then
(({
data
})
=>
{
const
{
deviceId
,
redirectUrl
}
=
query
const
{
deviceId
,
redirectUrl
}
=
query
console
.
log
(
'判断是否在其他设备'
)
if
(
!
data
)
{
// 没有在其他设备
if
(
!
data
)
{
// 没有在其他设备
console
.
log
(
'没有在其他设备'
)
// 加入设备
// 加入设备
this
.
$request
({
this
.
$request
({
url
:
'/api/gaming'
,
url
:
'/api/gaming'
,
...
@@ -59,7 +66,9 @@ export default {
...
@@ -59,7 +66,9 @@ export default {
}
}
const
{
id
}
=
data
const
{
id
}
=
data
if
(
id
)
{
if
(
id
)
{
console
.
log
(
'进入设备'
)
if
(
this
.
$route
.
name
!==
'index-game'
)
{
if
(
this
.
$route
.
name
!==
'index-game'
)
{
console
.
log
(
'重定向'
)
this
.
$router
.
replace
(
`/game?id=
${
id
}
&redirectUrl=
${
redirectUrl
}
`
)
this
.
$router
.
replace
(
`/game?id=
${
id
}
&redirectUrl=
${
redirectUrl
}
`
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment