app.ts 787 B

1234567891011121314151617181920212223242526272829303132333435
  1. import './utils/system/index'
  2. import './services/index' // 初始化服务
  3. App({
  4. globalData: {
  5. /// iPhone底部安全区域
  6. safeBottom: 0.0,
  7. /// 窗口高度
  8. windowHeight: 0,
  9. },
  10. onLaunch() {
  11. /// 获取iPhone底部安全区域
  12. wx.getSystemInfo({
  13. success: res=> {
  14. this.globalData.safeBottom = res.screenHeight-res.safeArea.bottom
  15. this.globalData.windowHeight = res.windowHeight
  16. },
  17. fail: () => {}
  18. })
  19. // 展示本地存储能力
  20. const logs = wx.getStorageSync('logs') || []
  21. logs.unshift(Date.now())
  22. wx.setStorageSync('logs', logs)
  23. // 登录
  24. wx.login({
  25. success: res => {
  26. console.log(res)
  27. // 发送 res.code 到后台换取 openId, sessionKey, unionId
  28. },
  29. })
  30. },
  31. })