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
这个提交包含在:
@@ -244,6 +244,7 @@ page {
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
padding: 8rpx 0;
|
||||
margin-bottom: 8rpx;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.nav-back-light {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
})
|
||||
|
||||
在新工单中引用
屏蔽一个用户