فهرست منبع

阿拉丁引入

ZhangWenQiang 6 سال پیش
والد
کامیت
860e1a59a2
2فایلهای تغییر یافته به همراه18 افزوده شده و 14 حذف شده
  1. 17 13
      app.js
  2. 1 1
      libs/ald-stat.js

+ 17 - 13
app.js

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

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
libs/ald-stat.js