new-20250827 批量报警、批量发送消息,分供应商处理 #37

Merged
dyf merged 8 commits from liubiao/APP:new-20250827 into main 2026-03-10 17:39:40 +08:00
52 changed files with 6380 additions and 1851 deletions

View File

@ -2,12 +2,12 @@
"version" : "1.0", "version" : "1.0",
"configurations" : [ "configurations" : [
{ {
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-ios" "type" : "uni-app:app-ios"
}, },
{ {
"customPlaygroundType" : "local", "customPlaygroundType" : "local",
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
}, },
{ {
@ -17,6 +17,9 @@
"default" : { "default" : {
"launchtype" : "local" "launchtype" : "local"
}, },
"h5" : {
"launchtype" : "local"
},
"provider" : "aliyun", "provider" : "aliyun",
"type" : "uniCloud" "type" : "uniCloud"
} }

27
App.vue
View File

@ -30,13 +30,11 @@
//以上代码仅在开发时使用,否则会出现不可预知的问题。 //以上代码仅在开发时使用,否则会出现不可预知的问题。
// #ifdef APP|APP-PLUS // #ifdef APP|APP-PLUS
if (plus.runtime.isAgreePrivacy()) {
bleTool.getBleTool(); bleTool.getBleTool();
var appid = plus.runtime.appid;
console.log('应用的 appid 为:' + appid);
uni.getPushClientId({ uni.getPushClientId({
success(res) { success(res) {
console.log("推送信息:", res); console.log("推送信息:", res);
@ -46,12 +44,12 @@
console.error(err) console.error(err)
} }
}); });
if(!uni.setAppBadgeNumber){//兼容鸿蒙的写法 if (!uni.setAppBadgeNumber) { //兼容鸿蒙的写法
uni.setAppBadgeNumber=plus.runtime.setBadgeNumber; uni.setAppBadgeNumber = plus.runtime.setBadgeNumber;
} }
uni.onPushMessage((res) => { uni.onPushMessage((res) => {
console.log("收到推送消息:", res); //监听推送消息 console.log("收到推送消息:", res); //监听推送消息
if(res.type=='click'){ if (res.type == 'click') {
//将App角标设置为0清空app在消息中心的所有消息 //将App角标设置为0清空app在消息中心的所有消息
uni.setAppBadgeNumber(0); uni.setAppBadgeNumber(0);
plus.push.clear(); plus.push.clear();
@ -60,13 +58,13 @@
uni.createPushMessage({ uni.createPushMessage({
title: res.data.title, title: res.data.title,
content: res.data.content, content: res.data.content,
payload:res.data.payload payload: res.data.payload
}); });
}); });
}
// #endif // #endif
}, },
@ -74,18 +72,15 @@
console.log('App Show'); console.log('App Show');
//将检查更新换到onshow,因为苹果用户喜欢一直挂着 //将检查更新换到onshow,因为苹果用户喜欢一直挂着
uni.getSystemInfo({ // #ifdef APP|APP-PLUS
success: function(res) {
if (res.uniPlatform == 'app') {
let appid = plus.runtime.appid; let appid = plus.runtime.appid;
if (appid !== 'HBuilder') {
console.log("appid=", appid); console.log("appid=", appid);
if (appid !== 'HBuilder') {
upgrade.checkAndUpdateWgt(); upgrade.checkAndUpdateWgt();
} }
} // #endif
}
});
}, },
onHide: function() { onHide: function() {
console.log('App Hide'); console.log('App Hide');

View File

@ -2,7 +2,7 @@
"version" : "1", "version" : "1",
"prompt" : "template", "prompt" : "template",
"title" : "服务协议和隐私政策", "title" : "服务协议和隐私政策",
"message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://cnxhyc.com/jquan/2026/02/09/80806c4209c74bd0a223415683ec300d.html\">《服务协议》</a>和<a href=\"https://cnxhyc.com/jquan/2026/02/09/4a4d05227c1242d1a505b98586704c39.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。", "message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://cnxhyc.com/jquan/2026/02/09/80806c4209c74bd0a223415683ec300d.html\">《服务协议》</a>和<a href=\"http://cnxhyc.com/jquan/2026/03/06/d60f8b8cbf5942b8a1b52bb6ea469aa6.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
"buttonAccept" : "同意并接受", "buttonAccept" : "同意并接受",
"buttonRefuse" : "暂不同意", "buttonRefuse" : "暂不同意",
"hrefLoader" : "system", "hrefLoader" : "system",

View File

@ -63,6 +63,10 @@ export function mapReverseGeocoding(data) {
}) })
} }
export function deviceRealTimeStatus(){ export function deviceRealTimeStatus(params){
return Promise.resolve({code:500}); return request({
url: `/app/device/realTimeStatus`,
method: 'get',
data:params
})
} }

View File

