|
@@ -6,22 +6,31 @@ export default {
|
|
// 状态栏
|
|
// 状态栏
|
|
statusBarHeight: 20,
|
|
statusBarHeight: 20,
|
|
// 设备信息
|
|
// 设备信息
|
|
- deviceInfo: {}
|
|
|
|
|
|
+ deviceInfo: {},
|
|
|
|
+ // 是否在App内部H5
|
|
|
|
+ inside: false
|
|
},
|
|
},
|
|
onLaunch() {
|
|
onLaunch() {
|
|
- // 获取App方法
|
|
|
|
- getUserInfo.postMessage('获取用户信息')
|
|
|
|
- getDeviceInfo.postMessage('获取设备信息')
|
|
|
|
- getMWDeviceInfo.postMessage('获取音响信息')
|
|
|
|
- // 暴露setUserInfo方法给APP
|
|
|
|
- window['setUserInfo'] = res => {
|
|
|
|
- this.globalData.userInfo = JSON.parse(res)
|
|
|
|
- }
|
|
|
|
- window['setDeviceInfo'] = res => {
|
|
|
|
- this.globalData.statusBarHeight = JSON.parse(res).statusHeight
|
|
|
|
- }
|
|
|
|
- window['setMWDeviceInfo'] = res => {
|
|
|
|
- this.globalData.deviceInfo = JSON.parse(res)
|
|
|
|
|
|
+ try {
|
|
|
|
+ // 获取App方法
|
|
|
|
+ getUserInfo.postMessage('获取用户信息')
|
|
|
|
+ getDeviceInfo.postMessage('获取设备信息')
|
|
|
|
+ getMWDeviceInfo.postMessage('获取音响信息')
|
|
|
|
+ // 在App内部H5
|
|
|
|
+ this.globalData.inside = true
|
|
|
|
+ // 暴露setUserInfo方法给APP
|
|
|
|
+ window['setUserInfo'] = res => {
|
|
|
|
+ this.globalData.userInfo = JSON.parse(res)
|
|
|
|
+ }
|
|
|
|
+ window['setDeviceInfo'] = res => {
|
|
|
|
+ this.globalData.statusBarHeight = JSON.parse(res).statusHeight
|
|
|
|
+ }
|
|
|
|
+ window['setMWDeviceInfo'] = res => {
|
|
|
|
+ this.globalData.deviceInfo = JSON.parse(res)
|
|
|
|
+ }
|
|
|
|
+ } catch {
|
|
|
|
+ // 在浏览器H5
|
|
|
|
+ this.globalData.inside = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|