app.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //app.js
  2. import {
  3. GetQueryString
  4. } from 'utils/util'
  5. // const Towxml = require('/towxml/main');
  6. App({
  7. onLaunch: function (options) {
  8. // 判断设备是否为 iPhone X
  9. this.checkIsIPhoneX()
  10. options.referrerInfo.extraData && (this.globalData.upgradeHide = options.referrerInfo.extraData.upgrade)
  11. },
  12. globalData: {
  13. isIPX: false, // 当前设备是否为 iPhone X
  14. isIOS: false, // 判断设备是否为苹果
  15. userInfo: null,
  16. statusBarHeight: wx.getSystemInfoSync()['statusBarHeight'],
  17. userGrade: '二年级',
  18. upgradeHide: true
  19. },
  20. checkIsIPhoneX: function () {
  21. const self = this
  22. wx.getSystemInfo({
  23. success: function (res) {
  24. // 根据 model 进行判断
  25. console.log(res)
  26. console.log(res.system.search('iOS'))
  27. if (res.model.search('iPhone X') != -1) {
  28. self.globalData.isIPX = true
  29. }
  30. if (res.system.search('iOS') != -1) {
  31. self.globalData.isIOS = true
  32. }
  33. }
  34. })
  35. },
  36. // towxml: new Towxml()
  37. })