new-20250827 优化蓝牙订阅在首页的弹窗 #42
@ -6,10 +6,12 @@
|
||||
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
|
||||
:buttonText="item.buttonText" @buttonClick="okCallback(item,index)" :visiblePrompt="item.visiblePrompt"
|
||||
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
|
||||
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel"
|
||||
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" :showSlot="item.showSlot"
|
||||
:showHeader="item.showHeader" :headerTxt="item.headerTxt"
|
||||
|
||||
@cancelPop="cancelClick(item,index)" />
|
||||
@cancelPop="cancelClick(item,index)" >
|
||||
<slot />
|
||||
</MessagePopup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -48,10 +50,10 @@
|
||||
this.closePop(item);
|
||||
},
|
||||
closePop: function(item) {
|
||||
debugger;
|
||||
|
||||
if (item) {
|
||||
this.Msgboxs.find((v, i) => {
|
||||
debugger;
|
||||
|
||||
if (item.key && v.key) {
|
||||
if (item.key === v.key) {
|
||||
this.Msgboxs.splice(i, 1);
|
||||
@ -79,7 +81,7 @@
|
||||
showPop: true, //是否显示弹窗
|
||||
popType: 'custom',
|
||||
bgColor: '#383934bd',
|
||||
borderColor: '#BBE600',
|
||||
borderColor: '#BBE6004d',
|
||||
textColor: '#ffffffde',
|
||||
buttonBgColor: '#BBE600',
|
||||
buttonTextColor: '#232323DE',
|
||||
@ -116,7 +118,7 @@
|
||||
}
|
||||
|
||||
if (!json.borderColor) {
|
||||
json.borderColor = '#BBE600';
|
||||
json.borderColor = '#BBE6004d';
|
||||
json.buttonBgColor = '#BBE600';
|
||||
}
|
||||
json.showPop = true;
|
||||
@ -137,21 +139,37 @@
|
||||
error: {
|
||||
icoUrl: '/static/images/common/uploadErr.png',
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434"
|
||||
buttonBgColor: "#E03434",
|
||||
bgColor:'#38393466',
|
||||
buttonTextColor:'#FFFFFFde'
|
||||
},
|
||||
succ: {
|
||||
icoUrl: '/static/images/common/success.png',
|
||||
borderColor: "#BBE600",
|
||||
buttonBgColor: "#BBE600"
|
||||
borderColor: "#BBE6004d",
|
||||
buttonBgColor: "#BBE600",
|
||||
bgColor:'#38393466'
|
||||
},
|
||||
warn: {
|
||||
icoUrl: '/static/images/common/warning.png',
|
||||
borderColor: "#FFC84E",
|
||||
borderColor: "#FFC84E4d",
|
||||
buttonBgColor: "#FFC84E",
|
||||
bgColor:'#38393466'
|
||||
},
|
||||
info:{
|
||||
borderColor: "#BBE600",
|
||||
buttonBgColor: "#BBE600"
|
||||
borderColor: "#BBE6004d",
|
||||
buttonBgColor: "#BBE600",
|
||||
bgColor:'#38393466'
|
||||
},
|
||||
prompt:{
|
||||
|
||||
|
||||
borderColor: "#aed6004d",
|
||||
buttonBgColor: "#aed600",
|
||||
bgColor:'#38393466',
|
||||
buttonTextColor:'#232323de',
|
||||
showSlot:true,
|
||||
showCancel:true,
|
||||
buttonCancelText:'取消'
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +189,13 @@
|
||||
borderColor: cfg[type].borderColor,
|
||||
buttonBgColor: cfg[type].buttonBgColor,
|
||||
buttonText: btnTxt ? btnTxt : '确定',
|
||||
okCallback: okCallback ? okCallback : this.closePop
|
||||
okCallback: okCallback ? okCallback : this.closePop,
|
||||
buttonTextColor:cfg[type].buttonTextColor,
|
||||
bgColor:cfg[type].bgColor,
|
||||
showSlot:cfg[type].showSlot,
|
||||
showCancel:cfg[type].showCancel,
|
||||
buttonCancelText:cfg[type].buttonCancelText
|
||||
|
||||
};
|
||||
return this.showPop(options);
|
||||
|
||||
|
||||
@ -107,6 +107,6 @@
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
color: #FFFFFF;
|
||||
color: #FFFFFFde;
|
||||
}
|
||||
</style>
|
||||
@ -58,7 +58,7 @@
|
||||
* 清除Canvas内容
|
||||
*/
|
||||
clearCanvas() {
|
||||
this.ctx.setFillStyle(this.bgColor);
|
||||
this.ctx.setFillStyle('#FFFFFF');//this.bgColor
|
||||
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
|
||||
},
|
||||
|
||||
@ -73,31 +73,49 @@
|
||||
|
||||
// 逐行处理
|
||||
for (let y = 0; y < 16; y++) {
|
||||
let byte1 = 0,
|
||||
byte2 = 0;
|
||||
let byte1 = '',
|
||||
byte2 = '';
|
||||
|
||||
// 每行16个像素,分为两个字节
|
||||
for (let x = 0; x < 16; x++) {
|
||||
// 计算像素在imageData中的索引 (RGBA格式)
|
||||
let index = (y * 16 + x) * 4;
|
||||
let red = imageData[index];
|
||||
|
||||
// 黑色像素(R值较低)视为1,白色视为0
|
||||
let isBlack = red < 128;
|
||||
|
||||
if (x < 8) {
|
||||
// 第一个字节(左8位)
|
||||
if (isBlack) {
|
||||
byte1 |= 0x80 >> x; // 从左到右设置位
|
||||
}
|
||||
} else {
|
||||
// 第二个字节(右8位)
|
||||
if (isBlack) {
|
||||
byte2 |= 0x80 >> (x - 8);
|
||||
}
|
||||
let index = (y * 16 + x) * 4;
|
||||
let r = imageData[index];
|
||||
let g = imageData[index+1];
|
||||
let b = imageData[index+2];
|
||||
|
||||
|
||||
let gray = (r + g + b) / 3;
|
||||
let bit = gray < 255 ? '1' : '0';
|
||||
|
||||
|
||||
|
||||
if (x < 8) {
|
||||
byte1+=bit;
|
||||
} else {
|
||||
byte2+=bit;
|
||||
}
|
||||
}
|
||||
// let red = imageData[index];
|
||||
|
||||
// // 黑色像素(R值较低)视为1,白色视为0
|
||||
// let isBlack = red < 128;
|
||||
|
||||
// if (x < 8) {
|
||||
// // 第一个字节(左8位)
|
||||
// if (isBlack) {
|
||||
// byte1 |= 0x80 >> x; // 从左到右设置位
|
||||
// }
|
||||
// } else {
|
||||
// // 第二个字节(右8位)
|
||||
// if (isBlack) {
|
||||
// byte2 |= 0x80 >> (x - 8);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
byte1=parseInt(byte1,2);
|
||||
byte2=parseInt(byte2,2);
|
||||
// 将字节转换为两位十六进制字符串
|
||||
matrix.push('0x' + byte1.toString(16).padStart(2, '0').toUpperCase());
|
||||
matrix.push('0x' + byte2.toString(16).padStart(2, '0').toUpperCase());
|
||||
@ -118,7 +136,7 @@
|
||||
this.clearCanvas();
|
||||
|
||||
// 3. 设置文字样式
|
||||
ctx.setFillStyle(this.color);
|
||||
ctx.setFillStyle('#000000');//this.color
|
||||
ctx.setTextBaseline('middle');
|
||||
ctx.setFontSize(this.fontSize);
|
||||
ctx.font = `${this.fontSize}px "PingFang SC", PingFang SC, Arial, sans-serif`;
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
* 清除Canvas内容
|
||||
*/
|
||||
clearCanvas() {
|
||||
this.ctx.setFillStyle(this.bgColor);
|
||||
this.ctx.setFillStyle('#FFFFFF'); //this.bgColor
|
||||
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
|
||||
},
|
||||
|
||||
@ -71,22 +71,22 @@
|
||||
if (this.canvasWarmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
// 设置画布尺寸
|
||||
this.currentCanvasWidth = 16;
|
||||
this.currentCanvasHeight = 16;
|
||||
|
||||
|
||||
// 清空画布
|
||||
this.clearCanvas();
|
||||
|
||||
|
||||
// 绘制一个测试字符来预热字体和画布
|
||||
this.ctx.setFillStyle(this.color);
|
||||
this.ctx.setFillStyle('#000000'); //this.color
|
||||
this.ctx.setFontSize(this.fontSize);
|
||||
this.ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
|
||||
this.ctx.setTextBaseline('middle');
|
||||
this.ctx.fillText('测', 0, 8);
|
||||
|
||||
|
||||
// 等待画布绘制完成
|
||||
await new Promise((resolve) => {
|
||||
this.ctx.draw(false, () => {
|
||||
@ -110,7 +110,7 @@
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// 额外等待确保字体完全加载
|
||||
await new Promise(resolve => setTimeout(resolve, 200));
|
||||
} catch (ex) {
|
||||
@ -118,55 +118,55 @@
|
||||
this.canvasWarmed = true; // 即使失败也标记为已预热,避免重复尝试
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 复用单个Canvas处理所有文本行
|
||||
*/
|
||||
async drawAndGetPixels() {
|
||||
// 第一次调用时先预热画布(解决APP重新打开后第一次获取数据不完整的问题)
|
||||
// await this.warmupCanvas();
|
||||
|
||||
let convertCharToMatrix=function(imageData) {
|
||||
debugger;
|
||||
let convertCharToMatrix = function(imageData) {
|
||||
|
||||
// console.log("imgData=",imageData)
|
||||
let matrix = [];
|
||||
|
||||
|
||||
// 逐行处理
|
||||
for (let y = 0; y < 16; y++) {
|
||||
let byte1 = 0,
|
||||
byte2 = 0;
|
||||
|
||||
// 每行16个像素,分为两个字节
|
||||
let byte1 = '',
|
||||
byte2 = '';
|
||||
|
||||
|
||||
for (let x = 0; x < 16; x++) {
|
||||
// 计算像素在imageData中的索引 (RGBA格式)
|
||||
|
||||
let index = (y * 16 + x) * 4;
|
||||
let red = imageData[index];
|
||||
|
||||
// 黑色像素(R值较低)视为1,白色视为0
|
||||
let isBlack = red < 128;
|
||||
|
||||
if (x < 8) {
|
||||
// 第一个字节(左8位)
|
||||
if (isBlack) {
|
||||
byte1 |= 0x80 >> x; // 从左到右设置位
|
||||
}
|
||||
} else {
|
||||
// 第二个字节(右8位)
|
||||
if (isBlack) {
|
||||
byte2 |= 0x80 >> (x - 8);
|
||||
}
|
||||
let r = imageData[index];
|
||||
let g = imageData[index+1];
|
||||
let b = imageData[index+2];
|
||||
|
||||
|
||||
let gray = (r + g + b) / 3;
|
||||
let bit = gray < 255 ? '1' : '0';
|
||||
|
||||
|
||||
|
||||
if (x < 8) {
|
||||
byte1+=bit;
|
||||
} else {
|
||||
byte2+=bit;
|
||||
}
|
||||
}
|
||||
|
||||
byte1=parseInt(byte1,2);
|
||||
byte2=parseInt(byte2,2);
|
||||
// 将字节转换为两位十六进制字符串
|
||||
matrix.push('0x' + byte1.toString(16).padStart(2, '0').toUpperCase());
|
||||
matrix.push('0x' + byte2.toString(16).padStart(2, '0').toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
return matrix;
|
||||
}
|
||||
|
||||
|
||||
let drawTxt=async (textLine)=> {
|
||||
let drawTxt = async (textLine) => {
|
||||
debugger;
|
||||
let result = {};
|
||||
let ctx = this.ctx;
|
||||
@ -179,12 +179,12 @@
|
||||
this.clearCanvas();
|
||||
|
||||
// 3. 设置文字样式
|
||||
ctx.setFillStyle(this.color);
|
||||
ctx.setFillStyle('#000000'); //this.color
|
||||
ctx.setTextBaseline('middle');
|
||||
// ctx.setTextAlign('center')
|
||||
ctx.setFontSize(this.fontSize);
|
||||
ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
|
||||
|
||||
ctx.font = `${this.fontSize}px "PingFang SC","PingFangBold", Arial, sans-serif`;
|
||||
|
||||
// 4. 绘制当前行文本
|
||||
let currentX = 0;
|
||||
let currentY = this.fontSize / 2;
|
||||
@ -206,8 +206,8 @@
|
||||
width: this.currentCanvasWidth,
|
||||
height: this.currentCanvasHeight,
|
||||
success: res => {
|
||||
|
||||
result={
|
||||
|
||||
result = {
|
||||
line: textLine,
|
||||
pixelData: res.data,
|
||||
width: this.currentCanvasWidth,
|
||||
@ -228,10 +228,10 @@
|
||||
let arr = [];
|
||||
// 循环处理每行文本
|
||||
for (let i = 0; i < this.validTxts.length; i++) {
|
||||
debugger;
|
||||
debugger;
|
||||
let linePixls = [];
|
||||
let item = this.validTxts[i];
|
||||
|
||||
|
||||
for (var j = 0; j < item.length; j++) {
|
||||
let result = await drawTxt(item[j]);
|
||||
linePixls.push(convertCharToMatrix(result.pixelData));
|
||||
@ -239,7 +239,7 @@ debugger;
|
||||
// console.log("hexs=",linePixls.join(","));
|
||||
arr.push(linePixls);
|
||||
}
|
||||
|
||||
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
* 清除Canvas内容
|
||||
*/
|
||||
clearCanvas() {
|
||||
this.ctx.setFillStyle(this.bgColor);
|
||||
this.ctx.setFillStyle('#FFFFFF');//this.bgColor
|
||||
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
|
||||
},
|
||||
|
||||
@ -87,7 +87,7 @@
|
||||
this.clearCanvas();
|
||||
|
||||
// 绘制一个测试字符来预热字体和画布
|
||||
this.ctx.setFillStyle(this.color);
|
||||
this.ctx.setFillStyle('#000000');//this.color
|
||||
this.ctx.setFontSize(this.fontSize);
|
||||
this.ctx.font = `${this.fontSize}px "PingFangBold","PingFang SC", Arial, sans-serif`;
|
||||
this.ctx.setTextBaseline('middle');
|
||||
@ -212,7 +212,7 @@
|
||||
this.clearCanvas();
|
||||
|
||||
// 3. 设置文字样式
|
||||
ctx.setFillStyle(this.color);
|
||||
ctx.setFillStyle('#000000');//this.color
|
||||
ctx.setTextBaseline('middle');
|
||||
// ctx.setTextAlign('center')
|
||||
ctx.setFontSize(this.fontSize);
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
* 清除Canvas内容
|
||||
*/
|
||||
clearCanvas() {
|
||||
this.ctx.setFillStyle(this.bgColor);
|
||||
this.ctx.setFillStyle('#FFFFFF');//this.bgColor
|
||||
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
|
||||
},
|
||||
|
||||
@ -100,10 +100,19 @@
|
||||
for (let x = 0; x < 16; x++) {
|
||||
// 计算像素在imageData中的索引 (RGBA格式)
|
||||
let index = (y * 16 + x) * 4;
|
||||
let red = imageData[index];
|
||||
// let red = imageData[index];
|
||||
|
||||
|
||||
let r = imageData[index];
|
||||
let g = imageData[index+1];
|
||||
let b = imageData[index+2];
|
||||
|
||||
|
||||
let gray = (r + g + b) / 3;
|
||||
let bit = gray < 255 ? '1' : '0';
|
||||
|
||||
// 黑色像素(R值较低)视为1,白色视为0
|
||||
let isBlack = red < 128 ? 1 : 0;
|
||||
let isBlack =gray < 255 ? 1 : 0;// red < 128 ? 1 : 0;
|
||||
arr.push(isBlack);
|
||||
|
||||
}
|
||||
@ -154,7 +163,7 @@
|
||||
this.clearCanvas();
|
||||
|
||||
// 3. 设置文字样式
|
||||
ctx.setFillStyle(this.color);
|
||||
ctx.setFillStyle('#000000');//this.color
|
||||
ctx.setTextBaseline('middle');
|
||||
// ctx.setTextAlign('center')
|
||||
ctx.setFontSize(this.fontSize);
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
* 清除Canvas内容
|
||||
*/
|
||||
clearCanvas() {
|
||||
this.ctx.setFillStyle(this.bgColor);
|
||||
this.ctx.setFillStyle('#FFFFFF');//this.bgColor
|
||||
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
|
||||
},
|
||||
|
||||
@ -82,9 +82,9 @@
|
||||
this.currentCanvasWidth = 16;
|
||||
this.currentCanvasHeight = 16;
|
||||
this.clearCanvas();
|
||||
this.ctx.setFillStyle(this.color);
|
||||
this.ctx.setFillStyle('#000000');//this.color
|
||||
this.ctx.setFontSize(this.fontSize);
|
||||
this.ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
|
||||
this.ctx.font = `${this.fontSize}px "PingFang SC","PingFangBold", Arial, sans-serif`;
|
||||
this.ctx.setTextBaseline('middle');
|
||||
this.ctx.fillText('测', 0, 8);
|
||||
|
||||
@ -158,12 +158,20 @@
|
||||
// pixels.push(R < 128 ? 1 : 0);
|
||||
|
||||
|
||||
const R = imageData[i];
|
||||
const G = imageData[i + 1];
|
||||
const B = imageData[i + 2];
|
||||
const gray = 0.299 * R + 0.587 * G + 0.114 * B; // 灰度转换
|
||||
pixels.push(gray < 128 ? 1 : 0);
|
||||
// const R = imageData[i];
|
||||
// const G = imageData[i + 1];
|
||||
// const B = imageData[i + 2];
|
||||
// const gray = 0.299 * R + 0.587 * G + 0.114 * B; // 灰度转换
|
||||
// pixels.push(gray < 128 ? 1 : 0);
|
||||
|
||||
let r = imageData[i];
|
||||
let g = imageData[i+1];
|
||||
let b = imageData[i+2];
|
||||
|
||||
|
||||
let gray = (r + g + b) / 3;
|
||||
let bit = gray < 255 ? 1 : 0;
|
||||
pixels.push(bit);
|
||||
}
|
||||
|
||||
const lowBytes = new Array(charWidth).fill(0);
|
||||
@ -197,11 +205,11 @@
|
||||
this.clearCanvas();
|
||||
|
||||
// 3. 设置文字样式
|
||||
ctx.setFillStyle(this.color);
|
||||
ctx.setFillStyle('#000000');//this.color
|
||||
ctx.setTextBaseline('middle');
|
||||
// ctx.setTextAlign('center')
|
||||
ctx.setFontSize(this.fontSize);
|
||||
ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
|
||||
ctx.font = `${this.fontSize}px "PingFang SC","PingFangBold", Arial, sans-serif`;
|
||||
|
||||
// 4. 绘制当前行文本
|
||||
debugger;
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
* 清除Canvas内容
|
||||
*/
|
||||
clearCanvas() {
|
||||
this.ctx.setFillStyle(this.bgColor);
|
||||
this.ctx.setFillStyle('#FFFFFF');//this.bgColor
|
||||
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
|
||||
},
|
||||
|
||||
@ -105,10 +105,18 @@
|
||||
let G = imageData[index+1];
|
||||
let B = imageData[index]+2;
|
||||
|
||||
// let r = imageData[i];
|
||||
// let g = imageData[i+1];
|
||||
// let b = imageData[i+2];
|
||||
|
||||
|
||||
let gray = (R + G + B) / 3;
|
||||
let bit = gray < 255 ? 1 : 0;
|
||||
|
||||
|
||||
// 黑色像素(R值较低)视为1,白色视为0
|
||||
let isBlack = R < 128 ? 1 : 0;
|
||||
arr.push(isBlack);
|
||||
// let isBlack = R < 128 ? 1 : 0;
|
||||
arr.push(bit);
|
||||
|
||||
}
|
||||
}
|
||||
@ -159,11 +167,11 @@
|
||||
this.clearCanvas();
|
||||
|
||||
// 3. 设置文字样式
|
||||
ctx.setFillStyle(this.color);
|
||||
ctx.setFillStyle('#000000');//this.color
|
||||
ctx.setTextBaseline('middle');
|
||||
// ctx.setTextAlign('center')
|
||||
ctx.setFontSize(this.fontSize);
|
||||
ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
|
||||
ctx.font = `${this.fontSize}px PingFangBold", "PingFang SC", Arial, sans-serif`;
|
||||
|
||||
// 4. 绘制当前行文本
|
||||
let currentX = 0;
|
||||
|
||||
@ -141,9 +141,8 @@
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transform: translateZ(0);
|
||||
/* 启用GPU加速 */
|
||||
margin-top: -150rpx;
|
||||
transform: translateZ(0);
|
||||
margin-top: 0rpx;
|
||||
}
|
||||
|
||||
/* 刻度容器 */
|
||||
|
||||
@ -459,6 +459,13 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/210/HBY210",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "HBY210"
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
|
||||
@ -66,7 +66,9 @@
|
||||
</view>
|
||||
|
||||
<ProParams :id="device.id"></ProParams>
|
||||
|
||||
<MsgBox ref="msgPop" />
|
||||
|
||||
<global-loading ref="loading" />
|
||||
</view>
|
||||
</template>
|
||||
@ -85,7 +87,8 @@
|
||||
MsgClose,
|
||||
MsgWarning,
|
||||
showPop,
|
||||
MsgInfo
|
||||
MsgInfo,
|
||||
MsgPrompt
|
||||
} from '@/utils/MsgPops.js'
|
||||
import Common from '@/utils/Common.js';
|
||||
import BleTool from '@/utils/BleHelper.js'
|
||||
@ -213,7 +216,7 @@
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
|
||||
|
||||
these = this;
|
||||
recei = BleReceive.getBleReceive();
|
||||
ble = BleTool.getBleTool();
|
||||
@ -227,8 +230,8 @@
|
||||
|
||||
eventChannel = this.getOpenerEventChannel();
|
||||
|
||||
eventChannel.on('detailData', function(data) {
|
||||
|
||||
eventChannel.on('detailData', (data)=> {
|
||||
|
||||
console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||
var device = data.data;
|
||||
these.Status.apiType = data.apiType;
|
||||
@ -1196,7 +1199,7 @@
|
||||
.navbarRight .img {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
margin-right: 20rpx;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.uni-navbar--fixed {
|
||||
|
||||
@ -623,7 +623,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
|
||||
@ -1360,7 +1360,7 @@ onFreqChanging(e){
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
|
||||
@ -58,6 +58,11 @@
|
||||
<text class="value"
|
||||
:class="deviceInfo.onlineStatus===0?'red':'green'">{{ deviceInfo.onlineStatus === 0 ? '离线': '在线' }}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="lbl">充电状态</text>
|
||||
<text class="value"
|
||||
>{{ deviceInfo.chargingStatus === 0 ? '未充电': '充电中' }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label" style="display: flex; align-items: center;">定位信息</text>
|
||||
<view class="info-value status-running" @click="gpsPosition(deviceInfo)">
|
||||
@ -192,6 +197,16 @@
|
||||
</view>
|
||||
</view>
|
||||
<ProParams :id="device.id"></ProParams>
|
||||
|
||||
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
|
||||
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
||||
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
|
||||
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
|
||||
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt"
|
||||
:promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue"
|
||||
:buttonCancelText="Status.Pop.buttonCancelText" :showCancel="Status.Pop.showCancel"
|
||||
@cancelPop="closePop" />
|
||||
|
||||
<MsgBox ref="msgPop" />
|
||||
</view>
|
||||
</view>
|
||||
@ -1514,7 +1529,7 @@
|
||||
option.buttonBgColor = '#BBE600';
|
||||
}
|
||||
these.Status.Pop.showPop = true;
|
||||
showPop(option,this);
|
||||
|
||||
},
|
||||
btnClick() {
|
||||
|
||||
|
||||
@ -1196,7 +1196,7 @@
|
||||
.navbarRight .img {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
margin-right: 20rpx;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.uni-navbar--fixed {
|
||||
|
||||
@ -1365,7 +1365,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
|
||||
2715
pages/210/HBY210.vue
1528
pages/210/HBY210Old.vue
Normal file
@ -1252,7 +1252,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
|
||||
@ -748,7 +748,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="warnnig" :class="formData.sta_ShakeBit!==0 ?'':'displayNone'">
|
||||
<view class="warnnig" :class="formData.sta_ShakeBit!=0 ?'':'displayNone'">
|
||||
<view>{{formData.sta_ShakeBit==3?'设备疑似受到外力碰撞':'设备声光报警中'}}!</view>
|
||||
<view @click.stop="SOSToggle()">
|
||||
<uni-icons type="closeempty" color="#FFFFFFde" size="16"></uni-icons>
|
||||
@ -1418,7 +1418,7 @@
|
||||
console.error("出现错误", ex)
|
||||
});
|
||||
}
|
||||
let msg = val == 1 ? '确定开启声光报警' : '确定关闭声光报警';
|
||||
let msg = val == 1 ? '确定开启声光报警' : '确定解除声光报警';
|
||||
|
||||
showPop({
|
||||
message: msg,
|
||||
@ -1912,7 +1912,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
showCancel: true,
|
||||
okCallback: function() {
|
||||
console.log("1111");
|
||||
@ -2858,7 +2858,7 @@
|
||||
.navbarRight .img {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
margin-right: 20rpx;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.uni-navbar--fixed {
|
||||
|
||||
@ -840,7 +840,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
|
||||
@ -708,7 +708,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
// console.log("1111");
|
||||
uni.navigateTo({
|
||||
|
||||
@ -688,7 +688,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
// console.log("1111");
|
||||
uni.navigateTo({
|
||||
|
||||
@ -58,6 +58,12 @@
|
||||
{{getbleStatu}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="info-row" v-if="itemInfo.deviceMac" @click="bleStatuToggle">
|
||||
<text class="info-label">充电状态</text>
|
||||
<text class="info-value status-running" >
|
||||
{{deviceInfo.chargeState != 0?'充电中':'未充电'}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label" style="display: flex; align-items: center;">定位信息</text>
|
||||
<view class="info-value status-running" @click="gpsPosition(deviceInfo)">
|
||||
@ -73,7 +79,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="callpolice" v-if="deviceInfo.onlineStatus == 1 && deviceInfo.alarmStatus == 1">
|
||||
<view class="callpolice" v-if="deviceInfo.alarmStatus == 1">
|
||||
<view class="">设备强制报警中</view>
|
||||
<view>
|
||||
<uni-icons type="closeempty" size="15" color="rgba(255, 255, 255, 0.9)"
|
||||
@ -436,6 +442,52 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onReceive(deviceState){//蓝牙/Mq通用消息处理
|
||||
switch (deviceState[0]) {
|
||||
// 1设备切换灯光实时返回
|
||||
case 1:
|
||||
this.currentMainMode = this.getMainLightModeLabel(
|
||||
deviceState[
|
||||
1]);
|
||||
this.sliderValue = deviceState[2];
|
||||
this.deviceInfo.batteryRemainingTime = deviceState[3];
|
||||
break;
|
||||
// 12为设备实时上报
|
||||
case 12:
|
||||
this.currentMainMode = this.getMainLightModeLabel(
|
||||
deviceState[
|
||||
1]);
|
||||
this.isLaserOn = deviceState[2] === 1; //第3位表示当时激光灯档位
|
||||
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
|
||||
if (this.deviceInfo) {
|
||||
this.deviceInfo.batteryPercentage = deviceState[3]; //第4位电量百分比
|
||||
this.deviceInfo.chargeState = deviceState[4]; //第5位为充电状态(0没有充电,1正在充电,2为已充满)
|
||||
this.deviceInfo.batteryRemainingTime = deviceState[5]; //第6位200代表电池剩余续航时间200分钟
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (this.deviceInfo.batteryPercentage < 20 &&
|
||||
this.deviceInfo.chargeState == 0) {
|
||||
this.popupType = 'bettery';
|
||||
this.popupMessage = '请及时充电';
|
||||
this.showPopupFlag = true;
|
||||
}
|
||||
if (this.apiType === 'listA') {
|
||||
this.fetchDeviceDetail(data.data.id)
|
||||
} else {
|
||||
// 分享权限详情
|
||||
this.fetchSharedDeviceDetail(data.data.id)
|
||||
}
|
||||
}, 10000);
|
||||
// 上报电量,在列表里面同步
|
||||
uni.$emit('deviceStatusUpdate', {
|
||||
message: parsedMessage,
|
||||
timestamp: new Date().getTime()
|
||||
});
|
||||
break;
|
||||
default:
|
||||
console.log('未知的 deviceState 类型:', deviceState[0]);
|
||||
}
|
||||
},
|
||||
bleStatuToggle() {
|
||||
let f = this.getDevice();
|
||||
if (!f) {
|
||||
@ -504,7 +556,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
showCancel: true,
|
||||
okCallback: function() {
|
||||
console.log("1111");
|
||||
@ -532,11 +584,9 @@
|
||||
}
|
||||
let data = rec.ReceiveData(receive, device, pagePath, recArr);
|
||||
console.log("蓝牙收到消息", data)
|
||||
this.receivData(data);
|
||||
},
|
||||
receivData(data) {
|
||||
|
||||
this.onReceive(data.state);
|
||||
},
|
||||
|
||||
bleStateBreak() {
|
||||
if (this.Status.pageHide) {
|
||||
return;
|
||||
@ -1566,6 +1616,7 @@
|
||||
// this.popupConfirmText="";
|
||||
},
|
||||
OpenWarn(val){//开启/解除强制报警
|
||||
debugger;
|
||||
const topic = `B/${this.itemInfo.deviceImei}`;
|
||||
let message={"instruct":[7,val,0,0,0,0]};
|
||||
message=JSON.stringify(message);
|
||||
@ -1575,6 +1626,8 @@
|
||||
});
|
||||
if(flag){
|
||||
this.itemInfo.alarmStatus=val;
|
||||
}else{
|
||||
MsgError("操作没有成功",'确定',this);
|
||||
}
|
||||
|
||||
this.showPopupFlag = false;
|
||||
@ -1644,11 +1697,11 @@
|
||||
// 3.解除告警状态
|
||||
const registerRes = await deviceSendAlarmMessage(data);
|
||||
if (registerRes.code !== 200) {
|
||||
uni.showToast({
|
||||
title: registerRes.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
// uni.showToast({
|
||||
// title: registerRes.msg,
|
||||
// icon: 'none'
|
||||
// })
|
||||
this.OpenWarn(0);
|
||||
return
|
||||
}
|
||||
this.itemInfo.alarmStatus=0;
|
||||
@ -1908,53 +1961,8 @@
|
||||
const deviceState = parsedMessage.state; // 直接取 state 数组
|
||||
// 切换主灯光模式,亮度值设备同步
|
||||
if (!deviceState) return;
|
||||
// 1设备切换灯光实时返回
|
||||
switch (deviceState[0]) {
|
||||
case 1:
|
||||
this.currentMainMode = this.getMainLightModeLabel(
|
||||
deviceState[
|
||||
1]);
|
||||
this.sliderValue = deviceState[2];
|
||||
this.deviceInfo.batteryRemainingTime = deviceState[3];
|
||||
break;
|
||||
// 12为设备实时上报
|
||||
case 12:
|
||||
this.currentMainMode = this.getMainLightModeLabel(
|
||||
deviceState[
|
||||
1]);
|
||||
this.isLaserOn = deviceState[2] === 1; //第3位表示当时激光灯档位
|
||||
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
|
||||
if (this.deviceInfo) {
|
||||
this.deviceInfo.batteryPercentage = deviceState[
|
||||
3]; //第4位电量百分比
|
||||
this.deviceInfo.chargeState = deviceState[
|
||||
4]; //第5位为充电状态(0没有充电,1正在充电,2为已充满)
|
||||
this.deviceInfo.batteryRemainingTime = deviceState[
|
||||
5]; //第6位200代表电池剩余续航时间200分钟
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (this.deviceInfo.batteryPercentage < 20 &&
|
||||
this.deviceInfo.chargeState == 0) {
|
||||
this.popupType = 'bettery';
|
||||
this.popupMessage = '请及时充电';
|
||||
this.showPopupFlag = true;
|
||||
}
|
||||
if (this.apiType === 'listA') {
|
||||
this.fetchDeviceDetail(data.data.id)
|
||||
} else {
|
||||
// 分享权限详情
|
||||
this.fetchSharedDeviceDetail(data.data.id)
|
||||
}
|
||||
}, 10000);
|
||||
// 上报电量,在列表里面同步
|
||||
uni.$emit('deviceStatusUpdate', {
|
||||
message: parsedMessage,
|
||||
timestamp: new Date().getTime()
|
||||
});
|
||||
break;
|
||||
default:
|
||||
console.log('未知的 deviceState 类型:', deviceState[0]);
|
||||
}
|
||||
|
||||
this.onReceive(deviceState);
|
||||
} catch (error) {
|
||||
console.log('解析MQTT消息失败:', error, '原始消息:', payload);
|
||||
}
|
||||
|
||||
@ -739,7 +739,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
|
||||
@ -822,7 +822,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
|
||||
@ -180,7 +180,7 @@
|
||||
<view class="item" @click="lightSetting('close')" :class="formData.lightCurr=='close'?'active':''">
|
||||
<view class="imgContent center">
|
||||
<image class="img"
|
||||
:src="formData.lightCurr=='close'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
|
||||
:src="formData.lightCurr=='close'?'/static/images/lightImg/closeLightActive.png':'/static/images/lightImg/closeLight.png'"
|
||||
mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="txt">关闭</view>
|
||||
@ -340,7 +340,7 @@
|
||||
borderColor: '#BBE600',
|
||||
textColor: '#ffffffde',
|
||||
buttonBgColor: '#BBE600',
|
||||
buttonTextColor: '#232323DE',
|
||||
buttonTextColor: '#FFFFFFDE',
|
||||
|
||||
iconUrl: '',
|
||||
message: '您确定要这样做吗?',
|
||||
@ -725,7 +725,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
showCancel: true,
|
||||
cancelCallback: () => {
|
||||
// this.closePop();
|
||||
@ -1178,6 +1178,7 @@
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonTextColor: "#FFFFFFde",
|
||||
okCallback: null,
|
||||
buttonText: "确定"
|
||||
},these)
|
||||
@ -1221,6 +1222,7 @@
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonTextColor: "#FFFFFFde"
|
||||
},these);
|
||||
|
||||
}).finally(() => {
|
||||
@ -1285,7 +1287,8 @@
|
||||
message: "通信异常,请检查手机或设备网络",
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonTextColor: "#FFFFFFde"
|
||||
},these);
|
||||
|
||||
}).finally(() => {
|
||||
@ -1367,7 +1370,8 @@
|
||||
message: '无操作权限',
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonTextColor: "#FFFFFFde",
|
||||
okCallback: null,
|
||||
buttonText: "确定"
|
||||
},these)
|
||||
@ -1439,7 +1443,8 @@
|
||||
message: "通信异常,请检查手机或设备网络",
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonTextColor: "#FFFFFFde"
|
||||
},these);
|
||||
|
||||
}).finally(() => {
|
||||
@ -1562,6 +1567,7 @@
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonTextColor:"#FFFFFFde",
|
||||
okCallback: OpenSOS,
|
||||
buttonText: "开启"
|
||||
},these);
|
||||
@ -1591,6 +1597,7 @@
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonTextColor: "#FFFFFFde",
|
||||
okCallback: null,
|
||||
buttonText: "确定"
|
||||
},these)
|
||||
@ -1632,7 +1639,8 @@
|
||||
message: "通信异常,请检查手机或设备网络",
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonTextColor: "#FFFFFFde"
|
||||
},these);
|
||||
|
||||
}).finally(() => {
|
||||
@ -2192,7 +2200,8 @@
|
||||
message: '无操作权限',
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonTextColor: "#FFFFFFde",
|
||||
okCallback: null,
|
||||
buttonText: "确定"
|
||||
},these)
|
||||
@ -2313,7 +2322,8 @@
|
||||
message: '无操作权限',
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonTextColor: "#FFFFFFde",
|
||||
okCallback: null,
|
||||
buttonText: "确定"
|
||||
},these)
|
||||
@ -2531,7 +2541,8 @@
|
||||
message: '无操作权限',
|
||||
iconUrl: "/static/images/common/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonTextColor: "#FFFFFFde",
|
||||
okCallback: null,
|
||||
buttonText: "确定"
|
||||
},these)
|
||||
@ -2921,18 +2932,16 @@
|
||||
|
||||
}
|
||||
|
||||
.usrinfo .btnSend {
|
||||
line-height: 65rpx;
|
||||
border-radius: 8px;
|
||||
width: 120rpx;
|
||||
height: 65rpx;
|
||||
color: rgba(35, 35, 35, 0.87);
|
||||
font-family: PingFang SC;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.15rpx;
|
||||
text-align: center;
|
||||
background-color: #BBE600;
|
||||
.usrinfo .btnSend {
|
||||
background-color: rgb(187, 230, 0);
|
||||
color: rgba(35, 35, 35, 0.87);
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
border-radius: 16rpx;
|
||||
font-size: 26rpx;
|
||||
width: 112rpx;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.usrinfo .item {
|
||||
@ -3330,7 +3339,7 @@
|
||||
.navbarRight .img{
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
margin-right: 20rpx;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
.uni-navbar--fixed{
|
||||
top:0rpx;
|
||||
|
||||
@ -628,7 +628,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor: '#232323de',
|
||||
buttonTextColor: '#FFFFFFde',
|
||||
okCallback: function() {
|
||||
console.log("1111");
|
||||
uni.navigateTo({
|
||||
|
||||
@ -482,20 +482,20 @@
|
||||
|
||||
|
||||
ble.addStateBreakCallback(() => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '蓝牙不可用'
|
||||
});
|
||||
|
||||
|
||||
MsgError('蓝牙不可用','',these);
|
||||
|
||||
these.EquipMents.filter((v, i) => {
|
||||
these.$set(these.EquipMents[i], 'link', false);
|
||||
});
|
||||
}, pagePath);
|
||||
ble.addStateRecoveryCallback(() => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '蓝牙恢复可用'
|
||||
});
|
||||
|
||||
|
||||
MsgSuccess('蓝牙恢复可用','',these,()=>{
|
||||
MsgClear(these);
|
||||
})
|
||||
},
|
||||
pagePath);
|
||||
|
||||
@ -568,7 +568,7 @@
|
||||
|
||||
|
||||
plus.runtime.openURL('weixin://', (err) => {
|
||||
MsgError("打开微信失败,请手动打开微信粘贴");
|
||||
MsgError("打开微信失败,请手动打开微信,发送至'文件传输助手'");
|
||||
});
|
||||
},
|
||||
fail(ex){
|
||||
@ -805,10 +805,8 @@
|
||||
|
||||
let json = getUrlParams(res.result);
|
||||
if (!json.key) {
|
||||
uni.showModal({
|
||||
title: '错误',
|
||||
content: "无效的二维码"
|
||||
})
|
||||
|
||||
MsgError('无效的二维码','',these);
|
||||
return;
|
||||
}
|
||||
this.scanKey = json.key;
|
||||
@ -1050,9 +1048,8 @@
|
||||
these.sendEquipToMq();
|
||||
}).catch(ex => {
|
||||
console.log("ex=", ex)
|
||||
uni.showModal({
|
||||
content: "连接失败:" + ex.msg
|
||||
});
|
||||
|
||||
MsgError("连接失败:" + ex.msg,'',these);
|
||||
hideLoading(these);
|
||||
});
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
|
||||
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
|
||||
<view v-if="deviceList.length>0">
|
||||
<uni-swipe-action ref="swipeAction">
|
||||
<uni-swipe-action ref="swipeAction" >
|
||||
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
|
||||
<uni-swipe-action-item :right-options="Options"
|
||||
@click="handleSwipeClick($event, item, index)" class="device-card"
|
||||
@ -88,6 +88,7 @@
|
||||
</view>
|
||||
<!-- 按钮组 -->
|
||||
<view class="popup-buttons">
|
||||
<button class="btn cancelBtn" @click="closePopup('delete')">取消</button>
|
||||
<button class="btn agreeBtn" @click="handleBtn">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
@ -98,14 +99,15 @@
|
||||
<view class="popup-content">
|
||||
<view>
|
||||
<view class="popup-flex">
|
||||
<text>设备名称</text>
|
||||
<input type="text" v-model="deviceName" placeholder="请输入设备名称" class="popup-input"
|
||||
<text>名称</text>
|
||||
<input type="text" v-model="deviceName" placeholder="请输入名称" class="popup-input"
|
||||
@click.stop />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 按钮组 -->
|
||||
<view class="popup-buttons" style="margin-top:50rpx;">
|
||||
<button class="btn cancelBtn" @click="closePopup('rename')">取消</button>
|
||||
<button class="btn agreeBtn4" @click="handleBtnName">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
@ -134,6 +136,9 @@
|
||||
</view>
|
||||
<!-- 蒙板、用于点击任意位置关闭悬浮的菜单 -->
|
||||
<view class="mask" v-show="showTooltip||showshare" @click.stop="closePopMenu"></view>
|
||||
|
||||
|
||||
<MsgBox ref="msgPop" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -772,7 +777,8 @@
|
||||
this.downCallback();
|
||||
});
|
||||
ble = bleTool.getBleTool();
|
||||
recei = BleReceive.getBleReceive();
|
||||
console.log("this=",this);
|
||||
recei = BleReceive.getBleReceive(this);
|
||||
//蓝牙连接成功的回调
|
||||
ble.addRecoveryCallback((res) => {
|
||||
// console.log("蓝牙连接成功的回调");
|
||||
@ -799,8 +805,9 @@
|
||||
|
||||
//接收到消息的回调
|
||||
ble.addReceiveCallback((receive, device, path, recArr) => {
|
||||
// console.error("首页收到消息了");
|
||||
recei.ReceiveData(receive, device, path, recArr);
|
||||
console.error("首页收到消息了");
|
||||
let json=recei.ReceiveData(receive, device, path, recArr);
|
||||
console.error("消息内容",json);
|
||||
this.updateBleStatu();
|
||||
}, pagePath);
|
||||
|
||||
@ -873,12 +880,25 @@
|
||||
text-align: center;
|
||||
/* 文字居中 */
|
||||
/* 设置最小宽度 */
|
||||
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.active {
|
||||
color: rgba(187, 230, 0, 1);
|
||||
border-bottom: 6rpx solid rgba(187, 230, 0, 1);
|
||||
.tab-item.active {
|
||||
color: #bbe600;
|
||||
|
||||
height: 60rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.tab-item.active::before{
|
||||
content: "";
|
||||
background-color: #bbe600;
|
||||
position: absolute;
|
||||
top: 90%;
|
||||
left:35%;
|
||||
width: 30%;
|
||||
height: 6rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.sendFlex {
|
||||
@ -1128,14 +1148,32 @@
|
||||
border-radius: 40rpx;
|
||||
padding: 30rpx;
|
||||
text-align: center;
|
||||
border: 1px solid rgba(255, 200, 78, 0.3);
|
||||
border: 1px solid #E034344d;
|
||||
}
|
||||
|
||||
|
||||
.cancelBtn{
|
||||
|
||||
|
||||
text-align: center;
|
||||
width: 170rpx !important;
|
||||
background-color: #00000000;
|
||||
}
|
||||
|
||||
.agreement-popupC .cancelBtn{
|
||||
border:1rpx solid #E034344d;
|
||||
color:#E03434;
|
||||
}
|
||||
|
||||
.agreement-popupD .cancelBtn{
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.6);
|
||||
color:rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
.agreement-popupD {
|
||||
width: 70%;
|
||||
width: 75%;
|
||||
background-color: rgb(42, 42, 42);
|
||||
border-radius: 40rpx;
|
||||
padding: 40rpx;
|
||||
padding: 40rpx 5rpx;
|
||||
text-align: center;
|
||||
border: 1px solid rgba(187, 230, 0, 0.3);
|
||||
}
|
||||
@ -1157,6 +1195,7 @@
|
||||
font-size: 28rpx;
|
||||
text-align: left;
|
||||
text-indent: 5rpx;
|
||||
width: calc(100% - 75rpx);
|
||||
}
|
||||
|
||||
.svg {
|
||||
@ -1177,8 +1216,8 @@
|
||||
|
||||
/* 同意按钮 */
|
||||
.agreeBtn {
|
||||
background: #FFC84E;
|
||||
color: #232323;
|
||||
background: #E03434;
|
||||
color: #FFFFFF;
|
||||
border: none;
|
||||
width: 170rpx !important;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 298 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.0 KiB |
BIN
static/images/lightImg/closeLightActive.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
@ -22,9 +22,6 @@ const serviceDic = [ //合作供应商的蓝牙主服务
|
||||
class BleHelper {
|
||||
constructor() {
|
||||
this.StorageKey = "linkedDevices";
|
||||
|
||||
recei = receivTool.getBleReceive();
|
||||
|
||||
this.init();
|
||||
}
|
||||
init() {
|
||||
@ -41,16 +38,12 @@ class BleHelper {
|
||||
if (!v) return false;
|
||||
v.Linked = false;
|
||||
v.notifyState = false;
|
||||
return !!v.device;
|
||||
return v.device;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
|
||||
|
||||
|
||||
|
||||
this.data = {
|
||||
isOpenBlue: false, //蓝牙模块是否开启
|
||||
available: false, //蓝牙状态是否可用
|
||||
@ -71,17 +64,7 @@ class BleHelper {
|
||||
stateRecoveryCallback: [], //蓝牙适配器恢复可用事件
|
||||
stateBreakCallback: [] //蓝牙适配器不可用事件
|
||||
}
|
||||
//蓝牙模块不再订阅,改到首页订阅
|
||||
// this.addReceiveCallback((receive, f, path, recArr) => {
|
||||
// recei.ReceiveData(receive, f, path, recArr);
|
||||
// }, "BleReceiveData");
|
||||
|
||||
// setTimeout(() => {
|
||||
// this.OpenBlue().then(() => {
|
||||
// this.linkAllDevices();
|
||||
// });
|
||||
|
||||
// }, 10);
|
||||
|
||||
this.dic = {
|
||||
errRemarks: [{
|
||||
@ -668,7 +651,7 @@ class BleHelper {
|
||||
BleReceive() {
|
||||
uni.onBLECharacteristicValueChange((receive) => {
|
||||
//订阅消息
|
||||
console.log("收到订阅消息", receive);
|
||||
// console.log("收到订阅消息", receive);
|
||||
let f = this.data.LinkedList.find((v) => {
|
||||
return v.deviceId == receive.deviceId;
|
||||
})
|
||||
|
||||
@ -1,8 +1,22 @@
|
||||
import Common from '@/utils/Common.js'
|
||||
import { parseBleData } from '@/api/100J/HBY100-J.js'
|
||||
import {
|
||||
parseBleData
|
||||
} from '@/api/100J/HBY100-J.js'
|
||||
import {
|
||||
MsgSuccess,
|
||||
MsgError,
|
||||
MsgClose,
|
||||
MsgWarning,
|
||||
showPop,
|
||||
MsgClear,
|
||||
MsgInfo
|
||||
} from '@/utils/MsgPops.js';
|
||||
|
||||
class BleReceive {
|
||||
constructor() {
|
||||
constructor(_ref) {
|
||||
if(_ref){
|
||||
this.ref = _ref;
|
||||
}
|
||||
this.StorageKey = "linkedDevices";
|
||||
this.HandlerMap = {
|
||||
'/pages/6155/deviceDetail': this.Receive_6155.bind(this),
|
||||
@ -13,10 +27,12 @@ class BleReceive {
|
||||
'/pages/4877/BJQ4877': this.Receive_4877.bind(this),
|
||||
'/pages/100/HBY100': this.Receive_100.bind(this),
|
||||
'/pages/102/HBY102': this.Receive_102.bind(this),
|
||||
'/pages/6170/deviceControl/index':this.Receive_6170.bind(this),
|
||||
'/pages/6170/deviceControl/index': this.Receive_6170.bind(this),
|
||||
'/pages/100J/HBY100-J': this.Receive_100J.bind(this),
|
||||
'/pages/6075J/BJQ6075J':this.Receive_6075.bind(this)
|
||||
'/pages/6075J/BJQ6075J': this.Receive_6075.bind(this),
|
||||
'/pages/210/HBY210':this.Receive_210.bind(this),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -63,23 +79,23 @@ class BleReceive {
|
||||
return receive;
|
||||
}
|
||||
|
||||
if (f && f.macAddress && f.device && f.device.id) {
|
||||
if (fReady) {
|
||||
let handler = null;
|
||||
let keys = Object.keys(this.HandlerMap);
|
||||
let devKey = f.device.detailPageUrl ? f.device.detailPageUrl.replace(/\//g, '').toLowerCase() : '';
|
||||
|
||||
|
||||
for (let index = 0; index < keys.length; index++) {
|
||||
let devKey = f.device.detailPageUrl ? f.device.detailPageUrl.replace(/\//g, "").toLowerCase() : '';
|
||||
let key = keys[index].replace(/\//g, '').toLowerCase();
|
||||
if (key == devKey) {
|
||||
handler = this.HandlerMap[keys[index]];
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (handler) {
|
||||
let data = handler(receive, f, path, recArr);
|
||||
let data = handler(receive, f, path, recArr);
|
||||
this.setBleFormData(data, f);
|
||||
return data;
|
||||
} else {
|
||||
@ -89,7 +105,7 @@ class BleReceive {
|
||||
} else {
|
||||
// 100J AE30 二进制帧在 f 不完整时已在上方 parseBleData,此处不再误报「无法处理」
|
||||
if (!is100JAe30) {
|
||||
console.log("已收到该消息,但无法处理", receive, "f:", f);
|
||||
console.error("已收到该消息,但无法处理", receive, "f:", f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,40 +196,33 @@ class BleReceive {
|
||||
formData.modeCurr = modeCurr;
|
||||
formData.warnLevel = warn;
|
||||
formData.iswarn = iswarn;
|
||||
|
||||
|
||||
|
||||
let recCnt = recArr.find(v => {
|
||||
return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
|
||||
.replace(/\//g, "").toLowerCase();
|
||||
});
|
||||
if (!recCnt) {
|
||||
let msg = [];
|
||||
if (f) {
|
||||
if (formData.battary <= 20) {
|
||||
msg.push("设备'" + f.device.deviceName + "'电量低");
|
||||
}
|
||||
if (iswarn) {
|
||||
msg.push("设备'" + f.device.deviceName + "'环境存在漏电电源");
|
||||
}
|
||||
|
||||
if (iswarn) {
|
||||
uni.showModal({
|
||||
content: "'" + f.device.deviceName + "'环境存在漏电电源",
|
||||
title: "警告",
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
|
||||
if (f) {
|
||||
uni.navigateTo({
|
||||
url: f.detailPageUrl,
|
||||
events: {
|
||||
ack: function(data) {}
|
||||
},
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('detailData', {
|
||||
data: f,
|
||||
deviceType: '',
|
||||
apiType: 'listA'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.ref && msg.length>0) {
|
||||
if (msg.length > 0) {
|
||||
msg = msg.join(',');
|
||||
MsgError("'" + f.device.deviceName + "'环境存在漏电电源", '', this.ref, () => {
|
||||
MsgClear(this.ref);
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return formData;
|
||||
} catch (error) {
|
||||
@ -229,7 +238,7 @@ class BleReceive {
|
||||
if (str.indexOf('mac address:') == 0) {
|
||||
let formData = {};
|
||||
formData.macAddress = str.split(':')[1];
|
||||
|
||||
|
||||
return formData;
|
||||
} else {
|
||||
let receiveData = {
|
||||
@ -348,7 +357,7 @@ class BleReceive {
|
||||
receiveData.fourGStrenth = fourGStrenth;
|
||||
receiveData.SOS = sosTxt;
|
||||
receiveData.qzwarn = sosTxt === 'sg';
|
||||
|
||||
|
||||
console.log("recArr=", recArr);
|
||||
let recCnt = recArr.find(v => {
|
||||
return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
|
||||
@ -362,13 +371,22 @@ class BleReceive {
|
||||
if (staticWarn) { //有静止报警
|
||||
msgs.push("静止报警中");
|
||||
}
|
||||
if (receiveData.battary <= 20) {
|
||||
msg.push("设备'" + f.device.deviceName + "'电量低");
|
||||
}
|
||||
if (msgs.length > 0) {
|
||||
msgs = "设备'" + f.device.deviceName + msgs.join(";");
|
||||
uni.showModal({
|
||||
title: "警告",
|
||||
content: msgs,
|
||||
showCancel: false
|
||||
});
|
||||
msgs = msgs.join(";");
|
||||
if (this.ref) {
|
||||
MsgError(msgs, '', this.ref, () => {
|
||||
MsgClear(this.ref);
|
||||
});
|
||||
}
|
||||
|
||||
// uni.showModal({
|
||||
// title: "警告",
|
||||
// content: msgs,
|
||||
// showCancel: false
|
||||
// });
|
||||
}
|
||||
|
||||
}
|
||||
@ -436,7 +454,7 @@ class BleReceive {
|
||||
console.log('将数据转文本失败', ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return receiveData;
|
||||
}
|
||||
|
||||
@ -514,12 +532,13 @@ class BleReceive {
|
||||
|
||||
});
|
||||
if (!recCnt) {
|
||||
if (batteryLevel <= 20) {
|
||||
// 会弹出两个框,暂且注释掉这段代码
|
||||
uni.showModal({
|
||||
content: "设备'" + f.device.deviceName + "'电量低",
|
||||
title: "提示"
|
||||
});
|
||||
if (batteryLevel <= 20 && warn == 0x00) {
|
||||
|
||||
if (this.ref) {
|
||||
MsgError("设备'" + f.device.deviceName + "'电量低", '', this.ref, () => {
|
||||
MsgClear(this.ref);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -613,13 +632,17 @@ class BleReceive {
|
||||
|
||||
|
||||
});
|
||||
console.log("formData=",formData)
|
||||
if (!recCnt) {
|
||||
if (batteryLevel <= 20) {
|
||||
// 会弹出两个框,暂且注释掉这段代码
|
||||
uni.showModal({
|
||||
content: "设备'" + f.device.deviceName + "'电量低",
|
||||
title: "提示"
|
||||
});
|
||||
console.log("11111");
|
||||
if (formData.battary <= 20 && bytes[5] == 0x00) {
|
||||
console.log("2222")
|
||||
if (this.ref) {
|
||||
console.log("3333333");
|
||||
MsgError("设备'" + f.device.deviceName + "'电量低", '', this.ref, () => {
|
||||
MsgClear(this.ref);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -646,11 +669,13 @@ class BleReceive {
|
||||
});
|
||||
if (!recCnt) {
|
||||
if (receiveData.sta_PowerPercent <= 20) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "设备'" + f.device.deviceName + "'电量低",
|
||||
showCancel: false
|
||||
});
|
||||
|
||||
if (this.ref) {
|
||||
MsgError("设备'" + f.device.deviceName + "'电量低", '', this.ref, () => {
|
||||
MsgClear(this.ref);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@ -674,12 +699,16 @@ class BleReceive {
|
||||
.replace(/\//g, "").toLowerCase();
|
||||
});
|
||||
if (!recCnt) {
|
||||
if (receiveData.sta_battery <= 20) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "设备'" + f.device.deviceName + "'电量低",
|
||||
showCancel: false
|
||||
});
|
||||
if (receiveData.sta_battery <= 20 && (receiveData.sta_system != '1' || receiveData.sta_system !=
|
||||
'3')) {
|
||||
|
||||
if (this.ref) {
|
||||
MsgError("设备'" + f.device.deviceName + "'电量低", '', this.ref, () => {
|
||||
MsgClear(this.ref);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@ -695,19 +724,22 @@ class BleReceive {
|
||||
try {
|
||||
if (!receive.bytes || receive.bytes.length < 3) return receiveData;
|
||||
// 与 HBY100-J 页 bleValueNotify 共用 notify,避免 parseBleData 执行两次:重复日志、FB05 双次 resolve、onNotify 双次
|
||||
const parsed = parseBleData(receive.bytes, { skipSideEffects: true });
|
||||
const parsed = parseBleData(receive.bytes, {
|
||||
skipSideEffects: true
|
||||
});
|
||||
if (!parsed) return receiveData;
|
||||
if (parsed.longitude !== undefined) receiveData.longitude = parsed.longitude;
|
||||
if (parsed.latitude !== undefined) receiveData.latitude = parsed.latitude;
|
||||
if (parsed.batteryPercentage !== undefined) receiveData.batteryPercentage = parsed.batteryPercentage;
|
||||
if (parsed.batteryRemainingTime !== undefined) receiveData.batteryRemainingTime = parsed.batteryRemainingTime;
|
||||
if (parsed.batteryRemainingTime !== undefined) receiveData.batteryRemainingTime = parsed
|
||||
.batteryRemainingTime;
|
||||
} catch (e) {
|
||||
console.log('[100J] BleReceive 解析失败', e);
|
||||
}
|
||||
return receiveData;
|
||||
}
|
||||
|
||||
Receive_6170(receive, f, path, recArr) {
|
||||
Receive_6170(receive, f, path, recArr) {
|
||||
let receiveData = {};
|
||||
|
||||
try {
|
||||
@ -721,21 +753,20 @@ Receive_6170(receive, f, path, recArr) {
|
||||
.replace(/\//g, "").toLowerCase();
|
||||
});
|
||||
if (!recCnt) {
|
||||
if (receiveData.sta_PowerPercent <= 20) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "设备'" + f.device.deviceName + "'电量低",
|
||||
showCancel: false
|
||||
});
|
||||
let deviceState = receiveData.state;
|
||||
if (deviceState && deviceState instanceof Array) {
|
||||
if (deviceState[0] == 12 && deviceState[3] <= 20 && deviceState[4] == 0) {
|
||||
if (this.ref) {
|
||||
MsgError("设备'" + f.device.deviceName + "'电量低", '', this.ref, () => {
|
||||
MsgClear(this.ref);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (error) {
|
||||
receiveData = {};
|
||||
console.error("文本解析失败", error)
|
||||
@ -758,18 +789,21 @@ Receive_6170(receive, f, path, recArr) {
|
||||
.replace(/\//g, "").toLowerCase();
|
||||
});
|
||||
if (!recCnt) {
|
||||
if (receiveData.sta_PowerPercent <= 20) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "设备'" + f.device.deviceName + "'电量低",
|
||||
showCancel: false
|
||||
});
|
||||
|
||||
let msgs = [];
|
||||
|
||||
if (receiveData.sta_PowerPercent <= 20 && receiveData.sta_charge == 0) {
|
||||
msgs.push("设备'" + f.device.deviceName + "'电量低");
|
||||
}
|
||||
if (receiveData.sta_Intrusion === 1) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "闯入报警中",
|
||||
showCancel: false
|
||||
msgs.push("设备'" + f.device.deviceName + "'闯入报警中");
|
||||
}
|
||||
|
||||
|
||||
if (this.ref && msg.length>0) {
|
||||
msgs = msgs.join(",");
|
||||
MsgError(msgs, '', this.ref, () => {
|
||||
MsgClear(this.ref);
|
||||
});
|
||||
}
|
||||
|
||||
@ -787,7 +821,7 @@ Receive_6170(receive, f, path, recArr) {
|
||||
|
||||
if (receiveData.sta_tomac.indexOf(':') == -1) {
|
||||
receiveData.sta_tomac = receiveData.sta_tomac.replace(/(.{2})/g, '$1:').slice(0, -
|
||||
1); //mac地址自动补:
|
||||
1); //mac地址自动补:
|
||||
}
|
||||
uni.getStorageInfo({
|
||||
success: function(res) {
|
||||
@ -814,9 +848,9 @@ Receive_6170(receive, f, path, recArr) {
|
||||
let dev = arr.find(v => {
|
||||
if (v.linkId == f.linkId) {
|
||||
let vl = v.linkEqs.find(cvl => {
|
||||
if(cvl.linkMac === receiveData.sta_tomac){
|
||||
v.read=false;
|
||||
cvl.linkTime=time;
|
||||
if (cvl.linkMac === receiveData.sta_tomac) {
|
||||
v.read = false;
|
||||
cvl.linkTime = time;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -853,7 +887,7 @@ Receive_6170(receive, f, path, recArr) {
|
||||
console.error("某个设备闯入报警");
|
||||
if (receiveData.sta_sosadd.indexOf(':') == -1) {
|
||||
receiveData.sta_sosadd = receiveData.sta_sosadd.replace(/(.{2})/g, '$1:').slice(0, -
|
||||
1); //mac地址自动补:
|
||||
1); //mac地址自动补:
|
||||
}
|
||||
warnArrs.push({
|
||||
linkId: f.linkId,
|
||||
@ -911,35 +945,61 @@ Receive_6170(receive, f, path, recArr) {
|
||||
}
|
||||
|
||||
|
||||
Receive_6075(receive,f,path,recArr){
|
||||
Receive_6075(receive, f, path, recArr) {
|
||||
let receiveData = {};
|
||||
|
||||
|
||||
try {
|
||||
|
||||
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_PowerPercent <= 20) {
|
||||
// uni.showModal({
|
||||
// title: "提示",
|
||||
// content: "设备'" + f.device.deviceName + "'电量低",
|
||||
// showCancel: false
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
if (!recCnt && this.ref) {
|
||||
if (receiveData.sta_PowerPercent <= 20 && (receiveData.sta_system != 3 || receiveData.sta_system !=1)) {
|
||||
|
||||
MsgError("设备'" + f.device.deviceName + "'电量低", '', this.ref, () => {
|
||||
MsgClear(this.ref);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
receiveData = {};
|
||||
console.log("文本解析失败", error)
|
||||
}
|
||||
return receiveData;
|
||||
|
||||
|
||||
}
|
||||
Receive_210(receive, f, path, recArr) {
|
||||
let receiveData = {};
|
||||
|
||||
try {
|
||||
|
||||
receiveData = JSON.parse(receive.str);
|
||||
|
||||
let recCnt = recArr.find(v => {
|
||||
return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
|
||||
.replace(/\//g, "").toLowerCase();
|
||||
});
|
||||
if (!recCnt && this.ref) {
|
||||
if (receiveData.sta_PowerPercent <= 20 && (receiveData.sta_system != 3 || receiveData.sta_system !=1)) {
|
||||
|
||||
MsgError("设备'" + f.device.deviceName + "'电量低", '', this.ref, () => {
|
||||
MsgClear(this.ref);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
receiveData = {};
|
||||
console.log("文本解析失败", error)
|
||||
}
|
||||
return receiveData;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -947,10 +1007,12 @@ Receive_6170(receive, f, path, recArr) {
|
||||
|
||||
let receiveInstance = null;
|
||||
export default {
|
||||
getBleReceive: function(found, receive) {
|
||||
getBleReceive: function(_ref) {
|
||||
console.log("_ref=",_ref);
|
||||
if (!receiveInstance) {
|
||||
receiveInstance = new BleReceive();
|
||||
|
||||
receiveInstance = new BleReceive(_ref);
|
||||
}else{
|
||||
console.log("使用现有实例receiveInstance")
|
||||
}
|
||||
return receiveInstance;
|
||||
}
|
||||
|
||||
@ -2,7 +2,8 @@ var MsgType = {
|
||||
error: "error",
|
||||
succ: "succ",
|
||||
warn: "warn",
|
||||
info:'info'
|
||||
info:'info',
|
||||
prompt:'prompt'
|
||||
}
|
||||
var time = null;
|
||||
// 显示成功
|
||||
@ -74,6 +75,26 @@ export const MsgInfo = (msg, btnTxt, ev, isClear,btnCallback) => {
|
||||
return option;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//显示捕获窗口,用于自定义弹窗内容
|
||||
export const MsgPrompt = ( ev,refName, btnCallback,isClear) => {
|
||||
if (!ev) {
|
||||
|
||||
return null;
|
||||
}
|
||||
if (!ev.$refs[refName]) {
|
||||
|
||||
return null;
|
||||
}
|
||||
let option = ev.$refs[refName].showMsg("", "", MsgType.prompt,btnCallback);
|
||||
if (isClear === undefined || isClear) {
|
||||
createClear(ev);
|
||||
}
|
||||
|
||||
return option;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 隐藏loading
|
||||
|
||||