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

View File

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

View File

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

View File

@ -1,13 +1,8 @@
var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[];
<<<<<<< HEAD
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/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
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 __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":"地图"}}];
__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()})}});
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) => {
console.log("options"+JSON.stringify(options))
return new Promise((resolve, reject) => {
@ -19,9 +19,11 @@ const request = (options) => {
header: options.header || {},
timeout: 10000,
success: (res) => {
console.log("请求成功",res);
resolve(res.data);
},
fail: (err) => {
console.log("请求失败",err);
reject(err);
}
};