1
0
forked from dyf/APP

修复6170测试中出现的bug

This commit is contained in:
fengerli
2025-08-08 17:34:46 +08:00
parent ae608e04c0
commit 3ab58ac29e
8 changed files with 132 additions and 49 deletions

View File

@ -2,7 +2,7 @@ import request from '@/utils/request'
//报警 //报警
export function deviceSendAlarmMessage(data) { export function deviceSendAlarmMessage(data) {
return request({ return request({
url: '/app/device/sendAlarmMessage', url: '/app/bjq/device/sendAlarmMessage',
method: 'post', method: 'post',
data: data data: data
}) })

View File

@ -2,7 +2,7 @@
import request from '@/utils/request' import request from '@/utils/request'
export function deviceDetail(id) { export function deviceDetail(id) {
return request({ return request({
url: `/app/device/${id}`, url: `/app/bjq/device/${id}`,
method: 'get', method: 'get',
}) })
} }
@ -16,7 +16,7 @@ export function deviceShareId(id) {
// 人员信息登记 // 人员信息登记
export function registerPersonInfo(data) { export function registerPersonInfo(data) {
return request({ return request({
url: `/app/device/registerPersonInfo`, url: `/app/bjq/device/registerPersonInfo`,
method: 'post', method: 'post',
data: data data: data
}) })
@ -24,7 +24,7 @@ export function registerPersonInfo(data) {
// 发送信息 // 发送信息
export function deviceSendMessage(data) { export function deviceSendMessage(data) {
return request({ return request({
url: `/app/device/sendMessage`, url: `/app/bjq/device/sendMessage`,
method: 'post', method: 'post',
data: data data: data
}) })
@ -32,7 +32,7 @@ export function deviceSendMessage(data) {
// 灯光模式设置 // 灯光模式设置
export function lightModeSettings(data) { export function lightModeSettings(data) {
return request({ return request({
url: `/app/device/lightModeSettings`, url: `/app/bjq/device/lightModeSettings`,
method: 'post', method: 'post',
data: data data: data
}) })
@ -40,7 +40,7 @@ export function lightModeSettings(data) {
// 激光模式设置 // 激光模式设置
export function laserModeSettings(data) { export function laserModeSettings(data) {
return request({ return request({
url: `/app/device/laserModeSettings`, url: `/app/bjq/device/laserModeSettings`,
method: 'post', method: 'post',
data: data data: data
}) })
@ -49,7 +49,7 @@ export function laserModeSettings(data) {
export function lightBrightnessSettings(data) { export function lightBrightnessSettings(data) {
return request({ return request({
url: `/app/device/lightBrightnessSettings`, url: `/app/bjq/device/lightBrightnessSettings`,
method: 'post', method: 'post',
data: data data: data
}) })
@ -57,7 +57,7 @@ export function lightBrightnessSettings(data) {
// 地图逆解析 // 地图逆解析
export function mapReverseGeocoding(data) { export function mapReverseGeocoding(data) {
return request({ return request({
url: `/app/device/mapReverseGeocoding`, url: `/app/bjq/device/mapReverseGeocoding`,
method: 'post', method: 'post',
data: data data: data
}) })

View File

@ -40,7 +40,12 @@
<view class="ID"> <view class="ID">
<view class="ID"> <view class="ID">
ID:{{item.deviceImei}}</view> ID:{{item.deviceImei}}</view>
<view class="onlines">在线</view> <!-- 在线状态 -->
<view class="onlines"
v-if="item.onlineStatus==1">在线</view>
<!-- 离线状态 -->
<view class="offlines"
v-if="item.onlineStatus==0">离线</view>
<view>电量{{item.battery || '0'}}%</view> <view>电量{{item.battery || '0'}}%</view>
</view> </view>
</view> </view>
@ -67,7 +72,7 @@
<view class="agreement-mask" v-if="deleteShow" @click="closePopup('delete')"> <view class="agreement-mask" v-if="deleteShow" @click="closePopup('delete')">
<view class="agreement-popupC" @click.stop> <view class="agreement-popupC" @click.stop>
<view class="popup-content"> <view class="popup-content">
<image src="/static/images/common/delel.png" class="svg" mode="aspectFit"></image> <image src="/static/images/common/delel.png" class="svg" mode="aspectFit"></image>
<uni-icon class="trash"></uni-icon> <uni-icon class="trash"></uni-icon>
<view class="popup-Title"> <view class="popup-Title">
{{ tabs[activeTab].name === '我的分享' ? '确定停止分享该设备' : '确定移除他人分享给你的这台设备' }} {{ tabs[activeTab].name === '我的分享' ? '确定停止分享该设备' : '确定移除他人分享给你的这台设备' }}

View File

@ -144,8 +144,7 @@
this.popupType = 'cancel'; this.popupType = 'cancel';
this.popupMessage = '确认要解除所选设备的报警状态?'; this.popupMessage = '确认要解除所选设备的报警状态?';
this.showPopupFlag = true; this.showPopupFlag = true;
this.pendingAlarmAction = 1 this.pendingAlarmAction = 0
}, },
sendAlarmCommand(type) { sendAlarmCommand(type) {
const selectedDevices = this.deviceList.filter(item => item.checked); const selectedDevices = this.deviceList.filter(item => item.checked);
@ -162,11 +161,10 @@
icon: 'none' icon: 'none'
}); });
this.showPopupFlag = false this.showPopupFlag = false
uni.$emit('deviceStatusUpdate', {});
setTimeout(() => { setTimeout(() => {
uni.navigateBack() uni.navigateBack()
}, 500) }, 500)
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,

View File

@ -18,14 +18,20 @@
<view class="battery-v1"> <view class="battery-v1">
<image src="/static/images/common/dl.png" class="dlIMG"></image> <image src="/static/images/common/dl.png" class="dlIMG"></image>
<view> <view>
<view class="battery-v2">{{deviceInfo.batteryPercentage}}%</view> <view class="battery-v2"
:style="{color: deviceInfo.batteryPercentage < 20 ? '#FF0000' : ''}">
{{deviceInfo.batteryPercentage}}%
</view>
<view class="battery-v3">电量</view> <view class="battery-v3">电量</view>
</view> </view>
<view v-if="deviceInfo.chargeState==1">
<image src="/static/images/common/chargeState.png" class="chargeStateIMG"></image>
</view>
</view> </view>
<view class="battery-v1"> <view class="battery-v1">
<image src="/static/images/common/nz.png" class="dlIMG" mode="aspectFit"></image> <image src="/static/images/common/nz.png" class="dlIMG" mode="aspectFit"></image>
<view> <view>
<view class="battery-v2">{{deviceInfo.batteryRemainingTime || '0分钟'}}分钟</view> <view class="battery-v2">{{deviceInfo.batteryRemainingTime || '0'}}分钟</view>
<view class="battery-v3">续航时间</view> <view class="battery-v3">续航时间</view>
</view> </view>
</view> </view>
@ -101,6 +107,7 @@
<image src="/static/images/6170/jg.png" class="setIMG" mode="aspectFit"></image> <image src="/static/images/6170/jg.png" class="setIMG" mode="aspectFit"></image>
<view> <view>
<view class="battery-v2">激光模式</view> <view class="battery-v2">激光模式</view>
<view class="mode-v3">{{currentlaserMode}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -256,8 +263,10 @@
<CustomPopup v-if="popupType === 'cancel'" :show="showPopupFlag" <CustomPopup v-if="popupType === 'cancel'" :show="showPopupFlag"
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="onPopupConfirm" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" /> @confirm="onPopupConfirmPolice" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
</view> </view>
<!-- ===============进度条============== -->
<Progress :config="Progress"></Progress>
</view> </view>
</template> </template>
@ -273,14 +282,14 @@
lightBrightnessSettings, //灯光亮度设置 lightBrightnessSettings, //灯光亮度设置
mapReverseGeocoding //地图逆解析 mapReverseGeocoding //地图逆解析
} from '@/api/6170/deviceControl.js' } from '@/api/6170/deviceControl.js'
import {
getDeviceId
} from '../../../store/BLETools';
import { import {
baseURL, baseURL,
getToken, getToken,
clientid clientid
} from '@/utils/request' } from '@/utils/request'
import {
deviceSendAlarmMessage
} from '@/api/6170/callPolice.js'
export default { export default {
data() { data() {
return { return {
@ -297,6 +306,7 @@
sliderValue: 25, sliderValue: 25,
lightModeA: false, lightModeA: false,
currentMainMode: '强光', currentMainMode: '强光',
currentlaserMode: "关闭",
lightModeB: false, lightModeB: false,
lightModeC: false, //激光提示框 lightModeC: false, //激光提示框
items: [], items: [],
@ -311,10 +321,7 @@
position: '', position: '',
code: '', code: '',
}, },
deviceInfo: { deviceInfo: {},
},
activePermissions: [], // 存储当前设备的权限数组 activePermissions: [], // 存储当前设备的权限数组
isSharedDevice: false, // 标记是否来自分享 isSharedDevice: false, // 标记是否来自分享
isRightIconVisible: false, isRightIconVisible: false,
@ -326,7 +333,24 @@
file: '', file: '',
selectedItemIndex: 0, selectedItemIndex: 0,
popupType: 'person', //弹框类型 popupType: 'person', //弹框类型
isLaserOn: false isLaserOn: false,
// 进度条
Progress: {
show: false, //是否显示
height: '40rpx',
showMask: true, //是否显示mask
maskBgColor: 'rgba(0, 0, 0, 0.5)', // 半透明黑色遮罩
contentBgColor: 'rgba(18, 18, 18, 0.8)', // 主背景带透明度
showText: true, //是否显示当前进度的文字
txtColor: '#ffffffde', //文字的颜色
curr: 20, //当前进度
total: 100, //总进度
proBgColor: '#2a2a2a', //进度条底色,
proBorder: '', //进度条border
currBgColor: '#bbe600', //当前进度底色
currBorder: '', //当前进度border
borderRadius: '10rpx'
}
} }
}, },
computed: { computed: {
@ -448,7 +472,7 @@
this.sliderValue = value; this.sliderValue = value;
let data = { let data = {
deviceId: this.deviceID, deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId,
instructValue: this.sliderValue + '.00' instructValue: this.sliderValue + '.00'
} }
lightBrightnessSettings(data).then((res) => { lightBrightnessSettings(data).then((res) => {
@ -527,7 +551,7 @@
// 修正这里的赋值错误,应该保存索引而不是文本 // 修正这里的赋值错误,应该保存索引而不是文本
this.selectedItemIndex = this.selectedItemIndex; this.selectedItemIndex = this.selectedItemIndex;
let data = { let data = {
deviceId: this.deviceID, deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId,
instructValue: selectedItem.instructValue instructValue: selectedItem.instructValue
} }
lightModeSettings(data).then((res) => { lightModeSettings(data).then((res) => {
@ -551,9 +575,9 @@
}, },
// 激光确认框提交 // 激光确认框提交
handleBtn() { handleBtn() {
const instructValue = this.isLaserOn ? 0 : 1; const instructValue = this.isLaserOn ? 0 : 1;
let data = { let data = {
deviceId: this.deviceID, deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId,
instructValue: instructValue instructValue: instructValue
} }
laserModeSettings(data).then((res) => { laserModeSettings(data).then((res) => {
@ -562,7 +586,8 @@
icon: 'none', icon: 'none',
title: res.msg title: res.msg
}) })
this.isLaserOn = !this.isLaserOn; this.isLaserOn = !this.isLaserOn;
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭"; // 更新显示文本
this.lightModeC = false this.lightModeC = false
} else { } else {
uni.showToast({ uni.showToast({
@ -622,18 +647,20 @@
}); });
return; return;
} }
// 显示上传中加载提示 // 显示进度条
uni.showLoading({ this.Progress = {
title: '上传中...', ...this.Progress,
mask: true show: true,
}); curr: 0,
showText: true
};
uni.uploadFile({ uni.uploadFile({
url: baseURL + '/app/device/uploadLogo', url: baseURL + '/app/bjq/device/uploadLogo',
filePath: this.selectedImage, filePath: this.selectedImage,
name: 'file', name: 'file',
formData: { formData: {
deviceId: this.deviceID, deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId,
}, },
header: { header: {
'Authorization': 'Bearer ' + getToken(), 'Authorization': 'Bearer ' + getToken(),
@ -644,9 +671,6 @@
try { try {
const responseData = JSON.parse(res.data); const responseData = JSON.parse(res.data);
if (responseData.code === 200) { if (responseData.code === 200) {
this.popupType = 'logo'; //弹框类型
this.showPopupFlag = true;
this.popupMessage = '上传成功';
this.selectedImage = ''; this.selectedImage = '';
this.file = null; this.file = null;
this.lightModeB = false this.lightModeB = false
@ -661,6 +685,7 @@
title: '上传失败', title: '上传失败',
icon: 'none' icon: 'none'
}); });
this.Progress.show = false; // 上传失败隐藏进度条
} finally { } finally {
uni.hideLoading(); uni.hideLoading();
} }
@ -684,20 +709,23 @@
// 操作说明 // 操作说明
operatingInst() { operatingInst() {
let id = this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/operatingInstruct/index?id=${this.deviceID}` url: `/pages/common/operatingInstruct/index?id=${id}`
}) })
}, },
// 产品参数 // 产品参数
productparams() { productparams() {
let id = this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/productDes/index?id=${this.deviceID}` url: `/pages/common/productDes/index?id=${id}`
}) })
}, },
// 操作视频 // 操作视频
operatingVideo() { operatingVideo() {
let id = this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/operationVideo/index?id=${this.deviceID}` url: `/pages/common/operationVideo/index?id=${id}`
}) })
}, },
@ -741,7 +769,7 @@
name: this.personnelInfo.name, name: this.personnelInfo.name,
position: this.personnelInfo.position, position: this.personnelInfo.position,
unitName: this.personnelInfo.unitName, unitName: this.personnelInfo.unitName,
deviceId: this.deviceID deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId,
} }
registerPersonInfo(data).then((res) => { registerPersonInfo(data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -761,6 +789,32 @@
this.showPopupFlag = false this.showPopupFlag = false
console.log('用户点击了确定') console.log('用户点击了确定')
}, },
// 解除报警
onPopupConfirmPolice() {
let data = {
deviceIds: this.apiType === 'listA' ? [this.deviceID] : [this.itemInfo.deviceId],
instructValue: 0, // '解除报警'
}
deviceSendAlarmMessage(data).then((res) => {
if (res.code == 200) {
uni.showToast({
title: res.msg,
icon: 'none'
});
this.showPopupFlag = false
setTimeout(() => {
this.fetchDeviceDetail(this.deviceID);
uni.$emit('deviceStatusUpdate', {});
}, 500)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
});
},
// 发送文本消息 // 发送文本消息
sendTextMessage() { sendTextMessage() {
if (!this.messageToSend) { if (!this.messageToSend) {
@ -776,7 +830,9 @@
}) })
let data = { let data = {
sendMsg: this.messageToSend, sendMsg: this.messageToSend,
deviceIds: [this.deviceID] //deviceIds: [this.deviceID],
deviceIds: this.apiType === 'listA' ? [this.deviceID] : [this.itemInfo.deviceId],
} }
deviceSendMessage(data).then((res) => { deviceSendMessage(data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -892,7 +948,6 @@
setTimeout(() => { setTimeout(() => {
this.fetchDeviceDetail(data.data.id); this.fetchDeviceDetail(data.data.id);
}, 20000); }, 20000);
// 这里判断电量低于20%,弹框提示 // 这里判断电量低于20%,弹框提示
if (this.deviceInfo.batteryPercentage < 20) { if (this.deviceInfo.batteryPercentage < 20) {
this.popupType = 'bettery' this.popupType = 'bettery'
@ -900,13 +955,32 @@
this.showPopupFlag = true; this.showPopupFlag = true;
} }
} }
// 处理上传照片进度消息
if (deviceState[0] === 3) {
const progress = deviceState[1];
// 更新进度条
this.Progress = {
...this.Progress,
curr: progress * 2,
show: progress < 50 // 进度达到100时自动隐藏
};
// 当进度为100时显示成功弹框
if (progress === 50) {
this.popupType = 'logo';
this.popupMessage = '上传成功';
this.showPopupFlag = true;
this.lightModeB = false; // 关闭上传弹窗
this.selectedImage = ''; // 清空已选图片
}
}
}); });
}); });
if (this.apiType === 'listA') { if (this.apiType === 'listA') {
this.fetchDeviceDetail(data.data.id) this.fetchDeviceDetail(data.data.id)
} else { } else {
this.fetchSharedDeviceDetail(data.data.deviceId) // 查分享权限详情
this.fetchSharedDeviceDetail(data.data.id)
} }
}); });
@ -995,6 +1069,12 @@
height: 52rpx; height: 52rpx;
} }
.chargeStateIMG {
width: 27rpx;
height: 37rpx;
margin-left: 10rpx;
}
.cpIMG { .cpIMG {
width: 66rpx; width: 66rpx;
height: 66rpx; height: 66rpx;

View File

@ -542,7 +542,7 @@
}); });
// 监听设备状态更新事件 // 监听设备状态更新事件
uni.$on('deviceStatusUpdate', (data) => { uni.$on('deviceStatusUpdate', (data) => {
console.log('收到设备状态更新通知:', data); console.log('列表收到消息了么');
this.onIntall() this.onIntall()
}); });
}, },

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 B

View File

@ -1,5 +1,5 @@
import config from '../config/index.js'; import config from '../config/index.js';
const env = 'production'; //production development //开发of线上 改这里就行 const env = 'development'; //production development //开发of线上 改这里就行
const BASE = config[env]; const BASE = config[env];
const request = (options) => { const request = (options) => {
console.log("options"+JSON.stringify(options),BASE.BASE_URL) console.log("options"+JSON.stringify(options),BASE.BASE_URL)