Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
dj-scrm-wx-work-main
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 2e52e763
authored
Jun 29, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
f5fcf8db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
src/store/modules/app.js
src/views/common/accountList.vue
src/store/modules/app.js
View file @
2e52e76
...
@@ -70,11 +70,12 @@ const actions = {
...
@@ -70,11 +70,12 @@ const actions = {
let
[
redirectUrl
]
=
window
.
location
.
href
.
split
(
'?'
)
let
[
redirectUrl
]
=
window
.
location
.
href
.
split
(
'?'
)
const
code
=
getParams
(
'code'
)
const
code
=
getParams
(
'code'
)
if
(
code
)
{
if
(
code
)
{
const
{
corpId
}
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
const
{
corpId
,
agentId
}
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
ssoApi
ssoApi
.
login
({
.
login
({
code
,
code
,
corpId
corpId
,
getUserInfoFlag
:
agentId
?
true
:
false
})
})
.
then
(({
code
,
data
})
=>
{
.
then
(({
code
,
data
})
=>
{
let
url
=
`
${
redirectUrl
.
split
(
'#'
)[
0
]}
#/`
let
url
=
`
${
redirectUrl
.
split
(
'#'
)[
0
]}
#/`
...
@@ -121,13 +122,13 @@ const actions = {
...
@@ -121,13 +122,13 @@ const actions = {
}
else
{
}
else
{
util
.
showLoading
()
util
.
showLoading
()
let
appid
=
getParams
(
'corpId'
)
//从链接获取
let
appid
=
getParams
(
'corpId'
)
//从链接获取
let
agentid
=
getParams
(
'agent
i
d'
)
//从链接获取
let
agentid
=
getParams
(
'agent
I
d'
)
//从链接获取
let
dj_scrm
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
let
dj_scrm
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
const
IS_PROD
=
[
'production'
,
'prod'
].
includes
(
process
.
env
.
NODE_ENV
)
const
IS_PROD
=
[
'production'
,
'prod'
].
includes
(
process
.
env
.
NODE_ENV
)
if
(
!
appid
)
{
if
(
!
appid
)
{
if
(
dj_scrm
)
{
if
(
dj_scrm
)
{
appid
=
dj_scrm
.
corpId
appid
=
dj_scrm
.
corpId
agentid
=
dj_scrm
.
agent
i
d
agentid
=
dj_scrm
.
agent
I
d
}
else
{
}
else
{
if
(
IS_PROD
)
{
if
(
IS_PROD
)
{
Notify
({
Notify
({
...
@@ -137,16 +138,21 @@ const actions = {
...
@@ -137,16 +138,21 @@ const actions = {
return
return
}
else
{
}
else
{
appid
=
'ww7ee69c648ae1b7e6'
appid
=
'ww7ee69c648ae1b7e6'
agentid
=
1000003
agentid
=
1000035
// appid = 'wwc1fefc2a3f70bd0b'
// agentid = 1000002
}
}
}
}
}
}
util
.
setLocalStorage
(
'dj_scrm_corpId'
,
{
corpId
:
appid
,
agentid
})
let
dj_scrm_storage
=
{
corpId
:
appid
}
let
wxUrl
=
'https://open.weixin.qq.com/connect/oauth2/authorize'
let
wxUrl
=
'https://open.weixin.qq.com/connect/oauth2/authorize'
wxUrl
=
`
${
wxUrl
}
?appid=
${
appid
}
&redirect_uri=
${
encodeURIComponent
(
redirectUrl
)}
&response_type=code&scope=snsapi_privateinfo&state=STATE`
wxUrl
=
`
${
wxUrl
}
?appid=
${
appid
}
&redirect_uri=
${
encodeURIComponent
(
redirectUrl
)}
&response_type=code&scope=snsapi_privateinfo`
if
(
agentid
)
wxUrl
=
`
${
wxUrl
}
&agentid=
${
agentid
}
`
if
(
agentid
)
{
console
.
log
(
`
${
wxUrl
}
#wechat_redirect`
)
wxUrl
=
`
${
wxUrl
}
&agentid=
${
agentid
}
`
window
.
location
.
href
=
`
${
wxUrl
}
#wechat_redirect`
dj_scrm_storage
.
agentId
=
agentid
}
util
.
setLocalStorage
(
'dj_scrm_corpId'
,
dj_scrm_storage
)
window
.
location
.
href
=
`
${
wxUrl
}
&state=STATE#wechat_redirect`
}
}
},
},
navigation
({
dispatch
},
to
)
{
navigation
({
dispatch
},
to
)
{
...
...
src/views/common/accountList.vue
View file @
2e52e76
...
@@ -83,7 +83,7 @@ export default {
...
@@ -83,7 +83,7 @@ export default {
let
redirect_uri
=
this
.
getLocalStorage
(
'dj_scrm_redirect_uri'
)
let
redirect_uri
=
this
.
getLocalStorage
(
'dj_scrm_redirect_uri'
)
this
.
setLocalStorage
(
'dj_scrm_userInfo'
,
data
)
this
.
setLocalStorage
(
'dj_scrm_userInfo'
,
data
)
this
.
setSessionId
(
data
.
sessionId
)
this
.
setSessionId
(
data
.
sessionId
)
let
{
corpId
}
=
this
.
getLocalStorage
(
'dj_scrm_corpId'
)
let
{
corpId
,
agentId
}
=
this
.
getLocalStorage
(
'dj_scrm_corpId'
)
store
.
dispatch
(
'registerHttp'
,
data
.
sessionId
)
store
.
dispatch
(
'registerHttp'
,
data
.
sessionId
)
this
.
removeLocalStorage
(
'dj_scrm_redirect_uri'
)
this
.
removeLocalStorage
(
'dj_scrm_redirect_uri'
)
this
.
showLoading
(
'登录成功'
,
()
=>
{
this
.
showLoading
(
'登录成功'
,
()
=>
{
...
@@ -91,6 +91,7 @@ export default {
...
@@ -91,6 +91,7 @@ export default {
if
(
redirect_uri
)
{
if
(
redirect_uri
)
{
let
[
URL
,
query
]
=
decodeURIComponent
(
redirect_uri
).
split
(
'?'
)
let
[
URL
,
query
]
=
decodeURIComponent
(
redirect_uri
).
split
(
'?'
)
URL
=
`
${
URL
}
?sessionId=
${
data
.
sessionId
}
&corpId=
${
corpId
}
`
URL
=
`
${
URL
}
?sessionId=
${
data
.
sessionId
}
&corpId=
${
corpId
}
`
if
(
agentId
)
URL
=
`
${
URL
}
&agentId=
${
agentId
}
`
if
(
query
)
URL
=
`
${
URL
}
&
${
query
}
`
if
(
query
)
URL
=
`
${
URL
}
&
${
query
}
`
window
.
location
.
href
=
URL
window
.
location
.
href
=
URL
}
}
...
...
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