@ -23,7 +23,7 @@
paddingRight: config.dividerMargin paddingRight: config.dividerMargin
}" @click="handleItemClick(item, index)"> }" @click="handleItemClick(item, index)">
<view class="p100" :style="{backgroundColor:config.activeIndex==index?config.itemBgColor:'', <view class="p100" :style="{backgroundColor:(config.activeIndex==index || item[config.valueMember]==config.value) ?config.itemBgColor:'',
justifyContent:config.textAlign justifyContent:config.textAlign
}"> }">
<view class="imgContent" v-if="item.icon" :style="{ <view class="imgContent" v-if="item.icon" :style="{
@ -73,6 +73,8 @@
maskBgColor: '', //mask的颜色 maskBgColor: '', //mask的颜色
menuItems: [], //菜单项 包含icon text menuItems: [], //菜单项 包含icon text
activeIndex: -1, //当前已选中的项编号 activeIndex: -1, //当前已选中的项编号
valueMember:'',
value:null,
bgColor: '#2a2a2a', //主体背景 bgColor: '#2a2a2a', //主体背景
itemBgColor: '#3a3a3a', //各项被选中后的背景 itemBgColor: '#3a3a3a', //各项被选中后的背景
textColor: '#ffffffde', //各项的文字颜色 textColor: '#ffffffde', //各项的文字颜色
@ -91,7 +93,16 @@
}, },
created(){
if(this.config.value && this.config.valueMember){
this.config.menuItems.find((v,i)=>{
if(v[this.config.valueMember]==this.config.value){
this.config.activeIndex=i;
return true;
}
});
}
},
methods: { methods: {
closeMenu() { closeMenu() {
@ -108,6 +119,16 @@
let index = null; let index = null;
if (this.config.activeIndex > -1) { if (this.config.activeIndex > -1) {
item = this.config.menuItems[this.config.activeIndex]; item = this.config.menuItems[this.config.activeIndex];
}else{
for (let i = 0; i < this.config.menuItems.length; i++) {
var element = this.config.menuItems[i];
if(element[this.config.valueMember]==this.config.value){
item=element;
index=i;
break;
}
}
} }
index = this.config.activeIndex; index = this.config.activeIndex;
this.$emit('btnClick', item, index); this.$emit('btnClick', item, index);

View File

@ -1,31 +1,19 @@
<template> <template>
<view class="message-popup" v-if="visible"> <view class="message-popup" v-if="visible">
<view class="popup-mask" @click="handleMaskClick"></view> <view class="popup-mask" @click="handleMaskClick"></view>
<view <view class="popup-content" :style="{
class="popup-content"
:style="{
backgroundColor: bgColor || getTypeStyle('bgColor'), backgroundColor: bgColor || getTypeStyle('bgColor'),
borderColor: borderColor || getTypeStyle('borderColor'), borderColor: borderColor || getTypeStyle('borderColor'),
color: textColor || getTypeStyle('textColor') color: textColor || getTypeStyle('textColor')
}" }">
> <view v-if="showHeader&&headerTxt" class="header">{{headerTxt}}</view>
<view v-if="showHeader&&headerTxt" class="header"
>{{headerTxt}}</view> <view v-if="visibleClose" class="rightClose" :style="{color:textColor || getTypeStyle('textColor')}"
@click="closeClick">x</view>
<view v-if="visibleClose" class="rightClose"
:style="{color:textColor || getTypeStyle('textColor')}"
@click="closeClick"
>x</view>
<view v-if="!visiblePrompt"> <view v-if="!visiblePrompt">
<image <image v-if="iconUrl" :src="iconUrl" mode="aspectFit" class="popup-icon"
v-if="iconUrl" :style="{ tintColor: textColor || getTypeStyle('textColor') }"></image>
:src="iconUrl"
mode="aspectFit"
class="popup-icon"
:style="{ tintColor: textColor || getTypeStyle('textColor') }"
></image>
<view class="popup-message" :class="showSlot?'displayNone':''">{{ message }}</view> <view class="popup-message" :class="showSlot?'displayNone':''">{{ message }}</view>
<view class="popup-message" :class="showSlot?'':'displayNone'"> <view class="popup-message" :class="showSlot?'':'displayNone'">
<slot></slot> <slot></slot>
@ -35,33 +23,19 @@
<view v-else class="popup-prompt"> <view v-else class="popup-prompt">
<text class="popup-prompt-title">{{ promptTitle || '请输入信息' }}</text> <text class="popup-prompt-title">{{ promptTitle || '请输入信息' }}</text>
<input <input class="popup-prompt-input" :placeholder="promptPlaceholder" :value="modelValue"
class="popup-prompt-input" @input="handleInput" @confirm="handleButtonClick" />
:placeholder="promptPlaceholder"
:value="modelValue"
@input="handleInput"
@confirm="handleButtonClick"
/>
</view> </view>
<view class="popBtnContent" v-show="showCancel || buttonText"> <view class="popBtnContent" v-show="showCancel || buttonText">
<view <view class="popup-button-cancel" v-if="showCancel" :style="{display:showCancel?'block':'none'}"
class="popup-button-cancel" @click="handleCancelClick">{{ buttonCancelText?buttonCancelText:'取消' }}</view>
v-if="showCancel"
:style="{display:showCancel?'block':'none'}"
@click="handleCancelClick"
>{{ buttonCancelText?buttonCancelText:'取消' }}</view>
<view <view class="popup-button" :class="buttonText?'':'displayNone'" :style="{
class="popup-button"
:class="buttonText?'':'displayNone'"
:style="{
backgroundColor: buttonBgColor || getTypeStyle('buttonBgColor'), backgroundColor: buttonBgColor || getTypeStyle('buttonBgColor'),
color: buttonTextColor || getTypeStyle('buttonTextColor') color: buttonTextColor || getTypeStyle('buttonTextColor')
}" }" @click="handleButtonClick">{{ buttonText }}</view>
@click="handleButtonClick"
>{{ buttonText }}</view>
</view> </view>
@ -73,16 +47,16 @@
</template> </template>
<script> <script>
export default { export default {
name: 'MessagePopup', name: 'MessagePopup',
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false
}, },
visibleClose:{ visibleClose: {
type:Boolean, type: Boolean,
default:true default: true
}, },
visiblePrompt: { visiblePrompt: {
type: Boolean, type: Boolean,
@ -100,7 +74,7 @@ export default {
type: { type: {
type: String, type: String,
default: 'info', default: 'info',
validator: value => ['success', 'error', 'info','custom'].includes(value) validator: value => ['success', 'error', 'info', 'custom'].includes(value)
}, },
bgColor: String, bgColor: String,
borderColor: String, borderColor: String,
@ -116,25 +90,25 @@ export default {
type: String, type: String,
default: '确定' default: '确定'
}, },
buttonCancelText:{ buttonCancelText: {
type:String, type: String,
default:'取消' default: '取消'
}, },
showCancel:{ showCancel: {
type:Boolean, type: Boolean,
default:false default: false
}, },
showHeader:{ showHeader: {
type:Boolean, type: Boolean,
default:false default: false
}, },
headerTxt:{ headerTxt: {
type:String, type: String,
default:"" default: ""
}, },
showSlot:{ showSlot: {
type:Boolean, type: Boolean,
default:false default: false
} }
}, },
data() { data() {
@ -194,11 +168,11 @@ export default {
this.$emit('maskClick') this.$emit('maskClick')
}, },
closeClick(){ closeClick() {
this.$emit('closePop') this.$emit('closePop')
}, },
handleCancelClick(){ handleCancelClick() {
this.$emit('cancelPop'); this.$emit('cancelPop');
}, },
@ -208,14 +182,15 @@ export default {
this.$emit('update:modelValue', this.inputValue) this.$emit('update:modelValue', this.inputValue)
} }
} }
} }
</script> </script>
<style> <style>
.displayNone{ .displayNone {
display: none !important display: none !important
} }
.message-popup {
.message-popup {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
@ -225,18 +200,18 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.popup-mask { .popup-mask {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
} }
.popup-content { .popup-content {
position: relative; position: relative;
width: 80%; width: 80%;
max-width: 400px; max-width: 400px;
@ -248,9 +223,10 @@ export default {
border-style: solid; border-style: solid;
box-sizing: border-box; box-sizing: border-box;
z-index: 10; z-index: 10;
} }
.header{
width:100%; .header {
width: 100%;
color: rgba(255, 255, 255, 0.87); color: rgba(255, 255, 255, 0.87);
font-family: PingFang SC; font-family: PingFang SC;
font-size: 32rpx; font-size: 32rpx;
@ -259,8 +235,9 @@ export default {
line-height: 80rpx; line-height: 80rpx;
letter-spacing: 0.07px; letter-spacing: 0.07px;
text-align: center; text-align: center;
} }
.rightClose{
.rightClose {
position: absolute; position: absolute;
right: 20rpx; right: 20rpx;
top: 20rpx; top: 20rpx;
@ -269,38 +246,39 @@ export default {
width: 24rpx; width: 24rpx;
height: 24rpx; height: 24rpx;
line-height: 24rpx; line-height: 24rpx;
} }
.popup-icon {
.popup-icon {
width: 60rpx; width: 60rpx;
height: 60rpx; height: 60rpx;
margin: 20rpx auto; margin: 20rpx auto;
display: block; display: block;
} }
.popup-message { .popup-message {
font-size: 28rpx; font-size: 28rpx;
text-align: center; text-align: center;
padding: 20rpx 0rpx 30rpx 0rpx; padding: 20rpx 0rpx 30rpx 0rpx;
font-weight: 400; font-weight: 400;
letter-spacing: 0.07px; letter-spacing: 0.07px;
} white-space: pre-wrap;
word-wrap: break-word;
word-break: break-all;
}
.popup-prompt { .popup-prompt {
width: 100%; width: 100%;
} }
.popup-prompt-title { .popup-prompt-title {
display: block; display: block;
font-size: 32rpx; font-size: 32rpx;
text-align: center; text-align: center;
margin-bottom: 20rpx; margin-bottom: 20rpx;
font-weight: 500; font-weight: 500;
} }
.popup-prompt-input { .popup-prompt-input {
width: 100%; width: 100%;
height: 80rpx; height: 80rpx;
line-height: 80rpx; line-height: 80rpx;
@ -310,21 +288,21 @@ export default {
margin-bottom: 30rpx; margin-bottom: 30rpx;
font-size: 28rpx; font-size: 28rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.popBtnContent{ .popBtnContent {
width:100%; width: 100%;
height: 60rpx; height: 60rpx;
margin-top: 20rpx; margin-top: 20rpx;
display: flex display: flex;
;
flex-direction: row; flex-direction: row;
flex-wrap: nowrap; flex-wrap: nowrap;
align-content: center; align-content: center;
justify-content: space-evenly; justify-content: space-evenly;
align-items: center; align-items: center;
} }
.popup-button {
.popup-button {
width: 30%; width: 30%;
height: 60rpx; height: 60rpx;
line-height: 60rpx; line-height: 60rpx;
@ -338,9 +316,9 @@ export default {
outline: none; outline: none;
cursor: pointer; cursor: pointer;
} }
.popup-button-cancel{ .popup-button-cancel {
width: 30%; width: 30%;
height: 60rpx; height: 60rpx;
line-height: 60rpx; line-height: 60rpx;
@ -359,40 +337,37 @@ export default {
background-color: #00000000; background-color: #00000000;
color: #FFFFFFde; color: #FFFFFFde;
} }
.popup-prompt{ .popup-prompt {
width: 100%; width: 100%;
height: 60rpx; height: 60rpx;
line-height: 60rpx; line-height: 60rpx;
padding-top: 40rpx; padding-top: 40rpx;
} }
.popup-prompt-title{ .popup-prompt-title {
color: rgba(255, 255, 255, 0.6); color: rgba(255, 255, 255, 0.6);
text-align: right; text-align: right;
width: 30%; width: 30%;
float: left; float: left;
box-sizing: border-box; box-sizing: border-box;
white-space:nowrap; white-space: nowrap;
padding-right: 10rpx; padding-right: 10rpx;
} }
.popup-prompt-input{
.popup-prompt-input {
float: left; float: left;
width: 70%; width: 70%;
height: 60rpx; height: 60rpx;
line-height: 60rpx; line-height: 60rpx;
color: rgba(255, 255, 255, 0.87) ; color: rgba(255, 255, 255, 0.87);
box-sizing: border-box; box-sizing: border-box;
border: 2rpx solid rgba(255, 255, 255, 0.4); border: 2rpx solid rgba(255, 255, 255, 0.4);
border-radius: 8rpx; border-radius: 8rpx;
} }
</style> </style>

View File

@ -6,50 +6,59 @@
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message" :buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
:buttonText="item.buttonText" @buttonClick="okCallback(item,index)" :visiblePrompt="item.visiblePrompt" :buttonText="item.buttonText" @buttonClick="okCallback(item,index)" :visiblePrompt="item.visiblePrompt"
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)" :promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" @cancelPop="cancelClick(item,index)" /> :buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel"
:showHeader="item.showHeader" :headerTxt="item.headerTxt"
@cancelPop="cancelClick(item,index)" />
</view> </view>
</template> </template>
<script> <script>
import Common from '@/utils/Common.js'
export default { export default {
name: 'MsgBox', name: 'MsgBox',
data() { data() {
return { return {
Msgboxs:[] Msgboxs: []
} }
}, },
methods: { methods: {
//确认按钮事件如果回调函数返回true,将阻止关闭弹窗 //确认按钮事件如果回调函数返回true,将阻止关闭弹窗
okCallback(item,index){ okCallback(item, index) {
let flag=false; let flag = false;
if(item.okCallback){ if (item.okCallback) {
flag=item.okCallback(item,index) flag = item.okCallback(item, index)
} }
if(flag){ if (flag) {
return; return;
} }
this.closePop(item); this.closePop(item);
}, },
//取消按钮,如果回调函数返回true将阻止关闭弹窗 //取消按钮,如果回调函数返回true将阻止关闭弹窗
cancelClick(item,index){ cancelClick(item, index) {
let flag=false; let flag = false;
if(item.cancelCallback){ if (item.cancelCallback) {
flag=item.cancelCallback(item,index) flag = item.cancelCallback(item, index)
} }
if(flag){ if (flag) {
return; return;
} }
this.closePop(item); this.closePop(item);
}, },
closePop: function(item) { closePop: function(item) {
debugger;
if (item) { if (item) {
this.Msgboxs.find((v, i) => { this.Msgboxs.find((v, i) => {
debugger;
if (item.key && v.key) {
if (item.key === v.key) { if (item.key === v.key) {
this.Msgboxs.splice(i, 1); this.Msgboxs.splice(i, 1);
return true;
} }
}
}); });
if (item.cancelCallback) { if (item.cancelCallback) {
@ -64,7 +73,7 @@
}, },
//根据传入的配置,自定义一个弹窗 //根据传入的配置,自定义一个弹窗
showPop: function(option,isClear) { showPop: function(option, isClear) {
let def = { let def = {
key: '', key: '',
showPop: true, //是否显示弹窗 showPop: true, //是否显示弹窗
@ -86,7 +95,12 @@
showSlot: false, showSlot: false,
buttonCancelText: '', buttonCancelText: '',
showCancel: false, showCancel: false,
cancelCallback: null cancelCallback: null,
visible:false,
promptPlaceholder:'',
type:'custom',
showHeader:false,
headerTxt:''
} }
let json = {}; let json = {};
let keys = Object.keys(def); let keys = Object.keys(def);
@ -96,13 +110,9 @@
json[key] = def[key]; json[key] = def[key];
} }
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
json[key] = option[key]; if (option) {
} Object.assign(json, option);
} }
if (!json.borderColor) { if (!json.borderColor) {
@ -110,8 +120,10 @@
json.buttonBgColor = '#BBE600'; json.buttonBgColor = '#BBE600';
} }
json.showPop = true; json.showPop = true;
if (!('key' in json)) {
json.key = new Date().getTime();
if(!json.key){
json.key =Common.guid();
} }
this.Msgboxs.push(json); this.Msgboxs.push(json);
@ -119,7 +131,7 @@
return json; return json;
}, },
//弹出预定好的三种弹窗 //弹出预定好的三种弹窗
showMsg(msg,btnTxt, type,okCallback) { showMsg(msg, btnTxt, type, okCallback) {
let cfg = { let cfg = {
error: { error: {
@ -147,25 +159,25 @@
} }
let guid = new Date().getTime()+""; let guid =Common.guid();
let options = { let options = {
key: guid, key: guid,
message: msg, message: msg,
iconUrl: cfg[type].icoUrl, iconUrl: cfg[type].icoUrl,
borderColor: cfg[type].borderColor, borderColor: cfg[type].borderColor,
buttonBgColor: cfg[type].buttonBgColor, buttonBgColor: cfg[type].buttonBgColor,
buttonText: btnTxt?btnTxt:'确定', buttonText: btnTxt ? btnTxt : '确定',
okCallback: okCallback?okCallback:this.closePop okCallback: okCallback ? okCallback : this.closePop
}; };
return this.showPop(options); return this.showPop(options);
}, },
//清除所有弹窗 //清除所有弹窗
clearPops(){ clearPops() {
this.Msgboxs=[]; this.Msgboxs = [];
}, },
//获取当前所有弹窗的数量 //获取当前所有弹窗的数量
getPops(){ getPops() {
return this.Msgboxs.length; return this.Msgboxs.length;
} }
} }
@ -173,15 +185,15 @@
</script> </script>
<style> <style>
.msgBox{ .msgBox {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 9999; z-index: 99999;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
</style> </style>

View File

@ -0,0 +1,291 @@
<template>
<view>
<canvas type="2d" canvas-id="reusableCanvas" :width="currentCanvasWidth" :height="currentCanvasHeight"
class="offscreen-canvas"></canvas>
</view>
</template>
<script>
export default {
name: "TextToHexV2",
props: {
txts: {
type: Array,
default: () => [],
validator: (value) => value.every(item => typeof item === 'string')
},
fontSize: {
type: Number,
default: 12,
validator: (value) => value > 0 && value <= 100
},
bgColor: {
type: String,
default: "#ffffff"
},
color: {
type: String,
default: "#000000"
},
currentCanvasWidth: {
type: Number,
default: 80
},
currentCanvasHeight: {
type: Number,
default: 12
},
returnType: { //返回值的进制默认16进制
type: Number,
default: 16
}
},
data() {
return {
// Canvas上下文复用
ctx: null,
// 标记是否已经预热过画布
canvasWarmed: false
};
},
computed: {
validTxts() {
return this.txts.filter(line => line.trim() !== '');
}
},
mounted() {
// 初始化Canvas上下文只创建一次
this.ctx = uni.createCanvasContext('reusableCanvas', this);
},
methods: {
/**
* 估算单行文本所需的Canvas宽度
*/
calcLineWidth(textLine) {
return textLine.length * 16;
},
/**
* 清除Canvas内容
*/
clearCanvas() {
this.ctx.setFillStyle(this.bgColor);
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
},
/**
* 预热画布确保画布和字体完全准备好解决APP重新打开后第一次获取数据不完整的问题
*/
async warmupCanvas() {
if (this.canvasWarmed) {
return;
}
try {
// 清空画布
this.clearCanvas();
// 绘制一个测试字符来预热字体和画布
this.ctx.setFillStyle(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, () => {
// 获取一次测试数据确保canvasGetImageData API已准备好
setTimeout(() => {
uni.canvasGetImageData({
canvasId: 'reusableCanvas',
x: 0,
y: 0,
width: 16,
height: 16,
success: () => {
this.canvasWarmed = true;
resolve();
},
fail: () => {
this.canvasWarmed = true;
resolve();
}
});
}, 100);
});
});
// 额外等待确保字体完全加载
await new Promise(resolve => setTimeout(resolve, 200));
} catch (ex) {
console.log("画布预热异常:", ex);
this.canvasWarmed = true; // 即使失败也标记为已预热,避免重复尝试
}
},
/**
* 复用单个Canvas处理所有文本行
*/
async drawAndGetPixels() {
// 第一次调用时先预热画布解决APP重新打开后第一次获取数据不完整的问题
await this.warmupCanvas();
let convertCharToMatrix = (imageData) => {
try {
// console.log("imgData=",imageData.length)
let matrix = [];
let k = 0;
let tmpArr = [];
while (k < imageData.length) {
let r = imageData[k];
let g = imageData[k + 1];
let b = imageData[k + 2];
let a = imageData[k + 3];
// if (r === 255 && a >= 0) {
// r = 255;
// } else {
// r = 0;
// }
// if (r === 255) {
// tmpArr.push(1);
// } else {
// tmpArr.push(0);
// }
// 黑色像素R值较低视为1白色视为0
let isBlack = r < 128;
let byte1 = 0;
if (isBlack) {
byte1 = 1; // 从左到右设置位
}
tmpArr.push(byte1);
if (tmpArr.length == 8) {
tmpArr = parseInt(tmpArr.join(''), 2);
if (this.returnType == 16) {
matrix.push('0x' + tmpArr.toString(16).padStart(2, '0').toUpperCase());
} else if (this.returnType == 10) {
matrix.push(tmpArr);
}
if (this.returnType == 2) {
matrix.push(tmpArr.toString(2).padStart(8, '0'));
}
tmpArr = [];
}
k += 4;
}
// console.log("matrix=",matrix);
return matrix;
} catch (ex) {
console.error("ex=", ex);
}
}
let drawTxt = async (textLine) => {
let result = {};
let ctx = this.ctx;
// 2. 清空Canvas绘制背景
this.clearCanvas();
// 3. 设置文字样式
ctx.setFillStyle(this.color);
ctx.setTextBaseline('middle');
// ctx.setTextAlign('center')
ctx.setFontSize(this.fontSize);
ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
// 4. 绘制当前行文本
let currentX = 0;
let currentY = this.fontSize / 2;
console.log("textLine=", textLine)
ctx.fillText(textLine, currentX, currentY);
// for (let j = 0; j < textLine.length; j++) {
// let char = textLine[j];
// ctx.fillText(char, currentX, currentY);
// // 按实际字符宽度计算间距
// let charWidth = ctx.measureText(char).width;
// currentX += charWidth;
// }
// 5. 异步绘制并获取像素数据(串行处理避免冲突)
await new Promise((resolve, reject) => {
ctx.draw(false, () => {
uni.canvasGetImageData({
canvasId: 'reusableCanvas',
x: 0,
y: 0,
width: this.currentCanvasWidth,
height: this.currentCanvasHeight,
success: res => {
result = {
line: textLine,
pixelData: res.data,
width: this.currentCanvasWidth,
height: this.currentCanvasHeight
};
resolve();
},
fail: err => {
console.error(`处理第${i+1}行失败:`, err);
reject(err)
}
});
});
});
return result;
}
let arr = [];
// 循环处理每行文本
for (let i = 0; i < this.validTxts.length; i++) {
let linePixls = [];
let item = this.validTxts[i];
console.log("item=", item);
let result = await drawTxt(item);
linePixls.push(convertCharToMatrix(result.pixelData));
arr.push(linePixls);
}
return arr;
}
}
};
</script>
<style>
.offscreen-canvas {
position: fixed;
left: -9999px;
top: -9999px;
visibility: hidden;
}
</style>

View File

@ -2,7 +2,7 @@
const config = { const config = {
// 开发环境 // 开发环境
development: { development: {
BASE_URL: 'http://192.168.110.172:8000',//http://139.224.253.23:8000 BASE_URL: 'http://192.168.110.57:8000',//http://139.224.253.23:8000
API_PREFIX: '', API_PREFIX: '',
// MQTT 配置 // MQTT 配置
MQTT_HOST: '47.120.79.150', MQTT_HOST: '47.120.79.150',

View File

@ -2,8 +2,8 @@
"name" : "星汉物联", "name" : "星汉物联",
"appid" : "__UNI__A21EF43", "appid" : "__UNI__A21EF43",
"description" : "设备管控", "description" : "设备管控",
"versionName" : "1.0.18", "versionName" : "1.0.19",
"versionCode" : "100", "versionCode" : 101,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {
@ -44,7 +44,6 @@
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>", "<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
@ -100,8 +99,23 @@
}, },
"push" : { "push" : {
"unipush" : { "unipush" : {
"offline" : true,
"hms" : {},
"oppo" : {},
"vivo" : {},
"mi" : {},
"honor" : {},
"version" : "2", "version" : "2",
"offline" : true "icons" : {
"small" : {
"ldpi" : "unpackage/res/icons/18x18.png",
"mdpi" : "unpackage/res/icons/24x24.png",
"hdpi" : "unpackage/res/icons/36x36.png",
"xhdpi" : "unpackage/res/icons/48x48.png",
"xxhdpi" : "unpackage/res/icons/72x72.png"
}
},
"meizu" : {}
} }
} }
}, },
@ -170,7 +184,8 @@
"fallbackLocale" : "zh-Hans", "fallbackLocale" : "zh-Hans",
"app-harmony" : { "app-harmony" : {
"distribute" : { "distribute" : {
"modules" : {} "modules" : {},
"bundleName" : "uni.app.UNIA21EF43.Hommey"
} }
} }
} }

View File

@ -52,8 +52,7 @@
{ {
"path": "pages/common/send/index", "path": "pages/common/send/index",
"style": { "style": {
"navigationBarTitleText": "发送信息", "navigationBarTitleText": "发送信息"
"enablePullDownRefresh": true
} }
}, },
{ {
@ -102,10 +101,9 @@
} }
}, },
{ {
"path": "pages/6170/callPolice/index", "path": "pages/common/callPolice/index",
"style": { "style": {
"navigationBarTitleText": "报警", "navigationBarTitleText": "报警"
"enablePullDownRefresh": true
} }
}, },
@ -160,14 +158,7 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "pages/6155/ImgCrop",
"style": {
"navigationBarTitleText": "图像裁剪",
"navigationStyle": "custom",
"fullscreen": true
}
},
{ {
"path": "pages/6075/BJQ6075", "path": "pages/6075/BJQ6075",
"style": { "style": {
@ -440,6 +431,21 @@
"style": { "style": {
"navigationBarTitleText": "蓝牙添加设备" "navigationBarTitleText": "蓝牙添加设备"
} }
},
{
"path" : "pages/6075J/BJQ6075J",
"style" :
{
"navigationStyle": "custom"
}
},
{
"path": "pages/common/ImgCrop/ImgCrop",
"style": {
"navigationBarTitleText": "图像裁剪",
"navigationStyle": "custom",
"fullscreen": true
}
} }
], ],

View File

@ -336,7 +336,7 @@
showHeader: true, showHeader: true,
menuItems: [{ menuItems: [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/lightImg/qiang.png'
}], }],
activeIndex: -1, activeIndex: -1,
bgColor: '#2a2a2a', bgColor: '#2a2a2a',
@ -518,6 +518,11 @@
recei = BleReceive.getBleReceive(); recei = BleReceive.getBleReceive();
ble = BleTool.getBleTool(); ble = BleTool.getBleTool();
this.$watch("formData.sta_battery", (newVal, oldVal) => {
if (newVal <= 20 && this.formData.sta_system==2) {
this.showMsg("设备电量低");
}
});
ble.addReceiveCallback(this.bleValueNotify, pagePath); ble.addReceiveCallback(this.bleValueNotify, pagePath);
ble.addStateBreakCallback(this.bleStateBreak, pagePath); ble.addStateBreakCallback(this.bleStateBreak, pagePath);
@ -575,7 +580,7 @@
these.formData.bleStatu = 'connecting'; these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex=>{ }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
}); });
these.setBleFormData(); these.setBleFormData();
@ -592,17 +597,17 @@
this.Status.pageHide = false; this.Status.pageHide = false;
}, },
computed: { computed: {
getbleStatu(){ getbleStatu() {
if(this.formData.bleStatu===true){ if (this.formData.bleStatu === true) {
return '已连接'; return '已连接';
} }
if(this.formData.bleStatu==='connecting'){ if (this.formData.bleStatu === 'connecting') {
return '连接中'; return '连接中';
} }
if(this.formData.bleStatu==='dicconnect'){ if (this.formData.bleStatu === 'dicconnect') {
return '正在断开'; return '正在断开';
} }
if(this.formData.bleStatu==='err'){ if (this.formData.bleStatu === 'err') {
return '连接异常'; return '连接异常';
} }
return '未连接'; return '未连接';
@ -1196,9 +1201,9 @@
return; return;
} }
if (res.deviceId == these.formData.deviceId) { if (res.deviceId == these.formData.deviceId) {
if(res.device){ if (res.device) {
these.formData.bleStatu = 'connecting'; these.formData.bleStatu = 'connecting';
}else{ } else {
this.formData.bleStatu = false; this.formData.bleStatu = false;
} }
setTimeout(() => { setTimeout(() => {
@ -1233,14 +1238,14 @@
showLoading(this, { showLoading(this, {
text: "蓝牙恢复可用,正在连接设备" text: "蓝牙恢复可用,正在连接设备"
}); });
these.formData.bleStatu='connecting'; these.formData.bleStatu = 'connecting';
ble.LinkBlue(these.formData.deviceId).then(() => { ble.LinkBlue(these.formData.deviceId).then(() => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
updateLoading(these, { updateLoading(these, {
text: '连接成功' text: '连接成功'
}); });
}).catch(ex => { }).catch(ex => {
these.formData.bleStatu='err'; these.formData.bleStatu = 'err';
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) })
@ -1313,9 +1318,10 @@
} }
}); });
if (this.formData.sta_battery <= 20) {
this.showMsg("设备电量低");
}
}, },
getDevice: function() { getDevice: function() {
@ -1328,25 +1334,25 @@
return f; return f;
}, },
bleStatuToggle(){ bleStatuToggle() {
let f=this.getDevice(); let f = this.getDevice();
if(!f){ if (!f) {
this.showBleUnConnect(); this.showBleUnConnect();
return; return;
} }
if(this.formData.bleStatu===true){ if (this.formData.bleStatu === true) {
this.formData.bleStatu='dicconnect'; this.formData.bleStatu = 'dicconnect';
ble.disconnectDevice(f.deviceId).finally(r=>{ ble.disconnectDevice(f.deviceId).finally(r => {
this.formData.bleStatu=false; this.formData.bleStatu = false;
}); });
return; return;
} }
if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){ if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
this.formData.bleStatu='connecting'; this.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex=>{ }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
}); });
return; return;

