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
这个提交包含在:
Guoguo
2026-06-05 19:21:43 -07:00
父节点 9882d19b54
当前提交 810a3a19a5
修改 3 个文件,包含 16 行新增7 行删除
+5 -3
查看文件
@@ -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' })