app.ts 849 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. /// console.log(res)
  15. this.globalData.safeBottom = res.screenHeight-res.safeArea.bottom
  16. this.globalData.windowHeight = res.windowHeight
  17. },
  18. fail: (er) => {
  19. console.log(er)
  20. }
  21. })
  22. // 展示本地存储能力
  23. const logs = wx.getStorageSync('logs') || []
  24. logs.unshift(Date.now())
  25. wx.setStorageSync('logs', logs)
  26. // 登录
  27. wx.login({
  28. success: res => {
  29. console.log(res)
  30. // 发送 res.code 到后台换取 openId, sessionKey, unionId
  31. },
  32. })
  33. },
  34. })