fix: resolve multiple miniprogram bugs and extend admin console
- fix manual bind stuck at BLE scan, redirect to bind-success - add 15s timeout and stopScan to ble-connect - add stopScan method to ble.js - add back-to-home button on bind-success page - fix field name in subscribe-plans (plan -> plan_type) - fix history.js to handle created_at field - fix index.js to handle device name field - add subscription route alias in request.js - extend admin cloud function from 1 to 9 actions - add mock mode to admin-console request.js - remove unused discover page and legacy record function Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
这个提交包含在:
@@ -44,7 +44,7 @@ Page({
|
||||
self.setData({ hasDevice: devices.length > 0 })
|
||||
if (devices.length > 0) {
|
||||
self.setData({
|
||||
deviceName: devices[0].device_name || '光子美容仪',
|
||||
deviceName: devices[0].name || devices[0].device_id || '我的光面膜',
|
||||
deviceInfo: devices[0]
|
||||
})
|
||||
}
|
||||
@@ -90,6 +90,45 @@ Page({
|
||||
wx.navigateTo({ url: '/pages/scan/scan' })
|
||||
},
|
||||
|
||||
onManageDevice: function () {
|
||||
var self = this
|
||||
wx.showActionSheet({
|
||||
itemList: ['解绑当前设备'],
|
||||
success: function (res) {
|
||||
if (res.tapIndex === 0) {
|
||||
wx.showModal({
|
||||
title: '确认解绑',
|
||||
content: '解绑后将无法使用该设备,确定要解绑吗?',
|
||||
success: function (modalRes) {
|
||||
if (modalRes.confirm) {
|
||||
self.doUnbind()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
doUnbind: function () {
|
||||
var self = this
|
||||
wx.showLoading({ title: '解绑中...' })
|
||||
ble.disconnect()
|
||||
http.post('/api/v1/device/unbind', {}).then(function () {
|
||||
wx.hideLoading()
|
||||
self.setData({
|
||||
hasDevice: false,
|
||||
deviceName: '',
|
||||
deviceInfo: null,
|
||||
connected: false
|
||||
})
|
||||
wx.showToast({ title: '已解绑', icon: 'success' })
|
||||
}).catch(function (err) {
|
||||
wx.hideLoading()
|
||||
wx.showToast({ title: err.message || '解绑失败', icon: 'none' })
|
||||
})
|
||||
},
|
||||
|
||||
onStartTreatment: function () {
|
||||
if (!this.data.subscription || this.data.subscription.status === 0) {
|
||||
wx.navigateTo({ url: '/pages/subscribe-prompt/subscribe-prompt' })
|
||||
|
||||
在新工单中引用
屏蔽一个用户