Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
wx-notification
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 50365685
authored
Apr 14, 2026
by
yancanhua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 企业微信登录自测问题调整
1 parent
5d0cc991
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
13 deletions
src/router/router.js
src/store/modules/app.js
src/router/router.js
View file @
5036568
...
...
@@ -38,7 +38,7 @@ router.beforeEach((to, from, next) => {
console
.
log
(
recode
)
setTimeout
(()
=>
{
store
.
dispatch
(
'login'
)
},
66
0
)
},
66
6
)
})
if
(
to
.
matched
.
some
(
recode
=>
recode
.
meta
.
noAuth
))
{
console
.
log
(
'noAuth'
)
...
...
src/store/modules/app.js
View file @
5036568
...
...
@@ -40,20 +40,28 @@ const actions = {
// window.$HTTP = new Http({ ...window.$fetchConfig, alert: Notify, headers: { token: sessionId } })
},
login
({
dispatch
,
state
})
{
//获取当前路由路径
const
currentPath
=
window
.
location
.
href
;
const
pathKeywords
=
[
'/department'
,
'/personage'
,
'/company'
];
const
isTargetPath
=
pathKeywords
.
some
(
keyword
=>
currentPath
.
includes
(
keyword
));
if
(
isTargetPath
)
{
const
pushId
=
getParams
(
'pushId'
);
if
(
isTargetPath
&&
(
pushId
&&
(
pushId
*
1
)
>
744
))
{
state
.
showWindow
=
false
try
{
let
{
corpId
,
agentId
}
=
getParams
();
const
wwCode
=
getParams
(
'code'
);
let
{
loginUrl
}
=
window
.
$fetchConfig
;
let
userInfo
=
window
.
sessionStorage
.
getItem
(
'ww_userInfo'
)
||
''
;
if
(
userInfo
)
return
state
.
showWindow
=
true
;
let
userInfo
=
util
.
getLocalStorage
(
'ww_userInfo'
)
||
''
;
if
(
userInfo
&&
userInfo
.
timestamp
)
{
//判断用户时间戳是否过期12小时
if
(
userInfo
.
timestamp
&&
(
Date
.
now
()
-
userInfo
.
timestamp
)
>
(
1000
*
60
*
720
))
{
console
.
log
(
'用户登录过期'
);
}
else
{
console
.
log
(
'用户登录未过期'
);
return
state
.
showWindow
=
true
;
}
}
if
(
wwCode
)
{
ssoApi
.
login
({
code
:
wwCode
,
corpId
,
getUserInfoFlag
:
false
}).
then
(
res
=>
{
const
{
code
,
data
,
message
}
=
res
;
...
...
@@ -64,8 +72,10 @@ const actions = {
if
(
item
.
loginList
&&
item
.
loginList
.
length
)
{
let
[
userInfo
]
=
item
.
loginList
,
{
phone
}
=
userInfo
if
(
phone
)
window
.
sessionStorage
.
setItem
(
'ww_params_phone'
,
JSON
.
stringify
(
phone
))
window
.
sessionStorage
.
setItem
(
'ww_userInfo'
,
JSON
.
stringify
(
userInfo
))
if
(
phone
)
util
.
setLocalStorage
(
'ww_params_phone'
,
phone
)
//获取当前时间戳
userInfo
.
timestamp
=
Date
.
now
();
util
.
setLocalStorage
(
'ww_userInfo'
,
userInfo
);
}
else
throw
''
}
else
throw
''
}
else
throw
message
...
...
@@ -77,14 +87,14 @@ const actions = {
if
(
!
error
)
error
=
'登录失败或无权限'
if
(
error
)
Notify
(
typeof
error
===
'string'
?
error
:
error
.
toString
())
}
}
else
{
state
.
showWindow
=
true
const
{
corpId
,
agentId
}
=
util
.
getLocalStorage
(
'ww_storage_info'
),
{
loginUrl
}
=
window
.
$fetchConfig
;
window
.
location
.
href
=
`
${
loginUrl
}
?redirect_uri=
${
encodeURIComponent
(
window
.
location
.
href
)}
&corpId=
${
corpId
}
&agentId=
${
agentId
}
`
}
// else {
// state.showWindow = true
// const { corpId, agentId } = util.getLocalStorage('ww_storage_info'),
// { loginUrl } = window.$fetchConfig;
// window.location.href = `${loginUrl}?redirect_uri=${encodeURIComponent(window.location.href)}&corpId=${corpId}&agentId=${agentId}`
// }
},
navigation
({
dispatch
},
to
)
{
let
{
corpId
,
agentId
,
phone
,
name
,
id
}
=
getParams
(),
userInfo
=
util
.
getLocalStorage
(
'ww_userInfo'
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment