fix: back button alignment, mock bind flow, and timezone bug

- nav-back: add text-align:left to override page-header's center
- ble-connect mock: call bind API first to get fresh token before
  confirm, instead of relying on potentially stale URL params
- utils.js: use local time instead of UTC for toMysqlDate, fixing
  timezone mismatch with MySQL NOW() that caused bind tokens to
  appear immediately expired
这个提交包含在:
Guoguo
2026-04-29 04:54:42 -07:00
父节点 1f55e430c8
当前提交 2578c06a74
修改 3 个文件,包含 20 行新增21 行删除
+1
查看文件
@@ -244,6 +244,7 @@ page {
color: rgba(255, 255, 255, 0.85);
padding: 8rpx 0;
margin-bottom: 8rpx;
text-align: left;
}
.nav-back-light {
+17 -20
查看文件
@@ -96,38 +96,35 @@ Page({
this.startBleConnect()
},
onMockConnect: function () {
_mockConfirmBind: function () {
var self = this
clearTimeout(this._scanTimer)
ble.stopScan()
self.setData({ state: 'binding' })
// Skip BLE bind, confirm directly with server
http.post('/api/v1/device/bind/confirm', {
device_id: self.data.deviceId,
bind_token: self.data.bindToken
http.post('/api/v1/device/bind', {
device_id: self.data.deviceId
}).then(function (data) {
return http.post('/api/v1/device/bind/confirm', {
device_id: data.device_id,
bind_token: data.bind_token
})
}).then(function () {
self.setData({ state: 'done' })
wx.redirectTo({
url: '/pages/bind-success/bind-success?device_id=' + self.data.deviceId
})
}).catch(function (err) {
self.setData({ state: 'error', error: err.message || '模拟确认失败' })
self.setData({ state: 'error', error: err.message || '模拟绑定失败' })
})
},
onMockBindSuccess: function () {
var self = this
onMockConnect: function () {
clearTimeout(this._scanTimer)
ble.stopScan()
http.post('/api/v1/device/bind/confirm', {
device_id: self.data.deviceId,
bind_token: self.data.bindToken
}).then(function () {
wx.redirectTo({
url: '/pages/bind-success/bind-success?device_id=' + self.data.deviceId
})
}).catch(function (err) {
self.setData({ state: 'error', error: err.message || '模拟确认失败' })
})
this._mockConfirmBind()
},
onMockBindSuccess: function () {
clearTimeout(this._scanTimer)
ble.stopScan()
this._mockConfirmBind()
}
})