Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
dj-scrm-wx-work-attachment-customer
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 cfdcadd9
authored
Nov 06, 2021
by
liwk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
commit
1 parent
8295007d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
10 deletions
src/main.js
src/store/modules/app.js
src/utils/index.js
src/utils/util.js
src/main.js
View file @
cfdcadd
...
@@ -22,7 +22,6 @@ import './utils/util'
...
@@ -22,7 +22,6 @@ import './utils/util'
import
'components'
import
'components'
import
{
components
}
from
'@/plugins/vant'
import
{
components
}
from
'@/plugins/vant'
components
.
forEach
(
component
=>
Vue
.
use
(
component
))
components
.
forEach
(
component
=>
Vue
.
use
(
component
))
import
{
Http
}
from
'glsx-common'
Vue
.
prototype
.
api
=
api
Vue
.
prototype
.
api
=
api
Vue
.
prototype
.
bus
=
bus
Vue
.
prototype
.
bus
=
bus
Vue
.
prototype
.
tools
=
tools
Vue
.
prototype
.
tools
=
tools
...
@@ -47,9 +46,7 @@ fetchConfig(!isMock).then(res => {
...
@@ -47,9 +46,7 @@ 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 @
cfdcadd
...
@@ -7,8 +7,10 @@
...
@@ -7,8 +7,10 @@
* @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
:
[],
...
@@ -79,7 +81,8 @@ const actions = {
...
@@ -79,7 +81,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
)
registerHttp
(
userInfo
.
sessionId
)
// 只有一个账号 history.back()
// 只有一个账号 history.back()
console
.
log
(
`
${
redirectUrl
}${
route
}
`
)
console
.
log
(
`
${
redirectUrl
}${
route
}
`
)
window
.
location
.
replace
(
`
${
redirectUrl
}${
route
}
`
)
window
.
location
.
replace
(
`
${
redirectUrl
}${
route
}
`
)
...
@@ -107,10 +110,11 @@ const actions = {
...
@@ -107,10 +110,11 @@ const actions = {
navigation
({
dispatch
})
{
navigation
({
dispatch
})
{
util
.
showLoading
()
util
.
showLoading
()
const
sessionId
=
getParams
(
'sessionId'
)
const
sessionId
=
getParams
(
'sessionId'
)
const
storage_sessionId
=
util
.
get
LocalStorage
(
'dj_scrm_session_id'
)
const
storage_sessionId
=
util
.
get
SessionId
(
)
if
(
sessionId
||
storage_sessionId
)
{
if
(
sessionId
||
storage_sessionId
)
{
state
.
showWindow
=
true
state
.
showWindow
=
true
util
.
setLocalStorage
(
'dj_scrm_session_id'
,
sessionId
||
storage_sessionId
)
util
.
setSessionId
(
sessionId
||
storage_sessionId
)
registerHttp
(
sessionId
||
storage_sessionId
)
}
else
{
}
else
{
dispatch
(
'login'
)
dispatch
(
'login'
)
return
return
...
@@ -118,6 +122,10 @@ const actions = {
...
@@ -118,6 +122,10 @@ const actions = {
state
.
showWindow
=
true
state
.
showWindow
=
true
}
}
}
}
const
registerHttp
=
sessionId
=>
{
window
.
$HTTP
=
new
Http
({...
window
.
$fetchConfig
,
alert
:
Notify
,
headers
:
{
token
:
sessionId
}
})
console
.
log
(
window
.
$HTTP
)
}
const
getParams
=
name
=>
{
const
getParams
=
name
=>
{
let
[
url
,
paramsList
]
=
window
.
location
.
href
.
split
(
'?'
)
let
[
url
,
paramsList
]
=
window
.
location
.
href
.
split
(
'?'
)
if
(
!
paramsList
)
return
name
?
null
:
{}
if
(
!
paramsList
)
return
name
?
null
:
{}
...
...
src/utils/index.js
View file @
cfdcadd
...
@@ -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 @
cfdcadd
...
@@ -79,6 +79,12 @@ const touchstart = e => {
...
@@ -79,6 +79,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
))
}
}
...
@@ -164,6 +170,8 @@ const utils = {
...
@@ -164,6 +170,8 @@ const utils = {
makePhoneCall
,
makePhoneCall
,
isFullSucreen
,
isFullSucreen
,
watchPageBack
,
watchPageBack
,
setSessionId
,
getSessionId
,
showLoading
,
showLoading
,
hideLoading
,
hideLoading
,
refreshPage
,
refreshPage
,
...
...
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