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 b101b417
authored
Nov 06, 2021
by
liwk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
4249e5f4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
16 deletions
src/main.js
src/store/modules/app.js
src/utils/index.js
src/utils/util.js
src/views/common/accountList.vue
src/views/workbench/index.vue
src/main.js
View file @
b101b41
...
@@ -21,7 +21,6 @@ import { bus, tools, store as local } from './utils'
...
@@ -21,7 +21,6 @@ import { bus, tools, store as local } from './utils'
import
'./utils/util'
import
'./utils/util'
import
'components'
import
'components'
import
{
components
}
from
'@/plugins/vant'
import
{
components
}
from
'@/plugins/vant'
import
{
Http
}
from
'glsx-common'
components
.
forEach
(
component
=>
Vue
.
use
(
component
))
components
.
forEach
(
component
=>
Vue
.
use
(
component
))
Vue
.
prototype
.
api
=
api
Vue
.
prototype
.
api
=
api
Vue
.
prototype
.
bus
=
bus
Vue
.
prototype
.
bus
=
bus
...
@@ -45,10 +44,8 @@ fetchConfig(!isMock).then(res => {
...
@@ -45,10 +44,8 @@ fetchConfig(!isMock).then(res => {
// 从配置服务器获取动态配置
// 从配置服务器获取动态配置
// 设置 js中可以访问 $cdn
// 设置 js中可以访问 $cdn
Vue
.
use
(
cfg
)
Vue
.
use
(
cfg
)
window
.
$baseUrl
=
res
.
request
.
baseURL
window
.
$fetchConfig
=
res
window
.
$HTTP
=
new
Http
({...
res
,
alert
:
components
.
Notify
})
/**登录过期 重新登录 */
/**登录过期 重新登录 */
window
.
reLogin
=
()
=>
{
window
.
reLogin
=
()
=>
{
console
.
log
(
123
)
console
.
log
(
123
)
}
}
...
...
src/store/modules/app.js
View file @
b101b41
...
@@ -7,8 +7,9 @@
...
@@ -7,8 +7,9 @@
* @LastEditTime: 2021-07-06 12:02:21
* @LastEditTime: 2021-07-06 12:02:21
*/
*/
import
{
ssoApi
}
from
'@/api'
import
{
ssoApi
}
from
'@/api'
import
{
store
}
from
'utils'
import
{
store
,
util
}
from
'utils'
import
util
from
'@/utils/util'
import
{
Http
}
from
'glsx-common'
import
{
Notify
}
from
'vant'
const
state
=
{
const
state
=
{
pageMeta
:
''
,
pageMeta
:
''
,
keepAlives
:
[],
keepAlives
:
[],
...
@@ -61,11 +62,14 @@ const actions = {
...
@@ -61,11 +62,14 @@ const actions = {
removeKeep
({
commit
},
names
)
{
removeKeep
({
commit
},
names
)
{
commit
(
'REMOVE_KEEP'
,
names
)
commit
(
'REMOVE_KEEP'
,
names
)
},
},
registerHttp
({},
sessionId
=
''
)
{
window
.
$HTTP
=
new
Http
({...
window
.
$fetchConfig
,
alert
:
Notify
,
headers
:
{
token
:
sessionId
}
})
},
login
()
{
login
()
{
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
}
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
ssoApi
.
login
({
ssoApi
.
login
({
code
,
code
,
corpId
corpId
...
@@ -82,7 +86,8 @@ const actions = {
...
@@ -82,7 +86,8 @@ const actions = {
}
else
{
}
else
{
let
[
userInfo
]
=
data
.
loginList
let
[
userInfo
]
=
data
.
loginList
util
.
setLocalStorage
(
'dj_scrm_userInfo'
,
userInfo
)
util
.
setLocalStorage
(
'dj_scrm_userInfo'
,
userInfo
)
util
.
setLocalStorage
(
'dj_scrm_session_id'
,
userInfo
.
sessionId
)
util
.
setSessionId
(
userInfo
.
sessionId
)
dispatch
(
'registerHttp'
,
userInfo
.
sessionId
)
// 只有一个账号 history.back()
// 只有一个账号 history.back()
window
.
location
.
replace
(
`
${
url
}${
route
}
`
)
window
.
location
.
replace
(
`
${
url
}${
route
}
`
)
}
}
...
@@ -100,7 +105,7 @@ const actions = {
...
@@ -100,7 +105,7 @@ const actions = {
util
.
showLoading
()
util
.
showLoading
()
let
corpId
=
getParams
(
'corpId'
)
//从链接获取
let
corpId
=
getParams
(
'corpId'
)
//从链接获取
if
(
!
corpId
)
corpId
=
'ww7ee69c648ae1b7e6'
if
(
!
corpId
)
corpId
=
'ww7ee69c648ae1b7e6'
util
.
setLocalStorage
(
'dj_scrm_corpId'
,
corpId
)
util
.
setLocalStorage
(
'dj_scrm_corpId'
,
{
corpId
}
)
// 'ww657a2d4ae89a4424'
// 'ww657a2d4ae89a4424'
const
wxUrl
=
'https://open.weixin.qq.com/connect/oauth2/authorize'
const
wxUrl
=
'https://open.weixin.qq.com/connect/oauth2/authorize'
window
.
location
.
replace
(
`
${
wxUrl
}
?appid=
${
corpId
}
&redirect_uri=
${
encodeURIComponent
(
redirectUrl
)}
&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
)
window
.
location
.
replace
(
`
${
wxUrl
}
?appid=
${
corpId
}
&redirect_uri=
${
encodeURIComponent
(
redirectUrl
)}
&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
)
...
@@ -111,6 +116,7 @@ const actions = {
...
@@ -111,6 +116,7 @@ const actions = {
let
loginToken
=
util
.
getLocalStorage
(
'dj_scrm_loginToken'
)
let
loginToken
=
util
.
getLocalStorage
(
'dj_scrm_loginToken'
)
let
userInfo
=
util
.
getLocalStorage
(
'dj_scrm_userInfo'
)
let
userInfo
=
util
.
getLocalStorage
(
'dj_scrm_userInfo'
)
let
accountList
=
util
.
getLocalStorage
(
'dj_scrm_accountList'
)
let
accountList
=
util
.
getLocalStorage
(
'dj_scrm_accountList'
)
dispatch
(
'registerHttp'
)
if
(
!
userInfo
)
{
if
(
!
userInfo
)
{
if
(
loginToken
&&
accountList
)
{
if
(
loginToken
&&
accountList
)
{
state
.
showWindow
=
true
state
.
showWindow
=
true
...
...
src/utils/index.js
View file @
b101b41
...
@@ -7,8 +7,9 @@
...
@@ -7,8 +7,9 @@
* @LastEditTime: 2021-06-20 12:49:11
* @LastEditTime: 2021-06-20 12:49:11
*/
*/
import
bus
from
'./eventBus'
import
bus
from
'./eventBus'
import
util
from
'./util'
import
*
as
tool
from
'./tools'
import
*
as
tool
from
'./tools'
const
{
debounce
,
throttle
,
...
tools
}
=
tool
const
{
debounce
,
throttle
,
...
tools
}
=
tool
import
*
as
constants
from
'./constants'
import
*
as
constants
from
'./constants'
import
store
from
'./store'
import
store
from
'./store'
export
{
bus
,
tools
,
debounce
,
throttle
,
constants
,
store
}
\ No newline at end of file
\ No newline at end of file
export
{
bus
,
tools
,
debounce
,
throttle
,
constants
,
store
,
util
}
\ No newline at end of file
\ No newline at end of file
src/utils/util.js
View file @
b101b41
...
@@ -83,6 +83,12 @@ const touchstart = e => {
...
@@ -83,6 +83,12 @@ const touchstart = e => {
const
touchend
=
e
=>
{
const
touchend
=
e
=>
{
e
.
target
.
classList
.
remove
(
'btn-on-leave'
)
e
.
target
.
classList
.
remove
(
'btn-on-leave'
)
}
}
const
setSessionId
=
val
=>
{
window
.
localStorage
.
setItem
(
'dj_scrm_session_id'
,
val
)
}
const
getSessionId
=
()
=>
{
return
window
.
localStorage
.
getItem
(
'dj_scrm_session_id'
)
}
const
setLocalStorage
=
(
key
,
item
)
=>
{
const
setLocalStorage
=
(
key
,
item
)
=>
{
window
.
localStorage
.
setItem
(
key
,
JSON
.
stringify
(
item
))
window
.
localStorage
.
setItem
(
key
,
JSON
.
stringify
(
item
))
// sessionStorage.setItem(key, JSON.stringify(item))
// sessionStorage.setItem(key, JSON.stringify(item))
...
@@ -166,6 +172,8 @@ const utils = {
...
@@ -166,6 +172,8 @@ const utils = {
getLocalStorage
,
getLocalStorage
,
makePhoneCall
,
makePhoneCall
,
isFullSucreen
,
isFullSucreen
,
setSessionId
,
getSessionId
,
showLoading
,
showLoading
,
hideLoading
,
hideLoading
,
refreshPage
,
refreshPage
,
...
...
src/views/common/accountList.vue
View file @
b101b41
...
@@ -59,12 +59,12 @@ export default {
...
@@ -59,12 +59,12 @@ export default {
this
.
hideLoading
()
this
.
hideLoading
()
this
.
removeLocalStorage
(
'dj_scrm_loginToken'
)
this
.
removeLocalStorage
(
'dj_scrm_loginToken'
)
this
.
removeLocalStorage
(
'dj_scrm_accountList'
)
this
.
removeLocalStorage
(
'dj_scrm_accountList'
)
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
if
(
data
)
{
if
(
data
)
{
let
{
lastPath
,
redirect_uri
}
=
this
.
getQuery
()
let
{
lastPath
,
redirect_uri
}
=
this
.
getQuery
()
this
.
setLocalStorage
(
'dj_scrm_userInfo'
,
data
)
this
.
setLocalStorage
(
'dj_scrm_userInfo'
,
data
)
this
.
setLocalStorage
(
'dj_scrm_session_id'
,
data
.
sessionId
)
this
.
setSessionId
(
data
.
sessionId
)
store
.
dispatch
(
'registerHttp'
,
data
.
sessionId
)
this
.
showLoading
(
'登录成功'
,
()
=>
{
this
.
showLoading
(
'登录成功'
,
()
=>
{
if
(
redirect_uri
)
window
.
location
.
replace
(
decodeURIComponent
(
`
${
redirect_uri
}
?sessionId=
${
data
.
sessionId
}
`
))
if
(
redirect_uri
)
window
.
location
.
replace
(
decodeURIComponent
(
`
${
redirect_uri
}
?sessionId=
${
data
.
sessionId
}
`
))
else
this
.
$router
.
replace
({
name
:
lastPath
||
'home'
})
else
this
.
$router
.
replace
({
name
:
lastPath
||
'home'
})
...
...
src/views/workbench/index.vue
View file @
b101b41
...
@@ -70,7 +70,7 @@ export default {
...
@@ -70,7 +70,7 @@ export default {
list
:
[
list
:
[
{
{
name
:
'我要发券'
,
name
:
'我要发券'
,
link
:
'/dj-scrm-wx-work-attachment-activity/#/coupon'
link
:
'/dj-scrm-wx-work-
main/
attachment-activity/#/coupon'
},
},
{
{
name
:
'秒杀活动'
,
name
:
'秒杀活动'
,
...
@@ -88,9 +88,9 @@ export default {
...
@@ -88,9 +88,9 @@ export default {
},
},
methods
:
{
methods
:
{
jump
(
e
)
{
jump
(
e
)
{
let
sessionId
=
this
.
get
LocalStorage
(
'dj_scrm_session_id'
)
let
sessionId
=
this
.
get
SessionId
(
)
let
{
link
,
params
}
=
e
let
{
link
,
params
}
=
e
let
url
=
`
${
window
.
$baseUrl
}${
link
}
?sessionId=
${
sessionId
}
`
let
url
=
`
${
link
}
?sessionId=
${
sessionId
}
`
if
(
params
)
`
${
url
}
&
${
params
}
`
if
(
params
)
`
${
url
}
&
${
params
}
`
window
.
location
.
replace
(
url
)
window
.
location
.
replace
(
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