Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
dj-scrm-wx-work-attachment-clew
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 da180228
authored
Jun 29, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
企微敏感信息获取授权同步
1 parent
f34b54d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
src/store/modules/app.js
src/store/modules/app.js
View file @
da18022
...
@@ -16,15 +16,15 @@ const state = {
...
@@ -16,15 +16,15 @@ const state = {
lastPath
:
''
lastPath
:
''
}
}
const
mutations
=
{
const
mutations
=
{
SET_PAGE_META
(
state
,
meta
)
{
SET_PAGE_META
(
state
,
meta
)
{
state
.
pageMeta
=
meta
state
.
pageMeta
=
meta
},
},
PUSH_KEEP
(
state
,
name
)
{
PUSH_KEEP
(
state
,
name
)
{
if
(
!
state
.
keepAlives
.
includes
(
name
))
{
if
(
!
state
.
keepAlives
.
includes
(
name
))
{
state
.
keepAlives
.
push
(
name
)
state
.
keepAlives
.
push
(
name
)
}
}
},
},
REMOVE_KEEP
(
state
,
names
)
{
REMOVE_KEEP
(
state
,
names
)
{
state
.
keepAlives
=
state
.
keepAlives
.
reduce
((
arr
,
name
)
=>
{
state
.
keepAlives
=
state
.
keepAlives
.
reduce
((
arr
,
name
)
=>
{
if
(
!
names
.
includes
(
name
))
{
if
(
!
names
.
includes
(
name
))
{
return
arr
.
push
(
name
)
return
arr
.
push
(
name
)
...
@@ -32,28 +32,28 @@ const mutations = {
...
@@ -32,28 +32,28 @@ const mutations = {
return
arr
return
arr
},
[])
},
[])
},
},
SET_LAST_PATH
(
state
,
path
)
{
SET_LAST_PATH
(
state
,
path
)
{
state
.
lastPath
=
path
state
.
lastPath
=
path
}
}
}
}
const
actions
=
{
const
actions
=
{
setPageMeta
({
commit
},
meta
)
{
setPageMeta
({
commit
},
meta
)
{
document
.
title
=
meta
.
title
document
.
title
=
meta
.
title
commit
(
'SET_PAGE_META'
,
meta
)
commit
(
'SET_PAGE_META'
,
meta
)
},
},
setLoginToken
({
commit
},
val
)
{
setLoginToken
({
commit
},
val
)
{
commit
(
'SET_LOGIN_TOKEN'
,
val
)
commit
(
'SET_LOGIN_TOKEN'
,
val
)
},
},
setAccountList
({
commit
},
list
)
{
setAccountList
({
commit
},
list
)
{
commit
(
'SET_ACCOUNT_LIST'
,
list
)
commit
(
'SET_ACCOUNT_LIST'
,
list
)
},
},
pushKeep
({
commit
},
name
)
{
pushKeep
({
commit
},
name
)
{
commit
(
'PUSH_KEEP'
,
name
)
commit
(
'PUSH_KEEP'
,
name
)
},
},
removeKeep
({
commit
},
names
)
{
removeKeep
({
commit
},
names
)
{
commit
(
'REMOVE_KEEP'
,
names
)
commit
(
'REMOVE_KEEP'
,
names
)
},
},
login
({
dispatch
})
{
login
({
dispatch
})
{
let
[
redirectUrl
]
=
window
.
location
.
href
.
split
(
'?'
)
let
[
redirectUrl
]
=
window
.
location
.
href
.
split
(
'?'
)
// 以下是 本地调试
// 以下是 本地调试
if
(
process
.
env
.
NODE_ENV
==
'development'
)
{
if
(
process
.
env
.
NODE_ENV
==
'development'
)
{
...
@@ -121,14 +121,14 @@ const actions = {
...
@@ -121,14 +121,14 @@ const actions = {
window
.
location
.
href
=
`
${
wxUrl
}
?appid=
${
appid
}
&redirect_uri=
${
encodeURIComponent
(
redirectUrl
)}
&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
window
.
location
.
href
=
`
${
wxUrl
}
?appid=
${
appid
}
&redirect_uri=
${
encodeURIComponent
(
redirectUrl
)}
&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
}
}
}
else
{
}
else
{
const
storage_corpId
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
const
{
corpId
,
agentId
}
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
const
{
baseURL
}
=
window
.
$fetchConfig
.
request
const
{
baseURL
}
=
window
.
$fetchConfig
.
request
let
url
=
`
${
baseURL
}
/dj-scrm-wx-work-main/#/`
let
url
=
`
${
baseURL
}
/dj-scrm-wx-work-main/#/`
window
.
location
.
href
=
`
${
url
}
?redirect_uri=
${
redirectUrl
}
&corpId=
${
storage_corpId
.
corp
Id
}
`
window
.
location
.
href
=
`
${
url
}
?redirect_uri=
${
encodeURIComponent
(
redirectUrl
)}
&corpId=
${
corpId
}
&agentId=
${
agent
Id
}
`
}
}
},
},
navigation
({
dispatch
})
{
navigation
({
dispatch
})
{
let
{
sessionId
,
corpId
,
taskId
}
=
getParams
()
let
{
sessionId
,
corpId
,
taskId
,
agentId
}
=
getParams
()
const
storage_corpId
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
const
storage_corpId
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
if
(
!
corpId
)
corpId
=
storage_corpId
&&
storage_corpId
.
corpId
if
(
!
corpId
)
corpId
=
storage_corpId
&&
storage_corpId
.
corpId
if
(
corpId
&&
storage_corpId
)
{
if
(
corpId
&&
storage_corpId
)
{
...
@@ -137,7 +137,9 @@ const actions = {
...
@@ -137,7 +137,9 @@ const actions = {
util
.
clearSessionId
()
util
.
clearSessionId
()
}
}
}
}
util
.
setLocalStorage
(
'dj_scrm_corpId'
,
{
corpId
})
let
dj_scrm_storage
=
{
corpId
}
if
(
agentId
)
dj_scrm_storage
.
agentId
=
agentId
util
.
setLocalStorage
(
'dj_scrm_corpId'
,
dj_scrm_storage
)
if
(
taskId
)
{
if
(
taskId
)
{
util
.
setLocalStorage
(
'dj_scrm_taskId'
,
{
taskId
})
util
.
setLocalStorage
(
'dj_scrm_taskId'
,
{
taskId
})
}
}
...
@@ -154,7 +156,7 @@ const actions = {
...
@@ -154,7 +156,7 @@ const actions = {
}
}
state
.
showWindow
=
true
state
.
showWindow
=
true
},
},
registerHttp
({
},
sessionId
=
''
)
{
registerHttp
({
},
sessionId
=
''
)
{
window
.
$HTTP
=
new
Http
({
...
window
.
$fetchConfig
,
alert
:
Notify
,
headers
:
{
token
:
sessionId
}
})
window
.
$HTTP
=
new
Http
({
...
window
.
$fetchConfig
,
alert
:
Notify
,
headers
:
{
token
:
sessionId
}
})
}
}
}
}
...
...
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