1
0
forked from dyf/APP

添加蓝牙通讯握手

This commit is contained in:
liub
2025-07-29 09:34:15 +08:00
parent 0ac0d1998a
commit 3c0bf2f770
12 changed files with 7993 additions and 10376 deletions

View File

@ -89,7 +89,7 @@ export default {
uni.getBluetoothAdapterState({ uni.getBluetoothAdapterState({
success(res1) { success(res1) {
console.log("当前蓝牙适配器状态:" + JSON.stringify(res1)) //console.log("当前蓝牙适配器状态:" + JSON.stringify(res1))
if (callback) { if (callback) {
callback(res1); callback(res1);
} }
@ -126,7 +126,7 @@ export default {
callback(); callback();
} }
uni.onBluetoothAdapterStateChange(function(state) { uni.onBluetoothAdapterStateChange(function(state) {
console.log('蓝牙状态发生变化:' + JSON.stringify(state)); //console.log('蓝牙状态发生变化:' + JSON.stringify(state));
if (this.BleChangeCallback) { if (this.BleChangeCallback) {
this.BleChangeCallback() this.BleChangeCallback()
} }
@ -232,7 +232,7 @@ export default {
StopSearch: function() { StopSearch: function() {
uni.stopBluetoothDevicesDiscovery({ uni.stopBluetoothDevicesDiscovery({
success: (res) => { success: (res) => {
console.log("停止搜索蓝牙设备成功") //console.log("停止搜索蓝牙设备成功")
}, },
fail() { fail() {
console.log("无法停止蓝牙搜索") console.log("无法停止蓝牙搜索")
@ -242,7 +242,6 @@ export default {
//获取已连接的设备 //获取已连接的设备
getLinkBlue: function(callback) { getLinkBlue: function(callback) {
uni.getConnectedBluetoothDevices({ uni.getConnectedBluetoothDevices({
services: ["0xFFE0"],
success: (res) => { success: (res) => {
if (callback) { if (callback) {
callback(res); callback(res);
@ -250,7 +249,7 @@ export default {
} }
}, },
fail: function(ex) { fail: function(ex) {
console.log("获取已连接设备异常"); console.log("获取已连接设备异常",ex);
if (callback) { if (callback) {
callback({ callback({
devices: [] devices: []
@ -261,7 +260,7 @@ export default {
}, },
//连接某个设备 //连接某个设备
LinkBlue: function(deviceId, callback, error) { LinkBlue: function(deviceId, callback, error) {
//console.log("deviceId="+deviceId)
this.StopSearch(); this.StopSearch();
var these = this; var these = this;
let key = "linkedDevices"; let key = "linkedDevices";
@ -280,24 +279,25 @@ export default {
} }
//连接成功的回调 //连接成功的回调
var lindedCallback = function () { var lindedCallback = function(id,flag) {
let c = linkedDevices.find(function(v) { let c = linkedDevices.find(function(v) {
return v.deviceId == deviceId; return v.deviceId == deviceId;
}); });
if (c) { if (c && !flag) {
console.log("连接成功开始监听特征变化") console.log("连接成功开始监听特征变化deviceid="+deviceId+',serviceId='+c.notifyServiceid+',characteristicId='+c.notifyCharactId)
//监听设备的特征变化 //监听设备的特征变化
setTimeout(()=>{
uni.notifyBLECharacteristicValueChange({ uni.notifyBLECharacteristicValueChange({
deviceId: deviceId, deviceId: deviceId,
serviceId: c.notifyServiceid, serviceId: c.notifyServiceid,
characteristicId: c.notifyCharactId, characteristicId: c.notifyCharactId,
state: true, state: true,
success: function(res) { success: function(res) {
console.log("开始监听成功。。。。") console.log("开始监听成功。。。。",res)
if(res.errCode=='0'){
//订阅特征值 //订阅特征值
uni.onBLECharacteristicValueChange(function(data) { uni.onBLECharacteristicValueChange(function(data) {
// data.characteristicId // data.characteristicId
// data.deviceId // data.deviceId
@ -310,18 +310,21 @@ export default {
} }
}); });
}
} }
}); });
},1000);
} }
if (callback) { if (callback) {
callback(deviceId); callback(deviceId,flag);
} }
} }
var linkState = function(res) { var linkState = function(res) {
console.log("获取已连接的设备回调" + JSON.stringify(res)) //console.log("获取已连接的设备回调" + JSON.stringify(res))
let flag = res.devices.find(function(v) { let flag = res.devices.find(function(v) {
if (v.deviceId == deviceId) { if (v.deviceId == deviceId) {
return true; return true;
@ -329,35 +332,31 @@ export default {
return false; return false;
}); });
if (flag) { if (flag) {
console.log("设备状态已连接"); //console.log("设备状态已连接");
lindedCallback(deviceId); lindedCallback(deviceId,true);
return; return;
} else { } else {
console.log("设备未连接"); console.log("设备未连接:"+deviceId);
linkDevice(deviceId); linkDevice(deviceId);
} }
} }
var linkDevice = function(id) { var linkDevice = function() {
console.log("正在连接"+id); console.log("正在连接" + deviceId);
uni.createBLEConnection({ uni.createBLEConnection({
deviceId: id, deviceId: deviceId,
timeout: 30000, timeout: 30000,
success: function(info) { success: function(info) {
console.log("连接成功"); console.log("连接成功");
uni.setBLEMTU({ var call = () => {
deviceId: id,
mtu: 512,
success: () => {
console.log("mtu设置成功");
if (linkedDevices) { if (linkedDevices) {
console.log("11111" + JSON.stringify(linkedDevices)); console.log("11111" + JSON.stringify(linkedDevices));
f = linkedDevices.find(function(v) { f = linkedDevices.find(function(v) {
return v.deviceId == id; return v.deviceId == deviceId;
}); });
} else { } else {
console.log("22222") console.log("22222")
@ -372,12 +371,13 @@ export default {
these.getLinkBlue(function(res) { these.getLinkBlue(function(res) {
if (res.devices && res.devices.length) { if (res.devices && res.devices.length) {
let f = res.devices.find(function(v) { let f = res.devices.find(function(v) {
return v.deviceId == id; return v.deviceId == deviceId;
}); });
linkedDevices.push(f); linkedDevices.push(f);
uni.setStorageSync(key, JSON.stringify(linkedDevices)); uni.setStorageSync(key, JSON.stringify(
linkedDevices));
getService(id); getService(deviceId);
} }
@ -387,25 +387,43 @@ export default {
} else { } else {
console.log("缓存中已连接过"); console.log("缓存中已连接过");
if (!f.services) { if (!f.services) {
getService(id); getService(deviceId);
} else { } else {
lindedCallback(id); lindedCallback(deviceId,false);
} }
} }
}
let os = uni.getSystemInfoSync().osName;
if (os == 'android') {
uni.setBLEMTU({
deviceId: deviceId,
mtu: 512,
success: () => {
//console.log("mtu设置成功");
}, },
fail: function() { fail: function() {
console.log("mtu设置失败") console.log("mtu设置失败")
},
complete: function() {
call();
} }
}); });
} else {
call();
}
}, },
fail: function(ex) { fail: function(ex) {
if (ex) {
console.log("蓝牙连接失败" + JSON.stringify(ex));
if(error){ if(error){
console.log("蓝牙连接失败" + JSON.stringify(error));
error(ex); error(ex);
} }
}
} }
}); });
} }
@ -436,7 +454,7 @@ export default {
.then(results => { .then(results => {
console.log('所有操作成功完成', results); console.log('所有操作成功完成', results);
lindedCallback(id); lindedCallback(id,false);
}) })
.catch(error => { .catch(error => {
@ -448,7 +466,7 @@ export default {
repeatCnt++; repeatCnt++;
if (repeatCnt > 5) { if (repeatCnt > 5) {
lindedCallback(id); lindedCallback(id,false);
return; return;
} }
@ -498,10 +516,14 @@ export default {
if (notiChar) { if (notiChar) {
v.notifyServiceid = serviceId; v.notifyServiceid = serviceId;
v.notifyCharactId = notiChar.uuid; v.notifyCharactId = notiChar.uuid;
} }
} }
}); });
uni.setStorageSync(key, JSON.stringify(linkedDevices)); uni.setStorageSync(key, JSON.stringify(linkedDevices));
resolve(res); resolve(res);
}, },
@ -522,9 +544,9 @@ export default {
} }
}); });
console.log("正在获取蓝牙适配器状态") //console.log("正在获取蓝牙适配器状态")
this.CheckBlue((res) => { this.CheckBlue((res) => {
console.log("蓝牙状态:" + JSON.stringify(res)); //console.log("蓝牙状态:" + JSON.stringify(res));
if (res.available) { if (res.available) {
this.getLinkBlue(linkState); this.getLinkBlue(linkState);
} else { } else {
@ -607,23 +629,7 @@ export default {
console.log("倒计时2"); console.log("倒计时2");
if (f) { if (f) {
console.log("倒计时1"); console.log("倒计时1");
uni.writeBLECharacteristicValue({ these.sendDataNew(f.deviceId,f.writeServiceId,f.wirteCharactId,buffer).then(succ).catch(err);
deviceId: f.deviceId,
serviceId: f.writeServiceId,
characteristicId: f.wirteCharactId,
value: buffer,
success: () => {
console.log("发送数据成功");
resolve();
},
fail: (err) => {
console.log("发送数据失败" + JSON.stringify(err));
reject(`发送数据失败: ${err.errMsg}`);
},
complete: function() {
console.log("发送数据complete");
}
});
} else { } else {
reject(`已连接设备中无法找到此设备`); reject(`已连接设备中无法找到此设备`);
// console.log("警报:已连接设备中无法找到此设备") // console.log("警报:已连接设备中无法找到此设备")
@ -636,36 +642,67 @@ export default {
}); });
}, },
sendDataNew: function(deviceid, serviceId, characteristicId, buffer) { sendDataNew: function(deviceid, serviceId, characteristicId, buffer) {
console.log("准备向设备发送数据deviceid=" + deviceid); //console.log("准备向设备发送数据deviceid=" + deviceid+',serviceId='+serviceId+',characteristicId='+characteristicId);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let promise = new Promise((succ, err) => {
uni.writeBLECharacteristicValue({ uni.writeBLECharacteristicValue({
deviceId: deviceid, deviceId: deviceid,
serviceId: serviceId, serviceId: serviceId,
characteristicId: characteristicId, characteristicId: characteristicId,
value: buffer, value: buffer,
success: () => { success: () => {
console.log("发送数据成功"); //console.log("发送数据成功");
succ();
},
fail: (ex) => {
console.log("发送数据失败" + JSON.stringify(ex));
err(ex);
}
});
});
if (uni.getSystemInfoSync().osName.toLowerCase() == 'ios') {
//专业给IOS填坑uni.writeBLECharacteristicValue在IOS上不进入任何回调
function timeout(ms) {
return new Promise((_, err) => {
setTimeout(() => {
err({
code: -1,
errMsg: '超时了'
})
}, ms);
});
}
Promise.race([promise, timeout(50)]).then(resolve).catch((ex) => {
console.log("ex=", ex);
if (ex.code == -1) {
resolve(); resolve();
}, } else {
fail: (err) => { reject(ex);
console.log("发送数据失败" + JSON.stringify(err));
reject(`发送数据失败: ${err.errMsg}`);
},
complete: function() {
console.log("发送数据complete");
} }
}).finally(() => {
console.log("完成了")
});
} else {
promise.then(resolve).catch(reject);
}
}); });
});
} }
} }

View File

@ -1,6 +1,7 @@
{ {
"pages": [ "pages": [
{ {
"path": "pages/common/login/index", "path": "pages/common/login/index",
"style": { "style": {
@ -121,12 +122,21 @@
"fullscreen": true "fullscreen": true
} }
}, },
{
"path" : "pages/650/HBY650",
"style" :
{
"navigationBarTitleText" : "HBY650"
}
},
{ {
"path": "pages/common/map/index", "path": "pages/common/map/index",
"style": { "style": {
"navigationBarTitleText": "地图" "navigationBarTitleText": "地图"
} }
} }
], ],
"tabBar": { "tabBar": {
"color": "#fff", "color": "#fff",

View File

@ -144,8 +144,7 @@
</template> </template>
<script> <script>
import ble from '../../api/6155/BlueHelper'; import ble from '@/api/6155/BlueHelper';
import { deviceReName } from '../../api/common';
export default { export default {
data() { data() {
@ -242,7 +241,11 @@ import { deviceReName } from '../../api/common';
id: 'HSXF01061' id: 'HSXF01061'
}, },
device: { device: {
deviceId: '' deviceId: '',
writeServiceId: '',
wirteCharactId: '',
notifyServiceid:'',
notifyCharactId:''
} }
} }
}, },
@ -299,7 +302,7 @@ import { deviceReName } from '../../api/common';
content: '是否断开与设备的蓝牙连接?', content: '是否断开与设备的蓝牙连接?',
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
disconnectDevice(these.device.deviceId); ble.disconnectDevice(these.device.deviceId);
} }
uni.navigateBack(); uni.navigateBack();
@ -332,6 +335,49 @@ import { deviceReName } from '../../api/common';
} }
}, },
methods: { methods: {
getDevice: function() {
var these = this;
if (this.device.deviceId && this.device.writeServiceId && this.device.wirteCharactId) {
return this.device;
}
let key = "linkedDevices";
var store = uni.getStorageInfoSync();
var f = store.keys.find(function(v) {
return v == key;
});
// console.log("倒计时5");
var linkedDevices = [];
if (f) {
var str = uni.getStorageSync(key);
if (str) {
linkedDevices = JSON.parse(str);
}
}
// console.log("倒计时4");
if (linkedDevices && linkedDevices.length && linkedDevices.length > 0) {
// console.log("倒计时3");
f = linkedDevices.find(function(v) {
if(v.deviceId == these.device.deviceId){
these.device.writeServiceId=v.writeServiceId;
these.device.wirteCharactId=v.wirteCharactId;
these.device.notifyServiceid=v.notifyServiceid;
these.device.notifyCharactId=v.notifyCharactId;
return true;
}
return false;
});
} else {
f = null;
}
return f;
},
bleValueNotify: function(data) { bleValueNotify: function(data) {
console.log("读取到设备发送的数据:" + JSON.stringify(data)); console.log("读取到设备发送的数据:" + JSON.stringify(data));
// data.characteristicId // data.characteristicId
@ -404,35 +450,10 @@ import { deviceReName } from '../../api/common';
// 分包发送图片数据 // 分包发送图片数据
var sendImagePackets = function(imageData) { var sendImagePackets = function(imageData) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// this.isSending = true;
// this.progress = 0;
// this.currentPacket = 0;
// 总数据包数 // 总数据包数
const totalPackets = 52; const totalPackets = 52;
let currentPacket = 1; let currentPacket = 1;
f = these.getDevice();
let key = "linkedDevices";
var store = uni.getStorageInfoSync();
var f = store.keys.find(function(v) {
return v == key;
});
// console.log("倒计时5");
var linkedDevices = [];
if (f) {
var str = uni.getStorageSync(key);
if (str) {
linkedDevices = JSON.parse(str);
}
}
// console.log("倒计时4");
if (linkedDevices && linkedDevices.length && linkedDevices.length > 0) {
// console.log("倒计时3");
f = linkedDevices.find(function(v) {
return v.deviceId == these.device.deviceId;
});
if (f) { if (f) {
// 发送单个数据包 // 发送单个数据包
const sendNextPacket = () => { const sendNextPacket = () => {
@ -531,7 +552,7 @@ import { deviceReName } from '../../api/common';
} }
}
@ -594,8 +615,7 @@ import { deviceReName } from '../../api/common';
switch (type) { switch (type) {
case "main": case "main":
title = '主灯模式'; title = '主灯模式';
items = [ items = [{
{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/6155/DeviceDetail/qiang.png'
}, },
@ -696,10 +716,12 @@ import { deviceReName } from '../../api/common';
} }
dataView.setUint8(5, dataValue); // 数据 dataView.setUint8(5, dataValue); // 数据
dataView.setUint16(6, '9C41'); dataView.setUint16(6, '9C41');
let f = this.getDevice();
// 发送数据 // 发送数据
ble.LinkBlue(this.device.deviceId, () => { ble.LinkBlue(f.deviceId, () => {
setTimeout(() => { setTimeout(() => {
ble.sendData(this.device.deviceId, buffer); ble.sendDataNew(f.deviceId, f.writeServiceId, f.wirteCharactId, buffer);
}, 1000); }, 1000);
}); });
@ -800,10 +822,14 @@ import { deviceReName } from '../../api/common';
console.log("dataView.length=" + dataView.byteLength) console.log("dataView.length=" + dataView.byteLength)
let f = these.getDevice();
if (f) {
// 发送数据包 // 发送数据包
ble.LinkBlue(these.device.deviceId, () => { ble.LinkBlue(f.deviceId, () => {
setTimeout(() => { setTimeout(() => {
ble.sendData(these.device.deviceId, buffer).then(() => { ble.sendDataNew(f.deviceId, f.writeServiceId, f
.wirteCharactId, buffer).then(() => {
// 更新进度 // 更新进度
console.log( console.log(
`发送文字数据包 ${currentPacket}/${totalPackets}: ${text}` `发送文字数据包 ${currentPacket}/${totalPackets}: ${text}`
@ -822,6 +848,7 @@ import { deviceReName } from '../../api/common';
}, 0); }, 0);
}); });
}
// }).catch(err => { // }).catch(err => {
// this.isSendingText = false; // this.isSendingText = false;
@ -868,14 +895,16 @@ import { deviceReName } from '../../api/common';
dataView.setUint8(3, 0x00); // 数据长度 dataView.setUint8(3, 0x00); // 数据长度
dataView.setUint8(4, 0x01); // 数据长度 dataView.setUint8(4, 0x01); // 数据长度
dataView.setUint8(5, data); // 数据 dataView.setUint8(5, data); // 数据
let f = this.getDevice();
if (f) {
// 发送数据 // 发送数据
ble.LinkBlue(this.device.deviceId, () => { ble.LinkBlue(f.deviceId, () => {
setTimeout(() => { setTimeout(() => {
ble.sendData(this.device.deviceId, buffer); ble.sendDataNew(f.deviceId, f.writeServiceId, f.wirteCharactId, buffer);
}, 1000) }, 1000)
}); });
}
}, },
//获取当前设备状态 //获取当前设备状态
@ -911,13 +940,16 @@ import { deviceReName } from '../../api/common';
dataView.setUint8(1, type); // 帧类型:亮度调节 dataView.setUint8(1, type); // 帧类型:亮度调节
dataView.setUint8(2, '0x01'); // 包序号 dataView.setUint8(2, '0x01'); // 包序号
dataView.setUint8(3, '9C41'); // 数据长度 dataView.setUint8(3, '9C41'); // 数据长度
let f = this.getDevice();
if (f) {
// 发送数据 // 发送数据
ble.LinkBlue(this.device.deviceId, () => { ble.LinkBlue(f.deviceId, () => {
setTimeout(() => { setTimeout(() => {
ble.sendData(this.device.deviceId, buffer); ble.sendDataNew(f.deviceId, f.writeServiceId, f.wirteCharactId, buffer);
}, 100) }, 100)
}); });
}
} }

1813
pages/650/HBY650.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -357,7 +357,7 @@
if (item.typeName == '6155') { if (item.typeName == '6155') {
uni.navigateTo({ uni.navigateTo({
url: "/pages/6155/deviceDetail", url: "/pages/650/HBY650",
events: { events: {
ack: function(data) { ack: function(data) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -125,7 +125,7 @@ String.prototype.transFloat = function() {
// //
if (uni.getSystemInfoSync().platform){ if (uni.getSystemInfoSync().platform.toLowerCase()=='android' || uni.getSystemInfoSync().platform.toLowerCase()=='ios'){
uni.onBluetoothAdapterStateChange(function(res) { uni.onBluetoothAdapterStateChange(function(res) {
if (!res.available) { if (!res.available) {
isOpen = false isOpen = false

View File

@ -1,13 +1,8 @@
var isReady=false;var onReadyCallbacks=[]; var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[]; var isServiceReady=false;var onServiceReadyCallbacks=[];
<<<<<<< HEAD var __uniConfig = {"pages":["pages/650/HBY650","pages/common/login/index","pages/common/index/index","pages/common/user/index","pages/common/scan/scan","pages/common/qrcode/qrcode","pages/common/send/index","pages/common/userAgreement/index","pages/common/privacyAgreement/index","pages/common/aboutUs/index","pages/6170/deviceControl/index","pages/common/operationVideo/index","pages/common/addvideo/index","pages/common/operatingInstruct/index","pages/common/productDes/index","pages/common/addBLE/addEquip","pages/common/addBLE/LinkBle","pages/6155/deviceDetail","pages/6155/ImgCrop","pages/common/map/index"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#121212","backgroundColor":"#121212"},"tabBar":{"color":"#fff","selectedColor":"#BBE600","backgroundColor":"#202020","list":[{"pagePath":"pages/common/index/index","text":"我的设备","iconPath":"/static/tabs/device.png","selectedIconPath":"/static/tabs/device-HL.png"},{"pagePath":"pages/common/user/index","text":"我的","iconPath":"/static/tabs/my.png","selectedIconPath":"/static/tabs/my-HL.png"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"JingQuan","compilerVersion":"4.75","entryPagePath":"pages/650/HBY650","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniConfig = {"pages":["pages/common/login/index","pages/common/index/index","pages/common/user/index","pages/common/scan/scan","pages/common/qrcode/qrcode","pages/common/send/index","pages/common/userAgreement/index","pages/common/privacyAgreement/index","pages/common/aboutUs/index","pages/6170/deviceControl/index","pages/common/operationVideo/index","pages/common/addvideo/index","pages/common/operatingInstruct/index","pages/common/productDes/index","pages/common/addBLE/addEquip","pages/common/addBLE/LinkBle","pages/6155/deviceDetail","pages/6155/ImgCrop"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#121212","backgroundColor":"#121212"},"tabBar":{"color":"#fff","selectedColor":"#BBE600","backgroundColor":"#202020","list":[{"pagePath":"pages/common/index/index","text":"我的设备","iconPath":"/static/tabs/device.png","selectedIconPath":"/static/tabs/device-HL.png"},{"pagePath":"pages/common/user/index","text":"我的","iconPath":"/static/tabs/my.png","selectedIconPath":"/static/tabs/my-HL.png"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"JingQuan","compilerVersion":"4.75","entryPagePath":"pages/common/login/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; var __uniRoutes = [{"path":"/pages/650/HBY650","meta":{"isQuit":true},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/common/login/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/user/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/common/scan/scan","meta":{},"window":{"navigationBarTitleText":"扫描"}},{"path":"/pages/common/qrcode/qrcode","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/common/send/index","meta":{},"window":{"navigationBarTitleText":"发送信息"}},{"path":"/pages/common/userAgreement/index","meta":{},"window":{"navigationBarTitleText":"用户协议"}},{"path":"/pages/common/privacyAgreement/index","meta":{},"window":{"navigationBarTitleText":"隐私协议"}},{"path":"/pages/common/aboutUs/index","meta":{},"window":{"navigationBarTitleText":"关于我们"}},{"path":"/pages/6170/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operationVideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addvideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operatingInstruct/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/productDes/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addBLE/addEquip","meta":{},"window":{"navigationBarTitleText":"添加设备"}},{"path":"/pages/common/addBLE/LinkBle","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/6155/deviceDetail","meta":{},"window":{"navigationBarTitleText":"HBY 6155"}},{"path":"/pages/6155/ImgCrop","meta":{},"window":{"navigationBarTitleText":"图像裁剪","navigationStyle":"custom","fullscreen":true}},{"path":"/pages/common/map/index","meta":{},"window":{"navigationBarTitleText":"地图"}}];
var __uniRoutes = [{"path":"/pages/common/login/index","meta":{"isQuit":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/user/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/common/scan/scan","meta":{},"window":{"navigationBarTitleText":"扫描"}},{"path":"/pages/common/qrcode/qrcode","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/common/send/index","meta":{},"window":{"navigationBarTitleText":"发送信息"}},{"path":"/pages/common/userAgreement/index","meta":{},"window":{"navigationBarTitleText":"用户协议"}},{"path":"/pages/common/privacyAgreement/index","meta":{},"window":{"navigationBarTitleText":"隐私协议"}},{"path":"/pages/common/aboutUs/index","meta":{},"window":{"navigationBarTitleText":"关于我们"}},{"path":"/pages/6170/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operationVideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addvideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operatingInstruct/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/productDes/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addBLE/addEquip","meta":{},"window":{"navigationBarTitleText":"添加设备"}},{"path":"/pages/common/addBLE/LinkBle","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/6155/deviceDetail","meta":{},"window":{"navigationBarTitleText":"HBY 6155"}},{"path":"/pages/6155/ImgCrop","meta":{},"window":{"navigationBarTitleText":"图像裁剪","navigationStyle":"custom","fullscreen":true}}];
=======
var __uniConfig = {"pages":["pages/common/login/index","pages/common/index/index","pages/common/user/index","pages/common/scan/scan","pages/common/qrcode/qrcode","pages/common/send/index","pages/common/userAgreement/index","pages/common/privacyAgreement/index","pages/common/aboutUs/index","pages/6170/deviceControl/index","pages/common/operationVideo/index","pages/common/addvideo/index","pages/common/operatingInstruct/index","pages/common/productDes/index","pages/common/addBLE/addEquip","pages/common/addBLE/LinkBle","pages/6155/deviceDetail","pages/6155/ImgCrop","pages/common/map/index"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#121212","backgroundColor":"#121212"},"tabBar":{"color":"#fff","selectedColor":"#BBE600","backgroundColor":"#202020","list":[{"pagePath":"pages/common/index/index","text":"我的设备","iconPath":"/static/tabs/device.png","selectedIconPath":"/static/tabs/device-HL.png"},{"pagePath":"pages/common/user/index","text":"我的","iconPath":"/static/tabs/my.png","selectedIconPath":"/static/tabs/my-HL.png"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"JingQuan","compilerVersion":"4.64","entryPagePath":"pages/common/login/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/common/login/index","meta":{"isQuit":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/user/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/common/scan/scan","meta":{},"window":{"navigationBarTitleText":"扫描"}},{"path":"/pages/common/qrcode/qrcode","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/common/send/index","meta":{},"window":{"navigationBarTitleText":"发送信息"}},{"path":"/pages/common/userAgreement/index","meta":{},"window":{"navigationBarTitleText":"用户协议"}},{"path":"/pages/common/privacyAgreement/index","meta":{},"window":{"navigationBarTitleText":"隐私协议"}},{"path":"/pages/common/aboutUs/index","meta":{},"window":{"navigationBarTitleText":"关于我们"}},{"path":"/pages/6170/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operationVideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addvideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operatingInstruct/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/productDes/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addBLE/addEquip","meta":{},"window":{"navigationBarTitleText":"添加设备"}},{"path":"/pages/common/addBLE/LinkBle","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/6155/deviceDetail","meta":{},"window":{"navigationBarTitleText":"HBY 6155"}},{"path":"/pages/6155/ImgCrop","meta":{},"window":{"navigationBarTitleText":"图像裁剪","navigationStyle":"custom","fullscreen":true}},{"path":"/pages/common/map/index","meta":{},"window":{"navigationBarTitleText":"地图"}}];
>>>>>>> 56f05e7eec738c788fc1d3cd6bcfcf9aacde170c
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

122
utils/gbk.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
const BASE_URL = 'http://192.168.2.34:8000'; const BASE_URL = 'http://192.168.110.54:8000';
const request = (options) => { const request = (options) => {
console.log("options"+JSON.stringify(options)) console.log("options"+JSON.stringify(options))
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -19,9 +19,11 @@ const request = (options) => {
header: options.header || {}, header: options.header || {},
timeout: 10000, timeout: 10000,
success: (res) => { success: (res) => {
console.log("请求成功",res);
resolve(res.data); resolve(res.data);
}, },
fail: (err) => { fail: (err) => {
console.log("请求失败",err);
reject(err); reject(err);
} }
}; };