1
0
forked from dyf/APP

670小问题修复

This commit is contained in:
liub
2025-09-23 16:57:31 +08:00
parent 2546287bb4
commit ab696c3076
7 changed files with 84 additions and 69 deletions

View File

@ -30,8 +30,9 @@
uni.getSystemInfo({success:function(res){ uni.getSystemInfo({success:function(res){
if(res.uniPlatform=='app'){ if(res.uniPlatform=='app'){
upgrade.checkAndUpdateWgt();
bleTool.getBleTool(); bleTool.getBleTool();
upgrade.checkAndUpdateWgt();
} }
}}); }});
}, },

View File

@ -611,7 +611,9 @@
}, },
success: (res) => { success: (res) => {
debugger; debugger;
let json={persissonType:'670'}; let json = {
persissonType: '670'
};
Object.assign(json, this.device); Object.assign(json, this.device);
res.eventChannel.emit('share', { res.eventChannel.emit('share', {
data: json data: json
@ -1050,7 +1052,7 @@
}); });
}, },
sosSetting: function(type) { sosSetting: function(type) {
debugger;
if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
this.showPop({ this.showPop({
@ -1191,7 +1193,7 @@
this.Status.staticWarn.time = 0; this.Status.staticWarn.time = 0;
return; return;
} }
if (these.formData.qzwarn) { if (these.formData.qzwarn && these.Status.staticWarn.inteval) {
console.log("222222"); console.log("222222");
these.showQzWarn(sendRb); these.showQzWarn(sendRb);
} else { } else {
@ -1212,7 +1214,7 @@
return; return;
} else if (type == 'close') { } else if (type == 'close') {
if (this.formData.SOS = 'sg') { //解除声光报警 if (this.formData.SOS = 'sg' && this.Status.staticWarn.inteval) { //解除声光报警
this.CloseWarn(true); this.CloseWarn(true);
} else { } else {
this.formData.SOS = type; this.formData.SOS = type;

View File

@ -152,6 +152,7 @@
these = this; these = this;
this.EquipMents = []; this.EquipMents = [];
ble = bleTool.getBleTool(); ble = bleTool.getBleTool();
ble.addDeviceFound((arr) => { ble.addDeviceFound((arr) => {
arr = arr.devices; arr = arr.devices;
@ -201,7 +202,10 @@
// this.EquipMents = []; // this.EquipMents = [];
this.PairEquip = []; this.PairEquip = [];
ble && ble.StartSearch().catch((ex) => { ble && ble.StartSearch().then(res=>{
console.log("开始搜索成功",res);
}).catch((ex) => {
console.log("开始搜索出现异常",ex);
if (ex.code == 10001) { if (ex.code == 10001) {
these.showOpenSetting(); these.showOpenSetting();
} }

View File

@ -200,13 +200,13 @@
const selectedPermissions = this.permissions.filter(permission => permission.checked).map( const selectedPermissions = this.permissions.filter(permission => permission.checked).map(
permission => permission =>
permission.value); permission.value);
// const res = await deviceShareAdd({ const res = await deviceShareAdd({
// phonenumber: this.phone, phonenumber: this.phone,
// smsCode: this.code, smsCode: this.code,
// deviceId: this.itemInfo.id, deviceId: this.itemInfo.id,
// permission: selectedPermissions.join(',') permission: selectedPermissions.join(',')
// }) })
let res={code:200};
if (res.code == 200) { if (res.code == 200) {
this.shareShow = true this.shareShow = true
uni.hideLoading() uni.hideLoading()

View File

@ -1,16 +1,17 @@
import receivTool from "@/utils/BleReceive.js" import receivTool from "@/utils/BleReceive.js"
var recei = null; var recei = null;
const serviceDic = [ //合作供应商的蓝牙主服务 const serviceDic = [ //合作供应商的蓝牙主服务
{
"serviceId": "0000AE30-0000-1000-8000-00805F9B34FB",
"writeId": "0000AE03-0000-1000-8000-00805F9B34FB",
"notifyId": "0000AE02-0000-1000-8000-00805F9B34FB"
},
{ {
"serviceId": "0000FFE0-0000-1000-8000-00805F9B34FB", "serviceId": "0000FFE0-0000-1000-8000-00805F9B34FB",
"writeId": "0000FFE1-0000-1000-8000-00805F9B34FB", "writeId": "0000FFE1-0000-1000-8000-00805F9B34FB",
"notifyId": "0000FFE2-0000-1000-8000-00805F9B34FB" "notifyId": "0000FFE2-0000-1000-8000-00805F9B34FB"
},
{
"serviceId": "0000AE30-0000-1000-8000-00805F9B34FB",
"writeId": "0000AE03-0000-1000-8000-00805F9B34FB",
"notifyId": "0000AE02-0000-1000-8000-00805F9B34FB"
} }
]; ];
class BleHelper { class BleHelper {
@ -39,7 +40,10 @@ class BleHelper {
} }
setTimeout(() => { setTimeout(() => {
this.OpenBlue().then(()=>{
this.linkAllDevices(); this.linkAllDevices();
});
}, 10); }, 10);
this.data = { this.data = {
isOpenBlue: false, //蓝牙模块是否开启 isOpenBlue: false, //蓝牙模块是否开启
@ -185,7 +189,7 @@ class BleHelper {
key = new Date().getTime(); key = new Date().getTime();
} }
if (key) { if (key) {
console.log("key=" + key); // console.log("key=" + key);
let f = this.cfg.onDeviceFound.findIndex((v) => { let f = this.cfg.onDeviceFound.findIndex((v) => {
return v.key == key; return v.key == key;
}); });
@ -366,6 +370,7 @@ class BleHelper {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.data.available) { if (this.data.available) {
console.log("蓝牙模块是可用状态");
resolve({ resolve({
available: this.data.available, available: this.data.available,
discovering: this.data.discovering discovering: this.data.discovering
@ -373,6 +378,7 @@ class BleHelper {
return; return;
} }
if (!this.data.isOpenBlue) { if (!this.data.isOpenBlue) {
console.log("蓝牙模块未打开");
resolve({ resolve({
available: false, available: false,
discovering: false discovering: false
@ -381,12 +387,13 @@ class BleHelper {
} }
uni.getBluetoothAdapterState({ uni.getBluetoothAdapterState({
success: (info) => { success: (info) => {
console.log("蓝牙状态获取成功,",info)
this.data.available = info.available; this.data.available = info.available;
this.data.discovering = info.discovering; this.data.discovering = info.discovering;
resolve(info); resolve(info);
}, },
fail: (ex1) => { fail: (ex1) => {
////console.log("ex1", ex1); console.log("蓝牙状态获取失败", ex1);
let res1 = { let res1 = {
available: false, available: false,
discovering: false discovering: false
@ -472,7 +479,7 @@ class BleHelper {
}); });
uni.onBluetoothDeviceFound((devices) => { uni.onBluetoothDeviceFound((devices) => {
// console.log("发现新设备:" + JSON.stringify(devices)); console.log("发现新设备:" + JSON.stringify(devices));
this.data.searchList = this.data.searchList.concat( this.data.searchList = this.data.searchList.concat(
devices); devices);
if (this.cfg.onDeviceFound) { if (this.cfg.onDeviceFound) {
@ -706,6 +713,7 @@ class BleHelper {
// for (let i = 0; i < serviceIds.length; i++) { // for (let i = 0; i < serviceIds.length; i++) {
// promises.push(RunSearch(serviceIds[i])); // promises.push(RunSearch(serviceIds[i]));
// } // }
promises.push(RunSearch()); promises.push(RunSearch());
Promise.all(promises).then(resolve).catch(reject); Promise.all(promises).then(resolve).catch(reject);

View File

@ -257,7 +257,7 @@ export default {
value: "42", value: "42",
label: "SOS", label: "SOS",
checked: false, checked: false,
type: ['210', '6170', '670'] type: ['670']
} }
] ]

View File

@ -1,5 +1,5 @@
import config from '../config/index.js'; import config from '../config/index.js';
const env = 'production'; //production development //开发of线上 改这里就行 const env = 'development'; //production development //开发of线上 改这里就行
const BASE = config[env]; const BASE = config[env];
const request = (options) => { const request = (options) => {
console.log("options"+JSON.stringify(options),BASE.BASE_URL) console.log("options"+JSON.stringify(options),BASE.BASE_URL)