修复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) {
return request({
url: '/app/device/sendAlarmMessage',
url: '/app/bjq/device/sendAlarmMessage',
method: 'post',
data: data
})

View File

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

View File

@ -40,7 +40,12 @@
<view class="ID">
<view class="ID">
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>
</view>
@ -67,7 +72,7 @@
<view class="agreement-mask" v-if="deleteShow" @click="closePopup('delete')">
<view class="agreement-popupC" @click.stop>
<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>
<view class="popup-Title">
{{ tabs[activeTab].name === '我的分享' ? '确定停止分享该设备' : '确定移除他人分享给你的这台设备' }}

View File

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

View File

@ -18,14 +18,20 @@
<view class="battery-v1">
<image src="/static/images/common/dl.png" class="dlIMG"></image>
<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>
<view v-if="deviceInfo.chargeState==1">
<image src="/static/images/common/chargeState.png" class="chargeStateIMG"></image>
</view>
</view>
<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>
@ -101,6 +107,7 @@
<image src="/static/images/6170/jg.png" class="setIMG" mode="aspectFit"></image>
<view>
<view class="battery-v2">激光模式</view>
<view class="mode-v3">{{currentlaserMode}}</view>
</view>
</view>
</view>
@ -256,8 +263,10 @@
<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" />
@confirm="onPopupConfirmPolice" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
</view>
<!-- ===============进度条============== -->
<Progress :config="Progress"></Progress>
</view>
</template>
@ -273,14 +282,14 @@
lightBrightnessSettings, //灯光亮度设置
mapReverseGeocoding //地图逆解析
} from '@/api/6170/deviceControl.js'
import {
getDeviceId
} from '../../../store/BLETools';
import {
baseURL,
getToken,
clientid
} from '@/utils/request'
import {
deviceSendAlarmMessage
} from '@/api/6170/callPolice.js'
export default {
data() {
return {
@ -297,6 +306,7 @@
sliderValue: 25,
lightModeA: false,
currentMainMode: '强光',
currentlaserMode: "关闭",
lightModeB: false,
lightModeC: false, //激光提示框
items: [],
@ -311,10 +321,7 @@
position: '',
code: '',
},
deviceInfo: {
},
deviceInfo: {},
activePermissions: [], // 存储当前设备的权限数组
isSharedDevice: false, // 标记是否来自分享
isRightIconVisible: false,
@ -326,7 +333,24 @@
file: '',
selectedItemIndex: 0,
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: {
@ -448,7 +472,7 @@
this.sliderValue = value;
let data = {
deviceId: this.deviceID,
deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId,
instructValue: this.sliderValue + '.00'
}
lightBrightnessSettings(data).then((res) => {
@ -527,7 +551,7 @@
// 修正这里的赋值错误,应该保存索引而不是文本
this.selectedItemIndex = this.selectedItemIndex;
let data = {
deviceId: this.deviceID,
deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId,
instructValue: selectedItem.instructValue
}
lightModeSettings(data).then((res) => {
@ -551,9 +575,9 @@
},
// 激光确认框提交
handleBtn() {
const instructValue = this.isLaserOn ? 0 : 1;
const instructValue = this.isLaserOn ? 0 : 1;
let data = {
deviceId: this.deviceID,
deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId,
instructValue: instructValue
}
laserModeSettings(data).then((res) => {
@ -562,7 +586,8 @@
icon: 'none',
title: res.msg
})
this.isLaserOn = !this.isLaserOn;
this.isLaserOn = !this.isLaserOn;
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭"; // 更新显示文本
this.lightModeC = false
} else {
uni.showToast({
@ -622,18 +647,20 @@
});
return;
}
// 显示上传中加载提示
uni.showLoading({
title: '上传中...',
mask: true
});
// 显示进度条
this.Progress = {
...this.Progress,
show: true,
curr: 0,
showText: true
};
uni.uploadFile({
url: baseURL + '/app/device/uploadLogo',
url: baseURL + '/app/bjq/device/uploadLogo',
filePath: this.selectedImage,
name: 'file',
formData: {
deviceId: this.deviceID,
deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId,
},
header: {
'Authorization': 'Bearer ' + getToken(),
@ -644,9 +671,6 @@
try {
const responseData = JSON.parse(res.data);
if (responseData.code === 200) {
this.popupType = 'logo'; //弹框类型
this.showPopupFlag = true;
this.popupMessage = '上传成功';
this.selectedImage = '';
this.file = null;
this.lightModeB = false
@ -661,6 +685,7 @@
title: '上传失败',
icon: 'none'
});
this.Progress.show = false; // 上传失败隐藏进度条
} finally {
uni.hideLoading();
}
@ -684,20 +709,23 @@
// 操作说明
operatingInst() {
let id = this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId
uni.navigateTo({
url: `/pages/common/operatingInstruct/index?id=${this.deviceID}`
url: `/pages/common/operatingInstruct/index?id=${id}`
})
},
// 产品参数
productparams() {
let id = this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId
uni.navigateTo({
url: `/pages/common/productDes/index?id=${this.deviceID}`
url: `/pages/common/productDes/index?id=${id}`
})
},
// 操作视频
operatingVideo() {
let id = this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId
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,
position: this.personnelInfo.position,
unitName: this.personnelInfo.unitName,
deviceId: this.deviceID
deviceId: this.apiType === 'listA' ? this.deviceID : this.itemInfo.deviceId,
}
registerPersonInfo(data).then((res) => {
if (res.code == 200) {
@ -761,6 +789,32 @@
this.showPopupFlag = false
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() {
if (!this.messageToSend) {
@ -776,7 +830,9 @@
})
let data = {
sendMsg: this.messageToSend,
deviceIds: [this.deviceID]
//deviceIds: [this.deviceID],
deviceIds: this.apiType === 'listA' ? [this.deviceID] : [this.itemInfo.deviceId],
}
deviceSendMessage(data).then((res) => {
if (res.code == 200) {
@ -892,7 +948,6 @@
setTimeout(() => {
this.fetchDeviceDetail(data.data.id);
}, 20000);
// 这里判断电量低于20%,弹框提示
if (this.deviceInfo.batteryPercentage < 20) {
this.popupType = 'bettery'
@ -900,13 +955,32 @@
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') {
this.fetchDeviceDetail(data.data.id)
} else {
this.fetchSharedDeviceDetail(data.data.deviceId)
// 查分享权限详情
this.fetchSharedDeviceDetail(data.data.id)
}
});
@ -995,6 +1069,12 @@
height: 52rpx;
}
.chargeStateIMG {
width: 27rpx;
height: 37rpx;
margin-left: 10rpx;
}
.cpIMG {
width: 66rpx;
height: 66rpx;

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 B

View File

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