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 4249e5f4
authored
Nov 06, 2021
by
liwk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
8066a4a3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
32 additions
and
28 deletions
src/api/ssoApi.js
src/main.js
src/router/router.js
src/router/routes.js
src/store/modules/app.js
src/views/common/accountList.vue
src/views/home.vue
src/views/home/index.vue
src/views/workbench/index.vue
src/api/ssoApi.js
View file @
4249e5f
const
url
=
'/rop-scrm-sso/router'
const
returnAll
=
fals
e
const
returnAll
=
tru
e
export
default
{
/**OAuth2授权登陆 */
login
(
data
)
{
...
...
src/main.js
View file @
4249e5f
...
...
@@ -45,6 +45,7 @@ fetchConfig(!isMock).then(res => {
// 从配置服务器获取动态配置
// 设置 js中可以访问 $cdn
Vue
.
use
(
cfg
)
window
.
$baseUrl
=
res
.
request
.
baseURL
window
.
$HTTP
=
new
Http
({...
res
,
alert
:
components
.
Notify
})
/**登录过期 重新登录 */
...
...
src/router/router.js
View file @
4249e5f
...
...
@@ -37,7 +37,7 @@ router.beforeEach((to, from, next) => {
/* 路由发生变化修改页面title */
store
.
dispatch
(
'setPageMeta'
,
to
.
meta
)
/* 路由发生变化修改页面背景色 */
store
.
dispatch
(
'setPageBackground'
,
to
.
meta
)
document
.
documentElement
.
style
.
backgroundColor
=
to
.
meta
.
backgroundColor
||
'#fff'
next
()
})
...
...
src/router/routes.js
View file @
4249e5f
...
...
@@ -11,7 +11,7 @@ const pages = [{
meta
:
{
isTab
:
true
,
keepAlive
:
true
,
backgroundColor
:
'#
eee
'
backgroundColor
:
'#
F7F7F7
'
},
children
:
[
...
...
src/store/modules/app.js
View file @
4249e5f
...
...
@@ -12,7 +12,6 @@ import util from '@/utils/util'
const
state
=
{
pageMeta
:
''
,
keepAlives
:
[],
next
:
''
,
lastPath
:
''
}
const
mutations
=
{
...
...
@@ -32,9 +31,6 @@ const mutations = {
return
arr
},
[])
},
SET_ROUTER_OBJECT
(
state
,
next
)
{
state
.
next
=
next
},
SET_LAST_PATH
(
state
,
path
)
{
state
.
lastPath
=
path
}
...
...
@@ -65,12 +61,6 @@ const actions = {
removeKeep
({
commit
},
names
)
{
commit
(
'REMOVE_KEEP'
,
names
)
},
setRouterObjext
({
commit
},
next
)
{
commit
(
'SET_ROUTER_OBJECT'
,
next
)
},
setPageBackground
({},
{
backgroundColor
})
{
document
.
documentElement
.
style
.
backgroundColor
=
backgroundColor
||
'#fff'
},
login
()
{
let
[
redirectUrl
]
=
window
.
location
.
href
.
split
(
'?'
)
const
code
=
getParams
(
'code'
)
...
...
@@ -82,9 +72,8 @@ const actions = {
}).
then
(({
code
,
data
,
message
})
=>
{
let
url
=
`
${
redirectUrl
.
split
(
'#'
)[
0
]}
#/`
let
route
=
state
.
lastPath
==
'home'
?
''
:
state
.
lastPath
state
.
appFlag
=
true
state
.
showWindow
=
true
if
(
code
==
'0'
)
{
console
.
log
(
data
)
if
(
data
.
loginList
.
length
)
{
if
(
data
.
loginList
.
length
>
1
)
{
util
.
setLocalStorage
(
'dj_scrm_loginToken'
,
data
.
loginToken
)
...
...
@@ -124,7 +113,7 @@ const actions = {
let
accountList
=
util
.
getLocalStorage
(
'dj_scrm_accountList'
)
if
(
!
userInfo
)
{
if
(
loginToken
&&
accountList
)
{
state
.
appFlag
=
true
state
.
showWindow
=
true
router
.
replace
({
name
:
'common.accountList'
})
return
}
else
{
...
...
@@ -132,7 +121,7 @@ const actions = {
return
}
}
state
.
appFlag
=
true
state
.
showWindow
=
true
}
}
const
getParams
=
name
=>
{
...
...
src/views/common/accountList.vue
View file @
4249e5f
...
...
@@ -59,13 +59,15 @@ export default {
this
.
hideLoading
()
this
.
removeLocalStorage
(
'dj_scrm_loginToken'
)
this
.
removeLocalStorage
(
'dj_scrm_accountList'
)
if
(
code
==
'0'
)
{
if
(
data
)
{
let
{
lastPath
}
=
this
.
getQuery
()
let
{
lastPath
,
redirect_uri
}
=
this
.
getQuery
()
this
.
setLocalStorage
(
'dj_scrm_userInfo'
,
data
)
this
.
setLocalStorage
(
'dj_scrm_session_id'
,
data
.
sessionId
)
this
.
showLoading
(
'登录成功'
,
()
=>
{
this
.
$router
.
replace
({
name
:
lastPath
||
'home'
})
if
(
redirect_uri
)
window
.
location
.
replace
(
decodeURIComponent
(
`
${
redirect_uri
}
?sessionId=
${
data
.
sessionId
}
`
))
else
this
.
$router
.
replace
({
name
:
lastPath
||
'home'
})
})
}
}
else
{
...
...
src/views/home.vue
View file @
4249e5f
<!-- home -->
<
template
>
<div
class=
"container"
>
<template
v-if=
"
appFlag
"
>
<template
v-if=
"
showWindow
"
>
<transition
name=
"fade"
>
<keep-alive
v-if=
"$route.meta.keepAlive"
>
<router-view></router-view>
...
...
@@ -30,21 +30,21 @@ export default {
name
:
'workbench'
,
}
],
appFlag
:
false
,
showWindow
:
false
,
}
},
watch
:
{
watchFlag
:
{
immediate
:
true
,
handler
(
newval
)
{
this
.
appFlag
=
newval
this
.
showWindow
=
newval
this
.
hideLoading
()
}
}
},
computed
:
{
watchFlag
()
{
return
this
.
$store
.
state
.
app
.
appFlag
return
this
.
$store
.
state
.
app
.
showWindow
}
},
...
...
src/views/home/index.vue
View file @
4249e5f
<
template
>
<div
class=
"layout"
>
首页
我的待办
</div>
</
template
>
...
...
src/views/workbench/index.vue
View file @
4249e5f
...
...
@@ -17,6 +17,7 @@
<div
:key=
"index"
class=
"item"
@
click=
"jump(i)"
>
<div
:class=
"['sprite-icon',`icon-$
{index + 4}`]">
</div>
{{
i
.
name
}}
...
...
@@ -54,7 +55,7 @@ export default {
return
{
utilsList
:
[
{
name
:
'核销卡券'
name
:
'核销卡券'
,
},
{
name
:
'批量打标签'
...
...
@@ -68,13 +69,17 @@ export default {
],
list
:
[
{
name
:
'我要发券'
name
:
'我要发券'
,
link
:
'/dj-scrm-wx-work-attachment-activity/#/coupon'
},
{
name
:
'秒杀活动'
name
:
'秒杀活动'
,
link
:
'/dj-scrm-wx-work-attachment-activity/#/activity'
},
{
name
:
'直播活动'
name
:
'直播活动'
,
link
:
'/dj-scrm-wx-work-attachment-activity/#/activity'
,
params
:
'tabIndex=1'
}
]
}
...
...
@@ -82,6 +87,13 @@ export default {
mounted
()
{
},
methods
:
{
jump
(
e
)
{
let
sessionId
=
this
.
getLocalStorage
(
'dj_scrm_session_id'
)
let
{
link
,
params
}
=
e
let
url
=
`
${
window
.
$baseUrl
}${
link
}
?sessionId=
${
sessionId
}
`
if
(
params
)
`
${
url
}
&
${
params
}
`
window
.
location
.
replace
(
url
)
}
}
}
</
script
>
...
...
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