分享管理修复bug,210历史记录功能开发

This commit is contained in:
fengerli
2025-08-09 17:59:09 +08:00
parent c0bb2bcd9c
commit 0d13f84744
9 changed files with 70 additions and 37 deletions

View File

@ -48,7 +48,6 @@
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
} }
.tab-container { .tab-container {
@ -56,14 +55,12 @@
cursor: pointer; cursor: pointer;
margin-bottom: 40rpx; margin-bottom: 40rpx;
justify-content: space-between; justify-content: space-between;
} }
.tab-item { .tab-item {
font-size: 28rpx; font-size: 28rpx;
padding: 0 30rpx; padding: 0 30rpx;
text-align: center; text-align: center;
} }
.active { .active {

View File

@ -17,7 +17,7 @@
<text>{{ <text>{{
tabs[activeTab].name === '我的分享' tabs[activeTab].name === '我的分享'
? `分享给“${group.sharedTo}”的设备` ? `分享给“${group.sharedTo}”的设备`
: `来自“${group.sharedTo}”分享的设备` : `来自“${group.othersharedTo}”分享的设备`
}}</text> }}</text>
<text class="edit-btn" <text class="edit-btn"
@click="toggleEdit(groupIndex)">{{editingGroup === groupIndex ? '完成' : '编辑'}}</text> @click="toggleEdit(groupIndex)">{{editingGroup === groupIndex ? '完成' : '编辑'}}</text>
@ -41,11 +41,9 @@
<view class="ID"> <view class="ID">
ID:{{item.deviceImei}}</view> ID:{{item.deviceImei}}</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>
@ -54,11 +52,6 @@
</view> </view>
</block> </block>
</view> </view>
<!-- 加载状态提示 -->
<!-- <view class="loading-status">
<text v-if="loading">加载中...</text>
<text v-if="finished">没有更多数据了</text>
</view> -->
</view> </view>
<view v-else class="noDATA"> <view v-else class="noDATA">
<view> <view>
@ -122,10 +115,12 @@
const groups = {}; const groups = {};
this.deviceList.forEach(device => { this.deviceList.forEach(device => {
// 这里假设device.sharedTo是分享目标的手机号 // 这里假设device.sharedTo是分享目标的手机号
const key = device.sharedTo || '未分享'; const key = this.activeTab === 0 ? device.phonenumber : device.otherPhonenumber;
const displayName = this.activeTab === 0 ? device.phonenumber : device.otherPhonenumber;
if (!groups[key]) { if (!groups[key]) {
groups[key] = { groups[key] = {
sharedTo: key, sharedTo: displayName, // 显示用名称
othersharedTo: displayName, // 显示用名称
devices: [] devices: []
}; };
} }
@ -218,7 +213,8 @@
const newDevices = res.rows.map(device => ({ const newDevices = res.rows.map(device => ({
...device, ...device,
showConfirm: false, showConfirm: false,
sharedTo: device.phonenumber || '未分享' sharedTo: device.phonenumber,
othersharedTo: device.otherPhonenumber
})); }));
// 分页处理 // 分页处理
if (this.page === 1) { if (this.page === 1) {

View File

@ -67,7 +67,7 @@
</view> </view>
</view> </view>
<view class="callpolice" v-if="deviceInfo.onlineStatus==1"> <view class="callpolice" v-if="deviceInfo.onlineStatus==0">
<view class="">设备强制报警中</view> <view class="">设备强制报警中</view>
<view> <view>
<uni-icons type="closeempty" size="15" color="rgba(255, 255, 255, 0.9)" <uni-icons type="closeempty" size="15" color="rgba(255, 255, 255, 0.9)"
@ -271,7 +271,21 @@
@confirm="onPopupConfirmPolice" 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
v-if="Progress.show"
@click="closeProgress"
:style="{
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: Progress.maskBgColor,
zIndex: 999
}"
>
<Progress :config="Progress" @click.stop />
</view>
</view> </view>
</template> </template>
@ -285,7 +299,6 @@
lightModeSettings, //灯光模式设置 lightModeSettings, //灯光模式设置
laserModeSettings, //激光模式设置 laserModeSettings, //激光模式设置
lightBrightnessSettings, //灯光亮度设置 lightBrightnessSettings, //灯光亮度设置
mapReverseGeocoding //地图逆解析
} from '@/api/6170/deviceControl.js' } from '@/api/6170/deviceControl.js'
import { import {
baseURL, baseURL,
@ -379,6 +392,9 @@
this.lightModeB = false; this.lightModeB = false;
this.lightModeC = false; this.lightModeC = false;
}, },
closeProgress() {
this.Progress.show = false; // 直接关闭进度条
},
// *******定位****** // *******定位******
gpsPosition(item) { gpsPosition(item) {
// 添加调试日志 // 添加调试日志
@ -409,7 +425,6 @@
cardTouchMove(e) { cardTouchMove(e) {
if (!this.cardRect || e.touches.length === 0) return; if (!this.cardRect || e.touches.length === 0) return;
const deltaX = e.touches[0].clientX - this.touchStartX; const deltaX = e.touches[0].clientX - this.touchStartX;
const deltaY = e.touches[0].clientY - this.touchStartY; const deltaY = e.touches[0].clientY - this.touchStartY;

View File

@ -86,7 +86,7 @@
}, },
getData(val) { getData(val) {
let data = { let data = {
deviceid: val deviceId: val
} }
deviceShareList(data).then((res) => { deviceShareList(data).then((res) => {
if (res.code == 200) { if (res.code == 200) {

View File

@ -31,7 +31,7 @@
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index"> <block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
<uni-swipe-action-item :right-options="Options" <uni-swipe-action-item :right-options="Options"
@click="handleSwipeClick($event, item, index)" class="device-card" @click="handleSwipeClick($event, item, index)" class="device-card"
:style="{ border: item.communicationMode==0 && item.onlineStatus==1 ? '1px solid rgba(224, 52, 52, 1)' : 'none' }"> :style="{ border: item.communicationMode==0 && item.onlineStatus==0 ? '1px solid rgba(224, 52, 52, 1)' : 'none' }">
<view @click.stop="handleFile(item)"> <view @click.stop="handleFile(item)">
<view class="device-header"> <view class="device-header">
<view class="deviceIMG"> <view class="deviceIMG">
@ -54,7 +54,7 @@
</view> </view>
</view> </view>
<view class="device-callpolice" <view class="device-callpolice"
v-if="item.communicationMode==0 && item.onlineStatus==1">报警中</view> v-if="item.communicationMode==0 && item.onlineStatus==0">报警中</view>
<view v-if="item.communicationMode==1"> <view v-if="item.communicationMode==1">
<view class="device-status online">已连接</view> <view class="device-status online">已连接</view>
<view class="device-status unline">未连接</view> <view class="device-status unline">未连接</view>
@ -78,7 +78,7 @@
</scroll-view> </scroll-view>
</view> </view>
<!-- 删除弹框 --> <!-- 删除弹框 -->
<view class="agreement-mask" v-if="deleteShow" @click="closePopup('delete')"> <view class="agreement-mask" v-if="deleteShow" @click="closePopup('delete')" catchtouchmove="true">
<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/dell.png" mode="" class="svg"></image> <image src="/static/images/common/dell.png" mode="" class="svg"></image>
@ -94,7 +94,7 @@
</view> </view>
</view> </view>
<!-- =========重命名============== --> <!-- =========重命名============== -->
<view class="agreement-mask" v-if="RenameModel" @click="closePopup('rename')"> <view class="agreement-mask" v-if="RenameModel" @click="closePopup('rename')" catchtouchmove="true">
<view class="agreement-popupD" @click.stop> <view class="agreement-popupD" @click.stop>
<view class="popup-content"> <view class="popup-content">
<view> <view>
@ -112,9 +112,9 @@
</view> </view>
</view> </view>
<!-- 小提示框 --> <!-- 小提示框 -->
<view class="tooltip-box" v-if="showTooltip"> <view class="tooltip-box" v-if="showTooltip" @click="closePopupTooltip" catchtouchmove="true">
<view class="tooltip-arrow"></view> <view class="tooltip-arrow"></view>
<view class="tooltip-content"> <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" /> <image :src="item.icon" class="item-icon" />
@ -123,9 +123,9 @@
</view> </view>
</view> </view>
<!-- ====分享类型提示框==== --> <!-- ====分享类型提示框==== -->
<view class="tooltip-share" v-if="showshare"> <view class="tooltip-share" v-if="showshare" @click="closePopupTooltip" catchtouchmove="true">
<view class="tooltip-arrow"></view> <view class="tooltip-arrow"></view>
<view class="tooltip-content"> <view class="tooltip-content" @click.stop>
<view class="tooltip-item" v-for="(item, index) in shareItems" :key="index" <view class="tooltip-item" v-for="(item, index) in shareItems" :key="index"
@click="handleshareClick(item)"> @click="handleshareClick(item)">
<image :src="item.icon" class="item-icon" /> <image :src="item.icon" class="item-icon" />
@ -304,13 +304,34 @@
scan() { scan() {
this.showTooltip = !this.showTooltip; this.showTooltip = !this.showTooltip;
}, },
closePopupTooltip() {
this.showTooltip = !this.showTooltip
this.showshare = !this.showshare
},
// 添加设备,扫一扫,蓝牙 // 添加设备,扫一扫,蓝牙
handleMenuClick(item) { handleMenuClick(item) {
this.showTooltip = false; // 关闭弹窗 this.showTooltip = false; // 关闭弹窗
switch (item.action) { switch (item.action) {
case 'scan': case 'scan':
// uni.navigateTo({
// url: '/pages/common/scan/scan'
// });
// 扫一扫
uni.scanCode({
success: (res) => {
console.log('条码内容:' + res.result);
// 跳转并传递扫描结果
uni.navigateTo({ uni.navigateTo({
url: '/pages/common/scan/scan' url: `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(res.result)}`
});
},
fail: (err) => {
console.log('扫码失败', err);
uni.showToast({
title: '扫码失败',
icon: 'none'
});
}
}); });
break; break;
case 'bluetooth': case 'bluetooth':
@ -519,7 +540,7 @@
return item; // 解析失败则返回原 item return item; // 解析失败则返回原 item
} }
const [deviceId, onlineStatus, battery] = messageData.state || []; const [deviceId, onlineStatus, battery] = messageData.state || [];
console.log('我收到消息了没',item.battery); console.log('我收到消息了没', item.battery);
return { return {
...item, ...item,
battery: battery ?? item.battery, battery: battery ?? item.battery,

View File

@ -49,7 +49,6 @@
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>

View File

@ -9,9 +9,13 @@
<!-- 连接中状态 --> <!-- 连接中状态 -->
<view class="connecting-container" v-else> <view class="connecting-container" v-else>
<view class="device-info"> <view class="device-info">
<view> <view class="">
<image src="/static/images/bip.6.png" class="bip"></image> <image src="/static/images/common/svg.png" class="svg"></image>
</view> </view>
<!-- <view>
<image src="/static/images/bip.6.png" class="bip"></image>
</view> -->
<text class="device-name">设备名{{deviceId}}</text> <text class="device-name">设备名{{deviceId}}</text>
<text class="device-model1">ID:{{deviceId}}</text> <text class="device-model1">ID:{{deviceId}}</text>
</view> </view>

View File

@ -6,7 +6,7 @@
<image src="/static/images/common/logo.png" class="logo"></image> <image src="/static/images/common/logo.png" class="logo"></image>
</view> </view>
<view class="user-right"> <view class="user-right">
<view class="user-title">星汉研创</view> <view class="user-title">富源晟科技</view>
<view class="ID">ID:123456</view> <view class="ID">ID:123456</view>
</view> </view>
</view> </view>

View File

@ -191,7 +191,8 @@ class MqttClient {
try { try {
const connectOptions = { const connectOptions = {
timeout: 4, timeout: 10, // 增加连接超时时间,应对网络波动
keepAliveInterval: 30, // 明确设置心跳间隔为30秒
userName: this.options.username, userName: this.options.username,
password: this.options.password, password: this.options.password,
useSSL: false, useSSL: false,