From 5399ecf35905a9162ec3dac9df29a48e428deaa6 Mon Sep 17 00:00:00 2001 From: liub Date: Fri, 30 Jan 2026 11:51:29 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=B0=8F=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/common/login.js | 3 ++- config/index.js | 2 +- manifest.json | 2 +- pages/018A/HBY018A.vue | 2 +- pages/100/HBY100.vue | 44 +++++++++++++++++++++++------------------- pages/102/HBY102.vue | 2 +- pages/6107/BJQ6107.vue | 2 +- utils/BleHelper.js | 2 +- utils/request.js | 7 +++++-- 9 files changed, 37 insertions(+), 29 deletions(-) diff --git a/api/common/login.js b/api/common/login.js index 960fb0e..62ce6a6 100644 --- a/api/common/login.js +++ b/api/common/login.js @@ -4,7 +4,8 @@ export function login(data) { return request({ url: '/app/auth/login', method: 'POST', - data: data + data: data, + isAuthen:false }) } // 注册发送验证码 diff --git a/config/index.js b/config/index.js index 6ec3377..5459c4c 100644 --- a/config/index.js +++ b/config/index.js @@ -2,7 +2,7 @@ const config = { // 开发环境 development: { - BASE_URL: 'http://192.168.110.57:8000',//http://139.224.253.23:8000 + BASE_URL: 'http://139.224.253.23:8000',//http://139.224.253.23:8000 API_PREFIX: '', // MQTT 配置 MQTT_HOST: 'www.cnxhyc.com', diff --git a/manifest.json b/manifest.json index 6dadd96..ffa9fe6 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name" : "星汉物联", "appid" : "__UNI__A21EF43", "description" : "设备管控", - "versionName" : "1.0.12", + "versionName" : "1.0.13", "versionCode" : "100", "transformPx" : false, /* 5+App特有相关 */ diff --git a/pages/018A/HBY018A.vue b/pages/018A/HBY018A.vue index d91775e..bcb5419 100644 --- a/pages/018A/HBY018A.vue +++ b/pages/018A/HBY018A.vue @@ -95,7 +95,7 @@ - + diff --git a/pages/100/HBY100.vue b/pages/100/HBY100.vue index e25470a..eff28dd 100644 --- a/pages/100/HBY100.vue +++ b/pages/100/HBY100.vue @@ -223,25 +223,30 @@ - - 产品信息 - - - - 产品参数 - - - - 操作说明 - - - - 操作视频 - + + + + + + + 产品信息 + + + + 产品参数 + + + + 操作说明 + + + + 操作视频 - - + + + - + - + - diff --git a/pages/102/HBY102.vue b/pages/102/HBY102.vue index 4379aef..0e779f9 100644 --- a/pages/102/HBY102.vue +++ b/pages/102/HBY102.vue @@ -147,7 +147,7 @@ - + diff --git a/pages/6107/BJQ6107.vue b/pages/6107/BJQ6107.vue index 609be9a..d8995ed 100644 --- a/pages/6107/BJQ6107.vue +++ b/pages/6107/BJQ6107.vue @@ -183,7 +183,7 @@ - + diff --git a/utils/BleHelper.js b/utils/BleHelper.js index 7e42bc8..18ae9e1 100644 --- a/utils/BleHelper.js +++ b/utils/BleHelper.js @@ -775,7 +775,7 @@ class BleHelper { str: str, hexs: hexs }; - // console.log("监听到特征值:" + JSON.stringify(recData)); + console.log("监听到特征值:" + JSON.stringify(recData)); if (this.cfg.receivDataCallback) { if (this.cfg.receivDataCallback.length > 0) { diff --git a/utils/request.js b/utils/request.js index a25cc90..1b50db0 100644 --- a/utils/request.js +++ b/utils/request.js @@ -48,8 +48,11 @@ const request = (options) => { reject(err); } }; - - if (!options.url.includes('/login')) { + //是否添加身份验证,undefined时默认需要 + if(options.isAuthen===undefined){ + options.isAuthen=true; + } + if (options.isAuthen) { const token = uni.getStorageSync('token'); const clientid = uni.getStorageSync('clientID'); if (token) { -- 2.43.5 From f3d502b00ee6d7590391ea916a5be990833090af Mon Sep 17 00:00:00 2001 From: liub Date: Mon, 2 Feb 2026 10:12:48 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=9C=BA=E5=9E=8B=E8=93=9D=E7=89=99=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 2 +- manifest.json | 2 +- pages/common/addBLE/addEquip.vue | 64 ++++++++++++++++++++------------ 3 files changed, 42 insertions(+), 26 deletions(-) diff --git a/config/index.js b/config/index.js index 5459c4c..d239f4a 100644 --- a/config/index.js +++ b/config/index.js @@ -2,7 +2,7 @@ const config = { // 开发环境 development: { - BASE_URL: 'http://139.224.253.23:8000',//http://139.224.253.23:8000 + BASE_URL: 'http://192.168.110.172:8000',//http://139.224.253.23:8000 API_PREFIX: '', // MQTT 配置 MQTT_HOST: 'www.cnxhyc.com', diff --git a/manifest.json b/manifest.json index ffa9fe6..489e44b 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name" : "星汉物联", "appid" : "__UNI__A21EF43", "description" : "设备管控", - "versionName" : "1.0.13", + "versionName" : "1.0.14", "versionCode" : "100", "transformPx" : false, /* 5+App特有相关 */ diff --git a/pages/common/addBLE/addEquip.vue b/pages/common/addBLE/addEquip.vue index 102bec6..24adcab 100644 --- a/pages/common/addBLE/addEquip.vue +++ b/pages/common/addBLE/addEquip.vue @@ -184,22 +184,22 @@ }, onLoad(option) { eventChannel = this.getOpenerEventChannel(); - + eventChannel.on('detailData', function(rec) { console.log("接收到父页面的参数:", rec); these.device = rec.data; if (rec.data.bluetoothName) { these.search = rec.data.bluetoothName; - }else if(rec.data.deviceName){ + } else if (rec.data.deviceName) { these.search = rec.data.deviceName; } - + startValidDevice(); - + }); let search = option.search; these = this; - + const systemInfo = uni.getSystemInfoSync(); ble = bleTool.getBleTool(); // Ensure ble is initialized @@ -464,7 +464,7 @@ StartSubsrib(); - + }, @@ -533,21 +533,15 @@ return; } } - - - - ble.StopSearch().finally(() => { - - let disconnectPromises = []; - if (ble.data && ble.data.LinkedList) { - ble.data.LinkedList.forEach(device => { - console.log(`Requesting disconnect for ${device.deviceId}`); - disconnectPromises.push(ble.disconnectDevice(device.deviceId)); - }); + showLoading(these,{text:'正在刷新'}) + let time = null; + let startSearch = () => { + + if(time){ + clearTimeout(time); } - - Promise.allSettled(disconnectPromises).finally(() => { - + + time = setTimeout(() => { these.EquipMents = []; these.PairEquip = []; @@ -563,8 +557,31 @@ content: '开始搜索失败:' + err.msg }); } + }).finally(()=>{ + hideLoading(these); }); - }); + }, 500); + + } + + ble.StopSearch().finally(() => { + + let disconnectPromises = []; + if (ble.data && ble.data.LinkedList) { + ble.data.LinkedList.forEach(device => { + if (device.Linked) { + disconnectPromises.push(ble.disconnectDevice(device.deviceId)); + } + }); + } + + if (disconnectPromises.length > 0) { + Promise.allSettled(disconnectPromises).finally(() => { + startSearch(); + }); + } else { + startSearch(); + } }); @@ -678,12 +695,11 @@ console.log("客户端验证失败"); deviceInvalid(); return; - } - else if (f.macAddress == these.device.deviceMac){ + } else if (f.macAddress == these.device.deviceMac) { console.log("客户端验证成功"); deviceOK(); } - + return true; } else { -- 2.43.5 From b1eab86ba692b2e6886da1943870ce7f96f4f16c Mon Sep 17 00:00:00 2001 From: liub Date: Tue, 3 Feb 2026 13:08:49 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=89=E5=8D=93?= =?UTF-8?q?=E8=93=9D=E7=89=99=E6=9C=AA=E5=BC=80=E5=90=AF=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 2 +- pages/common/addBLE/addEquip.vue | 38 +++++++++----------------------- utils/BleHelper.js | 16 +++++++++----- utils/request.js | 11 ++++++++- utils/update.js | 33 +++++++++++++++++---------- 5 files changed, 53 insertions(+), 47 deletions(-) diff --git a/manifest.json b/manifest.json index 489e44b..d9ccd8e 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name" : "星汉物联", "appid" : "__UNI__A21EF43", "description" : "设备管控", - "versionName" : "1.0.14", + "versionName" : "1.0.15", "versionCode" : "100", "transformPx" : false, /* 5+App特有相关 */ diff --git a/pages/common/addBLE/addEquip.vue b/pages/common/addBLE/addEquip.vue index 24adcab..9d89df0 100644 --- a/pages/common/addBLE/addEquip.vue +++ b/pages/common/addBLE/addEquip.vue @@ -481,9 +481,9 @@ } plus.android.requestPermissions( - ['android.permission.ACCESS_FINE_LOCATION'], + ['android.permission.BLUETOOTH','android.permission.BLUETOOTH_ADMIN','android.permission.ACCESS_FINE_LOCATION','android.permission.ACCESS_COARSE_LOCATION'], (result) => { - if (result.granted.length > 0) { + if (result.granted && result.granted.length > 0) { console.log('定位权限已授予'); resolve(true); } else { @@ -537,7 +537,7 @@ let time = null; let startSearch = () => { - if(time){ + if(time!==null){ clearTimeout(time); } @@ -546,43 +546,27 @@ these.PairEquip = []; ble.StartSearch().then(result => { - console.log("Fresh scan started successfully."); - }).catch(err => { - console.error("Failed to start fresh scan:", err); + console.log("开始搜索成功",result); + + }).catch(err => { + console.error("开始搜索失败:", err); if (err.code === 10001) { these.showOpenSetting(); } else { uni.showModal({ title: '提示', - content: '开始搜索失败:' + err.msg + content: '出现错误:' + err.msg }); + } }).finally(()=>{ hideLoading(these); }); - }, 500); + }, 200); } - ble.StopSearch().finally(() => { - - let disconnectPromises = []; - if (ble.data && ble.data.LinkedList) { - ble.data.LinkedList.forEach(device => { - if (device.Linked) { - disconnectPromises.push(ble.disconnectDevice(device.deviceId)); - } - }); - } - - if (disconnectPromises.length > 0) { - Promise.allSettled(disconnectPromises).finally(() => { - startSearch(); - }); - } else { - startSearch(); - } - }); + ble.StopSearch().finally(startSearch); diff --git a/utils/BleHelper.js b/utils/BleHelper.js index 18ae9e1..49fcec1 100644 --- a/utils/BleHelper.js +++ b/utils/BleHelper.js @@ -76,12 +76,12 @@ class BleHelper { // recei.ReceiveData(receive, f, path, recArr); // }, "BleReceiveData"); - setTimeout(() => { - this.OpenBlue().then(() => { - this.linkAllDevices(); - }); + // setTimeout(() => { + // this.OpenBlue().then(() => { + // this.linkAllDevices(); + // }); - }, 10); + // }, 10); this.dic = { errRemarks: [{ @@ -139,6 +139,10 @@ class BleHelper { { key: '10013', remark: '连接 deviceId 为空或者是格式不正确' + }, + { + key: '10016', + remark: '定位服务已关闭' } ] } @@ -445,7 +449,7 @@ class BleHelper { getError(ex) { let code = ex.code; - ex.msg = "未知的异常" + ex.msg = code let f = this.dic.errRemarks.find((v) => { return v.key == code; }); diff --git a/utils/request.js b/utils/request.js index 1b50db0..1ac57fc 100644 --- a/utils/request.js +++ b/utils/request.js @@ -5,7 +5,16 @@ const request = (options) => { console.log("options" + JSON.stringify(options), BASE.BASE_URL) return new Promise((resolve, reject) => { // 处理GET请求参数 - let url = BASE.BASE_URL + options.url; + let url =""; + if(options.url.indexOf('http://')===0 || options.url.indexOf('https://')===0){ + url=options.url; + if(options.url.indexOf(BASE.BASE_UR)===-1){ + options.isAuthen=false; + } + }else{ + url=BASE.BASE_URL + options.url; + } + console.log("url" + url) if (options.method === 'GET' && options.data) { // 使用qs序列化参数 diff --git a/utils/update.js b/utils/update.js index 100ac32..880e9de 100644 --- a/utils/update.js +++ b/utils/update.js @@ -12,7 +12,7 @@ function checkAndUpdateWgt(updateUrl) { } // 显示加载提示 - let urls = ['https://dmsapp.skf.com.cn/HummerService/app/CheckUpdate']; + let urls = ['https://dmsapp.skf.com.cn/HummerService/app/CheckUpdate'];// // 1. 获取当前应用版本信息 plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => { @@ -130,7 +130,8 @@ function checkAndUpdateWgt(updateUrl) { let Update1 = () => { return request({ url: '/app/auth/version', - method: 'get' + method: 'get', + isAuthen:false }); } @@ -212,16 +213,24 @@ function downloadAndInstallWgt(wgtUrl) { console.log("无法删除临时文件"); }, complete() { - wating.close(); - uni.showModal({ - title: '更新完成', - content: '应用已更新,是否重启应用?', - showCancel: false, - success: () => { - // 3. 重启应用 - plus.runtime.restart(); - } - }); + wating.setTitle("应用已更新,正在重启"); + setTimeout(()=>{ + wating.close(); + plus.runtime.restart(); + + },1000); + + + // uni.showModal({ + // title: '更新完成', + // content: '应用已更新,点击确定重启应用', + // showCancel: false, + // success() { + + // plus.runtime.restart(); + + // } + // }); } }); -- 2.43.5