文件
jw-beauty/miniprogram/pages/wear-check/wear-check.js
T
Guoguo 52cb1f72dc fix: resolve header overlap on Dynamic Island iPhones
- app.js 通过 wx.getSystemInfoSync 获取 statusBarHeight 存入 globalData
- 所有12个自定义导航页面的 JS 读取 statusBarHeight
- WXML 通过 style="padding-top: {{statusBarHeight + 24}}px" 动态适配
- 普通手机和灵动岛手机都能正确显示
2026-04-24 22:20:10 +08:00

46 行
1012 B
JavaScript

var ble = require('../../services/ble')
Page({
data: {
statusBarHeight: 44,
checking: false,
result: null,
error: ''
},
onLoad: function () {
var app = getApp()
this.setData({ statusBarHeight: app.globalData.statusBarHeight })
},
onShow: function () {
this.checkWearing()
},
checkWearing: function () {
var self = this
self.setData({ checking: true, result: null, error: '' })
ble.on('status', function (status) {
self.setData({ checking: false })
if (status.bind_status === 1) {
self.setData({ result: 'ok' })
} else {
self.setData({ result: 'fail', error: '请确认设备已正确佩戴' })
}
})
ble.queryStatus().catch(function (err) {
self.setData({ checking: false, result: 'fail', error: err.error_msg || '查询失败' })
})
},
onNext: function () {
wx.navigateTo({ url: '/pages/treatment-setup/treatment-setup' })
},
onRetry: function () {
this.checkWearing()
}
})