|
|
@@ -1,4 +1,5 @@
|
|
|
require("./utils/string.js")
|
|
|
+const ald = require('./libs/ald-stat.js')
|
|
|
import {
|
|
|
updataStorageData
|
|
|
} from './utils/storage.js'
|
|
|
@@ -12,18 +13,21 @@ import {
|
|
|
saveLogin,
|
|
|
checkPhone
|
|
|
} from './services/wx.js'
|
|
|
-
|
|
|
+var startTime = Date.now();//启动时间
|
|
|
App({
|
|
|
- onLaunch: function(options) {
|
|
|
+ onLaunch: function (options) {
|
|
|
+ this.aldstat.sendEvent('小程序的启动时长', {
|
|
|
+ time: Date.now() - startTime
|
|
|
+ })
|
|
|
// 小程序版本更新
|
|
|
if (wx.getUpdateManager) {
|
|
|
const updateManager = wx.getUpdateManager()
|
|
|
- updateManager.onCheckForUpdate(function(res) {
|
|
|
+ updateManager.onCheckForUpdate(function (res) {
|
|
|
// 请求完新版本信息的回调
|
|
|
console.log(res.hasUpdate)
|
|
|
})
|
|
|
|
|
|
- updateManager.onUpdateReady(function() {
|
|
|
+ updateManager.onUpdateReady(function () {
|
|
|
wx.showModal({
|
|
|
title: '更新提示',
|
|
|
content: '新版本已经准备好,是否重启应用?',
|
|
|
@@ -36,7 +40,7 @@ App({
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- updateManager.onUpdateFailed(function() {
|
|
|
+ updateManager.onUpdateFailed(function () {
|
|
|
// 新版本下载失败
|
|
|
})
|
|
|
} else {
|
|
|
@@ -49,11 +53,11 @@ App({
|
|
|
// let sceneArr = [1007, 1008, 1044, 1011, 1012, 1013, 1047, 1048, 1049]
|
|
|
let shareToken = options.query.shareToken || null
|
|
|
getWxCode().then(code => {
|
|
|
- return wxLogin({
|
|
|
- code: code,
|
|
|
- shareToken: shareToken
|
|
|
- })
|
|
|
+ return wxLogin({
|
|
|
+ code: code,
|
|
|
+ shareToken: shareToken
|
|
|
})
|
|
|
+ })
|
|
|
.then(res => {
|
|
|
console.log("dd", res)
|
|
|
this.globalData.openId = res.data.openId ? res.data.openId : '';
|
|
|
@@ -119,13 +123,13 @@ App({
|
|
|
city: updataStorageData('city') || '无锡'
|
|
|
},
|
|
|
//页面分享
|
|
|
- onShareAppMessage: function() {
|
|
|
+ onShareAppMessage: function () {
|
|
|
wx.showShareMenu({
|
|
|
withShareTicket: true,
|
|
|
success: (res) => { // 成功后要做的事情
|
|
|
console.log(res)
|
|
|
},
|
|
|
- fail: function(res) {
|
|
|
+ fail: function (res) {
|
|
|
console.log(res)
|
|
|
}
|
|
|
})
|
|
|
@@ -138,10 +142,10 @@ App({
|
|
|
//需后台解析数据 encryptedData iv
|
|
|
console.log(res)
|
|
|
},
|
|
|
- fail: function(res) {
|
|
|
+ fail: function (res) {
|
|
|
console.log(res)
|
|
|
},
|
|
|
- complete: function(res) {}
|
|
|
+ complete: function (res) { }
|
|
|
})
|
|
|
},
|
|
|
// 跳转登录页面
|