1
0
forked from dyf/APP

完成100

This commit is contained in:
liub
2025-11-07 11:57:35 +08:00
parent c39cbcb34d
commit 2493bb7113
16 changed files with 1278 additions and 527 deletions

192
App.vue
View File

@ -3,7 +3,7 @@
import upgrade from '@/utils/update.js' import upgrade from '@/utils/update.js'
export default { export default {
onLaunch: function() { onLaunch: function() {
//以下代码仅在开发时使用,否则会出现不可预知的问题。 //以下代码仅在开发时使用,否则会出现不可预知的问题。
//清除登陆之外的所有信息; //清除登陆之外的所有信息;
// let store=uni.getStorageInfoSync(); // let store=uni.getStorageInfoSync();
@ -28,24 +28,29 @@
// }); // });
// uni.clearStorageSync(); // uni.clearStorageSync();
//以上代码仅在开发时使用,否则会出现不可预知的问题。 //以上代码仅在开发时使用,否则会出现不可预知的问题。
// #ifdef APP-PLUS
var appid = plus.runtime.appid;
console.log('应用的 appid 为:' + appid);
// #endif
}, },
onShow: function() { onShow: function() {
console.log('App Show'); console.log('App Show');
//将检查更新换到onshow,因为苹果用户喜欢一直挂着 //将检查更新换到onshow,因为苹果用户喜欢一直挂着
uni.getSystemInfo({success:function(res){ uni.getSystemInfo({
if(res.uniPlatform=='app'){ success: function(res) {
bleTool.getBleTool(); if (res.uniPlatform == 'app') {
let appid=plus.runtime.appid; bleTool.getBleTool();
if(appid!=='HBuilder'){ let appid = plus.runtime.appid;
console.log("appid=",appid); if (appid !== 'HBuilder') {
console.log("appid=", appid);
upgrade.checkAndUpdateWgt(); upgrade.checkAndUpdateWgt();
} }
} }
}}); }
});
}, },
onHide: function() { onHide: function() {
console.log('App Hide'); console.log('App Hide');
@ -55,66 +60,117 @@
<style lang="scss"> <style lang="scss">
@import 'vk-uview-ui/index.scss'; @import 'vk-uview-ui/index.scss';
/* #ifdef APP-ANDROID */ /* #ifdef APP-ANDROID */
//苹果应用以下样式后Slider不可拖动 //苹果应用以下样式后Slider不可拖动
uni-slider .uni-slider-handle-wrapper { uni-slider .uni-slider-handle-wrapper {
border-radius: 20rpx; border-radius: 20rpx;
}
uni-slider .uni-slider-thumb {
width: 66rpx !important;
height: 80rpx !important;
margin-top: -40rpx !important;
border-radius: 16rpx !important;
margin-left: -72rpx !important;
}
uni-slider .uni-slider-handle-wrapper {
height: 88rpx;
position: relative;
// }
/* #endif */
.custom-file-picker .file-picker__box-content {
background: rgba(26, 26, 26, 1);
border: none !important;
border-radius: 45rpx;
width: 180rpx;
height: 180rpx;
} }
uni-slider .uni-slider-thumb {
width: 66rpx !important; .uni-file-picker.custom-file-picker {
height: 80rpx !important; overflow: inherit !important;
margin-top: -40rpx !important; }
border-radius: 16rpx !important;
margin-left: -72rpx !important; .custom-file-picker .icon-add {
height: 5rpx !important;
width: 70rpx !important;
}
.uni-picker-view-mask {
background: rgba(42, 42, 42, 1);
z-index: -1;
}
.uni-picker-view-content {
position: inherit;
}
.uni-picker-view-wrapper {
background: rgba(42, 42, 42, 1);
}
.green {
color: #4CAF50 !important;
}
.red {
color: #FF0000 !important;
}
.maincontent {
width: 100%;
min-height: 100vh;
height: auto;
padding: 30rpx;
box-sizing: border-box;
} }
uni-slider .uni-slider-handle-wrapper {
height: 88rpx; .contentBg {
position: relative; background-color: #121212;
// } color: #ffffffde;
/* #endif */
.custom-file-picker .file-picker__box-content {
background: rgba(26, 26, 26, 1);
border: none !important;
border-radius: 45rpx;
width: 180rpx;
height: 180rpx;
}
.uni-file-picker.custom-file-picker {
overflow: inherit !important;
}
.custom-file-picker .icon-add {
height: 5rpx !important;
width: 70rpx !important;
}
.uni-picker-view-mask{
background: rgba(42, 42, 42, 1);
z-index: -1;
}
.uni-picker-view-content{
position: inherit;
}
.uni-picker-view-wrapper{
background: rgba(42, 42, 42, 1);
}
.green{
color: #BBE600 !important;
}
.red{
color:#E03434 !important;
}
@font-face {
font-family: "PingFang SC";
src: url("~@/static/fonts/PingFangSC.ttf") format("opentype");
} }
.fleft {
float: left;
}
.fright {
float: right;
}
.clear {
clear: both;
}
.displayNone {
display: none !important;
}
.visibilityHidden{
visibility: hidden !important;
}
.center {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-content: center;
justify-content: center;
align-items: center;
}
@font-face { @font-face {
font-family: "PingFangBold"; font-family: "PingFang SC";
src: url("~@/static/fonts/PingFangBold.ttf") format("opentype"); src: url("~@/static/fonts/PingFangSC.ttf") format("opentype");
} }
</style> @font-face {
font-family: "PingFangBold";
src: url("~@/static/fonts/PingFangBold.ttf") format("opentype");
}
</style>

View File

@ -252,34 +252,71 @@
} }
}, },
{ {
"path" : "pages/6331/BJQ6331", "path": "pages/6331/BJQ6331",
"style" : "style": {
{ "navigationBarTitleText": "BJQ6331"
"navigationBarTitleText" : "BJQ6331" }
},
{
"path": "pages/4877/BJQ4877",
"style": {
"navigationBarTitleText": "BJQ 4877"
} }
}, },
{ {
"path" : "pages/6331/AudioManager", "path": "pages/100/HBY100",
"style" : "style": {
{ "navigationBarTitleText": "HBY 100"
"navigationBarTitleText" : "语音管理"
} }
}, },
{ {
"path" : "pages/4877/BJQ4877", "path": "pages/common/audioManager/AudioList",
"style" : "style": {
{ "navigationBarTitleText": "语音管理",
"navigationBarTitleText" : "BJQ 4877" "disableScroll":true,
"app-plus": {
"bounce":"none",
"titleNView": {
"buttons": [
{
"color": "#00000000",
"text": "删",
"fontSize": "10",
"float": "right",
"fontWeight": "normal"
},
{
"color": "#ffffffde",
"text": "编辑",
"fontSize": "14",
"float": "right",
"fontWeight": "normal"
},
{
"color": "#ffffffde",
"text": "取消",
"fontSize": "14",
"float": "right",
"fontWeight": "normal"
}
]
}
}
} }
}, },
{ {
"path" : "pages/100/HBY100", "path" : "pages/common/audioManager/Recording",
"style" : "style" :
{ {
"navigationBarTitleText" : "HBY 100" "navigationBarTitleText" : "录制语音"
} }
} }
], ],
"tabBar": { "tabBar": {

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
<template> <template>
<view class="content contentBg"> <view class="content contentBg">
<view class="eq"> <view class="eq">
<view class="leftImg" @click.stop="previewImg(formData.img)"> <view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="formData.img?formData.img:'/static/images/4877/4877equip.png'" <image class="img" :src="device.devicePic?device.devicePic:formData.img"
mode="aspectFit"></image> mode="aspectFit"></image>
</view> </view>
<view class="rightTxt"> <view class="rightTxt">
@ -27,6 +27,10 @@
<text class="lbl">设备名称</text> <text class="lbl">设备名称</text>
<text class="value">{{device.deviceName}}</text> <text class="value">{{device.deviceName}}</text>
</view> </view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item"> <view class="item">
<text class="lbl">蓝牙名称</text> <text class="lbl">蓝牙名称</text>
<text class="value">{{device.bluetoothName}}</text> <text class="value">{{device.bluetoothName}}</text>
@ -312,7 +316,7 @@
usrToggle: true, usrToggle: true,
}, },
formData: { formData: {
img: '/static/images/4877/4877equip.png', img: '/static/images/common/BJQ4877.png',
sta_PowerPercent: '', sta_PowerPercent: '',
xuhang: '', xuhang: '',
blename: '', blename: '',
@ -439,7 +443,7 @@
} }
these.formData.blename = f.name ? f.name : "Unname"; these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName; these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.bleStatu = false; these.formData.bleStatu = false;
these.formData.deviceId = f.deviceId; these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {

View File

@ -1,8 +1,9 @@
<template> <template>
<view class="content contentBg"> <view class="content contentBg">
<view class="eq"> <view class="eq">
<view class="leftImg" @click.stop="previewImg(formData.img)"> <view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="formData.img" mode="aspectFit"></image> <image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
</view> </view>
<view class="rightTxt"> <view class="rightTxt">
<view class="row"> <view class="row">
@ -27,6 +28,10 @@
<text class="lbl">设备名称</text> <text class="lbl">设备名称</text>
<text class="value">{{device.deviceName}}</text> <text class="value">{{device.deviceName}}</text>
</view> </view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item"> <view class="item">
<text class="lbl">设备状态</text> <text class="lbl">设备状态</text>
<text class="value">{{formData.statu}}</text> <text class="value">{{formData.statu}}</text>
@ -228,7 +233,7 @@
} }
}, },
formData: { formData: {
img: '', img: '/static/images/common/HBY6155.png',
battary: '', battary: '',
xuhang: '', xuhang: '',
deviceName: '', deviceName: '',
@ -355,7 +360,7 @@
} }
these.formData.blename = f.name ? f.name : "Unname"; these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName; these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.id = device.id; these.formData.id = device.id;
these.formData.deviceId = f.deviceId; these.formData.deviceId = f.deviceId;
these.formData.bleStatu = false; these.formData.bleStatu = false;

