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 228a4869
authored
Oct 30, 2022
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add sentry config
1 parent
fbffc1a7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
87 deletions
app.js
utils/lib/sentry-miniapp.js
app.js
View file @
228a486
//app.js
//app.js
import
*
as
Sentry
from
'./utils/lib/sentry-miniapp'
Sentry
.
init
({
// dsn: 'http://ebcf31c417cc4ce185782f046e4a87a2@sentry.glsx.com.cn/5'
dsn
:
'https://e440585f391e46278c3c72ddabb1d17f@sentry.glsx.com.cn/31'
})
import
router
from
'./router/index.js'
import
router
from
'./router/index.js'
import
util
from
'./utils/util.js'
import
util
from
'./utils/util.js'
import
'./utils/Track'
import
'./utils/Track'
import
{
import
{
ssoApi
,
wechatApi
}
from
'./api/api'
ssoApi
,
import
{
trackData
}
from
'./utils/data'
wechatApi
}
from
'./api/api'
import
{
trackData
}
from
'./utils/data'
import
eventbus
from
'./utils/evenbus'
import
eventbus
from
'./utils/evenbus'
// 实例化对象存储
// 实例化对象存储
import
{
Storage
}
from
'./utils/cache/storage'
import
{
Storage
}
from
'./utils/cache/storage'
const
$Storage
=
new
Storage
()
const
$Storage
=
new
Storage
()
App
({
App
({
onLaunch
:
function
(
options
)
{
onLaunch
:
function
(
options
)
{
console
.
log
(
options
)
console
.
log
(
options
)
...
@@ -26,11 +27,12 @@ App({
...
@@ -26,11 +27,12 @@ App({
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
const
systemInfo
=
wx
.
getStorageSync
(
'aicard_system_info'
)
const
systemInfo
=
wx
.
getStorageSync
(
'aicard_system_info'
)
if
(
!
systemInfo
)
wx
.
getSystemInfo
({
if
(
!
systemInfo
)
success
(
res
)
{
wx
.
getSystemInfo
({
util
.
setStorageSync
(
'aicard_system_info'
,
res
)
success
(
res
)
{
}
util
.
setStorageSync
(
'aicard_system_info'
,
res
)
})
}
})
if
(
options
.
path
!=
'pages/tab/index/index'
)
{
if
(
options
.
path
!=
'pages/tab/index/index'
)
{
this
.
login
()
this
.
login
()
}
}
...
@@ -43,93 +45,97 @@ App({
...
@@ -43,93 +45,97 @@ App({
let
wechatInfo
=
null
let
wechatInfo
=
null
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
login
({
wx
.
login
({
success
({
success
({
code
})
{
code
ssoApi
})
{
.
jsCodeLogin
({
ssoApi
.
jsCodeLogin
({
code
,
code
,
appId
:
wx
.
$appId
appId
:
wx
.
$appId
})
}).
then
(
res
=>
{
.
then
(
res
=>
{
wechatInfo
=
res
.
data
wechatInfo
=
res
.
data
util
.
setStorageSync
(
'aicard_info'
,
wechatInfo
)
util
.
setStorageSync
(
'aicard_info'
,
wechatInfo
)
wx
.
$authStatus
=
res
.
code
!=
0
wx
.
$authStatus
=
res
.
code
!=
0
util
.
setSessionId
(
wechatInfo
.
sessionId
)
util
.
setSessionId
(
wechatInfo
.
sessionId
)
openId
=
wechatInfo
.
openId
openId
=
wechatInfo
.
openId
// util.setStorageSync('openId', openId)
// util.setStorageSync('openId', openId)
console
.
log
(
wx
.
$trackData
)
console
.
log
(
wx
.
$trackData
)
wx
.
showMeasure
=
!!
wx
.
$trackData
.
scene
wx
.
showMeasure
=
!!
wx
.
$trackData
.
scene
if
(
wx
.
$trackData
.
scene
)
{
if
(
wx
.
$trackData
.
scene
)
{
// 初次进入小程序默认埋首页
// 初次进入小程序默认埋首页
_this
.
getScene
(
wx
.
$trackData
.
scene
).
then
(
res
=>
{
_this
.
getScene
(
wx
.
$trackData
.
scene
).
then
(
res
=>
{
wx
.
$trackData
.
merchant
=
res
.
merchantId
wx
.
$trackData
.
merchant
=
res
.
merchantId
wx
.
$trackData
.
cardId
=
res
.
cardId
wx
.
$trackData
.
cardId
=
res
.
cardId
console
.
log
(
'wx.$trackData.cardId'
,
wx
.
$trackData
.
cardId
)
console
.
log
(
'wx.$trackData.cardId'
,
wx
.
$trackData
.
cardId
)
util
.
setStorageSync
(
'scene'
,
res
)
util
.
setStorageSync
(
'scene'
,
res
)
const
systemInfo
=
JSON
.
parse
(
wx
.
getStorageSync
(
'aicard_system_info'
))
wx
.
$trackData
.
type
=
systemInfo
.
environment
?
2
:
1
wx
.
$Track
.
sendTrack
(
trackData
.
COMPANY
,
wechatInfo
)
})
}
else
if
(
wx
.
$trackData
.
detailShare
)
{
// d+产品分享在这里设置埋点
const
detailShare
=
wx
.
$trackData
.
detailShare
console
.
log
(
1211
)
for
(
let
i
in
trackData
)
{
console
.
log
(
i
)
if
(
trackData
[
i
].
pageName
==
detailShare
)
{
console
.
log
(
trackData
[
i
])
wx
.
$Track
.
sendTrack
(
trackData
[
i
],
wechatInfo
)
break
}
}
}
else
if
(
wx
.
$trackData
.
isShare
)
{
util
.
setStorageSync
(
'scene'
,
wx
.
$trackData
)
const
systemInfo
=
JSON
.
parse
(
wx
.
getStorageSync
(
'aicard_system_info'
))
wx
.
$trackData
.
type
=
systemInfo
.
environment
?
2
:
1
}
else
if
(
!
wx
.
$trackData
.
detailShare
&&
wx
.
$trackData
.
cardId
)
{
// 名片分享在这里设置埋点
util
.
setStorageSync
(
'scene'
,
wx
.
$trackData
)
const
systemInfo
=
JSON
.
parse
(
wx
.
getStorageSync
(
'aicard_system_info'
))
const
systemInfo
=
JSON
.
parse
(
wx
.
getStorageSync
(
'aicard_system_info'
))
wx
.
$trackData
.
type
=
systemInfo
.
environment
?
2
:
1
wx
.
$trackData
.
type
=
systemInfo
.
environment
?
2
:
1
wx
.
$Track
.
sendTrack
(
trackData
.
COMPANY
,
wechatInfo
)
wx
.
$Track
.
sendTrack
(
trackData
.
COMPANY
,
wechatInfo
)
})
}
else
if
(
wx
.
$trackData
.
detailShare
)
{
// d+产品分享在这里设置埋点
const
detailShare
=
wx
.
$trackData
.
detailShare
console
.
log
(
1211
)
for
(
let
i
in
trackData
)
{
console
.
log
(
i
)
if
(
trackData
[
i
].
pageName
==
detailShare
)
{
console
.
log
(
trackData
[
i
])
wx
.
$Track
.
sendTrack
(
trackData
[
i
],
wechatInfo
)
break
}
}
}
else
if
(
wx
.
$trackData
.
isShare
)
{
util
.
setStorageSync
(
'scene'
,
wx
.
$trackData
)
const
systemInfo
=
JSON
.
parse
(
wx
.
getStorageSync
(
'aicard_system_info'
))
wx
.
$trackData
.
type
=
systemInfo
.
environment
?
2
:
1
}
else
if
(
!
wx
.
$trackData
.
detailShare
&&
wx
.
$trackData
.
cardId
)
{
// 名片分享在这里设置埋点
util
.
setStorageSync
(
'scene'
,
wx
.
$trackData
)
const
systemInfo
=
JSON
.
parse
(
wx
.
getStorageSync
(
'aicard_system_info'
))
wx
.
$trackData
.
type
=
systemInfo
.
environment
?
2
:
1
wx
.
$Track
.
sendTrack
(
trackData
.
COMPANY
,
wechatInfo
)
}
ssoApi
.
getUserInfo
({
openId
}).
then
(
result
=>
{
if
(
returnResponse
)
{
resolve
(
result
)
}
else
{
if
(
result
.
code
==
0
)
{
util
.
setUserInfo
(
result
.
data
)
}
else
{
util
.
showToast
(
result
.
message
||
'网络异常'
)
}
resolve
(
result
)
}
}
ssoApi
.
getUserInfo
({
openId
})
.
then
(
result
=>
{
if
(
returnResponse
)
{
resolve
(
result
)
}
else
{
if
(
result
.
code
==
0
)
{
util
.
setUserInfo
(
result
.
data
)
}
else
{
util
.
showToast
(
result
.
message
||
'网络异常'
)
}
resolve
(
result
)
}
})
})
.
catch
(()
=>
{
wx
.
$authStatus
=
true
reject
()
})
})
}).
catch
(()
=>
{
wx
.
$authStatus
=
true
reject
()
})
}
}
})
})
})
})
},
},
getScene
(
scene
)
{
getScene
(
scene
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wechatApi
.
getSceneById
({
wechatApi
id
:
decodeURIComponent
(
scene
).
split
(
'='
)[
1
]
.
getSceneById
({
}).
then
(({
data
})
=>
{
id
:
decodeURIComponent
(
scene
).
split
(
'='
)[
1
]
let
op
=
{}
})
data
.
scene
.
split
(
'&'
).
map
(
item
=>
{
.
then
(({
data
})
=>
{
const
[
key
,
val
]
=
item
.
split
(
"="
)
let
op
=
{}
op
[
key
]
=
val
data
.
scene
.
split
(
'&'
).
map
(
item
=>
{
const
[
key
,
val
]
=
item
.
split
(
'='
)
op
[
key
]
=
val
})
resolve
(
op
)
})
})
resolve
(
op
)
})
})
})
},
},
/**
/**
* 下载小程序新版本并重启应用
* 下载小程序新版本并重启应用
*/
*/
autoUpdate
:
function
()
{
autoUpdate
:
function
()
{
...
@@ -191,6 +197,5 @@ App({
...
@@ -191,6 +197,5 @@ App({
})
})
}
}
},
},
globalData
:
{
}
})
\ No newline at end of file
\ No newline at end of file
globalData
:
{}
})
utils/lib/sentry-miniapp.js
0 → 100644
View file @
228a486
This diff is collapsed.
Click to expand it.
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