Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-h5-ailipay
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 09d50f8b
authored
Nov 30, 2021
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
fe39c4eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
52 deletions
src/components/Share.vue
src/store/modules/app.js
src/components/Share.vue
View file @
09d50f8
...
...
@@ -61,9 +61,11 @@ export default {
let
options
=
this
.
tools
.
deepClone
(
staticOptions
)
if
(
apiName
==
'couponApi'
||
apiName
==
'boutiquecouponApi'
||
apiName
==
'equityApi'
)
{
options
[
1
].
className
=
'disabled'
this
.
options
=
options
this
.
showShare
=
true
return
}
console
.
log
(
options
)
this
.
options
=
options
if
(
apiName
==
'activityApi'
||
apiName
==
'liveApi'
)
{
this
.
showLoading
()
...
...
src/store/modules/app.js
View file @
09d50f8
...
...
@@ -35,7 +35,6 @@ const mutations = {
SET_LAST_PATH
(
state
,
path
)
{
state
.
lastPath
=
path
}
}
const
actions
=
{
setPageMeta
({
commit
},
meta
)
{
...
...
@@ -56,68 +55,68 @@ const actions = {
},
login
({
dispatch
})
{
let
[
redirectUrl
]
=
window
.
location
.
href
.
split
(
'?'
)
// 以下是 本地调试
// 以下是 本地调试
if
(
process
.
env
.
NODE_ENV
==
'development'
)
{
const
code
=
getParams
(
'code'
)
if
(
code
)
{
const
{
corpId
}
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
ssoApi
.
login
({
code
,
corpId
}).
then
(({
code
,
data
,
message
})
=>
{
let
route
=
state
.
lastPath
==
'coupon'
?
''
:
state
.
lastPath
||
''
route
=
route
.
replace
(
'.'
,
'/'
)
state
.
showWindow
=
true
if
(
code
==
'0'
)
{
if
(
data
.
loginList
.
length
)
{
if
(
data
.
loginList
.
length
>
1
)
{
util
.
setLocalStorage
(
'dj_scrm_loginToken'
,
data
.
loginToken
)
util
.
setLocalStorage
(
'dj_scrm_accountList'
,
data
.
loginList
)
let
userInfo
=
data
.
loginList
[
2
]
let
{
merchantId
,
accountName
}
=
userInfo
let
loginAccount
=
accountName
ssoApi
.
selectAccount
({
loginAccount
,
merchantId
,
loginToken
:
data
.
loginToken
,
loginSource
:
'WW'
,
loginType
:
3
}).
then
(
res
=>
{
util
.
removeLocalStorage
(
'dj_scrm_loginToken'
)
util
.
removeLocalStorage
(
'dj_scrm_accountList'
)
util
.
setLocalStorage
(
'dj_scrm_userInfo'
,
res
.
data
)
util
.
setSessionId
(
res
.
data
.
sessionId
)
dispatch
(
'registerHttp'
,
res
.
data
.
sessionId
)
ssoApi
.
login
({
code
,
corpId
})
.
then
(({
code
,
data
,
message
})
=>
{
let
route
=
state
.
lastPath
==
'coupon'
?
''
:
state
.
lastPath
||
''
route
=
route
.
replace
(
'.'
,
'/'
)
if
(
code
==
'0'
)
{
if
(
data
.
loginList
.
length
)
{
if
(
data
.
loginList
.
length
>
1
)
{
let
userInfo
=
data
.
loginList
[
2
]
let
{
merchantId
,
accountName
}
=
userInfo
let
loginAccount
=
accountName
ssoApi
.
selectAccount
({
loginAccount
,
merchantId
,
loginToken
:
data
.
loginToken
,
loginSource
:
'WW'
,
loginType
:
3
})
.
then
(
res
=>
{
util
.
setLocalStorage
(
'dj_scrm_userInfo'
,
res
.
data
)
util
.
setSessionId
(
res
.
data
.
sessionId
)
dispatch
(
'registerHttp'
,
res
.
data
.
sessionId
)
state
.
showWindow
=
true
window
.
location
.
replace
(
`
${
redirectUrl
}
#/
${
route
}
`
)
})
}
else
{
let
[
userInfo
]
=
data
.
loginList
util
.
setLocalStorage
(
'dj_scrm_userInfo'
,
userInfo
)
util
.
setSessionId
(
userInfo
.
sessionId
)
dispatch
(
'registerHttp'
,
userInfo
.
sessionId
)
// 只有一个账号 history.back()
console
.
log
(
`
${
redirectUrl
}${
route
}
`
)
state
.
showWindow
=
true
window
.
location
.
replace
(
`
${
redirectUrl
}
#/
${
route
}
`
)
}
)
}
}
else
{
let
[
userInfo
]
=
data
.
loginList
util
.
setLocalStorage
(
'dj_scrm_userInfo'
,
userInfo
)
util
.
setSessionId
(
userInfo
.
sessionId
)
dispatch
(
'registerHttp'
,
userInfo
.
sessionId
)
// 只有一个账号 history.back()
console
.
log
(
`
${
redirectUrl
}${
route
}
`
)
window
.
location
.
replace
(
`
${
redirectUrl
}
#/
${
route
}
`
)
/**没有账号 */
Notify
(
'没有账号'
)
// window.location.href = `${url}common/nothing`
}
}
else
{
/**没有账号 */
// window.location.href = `${url}common/nothing`
}
}
else
{
/**账号过期 (暂时没有字段判断是否过期) */
Notify
(
message
)
/**账号过期 (暂时没有字段判断是否过期) */
Notify
(
message
)
// window.location.href = `${url}common/overdue`
}
})
}
})
}
else
{
util
.
showLoading
()
let
appid
=
getParams
(
'corpId'
)
//从链接获取
let
dj_scrm
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
if
(
!
appid
)
appid
=
dj_scrm
&&
dj_scrm
.
corpId
||
'ww7ee69c648ae1b7e6'
//
if
(
!
appid
)
appid
=
(
dj_scrm
&&
dj_scrm
.
corpId
)
||
'ww7ee69c648ae1b7e6'
util
.
setLocalStorage
(
'dj_scrm_corpId'
,
{
corpId
:
appid
})
// 'ww657a2d4ae89a4424'
// 'ww657a2d4ae89a4424'
const
wxUrl
=
'https://open.weixin.qq.com/connect/oauth2/authorize'
window
.
location
.
href
=
`
${
wxUrl
}
?appid=
${
appid
}
&redirect_uri=
${
encodeURIComponent
(
redirectUrl
)}
&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
}
...
...
@@ -132,7 +131,7 @@ const actions = {
let
{
sessionId
,
corpId
}
=
getParams
()
const
storage_sessionId
=
util
.
getSessionId
()
const
storage_corpId
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
if
(
!
corpId
)
corpId
=
storage_corpId
&&
storage_corpId
.
corpId
||
'ww7ee69c648ae1b7e6'
if
(
!
corpId
)
corpId
=
(
storage_corpId
&&
storage_corpId
.
corpId
)
||
'ww7ee69c648ae1b7e6'
util
.
setLocalStorage
(
'dj_scrm_corpId'
,
{
corpId
})
if
(
sessionId
||
storage_sessionId
)
{
state
.
showWindow
=
true
...
...
@@ -147,7 +146,7 @@ const actions = {
state
.
showWindow
=
true
},
registerHttp
({},
sessionId
=
''
)
{
window
.
$HTTP
=
new
Http
({...
window
.
$fetchConfig
,
alert
:
Notify
,
headers
:
{
token
:
sessionId
}
})
window
.
$HTTP
=
new
Http
({
...
window
.
$fetchConfig
,
alert
:
Notify
,
headers
:
{
token
:
sessionId
}
})
}
}
const
getParams
=
name
=>
{
...
...
@@ -165,4 +164,4 @@ export default {
state
,
mutations
,
actions
}
\ No newline at end of file
}
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