完善6170报警功能,图片压缩大小
This commit is contained in:
@ -25,7 +25,7 @@
|
||||
<view class="battery-v1">
|
||||
<image src="/static/images/common/nz.png" class="dlIMG" mode="aspectFit"></image>
|
||||
<view>
|
||||
<view class="battery-v2">{{deviceInfo.batteryRemainingTime || '0分钟'}}</view>
|
||||
<view class="battery-v2">{{deviceInfo.batteryRemainingTime || '0分钟'}}分钟</view>
|
||||
<view class="battery-v3">续航时间</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -61,13 +61,22 @@
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="callpolice" v-if="deviceInfo.onlineStatus==1">
|
||||
<view class="">设备强制报警中</view>
|
||||
<view>
|
||||
<uni-icons type="closeempty" size="15" color="rgba(255, 255, 255, 0.9)"
|
||||
@click="handlePolice"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">灯光亮度</text>
|
||||
<text class="info-value status-running">{{ sliderValue }}%</text>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 灯光亮度控制 -->
|
||||
<view class="control-card" @touchstart="cardTouchStart" @touchmove="cardTouchMove" @touchend="cardTouchEnd">
|
||||
<view class="control-card" @touchstart="cardTouchStart" @touchmove="cardTouchMove"
|
||||
@touchend="cardTouchEnd">
|
||||
<view @touchmove.prevent>
|
||||
<slider :value="sliderValue" min="10" max="100" activeColor="rgb(187, 230, 0)"
|
||||
backgroundColor="rgb(26, 26, 26)" :show-value="false" @changing="onSliderChanging"
|
||||
@ -144,7 +153,7 @@
|
||||
</view>
|
||||
|
||||
<view class="form-row">
|
||||
<input class="form-input" maxlength="20" placeholder="请输入文字" v-model="messageToSend" />
|
||||
<input class="form-input1" maxlength="20" placeholder="请输入文字" v-model="messageToSend" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 产品信息 -->
|
||||
@ -230,8 +239,23 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 人员信息成功提示弹框 -->
|
||||
<CustomPopup :show="showPopupFlag" :message="popupMessage" icon="/static/images/common/sendSucc.png"
|
||||
:confirm-text="popupConfirmText" :show-cancel="false" @confirm="onPopupConfirm" />
|
||||
<CustomPopup v-if="popupType === 'person'" :show="showPopupFlag" :message="popupMessage"
|
||||
icon="/static/images/common/sendSucc.png" :confirm-text="popupConfirmText" :show-cancel="false"
|
||||
@confirm="onPopupConfirm" />
|
||||
<!-- 开机log上传成功的弹框提示 -->
|
||||
<CustomPopup v-if="popupType === 'logo'" :show="showPopupFlag" :message="popupMessage"
|
||||
icon="/static/images/common/upload.png" :confirm-text="popupConfirmText" :show-cancel="false"
|
||||
@confirm="onPopupConfirm" />
|
||||
<!--============= 电量低于提示弹框=========== -->
|
||||
<CustomPopup v-if="popupType === 'bettery'" :show="showPopupFlag"
|
||||
popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage"
|
||||
icon="/static/images/common/path.png" :confirm-text="popupConfirmText" :show-cancel="true"
|
||||
@confirm="onPopupConfirm" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
|
||||
<!-- 解除报警 -->
|
||||
<CustomPopup v-if="popupType === 'cancel'" :show="showPopupFlag"
|
||||
popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage"
|
||||
icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="false"
|
||||
@confirm="onPopupConfirm" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -297,7 +321,9 @@
|
||||
showUploadPopup: false,
|
||||
selectedImage: null, // 添加这个变量来存储选择的图片
|
||||
file: '',
|
||||
selectedItemIndex: 0
|
||||
selectedItemIndex: 0,
|
||||
popupType: 'person', //弹框类型
|
||||
timer: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -330,30 +356,35 @@
|
||||
res.eventChannel.emit('MapData', JSON.parse(JSON.stringify(mapData)))
|
||||
},
|
||||
fail: (err) => {
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
// 强制报警()
|
||||
handlePolice() {
|
||||
this.popupType = 'cancel';
|
||||
this.popupMessage = '确认要解除所选设备的报警状态';
|
||||
this.showPopupFlag = true;
|
||||
},
|
||||
// ***********进度条***********
|
||||
cardTouchStart(e) {
|
||||
if (!this.cardRect) return;
|
||||
this.touchStartX = e.touches[0].clientX;
|
||||
this.touchStartY = e.touches[0].clientY;
|
||||
},
|
||||
|
||||
|
||||
cardTouchMove(e) {
|
||||
if (!this.cardRect || e.touches.length === 0) return;
|
||||
|
||||
|
||||
const deltaX = e.touches[0].clientX - this.touchStartX;
|
||||
const deltaY = e.touches[0].clientY - this.touchStartY;
|
||||
|
||||
|
||||
// 只有当水平滑动距离大于垂直距离时,才判断为有效滑动
|
||||
if (Math.abs(deltaX) > Math.abs(deltaY)) {
|
||||
this.isCardSliding = true;
|
||||
this.updateSliderFromTouch(e);
|
||||
}
|
||||
},
|
||||
|
||||
cardTouchEnd(e) {
|
||||
if (this.isCardSliding) {
|
||||
// 触摸结束时,调用滑动结束的处理函数来发送最终值
|
||||
@ -367,7 +398,7 @@
|
||||
this.touchStartX = 0;
|
||||
this.touchStartY = 0;
|
||||
},
|
||||
|
||||
|
||||
updateSliderFromTouch(e) {
|
||||
const touchX = e.touches[0].clientX;
|
||||
const cardLeft = this.cardRect.left;
|
||||
@ -391,17 +422,17 @@
|
||||
value = 10;
|
||||
}
|
||||
this.sliderValue = value; // 实时更新UI
|
||||
|
||||
|
||||
const now = Date.now();
|
||||
// 使用节流防止指令发送过于频繁
|
||||
if (now - this.lastBrightnessTime > 200) { // 200毫秒节流
|
||||
this.lastBrightnessTime = now;
|
||||
|
||||
|
||||
// 增加轻微的震动反馈,提升手感
|
||||
uni.vibrateShort({
|
||||
type: 'light'
|
||||
});
|
||||
|
||||
|
||||
let data = {
|
||||
deviceId: this.deviceID,
|
||||
instructValue: this.sliderValue + '.00'
|
||||
@ -419,7 +450,7 @@
|
||||
value = 10;
|
||||
}
|
||||
this.sliderValue = value;
|
||||
|
||||
|
||||
let data = {
|
||||
deviceId: this.deviceID,
|
||||
instructValue: this.sliderValue + '.00'
|
||||
@ -615,10 +646,9 @@
|
||||
try {
|
||||
const responseData = JSON.parse(res.data);
|
||||
if (responseData.code === 200) {
|
||||
uni.showToast({
|
||||
title: responseData.msg,
|
||||
icon: 'success'
|
||||
});
|
||||
this.popupType = 'logo'; //弹框类型
|
||||
this.showPopupFlag = true;
|
||||
this.popupMessage = '上传成功';
|
||||
this.selectedImage = '';
|
||||
this.file = null;
|
||||
this.lightModeB = false
|
||||
@ -718,6 +748,7 @@
|
||||
registerPersonInfo(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.hideLoading()
|
||||
this.popupType = 'person';
|
||||
this.showPopupFlag = true
|
||||
this.popupMessage = '人员信息发送成功'
|
||||
} else {
|
||||
@ -752,6 +783,7 @@
|
||||
deviceSendMessage(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.hideLoading()
|
||||
this.popupType = 'person';
|
||||
this.showPopupFlag = true
|
||||
this.popupMessage = '发送信息成功'
|
||||
} else {
|
||||
@ -849,6 +881,11 @@
|
||||
const statusTopic = `A/${this.itemInfo.deviceImei}`;
|
||||
this.mqttClient.subscribe(statusTopic, (payload) => {
|
||||
console.log(`收到来自 ${statusTopic} 的消息:`, payload);
|
||||
//收到电量上报。延迟20s请求接口数据
|
||||
setTimeout(() => {
|
||||
this.fetchDeviceDetail(data.data.id)
|
||||
}, 20000);
|
||||
|
||||
// ✅ 发送全局事件通知主页面更新
|
||||
uni.$emit('deviceStatusUpdate', {
|
||||
message: JSON.stringify(payload), // 消息内容
|
||||
@ -1104,6 +1141,18 @@
|
||||
|
||||
}
|
||||
|
||||
.callpolice {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-radius: 16rpx;
|
||||
background: rgba(224, 52, 52, 1);
|
||||
padding: 15rpx;
|
||||
margin-bottom: 15rpx;
|
||||
color: #fff;
|
||||
line-height: 35rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.example-body {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
@ -1175,6 +1224,14 @@
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
}
|
||||
|
||||
.form-input1 {
|
||||
height: 80rpx;
|
||||
border: 1rpx solid transparent;
|
||||
font-size: 32rpx;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
width: 98%;
|
||||
}
|
||||
|
||||
.product-section {
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
|
Reference in New Issue
Block a user