View File

@ -1,22 +0,0 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@ -1,8 +1,8 @@
<template> <template>
<view class="content contentBg"> <view class="content contentBg">
<view class="eq"> <view class="eq">
<view class="leftImg" @click.stop="previewImg(formData.img)"> <view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="formData.img" mode="aspectFit"></image> <image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
</view> </view>
<view class="rightTxt"> <view class="rightTxt">
<view class="row"> <view class="row">
@ -26,6 +26,10 @@
<text class="lbl">设备名称</text> <text class="lbl">设备名称</text>
<text class="value">{{device.deviceName}}</text> <text class="value">{{device.deviceName}}</text>
</view> </view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item"> <view class="item">
<text class="lbl">蓝牙名称</text> <text class="lbl">蓝牙名称</text>
<text class="value">{{device.bluetoothName}}</text> <text class="value">{{device.bluetoothName}}</text>
@ -308,7 +312,7 @@
usrToggle: true, usrToggle: true,
}, },
formData: { formData: {
img: '/static/images/6155/DeviceDetail/equip.png', img: '/static/images/common/BJQ6331.png',
battary: '', battary: '',
xuhang: '', xuhang: '',
blename: '', blename: '',
@ -395,7 +399,7 @@
} }
these.formData.blename = f.name ? f.name : "Unname"; these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName; these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.deviceId = f.deviceId; these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {

View File

@ -1,8 +1,8 @@
<template> <template>
<view class="content contentBg"> <view class="content contentBg">
<view class="eq"> <view class="eq">
<view class="leftImg" @click.stop="previewImg(formData.img)"> <view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="formData.img" mode="aspectFit"></image> <image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
</view> </view>
<view class="rightTxt"> <view class="rightTxt">
<view class="row"> <view class="row">
@ -26,6 +26,10 @@
<text class="lbl">蓝牙名称</text> <text class="lbl">蓝牙名称</text>
<text class="value">{{device.bluetoothName}}</text> <text class="value">{{device.bluetoothName}}</text>
</view> </view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item"> <view class="item">
<text class="lbl">设备名称</text> <text class="lbl">设备名称</text>
<text class="value">{{device.deviceName}}</text> <text class="value">{{device.deviceName}}</text>
@ -250,7 +254,7 @@
usrToggle: true, usrToggle: true,
}, },
formData: { formData: {
img: '/static/images/6155/DeviceDetail/equip.png', img: '/static/images/common/HBY650.png',
battary: '', battary: '',
xuhang: '', xuhang: '',
blename: '', blename: '',
@ -344,7 +348,7 @@
} }
these.formData.blename = f.name ? f.name : "Unname"; these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName; these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.bleStatu = false; these.formData.bleStatu = false;
these.formData.deviceId = f.deviceId; these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {

View File

@ -2,10 +2,12 @@
<view class="content contentBg"> <view class="content contentBg">
<custom-navbar :title="Status.navbar.title" :showBack="Status.navbar.showBack" color="#FFFFFF" <custom-navbar :title="Status.navbar.title" :showBack="Status.navbar.showBack" color="#FFFFFF"
:rightIcons="Status.navbar.icons" @icon-click="handleRightClick"></custom-navbar> :rightIcons="Status.navbar.icons" @icon-click="handleRightClick"></custom-navbar>
<view>
</view>
<view class="eq" :style="{marginTop:Status.navbar.height+'px'}"> <view class="eq" :style="{marginTop:Status.navbar.height+'px'}">
<view class="leftImg" @click.stop="previewImg(device['devicePic'])"> <view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="device['devicePic']" mode="aspectFit"></image> <image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
</view> </view>
<view class="rightTxt"> <view class="rightTxt">
<view class="row"> <view class="row">
@ -25,13 +27,18 @@
</view> </view>
</view> </view>
<view class="eqinfo"> <view class="eqinfo">
<view class="item">
<text class="lbl">设备名称</text>
<text class="value valueFont">{{device.deviceName}}</text>
</view>
<view class="item"> <view class="item">
<text class="lbl">设备IMEI</text> <text class="lbl">设备IMEI</text>
<text class="value valueFont">{{device.deviceImei}}</text> <text class="value valueFont">{{device.deviceImei}}</text>
</view> </view>
<view class="item"> <view class="item">
<text class="lbl">设备名称</text> <text class="lbl">Mac地址</text>
<text class="value valueFont">{{device.deviceName}}</text> <text class="value">{{device.deviceMac}}</text>
</view> </view>
<view class="item"> <view class="item">
<text class="lbl">蓝牙名称</text> <text class="lbl">蓝牙名称</text>
@ -382,6 +389,7 @@
bleLinkCnt: 0 bleLinkCnt: 0
}, },
formData: { formData: {
img:'/static/images/common/HBY670.png',
battary: "", //电量 battary: "", //电量
xuhang: "", //续航 xuhang: "", //续航
imei: "", //imei imei: "", //imei
@ -518,6 +526,7 @@
let keys = Object.keys(form); let keys = Object.keys(form);
for (var i = keys.length; i >= 0; i--) { for (var i = keys.length; i >= 0; i--) {
let key = keys[i]; let key = keys[i];
these.formData[key] = form[key]; these.formData[key] = form[key];
} }
} }

