Merge branch 'new-20250827' of http://47.107.152.87:3000/liubiao/APP into new-20250827

This commit is contained in:
liub
2025-11-17 15:31:14 +08:00
7 changed files with 673 additions and 405 deletions

View File

@ -39,15 +39,24 @@
<!-- 设备基本信息 -->
<view class="info-card">
<view class="info-row">
<text class="info-label">设备状态</text>
<text class="info-label">设备名称</text>
<text class="info-value status-running">运行中</text>
</view>
<view class="info-row">
<text class="info-label">蓝牙名称</text>
<text class="info-value status-running">FB-Site_02</text>
</view>
<view class="info-row">
<text class="info-label">蓝牙状态</text>
<text class="info-value status-running">未连接</text>
</view>
<view class="hr"></view>
<view class="info-row">
<text class="info-label">联机状态</text>
<text class="info-value status-greend">联机</text>
</view>
<view class="info-row">
<text class="info-label">定位信</text>
<text class="info-label">定位信</text>
<view class="info-value status-running" @click="gpsPosition">
<view class="info-value status-running">114.72 30.28</view>
<view class="info-value status-running">
@ -69,63 +78,6 @@
</view>
</view>
</view>
<!-- 灯光模式选择 -->
<!-- <view class="mode-section">
<view class="mode-buttons">
<view class="mode-v1">
<view class="mode-v2" @click="selectMode">
<image src="/static/images/210/lj.png" class="setIMG"></image>
<view>
<view class="battery-v2">联机设备</view>
</view>
</view>
</view>
<view class="mode-v1">
<view class="mode-v2" @click="uploadStartup">
<image src="/static/images/common/path7.png" class="setIMG" mode="aspectFit"></image>
<view>
<view class="battery-v2">开机画面</view>
<view class="mode-v3">上传</view>
</view>
</view>
</view>
<view class="mode-v1">
<view class="mode-v2" @click="automaticAlarm">
<image src="/static/images/210/zd.png" class="setIMG" mode="aspectFit"></image>
<view>
<view class="battery-v2">自动报警</view>
</view>
</view>
</view>
<view class="mode-v1">
<view class="mode-v2" @click="anualAlarm">
<image src="/static/images/210/zd-HL.png" class="setIMG" mode="aspectFit"></image>
<view>
<view class="battery-v2">手动报警</view>
</view>
</view>
</view>
<view class="mode-v1">
<view class="mode-v2">
<image src="/static/images/210/bj.png" class="setIMG" mode="aspectFit"></image>
<view>
<view class="battery-v2">报警声音</view>
<view class="mode-v3">上传</view>
</view>
</view>
</view>
<view class="mode-v1">
<view class="mode-v2" @click="alarmTime">
<image src="/static/images/210/time.png" class="setIMG" mode="aspectFit"></image>
<view>
<view class="battery-v2">报警时长</view>
<view class="mode-v3">{{alarmTimeDisplay }}</view>
</view>
</view>
</view>
</view>
</view> -->
<view class="mode-section">
<view class="mode-buttons">
<view v-for="(item, index) in modeItems" :key="index" class="mode-v1"
@ -240,119 +192,15 @@
</view>
</view>
<!-- ======各个弹框类型======= -->
<CustomPopup :show="currentPopup.show" ="currentPopup.config" @confirm="handleConfirm"
@cancel="handleCancel" />
<CustomPopupTXT :show="currentPopup.show" v-bind="currentPopup.config" @confirm="handleConfirm"
@cancel="handleCancel" class="custom-popup-txt" />
</view>
</view>
</template>
<script>
// 弹框配置中心
const POPUP_CONFIGS = {
// 人员信息发送
person: {
config: {
icon: '/static/images/common/sendSucc.png',
message: '信息发送成功',
showCancel: false
},
confirm() {
return true; // 直接关闭
}
import CustomPopupTXT from '@/components/CustomPopup/CustomPopup.vue'
},
// 上传开机log
logo: {
config: {
icon: '/static/images/common/upload.png',
message: '上传成功',
showCancel: false
},
confirm() {
return true; // 直接关闭
}
},
// 电量低于20%.提示框
bettery: {
config: {
title: '设备电量低于20%',
titleColor: 'rgba(224, 52, 52, 1)',
message: '请及时充电',
icon: '/static/images/common/path.png',
popupBorder: '1rpx solid rgba(224, 52, 52, 0.3)',
confirmBtnBg: 'rgba(224, 52, 52, 1)',
showCancel: true
},
confirm() {
return true; // 直接关闭
}
},
// 解除报警关闭的那个提示
cancel: {
config: {
titleColor: 'rgba(224, 52, 52, 1)',
icon: '/static/images/6170/svg.png',
popupBorder: '1rpx solid rgba(224, 52, 52, 0.3)',
confirmBtnBg: 'rgba(224, 52, 52, 1)',
showCancel: true //取消按钮
},
confirm() {
console.log('解除报警确认');
}
},
// 手动报警弹框
del: {
config: {
message: '确定开启报警?',
icon: '/static/images/210/bj_1.png',
popupBorder: '1rpx solid rgba(255, 200, 78, 1)',
confirmBtnBg: 'rgba(255, 200, 78, 1)',
showCancel: true
},
confirm() {
return 'alarmCountdown'; //点击确认,再次弹框,解除报警,再次报警的类型
}
},
// 手动报警再次弹框 再次报警,解除报警指令
alarmCountdown: {
config: {
title: '报警倒计时',
icon: '/static/images/6170/svg.png',
message: '59秒',
popupBorder: '1rpx solid rgba(224, 52, 52, 1)',
confirmBtnBg: 'rgba(224, 52, 52, 1)',
cancelBtnColor:"rgba(224, 52, 52, 1)",
confirmBtnColor:"rgba(255, 255, 255, 0.87)",
confirmText: '解除报警',
cancelText:"再次报警",
showCancel: true //取消按钮
},
confirm() {
console.log('解除报警确认');
}
},
// 自动报警
autoAlarm: {
config: {
icon: '/static/images/6170/svg.png',
title: '报警信息',
message: '002号设备(ID:123456)\n出现报警', // 使用\n换行
showCountdown: true,
countdownTime: 59,
confirmText: '解除报警',
popupBorder: '1rpx solid rgba(224, 52, 52, 0.3)',
confirmBtnBg: 'rgba(224, 52, 52, 1)',
confirmBtnColor: "rgba(255, 255, 255, 0.87)",
showCancel: false,
},
confirm() {
console.log('自动报警解除报警的弹框');
}
}
}
import MqttClient from '@/utils/mqtt.js';
import {
deviceDetail,
@ -372,6 +220,9 @@
clientid
} from '@/utils/request'
export default {
components: {
CustomPopupTXT
},
data() {
return {
selectedIndex: -1, // Track currently selected index
@ -381,8 +232,8 @@
subTitle: ""
},
{
image: "/static/images/common/path7.png",
title: "开机画面",
image: "/static/images/210/bj.png",
title: "报警声音",
subTitle: "上传"
},
{
@ -396,8 +247,8 @@
subTitle: ""
},
{
image: "/static/images/210/bj.png",
title: "报警声音",
image: "/static/images/common/path7.png",
title: "开机画面",
subTitle: "上传"
},
{
@ -449,6 +300,118 @@
radioSelected: 0, // -1表示未选中任何项
deviceType: '',
popupType: '', //弹框类型
// 弹框配置中心
POPUP_CONFIGS: {
// 人员信息发送
person: {
config: {
icon: '/static/images/common/sendSucc.png',
message: '信息发送成功',
showCancel: false
},
confirm() {
return true; // 直接关闭
}
},
// 上传开机log
logo: {
config: {
icon: '/static/images/common/upload.png',
message: '上传成功',
showCancel: false
},
confirm() {
return true; // 直接关闭
}
},
// 电量低于20%.提示框
bettery: {
config: {
show: true, // 必须显式设置为true
showIcon: true, // 显示图标
title: '设备电量低于20%',
titleColor: 'rgba(224, 52, 52, 1)',
message: '请及时充电',
icon: '/static/images/common/path.png',
popupBorder: '1rpx solid rgba(224, 52, 52, 0.3)',
confirmBtnBg: 'rgba(224, 52, 52, 1)',
showCancel: true
},
confirm() {
return true; // 直接关闭
}
},
// 解除报警关闭的那个提示
cancel: {
config: {
show: true, // 必须显式设置为true
showIcon: true, // 显示图标
titleColor: 'rgba(224, 52, 52, 1)',
icon: '/static/images/6170/svg.png',
popupBorder: '1rpx solid rgba(224, 52, 52, 0.3)',
confirmBtnBg: 'rgba(224, 52, 52, 1)',
showCancel: true //取消按钮
},
confirm() {
console.log('解除报警确认');
}
},
// 手动报警弹框
del: {
config: {
show: true, // 必须显式设置为true
showIcon: true, // 显示图标
message: '确定开启报警?',
icon: '/static/images/210/bj_1.png',
popupBorder: '1rpx solid rgba(255, 200, 78, 1)',
confirmBtnBg: 'rgba(255, 200, 78, 1)',
showCancel: true
},
confirm() {
return 'alarmCountdown'; //点击确认,再次弹框,解除报警,再次报警的类型
}
},
// 手动报警再次弹框 再次报警,解除报警指令
alarmCountdown: {
config: {
show: true, // 必须显式设置为true
showIcon: true, // 显示图标
title: '报警倒计时',
icon: '/static/images/6170/svg.png',
message: '59秒',
popupBorder: '1rpx solid rgba(224, 52, 52, 1)',
confirmBtnBg: 'rgba(224, 52, 52, 1)',
cancelBtnColor: "rgba(224, 52, 52, 1)",
confirmBtnColor: "rgba(255, 255, 255, 0.87)",
confirmText: '解除报警',
cancelText: "再次报警",
showCancel: true //取消按钮
},
confirm() {
console.log('解除报警确认');
}
},
// 自动报警
autoAlarm: {
config: {
show: true, // 必须显式设置为true
showIcon: true, // 显示图标
icon: '/static/images/6170/svg.png',
title: '报警信息',
message: '002号设备(ID:123456)\n出现报警', // 使用\n换行
showCountdown: true,
countdownTime: 59,
confirmText: '解除报警',
popupBorder: '1rpx solid rgba(224, 52, 52, 0.3)',
confirmBtnBg: 'rgba(224, 52, 52, 1)',
confirmBtnColor: "rgba(255, 255, 255, 0.87)",
showCancel: false,
},
confirm() {
console.log('自动报警解除报警的弹框');
}
}
}
}
},
methods: {
@ -461,17 +424,18 @@
showPopup(type) {
this.currentPopup = {
show: true,
config: POPUP_CONFIGS[type].config,
callback: POPUP_CONFIGS[type].confirm
config: this.POPUP_CONFIGS[type].config,
callback: this.POPUP_CONFIGS[type].confirm
}
console.log(type, 'typetype');
},
handleConfirm() {
if (this.currentPopup.callback) {
const nextPopupType = this.currentPopup.callback(); // 执行回调并获取下一个弹框类型
this.currentPopup.show = false; // 关闭当前弹框
if (nextPopupType) {
this.showPopup(nextPopupType); // 打开下一个弹框
}
const nextPopupType = this.currentPopup.callback(); // 执行回调并获取下一个弹框类型
this.currentPopup.show = false; // 关闭当前弹框
if (nextPopupType) {
this.showPopup(nextPopupType); // 打开下一个弹框
}
} else {
this.currentPopup.show = false; // 默认关闭
}
@ -486,8 +450,8 @@
case 0:
this.selectMode();
break;
case 1:
this.uploadStartup();
case 1: // 报警声音
this.soundAlarm();
break;
case 2:
this.automaticAlarm();
@ -495,6 +459,9 @@
case 3:
this.manualAlarm();
break;
case 4:
this.uploadStartup();
break;
case 5:
this.alarmTime();
break;
@ -507,6 +474,10 @@
handleRadioSelect(index) {
this.radioSelected = index;
console.log('选中了单选选项:', this.radioList[index]);
},
// 报警声音
soundAlarm() {
},
// 自动报警
automaticAlarm() {
@ -1047,6 +1018,11 @@
margin-bottom: 20rpx;
}
.hr {
border-bottom: 2rpx solid rgba(255, 255, 255, 0.04);
margin-bottom: 10rpx;
}
.info-label {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.87);

View File

@ -35,7 +35,13 @@
<view>
</view>
</view>
<view class="callpolice">
<view class="">设备疑似受到外力碰撞</view>
<view>
<uni-icons type="closeempty" size="15" color="rgba(255, 255, 255, 0.9)"
></uni-icons>
</view>
</view>
<!-- 设备基本信息 -->
<view class="info-card">
<view class="info-row">
@ -44,13 +50,16 @@
</view>
<view class="info-row">
<text class="info-label">设备状态</text>
<text class="info-value status-running">{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus === 2 ? '故障' : '在线' }}</text>
<text
class="info-value status-running">{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus === 2 ? '故障' : '在线' }}</text>
</view>
<view class="info-row">
<text class="info-label">定位信息</text>
<view class="info-value status-running" @click="gpsPosition">
<view class="info-value status-running"> {{ deviceInfo && deviceInfo.longitude ? Number(deviceInfo.longitude).toFixed(4) : '' }}
{{ deviceInfo && deviceInfo.latitude ? Number(deviceInfo.latitude).toFixed(4) : '' }}</view>
<view class="info-value status-running">
{{ deviceInfo && deviceInfo.longitude ? Number(deviceInfo.longitude).toFixed(4) : '' }}
{{ deviceInfo && deviceInfo.latitude ? Number(deviceInfo.latitude).toFixed(4) : '' }}
</view>
<view class="info-value status-running">
<uni-icons @click="toggleForm" type="location" size="17"
color="rgba(255, 255, 255, 0.8)" style="vertical-align: bottom;" />
@ -293,7 +302,7 @@
icon: '/static/images/210/bj_1.png',
message: '确定开启设备声光报警?',
confirmBtnBg: 'rgba(255, 200, 78, 1)',
popupBorder:'1rpx solid rgba(255, 200, 78, 0.3)',
popupBorder: '1rpx solid rgba(255, 200, 78, 0.3)',
showCancel: true
},
confirm() {
@ -308,8 +317,10 @@
registerPersonInfo,
deviceSendMessage,
deviceShareId,
lightModeSettings, //灯模式设置
lightModeSettings, //灯模式设置
auxiliaryLightModeSettings, //辅灯模式
laserModeSettings, //激光模式设置
salaModeSettings, //声光报警
mapReverseGeocoding //地图逆解析
} from '@/api/6075/6075.js'
import {
@ -361,10 +372,10 @@
selectedImage: null, // 添加这个变量来存储选择的图片
file: '',
selectedItemIndex: 0,
radioList: ['M', 'S'],
radioSelected: 0, // -1表示未选中任何项
deviceType: '',
popupType: '', //弹框类型
pendingMainMode: null, // 选中的索引
items: [],
}
},
computed: {
@ -424,19 +435,53 @@
url: '/pages/common/map/index'
})
},
// 激光模式
lasermode() {
this.lightModeC = true
},
// 声光报警
audible() {
this.showPopup('audibleAlarm');
},
// 激光模式
lasermode() {
this.lightModeC = true;
},
// 激光确认框提交
handleBtn() {
if (this.deviceInfo.onlineStatus !== 1) {
uni.showToast({
title: '设备已离线',
icon: 'none'
});
return;
}
const instructValue = this.isLaserOn ? 0 : 1;
let data = {
deviceId: this.computedDeviceId,
instructValue: instructValue,
deviceImei: this.itemInfo.deviceImei,
typeName: this.itemInfo.typeName,
};
laserModeSettings(data).then((res) => {
if (res.code == 200) {
uni.showToast({
icon: 'none',
title: res.msg
});
// 更新状态
this.isLaserOn = !this.isLaserOn;
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
this.lightModeC = false;
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
})
},
//激光取消
handleDisagree() {
this.lightModeC = false
},
// 取消按钮
handleBtn() {
handleDisagree() {
this.lightModeC = false
},
// 主灯模式
@ -531,7 +576,6 @@
this.isFormExpanded = !this.isFormExpanded;
},
onItemClick(index) {
console.log(index, 'index');
const item = this.items[index];
this.selectedItemIndex = index;
this.items = this.items.map((item, i) => ({
@ -539,14 +583,73 @@
selected: i === index
}));
this.pendingMainMode = item.text;
// 主灯
this.currentMainMode = item.text;
// 辅灯
this.currentSubMode = item.text;
console.log(this.pendingMainMode, 'this.pendingMainModethis.pendingMainMode');
},
// 灯光模式的确认
handleSumbit() {
if (this.deviceInfo.onlineStatus !== 1) {
uni.showToast({
title: '设备已离线',
icon: 'none'
});
return;
}
if (this.popupTitle == '主灯模式') {
if (this.selectedItemIndex === null) return;
const selectedItem = this.items[this.selectedItemIndex];
let data = {
deviceId: this.computedDeviceId,
instructValue: selectedItem.instructValue,
deviceImei: this.itemInfo.deviceImei,
typeName: this.itemInfo.typeName,
};
lightModeSettings(data).then((res) => {
if (res.code == 200) {
this.currentMainMode = this.pendingMainMode;
this.selectedItemIndex = selectedItem;
uni.showToast({
title: res.msg,
icon: 'none'
})
uni.hideLoading();
this.lightModeA = false;
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
uni.hideLoading();
}
})
} else {
if (this.selectedItemIndex === null) return;
const selectedItem = this.items[this.selectedItemIndex];
let data = {
deviceId: this.computedDeviceId,
instructValue: selectedItem.instructValue,
deviceImei: this.itemInfo.deviceImei,
typeName: this.itemInfo.typeName,
};
auxiliaryLightModeSettings(data).then((res) => {
if (res.code == 200) {
this.currentSubMode = this.pendingMainMode;
this.selectedItemIndex = selectedItem;
uni.showToast({
title: res.msg,
icon: 'none'
})
uni.hideLoading();
this.lightModeA = false;
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
uni.hideLoading();
}
})
}
this.lightModeA = false
},
// 上传开机画面
@ -605,7 +708,7 @@
});
uni.uploadFile({
url: baseURL + '/app/device/uploadLogo',
url: baseURL + '/app/bjq6075/device/uploadLogo',
filePath: this.selectedImage,
name: 'file',
formData: {
@ -1136,7 +1239,17 @@
margin-left: 40rpx;
}
.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%;

View File

@ -536,6 +536,7 @@
},
// 灯光模式的确认
handleSumbit() {
if (this.deviceInfo.onlineStatus !== 1) {
uni.showToast({
title: '设备已离线',