feat: support JW_ device ID format in QR scan and BLE matching
- parseDeviceId accepts hex with spaces (e.g. "672B6D5A 4DCD861") - BLE scan does exact match on "JW_<device_id>" when target is known - Manual input placeholder updated to show new format
这个提交包含在:
@@ -52,6 +52,7 @@ Page({
|
||||
}, SCAN_TIMEOUT)
|
||||
|
||||
ble.startScan({
|
||||
targetDeviceId: self.data.deviceId,
|
||||
onFound: function (device) {
|
||||
clearTimeout(self._scanTimer)
|
||||
self.setData({ state: 'connecting' })
|
||||
|
||||
@@ -43,7 +43,9 @@ Page({
|
||||
},
|
||||
|
||||
parseDeviceId: function (content) {
|
||||
content = (content || '').trim()
|
||||
if (/^[0-9A-Fa-f]{16}$/.test(content)) return content
|
||||
if (/^[0-9A-Fa-f]+([ _-][0-9A-Fa-f]+)+$/.test(content)) return content
|
||||
try {
|
||||
var url = new URL(content)
|
||||
var id = url.searchParams.get('device_id') || url.searchParams.get('id')
|
||||
@@ -79,11 +81,11 @@ Page({
|
||||
wx.showModal({
|
||||
title: '手动输入设备号',
|
||||
editable: true,
|
||||
placeholderText: '请输入16位设备ID',
|
||||
placeholderText: '请输入设备ID,如 672B6D5A 4DCD861',
|
||||
success: function (res) {
|
||||
if (res.confirm && res.content) {
|
||||
var deviceId = res.content.trim()
|
||||
if (/^[0-9A-Fa-f]{16}$/.test(deviceId)) {
|
||||
var deviceId = self.parseDeviceId(res.content)
|
||||
if (deviceId) {
|
||||
self.bindDevice(deviceId)
|
||||
} else {
|
||||
wx.showToast({ title: '设备号格式不正确', icon: 'none' })
|
||||
|
||||
在新工单中引用
屏蔽一个用户