View File

@ -1,8 +1,8 @@
<template> <template>
<view class="content contentBg"> <view class="content contentBg">
<view class="eq"> <view class="eq">
<view class="leftImg" @click.stop="previewImg(formData.img)"> <view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="formData.img" mode="aspectFit"></image> <image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
</view> </view>
<view class="rightTxt"> <view class="rightTxt">
<view class="row"> <view class="row">
@ -26,6 +26,10 @@
<text class="lbl">设备名称</text> <text class="lbl">设备名称</text>
<text class="value">{{device.deviceName}}</text> <text class="value">{{device.deviceName}}</text>
</view> </view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item"> <view class="item">
<text class="lbl">设备状态</text> <text class="lbl">设备状态</text>
<text class="value">{{formData.statu}}</text> <text class="value">{{formData.statu}}</text>
@ -229,7 +233,7 @@
} }
}, },
formData: { formData: {
img: '', img: '/static/images/common/HBY6155.png',
battary: '', battary: '',
xuhang: '', xuhang: '',
deviceName: '', deviceName: '',
@ -310,7 +314,7 @@
} }
these.formData.blename = f.name ? f.name : "Unname"; these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName; these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.id = device.id; these.formData.id = device.id;
these.formData.deviceId = f.deviceId; these.formData.deviceId = f.deviceId;
these.formData.bleStatu = false; these.formData.bleStatu = false;