View File

@ -273,7 +273,7 @@
showHeader: true, showHeader: true,
menuItems: [{ menuItems: [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/lightImg/qiang.png'
}], }],
activeIndex: -1, activeIndex: -1,
bgColor: '#2a2a2a', bgColor: '#2a2a2a',

View File

@ -355,15 +355,15 @@
showHeader: true, showHeader: true,
menuItems: [{ menuItems: [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/lightImg/qiang.png'
}, },
{ {
text: '弱光', text: '弱光',
icon: '/static/images/6155/DeviceDetail/ruo.png' icon: '/static/images/lightImg/ruo.png'
}, },
{ {
text: '爆闪', text: '爆闪',
icon: '/static/images/6155/DeviceDetail/shan.png' icon: '/static/images/lightImg/shan.png'
} }
], ],
activeIndex: -1, activeIndex: -1,

View File

@ -279,15 +279,15 @@ import request, { baseURL } from '@/utils/request.js';
showHeader: true, showHeader: true,
menuItems: [{ menuItems: [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/lightImg/qiang.png'
}, },
{ {
text: '弱光', text: '弱光',
icon: '/static/images/6155/DeviceDetail/ruo.png' icon: '/static/images/lightImg/ruo.png'
}, },
{ {
text: '爆闪', text: '爆闪',
icon: '/static/images/6155/DeviceDetail/shan.png' icon: '/static/images/lightImg/shan.png'
} }
], ],
activeIndex: -1, activeIndex: -1,

View File

