// app.js import { AllSDK } from "./tqlsdk/allSDK" App({ globalData: { statusBarHeight: 0, // 导航栏高度 navigationBarHeight: 0, // 内容区高度 contentAreaHeight: 0, // iOS底部控制条高度 bottomControlStripHeight: 0, // canvas 宽 canvasWidth: 0, // canvas 高 canvasHeight: 0, tqlSDK: null, deviceId: null, deviceName: null, deviceMac: null, SrcExUrl: 'https://scratch.baca-ai.com' }, onLaunch() { // 展示本地存储能力 this.globalData.tqlSDK = new AllSDK(0) // chende start wx.getSystemInfo({ success: res => { console.log('系统信息', res) const { // 状态栏高度 statusBarHeight, safeArea: { // 安全区域高度 bottom: safeAreaBottom }, // 屏幕高度 screenHeight } = res const { // 顶部胶囊按钮高度 height: topMenuButtonHeight, // 顶部胶囊按钮顶部距离 top: topMenuButtonTop, } = wx.getMenuButtonBoundingClientRect() // 系统状态栏高度 this.globalData.statusBarHeight = statusBarHeight // 计算顶部导航栏高度 this.globalData.navigationBarHeight = topMenuButtonHeight + (topMenuButtonTop - statusBarHeight) * 2 // 计算iOS底部控制条高度 this.globalData.bottomControlStripHeight = screenHeight - safeAreaBottom // 计算内容区高度 this.globalData.contentAreaHeight = screenHeight - statusBarHeight - this.globalData.navigationBarHeight - this.globalData.bottomControlStripHeight console.log('全局数据', this.globalData) } }) // chende end wx.getSystemInfo({ success: res => { let modelmes = res.model; // console.log('系统信息', res); if (modelmes.search('iPhone X') != -1) { console.log(modelmes.search('iPhone X') != -1); this.globalData.isIphoneX = true } wx.setStorageSync('modelmes', modelmes) } }) }, })