View File

@ -6,19 +6,19 @@
</image> </image>
</view> </view>
<view class="deviceName"> <view class="deviceName">
蓝牙名:{{device.name}} 蓝牙名:{{serverDevice?serverDevice['bluetoothName']: device.name}}
</view> </view>
<view class="deviceName"> <view class="deviceName">
状态:{{deviceStatu}} 状态:{{deviceStatu}}
</view> </view>
<view class="deviceName"> <view class="deviceName">
设备名:{{device.deviceName}} 设备名:{{serverDevice?serverDevice['deviceName']:device.deviceName}}
</view> </view>
<view class="deviceId"> <view class="deviceId">
设备Mac:{{device.macAddress}} 设备Mac:{{serverDevice?serverDevice['deviceMac']:device.macAddress}}
</view> </view>
<view class="deviceId"> <view class="deviceId">
设备IMEI:{{device.imei}} 设备IMEI:{{serverDevice?serverDevice['deviceImei']:device.imei}}
</view> </view>
<view class="bound" :class="boundStatu"> <view class="bound" :class="boundStatu">
{{Statu.boundRemark}} {{Statu.boundRemark}}
@ -84,17 +84,18 @@
} }
}, },
deviceStatu: function() { deviceStatu: function() {
if (!this.device.name) { debugger;
if (!this.device.name && !this.device.macAddress) {
return ""; return "";
} }
if (!this.device.linkStatu) { if (!this.device.linkStatu && !this.device.macAddress) {
return "蓝牙未连接"; return "蓝牙未连接";
} }
if (!this.device.macAddress) { if (!this.device.macAddress) {
return '等待设备上报Mac地址'; return '等待设备上报Mac地址';
} }
if (!this.device.deviceName) { if (!this.device.deviceName && !(this.serverDevice && this.serverDevice.deviceName)) {
if (this.Statu.isSearch) { if (this.Statu.isSearch) {
return "无效设备"; return "无效设备";
} else { } else {
@ -105,7 +106,10 @@
} }
} }
} else { } else {
return "找到有效设备"
return "找到有效设备"
} }
return ""; return "";
@ -192,30 +196,39 @@
} }
}, pagePath); }, pagePath);
eventChannel = this.getOpenerEventChannel(); eventChannel = this.getOpenerEventChannel();
eventChannel.on('LinkItem', function(data) {
console.log("data=", data); if(option.mac){
let f = ble.data.LinkedList.find((v) => { this.device.macAddress=option.mac;
return v.deviceId == data.deviceId; these.initDevice();
}); }
if (f) { else{
let keys = Object.keys(f); eventChannel.on('LinkItem', function(data) {
keys.forEach((v, index) => { console.log("data=", data);
these.device[v] = f[v]; let f = ble.data.LinkedList.find((v) => {
}) return v.deviceId == data.deviceId;
// console.log("LinkedList=", ble.data.LinkedList) });
// console.log("f=", f); if (f) {
// console.log("获取到设备", these.device); let keys = Object.keys(f);
if (f.macAddress) { keys.forEach((v, index) => {
these.device.macAddress = f.macAddress; these.device[v] = f[v];
})
these.initDevice(); // console.log("LinkedList=", ble.data.LinkedList)
// console.log("f=", f);
// console.log("获取到设备", these.device);
if (f.macAddress) {
these.device.macAddress = f.macAddress;
these.initDevice();
}
} else {
console.log("未获取到设备");
} }
} else { })
console.log("未获取到设备");
} let inteval = setInterval(this.initDevice, 10000);
}) }
let inteval = setInterval(this.initDevice, 10000);
}, },
methods: { methods: {
reLinkdevice() { reLinkdevice() {
@ -281,6 +294,7 @@
deviceInvalid(); deviceInvalid();
} }
} else { } else {
this.serverDevice =null;
deviceInvalid(); deviceInvalid();
} }
@ -297,21 +311,21 @@
}, },
Link() { Link() {
// 调用绑定设备接口 // 调用绑定设备接口
let f = ble.data.LinkedList.find((v) => { // let f = ble.data.LinkedList.find((v) => {
return v.deviceId == these.device.deviceId; // return v.deviceId == these.device.deviceId;
}); // });
if (!f) { // if (!f) {
// these.Statu.bound = false;
// these.Statu.boundRemark = "蓝牙连接不成功";
// return;
// }
if (!this.device.macAddress) {
these.Statu.bound = false; these.Statu.bound = false;
these.Statu.boundRemark = "蓝牙连接不成功"; these.Statu.boundRemark = "获取设备Mac地址异常";
return; return;
} }
if (!f.macAddress) { if (!this.serverDevice) {
these.Statu.bound = false;
these.Statu.boundRemark = "设备上报Mac地址异常";
return;
}
if (!this.device.deviceName) {
these.Statu.bound = false; these.Statu.bound = false;
these.Statu.boundRemark = "设备未入库"; these.Statu.boundRemark = "设备未入库";
return; return;

View File

@ -333,8 +333,8 @@
this.total = 0; // 重置总数 this.total = 0; // 重置总数
const deviceType = tab.id === '' ? undefined : tab.id; const deviceType = tab.id === '' ? undefined : tab.id;
this.$nextTick(() => { this.$nextTick(() => {
this.getSystemInfoSyncH(); this.getSystemInfoSyncH();
}); });
this.getData(deviceType); this.getData(deviceType);
if (this.mescroll) { if (this.mescroll) {
this.mescroll.resetUpScroll(); this.mescroll.resetUpScroll();
@ -400,9 +400,54 @@
case 'scan': case 'scan':
uni.scanCode({ uni.scanCode({
success: (res) => { success: (res) => {
const cleanedResult = res.result.trim(); let cleanedResult = res.result.trim();
uni.navigateTo({ console.log("scanResult=", cleanedResult);
url: `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}` let promise = new Promise((resolve, reject) => {
let url = '';
try {
let json = JSON.parse(cleanedResult);
console.log("json=", json);
if ('blue' in json) {
let mac = json.blue;
if (mac) {
if (!mac.includes(':')) {
mac = mac.replace(/(.{2})/g,'$1:').slice(0,-1)
}
url =`/pages/common/addBLE/LinkBle?mac=${encodeURIComponent(mac)}`;
console.log("蓝牙设备",mac);
}
} else if ('imei' in json) {
let imei = json.imei;
if (iemi) {
url =
`/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(imei)}`;
console.log("4G设备:",imei)
}
}
} catch (error) {
console.error("识别二维码失败,",error);
} finally {
if(!url){
url =
`/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`
console.log("未知设备:",cleanedResult)
}
resolve(url);
}
});
promise.then(res => {
uni.navigateTo({
url: res
});
}); });
}, },
fail: (err) => { fail: (err) => {
@ -456,9 +501,9 @@
if (this.$refs.swipeAction) { if (this.$refs.swipeAction) {
this.$refs.swipeAction.closeAll(); this.$refs.swipeAction.closeAll();
} }
console.log("111111",this.deviceId); console.log("111111", this.deviceId);
console.log("ble==null,",ble) console.log("ble==null,", ble)
ble && ble.DropDevice(null,this.deviceId.id); ble && ble.DropDevice(null, this.deviceId.id);
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -541,10 +586,10 @@
// 列表跳转 // 列表跳转
handleFile(item) { handleFile(item) {
let url = item.detailPageUrl; let url = item.detailPageUrl;
// url="/pages/6331/BJQ6331"; // url="/pages/6331/BJQ6331";
uni.navigateTo({ uni.navigateTo({
url: url, url: url,
success: (res) => { success: (res) => {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View File

@ -789,7 +789,7 @@ class BleHelper {
} }
try { try {
console.log("11111"); // console.log("11111");
let recData = { let recData = {
deviceId: receive.deviceId, deviceId: receive.deviceId,
serviceId: receive.serviceId, serviceId: receive.serviceId,
@ -798,7 +798,7 @@ class BleHelper {
str: str, str: str,
hexs: hexs hexs: hexs
}; };
console.log("监听到特征值:" + JSON.stringify(recData)); // console.log("监听到特征值:" + JSON.stringify(recData));
if (this.cfg.receivDataCallback) { if (this.cfg.receivDataCallback) {
if (this.cfg.receivDataCallback.length > 0) { if (this.cfg.receivDataCallback.length > 0) {

View File

@ -7,7 +7,7 @@ class BleReceive {
'/pages/650/HBY650': this.Receive_650.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/4877/BJQ4877': this.Receive_4877.bind(this),
'/pages/100/HBY100': this.Receive_4877.bind(this) '/pages/100/HBY100': this.Receive_100.bind(this)
}; };
} }
@ -45,8 +45,9 @@ class BleReceive {
let handler = null; let handler = null;
let keys = Object.keys(this.HandlerMap); let keys = Object.keys(this.HandlerMap);
for (let index = 0; index < keys.length; index++) { for (let index = 0; index < keys.length; index++) {
let key = keys[index].replaceAll('/', '').toLowerCase();
let devKey = f.device.detailPageUrl ? f.device.detailPageUrl.replaceAll('/', '').toLowerCase() : ''; let key = keys[index].replace(/\//g, "").toLowerCase();
let devKey = f.device.detailPageUrl ? f.device.detailPageUrl.replace(/\//g, "").toLowerCase() : '';
if (key == devKey) { if (key == devKey) {
handler = this.HandlerMap[keys[index]]; handler = this.HandlerMap[keys[index]];
break; break;
@ -150,8 +151,8 @@ class BleReceive {
this.setBleFormData(formData, f); this.setBleFormData(formData, f);
let recCnt = recArr.find(v => { let recCnt = recArr.find(v => {
return v.key.replaceAll('/', '').toLowerCase() == f.device.detailPageUrl return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
.replaceAll('/', '').toLowerCase(); .replace(/\//g, "").toLowerCase();
}); });
if (!recCnt) { if (!recCnt) {
@ -318,8 +319,8 @@ class BleReceive {
this.setBleFormData(receiveData, f); this.setBleFormData(receiveData, f);
console.log("recArr=", recArr); console.log("recArr=", recArr);
let recCnt = recArr.find(v => { let recCnt = recArr.find(v => {
return v.key.replaceAll('/', '').toLowerCase() == f.device.detailPageUrl return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
.replaceAll('/', '').toLowerCase(); .replace(/\//g, "").toLowerCase();
}); });
if (!recCnt) { if (!recCnt) {
if (this.formData.staticWarn) { //有静止报警 if (this.formData.staticWarn) { //有静止报警
@ -470,7 +471,7 @@ class BleReceive {
let recCnt = recArr.find(v => { let recCnt = recArr.find(v => {
return v.key.replaceAll('/', '').toLowerCase() === f.device.detailPageUrl.replaceAll( return v.key.replace(/\//g, "").toLowerCase() === f.device.detailPageUrl.replaceAll(
'/', '').toLowerCase(); '/', '').toLowerCase();
}); });
if (!recCnt) { if (!recCnt) {
@ -497,12 +498,12 @@ 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 => {
return v.key.replaceAll('/', '').toLowerCase() == f.device.detailPageUrl return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
.replaceAll('/', '').toLowerCase(); .replace(/\//g, "").toLowerCase();
}); });
if (!recCnt) { if (!recCnt) {
if (receiveData.sta_PowerPercent<=20) { if (receiveData.sta_PowerPercent<=20) {
@ -521,7 +522,36 @@ class BleReceive {
} }
Receive_100(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.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
.replace(/\//g, "").toLowerCase();
});
if (!recCnt) {
if (receiveData.sta_battery<=20) {
uni.showModal({
title: "提示",
content: "设备电量低",
showCancel: false
});
}
}
} catch (error) {
receiveData = {};
console.log("文本解析失败",error)
}
return receiveData;
}
} }

View File

@ -1,10 +1,11 @@
import request from "@/utils/request.js"; import request from "@/utils/request.js";
export default { export default {
audioStorageKey: "audioStorageKey",
pcmStorageKey: "pcmStorageKey",
guid: function generateUUID() { guid: function generateUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random() * 16 | 0; let r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8); let v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16); return v.toString(16);
}); });
}, },
@ -137,7 +138,7 @@ export default {
checkLAN: function(succ, error) { checkLAN: function(succ, error) {
uni.getNetworkType({ uni.getNetworkType({
success: (res) => { success: (res) => {
const networkType = res.networkType; let networkType = res.networkType;
// 判断网络是否连接 // 判断网络是否连接
@ -182,7 +183,7 @@ export default {
} }
// 定义格式化映射 // 定义格式化映射
const formatMap = { let formatMap = {
'yyyy': date.getFullYear(), 'yyyy': date.getFullYear(),
'MM': String(date.getMonth() + 1).padStart(2, '0'), 'MM': String(date.getMonth() + 1).padStart(2, '0'),
'dd': String(date.getDate()).padStart(2, '0'), 'dd': String(date.getDate()).padStart(2, '0'),
@ -203,15 +204,15 @@ export default {
return formatMap[match]; return formatMap[match];
}); });
}, },
getdeviceShareId(id) {//获取设备分享信息 getdeviceShareId(id) { //获取设备分享信息
return request({ return request({
url: `/app/deviceShare/${id}`, url: `/app/deviceShare/${id}`,
method: 'get', method: 'get',
}) })
}, },
getPermissions(type) { getPermissions(type) {
if (!type) { if (!type) {
type='6170'; type = '6170';
} }
let array = [{ let array = [{
value: "1", value: "1",
@ -222,7 +223,7 @@ export default {
{ {
value: "2", value: "2",
label: "激光模式", label: "激光模式",
checked: false, checked: false,
type: ['210', '6170'] type: ['210', '6170']
}, },
{ {
@ -260,53 +261,106 @@ export default {
type: ['670'] type: ['670']
} }
] ]
let arr=[]; let arr = [];
for (let i = 0; i < array.length; i++) { for (let i = 0; i < array.length; i++) {
let item = array[i]; let item = array[i];
if(!item){ if (!item) {
continue; continue;
} }
if(!item.type){ if (!item.type) {
continue; continue;
} }
let typeContais=item.type.find(v=>{ let typeContais = item.type.find(v => {
return v.includes(type); return v.includes(type);
}); });
if(typeContais){ if (typeContais) {
let json={}; let json = {};
Object.assign(json,item); Object.assign(json, item);
arr.push(json); arr.push(json);
} }
} }
return arr; return arr;
}, },
//10进制转换为16进制字符串 //10进制转换为16进制字符串
decimalToHexLittleEndian(num, byteCount,revers) { decimalToHexLittleEndian(num, byteCount, revers) {
// 处理负数(如果需要支持负数,可先转为补码) // 处理负数(如果需要支持负数,可先转为补码)
if (num < 0) { if (num < 0) {
num = 0xFFFFFFFF + num + 1; num = 0xFFFFFFFF + num + 1;
} }
// 转为16进制去除前缀0x转为大写 // 转为16进制去除前缀0x转为大写
let hex = num.toString(16).toUpperCase(); let hex = num.toString(16).toUpperCase();
// 计算需要补充的0的数量确保每个字节占2位 // 计算需要补充的0的数量确保每个字节占2位
let padLength = (byteCount || Math.ceil(hex.length / 2) * 2) - hex.length; let padLength = (byteCount || Math.ceil(hex.length / 2) * 2) - hex.length;
if (padLength > 0) { if (padLength > 0) {
hex = '0'.repeat(padLength) + hex; hex = '0'.repeat(padLength) + hex;
} }
// 分割为字节数组每2位一个字节 // 分割为字节数组每2位一个字节
const bytes = []; let bytes = [];
for (let i = 0; i < hex.length; i += 2) { for (let i = 0; i < hex.length; i += 2) {
bytes.push(hex.substr(i, 2)); bytes.push(hex.substr(i, 2));
} }
// 是否反转字节顺序(低位在前)并拼接 // 是否反转字节顺序(低位在前)并拼接
if(revers){ if (revers) {
return bytes.reverse().join(''); return bytes.reverse().join('');
} }
return bytes.join(''); return bytes.join('');
} },
//将相对路径的文件移动到_downloads文件夹中
moveFileToDownloads(tempFilePath) {
return new Promise((resolve, reject) => {
if(!tempFilePath){
console.log("无文件需要移动");
resolve(tempFilePath);
return;
}
//本来就在此目录时直接返回
if (tempFilePath.indexOf("_downloads") === 0) {
console.log("文件已存在,无需移动");
resolve(tempFilePath);
return;
}
//不是app直接返回
if (!uni.getSystemInfoSync().uniPlatform.includes('app')) {
resolve('仅支持 App 端操作');
return;
}
// console.log("tempFilePath=", tempFilePath);
var srcPath = plus.io.convertLocalFileSystemURL(tempFilePath);
// console.log("srcPath=", srcPath);
plus.io.resolveLocalFileSystemURL(srcPath,
(fileEntry) => {
plus.io.requestFileSystem(plus.io.PUBLIC_DOWNLOADS, (fs) => {
// console.log("fs=",fs.name);
// console.log("fs=",fs.root.fullPath);
fileEntry.moveTo(fs.root, fileEntry.name, (entry) => {
console.log("entry=", entry);
let relativePath = `_downloads/${entry.name}`;
resolve(relativePath);
}, (ex) => {
reject(ex)
});
}, (e) => {
console.error("请求download目录失败 " + e);
reject(e);
});
},
(error) => {
console.log('文件不存在/路径错误:', error.message); // 核心问题!
}
);
});
},
} }