Compare commits
12 Commits
b01ad9d698
...
5fec8eff30
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fec8eff30 | |||
| 9ca14b1f32 | |||
| d265e8a1ab | |||
| 6a2688caf4 | |||
| 07bd22e848 | |||
| 052a7116c5 | |||
| d01abf267e | |||
| 8ccc37cb93 | |||
| ebbac4232a | |||
| 362b752087 | |||
| 5c69e32c2d | |||
| e247acdd5e |
@ -26,7 +26,7 @@
|
|||||||
<view class="p100" :style="{backgroundColor:config.activeIndex==index?config.itemBgColor:'',
|
<view class="p100" :style="{backgroundColor:config.activeIndex==index?config.itemBgColor:'',
|
||||||
justifyContent:config.textAlign
|
justifyContent:config.textAlign
|
||||||
}">
|
}">
|
||||||
<view class="imgContent" :style="{
|
<view class="imgContent" v-if="item.icon" :style="{
|
||||||
height:config.itemHeight,
|
height:config.itemHeight,
|
||||||
width:config.itemHeight
|
width:config.itemHeight
|
||||||
}">
|
}">
|
||||||
|
|||||||
@ -107,7 +107,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"path": "pages/210/deviceControl/index",
|
"path": "pages/210/HBY210",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
<view class="row">
|
<view class="row">
|
||||||
<image class="img" src="/static/images/6155/DeviceDetail/time.png" mode="aspectFit"></image>
|
<image class="img" src="/static/images/6155/DeviceDetail/time.png" mode="aspectFit"></image>
|
||||||
<view class="txt">
|
<view class="txt">
|
||||||
<view class="bigTxt">{{formData.sta_charge?dic.sta_charge[formData.sta_charge]:"" }}</view>
|
<view class="bigTxt">{{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }}</view>
|
||||||
<view class="smallTxt">设备状态</view>
|
<view class="smallTxt">设备状态</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -46,10 +46,10 @@
|
|||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="warnnig" :class="{'displayNone':formData.sta_sosadd===''}">
|
<view class="warnnig" v-for="item,index in warnDevices">
|
||||||
<view>闯入报警!</view>
|
<view>闯入报警!</view>
|
||||||
<view>
|
<view>
|
||||||
{{getWarDevice(formData.sta_sosadd)}}
|
{{item.name}}
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -114,6 +114,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="rightTxt">
|
<view class="rightTxt">
|
||||||
<text class="bigTxt">{{item.name}}</text>
|
<text class="bigTxt">{{item.name}}</text>
|
||||||
|
<text class="smallTxt" v-if="item.group==='sta_RadarType'">{{Distance}}</text>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -160,6 +161,10 @@
|
|||||||
|
|
||||||
|
|
||||||
<global-loading ref="loading" />
|
<global-loading ref="loading" />
|
||||||
|
|
||||||
|
<BottomSlideMenuPlus :config="Status.BottomMenu" @itemClick="btnClick" @close="closeActionSheet">
|
||||||
|
|
||||||
|
</BottomSlideMenuPlus>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -218,9 +223,31 @@
|
|||||||
show: false,
|
show: false,
|
||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '强光',
|
text: '2M',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
value:'status_2M',
|
||||||
}],
|
icon: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '4M',
|
||||||
|
value:'status_4M',
|
||||||
|
icon: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '7M',
|
||||||
|
value:'status_7M',
|
||||||
|
icon: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '10M',
|
||||||
|
value:'status_10M',
|
||||||
|
icon: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '关闭',
|
||||||
|
value:'status_off',
|
||||||
|
icon: ''
|
||||||
|
}
|
||||||
|
],
|
||||||
activeIndex: -1,
|
activeIndex: -1,
|
||||||
bgColor: '#2a2a2a',
|
bgColor: '#2a2a2a',
|
||||||
itemBgColor: '#3a3a3a',
|
itemBgColor: '#3a3a3a',
|
||||||
@ -254,12 +281,13 @@
|
|||||||
statu: '',
|
statu: '',
|
||||||
sta_address: '',
|
sta_address: '',
|
||||||
bleStatu: false,
|
bleStatu: false,
|
||||||
|
sta_charge:'',
|
||||||
sta_LedType: '',
|
sta_LedType: '',
|
||||||
sta_RadarType: '',
|
sta_RadarType: '',
|
||||||
sta_Online: '',
|
sta_Online: '',
|
||||||
warnTime: '',
|
warnTime: '',
|
||||||
sta_sosadd: "",
|
sta_sosadd: "",
|
||||||
|
sta_sosName:'',
|
||||||
sta_IntrusTime: ''
|
sta_IntrusTime: ''
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -349,10 +377,7 @@
|
|||||||
showConfirm: false
|
showConfirm: false
|
||||||
},
|
},
|
||||||
groupDevices: [],
|
groupDevices: [],
|
||||||
audioData: {
|
warnDevices:[]
|
||||||
packetCtn: 0,
|
|
||||||
hexs: []
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -429,7 +454,28 @@
|
|||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
Distance:function(){
|
||||||
|
let f=this.Status.BottomMenu.menuItems.find((item,index)=>{
|
||||||
|
|
||||||
|
return item.value===this.formData.sta_RadarType;
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
if(f){
|
||||||
|
return f.text;
|
||||||
|
}
|
||||||
|
return '关闭';
|
||||||
|
},
|
||||||
|
activeIndex:function(){
|
||||||
|
let active=4;
|
||||||
|
let f=this.Status.BottomMenu.menuItems.find((item,index)=>{
|
||||||
|
|
||||||
|
if(item.value===this.formData.sta_RadarType){
|
||||||
|
active=index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return active;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
@ -441,7 +487,8 @@
|
|||||||
|
|
||||||
|
|
||||||
if (item.group == 'sta_RadarType') {
|
if (item.group == 'sta_RadarType') {
|
||||||
this.toggleRedar(item, index);
|
// this.toggleRedar(item, index);
|
||||||
|
this.showRedarSetting(item,index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,6 +554,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
showRedarSetting(){
|
||||||
|
this.Status.BottomMenu.show=true;
|
||||||
|
this.Status.BottomMenu.showBtn=false;
|
||||||
|
|
||||||
|
this.Status.BottomMenu.title="感应距离设置";
|
||||||
|
|
||||||
|
this.Status.BottomMenu.textAlign="center";
|
||||||
|
|
||||||
|
this.Status.BottomMenu.showMask=true;
|
||||||
|
this.Status.BottomMenu.activeIndex=this.activeIndex;
|
||||||
|
},
|
||||||
|
btnClick(item,index){
|
||||||
|
this.Status.BottomMenu.show=false;
|
||||||
|
console.log("选中的项:"+index+",值:"+JSON.stringify(item));
|
||||||
|
this.toggleRedar(item,index);
|
||||||
|
},
|
||||||
|
closeActionSheet(){
|
||||||
|
this.Status.BottomMenu.show=false;
|
||||||
},
|
},
|
||||||
toggleRedar(item, index) { //雷达启停
|
toggleRedar(item, index) { //雷达启停
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
@ -521,7 +587,7 @@
|
|||||||
deviceId: '12345'
|
deviceId: '12345'
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
let val = item.key;
|
let val = item.value;
|
||||||
if (this.formData.sta_RadarType === val) {
|
if (this.formData.sta_RadarType === val) {
|
||||||
val = 'status_off';
|
val = 'status_off';
|
||||||
}
|
}
|
||||||
@ -533,7 +599,9 @@
|
|||||||
|
|
||||||
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30)
|
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
debugger;
|
||||||
this.formData.sta_RadarType = val;
|
this.formData.sta_RadarType = val;
|
||||||
|
this.Status.BottomMenu.activeIndex=index;
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
@ -750,6 +818,31 @@
|
|||||||
|
|
||||||
console.log("json=", json)
|
console.log("json=", json)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let active=-1;
|
||||||
|
let f=this.Status.BottomMenu.menuItems.find((item,index)=>{
|
||||||
|
|
||||||
|
if(item.value===json.sta_RadarType){
|
||||||
|
active=index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.Status.BottomMenu.activeIndex=active;
|
||||||
|
|
||||||
|
let msg = [];
|
||||||
|
if (json.sta_PowerPercent <= 20 && (json.sta_charge===0 || json.sta_charge==='0')) {
|
||||||
|
msg.push("设备电量低");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(json.sta_sosadd_off){//某个设备解除报警
|
||||||
|
this.warnDevices.filter((d,index)=>{
|
||||||
|
if(d.mac===json.sta_sosadd_off){
|
||||||
|
this.warnDevices.splice(index,1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let keys = Object.keys(json);
|
let keys = Object.keys(json);
|
||||||
|
|
||||||
keys.forEach(key => {
|
keys.forEach(key => {
|
||||||
@ -759,24 +852,24 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let msg = [];
|
|
||||||
if (this.formData.sta_PowerPercent <= 20) {
|
|
||||||
msg.push("设备电量低");
|
|
||||||
}
|
|
||||||
if (json.sta_sosadd_off == this.formData.sta_sosadd) {
|
|
||||||
this.formData.sta_sosadd = "";
|
|
||||||
let name=this.getWarDevice(json.sta_sosadd_off);
|
|
||||||
msg.push('"' + name + '"取消报警');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.formData.sta_sosadd !== "") {
|
if (json.sta_sosadd) {//某个设备闯入报警
|
||||||
console.log("查询设备中");
|
console.log("查询设备中",json.sta_sosadd);
|
||||||
this.searchDevice(this.formData.sta_sosadd).catch(ex => {}).then(dev => {
|
this.searchDevice(json.sta_sosadd).catch(ex => {}).then(dev => {
|
||||||
console.log("dev=", dev);
|
console.log("dev=", dev);
|
||||||
|
let d=this.warnDevices.find(v=>{return v.mac===json.sta_sosadd});
|
||||||
|
let deviceName="";
|
||||||
if (dev) {
|
if (dev) {
|
||||||
|
// this.formData.sta_sosName=dev.deviceName;
|
||||||
msg.push('"' + dev.deviceName + '"闯入报警中');
|
msg.push('"' + dev.deviceName + '"闯入报警中');
|
||||||
|
deviceName=dev.deviceName;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
msg.push('闯入报警中');
|
msg.push('闯入报警中');
|
||||||
|
// this.formData.sta_sosName="";
|
||||||
|
}
|
||||||
|
if(!d){
|
||||||
|
this.warnDevices.push({mac:json.sta_sosadd,name:deviceName});
|
||||||
}
|
}
|
||||||
this.showMsg(msg.join(','));
|
this.showMsg(msg.join(','));
|
||||||
});
|
});
|
||||||
@ -805,6 +898,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
getWarDevice(macStr) {
|
getWarDevice(macStr) {
|
||||||
|
console.log("macStr=",macStr);
|
||||||
if (macStr) {
|
if (macStr) {
|
||||||
|
|
||||||
if (!macStr.includes(':')) {
|
if (!macStr.includes(':')) {
|
||||||
@ -834,13 +928,13 @@
|
|||||||
let f = this.groupDevices.find(v => {
|
let f = this.groupDevices.find(v => {
|
||||||
return v.deviceMac === macStr;
|
return v.deviceMac === macStr;
|
||||||
});
|
});
|
||||||
console.log("111111111");
|
// console.log("111111111");
|
||||||
if (f) {
|
if (f) {
|
||||||
console.log("找到设备", f);
|
console.log("找到设备", f);
|
||||||
resolve(f);
|
resolve(f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("111111111");
|
// console.log("111111111");
|
||||||
if (macStr == this.device.deviceMac) {
|
if (macStr == this.device.deviceMac) {
|
||||||
console.log("当前设备", this.device);
|
console.log("当前设备", this.device);
|
||||||
resolve(this.device);
|
resolve(this.device);
|
||||||
@ -1058,9 +1152,6 @@
|
|||||||
buttonText: '确定',
|
buttonText: '确定',
|
||||||
okCallback: null
|
okCallback: null
|
||||||
});
|
});
|
||||||
},
|
|
||||||
btnClick() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,69 +69,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 灯光模式选择 -->
|
<!-- ============灯光模式选择================ -->
|
||||||
<!-- <view class="mode-section">
|
|
||||||
<view class="mode-buttons">
|
|
||||||
<view class="mode-v1">
|
|
||||||
<view class="mode-v2" @click="selectMode">
|
|
||||||
<image src="/static/images/210/lj.png" class="setIMG"></image>
|
|
||||||
<view>
|
|
||||||
<view class="battery-v2">联机设备</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="mode-v1">
|
|
||||||
<view class="mode-v2" @click="uploadStartup">
|
|
||||||
<image src="/static/images/common/path7.png" class="setIMG" mode="aspectFit"></image>
|
|
||||||
<view>
|
|
||||||
<view class="battery-v2">开机画面</view>
|
|
||||||
<view class="mode-v3">上传</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="mode-v1">
|
|
||||||
<view class="mode-v2" @click="automaticAlarm">
|
|
||||||
<image src="/static/images/210/zd.png" class="setIMG" mode="aspectFit"></image>
|
|
||||||
<view>
|
|
||||||
<view class="battery-v2">自动报警</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="mode-v1">
|
|
||||||
<view class="mode-v2" @click="anualAlarm">
|
|
||||||
<image src="/static/images/210/zd-HL.png" class="setIMG" mode="aspectFit"></image>
|
|
||||||
<view>
|
|
||||||
<view class="battery-v2">手动报警</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="mode-v1">
|
|
||||||
<view class="mode-v2">
|
|
||||||
<image src="/static/images/210/bj.png" class="setIMG" mode="aspectFit"></image>
|
|
||||||
<view>
|
|
||||||
<view class="battery-v2">报警声音</view>
|
|
||||||
<view class="mode-v3">上传</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="mode-v1">
|
|
||||||
<view class="mode-v2" @click="alarmTime">
|
|
||||||
<image src="/static/images/210/time.png" class="setIMG" mode="aspectFit"></image>
|
|
||||||
<view>
|
|
||||||
<view class="battery-v2">报警时长</view>
|
|
||||||
<view class="mode-v3">{{alarmTimeDisplay }}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</view> -->
|
|
||||||
<view class="mode-section">
|
<view class="mode-section">
|
||||||
<view class="mode-buttons">
|
<view class="mode-buttons">
|
||||||
<view v-for="(item, index) in modeItems" :key="index" class="mode-v1" :class="{ 'active-mode': selectedIndex === index }">
|
<view v-for="(item, index) in modeItems" :key="index" class="mode-v1"
|
||||||
<view class="mode-v2"
|
:class="{ 'active-mode': selectedIndex === index }">
|
||||||
@click="handleModeClick(index)">
|
<view class="mode-v2" @click="handleModeClick(index)">
|
||||||
<image :src="item.image" class="setIMG" mode="aspectFit"></image>
|
<image :src="selectedIndex === index ? item.activeImage : item.image" class="setIMG"
|
||||||
|
mode="aspectFit"></image>
|
||||||
<view>
|
<view>
|
||||||
<view class="battery-v2">{{ item.title }}</view>
|
<view class="battery-v2">{{ item.title }}</view>
|
||||||
<view class="mode-v3" v-if="item.subTitle">{{ item.subTitle }}</view>
|
<view class="mode-v3" v-if="item.subTitle">{{ item.subTitle }}</view>
|
||||||
@ -239,6 +184,29 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- =====报警声音上传======= -->
|
||||||
|
<view class="agreement-mask" v-if="lightModeC" @click.stop="closePopup">
|
||||||
|
<view class="agreement-popupB" @click.stop>
|
||||||
|
<!-- 标题 -->
|
||||||
|
<view class="popup-title">报警声音</view>
|
||||||
|
<view class="popup-content">
|
||||||
|
<view>
|
||||||
|
<view class="upload_flex" @click="uploadFile">
|
||||||
|
<image src="/static/images/210/upload.png" mode="aspectFit" class="uploadIMG"></image>
|
||||||
|
<text>点击选择上传文件</text>
|
||||||
|
</view>
|
||||||
|
<view class="upload_flex" @click="deleteQ">
|
||||||
|
<image src="/static/images/210/delete.png" mode="aspectFit" class="uploadIMG"></image>
|
||||||
|
<text>删除文件</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 按钮组 -->
|
||||||
|
<view class="popup-buttons">
|
||||||
|
<button class="agree" @click="handleupload">确定</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<!-- ======各个弹框类型======= -->
|
<!-- ======各个弹框类型======= -->
|
||||||
<CustomPopup :show="currentPopup.show" v-bind="currentPopup.config" @confirm="handleConfirm"
|
<CustomPopup :show="currentPopup.show" v-bind="currentPopup.config" @confirm="handleConfirm"
|
||||||
@cancel="handleCancel" />
|
@cancel="handleCancel" />
|
||||||
@ -340,7 +308,7 @@
|
|||||||
} from '@/api/6170/deviceControl.js'
|
} from '@/api/6170/deviceControl.js'
|
||||||
import {
|
import {
|
||||||
getDeviceId
|
getDeviceId
|
||||||
} from '../../../store/BLETools';
|
} from '../../store/BLETools';
|
||||||
import {
|
import {
|
||||||
baseURL,
|
baseURL,
|
||||||
getToken,
|
getToken,
|
||||||
@ -352,31 +320,39 @@
|
|||||||
selectedIndex: -1, // Track currently selected index
|
selectedIndex: -1, // Track currently selected index
|
||||||
modeItems: [{
|
modeItems: [{
|
||||||
image: "/static/images/210/lj.png",
|
image: "/static/images/210/lj.png",
|
||||||
|
activeImage: "/static/images/210/lj-HL.png",
|
||||||
title: "联机设备",
|
title: "联机设备",
|
||||||
subTitle: ""
|
subTitle: ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
image: "/static/images/common/path7.png",
|
image: "/static/images/210/bj.png",
|
||||||
title: "开机画面",
|
activeImage: "/static/images/210/bj-HL.png",
|
||||||
|
title: "报警声音",
|
||||||
subTitle: "上传"
|
subTitle: "上传"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
image: "/static/images/210/zd.png",
|
image: "/static/images/210/zd.png",
|
||||||
|
activeImage: "/static/images/210/zd-HL.png",
|
||||||
title: "自动报警",
|
title: "自动报警",
|
||||||
subTitle: ""
|
subTitle: ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
image: "/static/images/210/zd-HL.png",
|
image: "/static/images/210/zd.png",
|
||||||
|
activeImage: "/static/images/210/zd-HL.png",
|
||||||
title: "手动报警",
|
title: "手动报警",
|
||||||
subTitle: ""
|
subTitle: ""
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
image: "/static/images/210/bj.png",
|
image: "/static/images/common/path7.png",
|
||||||
title: "报警声音",
|
activeImage: "/static/images/210/path-HL.png",
|
||||||
|
title: "开机画面",
|
||||||
subTitle: "上传"
|
subTitle: "上传"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
image: "/static/images/210/time.png",
|
image: "/static/images/210/time.png",
|
||||||
|
activeImage: "/static/images/210/time-HL.png",
|
||||||
title: "报警时长",
|
title: "报警时长",
|
||||||
subTitle: "30秒"
|
subTitle: "30秒"
|
||||||
}
|
}
|
||||||
@ -424,6 +400,7 @@
|
|||||||
radioSelected: 0, // -1表示未选中任何项
|
radioSelected: 0, // -1表示未选中任何项
|
||||||
deviceType: '',
|
deviceType: '',
|
||||||
popupType: '', //弹框类型
|
popupType: '', //弹框类型
|
||||||
|
lightModeC: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -432,6 +409,10 @@
|
|||||||
this.lightModeA = false;
|
this.lightModeA = false;
|
||||||
this.lightModeB = false;
|
this.lightModeB = false;
|
||||||
},
|
},
|
||||||
|
// 上传文件
|
||||||
|
uploadFile(){},
|
||||||
|
// 删除文件
|
||||||
|
deleteQ(){},
|
||||||
// 打开弹框
|
// 打开弹框
|
||||||
showPopup(type) {
|
showPopup(type) {
|
||||||
this.currentPopup = {
|
this.currentPopup = {
|
||||||
@ -455,13 +436,16 @@
|
|||||||
this.selectMode();
|
this.selectMode();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.uploadStartup();
|
this.soundAlarm();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.automaticAlarm();
|
this.manualAlarm();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.manualAlarm();
|
this.automaticAlarm();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this.uploadStartup();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
this.alarmTime();
|
this.alarmTime();
|
||||||
@ -486,6 +470,10 @@
|
|||||||
url: '/pages/common/map/index'
|
url: '/pages/common/map/index'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 报警声音
|
||||||
|
soundAlarm() {
|
||||||
|
this.lightModeC = true
|
||||||
|
},
|
||||||
// 联机设备
|
// 联机设备
|
||||||
selectMode() {
|
selectMode() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -888,7 +876,8 @@
|
|||||||
.mode-v1.active-mode .battery-v2 {
|
.mode-v1.active-mode .battery-v2 {
|
||||||
color: #BBE600 !important;
|
color: #BBE600 !important;
|
||||||
}
|
}
|
||||||
.mode-v1.active-mode .mode-v3{
|
|
||||||
|
.mode-v1.active-mode .mode-v3 {
|
||||||
color: #BBE600 !important;
|
color: #BBE600 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1291,6 +1280,18 @@
|
|||||||
margin-bottom: 50rpx;
|
margin-bottom: 50rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.upload_flex {
|
||||||
|
display: flex;
|
||||||
|
cursor: pointer;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom:20rpx;
|
||||||
|
}
|
||||||
|
.uploadIMG{
|
||||||
|
width:68rpx;
|
||||||
|
height:68rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
@ -108,15 +108,15 @@
|
|||||||
|
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">单位:</text>
|
<text class="lbl">单位:</text>
|
||||||
<input class="value" v-model="formData.textLines[0]" placeholder="请输入单位" placeholder-class="usrplace" />
|
<input class="value" v-model.trim="formData.textLines[0]" placeholder="请输入单位" placeholder-class="usrplace" />
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">部门:</text>
|
<text class="lbl">部门:</text>
|
||||||
<input class="value" v-model="formData.textLines[1]" placeholder="请输入姓名" placeholder-class="usrplace" />
|
<input class="value" v-model.trim="formData.textLines[1]" placeholder="请输入姓名" placeholder-class="usrplace" />
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">姓名:</text>
|
<text class="lbl">姓名:</text>
|
||||||
<input class="value" v-model="formData.textLines[2]" placeholder="请输入职位" placeholder-class="usrplace" />
|
<input class="value" v-model.trim="formData.textLines[2]" placeholder="请输入职位" placeholder-class="usrplace" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@ -919,7 +919,7 @@
|
|||||||
fail: (ex) => {
|
fail: (ex) => {
|
||||||
|
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: '视频文件上传失败了,请检查网络连接'
|
text : '视频文件上传失败了,请检查网络连接'
|
||||||
});
|
});
|
||||||
|
|
||||||
reject(ex);
|
reject(ex);
|
||||||
@ -1297,7 +1297,12 @@
|
|||||||
items = [{
|
items = [{
|
||||||
text: '泛光',
|
text: '泛光',
|
||||||
icon: '/static/images/6155/DeviceDetail/fan.png'
|
icon: '/static/images/6155/DeviceDetail/fan.png'
|
||||||
}];
|
},
|
||||||
|
{
|
||||||
|
text: '强+泛光',
|
||||||
|
icon: '/static/images/6155/DeviceDetail/fan.png'
|
||||||
|
},
|
||||||
|
];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1332,29 +1337,22 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
setMode(mode, type) {
|
setMode(mode, type) {
|
||||||
|
|
||||||
let dataValue = 0;
|
let dataValue = 0;
|
||||||
|
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
|
|
||||||
if (type == 'main') {
|
if (type == 'main') {
|
||||||
|
|
||||||
dataValue = 0x01;
|
dataValue = 0x01;
|
||||||
} else if (type == 'fu') {
|
} else if (type == 'fu') {
|
||||||
|
|
||||||
dataValue = 0x04;
|
dataValue = 0x04;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
if (type == 'main') {
|
||||||
dataValue = 0x02;
|
dataValue = 0x02;
|
||||||
|
} else if (type == 'fu') {
|
||||||
|
dataValue = 0x0A; //强泛光
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
// case 2:
|
|
||||||
// dataValue = 0x02;
|
|
||||||
// break;
|
|
||||||
case 2:
|
case 2:
|
||||||
dataValue = 0x03;
|
dataValue = 0x03;
|
||||||
break;
|
break;
|
||||||
@ -1363,7 +1361,7 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
// console.log("dataValue=", dataValue)
|
console.log("dataValue=", dataValue)
|
||||||
// 构建数据包
|
// 构建数据包
|
||||||
var buffer = new ArrayBuffer(6);
|
var buffer = new ArrayBuffer(6);
|
||||||
var dataView = new DataView(buffer);
|
var dataView = new DataView(buffer);
|
||||||
@ -1526,156 +1524,73 @@
|
|||||||
});
|
});
|
||||||
this.setBleFormData();
|
this.setBleFormData();
|
||||||
let task = async () => {
|
let task = async () => {
|
||||||
var sendTxtPackge = (rgbdata, type, str) => {
|
|
||||||
|
|
||||||
var promise = new Promise((resolve, reject) => {
|
|
||||||
try {
|
try {
|
||||||
// 设备协议:FA 06/07/08 01 00 + 256字节数据 + FF
|
// 预热画布,确保画布和字体完全准备好(解决APP重新打开后第一次获取数据不完整的问题)
|
||||||
// 每个文本行只需要一个261字节的包
|
console.log("预热画布...");
|
||||||
const bufferSize = 261;
|
await this.$refs.textToHex.drawAndGetPixels();
|
||||||
const dataSize = 256; // 数据部分固定256字节
|
await new Promise(resolve => setTimeout(resolve, 200)); // 等待预热完成
|
||||||
|
|
||||||
let buffer = new ArrayBuffer(bufferSize);
|
// 1. 获取所有文本行的像素数据
|
||||||
let dataView = new DataView(buffer);
|
const allPixels = await this.$refs.textToHex.drawAndGetPixels();
|
||||||
|
if (!allPixels) {
|
||||||
// 写入头部:FA 06/07/08 01 00
|
throw new Error("无法生成像素数据");
|
||||||
dataView.setUint8(0, 0xFA);
|
|
||||||
dataView.setUint8(1, type);
|
|
||||||
dataView.setUint8(2, 0x01);
|
|
||||||
dataView.setUint8(3, 0x00);
|
|
||||||
|
|
||||||
// 写入数据(最多256字节),确保数据是数字格式
|
|
||||||
let actualDataSize = Math.min(rgbdata.length, dataSize);
|
|
||||||
for (let i = 0; i < actualDataSize; i++) {
|
|
||||||
// 确保数据是数字格式,如果是字符串则转换
|
|
||||||
let byteValue = typeof rgbdata[i] === 'string' ? these.toByteValue(rgbdata[i]) : rgbdata[i];
|
|
||||||
dataView.setUint8(4 + i, byteValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用0填充剩余数据部分(如果数据不足256字节)
|
// 2. 将所有像素数据合并到一个大数组中
|
||||||
for (let i = 4 + actualDataSize; i < bufferSize - 1; i++) {
|
let combinedData = [];
|
||||||
dataView.setUint8(i, 0x00);
|
for (let i = 0; i < 3; i++) {
|
||||||
|
const linePixels = (allPixels[i] || []).flat(Infinity).map(item =>
|
||||||
|
typeof item === 'string' ? these.toByteValue(item) : item
|
||||||
|
);
|
||||||
|
// 补齐到256字节
|
||||||
|
while (linePixels.length < 256) {
|
||||||
|
linePixels.push(0x00);
|
||||||
|
}
|
||||||
|
combinedData = combinedData.concat(linePixels.slice(0, 256));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 写入尾部:FF
|
// 3. 构建完整的逻辑大包
|
||||||
dataView.setUint8(bufferSize - 1, 0xFF);
|
const logicalPacketSize = 4 + combinedData.length + 1; // Header + Data + Footer
|
||||||
|
const logicalBuffer = new ArrayBuffer(logicalPacketSize);
|
||||||
|
const logicalDataView = new DataView(logicalBuffer);
|
||||||
|
|
||||||
console.log(`发送文本数据包: type=0x${type.toString(16)}, 数据长度=${actualDataSize}, 总长度=${bufferSize}`);
|
// 写入头部
|
||||||
|
logicalDataView.setUint8(0, 0xFA);
|
||||||
|
logicalDataView.setUint8(1, 0x06);
|
||||||
|
logicalDataView.setUint8(2, 0x03);
|
||||||
|
logicalDataView.setUint8(3, 0x00);
|
||||||
|
|
||||||
// 发送数据包
|
// 写入数据
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f
|
for (let i = 0; i < combinedData.length; i++) {
|
||||||
.wirteCharactId, 100).then(() => {
|
logicalDataView.setUint8(4 + i, combinedData[i]);
|
||||||
resolve();
|
|
||||||
}).catch(err => {
|
|
||||||
if (err.code == '10007') {
|
|
||||||
// 重试
|
|
||||||
setTimeout(() => {
|
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f
|
|
||||||
.wirteCharactId, 100).then(() => {
|
|
||||||
resolve();
|
|
||||||
}).catch(reject);
|
|
||||||
}, 100);
|
|
||||||
} else {
|
|
||||||
reject(err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 写入尾部
|
||||||
|
logicalDataView.setUint8(logicalPacketSize - 1, 0xFF);
|
||||||
|
|
||||||
|
// 4. 将逻辑大包分包发送
|
||||||
|
const CHUNK_SIZE = 20; // 每个物理包的大小
|
||||||
|
const totalChunks = Math.ceil(logicalPacketSize / CHUNK_SIZE);
|
||||||
|
|
||||||
|
updateLoading(these, {
|
||||||
|
text: `准备发送,共 ${totalChunks} 个数据包...`
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (ex) {
|
for (let i = 0; i < totalChunks; i++) {
|
||||||
console.log("构建数据包异常:", ex);
|
const start = i * CHUNK_SIZE;
|
||||||
reject(ex);
|
const end = Math.min(start + CHUNK_SIZE, logicalPacketSize);
|
||||||
}
|
const chunk = logicalBuffer.slice(start, end);
|
||||||
|
|
||||||
|
updateLoading(these, {
|
||||||
|
text: `正在发送 ${i + 1} / ${totalChunks}`
|
||||||
});
|
});
|
||||||
|
|
||||||
return promise;
|
await ble.sendData(f.deviceId, chunk, f.writeServiceId, f.wirteCharactId, 50);
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 50)); // 包之间延迟
|
||||||
}
|
|
||||||
|
|
||||||
console.log("11111");
|
|
||||||
var result = null;
|
|
||||||
try {
|
|
||||||
console.log("this.$refs.textToHex=", this.$refs.textToHex);
|
|
||||||
// 获取像素数据(组件内部会自动预热画布)
|
|
||||||
result = await this.$refs.textToHex.drawAndGetPixels();
|
|
||||||
} catch (ex) {
|
|
||||||
console.log("获取画布数据异常:", ex);
|
|
||||||
}
|
|
||||||
if (!result) {
|
|
||||||
hideLoading(this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log("result=", result);
|
|
||||||
result = result.map(level1 => {
|
|
||||||
return level1.flat(Infinity).map(item => {
|
|
||||||
// 确保数据转换为数字格式,避免字符串格式导致的问题
|
|
||||||
return typeof item === 'string' ? these.toByteValue(item) : item;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
console.log("result=", result);
|
|
||||||
|
|
||||||
// var str1="FA 06 01 00 FF FF F7 9F EF 6F EC F7 EA 09 CF FF AF FB EF EB EF EB EC 6B EF EB EC 6B EF EB EF FB EE 63 FF FF FF FF F7 9F EF 6F EC F7 EA 09 CF FF AF FB EF EB EF EB EC 6B EF EB EC 6B EF EB EF FB EE 63 FF FF FF FF F7 FF 81 03 ED BB DD B7 CB CF F3 C7 CD 39 BE FF FE FF C0 03 FE FB FD FB F3 F7 8F 87 FF FF FF FF FE FF FE FF FE FF C0 03 FF FB FD FB FD FB FD FB FD FB FB FB FB FF F7 F7 EF F7 9F 8F FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF"
|
|
||||||
// var str2="FA 07 01 00 FF FF EE DD EE DF EF 5B AB DF AA 03 AE FF AE FF EE 03 EE FF EE FF EE 03 EE FF EE FF EE E3 FF FF FF FF EE DD EE DF EF 5B AB DF AA 03 AE FF AE FF EE 03 EE FF EE FF EE 03 EE FF EE FF EE E3 FF FF FF FF EF 77 EF 73 EF 7F 80 01 EF 7F EF 7F EF 03 E7 3B 8E BB EE D7 EE EF ED E7 ED 9B 8B 7D FF FF FF FF FF FF F7 EF F7 F7 EF F7 DF FB FF FF FF FF FE FF 80 01 FE 7F FD BF FB DF F7 E7 9F F9 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF"
|
|
||||||
// var str3="FA 08 01 00 FF FF EF DF EC 01 EF FF AB FF AA 03 AA FB AE FB EE 03 EF DF EF DF EE DB ED DF ED DD EF 1F FF FF FF FF EF BF EF 87 81 77 EE F7 EC 03 81 7F EF 7F EF 7F EF 03 81 7F EF 7F EF 7D EF 7D EF 03 FF FF FF FF F9 F1 CF BF DF FF DF FF C1 FF DD 81 DD F7 DD F7 C1 F7 DF 77 FF 77 BF 77 BF 77 FF F7 FF FF FF FF FD FF FD FF FB FF FB FF F0 07 E7 F7 EF F7 D8 07 BF F7 FF F7 F8 07 FF F7 FF F7 FF C7 FF FF FF FF FF FF FF FF FF FF FE FF FE 7F FE 7F FE FF FD BF FD FF FB DF F7 EF EF F7 DF FB BF FD FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF"
|
|
||||||
|
|
||||||
// let arr1=('0x'+(str1.split(' ').join(",0x"))).split(',');
|
|
||||||
// let arr2=('0x'+(str2.split(' ').join(",0x"))).split(',');
|
|
||||||
// let arr3=('0x'+(str3.split(' ').join(",0x"))).split(',');
|
|
||||||
|
|
||||||
// result=[arr1,arr2,arr3];
|
|
||||||
|
|
||||||
|
|
||||||
// console.log("result=",result);
|
|
||||||
|
|
||||||
|
|
||||||
let h3dic = [0x06, 0x07, 0x08];
|
|
||||||
let pros = [];
|
|
||||||
let flag = true;
|
|
||||||
// 在开始发送前添加延迟,确保数据完全准备好(解决第一次发送第一个字缺失的问题)
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 500));
|
|
||||||
|
|
||||||
for (var i = 0; i < result.length; i++) {
|
|
||||||
|
|
||||||
let str = this.formData.textLines[i];
|
|
||||||
|
|
||||||
if (str.length > 0) {
|
|
||||||
|
|
||||||
let width = str.length * 16;
|
|
||||||
var rgb = result[i];
|
|
||||||
|
|
||||||
// 确保数据是数组且已转换
|
|
||||||
if (!Array.isArray(rgb)) {
|
|
||||||
console.error(`第${i+1}行数据格式错误:`, rgb);
|
|
||||||
flag = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 第一次发送前额外延迟,确保设备完全准备好
|
|
||||||
if (i === 0) {
|
|
||||||
console.log("准备发送第一个文本行,等待设备准备好...");
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 500));
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
console.log(`开始发送第${i+1}个文本行 (type=0x${h3dic[i].toString(16)})`);
|
|
||||||
await sendTxtPackge(rgb, h3dic[i], str);
|
|
||||||
console.log(`第${i+1}个文本行发送完成`);
|
|
||||||
|
|
||||||
// 每个文本行发送完成后,添加延迟确保设备处理完成
|
|
||||||
if (i < result.length - 1) {
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 300));
|
|
||||||
}
|
|
||||||
} catch (ex) {
|
|
||||||
flag = false;
|
|
||||||
console.error(`发送第${i+1}个文本行出现异常:`, ex);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 5. 发送成功处理
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
if (flag) {
|
|
||||||
console.log("发送成功");
|
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: "发送成功",
|
message: "发送成功",
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||||
@ -1683,9 +1598,6 @@
|
|||||||
buttonBgColor: '#BBE600'
|
buttonBgColor: '#BBE600'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let json = {
|
let json = {
|
||||||
deviceId: these.device.id,
|
deviceId: these.device.id,
|
||||||
name: these.formData.textLines[1],
|
name: these.formData.textLines[1],
|
||||||
@ -1693,17 +1605,18 @@
|
|||||||
unitName: these.formData.textLines[2],
|
unitName: these.formData.textLines[2],
|
||||||
code: ""
|
code: ""
|
||||||
};
|
};
|
||||||
usrApi.sendUsr(json)
|
usrApi.sendUsr(json);
|
||||||
} else {
|
|
||||||
|
} catch (ex) {
|
||||||
|
hideLoading(these);
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: "出现异常发送失败",
|
message: "发送失败: " + (ex.msg || ex.message),
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
setTimeout(task, 0);
|
setTimeout(task, 0);
|
||||||
},
|
},
|
||||||
getDetail() {
|
getDetail() {
|
||||||
|
|||||||
@ -51,9 +51,14 @@
|
|||||||
<text>搜索设备</text>
|
<text>搜索设备</text>
|
||||||
<view @click="refreshBleList()">刷新</view>
|
<view @click="refreshBleList()">刷新</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="lblTitle">
|
||||||
|
<input class="uni-input" v-model="search" placeholder="名称筛选" />
|
||||||
|
<!-- <uni-easyinput :styles="{color:'#ffffffde',borderColor:'#cbcbcba8'}" :clearable="true" class="uni-mt-5" :trim="'both'"
|
||||||
|
prefixIcon="search" v-model="search" placeholder="名称筛选"></uni-easyinput> -->
|
||||||
|
</view>
|
||||||
<view class="list searchList">
|
<view class="list searchList">
|
||||||
<view class="item" v-on:click="Link(item,index)" v-for="item, index in EquipMents"
|
<view class="item" v-on:click="Link(item,index)" v-for="item, index in EquipMents"
|
||||||
v-show="!item['linkStatu']">
|
v-show="item.name.indexOf(search)>-1">
|
||||||
<view class="before" v-if="item.isTarget"></view>
|
<view class="before" v-if="item.isTarget"></view>
|
||||||
<view class="leftImg ">
|
<view class="leftImg ">
|
||||||
<image src="/static/images/BLEAdd/bluetooth.png" class="titleIco" mode="heightFix">
|
<image src="/static/images/BLEAdd/bluetooth.png" class="titleIco" mode="heightFix">
|
||||||
@ -148,6 +153,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
search: '', //筛选
|
||||||
PairEquip: [], //已配对设备
|
PairEquip: [], //已配对设备
|
||||||
EquipMents: [], //搜索出来的设备
|
EquipMents: [], //搜索出来的设备
|
||||||
device: null,
|
device: null,
|
||||||
@ -165,16 +171,20 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
onUnload() {
|
onUnload() {
|
||||||
|
if (ble) {
|
||||||
ble.StopSearch();
|
ble.StopSearch();
|
||||||
ble.removeAllCallback(pagePath);
|
ble.removeAllCallback(pagePath);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
|
debugger;
|
||||||
let search = option.search;
|
let search = option.search;
|
||||||
ble = bleTool.getBleTool();
|
|
||||||
these = this;
|
these = this;
|
||||||
eventChannel = this.getOpenerEventChannel();
|
eventChannel = this.getOpenerEventChannel();
|
||||||
const systemInfo = uni.getSystemInfoSync();
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
|
||||||
|
ble = bleTool.getBleTool(); // Ensure ble is initialized
|
||||||
|
|
||||||
if (systemInfo.uniPlatform == 'web') {
|
if (systemInfo.uniPlatform == 'web') {
|
||||||
|
|
||||||
|
|
||||||
@ -199,6 +209,67 @@
|
|||||||
"linkStatu": false,
|
"linkStatu": false,
|
||||||
"isTarget": true
|
"isTarget": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"RSSI": -69,
|
||||||
|
"advertisData": "",
|
||||||
|
"advertisServiceUUIDs": [
|
||||||
|
"0000FFE0-0000-1000-8000-00805F9B34FB"
|
||||||
|
],
|
||||||
|
"deviceId": "4F0DAC91-4391-CB07-905E-72D7F03EFCD3",
|
||||||
|
"name": "4877-BF743D",
|
||||||
|
"linkStatu": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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
|
||||||
|
},{
|
||||||
|
"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,
|
"RSSI": -69,
|
||||||
"advertisData": "",
|
"advertisData": "",
|
||||||
@ -213,11 +284,14 @@
|
|||||||
|
|
||||||
|
|
||||||
these.PairEquip = [this.EquipMents[0]];
|
these.PairEquip = [this.EquipMents[0]];
|
||||||
|
this.$forceUpdate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let StartSubsrib = () => {
|
let StartSubsrib = () => {
|
||||||
these.EquipMents = [];
|
these.EquipMents = [];
|
||||||
|
if (!ble) {
|
||||||
|
ble = bleTool.getBleTool();
|
||||||
|
}
|
||||||
//蓝牙不可用的回调
|
//蓝牙不可用的回调
|
||||||
ble.addStateBreakCallback(res => {
|
ble.addStateBreakCallback(res => {
|
||||||
if (these.Status.isPageHidden) {
|
if (these.Status.isPageHidden) {
|
||||||
@ -234,19 +308,6 @@
|
|||||||
these.showOpenSetting();
|
these.showOpenSetting();
|
||||||
|
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
//蓝牙再次可用的回调
|
|
||||||
ble.addStateRecoveryCallback(res => {
|
|
||||||
if (these.Status.isPageHidden) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'success',
|
|
||||||
title: '蓝牙恢复可用'
|
|
||||||
});
|
|
||||||
these.Status.BottomMenu.show = false;
|
|
||||||
these.EquipMents = [];
|
|
||||||
these.refreshBleList();
|
|
||||||
}, pagePath);
|
|
||||||
|
|
||||||
//蓝牙断开连接的回调
|
//蓝牙断开连接的回调
|
||||||
ble.addDisposeCallback(res => {
|
ble.addDisposeCallback(res => {
|
||||||
@ -263,6 +324,61 @@
|
|||||||
|
|
||||||
|
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//搜索到新设备的回调 (Always active)
|
||||||
|
ble.addDeviceFound((arr) => {
|
||||||
|
console.log("--- 收到原始扫描数据 ---", JSON.stringify(arr));
|
||||||
|
if (these.Status.isPageHidden) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!arr || !arr.devices) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
arr = arr.devices;
|
||||||
|
|
||||||
|
console.log(`本次扫描批次发现 ${arr.length} 个设备`);
|
||||||
|
|
||||||
|
for (var i = 0; i < arr.length; i++) {
|
||||||
|
let device = arr[i];
|
||||||
|
device.linkStatu = false;
|
||||||
|
|
||||||
|
let f = these.EquipMents.find((v, index) => {
|
||||||
|
if (v.deviceId == device.deviceId) {
|
||||||
|
console.log(
|
||||||
|
`更新设备信号: ${device.name || device.deviceId}, RSSI: ${device.RSSI}`
|
||||||
|
);
|
||||||
|
these.$set(these.EquipMents[index], 'RSSI', device.RSSI);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!f) {
|
||||||
|
console.log("+++ 发现新设备,准备添加到列表:", JSON.stringify(device));
|
||||||
|
|
||||||
|
if (these.device && these.device.bluetoothName && device.name) {
|
||||||
|
if (these.device.bluetoothName === device.name || (device.name && device.name
|
||||||
|
.indexOf(these
|
||||||
|
.device.bluetoothName) > -1) || (device.name && this.device
|
||||||
|
.bluetoothName.indexOf(
|
||||||
|
device.name) > -1)) {
|
||||||
|
device.isTarget = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (device.name) {
|
||||||
|
device.name = device.name.replace('JQZM-', '');
|
||||||
|
}
|
||||||
|
these.EquipMents.push(device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, pagePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
let startValidDevice = () => {
|
||||||
|
if (these.device) {
|
||||||
|
console.log("进入配对模式,启用连接恢复和验证逻辑。");
|
||||||
//蓝牙连接已恢复的回调
|
//蓝牙连接已恢复的回调
|
||||||
ble.addRecoveryCallback(res => {
|
ble.addRecoveryCallback(res => {
|
||||||
if (these.Status.isPageHidden) {
|
if (these.Status.isPageHidden) {
|
||||||
@ -291,54 +407,16 @@
|
|||||||
|
|
||||||
|
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
//搜索到新设备的回调
|
|
||||||
|
|
||||||
ble.addDeviceFound((arr) => {
|
|
||||||
// console.log("发现设备", arr);
|
|
||||||
if (these.Status.isPageHidden) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
arr = arr.devices;
|
|
||||||
|
|
||||||
for (var i = 0; i < arr.length; i++) {
|
|
||||||
|
|
||||||
arr[i].linkStatu = false;
|
|
||||||
if (!arr[i].name) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let f = these.EquipMents.find((v, index) => {
|
|
||||||
if (v.deviceId == arr[i].deviceId) {
|
|
||||||
|
|
||||||
these.$set(these.EquipMents[index], 'RSSI', arr[i].RSSI);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!f) {
|
|
||||||
console.log("发现新设备,", arr[i]);
|
|
||||||
|
|
||||||
if (these.device && these.device.bluetoothName) {
|
|
||||||
if (these.device.bluetoothName === arr[i].name || arr[i].name.indexOf(these
|
|
||||||
.device.bluetoothName) > -1 || these.device.bluetoothName.indexOf(arr[
|
|
||||||
i].name) > -1) {
|
|
||||||
arr[i].isTarget = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
arr[i].name = arr[i].name.replace('JQZM-', '');
|
|
||||||
these.EquipMents.push(arr[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// console.log("EquipMents=", these.EquipMents)
|
|
||||||
}, pagePath);
|
|
||||||
//收到设备的消息回调
|
//收到设备的消息回调
|
||||||
ble.addReceiveCallback((receivData, f, path, arr) => {
|
ble.addReceiveCallback((receivData, f, path, arr) => {
|
||||||
|
console.log("000000");
|
||||||
if (these.Status.isPageHidden) {
|
if (these.Status.isPageHidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log("1111111");
|
||||||
if (f.macAddress && these.device) {
|
if (f.macAddress && these.device) {
|
||||||
|
console.log("222222");
|
||||||
clearInterval(this.Status.intval);
|
clearInterval(this.Status.intval);
|
||||||
this.Status.intval = null;
|
this.Status.intval = null;
|
||||||
this.Status.time = null;
|
this.Status.time = null;
|
||||||
@ -354,19 +432,19 @@
|
|||||||
|
|
||||||
|
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
StartSubsrib();
|
StartSubsrib();
|
||||||
|
|
||||||
|
|
||||||
eventChannel.on('detailData', function(rec) {
|
eventChannel.on('detailData', function(rec) {
|
||||||
console.log("接收到父页面的参数:", rec);
|
console.log("接收到父页面的参数:", rec);
|
||||||
these.device = rec.data;
|
these.device = rec.data;
|
||||||
console.log("11111")
|
if (rec.data.bluetoothName) {
|
||||||
|
these.search = rec.data.bluetoothName.replace('JQZM-', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
startValidDevice();
|
||||||
these.refreshBleList();
|
these.refreshBleList();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -377,41 +455,95 @@
|
|||||||
this.refreshBleList();
|
this.refreshBleList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
refreshBleList() {
|
checkAndRequestLocationPermission() {
|
||||||
if (!ble) {
|
return new Promise((resolve) => {
|
||||||
|
|
||||||
|
if (uni.getSystemInfoSync().platform !== 'android') {
|
||||||
|
return resolve(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
plus.android.requestPermissions(
|
||||||
|
['android.permission.ACCESS_FINE_LOCATION'],
|
||||||
|
(result) => {
|
||||||
|
if (result.granted.length > 0) {
|
||||||
|
console.log('定位权限已授予');
|
||||||
|
resolve(true);
|
||||||
|
} else {
|
||||||
|
console.warn('定位权限被拒绝');
|
||||||
|
uni.showModal({
|
||||||
|
title: '权限提醒',
|
||||||
|
content: '为了正常扫描蓝牙设备,需要您开启定位权限',
|
||||||
|
showCancel: false,
|
||||||
|
success: () => {
|
||||||
|
uni.openSetting(); // 引导用户去设置页
|
||||||
|
}
|
||||||
|
});
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
console.error('请求定位权限失败:', error);
|
||||||
|
uni.showToast({
|
||||||
|
title: '权限请求异常',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
resolve(true);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async refreshBleList() {
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
if (systemInfo.uniPlatform == 'web') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let promis = [];
|
const hasPermission = await this.checkAndRequestLocationPermission();
|
||||||
for (let index = 0; index < this.PairEquip.length; index++) {
|
if (!hasPermission) {
|
||||||
let item = this.PairEquip[index];
|
console.log("缺少定位权限,已中止蓝牙扫描。");
|
||||||
promis.push(ble.disconnectDevice(item.deviceId));
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.allSettled(promis).finally(() => {
|
|
||||||
ble.StopSearch().finally(res => {
|
if (!ble) {
|
||||||
console.log("停止搜索成功");
|
ble = bleTool.getBleTool();
|
||||||
|
if (!ble) {
|
||||||
|
console.error("BLE helper not initialized!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ble.StopSearch().finally(() => {
|
||||||
|
|
||||||
|
let disconnectPromises = [];
|
||||||
|
if (ble.data && ble.data.LinkedList) {
|
||||||
|
ble.data.LinkedList.forEach(device => {
|
||||||
|
console.log(`Requesting disconnect for ${device.deviceId}`);
|
||||||
|
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.allSettled(disconnectPromises).finally(() => {
|
||||||
|
|
||||||
these.EquipMents = [];
|
these.EquipMents = [];
|
||||||
these.PairEquip = [];
|
these.PairEquip = [];
|
||||||
|
|
||||||
ble.StartSearch().then(result => {
|
ble.StartSearch().then(result => {
|
||||||
console.log("开始搜索成功");
|
console.log("Fresh scan started successfully.");
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error("开始搜索失败,err=", err);
|
console.error("Failed to start fresh scan:", err);
|
||||||
if (err.code === 10001) {
|
if (err.code === 10001) {
|
||||||
these.showOpenSetting();
|
these.showOpenSetting();
|
||||||
} else {
|
} else {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '出现异常:' + err.msg
|
content: '开始搜索失败:' + err.msg
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch(ex => {
|
|
||||||
console.error("ex=", ex);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
isItemLink: function(item, index) {
|
isItemLink: function(item, index) {
|
||||||
let src = '/static/images/BLEAdd/noLink.png';
|
let src = '/static/images/BLEAdd/noLink.png';
|
||||||
@ -753,11 +885,12 @@
|
|||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: calc(100% - 300rpx);
|
height: calc(100% - 240rpx);
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 300rpx;
|
top: 240rpx;
|
||||||
left: 0rpx;
|
left: 0rpx;
|
||||||
|
/* border: 1px solid #BBE600; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -778,17 +911,20 @@
|
|||||||
align-content: center;
|
align-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
min-height: 120rpx;
|
min-height: 120rpx;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.searchList {
|
.searchList {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: calc(100% - 186rpx);
|
height: calc(100% - 300rpx);
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
box-sizing: border-box;
|
||||||
|
/* border: 1px solid red; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.list .item {
|
.list .item {
|
||||||
@ -958,4 +1094,21 @@
|
|||||||
filter: none !important;
|
filter: none !important;
|
||||||
-webkit-filter: none !important;
|
-webkit-filter: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.uni-input{
|
||||||
|
background-color: #121212;
|
||||||
|
width:100%;
|
||||||
|
height: 60rpx;
|
||||||
|
color: #ffffffde;
|
||||||
|
border:1rpx solid #cbcbcbde;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
text-indent: 8rpx;
|
||||||
|
font-family: "PingFang SC";
|
||||||
|
line-height: 60rpx;
|
||||||
|
caret-color:#BBE600;
|
||||||
|
font-weight: 200;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Before Width: | Height: | Size: 125 B |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 265 B |
|
Before Width: | Height: | Size: 463 B |
|
Before Width: | Height: | Size: 171 B |
|
Before Width: | Height: | Size: 489 B |
|
Before Width: | Height: | Size: 676 B |
|
Before Width: | Height: | Size: 486 B |
|
Before Width: | Height: | Size: 605 B |
|
Before Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 324 B |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 512 B |
|
Before Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 331 B |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 167 B |
|
Before Width: | Height: | Size: 901 B |
|
Before Width: | Height: | Size: 454 B |
|
Before Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 587 B |
|
Before Width: | Height: | Size: 957 B |
|
Before Width: | Height: | Size: 282 B |
|
Before Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 563 B |
|
Before Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 500 B |
|
Before Width: | Height: | Size: 799 B |
|
Before Width: | Height: | Size: 927 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 278 B |
|
Before Width: | Height: | Size: 226 B |
|
Before Width: | Height: | Size: 457 B |
|
Before Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 510 B |
|
Before Width: | Height: | Size: 475 B |
|
Before Width: | Height: | Size: 209 B |
|
Before Width: | Height: | Size: 740 B |
|
Before Width: | Height: | Size: 446 B |
|
Before Width: | Height: | Size: 654 B |
|
Before Width: | Height: | Size: 691 B |
|
Before Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 385 B |
|
Before Width: | Height: | Size: 489 B |
BIN
static/zj.png
|
Before Width: | Height: | Size: 296 KiB |
|
Before Width: | Height: | Size: 8.6 KiB |
@ -1714,7 +1714,7 @@ class BleHelper {
|
|||||||
let buffer = new ArrayBuffer(bufferSize);
|
let buffer = new ArrayBuffer(bufferSize);
|
||||||
let dataView = new DataView(buffer);
|
let dataView = new DataView(buffer);
|
||||||
for (let i = 0; i < array.length; i++) {
|
for (let i = 0; i < array.length; i++) {
|
||||||
dataView.setUint8(i, array);
|
dataView.setUint8(i, array[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.sendData(deviceid, buffer, writeServiceId, wirteCharactId, ms);
|
return this.sendData(deviceid, buffer, writeServiceId, wirteCharactId, ms);
|
||||||
|
|||||||
@ -569,7 +569,7 @@ class BleReceive {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
console.log("str=",receive.str);
|
// console.log("str=",receive.str);
|
||||||
receiveData = JSON.parse(receive.str);
|
receiveData = JSON.parse(receive.str);
|
||||||
|
|
||||||
let recCnt = recArr.find(v => {
|
let recCnt = recArr.find(v => {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import config from '../config/index.js';
|
import config from '../config/index.js';
|
||||||
export const env = 'development'; //production development //开发of线上 改这里就行
|
export const env = 'production'; //production development //开发of线上 改这里就行
|
||||||
const BASE = config[env];
|
const BASE = config[env];
|
||||||
const request = (options) => {
|
const request = (options) => {
|
||||||
console.log("options" + JSON.stringify(options), BASE.BASE_URL)
|
console.log("options" + JSON.stringify(options), BASE.BASE_URL)
|
||||||
|
|||||||