@ -679,7 +679,7 @@
} }
let that = this; let that = this;
uni.navigateTo({ uni.navigateTo({
url: "/pages/6155/ImgCrop", url: "/pages/ImgCrop/ImgCrop",
events: { events: {
ImgCutOverPath: function(data) { ImgCutOverPath: function(data) {
that.selectedImage = data.picPath; that.selectedImage = data.picPath;

2908
pages/6075J/BJQ6075J.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -312,20 +312,20 @@
dic: { dic: {
menuItems: [{ menuItems: [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png', icon: '/static/images/lightImg/qiang.png',
math: 100, math: 100,
type: 'main' type: 'main'
}, },
{ {
text: '弱光', text: '弱光',
icon: '/static/images/6155/DeviceDetail/ruo.png', icon: '/static/images/lightImg/ruo.png',
math: 50, math: 50,
type: 'main' type: 'main'
}, },
{ {
text: '爆闪', text: '爆闪',
icon: '/static/images/6155/DeviceDetail/shan.png', icon: '/static/images/lightImg/shan.png',
math: 30, math: 30,
type: 'main' type: 'main'
}, },
@ -337,13 +337,13 @@
}, },
{ {
text: '泛光', text: '泛光',
icon: '/static/images/6155/DeviceDetail/fan.png', icon: '/static/images/lightImg/fan.png',
math: 100, math: 100,
type: 'fu' type: 'fu'
}, },
{ {
text: '强+泛光', text: '强+泛光',
icon: '/static/images/6155/DeviceDetail/fan.png', icon: '/static/images/lightImg/fan.png',
math: 70, math: 70,
type: 'fu' type: 'fu'
} }
@ -786,8 +786,11 @@
iconUrl: "/static/images/common/success.png", iconUrl: "/static/images/common/success.png",
}); });
setTimeout(()=>{
ble.sendString(f.deviceId, "transmit complete", f.writeServiceId, f ble.sendString(f.deviceId, "transmit complete", f.writeServiceId, f
.wirteCharactId); .wirteCharactId);
},1000);
these.rgb565Data = null; these.rgb565Data = null;
resolve(); resolve();
return; return;
@ -906,7 +909,7 @@
sourceType: ['album'], sourceType: ['album'],
success: function(res) { success: function(res) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/6155/ImgCrop", url: "/pages/ImgCrop/ImgCrop",
events: { events: {
ImgCutOver: function(data) { ImgCutOver: function(data) {
@ -915,7 +918,7 @@
}); });
console.log("data=", data); console.log("data=", data);
these.Status.BottomMenu.show = false; these.Status.BottomMenu.show = false;
these.rgb565Data = ble.convertToRGB565(data.piexls); these.rgb565Data = Common.convertToRGB565(data.piexls);
setTimeout(function() { setTimeout(function() {
sendImagePackets().catch(() => { sendImagePackets().catch(() => {

View File

@ -1,100 +0,0 @@
<template>
<view>
<canvas id="splashCanvas" canvas-id="splashCanvas" :style="{'width':width+'px','height':height+'px'}" style=" z-index: 9999;position: fixed; visibility: hidden;"></canvas>
<qf-image-cropper :src="src" :showAngle="false" :width="cropWidth" :height="cropHeight" fileType="jpg"
@crop="handleCrop" :areaScale="0.1" :minScale="0.1" :gpu="true">
</qf-image-cropper>
</view>
</template>
<script>
import QfImageCropper from '@/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue';
export default {
components: {
QfImageCropper
},
data() {
return {
src: "",
Statu: false,
width:160,
height:80,
times:10
}
},
computed:{
cropWidth(){
return this.width*this.times;
}
,
cropHeight(){
return this.height*this.times;
}
},
onLoad: function(option) {
const eventChannel = this.getOpenerEventChannel();
var these = this;
eventChannel.on('checkImg', (rec)=> {
console.log("我收到你的消息了,消息内容是:" + JSON.stringify(rec));
this.src = rec.data;
this.width=rec.width?rec.width:160;
this.height=rec.height?rec.height:80;
this.times=rec.times?rec.times:10;
})
},
methods: {
handleCrop(e) {
var these = this;
const eventChannel = these.getOpenerEventChannel();
this.Statu = true;
console.log("裁剪完成");
console.log(e.tempFilePath);
eventChannel.emit('ImgCutOver_Path',e.tempFilePath);
const ctx = uni.createCanvasContext('splashCanvas', this);
ctx.drawImage(
e.tempFilePath,
0,0,these.width,these.height
);
setTimeout(() => {
ctx.draw(false, ()=>{
console.log("abcdefg")
uni.canvasGetImageData({
canvasId: 'splashCanvas',
x: 0,
y: 0,
width: these.width,
height: these.height,
success: (res) => {
// 处理像素数据并发送
console.log("res.data.length="+res.data.length);
eventChannel.emit('ImgCutOverPath', {
picPath: e.tempFilePath
});
eventChannel.emit('ImgCutOver',{piexls:res.data,picPath:e.tempFilePath});
uni.navigateBack();
},
fail: (err) => {
reject(`获取canvas数据失败: ${err.errMsg}`);
}
});
});
}, 500);
}
}
}
</script>
<style>
.canvas {
border: 1px solid #ccc;
}
</style>

View File

@ -250,15 +250,15 @@
showHeader: true, showHeader: true,
menuItems: [{ menuItems: [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/lightImg/qiang.png'
}, },
{ {
text: '弱光', text: '弱光',
icon: '/static/images/6155/DeviceDetail/ruo.png' icon: '/static/images/lightImg/ruo.png'
}, },
{ {
text: '爆闪', text: '爆闪',
icon: '/static/images/6155/DeviceDetail/shan.png' icon: '/static/images/lightImg/shan.png'
} }
], ],
activeIndex: -1, activeIndex: -1,
@ -926,7 +926,7 @@
sourceType: ['album'], sourceType: ['album'],
success: function(res) { success: function(res) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/6155/ImgCrop", url: "/pages/ImgCrop/ImgCrop",
events: { events: {
ImgCutOver: function(data) { ImgCutOver: function(data) {
@ -1378,19 +1378,19 @@
title = '主灯模式'; title = '主灯模式';
items = [{ items = [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/lightImg/qiang.png'
}, },
// { // {
// text: '工作光', // text: '工作光',
// icon: '/static/images/6155/DeviceDetail/fan.png' // icon: '/static/images/lightImg/fan.png'
// }, // },
{ {
text: '弱光', text: '弱光',
icon: '/static/images/6155/DeviceDetail/ruo.png' icon: '/static/images/lightImg/ruo.png'
}, },
{ {
text: '爆闪', text: '爆闪',
icon: '/static/images/6155/DeviceDetail/shan.png' icon: '/static/images/lightImg/shan.png'
}, },
{ {
text: '关闭', text: '关闭',
@ -1402,11 +1402,11 @@
title = '辅灯模式'; title = '辅灯模式';
items = [{ items = [{
text: '泛光', text: '泛光',
icon: '/static/images/6155/DeviceDetail/fan.png' icon: '/static/images/lightImg/fan.png'
}, },
{ {
text: '强+泛光', text: '强+泛光',
icon: '/static/images/6155/DeviceDetail/fan.png' icon: '/static/images/lightImg/fan.png'
}, },
]; ];
break; break;

View File

@ -52,6 +52,12 @@
{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus === 2 ? '故障' : '在线' }} {{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus === 2 ? '故障' : '在线' }}
</text> </text>
</view> </view>
<view class="info-row" v-if="itemInfo.deviceMac">
<text class="info-label">蓝牙状态</text>
<text class="info-value status-running">
{{getbleStatu}}
</text>
</view>
<view class="info-row"> <view class="info-row">
<text class="info-label" style="display: flex; align-items: center;">定位信息</text> <text class="info-label" style="display: flex; align-items: center;">定位信息</text>
<view class="info-value status-running" @click="gpsPosition(deviceInfo)"> <view class="info-value status-running" @click="gpsPosition(deviceInfo)">
@ -123,6 +129,9 @@
<!-- 人员信息登记 --> <!-- 人员信息登记 -->
<view class="form-section" v-if="hasPermission('4')"> <view class="form-section" v-if="hasPermission('4')">
<TextToHexV2 class="TextToHex" ref="textToHex" :txts="formData.textLines" :bgColor="'#FFFFFF'"
:color="'#000000'" :fontSize="12" :returnType="10" />
<view class="mode-buttons"> <view class="mode-buttons">
<view class="section-title">人员信息登记</view> <view class="section-title">人员信息登记</view>
<view class="right-icons"> <view class="right-icons">
@ -266,11 +275,33 @@
popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage" popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage"
icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="false" icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="false"
@confirm="onPopupConfirmPolice" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" /> @confirm="onPopupConfirmPolice" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
<MsgBox ref="msgPop" />
<global-loading ref="loading" />
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import TextToHexV2 from '@/components/TextToHex/TextToHexV2.vue';
import BleTool from '@/utils/BleHelper.js'
import BleReceive from '@/utils/BleReceive';
import {
showLoading,
hideLoading,
updateLoading
} from '@/utils/loading.js';
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop
} from '@/utils/MsgPops.js';
import Common from '@/utils/Common.js';
import MqttClient from '@/utils/mqtt.js'; import MqttClient from '@/utils/mqtt.js';
import { import {
generateShortId, generateShortId,
@ -285,16 +316,27 @@
laserModeSettings, //激光模式设置 laserModeSettings, //激光模式设置
lightBrightnessSettings, //灯光亮度设置 lightBrightnessSettings, //灯光亮度设置
deviceRealTimeStatus //设备状态 deviceRealTimeStatus //设备状态
} from '@/api/6170/deviceControl.js' } from '@/api/6170/deviceControl.js';
import { import {
baseURL, baseURL,
getToken, getToken,
clientid clientid
} from '@/utils/request' } from '@/utils/request';
import { import {
deviceSendAlarmMessage deviceSendAlarmMessage
} from '@/api/6170/callPolice.js' } from '@/api/6170/callPolice.js';
var these = null;
var ble = null;
var rec = null;
var pagePath = "pages/6170/BJQ6170";
export default { export default {
components: {
TextToHexV2
},
data() { data() {
return { return {
isCardSliding: false, isCardSliding: false,
@ -312,7 +354,25 @@
pendingMainMode: null, // 选中的索引 pendingMainMode: null, // 选中的索引
isFormExpanded: true, // 默认展开 isFormExpanded: true, // 默认展开
deviceID: '', deviceID: '',
itemInfo: {}, itemInfo: {
id: "",
deviceName: "",
deviceImei: "",
deviceMac: "",
communicationMode: 0,
devicePic: "",
typeName: "",
bluetoothName: null,
deviceStatus: null,
bindingTime: "",
onlineStatus: 0,
battery: "0",
latitude: null,
longitude: null,
alarmStatus: null,
detailPageUrl: "",
showConfirm: false
},
mqttClient: null, mqttClient: null,
messageToSend: '', messageToSend: '',
personnelInfo: { personnelInfo: {
@ -330,12 +390,21 @@
popupConfirmText: '确认', popupConfirmText: '确认',
showUploadPopup: false, showUploadPopup: false,
selectedImage: null, // 添加这个变量来存储选择的图片 selectedImage: null, // 添加这个变量来存储选择的图片
rgb565Data: null,
selectedItemIndex: 0, selectedItemIndex: 0,
popupType: 'person', //弹框类型 popupType: 'person', //弹框类型
isLaserOn: false, isLaserOn: false,
isSending: false, isSending: false,
isProcessing: false, isProcessing: false,
isPolling: false // 轮询状态 isPolling: false, // 轮询状态
formData: {
deviceId: '',
bleStatu: '',
textLines: []
},
Status: {
pageHide: null
}
} }
}, },
computed: { computed: {
@ -344,9 +413,170 @@
}, },
popupTitle() { popupTitle() {
return this.modeType === 'main' ? '灯光模式' : '激光模式'; return this.modeType === 'main' ? '灯光模式' : '激光模式';
},
getbleStatu() {
if (this.formData.bleStatu === true) {
return '已连接';
}
if (this.formData.bleStatu === 'connecting') {
return '连接中';
}
if (this.formData.bleStatu === 'dicconnect') {
return '正在断开';
}
if (this.formData.bleStatu === 'err') {
return '连接异常';
}
return '未连接';
} }
}, },
methods: { methods: {
getDevice: function() {
console.log("LinkedList=", ble.data.LinkedList);
console.log("this.device=", this.device);
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == this.itemInfo.deviceMac) {
if (!this.formData.deviceId) {
this.formData.deviceId = v.deviceId
};
return true;
}
});
return f;
},
initBle() {
if (this.itemInfo.deviceMac) {
let f = this.getDevice();
ble.addReceiveCallback(these.bleValueNotify, pagePath);
ble.addStateBreakCallback(these.bleStateBreak, pagePath);
ble.addStateRecoveryCallback(these.bleStateRecovry, pagePath);
ble.addDisposeCallback(these.deviceDispose, pagePath);
ble.addRecoveryCallback(these.deviceRecovry, pagePath);
if (!f) {
this.showBleUnConnect();
}
}
},
showBleUnConnect() {
showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
showCancel: true,
okCallback: function() {
console.log("1111");
uni.navigateTo({
url: "/pages/common/addBLE/addEquip",
events: {
BindOver: function(data) {
console.log(data)
these.formData.bleStatu = true;
}
},
success: function(res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('detailData', {
data: these.itemInfo
})
}
})
}
}, these);
},
bleValueNotify: function(receive, device, path, recArr) { //订阅消息
if (receive.deviceId !== this.formData.deviceId) {
return;
}
let data = recei.ReceiveData(receive, device, pagePath, recArr);
console.log("蓝牙收到消息", data)
this.receivData(data);
},
bleStateBreak() {
if (this.Status.pageHide) {
return;
}
//蓝牙适配器不可用
this.formData.bleStatu = false;
uni.showToast({
icon: 'fail',
title: '蓝牙已不可用'
})
hideLoading(this);
},
bleStateRecovry() {
console.log("蓝牙可用");
if (this.Status.pageHide) {
return;
}
console.log("蓝牙可用");
//蓝牙适配器再次可用,尝试恢复连接
showLoading(this, {
text: "蓝牙恢复可用,正在连接设备"
});
this.formData.bleStatu = 'connecting';
ble.LinkBlue(these.formData.deviceId).then(() => {
these.formData.bleStatu = true;
updateLoading(these, {
text: '连接成功'
});
}).catch(ex => {
updateLoading(these, {
text: ex.msg
})
}).finally(() => {
setTimeout(() => {
hideLoading(these);
}, 1000);
});
},
deviceDispose(res) {
if (this.Status.pageHide) {
return;
}
if (res.deviceId == these.formData.deviceId) {
if (res.device) {
these.formData.bleStatu = 'connecting';
} else {
this.formData.bleStatu = false;
}
setTimeout(() => {
hideLoading(these, 1000);
});
uni.showToast({
icon: 'fail',
title: '蓝牙连接已断开'
});
}
},
deviceRecovry(res) {
if (this.Status.pageHide) {
return;
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
setTimeout(() => {
hideLoading(these, 1000);
});
uni.showToast({
icon: 'success',
title: '蓝牙连接成功'
});
}
},
// 点击弹框外的区域关闭 // 点击弹框外的区域关闭
closePopup() { closePopup() {
this.lightModeA = false; this.lightModeA = false;
@ -430,6 +660,9 @@
// 使用节流防止指令发送过于频繁 // 使用节流防止指令发送过于频繁
if (now - this.lastBrightnessTime > 200) { // 200毫秒节流 if (now - this.lastBrightnessTime > 200) { // 200毫秒节流
this.lastBrightnessTime = now; this.lastBrightnessTime = now;
let mqSend = () => {
// 增加轻微的震动反馈,提升手感 // 增加轻微的震动反馈,提升手感
uni.vibrateShort({ uni.vibrateShort({
type: 'light' type: 'light'
@ -446,8 +679,38 @@
} }
}) })
} }
if (ble && this.itemInfo.deviceMac) {
let f = this.getDevice();
if (f) {
let json = {
instruct: [5, 0, 0, 0, 0]
};
json.instruct[1] = parseInt(this.sliderValue);
ble.sendString(f.deviceId, json).then(res => {
}).catch(ex => {
mqSend();
});
} else {
mqSend();
}
return;
} else {
mqSend();
}
}
}, },
onSliderChangeEnd(e) { onSliderChangeEnd(e) {
let value = e.detail.value;
if (value < 10) {
value = 10;
}
this.sliderValue = value;
let mqSend = () => {
if (this.deviceInfo.onlineStatus !== 1) { if (this.deviceInfo.onlineStatus !== 1) {
uni.showToast({ uni.showToast({
title: '设备已离线', title: '设备已离线',
@ -455,11 +718,7 @@
}); });
return; return;
} }
let value = e.detail.value;
if (value < 10) {
value = 10;
}
this.sliderValue = value;
let data = { let data = {
deviceId: this.computedDeviceId, deviceId: this.computedDeviceId,
instructValue: this.sliderValue + '.00', instructValue: this.sliderValue + '.00',
@ -475,6 +734,30 @@
}) })
} }
}) })
}
if (ble && this.itemInfo.deviceMac) {
let f = this.getDevice();
if (f) {
let json = {
instruct: [5, 0, 0, 0, 0]
};
json.instruct[1] = parseInt(this.sliderValue);
ble.sendString(f.deviceId, json).then(res => {
}).catch(ex => {
mqSend();
});
} else {
mqSend();
}
return;
} else {
mqSend();
}
}, },
selectMode(type) { selectMode(type) {
this.modeType = type; this.modeType = type;
@ -537,6 +820,11 @@
// 灯光模式的确认 // 灯光模式的确认
handleSumbit() { handleSumbit() {
if (this.selectedItemIndex === null) return;
const selectedItem = this.items[this.selectedItemIndex];
let mqSend = () => {
if (this.deviceInfo.onlineStatus !== 1) { if (this.deviceInfo.onlineStatus !== 1) {
uni.showToast({ uni.showToast({
title: '设备已离线', title: '设备已离线',
@ -544,8 +832,7 @@
}); });
return; return;
} }
if (this.selectedItemIndex === null) return;
const selectedItem = this.items[this.selectedItemIndex];
let data = { let data = {
deviceId: this.computedDeviceId, deviceId: this.computedDeviceId,
instructValue: selectedItem.instructValue, instructValue: selectedItem.instructValue,
@ -569,14 +856,44 @@
}) })
uni.hideLoading(); uni.hideLoading();
} }
}) });
}
if (ble && this.itemInfo.deviceMac) {
let f = this.getDevice();
if (f) {
let json = {
instruct: [1, 0, 0, 0, 0]
};
json.instruct[1] = parseInt(selectedItem.instructValue);
ble.sendString(f.deviceId, json).then(res => {
}).catch(ex => {
mqSend();
});
} else {
mqSend();
}
return;
} else {
mqSend();
}
}, },
// 激光模式 // 激光模式
lasermode() { lasermode() {
this.lightModeC = true this.lightModeC = true
}, },
// 激光确认框提交 // 激光确认框提交
handleBtn() { handleBtn() {
const instructValue = this.isLaserOn ? 0 : 1;
let mqSend = () => {
if (this.deviceInfo.onlineStatus !== 1) { if (this.deviceInfo.onlineStatus !== 1) {
uni.showToast({ uni.showToast({
title: '设备已离线', title: '设备已离线',
@ -584,7 +901,7 @@
}); });
return; return;
} }
const instructValue = this.isLaserOn ? 0 : 1;
let data = { let data = {
deviceId: this.computedDeviceId, deviceId: this.computedDeviceId,
instructValue: instructValue, instructValue: instructValue,
@ -607,7 +924,33 @@
icon: 'none' icon: 'none'
}); });
} }
}).finally(() => {
this.lightModeC = false;
}) })
}
if (ble && this.itemInfo.deviceMac) {
let f = this.getDevice();
if (f) {
let json = {
instruct: [4, 0, 0, 0, 0]
};
json.instruct[1] = parseInt(instructValue);
ble.sendString(f.deviceId, json).then(res => {
this.lightModeC = false;
this.isLaserOn = !this.isLaserOn;
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
}).catch(ex => {
mqSend();
});
} else {
mqSend();
}
return;
} else {
mqSend();
}
}, },
//激光取消 //激光取消
handleDisagree() { handleDisagree() {
@ -636,10 +979,11 @@
} }
let that = this; let that = this;
uni.navigateTo({ uni.navigateTo({
url: "/pages/6155/ImgCrop", url: "/pages/ImgCrop/ImgCrop",
events: { events: {
ImgCutOverPath :function (data) { ImgCutOver: function(data) {
that.selectedImage = data.picPath; that.selectedImage = data.picPath;
these.rgb565Data = Common.convertToRGB565(data.piexls);
} }
}, },
success(ev) { success(ev) {
@ -653,7 +997,7 @@
}, },
// 上传开机画面确认按键 // 上传开机画面确认按键
handleupload() { handleupload() {
let loadingShown = false;
if (!this.selectedImage) { if (!this.selectedImage) {
uni.showToast({ uni.showToast({
title: '请上传一张图片', title: '请上传一张图片',
@ -661,6 +1005,8 @@
}); });
return; return;
} }
let mqSend = () => {
if (this.deviceInfo.onlineStatus !== 1) { if (this.deviceInfo.onlineStatus !== 1) {
uni.showToast({ uni.showToast({
title: '设备已离线', title: '设备已离线',
@ -668,6 +1014,8 @@
}); });
return; return;
} }
let loadingShown = false;
// 显示上传加载状态 // 显示上传加载状态
uni.showLoading({ uni.showLoading({
title: '图片上传中...', title: '图片上传中...',
@ -747,6 +1095,174 @@
} }
} }
}); });
}
let bleSend = () => {
let f = this.getDevice();
if (!f) {
this.showBleUnConnect();
return;
}
var sendImagePackets = (ReSendNo) => {
return new Promise((resolve, reject) => {
// 总数据包数
let totalPackets = 52;
let currentPacket = 1;
if (ReSendNo) {
totalPackets = ReSendNo;
currentPacket = ReSendNo;
}
if (f) {
// 发送单个数据包
const sendNextPacket = () => {
if (currentPacket > totalPackets) {
hideLoading(these);
showPop({
showPop: true,
message: "上传成功",
iconUrl: "/static/images/common/success.png",
}, these);
setTimeout(() => {
ble.sendString(f.deviceId, "transmit complete", f
.writeServiceId, f
.wirteCharactId);
}, 1000);
these.rgb565Data = null;
resolve();
return;
}
// 计算当前包的数据
let packetSize = 250;
// if (currentPacket <= 51) {
// packetSize = 250; // 前51个包每个500字节
// } else {
// packetSize = 50; // 最后一个包100字节
// }
// 创建数据包
const startIndex = (currentPacket - 1) * packetSize;
const endIndex = Math.min(startIndex + packetSize, these.rgb565Data
.length);
if (startIndex > endIndex) {
return;
}
const packetData = these.rgb565Data.slice(startIndex,
endIndex);
// 构建数据包
const bufferSize =
505; // 5 + packetData.length * 2; // 头部5字节 + 数据部分
const buffer = new ArrayBuffer(bufferSize);
const dataView = new DataView(buffer);
// 填充头部
dataView.setUint8(0, 0x55); // 帧头
dataView.setUint8(1, 0x02); // 帧类型:开机画面
dataView.setUint8(2, currentPacket); // 包序号
if (packetData.length == 250) {
dataView.setUint8(3, 0x01);
dataView.setUint8(4, 0xF4);
} else {
dataView.setUint8(3, 0x00);
dataView.setUint8(4, 0x64);
}
// 填充数据每个RGB565值占2字节
for (let i = 0; i < packetData.length; i++) {
dataView.setUint16(5 + i * 2, packetData[i], false); // 大端字节序
}
if (currentPacket > 51) { //第52包补FF
for (var i = 105; i < bufferSize; i++) {
dataView.setUint8(i, 0xFF);
}
}
//发送数据包
ble.sendData(f.deviceId, buffer, f.writeServiceId, f
.wirteCharactId,
10)
.then(() => {
updateLoading(these, {
text: "正在发送:" + currentPacket + "/" +
totalPackets
})
currentPacket++;
setTimeout(sendNextPacket, these.inteval);
}).catch(err => {
console.log("发送数据包失败了" + JSON.stringify(err));
if (err.code == '10007') {
setTimeout(sendNextPacket, these.inteval);
return;
}
showPop({
message: err.msg,
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
}, these);
hideLoading(these);
these.rgb565Data = null;
reject(err);
});
}
if (ReSendNo) {
sendNextPacket(ReSendNo);
return;
}
// 开始牵手
ble.sendString(f.deviceId, "picture transmit start", f.writeServiceId,
f.wirteCharactId).then(() => {
setTimeout(sendNextPacket, 120);
}).catch((err) => {
console.log("握手没有成功");
showPop({
message: err.msg,
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
}, these);
hideLoading(these);
reject(err);
});
}
});
}
setTimeout(function() {
sendImagePackets().catch(() => {
});
}, 0)
}
if (ble && this.itemInfo.deviceMac) {
let f = this.getDevice();
if (f) {
bleSend();
} else {
mqSend();
}
} else {
mqSend();
}
}, },
// 分享 // 分享
shareUp() { shareUp() {
@ -763,7 +1279,8 @@
}) })
}, },
// 发送人员信息 // 发送人员信息
async sendPersonnelInfo() { sendPersonnelInfo() {
let mqSend = async () => {
if (this.isSending) return; if (this.isSending) return;
const requiredFields = [{ const requiredFields = [{
field: 'unitName', field: 'unitName',
@ -839,6 +1356,160 @@
uni.hideLoading(); uni.hideLoading();
this.isSending = false; this.isSending = false;
} }
}
let bleSend = () => {
let f = this.getDevice();
if (!f) {
this.showBleUnConnect();
return;
}
this.formData.textLines = [this.personnelInfo.unitName, this.personnelInfo.name, this.personnelInfo
.position, this.personnelInfo.code
];
console.log("data=", this.formData.textLines);
showLoading(these, {
text: '发送中'
})
//握手
let holdHand = (hexs, time) => {
return new Promise((resolve, reject) => {
ble.sendString(f.deviceId, hexs).then(res => {
setTimeout(() => {
resolve(res)
}, time);
}).catch(ex => {
reject(ex)
});
});
}
//画图
let drawText = () => {
return new Promise((resolve, reject) => {
this.$refs.textToHex.drawAndGetPixels().then(allPixels => {
if (!allPixels) {
reject("文本初始化失败");
return;
}
console.log("画图成功", JSON.stringify(allPixels));
resolve(allPixels);
}).catch(compEx => {
console.error("失败了", compEx);
reject(compEx);
});
});
}
//发送3个分包的数据
let task = (allPixels) => {
try {
let combinedData = [];
for (let i = 0; i < 4; i++) {
let linePixels = (allPixels[i] || []).flat(Infinity).map(item =>
typeof item === 'string' ? parseInt(item) : item
);
combinedData.push(linePixels);
}
let curr = 1;
let len = combinedData.length;
//分包发送
let sendPacket = () => {
if (combinedData.length === curr - 1) {
holdHand('transmit complete', 200).then(res => {
MsgSuccess("人员信息发送成功", "确定", these);
hideLoading(these);
this.setBleFormData();
});
hideLoading();
return;
}
let array = {
instruct: [2, curr].concat(combinedData[curr - 1])
};
console.log("array=", array);
ble.sendString(f.deviceId, array, null, null, 15).then(
res => {
curr++;
console.log("发送成功", curr);
updateLoading(these, {
text: '发送中,' + (curr - 1) + '/' + 4
})
setTimeout(sendPacket, 250);
}).catch(err => {
console.err("发送失败", err);
if (err.code == '10007') {
setTimeout(sendPacket, 250);
} else {
console.log("err:", err);
MsgError('发送失败' + (err.msg || err.code), '确定', these);
hideLoading();
}
});
}
setTimeout(sendPacket, 0);
// 5. 发送成功处理
} catch (ex) {
MsgError('发送失败' + (ex.msg || ex.code), '确定', these);
}
}
setTimeout(() => {
Promise.allSettled([holdHand('word transmit start', 2200), drawText()]).then(
results => {
if (results[0].status == 'rejected') {
setTimeout(() => {
hideLoading(these)
}, 500);
return;
}
if (results[1].status == 'rejected') {
return;
}
task(results[1].value);
})
}, 0);
}
if (ble && this.itemInfo.deviceMac) {
let f = this.getDevice();
if (f) {
bleSend();
} else {
mqSend();
}
return;
} else {
mqSend();
}
}, },
// 所有弹框,确定关闭按钮 // 所有弹框,确定关闭按钮
onPopupConfirm() { onPopupConfirm() {
@ -1124,6 +1795,9 @@
}, },
onLoad(options) { onLoad(options) {
these = this;
const eventChannel = this.getOpenerEventChannel(); const eventChannel = this.getOpenerEventChannel();
// 监听 'detailData' 事件,获取传过来的数据 // 监听 'detailData' 事件,获取传过来的数据
uni.showLoading({ uni.showLoading({
@ -1132,11 +1806,16 @@
eventChannel.on('detailData', (data) => { eventChannel.on('detailData', (data) => {
console.log(data, 'data'); console.log(data, 'data');
this.itemInfo = data.data; this.itemInfo = data.data;
this.deviceID = data.data.id; this.deviceID = data.data.id;
this.navTitle = data.data.deviceName; this.navTitle = data.data.deviceName;
this.apiType = data.apiType this.apiType = data.apiType
// 根据 apiType 设置右图标的显示状态 // 根据 apiType 设置右图标的显示状态
this.isRightIconVisible = this.apiType === 'listA'; this.isRightIconVisible = this.apiType === 'listA';
this.initBle();
// 初始化并连接MQTT // 初始化并连接MQTT
this.mqttClient = new MqttClient(); this.mqttClient = new MqttClient();
this.mqttClient.connect(() => { this.mqttClient.connect(() => {
@ -1212,6 +1891,31 @@
this.fetchSharedDeviceDetail(data.data.id) this.fetchSharedDeviceDetail(data.data.id)
} }
if (this.itemInfo.deviceMac) {
rec = BleReceive.getBleReceive();
ble = BleTool.getBleTool();
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == this.itemInfo.deviceMac) {
console.log("找到设备了", v);
these.formData.deviceId = v.deviceId;
return true;
}
return false;
});
if (f) {
these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(
res => {
these.formData.bleStatu = true;
});
}
}
}); });
eventChannel.emit('ack', { eventChannel.emit('ack', {
@ -1768,4 +2472,11 @@
margin-top: 60rpx; margin-top: 60rpx;
position: relative; position: relative;
} }
.TextToHex {
position: fixed;
top: -99999rpx;
left: -99999rpx;
visibility: hidden;
}
</style> </style>

View File

@ -71,7 +71,7 @@
<view class="item" @click="lightSetting('jieN')" :class="formData.lightCurr=='jieN'?'active':''"> <view class="item" @click="lightSetting('jieN')" :class="formData.lightCurr=='jieN'?'active':''">
<view class="imgContent center"> <view class="imgContent center">
<image class="img" <image class="img"
:src="formData.lightCurr=='jieN'?'/static/images/6331/jieNActive.png':'/static/images/6331/jieN.png'" :src="formData.lightCurr=='jieN'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
mode="aspectFit"></image> mode="aspectFit"></image>
</view> </view>
<view class="txt">节能光</view> <view class="txt">节能光</view>
@ -275,15 +275,15 @@ import request, { baseURL } from '@/utils/request.js';
showHeader: true, showHeader: true,
menuItems: [{ menuItems: [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/lightImg/qiang.png'
}, },
{ {
text: '弱光', text: '弱光',
icon: '/static/images/6155/DeviceDetail/ruo.png' icon: '/static/images/lightImg/ruo.png'
}, },
{ {
text: '爆闪', text: '爆闪',
icon: '/static/images/6155/DeviceDetail/shan.png' icon: '/static/images/lightImg/shan.png'
} }
], ],
activeIndex: -1, activeIndex: -1,

View File

@ -257,15 +257,15 @@ import request, { baseURL } from '@/utils/request.js';
showHeader: true, showHeader: true,
menuItems: [{ menuItems: [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/lightImg/qiang.png'
}, },
{ {
text: '弱光', text: '弱光',
icon: '/static/images/6155/DeviceDetail/ruo.png' icon: '/static/images/lightImg/ruo.png'
}, },
{ {
text: '爆闪', text: '爆闪',
icon: '/static/images/6155/DeviceDetail/shan.png' icon: '/static/images/lightImg/shan.png'
} }
], ],
activeIndex: -1, activeIndex: -1,
@ -1051,7 +1051,7 @@ import request, { baseURL } from '@/utils/request.js';
var gotoCutImg = (imgPath) => { var gotoCutImg = (imgPath) => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/6155/ImgCrop", url: "/pages/ImgCrop/ImgCrop",
events: { events: {
ImgCutOver: function(data) { ImgCutOver: function(data) {
// console.log("我收到裁剪后的图片了,感谢老铁," + data) // console.log("我收到裁剪后的图片了,感谢老铁," + data)

View File

@ -177,7 +177,7 @@
<view class="item" @click="lightSetting('close')" :class="formData.lightCurr=='close'?'active':''"> <view class="item" @click="lightSetting('close')" :class="formData.lightCurr=='close'?'active':''">
<view class="imgContent center"> <view class="imgContent center">
<image class="img" <image class="img"
:src="formData.lightCurr=='close'?'/static/images/670/jieNActive.png':'/static/images/670/jieN.png'" :src="formData.lightCurr=='close'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
mode="aspectFit"></image> mode="aspectFit"></image>
</view> </view>
<view class="txt">关闭</view> <view class="txt">关闭</view>
@ -363,15 +363,15 @@
showHeader: true, showHeader: true,
menuItems: [{ menuItems: [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/lightImg/qiang.png'
}, },
{ {
text: '弱光', text: '弱光',
icon: '/static/images/6155/DeviceDetail/ruo.png' icon: '/static/images/lightImg/ruo.png'
}, },
{ {
text: '爆闪', text: '爆闪',
icon: '/static/images/6155/DeviceDetail/shan.png' icon: '/static/images/lightImg/shan.png'
} }
], ],
activeIndex: -1, activeIndex: -1,
@ -486,10 +486,14 @@
}, },
onLoad: function() { onLoad: function() {
these = this; these = this;
recei = BleReceive.getBleReceive(); recei = BleReceive.getBleReceive();
ble = BleTool.getBleTool(); ble = BleTool.getBleTool();
this.$watch("formData.battary", (newVal, oldVal) => {
if (newVal <= 20 && this.formData.sta_system==2) {
this.showMsg("设备电量低");
}
});
ble.addReceiveCallback(these.bleValueNotify, pagePath); ble.addReceiveCallback(these.bleValueNotify, pagePath);
@ -928,30 +932,16 @@
// console.log("收到文本回复", payload); // console.log("收到文本回复", payload);
// // this.SendTxtMQ(json); // // this.SendTxtMQ(json);
// } // }
if (keys.indexOf('sta_BreakNews') > - if (keys.indexOf('sta_BreakNews') > -1) { //紧急通知
1) { //紧急通知 if(json.sta_BreakNews=='I get it'){
if (json.sta_BreakNews ===
'I get it'
) // && this.Status.msgOkTime && this.Status.msgOkIntval){
{
these.showPop({ these.showPop({
showPop: true, showPop: true,
message: "用户已确认收到紧急通知", message: "用户已确认收到紧急通知",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png" iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
}); });
// this.Status.msgOkTime=null
// clearInterval(this.Status.msgOkIntval);
} }
} }
// else {
// console.log("收到不能处理的数据", payload);
// }
} catch (error) { } catch (error) {
console.error("无法解析此消息", payload); console.error("无法解析此消息", payload);
} }
@ -1881,7 +1871,7 @@
var gotoCutImg = (imgPath) => { var gotoCutImg = (imgPath) => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/6155/ImgCrop", url: "/pages/ImgCrop/ImgCrop",
events: { events: {
ImgCutOver: function(data) { ImgCutOver: function(data) {
// console.log("我收到裁剪后的图片了,感谢老铁," + data) // console.log("我收到裁剪后的图片了,感谢老铁," + data)

View File

@ -230,20 +230,20 @@
showHeader: true, showHeader: true,
menuItems: [{ menuItems: [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/lightImg/qiang.png'
}, },
{ {
text: '弱光', text: '弱光',
icon: '/static/images/6155/DeviceDetail/ruo.png' icon: '/static/images/lightImg/ruo.png'
}, },
{ {
text: '爆闪', text: '爆闪',
icon: '/static/images/6155/DeviceDetail/shan.png' icon: '/static/images/lightImg/shan.png'
} }
], ],
activeIndex: -1, activeIndex: -1,
bgColor: '#2a2a2a', bgColor: '#2a2a2a',
itemBgColor: '#3a3a3a', itemBgColor: '#00000000',
textColor: '#ffffffde', textColor: '#ffffffde',
textAlign: 'flex-start', textAlign: 'flex-start',
title: '主灯模式', title: '主灯模式',
@ -783,7 +783,7 @@
sourceType: ['album'], sourceType: ['album'],
success: function(res) { success: function(res) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/6155/ImgCrop", url: "/pages/ImgCrop/ImgCrop",
events: { events: {
ImgCutOver: function(data) { ImgCutOver: function(data) {
//将8位的二进制数组转换成16进制数据 //将8位的二进制数组转换成16进制数据
@ -957,19 +957,19 @@
title = '主灯模式'; title = '主灯模式';
items = [{ items = [{
text: '强光', text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png' icon: '/static/images/lightImg/qiang.png'
}, },
// { // {
// text: '工作光', // text: '工作光',
// icon: '/static/images/6155/DeviceDetail/fan.png' // icon: '/static/images/lightImg/fan.png'
// }, // },
{ {
text: '弱光', text: '弱光',
icon: '/static/images/6155/DeviceDetail/ruo.png' icon: '/static/images/lightImg/ruo.png'
}, },
{ {
text: '爆闪', text: '爆闪',
icon: '/static/images/6155/DeviceDetail/shan.png' icon: '/static/images/lightImg/shan.png'
}, },
{ {
text: '关闭', text: '关闭',
@ -981,7 +981,7 @@
title = '辅灯模式'; title = '辅灯模式';
items = [{ items = [{
text: '泛光', text: '泛光',
icon: '/static/images/6155/DeviceDetail/fan.png' icon: '/static/images/lightImg/fan.png'
}]; }];
break; break;
} }
@ -1089,14 +1089,7 @@
}, },
handleItemClick(item, index) { handleItemClick(item, index) {
switch (this.Status.BottomMenu.type) {
case "main":
break;
case "fu":
break;
}
this.Status.BottomMenu.activeIndex = index; this.Status.BottomMenu.activeIndex = index;
}, },

View File

@ -0,0 +1,100 @@
<template>
<view>
<canvas id="splashCanvas" canvas-id="splashCanvas" :style="{'width':width+'px','height':height+'px'}" style=" z-index: 9999;position: fixed; visibility: hidden;"></canvas>
<qf-image-cropper :src="src" :showAngle="false" :width="cropWidth" :height="cropHeight" fileType="jpg"
@crop="handleCrop" :areaScale="0.1" :minScale="0.1" :gpu="true">
</qf-image-cropper>
</view>
</template>
<script>
import QfImageCropper from '@/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue';
export default {
components: {
QfImageCropper
},
data() {
return {
src: "",
Statu: false,
width:160,
height:80,
times:10
}
},
computed:{
cropWidth(){
return this.width*this.times;
}
,
cropHeight(){
return this.height*this.times;
}
},
onLoad: function(option) {
const eventChannel = this.getOpenerEventChannel();
var these = this;
eventChannel.on('checkImg', (rec)=> {
console.log("我收到你的消息了,消息内容是:" + JSON.stringify(rec));
this.src = rec.data;
this.width=rec.width?rec.width:160;
this.height=rec.height?rec.height:80;
this.times=rec.times?rec.times:10;
})
},
methods: {
handleCrop(e) {
var these = this;
const eventChannel = these.getOpenerEventChannel();
this.Statu = true;
console.log("裁剪完成");
console.log(e.tempFilePath);
eventChannel.emit('ImgCutOver_Path',e.tempFilePath);
const ctx = uni.createCanvasContext('splashCanvas', this);
ctx.drawImage(
e.tempFilePath,
0,0,these.width,these.height
);
setTimeout(() => {
ctx.draw(false, ()=>{
console.log("abcdefg")
uni.canvasGetImageData({
canvasId: 'splashCanvas',
x: 0,
y: 0,
width: these.width,
height: these.height,
success: (res) => {
// 处理像素数据并发送
console.log("res.data.length="+res.data.length);
eventChannel.emit('ImgCutOverPath', {
picPath: e.tempFilePath
});
eventChannel.emit('ImgCutOver',{piexls:res.data,picPath:e.tempFilePath});
uni.navigateBack();
},
fail: (err) => {
reject(`获取canvas数据失败: ${err.errMsg}`);
}
});
});
}, 500);
}
}
}
</script>
<style>
.canvas {
border: 1px solid #ccc;
}
</style>

View File

@ -72,7 +72,6 @@
callback: this.scan callback: this.scan
}], }],
title: '扫码' title: '扫码'
}, },
}, },
formData: { formData: {
@ -208,7 +207,7 @@
this.qrCodeResult(cleanedResult, true, null); this.qrCodeResult(cleanedResult, true, null);
}, },
fail: (err) => { fail: (err) => {
this.showMsg("扫码失败:" + err.errMsg, MsgType.error); MsgError("扫码失败:" + err.errMsg,"确定",these);
} }
}); });
}, },

View File

@ -2,11 +2,12 @@
<view class="container"> <view class="container">
<!-- 设备列表 --> <!-- 设备列表 -->
<view class="allSelect" @click="selectAll"> 全选</view> <view class="allSelect" @click="selectAll"> 全选</view>
<scroll-view class="device-list" scroll-y> <mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
<view class="device-card" v-for="(item, index) in deviceList" :key="index" :down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
@click="item.onlineStatus === 1 ? toggleSelect(index) : null">
<view class="device-card" v-for="(item, index) in deviceList" :key="index" @click="toggleSelect(index)">
<!-- 复选框 --> <!-- 复选框 -->
<view class="checkbox" :class="{ checked: item.checked, disabled: item.onlineStatus !== 1 }"> <view class="checkbox" :class="{ checked: item.checked }">
<uni-icons v-if="item.checked" type="checkmarkempty" size="18" color="rgb(0, 0, 0)"></uni-icons> <uni-icons v-if="item.checked" type="checkmarkempty" size="18" color="rgb(0, 0, 0)"></uni-icons>
</view> </view>
<!-- 设备信息 --> <!-- 设备信息 -->
@ -28,11 +29,12 @@
</view> </view>
</view> </view>
</view> </view>
</mescroll-uni>
<view class="editInfmation"> <view class="editInfmation">
<button class="login-btn qz" @click="forceAlarm">强制报警</button> <button class="login-btn qz" @click="forceAlarm">强制报警</button>
<button class="login-btn jc" @click="cancelAlarm">解除报警</button> <button class="login-btn jc" @click="cancelAlarm">解除报警</button>
</view> </view>
</scroll-view>
<!-- 强制报警提示弹框 --> <!-- 强制报警提示弹框 -->
<CustomPopup v-if="popupType === 'force'" :show="showPopupFlag" popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" <CustomPopup v-if="popupType === 'force'" :show="showPopupFlag" popupBorder="1rpx solid rgba(224, 52, 52, 0.3)"
:message="popupMessage" icon="/static/images/6170/bj.png" :confirm-text="popupConfirmText" :message="popupMessage" icon="/static/images/6170/bj.png" :confirm-text="popupConfirmText"
@ -68,9 +70,16 @@
deviceRealTimeStatus // deviceRealTimeStatus //
} from '@/api/6170/deviceControl.js' } from '@/api/6170/deviceControl.js'
import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue';
import MqTool from '@/utils/MqHelper.js';
var timeout = null;
var these = null;
var mq=null;
export default { export default {
components: { components: {
CustomPopup CustomPopup,
MescrollUni
}, },
data() { data() {
return { return {
@ -83,18 +92,53 @@
pendingAlarmAction: '', pendingAlarmAction: '',
sendInfo: '', sendInfo: '',
// 2. typeName // 2. typeName
alarmApiMapping: { dic: {
'HBY100-J': { //100J alarmApiMapping: [{
type: ['HBY100-J'],
sendApi: deviceForceAlarmActivation, sendApi: deviceForceAlarmActivation,
statusTypeName: 'FunctionAccessBatchStatusRule_BJQ100J' statusTypeName: 'FunctionAccessBatchStatusRule_BJQ100J',
sendType: 'FYSSend'
}, },
'BJQ6170': { //6170 {
type: ['BJQ6170'],
sendApi: deviceSendAlarmMessage, sendApi: deviceSendAlarmMessage,
statusTypeName: 'FunctionAccessBatchStatusRule_BJQ200J' statusTypeName: 'FunctionAccessBatchStatusRule_BJQ200J',
sendType: 'FYSSend'
},
{
type: ['BJQ6075J'],
sendApi: deviceSendAlarmMessage,
statusTypeName: '',
sendType: 'CommonSend'
},
{
type: ['HBY670'],
sendApi: deviceSendAlarmMessage,
statusTypeName: '',
sendType: 'XSSend'
} }
]
}, },
loading: false, loading: false,
total: 0 total: 0,
mescroll: null,
downOption: {
auto: true,
autoShowLoading: false,
},
upOption: {
auto: false,
noMoreSize: 0,
offset: 50,
isLock: false,
empty: {
tip: '暂无数据',
hideScroll: false
},
textNoMore: '没有更多数据了'
},
mescrollHeight: 0
} }
}, },
computed: { computed: {
@ -105,13 +149,53 @@
currentApiConfig() { currentApiConfig() {
const currentTypeName = this.sendInfo.typeName || ''; const currentTypeName = this.sendInfo.typeName || '';
// //
return this.alarmApiMapping[currentTypeName] || { let f = this.dic.alarmApiMapping.find(v => {
return v.type.indexOf(currentTypeName) > -1;
});
if (f) {
return f;
} else {
return {
sendApi: deviceDefaultAlarm, sendApi: deviceDefaultAlarm,
statusTypeName: 'FunctionAccessBatchStatusRule_Default' statusTypeName: 'FunctionAccessBatchStatusRule_Default',
sendType:'FYSSend'
}; };
} }
}
}, },
methods: { methods: {
getSystemInfoSyncH() {
let sysInfo = uni.getSystemInfoSync();
// footer 220rpx + 120rpx = 340rpx px1rpx = sysInfo.pixelRatio / 750 * rpx px
let footerHeight = 340 * (sysInfo.screenWidth / 750); // rpx px
// console.log("footerHeight=", footerHeight);
this.mescrollHeight = sysInfo.screenHeight - footerHeight;
// console.log("mescrollHeight=", this.mescrollHeight);
},
mescrollInit(mescroll) {
this.mescroll = mescroll;
},
//
downCallback() {
if (this.mescroll) {
this.mescroll.resetUpScroll(false);
this.mescroll.scrollTo(0, 0);
}
this.getData(this.sendInfo.id);
},
//
upCallback() {
this.getData(this.sendInfo.id);
},
onclosePopup() { onclosePopup() {
this.showPopupFlag = false this.showPopupFlag = false
}, },
@ -123,21 +207,23 @@
selectAll() { selectAll() {
console.log('123'); console.log('123');
// 线/ // 线/
const allSelected = this.deviceList.every(item => item.onlineStatus === 1 && item.checked); const allSelected = this.deviceList.every(item => item.checked);
this.deviceList.forEach(item => { this.deviceList.forEach(item => {
// 线checked // 线checked
if (item.onlineStatus === 1) {
item.checked = !allSelected; item.checked = !allSelected;
}
}); });
this.$forceUpdate(); this.$forceUpdate();
}, },
// //
getData(deviceType) { getData(deviceType) {
clearTimeout(timeout);
timeout = setTimeout(() => {
console.log(deviceType, 'deviceTypedeviceType'); console.log(deviceType, 'deviceTypedeviceType');
this.loading = true; this.loading = true;
let data = { let data = {
pageNum: 1, pageNum: this.mescroll?this.mescroll.num:1,
pageSize: 50, pageSize: 50,
deviceType: deviceType deviceType: deviceType
} }
@ -149,11 +235,33 @@
checked: false checked: false
})); }));
this.total = res.total; this.total = res.total;
this.deviceList = newDevices
if(data.pageNum===1){
this.deviceList = newDevices;
}else{
this.deviceList =this.deviceList.concat(newDevices);
}
let hasNext = true;
if (res.rows.length < data.pageSize || this.deviceList.length >= this.total) {
hasNext = false;
} else {
hasNext = true;
}
this.mescroll.endSuccess(res.rows.length, hasNext);
} else {
this.mescroll.endSuccess(0, false);
} }
}).finally(() => { }).finally(() => {
this.loading = false; this.loading = false;
}).catch(ex => {
this.mescroll.endSuccess(0, false);
}); });
}, 200);
}, },
// //
forceAlarm() { forceAlarm() {
@ -186,7 +294,7 @@
this.pendingAlarmAction = 0 this.pendingAlarmAction = 0
}, },
// //
async sendAlarmCommand() { sendAlarmCommand() {
const selectedDevices = this.deviceList.filter(item => item.checked); const selectedDevices = this.deviceList.filter(item => item.checked);
const deviceIds = selectedDevices.map(item => item.id); const deviceIds = selectedDevices.map(item => item.id);
const deviceImeiList = selectedDevices.map(item => item.deviceImei); const deviceImeiList = selectedDevices.map(item => item.deviceImei);
@ -206,10 +314,12 @@
// typeName // typeName
const { const {
sendApi, sendApi,
statusTypeName statusTypeName,
sendType
} = this.currentApiConfig; } = this.currentApiConfig;
//
// const batchId = generateShortId(); //FYS
let FYSSend = async () => {
const requestData = { const requestData = {
deviceIds: deviceIds, deviceIds: deviceIds,
typeName: this.sendInfo.typeName, typeName: this.sendInfo.typeName,
@ -235,6 +345,48 @@
icon: 'none' icon: 'none'
}); });
} }
}
//XS
let XSSend = () => {
let json=JSON.stringify({ins_SOSGrade:[1]});
for (let i = 0; i < deviceImeiList.length; i++) {
let imei = deviceImeiList[i];
mq.sendData("B/"+imei,json,false);
}
uni.showToast({
title: isAlarming ? '强制报警开启成功' : '报警已解除',
icon: 'success'
});
this.showPopupFlag = false
}
//
let CommonSend = () => {
let json=JSON.stringify({ins_ShakeBit:1});
for (let i = 0; i < deviceImeiList.length; i++) {
let imei = deviceImeiList[i];
mq.sendData("B/"+imei,json,false);
}
uni.showToast({
title: isAlarming ? '强制报警开启成功' : '报警已解除',
icon: 'success'
});
this.showPopupFlag = false
}
switch (sendType) {
case "FYSSend":
FYSSend();
break;
case "XSSend":
XSSend();
break;
case "CommonSend":
CommonSend();
break;
}
} catch (error) { } catch (error) {
console.error('报警操作异常:', error); console.error('报警操作异常:', error);
@ -251,14 +403,26 @@
this.sendAlarmCommand(this.popupType); this.sendAlarmCommand(this.popupType);
}, },
}, },
onUnload() {
if(mq){
mq.disconnect();
}
},
onLoad(options) { onLoad(options) {
these = this;
mq=MqTool.getMqTool();
if(mq){
mq.init();
}
const eventChannel = this.getOpenerEventChannel(); const eventChannel = this.getOpenerEventChannel();
// 'deviceSend' // 'deviceSend'
eventChannel.on('devicePolice', (data) => { eventChannel.on('devicePolice', (data) => {
this.getData(data.data.id) this.getData(data.data.id)
this.sendInfo = data.data this.sendInfo = data.data
}); });
eventChannel.emit('ack', {}) eventChannel.emit('ack', {});
this.getSystemInfoSyncH();
}, },
} }
</script> </script>

