app.js 440 B

12345678910111213141516171819202122
  1. // app.js
  2. var MQTT = require("./utils/mqtt.js");
  3. App({
  4. onLaunch() {
  5. // 展示本地存储能力
  6. const logs = wx.getStorageSync('logs') || []
  7. logs.unshift(Date.now())
  8. wx.setStorageSync('logs', logs)
  9. MQTT.ConnectMqtt();//链接MQTT
  10. // 登录
  11. wx.login({
  12. success: res => {
  13. // 发送 res.code 到后台换取 openId, sessionKey, unionId
  14. }
  15. })
  16. },
  17. globalData: {
  18. userInfo: null
  19. }
  20. })