1
0
forked from dyf/APP

Merge branch 'liubiao-new-20250827'

This commit is contained in:
fengerli
2025-10-31 11:15:39 +08:00
27 changed files with 5240 additions and 1780 deletions

View File

@ -7,7 +7,7 @@
<script>
export default {
name: "textToDotMatrix",
name: "textToDotMatrixFor7305",
props: {
txts: {
type: Array,

View File

@ -2,7 +2,7 @@
"name" : "星汉物联",
"appid" : "__UNI__A21EF43",
"description" : "设备管控",
"versionName" : "1.0.3",
"versionName" : "1.0.6",
"versionCode" : "100",
"transformPx" : false,
/* 5+App */
@ -22,8 +22,7 @@
"Bluetooth" : {},
"Camera" : {},
"Geolocation" : {},
"Maps" : {},
"Record" : {}
"Maps" : {}
},
/* */
"distribute" : {

View File

@ -264,6 +264,20 @@
{
"navigationBarTitleText" : "语音管理"
}
},
{
"path" : "pages/4877/BJQ4877",
"style" :
{
"navigationBarTitleText" : "BJQ 4877"
}
},
{
"path" : "pages/100/HBY100",
"style" :
{
"navigationBarTitleText" : "HBY 100"
}
}

1609
pages/100/HBY100.vue Normal file

File diff suppressed because it is too large Load Diff

1592
pages/4877/BJQ4877.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -357,6 +357,7 @@
these.formData.img = device.devicePic;
these.formData.id = device.id;
these.formData.deviceId = f.deviceId;
these.formData.bleStatu = false;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
});
@ -514,11 +515,14 @@
return f;
},
bleValueNotify: function(receive, device, path,recArr) {
bleValueNotify: function(receive, device, path, recArr) {
if (receive.deviceId !== this.formData.deviceId) {
return;
}
if (this.Status.pageHide) {
return;
}
let json = recei.ReceiveData(receive, device, path,recArr);
let json = recei.ReceiveData(receive, device, path, recArr);
if (!json) {
return;
}
@ -571,6 +575,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
okCallback: function() {
// console.log("1111");
uni.navigateTo({
@ -1027,39 +1032,52 @@
this.Status.Pop.showPop = false;
},
showPop: function(option) {
hideLoading(this);
let defaultCfg = {
showHeader: false,
headerTxt: "",
showHeader: false,
showCancel: false,
borderColor: '#BBE600',
buttonBgColor: '#BBE600',
okCallback: null,
cancelCallback: null,
let def = {
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '',
buttonText: '确定',
clickEvt: ''
};
if (!option) {
clickEvt: '',
visiblePrompt: false,
promptTitle: '',
modelValue: '',
visibleClose: false,
okCallback: null,
showSlot: false,
buttonCancelText: '',
showCancel: false,
}
}
let keys = Object.keys(option);
for (var i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
keys = Object.keys(defaultCfg);
for (var i = 0; i < keys.length; i++) {
let keys = Object.keys(def);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
if (key in option) {
continue;
}
this.Status.Pop[key] = defaultCfg[key];
this.Status.Pop[key] = def[key];
}
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
}
this.Status.Pop.showPop = true;
if (!option.borderColor) {
option.borderColor = '#BBE600';
option.buttonBgColor = '#BBE600';
}
these.Status.Pop.showPop = true;
},
sendUsr() {
let f = this.getDevice();

View File

@ -247,6 +247,7 @@
data() {
return {
Status: {
pageHide: false,
showLightingSet: false,
showVolumeSet: false,
Pop: {
@ -675,6 +676,9 @@
},
bleValueNotify: function(receive, device, path) { //订阅消息
if (receive.deviceId !== this.formData.deviceId) {
return;
}
console.log("收到设备的数据", receive)
let data = recei.ReceiveData(receive, device, pagePath);
@ -717,13 +721,13 @@
showBleUnConnect() {
these.showPop({
this.showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#FFFFFFde',
buttonTextColor: '#232323de',
okCallback: function() {
uni.navigateTo({
@ -731,7 +735,7 @@
events: {
BindOver: function(data) {
console.log(data)
these.formData.bleStatu=true;
these.formData.bleStatu = true;
}
},
success: function(res) {
@ -797,6 +801,7 @@
}
},
showPop: function(option) {
hideLoading(this);
let def = {
showPop: true, //是否显示弹窗
popType: 'custom',
@ -807,14 +812,16 @@
buttonTextColor: '#232323DE',
iconUrl: '',
message: '',
buttonText: '',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '',
modelValue: '',
visibleClose: false,
okCallback: null,
showSlot: false
showSlot: false,
buttonCancelText: '',
showCancel: false,
}
let keys = Object.keys(def);
@ -824,14 +831,14 @@
if (key in option) {
continue;
}
these.Status.Pop[key] = def[key];
this.Status.Pop[key] = def[key];
}
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
these.Status.Pop[key] = option[key];
this.Status.Pop[key] = option[key];
}
}

View File

@ -192,7 +192,7 @@
data() {
return {
Status: {
pageHide: false,
Pop: {
showPop: false, //是否显示弹窗
popType: 'custom',
@ -345,10 +345,10 @@
these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.bleStatu = false;
these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res=>{
these.formData.bleStatu=true;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
});
these.setBleFormData();
these.getDetail();
@ -490,9 +490,12 @@
return className;
},
bleValueNotify: function(receive, device, path,recArr) { //订阅消息
bleValueNotify: function(receive, device, path, recArr) { //订阅消息
if (receive.deviceId !== this.formData.deviceId) {
return;
}
console.log("收到设备的数据", receive)
let data = recei.ReceiveData(receive, device, pagePath,recArr);
let data = recei.ReceiveData(receive, device, pagePath, recArr);
if (data) {
if ("staBlue_picture" in data) {
@ -559,7 +562,7 @@
getDetail() {
var that = this;
usrApi.getDetail(this.device.id).then(res => {
console.log("res=",res);
console.log("res=", res);
if (res && res.code == 200) {
res = res.data;
let personnelInfo = res.personnelInfo;
@ -684,7 +687,7 @@ console.log("res=",res);
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#FFFFFFde',
buttonTextColor: '#232323de',
okCallback: function() {
uni.navigateTo({
@ -692,7 +695,7 @@ console.log("res=",res);
events: {
BindOver: function(data) {
console.log(data)
these.formData.bleStatu=true;
these.formData.bleStatu = true;
}
},
success: function(res) {
@ -1261,17 +1264,47 @@ console.log("res=",res);
}
},
showPop: function(option) {
hideLoading(this);
let def = {
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '',
modelValue: '',
visibleClose: false,
okCallback: null,
showSlot: false,
buttonCancelText: '',
showCancel: false,
}
if (!option) {
option = {
a: 1
};
}
let keys = Object.keys(option);
for (var i = 0; i < keys.length; i++) {
let keys = Object.keys(def);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
these.Status.Pop[key] = option[key];
if (key in option) {
continue;
}
this.Status.Pop[key] = def[key];
}
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
}
if (!option.borderColor) {
option.borderColor = '#BBE600';
option.buttonBgColor = '#BBE600';

View File

@ -523,6 +523,7 @@
these.formData['imei'] = these.device.deviceImei;
}
these.getDetail();
these.formData.bleStatu = false;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
});
@ -530,10 +531,10 @@
},
onShow() {
this.Status.pageHide=false;
this.Status.pageHide = false;
},
onHide: function() {
this.Status.pageHide=true;
this.Status.pageHide = true;
},
onBackPress(e) {
ble.removeReceiveCallback(pagePath);
@ -627,11 +628,12 @@
return;
}
this.showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备,取消"+(4-this.Status.bleLinkCnt)+"次后不再提醒",
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备,取消" + (4 - this.Status.bleLinkCnt) + "次后不再提醒",
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
showCancel: true,
cancelCallback: () => {
// this.closePop();
@ -643,7 +645,7 @@
events: {
BindOver: function(data) {
console.log(data)
these.formData.bleStatu=true;
these.formData.bleStatu = true;
}
},
success: function(res) {
@ -982,9 +984,11 @@
this.refreshFormData(receiveData, 'auto');
return receiveData;
},
bleValueNotify: function(receive, device, path,recArr) { //订阅消息
let data = recei.ReceiveData(receive, device, pagePath,recArr);
bleValueNotify: function(receive, device, path, recArr) { //订阅消息
if (receive.deviceId !== this.formData.deviceId) {
return;
}
let data = recei.ReceiveData(receive, device, pagePath, recArr);
console.log("收到设备的数据", data)
if (data) {
if ("staBlue_picture" in data) {
@ -1395,7 +1399,7 @@
these.Status.staticWarn.inteval = null;
these.formData.qzwarn = false;
if(this.Status.Pop.okCallback){
if (this.Status.Pop.okCallback) {
these.CloseWarn(false);
these.formData.SOS = 'close';
}
@ -1432,9 +1436,10 @@
this.Status.staticWarn.time = 0;
return;
}
if (these.formData.qzwarn && these.Status.staticWarn.inteval && these.Status.staticWarn.time) {
if (these.formData.qzwarn && these.Status.staticWarn.inteval && these.Status.staticWarn
.time) {
console.log("222222");
this.Status.Pop.okCallback=null;
this.Status.Pop.okCallback = null;
these.showQzWarn(sendRb);
} else {
sendRb();
@ -2169,39 +2174,51 @@
},
showPop: function(option) {
hideLoading(this);
let defaultCfg = {
showHeader: false,
headerTxt: "",
showHeader: false,
showCancel: false,
borderColor: '#BBE600',
buttonBgColor: '#BBE600',
okCallback: null,
cancelCallback: null,
let def = {
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '',
modelValue: '',
visibleClose: false,
okCallback: null,
showSlot: false,
buttonCancelText: '',
showCancel: false,
buttonCancelText: '取消',
clickEvt: ''
};
if (!option) {
}
}
let keys = Object.keys(option);
for (var i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
keys = Object.keys(defaultCfg);
for (var i = 0; i < keys.length; i++) {
let keys = Object.keys(def);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
if (key in option) {
continue;
}
this.Status.Pop[key] = defaultCfg[key];
this.Status.Pop[key] = def[key];
}
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
}
this.Status.Pop.showPop = true;
if (!option.borderColor) {
option.borderColor = '#BBE600';
option.buttonBgColor = '#BBE600';
}
these.Status.Pop.showPop = true;
},
sendUsr: function(ReSendNo) {
@ -2337,9 +2354,9 @@
// 获取当前行文字
const text = textLines[currentPacket - 1] || '';
let arr = gbk.encode(text)
console.log("arr=",arr);
console.log("arr=", arr);
let gbkData = gbk.arr2hex(arr);
console.log("gbkData=",gbkData);
console.log("gbkData=", gbkData);
// 构建数据包
const bufferSize = 5 + gbkData.length / 2; // 头部4字节 + 数据部分

View File

@ -8,14 +8,14 @@
<view class="row">
<image class="img" src="/static/images/6155/DeviceDetail/battry.png" mode="aspectFit"></image>
<view class="txt">
<view class="bigTxt">{{ formData.battary }}%</view>
<view class="bigTxt">{{formData.battary}}%</view>
<view class="smallTxt">电量</view>
</view>
</view>
<view class="row">
<image class="img" src="/static/images/6155/DeviceDetail/time.png" mode="aspectFit"></image>
<view class="txt">
<view class="bigTxt">{{ formData.xuhang }}</view>
<view class="bigTxt">{{formData.xuhang}}</view>
<view class="smallTxt">续航时间</view>
</view>
</view>
@ -24,25 +24,25 @@
<view class="eqinfo">
<view class="item">
<text class="lbl">蓝牙名称</text>
<text class="value">{{ formData.blename }}</text>
<text class="value">{{formData.blename}}</text>
</view>
<view class="item">
<text class="lbl">设备名称</text>
<text class="value">{{ formData.deviceName }}</text>
<text class="value">{{formData.deviceName}}</text>
</view>
<view class="item">
<text class="lbl">充电状态</text>
<text class="value">{{ formData.statu }}</text>
<text class="value">{{formData.statu}}</text>
</view>
<view class="item">
<text class="lbl">蓝牙状态</text>
<text class="value" :class="formData.bleStatu ? 'green' : 'red'">{{ formData.bleStatu ? '已连接' : '未连接' }}</text>
<text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text>
</view>
</view>
<view class="lamp">
<view class="title">
<text>灯光亮度</text>
<text>{{ formData.liangDu }}%</text>
<text>{{formData.liangDu}}%</text>
</view>
<view class="slider-container">
@ -59,7 +59,7 @@
</view>
<view class="rightTxt">
<text class="bigTxt">主灯模式</text>
<text class="smallTxt">{{ getMode }}</text>
<text class="smallTxt">{{getMode}}</text>
</view>
</view>
<!-- <view class="mode marginLeft fleft" v-on:click.stop="ModeSetting('fu')">
@ -88,20 +88,23 @@
<view class="btnSend fright" v-on:click.stop="sendUsr">发送</view>
<view class="clear"></view>
<textToDotMatrixFor7305 class="TextToHex" ref="textToHex" :txts="formData.textLines"
:bgColor="'#FFFFFF'" :color="'#000000'" :fontSize="11"></textToDotMatrixFor7305>
:bgColor="'#FFFFFF'" :color="'#000000'" :fontSize="11" ></textToDotMatrixFor7305>
</view>
<view class="item">
<text class="lbl">单位</text>
<input class="value" v-model="formData.textLines[0]" placeholder="请输入单位" placeholder-class="usrplace" />
<input class="value" v-model="formData.textLines[0]" placeholder="请输入单位"
placeholder-class="usrplace" />
</view>
<view class="item">
<text class="lbl">部门</text>
<input class="value" v-model="formData.textLines[1]" placeholder="请输入姓名" placeholder-class="usrplace" />
<input class="value" v-model="formData.textLines[1]" placeholder="请输入姓名"
placeholder-class="usrplace" />
</view>
<view class="item">
<text class="lbl">姓名</text>
<input class="value" v-model="formData.textLines[2]" placeholder="请输入职位" placeholder-class="usrplace" />
<input class="value" v-model="formData.textLines[2]" placeholder="请输入职位"
placeholder-class="usrplace" />
</view>
</view>
@ -147,23 +150,23 @@
</template>
<script>
import textToDotMatrixFor7305 from '@/components/TextToHex/textToDotMatrixFor7305.vue';
import bleTool from '@/utils/BleHelper.js';
import usrApi from '@/api/670/HBY670.js'
import {
import textToDotMatrixFor7305 from '@/components/TextToHex/textToDotMatrixFor7305.vue';
import bleTool from '@/utils/BleHelper.js';
import usrApi from '@/api/670/HBY670.js'
import {
showLoading,
hideLoading,
updateLoading
} from '@/utils/loading.js'
import BleReceive from '@/utils/BleReceive';
} from '@/utils/loading.js'
import BleReceive from '@/utils/BleReceive';
var ble = null;
var these = null;
var BrighInteval = null;
var recei = null;
var pagePath = "/pages/7305/BJQ7305";
export default {
var ble = null;
var these = null;
var BrighInteval = null;
var recei = null;
var pagePath = "/pages/7305/BJQ7305";
export default {
components: {
textToDotMatrixFor7305
},
@ -266,7 +269,7 @@ export default {
onUnload() {
ble.removeAllCallback(pagePath);
},
onLoad: function () {
onLoad: function() {
these = this;
recei = BleReceive.getBleReceive();
ble = bleTool.getBleTool();
@ -278,7 +281,7 @@ export default {
ble.addRecoveryCallback(these.deviceRecovry, pagePath);
let eventChannel = this.getOpenerEventChannel();
eventChannel.on('detailData', function (data) {
eventChannel.on('detailData', function(data) {
let device = data.data;
@ -322,15 +325,15 @@ export default {
});
},
onHide: function () {
onHide: function() {
this.Status.pageHide = true;
console.log("页面隐藏");
},
onShow: function () {
onShow: function() {
this.Status.pageHide = false;
},
computed: {
RSSIRemark: function () {
RSSIRemark: function() {
let remark = '极弱';
if (this.formData.RSSI <= 0 && this.formData.RSSI >= -30) {
remark = '强';
@ -456,7 +459,7 @@ export default {
urls: [img]
})
},
getDevice: function () {
getDevice: function() {
// console.log("LinkedList=", ble.data.LinkedList);
// console.log("formData=", these.formData);
let f = ble.data.LinkedList.find((v) => {
@ -465,7 +468,7 @@ export default {
return f;
},
bleValueNotify: function (receive, device, path, recArr) {
bleValueNotify: function(receive, device, path, recArr) {
if (this.Status.pageHide) {
return;
@ -499,7 +502,7 @@ export default {
},
proParam: function () {
proParam: function() {
uni.navigateTo({
url: '/pages/common/productDes/index?id=' + this.formData.id,
@ -508,7 +511,7 @@ export default {
}
});
},
handRemark: function () {
handRemark: function() {
uni.navigateTo({
url: '/pages/common/operatingInstruct/index?id=' + this.formData.id,
success(ev) {
@ -516,7 +519,7 @@ export default {
}
});
},
handVideo: function () {
handVideo: function() {
uni.navigateTo({
url: '/pages/common/operationVideo/index?id=' + this.formData.id,
success(ev) {
@ -531,17 +534,17 @@ export default {
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
okCallback: function () {
okCallback: function() {
console.log("1111");
uni.navigateTo({
url: "/pages/common/addBLE/addEquip",
events: {
BindOver: function (data) {
BindOver: function(data) {
console.log(data)
these.formData.bleStatu = true;
}
},
success: function (res) {
success: function(res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('detailData', {
data: these.device
@ -554,7 +557,7 @@ export default {
}
});
},
checkImgUpload: function () {
checkImgUpload: function() {
let f = these.getDevice();
if (!f) {
@ -567,7 +570,7 @@ export default {
// 分包发送图片数据
var sendImagePackets = function (packetData) {
var sendImagePackets = function(packetData) {
return new Promise((resolve, reject) => {
try {
// 1. 构建一个包含完整头、数据和尾的完整数据包
@ -661,11 +664,11 @@ export default {
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album'],
success: function (res) {
success: function(res) {
uni.navigateTo({
url: "/pages/6155/ImgCrop",
events: {
ImgCutOver: function (data) {
ImgCutOver: function(data) {
//将8位的二进制数组转换成16进制数据
let binaryToHex = (binaryArray) => {
if (!Array.isArray(binaryArray) || binaryArray
@ -769,7 +772,7 @@ export default {
});
these.Status.BottomMenu.show = false;
setTimeout(function () {
setTimeout(function() {
sendImagePackets(matrix).catch((
ex) => {
console.log("出现异常", ex);
@ -796,14 +799,14 @@ export default {
}
});
},
UploadOpenImg: function () {
UploadOpenImg: function() {
//上传开机画面
this.Status.BottomMenu.menuItems = [];
this.Status.BottomMenu.title = "上传开机画面";
this.Status.BottomMenu.type = "checkImg";
this.Status.BottomMenu.show = true;
},
ModeSetting: function (type) {
ModeSetting: function(type) {
this.formData.mode = type;
let items = [];
@ -971,14 +974,14 @@ export default {
})
},
closePop: function () {
closePop: function() {
this.Status.Pop.showPop = false;
if (this.Status.Pop.cancelCallback) {
this.Status.Pop.cancelCallback();
}
},
HidePop: function () {
HidePop: function() {
console.log("1111");
if (this.Status.Pop.clickEvt == 'SendUsr') {
@ -988,7 +991,7 @@ export default {
}
this.Status.Pop.showPop = false;
},
showPop: function (option) {
showPop: function(option) {
hideLoading(this);
let defaultCfg = {
@ -1213,7 +1216,7 @@ export default {
}
});
},
ack: function () {
ack: function() {
let eventChannel = this.getOpenerEventChannel();
@ -1222,7 +1225,7 @@ export default {
});
},
sliderChange: function (evt) {
sliderChange: function(evt) {
this.formData.liangDu = evt.detail.value;
clearTimeout(BrighInteval)
//给蓝牙设备发送信号更新亮度
@ -1231,7 +1234,7 @@ export default {
this.setBleFormData();
}, 100);
},
sendBrightness: function () {
sendBrightness: function() {
const buffer = new ArrayBuffer(6);
const dataView = new DataView(buffer);
let data = '0x' + parseInt(this.formData.liangDu).toString(16);
@ -1260,7 +1263,7 @@ export default {
},
//获取当前设备状态
GetDeviceStatu: function () {
GetDeviceStatu: function() {
//数据头 命令码 数据 校验码
//JQOC 0B 00 9C41
@ -1270,18 +1273,18 @@ export default {
this.sendCmd('0x0B');
},
//设备重启
DeviceReStart: function () {
DeviceReStart: function() {
//数据头 命令码 数据 校验码
//JQOC 0C 01 9C412
this.sendCmd('0x0C');
},
//恢复出厂设置
DeviceReSet: function () {
DeviceReSet: function() {
//数据头 命令码 数据 校验码
//JQOC 0D 01 9C412
this.sendCmd('0x0D');
},
sendCmd: function (type, callback) {
sendCmd: function(type, callback) {
//数据头 命令码 数据 校验码
const buffer = new ArrayBuffer(7);
@ -1311,68 +1314,68 @@ export default {
}
}
}
</script>
<style>
.content {
.content {
box-sizing: border-box;
width: 100%;
min-height: 100vh;
height: auto;
}
}
.contentBg {
.contentBg {
background-color: #121212;
color: #ffffffde;
}
}
.fleft {
.fleft {
float: left;
}
}
.fright {
.fright {
float: right;
}
}
.clear {
.clear {
clear: both;
}
}
.displayNone {
.displayNone {
display: none !important;
}
}
.p100 {
.p100 {
width: 100%;
height: 100%;
}
}
.center {
.center {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-content: center;
justify-content: center;
align-items: center;
}
}
.centerLeft {
.centerLeft {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-content: center;
justify-content: flex-start;
align-items: center;
}
}
.content {
.content {
padding: 30rpx;
box-sizing: border-box;
}
}
.eq {
.eq {
width: 100%;
height: 250rpx;
border-radius: 8px;
@ -1386,41 +1389,41 @@ export default {
justify-content: center;
align-items: center;
margin-bottom: 24rpx;
}
}
.eq .leftImg {
.eq .leftImg {
box-sizing: border-box;
padding: 36rpx;
border-radius: 16rpx;
background: rgba(42, 42, 42, 0.5);
}
}
.eq .leftImg,
.eq .rightTxt {
.eq .leftImg,
.eq .rightTxt {
width: 50%;
height: 100%;
}
}
.eq .rightTxt {
.eq .rightTxt {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
align-content: flex-start;
justify-content: space-evenly;
align-items: flex-start;
}
}
.eq .leftImg .img {
.eq .leftImg .img {
width: 100%;
height: 100%;
}
}
.eq .rightTxt .img {
.eq .rightTxt .img {
width: 52rpx;
height: 52rpx;
}
}
.eq .rightTxt .row {
.eq .rightTxt .row {
width: 100%;
display: flex;
flex-direction: row;
@ -1430,35 +1433,35 @@ export default {
align-items: center;
box-sizing: border-box;
padding-left: 50rpx;
}
}
.eq .rightTxt .row .txt {
.eq .rightTxt .row .txt {
padding-left: 20rpx;
}
}
.eq .bigTxt {
.eq .bigTxt {
color: rgba(255, 255, 255, 0.87);
font-family: "PingFang SC";
font-size: 28rpx;
font-weight: 400;
}
}
.eq .smallTxt {
.eq .smallTxt {
color: rgba(255, 255, 255, 0.6);
font-family: "PingFang SC";
font-size: 24rpx;
font-weight: 400;
}
}
.eqinfo {
.eqinfo {
border-radius: 16rpx;
background: rgba(26, 26, 26, 1);
box-sizing: border-box;
padding: 14rpx 0rpx;
}
}
.eqinfo .item {
.eqinfo .item {
width: 100%;
height: 60rpx;
line-height: 60rpx;
@ -1470,9 +1473,9 @@ export default {
align-content: center;
justify-content: space-between;
align-items: center;
}
}
.eqinfo .lbl {
.eqinfo .lbl {
color: rgba(255, 255, 255, 0.87);
font-family: "PingFang SC";
font-size: 28rpx;
@ -1480,9 +1483,9 @@ export default {
letter-spacing: 0.07px;
text-align: left;
}
}
.eqinfo .value {
.eqinfo .value {
color: rgba(255, 255, 255, 0.6);
font-family: "PingFang SC";
font-size: 28rpx;
@ -1490,14 +1493,14 @@ export default {
letter-spacing: 0.07px;
text-align: left;
}
}
.lamp {
.lamp {
margin-top: 24rpx;
}
}
.lamp .title {
.lamp .title {
width: 100%;
height: 60rpx;
line-height: 60rpx;
@ -1510,16 +1513,16 @@ export default {
justify-content: space-between;
align-items: center;
font-size: 28rpx;
}
}
.lampMode {
.lampMode {
padding: 30rpx 0rpx;
width: 100%;
box-sizing: border-box;
}
}
.lampMode .mode {
.lampMode .mode {
width: calc(calc(100% - 34rpx) / 2);
border-radius: 8px;
margin-top: 20rpx;
@ -1532,18 +1535,18 @@ export default {
justify-content: flex-start;
padding: 30rpx;
box-sizing: border-box;
}
}
.mode.marginLeft {
.mode.marginLeft {
margin-left: 34rpx !important;
}
}
.mode .leftImg .img {
.mode .leftImg .img {
width: 70rpx;
height: 70rpx;
}
}
.mode .rightTxt {
.mode .rightTxt {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
@ -1551,9 +1554,9 @@ export default {
justify-content: center;
align-items: flex-start;
padding-left: 20rpx;
}
}
.mode .bigTxt {
.mode .bigTxt {
color: rgba(255, 255, 255, 0.87);
font-family: "PingFang SC";
font-size: 28rpx;
@ -1561,9 +1564,9 @@ export default {
letter-spacing: 0.07px;
}
}
.mode .smallTxt {
.mode .smallTxt {
color: rgba(255, 255, 255, 0.6);
font-family: "PingFang SC";
font-size: 24rpx;
@ -1571,17 +1574,17 @@ export default {
letter-spacing: 0.07px;
}
}
.usrinfo {
.usrinfo {
border-radius: 8px;
width: 100%;
box-sizing: border-box;
padding: 24rpx 28rpx;
background: rgba(26, 26, 26, 1);
}
}
.usrtitle {
.usrtitle {
color: rgba(255, 255, 255, 0.87);
font-family: "PingFang SC";
font-size: 28rpx;
@ -1590,9 +1593,9 @@ export default {
line-height: 40rpx;
letter-spacing: 0.07px;
}
}
.usrinfo .btnSend {
.usrinfo .btnSend {
line-height: 65rpx;
border-radius: 8px;
width: 120rpx;
@ -1604,9 +1607,9 @@ export default {
letter-spacing: 0.07px;
text-align: center;
background-color: #BBE600;
}
}
.usrinfo .item {
.usrinfo .item {
border-radius: 8px;
width: 100%;
box-sizing: border-box;
@ -1620,9 +1623,9 @@ export default {
align-content: center;
justify-content: flex-start;
align-items: center;
}
}
.usrinfo .lbl {
.usrinfo .lbl {
width: 120rpx;
height: 100%;
padding-left: 24rpx;
@ -1637,17 +1640,17 @@ export default {
letter-spacing: 0.07px;
}
}
.usrinfo .value {
.usrinfo .value {
width: calc(100% - 120rpx);
height: 100%;
}
}
.usrinfo .value .uni-input-input {
.usrinfo .value .uni-input-input {
color: rgba(255, 255, 255, 0.87);
font-family: "PingFang SC";
font-size: 28rpx;
@ -1655,28 +1658,28 @@ export default {
letter-spacing: 0.07px;
text-align: left;
}
}
.usrplace {
.usrplace {
color: rgba(255, 255, 255, 0.4);
font-family: "PingFang SC";
font-size: 28rpx;
font-weight: 400;
letter-spacing: 0.07px;
text-align: left;
}
}
.proinfo .itemcontent {
.proinfo .itemcontent {
display: flex;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-content: center;
justify-content: space-evenly;
}
}
.proinfo .item {
.proinfo .item {
width: 180rpx;
height: 180rpx;
box-sizing: border-box;
@ -1689,16 +1692,16 @@ export default {
align-content: center;
justify-content: center;
align-items: center;
}
}
.proinfo .item .img {
.proinfo .item .img {
width: 50rpx;
height: 50rpx;
}
}
.proinfo .item .txt {
.proinfo .item .txt {
color: rgba(255, 255, 255, 0.6);
font-family: "PingFang SC";
font-size: 24rpx;
@ -1706,15 +1709,15 @@ export default {
margin-top: 20rpx;
letter-spacing: 0.07px;
text-align: left;
}
}
.slider-container {
.slider-container {
padding: 0px;
}
}
.addIco {
.addIco {
width: 100%;
height: 360rpx;
display: flex;
@ -1723,26 +1726,26 @@ export default {
align-content: center;
justify-content: center;
align-items: center;
}
}
.icoContent {
.icoContent {
width: 240rpx;
height: 240rpx;
border-radius: 8rpx;
background: rgba(58, 58, 58, 1);
}
}
.icoContent .img {
.icoContent .img {
width: 70rpx;
height: 70rpx;
}
}
.TextToHex {
.TextToHex {
position: fixed;
top: -99999rpx;
left: -99999rpx;
visibility: hidden;
}
}
</style>

View File

@ -156,14 +156,39 @@
if (these.device.deviceId == receive.deviceId) {
console.log("11111:", receive);
these.device.imei = f.imei;
if (receive.bytes[0] == 0xFC || receive.str.indexOf('mac address:') == 0) {
let flag=false;
if (receive.bytes && receive.bytes.length && receive.bytes[0] == 0xFC) {//6155 7305
if (f && f.macAddress) {
flag=true;
}
}
else if(receive.str.indexOf('mac address:') == 0){//650 670
if (f && f.macAddress) {
flag=true;
}
}
else{
try{
let json=JSON.parse(receive.str);
let key = "sta_address";
if (key in json) {//100
if (f && f.macAddress) {
flag=true;
}
}
}catch(err){
console.log("出现异常,",err);
}
}
if(flag){
these.device.macAddress = f.macAddress;
console.log("222222");
these.Statu.isSearch = false;
these.initDevice();
}
}
}
}, pagePath);
eventChannel = this.getOpenerEventChannel();

View File

@ -27,7 +27,8 @@
<view class="item " v-for="item, index in PairEquip" v-show="PairEquip.length>0">
<view class="leftImg ">
<image src="/static/images/common/bluetooth.png" class="titleIco" mode="heightFix">
<image src="/static/images/common/bluetooth.png" class="titleIco filterNone"
mode="heightFix">
</image>
</view>
<view class="centertxt ">
@ -172,72 +173,79 @@
let search = option.search;
these = this;
eventChannel = this.getOpenerEventChannel();
// this.EquipMents = [{
// "RSSI": -55,
// "advertisData": "",
// "advertisServiceUUIDs": [
// "0000FFE0-0000-1000-8000-00805F9B34FB"
// ],
// "deviceId": "EBDA4E6F-3A28-FF65-A845-AE8CC7B78375",
// "name": "HBY670-BF74EA",
// "linkStatu": false
// },
// {
// "RSSI": -61,
// "advertisData": "",
// "advertisServiceUUIDs": [
// "0000FFE0-0000-1000-8000-00805F9B34FB"
// ],
// "deviceId": "469FB381-B47E-1E40-8073-EF50B5704AAB",
// "name": "EF4651",
// "linkStatu": false,
// "isTarget": true
// },
// {
// "RSSI": -69,
// "advertisData": "",
// "advertisServiceUUIDs": [
// "0000FFE0-0000-1000-8000-00805F9B34FB"
// ],
// "deviceId": "4F0DAC91-4391-CB07-905E-72D7F03EFCD3",
// "name": "4877-BF743D",
// "linkStatu": false
// }
// ];
const systemInfo = uni.getSystemInfoSync();
if (systemInfo.uniPlatform == 'web') {
this.EquipMents = [{
"RSSI": -55,
"advertisData": "",
"advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB"
],
"deviceId": "EBDA4E6F-3A28-FF65-A845-AE8CC7B78375",
"name": "HBY670-BF74EA",
"linkStatu": false
},
{
"RSSI": -61,
"advertisData": "",
"advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB"
],
"deviceId": "469FB381-B47E-1E40-8073-EF50B5704AAB",
"name": "EF4651",
"linkStatu": false,
"isTarget": true
},
{
"RSSI": -69,
"advertisData": "",
"advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB"
],
"deviceId": "4F0DAC91-4391-CB07-905E-72D7F03EFCD3",
"name": "4877-BF743D",
"linkStatu": false
}
];
these.PairEquip = [this.EquipMents[0]];
return;
}
let StartSubsrib = () => {
these.EquipMents = [];
ble = bleTool.getBleTool();
//蓝牙不可用的回调
ble.addStateBreakCallback(res=>{
ble.addStateBreakCallback(res => {
if (these.Status.isPageHidden) {
return;
}
console.log("处理蓝牙不可用");
hideLoading(these);
these.PairEquip=[];
these.EquipMents=[];
these.PairEquip = [];
these.EquipMents = [];
uni.showToast({
icon:'fail',
title:'蓝牙已不可用'
icon: 'fail',
title: '蓝牙已不可用'
});
these.showOpenSetting();
},pagePath);
}, pagePath);
//蓝牙再次可用的回调
ble.addStateRecoveryCallback(res=>{
ble.addStateRecoveryCallback(res => {
if (these.Status.isPageHidden) {
return;
}
uni.showToast({
icon:'success',
title:'蓝牙恢复可用'
icon: 'success',
title: '蓝牙恢复可用'
});
these.Status.BottomMenu.show = false;
these.EquipMents=[];
these.EquipMents = [];
these.refreshBleList();
},pagePath);
}, pagePath);
//蓝牙断开连接的回调
ble.addDisposeCallback(res => {
@ -470,7 +478,7 @@
}
hideLoading(these);
eventChannel.emit('BindOver',these.device);
eventChannel.emit('BindOver', these.device);
ble.updateCache();
uni.navigateBack();
@ -941,4 +949,9 @@
color: #232323;
}
.filterNone {
filter: none !important;
-webkit-filter: none !important;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
static/images/4877/fan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
static/images/4877/sg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

View File

@ -33,15 +33,18 @@ class BleHelper {
if (linkedDevices && linkedDevices.length && linkedDevices.length > 0) {
// console.log("111111", linkedDevices);
linkedDevices = linkedDevices.filter((v) => {
if(v){
if (v) {
v.Linked = false;
v.notifyState = false;
}
return v?true:false;
return v ? true : false;
});
}
const systemInfo = uni.getSystemInfoSync();
setTimeout(() => {
this.OpenBlue().then(() => {
@ -55,8 +58,8 @@ class BleHelper {
discovering: false, //蓝牙是否正在搜索
searchList: [], //已搜索到的设备列表,
isSubscribe: false, //是否开启了订阅
LinkedList: linkedDevices //已连接的设备列表
LinkedList: linkedDevices, //已连接的设备列表
platform: systemInfo.uniPlatform
}
this.cfg = {
onDeviceFound: [], //发现新设备的事件
@ -169,7 +172,9 @@ class BleHelper {
//连接所有已连接过的设备
linkAllDevices() {
// console.log("模块启动时,自动连接已连接过的设备", this.data.LinkedList);
if (this.data.platform == 'web') {
return;
}
if (this.data.LinkedList && this.data.LinkedList.length > 0) {
let flag = false;
for (var i = 0; i < this.data.LinkedList.length; i++) {
@ -424,7 +429,12 @@ class BleHelper {
//获取蓝牙适配器状态
CheckBlue() {
if (this.data.platform == 'web') {
return Promise.resolve({
available: true,
discovering: false
});
}
return new Promise((resolve, reject) => {
if (this.data.available) {
// console.log("蓝牙模块是可用状态");
@ -463,6 +473,12 @@ class BleHelper {
//打开蓝牙适配器
OpenBlue() {
if (this.data.platform == 'web') {
this.data.isOpenBlue = true;
this.data.available = true;
this.data.isSubscribe = true;
return Promise.resolve(true);
}
var init = () => {
return new Promise((resolve, reject) => {
if (this.data.isOpenBlue) {
@ -678,6 +694,7 @@ class BleHelper {
}
let header = "mac address:";
let isUpdate = false;
if (str.indexOf(header) == 0) { //650以文本传输mac
console.log("str=", str);
this.data.LinkedList.find((v) => {
@ -698,10 +715,11 @@ class BleHelper {
.macAddress)
}
});
this.updateCache();
isUpdate = true;
}
if (str.indexOf('imei:') == 0) {
if (str.indexOf('imei:') == 0) { //670以此方式传输imei
let imei = str.split(':')[1];
@ -709,9 +727,10 @@ class BleHelper {
if (v.deviceId == receive
.deviceId) {
v.imei = imei;
isUpdate = true;
}
});
this.updateCache();
}
@ -725,12 +744,43 @@ class BleHelper {
if (v.deviceId == receive
.deviceId) {
v.macAddress = mac;
// console.log("收到mac地址:", str)
isUpdate = true;
}
});
this.updateCache();
}
}
try {
let receivJson = JSON.parse(str);
let key = "sta_address"; //HBY100以此方式上传mac地址
if (key in receivJson) {
this.data.LinkedList.find((v) => {
if (v.deviceId == receive
.deviceId) {
let macStr = receivJson[
key];
if (macStr.includes(':')) {
v.macAddress = macStr;
} else {
v.macAddress = macStr
.replace(/(.{2})/g,
'$1:').slice(0,
-1)
}
isUpdate = true;
}
});
}
} catch (convertException) {
console.error("文本无法转json", convertException)
}
if (isUpdate) {
this.updateCache();
}
// console.log("str1=", str);
} catch (ex) {
console.error("将数据转文本失败", ex);
@ -811,6 +861,14 @@ class BleHelper {
}
//关闭蓝牙适配器
CloseBlue() {
if (this.data.platform == 'web') {
this.data.available = false;
this.data.discovering = false;
this.data.isOpenBlue = false;
this.data.searchList = [];
return Promise.resolve();
}
return new Promise((resolve, reject) => {
this.data.available = false;
this.data.discovering = false;
@ -842,6 +900,9 @@ class BleHelper {
//开始搜索新设备
StartSearch() {
if (this.data.platform == 'web') {
return Promise.resolve({});
}
this.data.searchList = [];
var these = this;
//开始搜索
@ -902,6 +963,9 @@ class BleHelper {
//停止搜索
StopSearch() {
if (this.data.platform == 'web') {
return Promise.resolve();
}
let p1 = new Promise((resolve, reject) => {
uni.stopBluetoothDevicesDiscovery({
success: (res) => {
@ -1226,7 +1290,7 @@ class BleHelper {
setTimeout(function() {
startgetService(id);
}, 100+repeatCnt*300);
}, 100 + repeatCnt * 300);
}
},
fail: (ex) => {
@ -1341,7 +1405,9 @@ class BleHelper {
//连接某个设备
LinkBlue(deviceId, targetServiceId, writeCharId, notifyCharId, maxRetries) {
if (this.data.platform == 'web') {
return Promise.resolve(true);
}
if (maxRetries === undefined) {
maxRetries = 0; // 最大重试次数
}
@ -1503,8 +1569,8 @@ class BleHelper {
}
setMtu(deviceId){
let prom=new Promise((_succ,_err)=>{
setMtu(deviceId) {
let prom = new Promise((_succ, _err) => {
uni.setBLEMTU({
deviceId: deviceId,
mtu: 512,
@ -1514,12 +1580,13 @@ class BleHelper {
},
fail: (ex) => {
console.error(
"mtu设置失败",ex);
ex=this.getError(ex);
"mtu设置失败", ex);
ex = this.getError(ex);
_err(
ex
); // MTU设置失败不影响连接成功
},complete(){
},
complete() {
console.log("设置mtu完毕");
}
});
@ -1528,6 +1595,9 @@ class BleHelper {
}
//断开连接
disconnectDevice(deviceId) {
if (this.data.platform == 'web') {
return Promise.resolve();
}
var disconnect = (id) => {
return new Promise((resolve, reject) => {
uni.closeBLEConnection({
@ -1546,16 +1616,7 @@ class BleHelper {
}
if (deviceId) {
disconnect(deviceId);
this.data.LinkedList.find(v => {
if (v.deviceId === deviceId) {
return true;
}
return false;
});
return;
return disconnect(deviceId);
}
if (this.data.LinkedList.length > 0) {
@ -1567,10 +1628,8 @@ class BleHelper {
}
}
if (arr.length == 0) {
return;
}
if (arr.length) {
return new Promise((_succ, _err) => {
Promise.allSettled(arr).then((results) => {
results.forEach((result, index) => {
if (result.status === 'fulfilled') {
@ -1579,15 +1638,24 @@ class BleHelper {
////console.log(`第${index + 1}个Promise失败:`, result.reason.message);
}
});
_succ()
}).catch((ex) => {
_err();
});
});
} else {
////console.log("无已连接设备");
}
}
return Promise.resolve();
}
//向蓝牙设备发送一个字符串的ASCII码
sendString(deviceid, str, writeServiceId, wirteCharactId, ms) {
if (str && str.length) {
if (str && typeof(str) == 'object') {
str = JSON.stringify(str);
}
if (str) {
let buffer = new ArrayBuffer(str.length);
let dataView = new DataView(buffer);
@ -1627,7 +1695,9 @@ class BleHelper {
}
//向蓝牙设备发送数据,如果没连接将自动连接后再发
sendData(deviceid, buffer, writeServiceId, wirteCharactId, ms) {
if (this.data.platform == 'web') {
return Promise.resolve("h5平台默认成功");
}
// console.log("deviceid=" + deviceid + ",writeServiceId=" + writeServiceId + ",wirteCharactId=" +
// wirteCharactId + ",timeout=" + ms)
if (ms === undefined) {

View File

@ -5,7 +5,9 @@ class BleReceive {
'/pages/6155/deviceDetail': this.Receive_6155.bind(this),
'/pages/7305/BJQ7305': this.Receive_6155.bind(this),
'/pages/650/HBY650': this.Receive_650.bind(this),
'/pages/670/HBY670': this.Receive_670.bind(this)
'/pages/670/HBY670': this.Receive_670.bind(this),
'/pages/4877/BJQ4877': this.Receive_4877.bind(this),
'/pages/100/HBY100': this.Receive_4877.bind(this)
};
}
@ -490,6 +492,36 @@ class BleReceive {
}
}
Receive_4877(receive,f,path,recArr){
let receiveData={};
try {
console.log("str=",receive.str);
receiveData = JSON.parse(receive.str);
let recCnt = recArr.find(v => {
return v.key.replaceAll('/', '').toLowerCase() == f.device.detailPageUrl
.replaceAll('/', '').toLowerCase();
});
if (!recCnt) {
if (receiveData.sta_PowerPercent<=20) {
uni.showModal({
title: "提示",
content: "设备电量低",
showCancel: false
});
}
}
} catch (error) {
receiveData = {};
console.log("文本解析失败",error)
}
return receiveData;
}
}

View File

@ -280,5 +280,33 @@ export default {
}
}
return arr;
},
//10进制转换为16进制字符串
decimalToHexLittleEndian(num, byteCount,revers) {
// 处理负数(如果需要支持负数,可先转为补码)
if (num < 0) {
num = 0xFFFFFFFF + num + 1;
}
// 转为16进制去除前缀0x转为大写
let hex = num.toString(16).toUpperCase();
// 计算需要补充的0的数量确保每个字节占2位
let padLength = (byteCount || Math.ceil(hex.length / 2) * 2) - hex.length;
if (padLength > 0) {
hex = '0'.repeat(padLength) + hex;
}
// 分割为字节数组每2位一个字节
const bytes = [];
for (let i = 0; i < hex.length; i += 2) {
bytes.push(hex.substr(i, 2));
}
// 是否反转字节顺序(低位在前)并拼接
if(revers){
return bytes.reverse().join('');
}
return bytes.join('');
}
}