Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
ai-card
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 7946f2a8
authored
Sep 08, 2022
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改埋点
1 parent
8d35ac73
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
14 deletions
api/api.js
api/environment.js
api/ssoApi.js
api/wechantApi.js → api/wechatApi.js
app.js
utils/Track.js
api/api.js
View file @
7946f2a
import
api
from
'./request'
import
api
from
'./request'
import
ssoApi
from
'./ssoApi'
import
ssoApi
from
'./ssoApi'
import
wecha
ntApi
from
'./wechan
tApi'
import
wecha
tApi
from
'./wecha
tApi'
import
entmicroApi
from
'./entmicroApi'
import
entmicroApi
from
'./entmicroApi'
const
common
=
'scrm.api.carlife.common.'
const
common
=
'scrm.api.carlife.common.'
module
.
exports
=
{
module
.
exports
=
{
ssoApi
,
ssoApi
,
entmicroApi
,
entmicroApi
,
wecha
n
tApi
,
wechatApi
,
commonApi
:
{
commonApi
:
{
/**上传图片
/**上传图片
*/
*/
...
...
api/environment.js
View file @
7946f2a
...
@@ -6,7 +6,7 @@ const target = ["ip", "dev", "uat", "prod"];
...
@@ -6,7 +6,7 @@ const target = ["ip", "dev", "uat", "prod"];
2测试
2测试
3生产
3生产
*/
*/
const
index
=
1
;
const
index
=
2
;
const
secretKey
=
{
const
secretKey
=
{
ip
:
{},
ip
:
{},
dev
:
{
dev
:
{
...
@@ -38,7 +38,7 @@ const domain = {
...
@@ -38,7 +38,7 @@ const domain = {
const
pathEnum
=
{
const
pathEnum
=
{
sso
:
'/rop-scrm-sso/'
,
sso
:
'/rop-scrm-sso/'
,
wechat
:
'/rop-scrm-
sso
/'
,
wechat
:
'/rop-scrm-
wechat
/'
,
business
:
'/rop-scrm-entmicro/'
business
:
'/rop-scrm-entmicro/'
}
}
module
.
exports
=
{
module
.
exports
=
{
...
...
api/ssoApi.js
View file @
7946f2a
...
@@ -22,6 +22,13 @@ module.exports = {
...
@@ -22,6 +22,13 @@ module.exports = {
...
data
...
data
},
true
)
},
true
)
},
},
/**根据openId获取用户信息 */
getUserInfo
(
data
)
{
return
api
.
post
({
method
:
`
${
path
}
userProfile.getUserInfo`
,
...
data
},
true
)
},
/**退出 */
/**退出 */
logout
()
{
logout
()
{
return
api
.
post
({
return
api
.
post
({
...
...
api/wecha
n
tApi.js
→
api/wechatApi.js
View file @
7946f2a
import
api
from
'./request'
import
api
from
'./request'
const
path
=
'scrm.api.wechat.'
const
path
=
'scrm.api.wechat.'
module
.
exports
=
{
module
.
exports
=
{
/**
根据openId获取用户信息
*/
/**
解析scene
*/
get
UserInfo
(
data
)
{
get
SceneById
(
data
)
{
return
api
.
post
({
return
api
.
post
({
method
:
`
${
path
}
weapp.userProfile.getUserInfo
`
,
method
:
`
${
path
}
get.scene.by.id
`
,
...
data
...
data
},
true
)
},
true
)
}
,
}
}
}
app.js
View file @
7946f2a
...
@@ -4,8 +4,9 @@ import util from './utils/util.js'
...
@@ -4,8 +4,9 @@ import util from './utils/util.js'
import
'./utils/Track'
import
'./utils/Track'
import
{
import
{
ssoApi
,
ssoApi
,
wecha
n
tApi
wechatApi
}
from
'./api/api'
}
from
'./api/api'
import
{
trackData
}
from
'./utils/data'
App
({
App
({
onLaunch
:
function
(
options
)
{
onLaunch
:
function
(
options
)
{
/**挂载到wx对象 */
/**挂载到wx对象 */
...
@@ -13,6 +14,7 @@ App({
...
@@ -13,6 +14,7 @@ App({
wx
.
$router
=
router
wx
.
$router
=
router
wx
.
$imgUrl
=
'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
wx
.
$imgUrl
=
'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
wx
.
$appId
=
wx
.
getAccountInfoSync
().
miniProgram
.
appId
wx
.
$appId
=
wx
.
getAccountInfoSync
().
miniProgram
.
appId
wx
.
$trackData
=
options
.
query
this
.
globalData
.
appId
=
wx
.
getAccountInfoSync
().
miniProgram
.
appId
this
.
globalData
.
appId
=
wx
.
getAccountInfoSync
().
miniProgram
.
appId
const
systemInfo
=
wx
.
getStorageSync
(
'srcm_shopmall_system_info'
)
const
systemInfo
=
wx
.
getStorageSync
(
'srcm_shopmall_system_info'
)
if
(
!
systemInfo
)
wx
.
getSystemInfo
({
if
(
!
systemInfo
)
wx
.
getSystemInfo
({
...
@@ -21,7 +23,10 @@ App({
...
@@ -21,7 +23,10 @@ App({
}
}
})
})
console
.
log
(
options
)
console
.
log
(
options
)
this
.
login
()
if
(
options
.
path
!=
'pages/tab/index/index'
)
{
this
.
login
()
}
},
},
login
(
returnResponse
)
{
login
(
returnResponse
)
{
let
_this
=
this
let
_this
=
this
...
@@ -38,7 +43,7 @@ App({
...
@@ -38,7 +43,7 @@ App({
wx
.
$authStatus
=
res
.
code
!=
0
wx
.
$authStatus
=
res
.
code
!=
0
util
.
setSessionId
(
res
.
data
.
sessionId
)
util
.
setSessionId
(
res
.
data
.
sessionId
)
const
openId
=
res
.
data
.
openId
const
openId
=
res
.
data
.
openId
wechant
Api
.
getUserInfo
({
sso
Api
.
getUserInfo
({
openId
openId
}).
then
(
result
=>
{
}).
then
(
result
=>
{
console
.
log
(
result
)
console
.
log
(
result
)
...
@@ -63,10 +68,34 @@ App({
...
@@ -63,10 +68,34 @@ App({
wx
.
$authStatus
=
true
wx
.
$authStatus
=
true
reject
()
reject
()
})
})
console
.
log
(
wx
.
$trackData
.
scene
,
'--------'
)
if
(
wx
.
$trackData
.
scene
)
{
_this
.
getScene
(
wx
.
$trackData
.
scene
).
then
(
res
=>
{
console
.
log
(
res
)
wx
.
$trackData
.
merchant
=
res
.
merchantId
})
wx
.
$Track
.
sendTrack
(
trackData
.
COMPANY
)
}
}
}
})
})
})
})
},
},
getScene
(
scene
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wechatApi
.
getSceneById
({
id
:
decodeURIComponent
(
scene
).
split
(
'='
)[
1
]
}).
then
(({
data
})
=>
{
let
op
=
{}
data
.
scene
.
split
(
'&'
).
map
(
item
=>
{
const
[
key
,
val
]
=
item
.
split
(
"="
)
op
[
key
]
=
val
})
console
.
log
(
op
)
resolve
(
op
)
// wx.$trackData.merchant = op.merchantId
})
})
},
globalData
:
{
globalData
:
{
}
}
})
})
\ No newline at end of file
\ No newline at end of file
utils/Track.js
View file @
7946f2a
...
@@ -124,6 +124,7 @@ class TRACK {
...
@@ -124,6 +124,7 @@ class TRACK {
}
}
/**定时发送埋点数据 */
/**定时发送埋点数据 */
sendTrack
(
p
)
{
sendTrack
(
p
)
{
console
.
log
(
wx
.
$trackData
)
let
params
=
{
let
params
=
{
method
:
'entmicro.api.business.card.cardRecord'
method
:
'entmicro.api.business.card.cardRecord'
}
}
...
@@ -133,10 +134,13 @@ class TRACK {
...
@@ -133,10 +134,13 @@ class TRACK {
openId
:
'123445'
,
openId
:
'123445'
,
unionId
:
''
,
unionId
:
''
,
phone
:
'18873336682'
,
phone
:
'18873336682'
,
merchant
:
'12121'
,
//
merchant: '12121',
cardId
:
'1'
//
cardId: '1'
}
}
params
=
Object
.
assign
(
params
,
userInfo
,
p
)
if
(
!
wx
.
$trackData
.
merchant
)
{
}
params
=
Object
.
assign
(
params
,
userInfo
,
p
,
wx
.
$trackData
)
console
.
log
(
params
)
console
.
log
(
params
)
api
.
reportTrack
(
params
).
then
(({
api
.
reportTrack
(
params
).
then
(({
code
,
code
,
...
...
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