View File

@ -18,12 +18,15 @@
<image src="/static/images/common/more.png" mode="aspectFit" class="more"></image> <image src="/static/images/common/more.png" mode="aspectFit" class="more"></image>
</view> </view>
</view> </view>
<!-- <view class="sendFlex" v-if="activeTab && activeTab.id !== ''&& activeTabInfo.communicationMode==0 || activeTabInfo.communicationMode==2"> <view class="sendFlex"
<view class="callpolice" @click="callpolice">报警</view> v-show="showSendFlex"
<view class="Sendmessage" @click="location">位置</view> >
<view class="Sendmessage" @click="handleSend" v-if="activeTabInfo.typeName!=='HBY100-J'">发送信息</view> <view class="callpolice" @click="callpolice" v-show="showWarn">报警</view>
</view> --> <view class="Sendmessage" @click="location" v-show="showMap">位置</view>
<!-- <scroll-view class="device-list" scroll-y @scrolltolower="onScrollToLower" :lower-threshold="100" style="height:80vh;"> --> <view class="Sendmessage" @click="handleSend"
v-show="ShowSendmessage">发送信息</view>
</view>
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption" <mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }"> :down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
<view v-if="deviceList.length>0"> <view v-if="deviceList.length>0">
@ -40,15 +43,15 @@
<view class="device-name"> <view class="device-name">
<view>设备:{{item.deviceName}}</view> <view>设备:{{item.deviceName}}</view>
<view class="ID"> <view class="ID">
<view class="ID" v-if="item.communicationMode==0 || item.communicationMode==2">ID:{{item.deviceImei}} <view class="ID"
v-if="item.communicationMode==0 || item.communicationMode==2">
ID:{{item.deviceImei}}
</view> </view>
<view class="ID" v-else>ID:{{item.deviceMac}}</view> <view class="ID" v-else>ID:{{item.deviceMac}}</view>
<!-- 在线状态 --> <!-- 在线状态 -->
<view class="onlines" <view class="onlines" v-if="item.onlineStatus==1">在线</view>
v-if="item.onlineStatus==1">在线</view>
<!-- 离线状态 --> <!-- 离线状态 -->
<view class="offlines" <view class="offlines" v-if="item.onlineStatus==0">离线</view>
v-if="item.onlineStatus==0">离线</view>
<view>电量{{item.battery || '0'}}%</view> <view>电量{{item.battery || '0'}}%</view>
</view> </view>
</view> </view>
@ -74,7 +77,7 @@
暂无数据 暂无数据
</view> --> </view> -->
</mescroll-uni> </mescroll-uni>
<!-- </scroll-view> -->
</view> </view>
<!-- 删除弹框 --> <!-- 删除弹框 -->
<view class="agreement-mask" v-if="deleteShow" @click.stop="closePopup('delete')" catchtouchmove="true"> <view class="agreement-mask" v-if="deleteShow" @click.stop="closePopup('delete')" catchtouchmove="true">
@ -116,7 +119,7 @@
<view class="tooltip-content" @click.stop> <view class="tooltip-content" @click.stop>
<view class="tooltip-item" v-for="(item, index) in menuItems" :key="index" <view class="tooltip-item" v-for="(item, index) in menuItems" :key="index"
@click="handleMenuClick(item)"> @click="handleMenuClick(item)">
<image :src="item.icon" class="item-icon" mode="aspectFit"/> <image :src="item.icon" class="item-icon" mode="aspectFit" />
<text>{{ item.text }}</text> <text>{{ item.text }}</text>
</view> </view>
</view> </view>
@ -146,17 +149,34 @@
} from '@/api/common/index.js' } from '@/api/common/index.js'
import bleTool from '@/utils/BleHelper.js'; import bleTool from '@/utils/BleHelper.js';
import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue' import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue'
import BleReceive from '@/utils/BleReceive'; import BleReceive from '@/utils/BleReceive';
var pagePath = 'pages/common/index'; var pagePath = 'pages/common/index';
var ble = null; var ble = null;
var timeout = null; var timeout = null;
var recei=null; var recei = null;
export default { export default {
components: { components: {
MescrollUni MescrollUni
}, },
computed:{
showSendFlex(){
// return this.activeTab && this.activeTab.id !== ''&& (this.activeTabInfo.communicationMode==0 || this.activeTabInfo.communicationMode==2);
if(this.showMap || this.ShowSendmessage || this.showWarn){
return true;
}
return false;
},
ShowSendmessage(){
return this.dic.showMsgTypes.indexOf(this.activeTabInfo.typeName)>-1
},
showMap(){
return this.dic.showMapTypes.indexOf(this.activeTabInfo.typeName)>-1
},
showWarn(){
return this.dic.showCallPolice.indexOf(this.activeTabInfo.typeName)>-1
}
},
data() { data() {
return { return {
mescroll: null, mescroll: null,
@ -232,7 +252,12 @@ import BleReceive from '@/utils/BleReceive';
deviceId: '', deviceId: '',
deviceName: "", //重命名 deviceName: "", //重命名
activeTabInfo: '' activeTabInfo: '',
dic: {
showMsgTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'BJQ6075J'],//需要发送消息的类型
showMapTypes:['BJQ6170','HBY210','HBY670','BJQ6075','HBY018A','HBY100-J','BJQ6075J','HBY008A','HBY100-Y'],//需要显示地图的类型
showCallPolice:['BJQ6170','HBY210','HBY670','BJQ6075','HBY018A','HBY100-J','BJQ6075J','HBY008A','HBY100-Y']//需要发送报警的类型
}
} }
}, },
methods: { methods: {
@ -495,7 +520,7 @@ import BleReceive from '@/utils/BleReceive';
case 'scan': case 'scan':
// 扫一扫 // 扫一扫
uni.navigateTo({ uni.navigateTo({
url:'/pages/common/addScan/ScanEquip' url: '/pages/common/addScan/ScanEquip'
}); });
break; break;
@ -618,7 +643,7 @@ import BleReceive from '@/utils/BleReceive';
const deviceType = currentTab.id || ''; const deviceType = currentTab.id || '';
console.log(`跳转到发送信息页面\n当前设备类型: ${deviceType}\n设备类型名称: ${currentTab.typeName}`); console.log(`跳转到发送信息页面\n当前设备类型: ${deviceType}\n设备类型名称: ${currentTab.typeName}`);
uni.navigateTo({ uni.navigateTo({
url: '/pages/6170/callPolice/index', url: '/pages/common/callPolice/index',
events: { events: {
ack: function(data) {} ack: function(data) {}
}, },
@ -665,7 +690,7 @@ import BleReceive from '@/utils/BleReceive';
// 列表跳转 // 列表跳转
handleFile(item) { handleFile(item) {
let url = item.detailPageUrl; let url = item.detailPageUrl;
// console.log("url=",url); // url="/pages/6075/BJQ6075L";
// if(!url){ // if(!url){
// url="/pages/6075/BJQ6075" // url="/pages/6075/BJQ6075"
// } // }
@ -771,8 +796,8 @@ import BleReceive from '@/utils/BleReceive';
this.updateBleStatu(); this.updateBleStatu();
}, pagePath); }, pagePath);
let phone=uni.getStorageSync("phone"); let phone = uni.getStorageSync("phone");
if(phone==='17671332251'){//先写死方便自己使用,后面按人员权限区分 if (phone === '17671332251') { //先写死方便自己使用,后面按人员权限区分
this.menuItems.push({ this.menuItems.push({
text: '上报设备', text: '上报设备',
icon: '/static/images/common/add.png', icon: '/static/images/common/add.png',

View File

@ -2,7 +2,10 @@
<view class="device-page"> <view class="device-page">
<view class="title">星汉物联App联隐私政策</view> <view class="title">星汉物联App联隐私政策</view>
<view class="smalltitle"> <view class="smalltitle">
更新日期2025-09-23 编写日期2025-09-23
</view>
<view class="smalltitle">
更新日期2026-03-05
</view> </view>
<view class="smalltitle"> <view class="smalltitle">
生效日期2025-10-08 生效日期2025-10-08
@ -38,7 +41,7 @@
<view class="deviceTitle">(1).账号信息手机号码验证码,用于注册登陆</view> <view class="deviceTitle">(1).账号信息手机号码验证码,用于注册登陆</view>
<view class="deviceTitle">(2).蓝牙,用于设备连接后的通信控制</view> <view class="deviceTitle">(2).蓝牙,用于设备连接后的通信控制</view>
<view class="deviceTitle">(3).相机/相册权限,拍摄的照片或视频用于上传给设备扫码等</view> <view class="deviceTitle">(3).相机/相册权限,拍摄的照片或视频用于上传给设备扫码等</view>
<view class="deviceTitle">(4).设备标识信息IMEIAndroid IDMACOAID软件安装列表,用于日志查询统计分析识别您的设备预防恶意程序及反作弊提高服务安全性</view> <view class="deviceTitle">(4).设备标识信息BSSIDWi-Fi SSIDWi-Fi BSSIDIMEIAndroid IDMACOAIDAAIDPushTokenAPP ID应用包名软件安装列表,用于日志查询统计分析识别您的设备预防恶意程序及反作弊提高服务安全性</view>
<view class="deviceTitle">(5).GPS或网络位置,用于基于位置的服务如地图导航位置偏移预警</view> <view class="deviceTitle">(5).GPS或网络位置,用于基于位置的服务如地图导航位置偏移预警</view>
<view class="deviceTitle">(6).麦克风,我们的智能设备支持播放语音需要录音以上传给设备</view> <view class="deviceTitle">(6).麦克风,我们的智能设备支持播放语音需要录音以上传给设备</view>
<view class="deviceTitle">(7).根据SDK功能可能收集设备信息位置信息等我们会对合作的第三方SDK进行严格评估并要求其遵守相关法规具体清单见下文</view> <view class="deviceTitle">(7).根据SDK功能可能收集设备信息位置信息等我们会对合作的第三方SDK进行严格评估并要求其遵守相关法规具体清单见下文</view>
@ -51,6 +54,11 @@
<view class="deviceTitle">(2).定位SDK(com.amap.api.location),所属公司:北京高德图强科技有限公司,隐私政策链接:https://lbs.amap.com/pages/privacy/</view> <view class="deviceTitle">(2).定位SDK(com.amap.api.location),所属公司:北京高德图强科技有限公司,隐私政策链接:https://lbs.amap.com/pages/privacy/</view>
<view class="deviceTitle">(3).移动智能终端补充设备标识体系统一调用SDK(com.bun.miitmdid),所属公司:中国信息通信研究院,隐私政策链接:https://www.msa-alliance.cn/col.jsp?id=122</view> <view class="deviceTitle">(3).移动智能终端补充设备标识体系统一调用SDK(com.bun.miitmdid),所属公司:中国信息通信研究院,隐私政策链接:https://www.msa-alliance.cn/col.jsp?id=122</view>
<view class="deviceTitle">(4).轻量版地图SDK(com.amap.api.maps.utils),所属公司:北京高德图强科技有限公司,隐私政策链接:https://lbs.amap.com/pages/privacy/</view> <view class="deviceTitle">(4).轻量版地图SDK(com.amap.api.maps.utils),所属公司:北京高德图强科技有限公司,隐私政策链接:https://lbs.amap.com/pages/privacy/</view>
<view class="deviceTitle">(5).个推消息推送(com.igexin.push),所属公司:浙江每日互动网络科技股份有限公司,隐私政策链接:http://docs.getui.com/download.html</view>
<view class="deviceTitle">(6).阿里云快速json(com.alibaba.fastjson),所属公司:杭州阿里巴巴广告有限公司,隐私政策链接:https://github.com/alibaba/fastjson</view>
<view class="deviceTitle">(7).vivo PUSH-SDK(com.vivo.push),所属公司:维沃移动通信有限公司,隐私政策链接:https://dev.vivo.com.cn/documentCenter/doc/180</view>
<view class="deviceTitle">(8).OPPO PUSH 客户端SDK(com.heytap),所属公司:OPPO广东移动通信有限公司,隐私政策链接:https://open.oppomobile.com/new/introduction?page_name=oppopush</view>
</view> </view>
<view class="smalltitle"> <view class="smalltitle">
4. 信息的存储与安全 4. 信息的存储与安全

View File

@ -10,6 +10,7 @@
<view class="example-body"> <view class="example-body">
<!-- 图片列表 --> <!-- 图片列表 -->
<view class="image-list"> <view class="image-list">
<view class="image-item" v-for="(image, index) in instructionImages" :key="index" <view class="image-item" v-for="(image, index) in instructionImages" :key="index"
@click="handleImageClick(index,image)"> @click="handleImageClick(index,image)">
<image :src="image.fileUrl" mode="aspectFit" class="instruction-image" <image :src="image.fileUrl" mode="aspectFit" class="instruction-image"
@ -71,6 +72,7 @@
fileList: [], fileList: [],
deviceID: "", deviceID: "",
instructionImages: [], instructionImages: [],
typeImgs:[],//该设备类型的官方数据
isDeleteMode: false, // 是否删除模式 isDeleteMode: false, // 是否删除模式
selectedImages: [], // 选中的图片索引 selectedImages: [], // 选中的图片索引
deleteShow: false, deleteShow: false,
@ -225,7 +227,8 @@
}, },
onLoad(options) { onLoad(options) {
this.deviceID = options.id this.deviceID = options.id
this.callOtherApi() this.callOtherApi();
} }
} }
</script> </script>

View File

@ -1,11 +1,12 @@
<template> <template>
<view class="container"> <view class="container">
<!-- 设备列表 --> <!-- 设备列表 -->
<scroll-view class="device-list" scroll-y> <!-- <scroll-view class="device-list" scroll-y> -->
<view class="device-card" v-for="(item, index) in deviceList" :key="index" <mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
@click="item.onlineStatus === 1 ? toggleSelect(index) : null"> :down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
<view class="device-card" v-for="(item, index) in deviceList" :key="index" @click="toggleSelect(index)">
<!-- 复选框 --> <!-- 复选框 -->
<view class="checkbox" :class="{ checked: item.checked, disabled: item.onlineStatus !== 1 }"> <view class="checkbox" :class="{ checked: item.checked }">
<uni-icons v-if="item.checked" type="checkmarkempty" size="18" color="rgb(0, 0, 0)"></uni-icons> <uni-icons v-if="item.checked" type="checkmarkempty" size="18" color="rgb(0, 0, 0)"></uni-icons>
</view> </view>
<!-- 设备信息 --> <!-- 设备信息 -->
@ -27,38 +28,68 @@
</view> </view>
</view> </view>
</view> </view>
</mescroll-uni>
<!-- </scroll-view> -->
<view class="editInfmation"> <view class="editInfmation">
<view class="ql-editor">编辑信息</view> <view class="ql-editor">编辑信息</view>
<view class="ql-input"> <view class="ql-input">
<textarea placeholder-style="color:rgba(255, 255, 255, 0.4)" placeholder="请输入内容" class="textarea" <textarea placeholder-style="color:rgba(255, 255, 255, 0.4)" placeholder="请输入内容" class="textarea"
v-model="messageToSend" :maxlength="20" /> v-model="messageToSend" :maxlength="20" />
<TextToHexV1 class="TextToHex" ref="textToHex" :txts="textLines" :bgColor="'#FFFFFF'"
:color="'#000000'" :fontSize="16" />
</view> </view>
<button class="login-btn" @click.stop="sendTextMessage">发送</button> <button class="login-btn" @click.stop="sendTextMessage">发送</button>
</view> </view>
</scroll-view>
<!-- 成功提示弹框 --> <!-- 成功提示弹框 -->
<CustomPopup :show="showPopupFlag" :title="popupTitle" :message="popupMessage" <CustomPopup :show="showPopupFlag" :title="popupTitle" :message="popupMessage"
icon="/static/images/common/sendSucc.png" :confirm-text="popupConfirmText" :show-cancel="false" icon="/static/images/common/sendSucc.png" :confirm-text="popupConfirmText" :show-cancel="false"
@confirm="onPopupConfirm" /> @confirm="onPopupConfirm" />
<MsgBox ref="msgPop" />
<global-loading ref="loading" />
</view> </view>
</template> </template>
<script> <script>
import CustomPopup from '@/components/CustomPopup/CustomPopup.vue' import CustomPopup from '@/components/CustomPopup/CustomPopup.vue'
import { import {
deviceInfo, deviceInfo,
} from '@/api/common/index.js' } from '@/api/common/index.js'
import { import {
deviceSendMessage, deviceSendMessage,
deviceRealTimeStatus //设备状态 deviceRealTimeStatus //设备状态
} from '@/api/6170/deviceControl.js' } from '@/api/6170/deviceControl.js'
import { import {
generateShortId, generateShortId,
getdeviceSTatus getdeviceSTatus
} from '@/utils/function.js'; } from '@/utils/function.js';
export default { import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue';
import MqTool from '@/utils/MqHelper.js';
import gbk from '@/utils/gbk.js';
import TextToHexV1 from '@/components/TextToHex/TextToHexV1.vue';
import {
showLoading,
hideLoading,
updateLoading
} from '@/utils/loading.js';
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop
} from '@/utils/MsgPops.js';
var mq = null;
var timer = null;
var these = null;
export default {
components: { components: {
CustomPopup CustomPopup,
MescrollUni,
TextToHexV1
}, },
data() { data() {
return { return {
@ -69,23 +100,77 @@ export default {
popupMessage: '信息发送成功!', popupMessage: '信息发送成功!',
popupConfirmText: '确认', popupConfirmText: '确认',
isSending: false, isSending: false,
sendInfo: {} sendInfo: {},
mescroll: null,
downOption: {
auto: true,
autoShowLoading: false,
},
upOption: {
auto: false,
noMoreSize: 0,
offset: 50,
isLock: false,
empty: {
tip: '暂无数据',
hideScroll: false
},
textNoMore: '没有更多数据了'
},
mescrollHeight: 0,
textLines:[]
} }
}, },
methods: { methods: {
onPullDownRefresh() { getSystemInfoSyncH() {
// 执行下拉刷新时的操作,比如重新获取数据
this.getData(); let sysInfo = uni.getSystemInfoSync();
// 底部 footer 高度约 220rpx + 120rpx = 340rpx转换为 px1rpx = sysInfo.pixelRatio / 750 * 屏幕宽度?不,直接用 rpx 转 px 公式)
let footerHeight = 500 * (sysInfo.screenWidth / 750); // rpx 转 px
// console.log("footerHeight=", footerHeight);
this.mescrollHeight = sysInfo.screenHeight - footerHeight;
// console.log("mescrollHeight=", this.mescrollHeight);
}, },
mescrollInit(mescroll) {
this.mescroll = mescroll;
},
// 下拉刷新
downCallback() {
console.log("触发下拉刷新");
if (this.mescroll) {
this.mescroll.resetUpScroll(false);
this.mescroll.scrollTo(0, 0);
}
this.getData(this.sendInfo.id);
},
// 上拉加载
upCallback() {
console.log("触发上拉加载");
this.getData(this.sendInfo.id);
},
// onPullDownRefresh() {
// // 执行下拉刷新时的操作,比如重新获取数据
// this.getData();
// },
toggleSelect(index) { toggleSelect(index) {
this.deviceList[index].checked = !this.deviceList[index].checked this.deviceList[index].checked = !this.deviceList[index].checked
this.$forceUpdate() this.$forceUpdate()
}, },
// 获取设备列表 // 获取设备列表
getData(deviceType) { getData(deviceType) {
clearTimeout(timer);
timer = setTimeout(() => {
console.log("开始加载第" + (this.mescroll ? this.mescroll.num : 1) + '页数据')
this.loading = true; this.loading = true;
let data = { let data = {
pageNum: 1, pageNum: this.mescroll ? this.mescroll.num : 1,
pageSize: 50, pageSize: 50,
deviceType: deviceType deviceType: deviceType
} }
@ -97,14 +182,38 @@ export default {
checked: false checked: false
})); }));
this.total = res.total; this.total = res.total;
this.deviceList = newDevices if (data.pageNum === 1) {
this.deviceList = newDevices;
} else {
this.deviceList = this.deviceList.concat(newDevices);
}
this.total = res.total;
// 判断是否加载完成
let hasNext = true;
if (res.rows.length < data.pageSize || this.deviceList.length >= this.total) {
hasNext = false;
} else {
hasNext = true;
}
this.mescroll.endSuccess(res.rows.length, hasNext);
} else {
this.mescroll.endSuccess(0, false);
} }
}).finally(() => { }).finally(() => {
this.loading = false; this.loading = false;
}).catch(ex => {
this.mescroll.endSuccess(0, false);
}); });
}, 200);
}, },
// 发送文本消息 // 发送文本消息
async sendTextMessage() { sendTextMessage() {
// 防重复提交 // 防重复提交
if (this.isSending) return; if (this.isSending) return;
const selectedDevices = this.deviceList.filter(item => item.checked) const selectedDevices = this.deviceList.filter(item => item.checked)
@ -125,13 +234,16 @@ export default {
return; return;
} }
this.isSending = true; this.isSending = true;
let loadingShown = false; //FYS的方法
let FYSSend = async () => {
try { try {
uni.showLoading({ showLoading(these,{
title: '发送中...', text: '发送中...',
mask: true mask: true
}); });
loadingShown = true;
// 2. 准备请求数据 // 2. 准备请求数据
const batchId = generateShortId(); const batchId = generateShortId();
const data = { const data = {
@ -157,7 +269,7 @@ export default {
const statusRes = await getdeviceSTatus({ const statusRes = await getdeviceSTatus({
functionMode: 2, functionMode: 2,
batchId, batchId,
typeName:'FunctionAccessBatchStatusRule', typeName: 'FunctionAccessBatchStatusRule',
deviceImei, deviceImei,
interval: 500 interval: 500
}, },
@ -168,14 +280,247 @@ export default {
this.showPopupFlag = true this.showPopupFlag = true
} }
} catch (error) { } catch (error) {
uni.showToast({ MsgError(error.message,null,these);
title: error.message,
icon: 'none'
});
} finally { } finally {
uni.hideLoading(); hideLoading(these);
this.isSending = false; this.isSending = false;
} }
}
//XS的方法
let XSSend = () => {
try {
let text = this.messageToSend.padEnd(16,'').substring(0,16);
let arr = gbk.encode(text)
let gbkData = gbk.arr2hex(arr);
let len=gbkData.length;
let list = [];
console.log("gbkData=",gbkData);
let rec = function(payload, receive) {
debugger;
console.log("收到消息,imei=" + mei + ",消息内容,", payload);
let json =JSON.parse(payload.payload);
let mei=payload.receive.topic.replace('A/','');
let childData=null;
let childIndex=null;
if (json.sta_BreakNews === 1) {
childIndex=1;
childData=gbkData.slice(0,len/2);
}
else if (json.sta_BreakNews === 2) {
childIndex=2;
childData=gbkData.slice(len/2,len);
}
else if (json.sta_BreakNews === 'cover!') {
mq.unSubscribes({topic:"A/" + mei});
return;
}
if(childData){
console.log("childData=",childData)
let buffer={ins_BreakNews:[childIndex]};
for (var i = 0; i < childData.length; i += 2) {
let value = parseInt(childData[i] + "" + childData[i + 1], 16);
buffer.ins_BreakNews.push(value);
}
let msg=JSON.stringify(buffer);
mq.sendData("B/" + mei, msg, false);
}
};
let msg = JSON.stringify({
ins_BreakNews: [0]
});
for (let i = 0; i < deviceImeiList.length; i++) {
list.push({
imie: deviceImeiList[i],
topic: 'A/' + deviceImeiList[i],
callback: rec
});
mq.sendData("B/" + deviceImeiList[i], msg, false);
}
mq.subscribes(list);
this.showPopupFlag = true;
} catch (error) {
} finally {
this.isSending = false;
}
}
//FS的方法
let FSSend = () => {
this.messageToSend.padEnd(16, ' ').slice(0,16);
this.textLines = [this.messageToSend.slice(0, 8), this.messageToSend.slice(8, 16)];
showLoading(this, {
text: "发送中"
});
//握手
let holdHand = (hexs, time) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(true)
}, time);
});
}
//画图
let drawText = () => {
return new Promise((resolve, reject) => {
this.$refs.textToHex.drawAndGetPixels().then(allPixels => {
if (!allPixels) {
reject("文本初始化失败");
return;
}
console.log("画图成功");
resolve(allPixels)
}).catch(compEx => {
reject(compEx);
});
});
}
//发送3个分包的数据
let task = (allPixels,imei) => {
try {
let combinedData = [];
for (let i = 0; i < 2; i++) {
let linePixels = (allPixels[i] || []).flat(Infinity).map(item =>
item.replace('0x', '')
);
for (var j = linePixels.length; j < 256; j++) {
linePixels.push("00");
}
combinedData.push(['0' + (i + 1), '01'].concat(linePixels.slice(0, 128)));
combinedData.push(['0' + (i + 1), '02'].concat(linePixels.slice(128, 256)));
}
let curr = 1;
let len = combinedData.length;
console.log("包数量", len)
//分包发送
let sendPacket = () => {
if (combinedData.length === curr - 1) {
holdHand('transmit complete', 200).then(res => {
});
return;
}
let array = combinedData[curr - 1];
let json =JSON.stringify( {
ins_msg: array.join("")
});
mq.sendData("B/" + imei, json, false).then(
res => {
curr++;
console.log("发送成功", curr)
setTimeout(sendPacket, 500);
}).catch(err => {
if (err.code == '10007') {
setTimeout(sendPacket, 500);
} else {
console.log("err:", err);
MsgError('发送失败' + (err.msg || err.code), '确定', these);
}
});
}
setTimeout(sendPacket, 40);
// 5. 发送成功处理
} catch (ex) {
uni.showModal({
title: '提示',
content: '发送失败' + (ex.msg || ex.code)
})
}
}
setTimeout(()=>{
drawText().then(pixels=>{
for (let i = 0; i < deviceImeiList.length; i++) {
let imei = deviceImeiList[i];
task(pixels,imei);
}
setTimeout(()=>{
hideLoading(these);
MsgSuccess("发送成功",null,these);
},800);
})
}, 10);
}
let device = selectedDevices[0];
let sendDic = [{
urls: ['/pages/6170/deviceControl/index', '/pages/210/HBY210', '/pages/6075/BJQ6075',
'/pages/100J/HBY100-J'
],
send: FYSSend,
},
{
urls: ['/pages/670/HBY670'],
send: XSSend
},
{
urls: ['/pages/6075J/BJQ6075J'],
send: FSSend
}
];
let f = sendDic.find(v => {
return v.urls.indexOf(device.detailPageUrl) > -1;
});
if (f) {
f.send();
} else {
FYSSend();
}
}, },
onPopupConfirm() { onPopupConfirm() {
this.showPopupFlag = false this.showPopupFlag = false
@ -185,43 +530,57 @@ export default {
}, },
}, },
onLoad(options) { onLoad(options) {
these = this;
mq = MqTool.getMqTool();
if(mq){
mq.init();
}
const eventChannel = this.getOpenerEventChannel(); const eventChannel = this.getOpenerEventChannel();
// 监听 'deviceSend' 事件,获取传过来的数据 // 监听 'deviceSend' 事件,获取传过来的数据
eventChannel.on('deviceSend', (data) => { eventChannel.on('deviceSend', (data) => {
console.log('Received detail data:', data); console.log('Received detail data:', data);
this.getData(data.data.id)
this.sendInfo = data.data this.sendInfo = data.data
this.downCallback();
}); });
// 如果需要向调用页面返回数据,可以触发 'ack' 事件 // 如果需要向调用页面返回数据,可以触发 'ack' 事件
eventChannel.emit('ack', {}) eventChannel.emit('ack', {});
this.getSystemInfoSyncH();
}, },
} onUnload() {
clearTimeout(timer);
if (mq) {
mq.disconnect();
}
}
}
</script> </script>
<style scoped> <style scoped>
.container { .container {
min-height: 100vh; min-height: 100vh;
background-color: rgb(18, 18, 18); background-color: rgb(18, 18, 18);
box-sizing: border-box; box-sizing: border-box;
overflow-x: hidden; overflow-x: hidden;
} }
.device-list { .device-list {
flex: 1; flex: 1;
padding: 0 20rpx; padding: 0 20rpx;
} }
.device-card { .device-card {
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
width: 95%; width: 95%;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.checkbox { .checkbox {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
border: 2rpx solid rgba(255, 255, 255, 0.5); border: 2rpx solid rgba(255, 255, 255, 0.5);
@ -230,14 +589,14 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.checkbox.checked { .checkbox.checked {
background-color: rgb(187, 230, 0); background-color: rgb(187, 230, 0);
border-color: rgb(187, 230, 0); border-color: rgb(187, 230, 0);
} }
.device-content { .device-content {
background-color: rgb(26, 26, 26); background-color: rgb(26, 26, 26);
border-radius: 16rpx; border-radius: 16rpx;
position: relative; position: relative;
@ -245,32 +604,32 @@ export default {
align-items: center; align-items: center;
padding: 20rpx; padding: 20rpx;
width: 95%; width: 95%;
} }
.device-header { .device-header {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 15rpx; margin-bottom: 15rpx;
} }
.device-name { .device-name {
font-size: 32rpx; font-size: 32rpx;
color: rgba(255, 255, 255, 0.87); color: rgba(255, 255, 255, 0.87);
margin-left: 12rpx; margin-left: 12rpx;
line-height: 50rpx; line-height: 50rpx;
width: 83%; width: 83%;
white-space: nowrap; white-space: nowrap;
} }
.ID { .ID {
color: rgba(255, 255, 255, 0.6); color: rgba(255, 255, 255, 0.6);
font-size: 26rpx; font-size: 26rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
position: relative; position: relative;
} }
.device-status { .device-status {
width: 122rpx; width: 122rpx;
height: 52rpx; height: 52rpx;
font-size: 26rpx; font-size: 26rpx;
@ -281,26 +640,26 @@ export default {
right: 0rpx; right: 0rpx;
text-align: center; text-align: center;
line-height: 52rpx; line-height: 52rpx;
} }
.online { .online {
color: rgb(187, 230, 0); color: rgb(187, 230, 0);
} }
.unline { .unline {
color: rgba(255, 255, 255, 0.4); color: rgba(255, 255, 255, 0.4);
} }
.device-info { .device-info {
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
font-size: 26rpx; font-size: 26rpx;
color: rgba(255, 255, 255, 0.87); color: rgba(255, 255, 255, 0.87);
padding-top: 10rpx; padding-top: 10rpx;
position: relative; position: relative;
} }
.deviceIMG { .deviceIMG {
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
border-radius: 16rpx; border-radius: 16rpx;
@ -308,19 +667,19 @@ export default {
background-color: rgba(42, 42, 42, 0.6); background-color: rgba(42, 42, 42, 0.6);
display: flex; display: flex;
align-items: center; align-items: center;
} }
.IMG { .IMG {
width: 68rpx; width: 68rpx;
height: 50rpx; height: 50rpx;
margin-left: 17%; margin-left: 17%;
} }
.onlines { .onlines {
position: relative; position: relative;
} }
.onlines::before { .onlines::before {
content: ''; content: '';
position: absolute; position: absolute;
width: 15rpx; width: 15rpx;
@ -329,13 +688,13 @@ export default {
border-radius: 50%; border-radius: 50%;
top: 20rpx; top: 20rpx;
left: -20rpx left: -20rpx
} }
.unlines { .unlines {
position: relative; position: relative;
} }
.unlines::before { .unlines::before {
content: ''; content: '';
position: absolute; position: absolute;
width: 15rpx; width: 15rpx;
@ -344,9 +703,9 @@ export default {
border-radius: 50%; border-radius: 50%;
top: 20rpx; top: 20rpx;
left: -20rpx left: -20rpx
} }
.line { .line {
width: 2rpx; width: 2rpx;
height: 24rpx; height: 24rpx;
background: linear-gradient(90deg, background: linear-gradient(90deg,
@ -354,58 +713,67 @@ export default {
rgb(255, 255, 255) 50%, rgb(255, 255, 255) 50%,
rgba(255, 255, 255, 0) 100%); rgba(255, 255, 255, 0) 100%);
margin-top: 12rpx; margin-top: 12rpx;
} }
.ql-editor { .ql-editor {
color: rgba(255, 255, 255, 0.6); color: rgba(255, 255, 255, 0.6);
font-size: 30rpx; font-size: 30rpx;
} }
.ql-input { .ql-input {
width: 95.9%; width: 95.9%;
height: 200rpx; height: 200rpx;
margin-top: 30rpx; margin-top: 30rpx;
box-sizing: border-box; box-sizing: border-box;
padding: 30rpx; padding: 20rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: rgb(26, 26, 26); background: rgb(26, 26, 26);
} }
.textarea { .textarea {
color: rgba(255, 255, 255, 0.8); color: rgba(255, 255, 255, 0.8);
background: rgba(42, 42, 42, 1); background: rgba(42, 42, 42, 1);
border-radius: 16rpx; border-radius: 16rpx;
padding: 10rpx; padding: 10rpx;
height: 150rpx; height: 150rpx;
} width: 100%;
}
.editInfmation { .editInfmation {
padding: 20rpx; padding: 20rpx;
border-radius: 40rpx 40rpx 0px 0px; border-radius: 40rpx 40rpx 0px 0px;
background: rgba(28, 28, 28, 1); background: rgba(28, 28, 28, 1);
position: fixed; position: fixed;
bottom: 50rpx; bottom: 20rpx;
box-sizing: border-box; box-sizing: border-box;
} width: 100%;
}
.login-btn { .login-btn {
margin-top: 30rpx; margin-top: 30rpx;
background-color: rgb(187, 230, 0); background-color: rgb(187, 230, 0);
color: rgb(35, 35, 35); color: rgb(35, 35, 35);
border-radius: 50rpx; border-radius: 50rpx;
width: 90%; width: 90%;
} }
.checkbox.disabled { .checkbox.disabled {
opacity: 0.5; opacity: 0.5;
background-color: rgba(255, 255, 255, 0.1) !important; background-color: rgba(255, 255, 255, 0.1) !important;
border-color: rgba(255, 255, 255, 0.2) !important; border-color: rgba(255, 255, 255, 0.2) !important;
pointer-events: none; pointer-events: none;
/* 阻止点击事件 */ /* 阻止点击事件 */
} }
/* 可选:离线设备的卡片整体置灰 */ /* 可选:离线设备的卡片整体置灰 */
.device-card[data-offline="true"] { .device-card[data-offline="true"] {
opacity: 0.6; opacity: 0.6;
} }
.TextToHex {
position: fixed;
top: -99999rpx;
left: -99999rpx;
visibility: hidden;
}
</style> </style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 612 B

View File

Before

Width:  |  Height:  |  Size: 528 B

After

Width:  |  Height:  |  Size: 528 B

View File

Before

Width:  |  Height:  |  Size: 304 B

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

View File

@ -1601,7 +1601,7 @@ class BleHelper {
// console.log("正在连接" + deviceId); // console.log("正在连接" + deviceId);
uni.createBLEConnection({ uni.createBLEConnection({
deviceId: deviceId, deviceId: deviceId,
timeout: 30000, timeout: 15000,
success: (info) => { success: (info) => {
//释放连接锁 //释放连接锁

View File

@ -218,31 +218,31 @@ export default {
value: "1", value: "1",
label: "灯光模式", label: "灯光模式",
checked: false, checked: false,
type: ['6170', '670','102','6155','650','7305'] type: ['6170', '670','102','6155','650','7305','6075']
}, },
{ {
value: "2", value: "2",
label: "激光模式", label: "激光模式",
checked: false, checked: false,
type: ['6170'] type: ['6170','6075']
}, },
{ {
value: "3", value: "3",
label: "开机画面", label: "开机画面",
checked: false, checked: false,
type: ['210', '6170', '670','6155','650','7305'] type: ['210', '6170', '670','6155','650','7305','6075']
}, },
{ {
value: "4", value: "4",
label: "人员信息登记", label: "人员信息登记",
checked: false, checked: false,
type: ['210', '6170', '670','6155','650','7305'] type: ['210', '6170', '670','6155','650','7305','6075']
}, },
{ {
value: "5", value: "5",
label: "发送信息", label: "发送信息",
checked: false, checked: false,
type: ['210', '6170', '670'] type: ['210', '6170', '670','6075']
}, },
{ {
value: "6", value: "6",
@ -258,7 +258,7 @@ export default {
value: "42", value: "42",
label: "SOS", label: "SOS",
checked: false, checked: false,
type: ['670','4877'] type: ['670','4877','6075']
}, },
{ {
value: "43", value: "43",

View File

@ -281,7 +281,36 @@ class MqttClient {
} }
} }
publish(topic, message,retained) { async publish(topic, message,retained) {
let getLan=()=>{
return new Promise((succ,error)=>{
uni.getNetworkType({
success: (res) => {
let networkType = res.networkType;
// 判断网络是否连接
if (networkType === 'none') {
console.error('无网络连接')
succ(false);
} else {
succ(true);
}
},
fail: (err) => {
console.error('获取网络状态失败:', err);
succ(false);
}
});
});
}
let flag=await getLan();
if(!flag){
return false;
}
if (this.client && this.client.isConnected()) { if (this.client && this.client.isConnected()) {
const mqttMessage = new Paho.Message(message); const mqttMessage = new Paho.Message(message);
mqttMessage.destinationName = topic; mqttMessage.destinationName = topic;