Commit 228a4869 by 张立顺

add sentry config

1 parent fbffc1a7
//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 util from './utils/util.js'
import './utils/Track'
import {
ssoApi,
wechatApi
} from './api/api'
import {trackData} from './utils/data'
import { ssoApi, wechatApi } from './api/api'
import { trackData } from './utils/data'
import eventbus from './utils/evenbus'
// 实例化对象存储
import { Storage } from './utils/cache/storage'
const $Storage = new Storage()
App({
onLaunch: function (options) {
console.log(options)
......@@ -26,7 +27,8 @@ App({
wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
wx.$appId = wx.getAccountInfoSync().miniProgram.appId
const systemInfo = wx.getStorageSync('aicard_system_info')
if (!systemInfo) wx.getSystemInfo({
if (!systemInfo)
wx.getSystemInfo({
success(res) {
util.setStorageSync('aicard_system_info', res)
}
......@@ -43,13 +45,13 @@ App({
let wechatInfo = null
return new Promise((resolve, reject) => {
wx.login({
success({
code
}) {
ssoApi.jsCodeLogin({
success({ code }) {
ssoApi
.jsCodeLogin({
code,
appId: wx.$appId
}).then(res => {
})
.then(res => {
wechatInfo = res.data
util.setStorageSync('aicard_info', wechatInfo)
wx.$authStatus = res.code != 0
......@@ -69,11 +71,11 @@ App({
wx.$trackData.type = systemInfo.environment ? 2 : 1
wx.$Track.sendTrack(trackData.COMPANY, wechatInfo)
})
} else if(wx.$trackData.detailShare) {
} else if (wx.$trackData.detailShare) {
// d+产品分享在这里设置埋点
const detailShare = wx.$trackData.detailShare
console.log(1211)
for(let i in trackData) {
for (let i in trackData) {
console.log(i)
if (trackData[i].pageName == detailShare) {
console.log(trackData[i])
......@@ -92,9 +94,11 @@ App({
wx.$trackData.type = systemInfo.environment ? 2 : 1
wx.$Track.sendTrack(trackData.COMPANY, wechatInfo)
}
ssoApi.getUserInfo({
ssoApi
.getUserInfo({
openId
}).then(result => {
})
.then(result => {
if (returnResponse) {
resolve(result)
} else {
......@@ -106,23 +110,25 @@ App({
resolve(result)
}
})
}).catch(() => {
})
.catch(() => {
wx.$authStatus = true
reject()
})
}
})
})
},
getScene(scene) {
return new Promise((resolve, reject) => {
wechatApi.getSceneById({
wechatApi
.getSceneById({
id: decodeURIComponent(scene).split('=')[1]
}).then(({data}) => {
})
.then(({ data }) => {
let op = {}
data.scene.split('&').map(item => {
const [key, val] = item.split("=")
const [key, val] = item.split('=')
op[key] = val
})
resolve(op)
......@@ -191,6 +197,5 @@ App({
})
}
},
globalData: {
}
globalData: {}
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!