Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
phobos-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
phobos-ui
Commits
e9223792
Commit
e9223792
authored
Dec 22, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature(sa): 完成调整
parent
63000d25
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
init.service.js
src/service/init.service.js
+12
-1
sa.service.js
src/service/sa.service.js
+16
-1
No files found.
src/service/init.service.js
View file @
e9223792
...
...
@@ -6,6 +6,7 @@ import { isWechat, isApp, isAndroid, isIOS } from './validation.service';
import
Cookies
from
'
./cookieStorage.service
'
;
import
localStorage
from
'
./localStorage.service
'
;
import
sessionStorage
from
'
./sessionStorage.service
'
;
import
{
loginSa
}
from
'
./sa.service
'
;
// import { Toast } from '@qg/cherry-ui';
export
default
{
...
...
@@ -24,7 +25,14 @@ export default {
isIOS
&&
localStorage
.
set
(
'
vccChannel
'
,
'
214
'
);
isAndroid
&&
localStorage
.
set
(
'
vccChannel
'
,
'
217
'
);
meta
?.
has
?.
header
&&
store
.
commit
(
'
CHANGE_HEADER
'
,
meta
.
has
.
header
);
// 改变header
const
localParams
=
[
'
redirectUrl
'
,
'
h
'
,
'
vccToken
'
,
'
vccChannel
'
,
'
sonVccChannel
'
];
const
localParams
=
[
'
redirectUrl
'
,
'
h
'
,
'
vccToken
'
,
'
vccChannel
'
,
'
sonVccChannel
'
,
'
distinctID
'
];
// TODO: 类似逻辑可以整合
localParams
.
forEach
(
item
=>
{
const
value
=
to
.
query
[
item
];
...
...
@@ -36,6 +44,9 @@ export default {
localStorage
.
set
(
item
,
value
);
sessionStorage
.
set
(
item
,
value
);
}
if
(
item
===
'
distinctID
'
&&
to
.
query
[
item
])
{
loginSa
(
to
.
query
[
item
]);
}
});
(
isWechat
||
isApp
||
Cookies
.
get
(
'
h
'
)
===
'
0
'
)
&&
store
.
commit
(
'
CHANGE_HEADER
'
,
false
);
// 改变header
document
.
body
.
className
=
store
.
state
.
pay
.
header
?
'
has-header
'
:
''
;
...
...
src/service/sa.service.js
View file @
e9223792
import
Vue
from
'
vue
'
;
import
sa
from
'
sa-sdk-javascript
'
;
import
config
from
'
@/config
'
;
cons
ole
.
log
(
config
)
;
cons
t
saCookiesKey
=
'
sensorsdata2015jssdkcross
'
;
export
default
{
init
:
function
(
router
)
{
sa
.
init
({
...
...
@@ -41,3 +41,18 @@ export function saDeviceId() {
export
function
setRegisterPage
(
registerPageObj
)
{
sa
.
registerPage
(
registerPageObj
);
}
// 用户登录神策埋点
export
function
loginSa
(
uuid
=
localStorage
.
get
(
'
uuid
'
))
{
if
(
!
uuid
)
return
;
localStorage
.
set
(
'
uuid
'
,
uuid
);
sa
.
login
(
uuid
);
}
export
function
saDistinctId
()
{
const
reg
=
new
RegExp
(
`(^| )
${
saCookiesKey
}
=([^;]*)(;|$)`
);
let
cookieValue
=
document
.
cookie
.
match
(
reg
);
if
(
!
cookieValue
)
return
''
;
cookieValue
=
JSON
.
parse
(
decodeURIComponent
(
cookieValue
[
2
]));
return
cookieValue
.
distinct_id
||
''
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment