Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-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
mongo-ui
Commits
9c8ab939
Commit
9c8ab939
authored
Sep 23, 2020
by
郝聪敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature: 神策埋点添加自定义属性
parent
9ecf9bc1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
3 deletions
+36
-3
AuthFromXyqb.vue
src/components/AuthFromXyqb.vue
+2
-0
LoginModal.vue
src/components/LoginModal.vue
+3
-0
dev.config.js
src/config/dev.config.js
+1
-1
prod.config.js
src/config/prod.config.js
+1
-1
main.js
src/main.js
+4
-1
utils.js
src/service/utils.js
+25
-0
No files found.
src/components/AuthFromXyqb.vue
View file @
9c8ab939
...
...
@@ -39,6 +39,7 @@ import { mapState, mapActions } from "vuex";
import
protocol
from
"
@/api/protocol
"
;
import
{
authByxyqb
}
from
"
@/api/user
"
;
import
localStorage
from
"
@/service/localStorage
"
;
import
{
loginSa
}
from
"
@/service/utils
"
;
export
default
{
name
:
"
AuthFromXyqb
"
,
...
...
@@ -88,6 +89,7 @@ export default {
async
confirm
()
{
const
res
=
await
authByxyqb
({
xyqbToken
:
localStorage
.
get
(
"
xyqbToken
"
)
});
localStorage
.
set
(
"
mongoToken
"
,
res
.
token
);
loginSa
(
res
.
userSecId
);
this
.
setAuthXyqb
(
4
);
},
showProtocol
(
idx
)
{
...
...
src/components/LoginModal.vue
View file @
9c8ab939
...
...
@@ -53,6 +53,8 @@ import { loginByPhone, getCaptchaSms } from "@/api/user";
import
protocol
from
"
@/api/protocol
"
;
import
{
isPhone
,
isWeixinBrower
}
from
"
@/service/validation
"
;
import
localStorage
from
"
@/service/localStorage
"
;
import
{
loginSa
}
from
"
@/service/utils
"
;
export
default
{
name
:
"
LoginModal
"
,
components
:
{
...
...
@@ -108,6 +110,7 @@ export default {
this
.
$notify
({
type
:
"
success
"
,
message
:
"
登录成功
"
});
this
.
setIsShowLogin
(
false
);
localStorage
.
set
(
"
mongoToken
"
,
res
.
token
);
loginSa
(
res
.
userSecId
);
// TODO 开发目前使用这个token
// localStorage.setItem("mongoToken", "6ae7da7dd4c543f1a36c702c6f419f12");
}
...
...
src/config/dev.config.js
View file @
9c8ab939
...
...
@@ -7,5 +7,5 @@ export default {
// basicHost: "http://192.168.29.211:8964/",
wxAppId
:
"
wx514de17b23d53a20
"
,
shenceUrl
:
`
${
protocol
}
//bn.xyqb.com/sa?project=default`
,
// 神策数据请求地址
test
:
fals
e
test
:
tru
e
};
src/config/prod.config.js
View file @
9c8ab939
...
...
@@ -7,5 +7,5 @@ export default {
sharePath
:
"
https://mangguo.qthbx.com/share.html#
"
,
wxAppId
:
"
wx514de17b23d53a20
"
,
shenceUrl
:
`
${
protocol
}
//bn.xyqb.com/sa?project=production`
,
// 神策数据请求地址
test
:
fals
e
test
:
tru
e
};
src/main.js
View file @
9c8ab939
...
...
@@ -11,6 +11,7 @@ import Raven from "raven-js";
import
RavenVue
from
"
raven-js/plugins/vue
"
;
import
config
from
"
@/config
"
;
import
{
release
}
from
"
../.sentryclirc
"
;
import
{
registerSa
}
from
"
./service/utils
"
;
Vue
.
config
.
productionTip
=
false
;
new
Vue
({
...
...
@@ -40,8 +41,10 @@ sa.init({
},
show_log
:
config
.
test
});
// 添加公共属性
sa
.
registerPage
({
platformType
:
"
H5
"
});
registerSa
();
router
.
afterEach
(()
=>
{
Vue
.
nextTick
(()
=>
{
sa
.
quick
(
"
autoTrackSinglePage
"
);
...
...
src/service/utils.js
View file @
9c8ab939
import
{
isAndroid
,
isIOS
}
from
"
./validation
"
;
import
sa
from
"
sa-sdk-javascript
"
;
import
uuidv1
from
"
uuid/v1
"
;
import
localStorage
from
"
@/service/localStorage
"
;
/**
* 替换邮箱字符
* @param {String} email 输入字符串
...
...
@@ -317,3 +321,24 @@ export function onKeyboardStateChange(callback = () => {}, off = false) {
export
function
isValidDate
(
date
)
{
return
date
instanceof
Date
&&
!
isNaN
(
date
.
getTime
());
}
// 神策注册公共属性
export
function
registerSa
()
{
// 获取uuid表示设备唯一标识
let
uuid_unloggin
=
localStorage
.
get
(
"
uuid_unloggin
"
);
if
(
!
uuid_unloggin
)
{
uuid_unloggin
=
uuidv1
();
localStorage
.
set
(
"
uuid_unloggin
"
,
uuid_unloggin
);
}
const
saObj
=
{
platformType
:
"
H5
"
,
uuid_unloggin
};
// 添加公共属性
sa
.
registerPage
(
saObj
);
loginSa
();
}
// 用户登录神策埋点
export
function
loginSa
(
uuid
=
localStorage
.
get
(
"
uuid
"
))
{
if
(
!
uuid
)
return
;
localStorage
.
set
(
"
uuid
"
,
uuid
);
sa
.
login
(
uuid
);
}
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