分享设备相关的功能
This commit is contained in:
31
api/6170/deviceControl.js
Normal file
31
api/6170/deviceControl.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// 获取设备详细信息
|
||||||
|
import request from '@/utils/request'
|
||||||
|
export function deviceDetail(id) {
|
||||||
|
return request({
|
||||||
|
url: `/app/device/${id}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 获取设备分享详细信息
|
||||||
|
export function deviceShareId(id) {
|
||||||
|
return request({
|
||||||
|
url: `/app/deviceShare/${id}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 人员信息登记
|
||||||
|
export function registerPersonInfo(data) {
|
||||||
|
return request({
|
||||||
|
url: `/app/device/registerPersonInfo`,
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 发送信息
|
||||||
|
export function deviceSendMessage(data) {
|
||||||
|
return request({
|
||||||
|
url: `/app/device/sendMessage`,
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
@ -7,13 +7,7 @@ export function deviceShareAdd(data) {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 获取设备分享详细信息
|
|
||||||
export function deviceShareId(id) {
|
|
||||||
return request({
|
|
||||||
url: `/app/deviceShare/${id}`,
|
|
||||||
method: 'get',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 分享短信验证码
|
// 分享短信验证码
|
||||||
export function deviceShareCode(params) {
|
export function deviceShareCode(params) {
|
||||||
return request({
|
return request({
|
||||||
@ -23,7 +17,7 @@ export function deviceShareCode(params) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//设备管理列表
|
//设备管理列表 我的分享
|
||||||
export function deviceShareList(params) {
|
export function deviceShareList(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/app/deviceShare/deviceShareList',
|
url: '/app/deviceShare/deviceShareList',
|
||||||
@ -31,6 +25,14 @@ export function deviceShareList(params) {
|
|||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 他人分享
|
||||||
|
export function otherDeviceShareList(params) {
|
||||||
|
return request({
|
||||||
|
url: '/app/deviceShare/otherDeviceShareList',
|
||||||
|
method: 'get',
|
||||||
|
data: params
|
||||||
|
})
|
||||||
|
}
|
||||||
// 移除设备管理
|
// 移除设备管理
|
||||||
export function deviceShareDelete(ids) {
|
export function deviceShareDelete(ids) {
|
||||||
return request({
|
return request({
|
||||||
|
13
pages.json
13
pages.json
@ -127,6 +127,19 @@
|
|||||||
"navigationBarTitleText": "地图"
|
"navigationBarTitleText": "地图"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/common/allType/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "所有类型"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/6170/allShare/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "所有分享"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"path": "pages/6170/share/index",
|
"path": "pages/6170/share/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
519
pages/6170/allShare/index.vue
Normal file
519
pages/6170/allShare/index.vue
Normal file
@ -0,0 +1,519 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="device-page">
|
||||||
|
<scroll-view class="tab-bar" scroll-x="true" scroll-with-animation>
|
||||||
|
<view class="tab-container">
|
||||||
|
<view v-for="(tab, index) in tabs" :key="index"
|
||||||
|
:class="['tab-item', activeTab === index ? 'active' : '']" @click="switchTab(tab,index)">
|
||||||
|
{{tab.name}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<scroll-view class="device-list" scroll-y @scrolltolower="onScrollToLower" :lower-threshold="100"
|
||||||
|
style="height:80vh">
|
||||||
|
<view v-if="deviceList.length>0">
|
||||||
|
<view v-for="(group, groupIndex) in groupedDevices" :key="groupIndex">
|
||||||
|
<view class="share-header">
|
||||||
|
<text>分享给"{{group.sharedTo}}"的设备</text>
|
||||||
|
<text class="edit-btn"
|
||||||
|
@click="toggleEdit(groupIndex)">{{editingGroup === groupIndex ? '完成' : '编辑'}}</text>
|
||||||
|
</view>
|
||||||
|
<block>
|
||||||
|
|
||||||
|
<view class="device-card" v-for="(item, index) in group.devices" :key="index"
|
||||||
|
:ref="'swipeItem_' + index">
|
||||||
|
<view class="checkbox" v-if="editingGroup === groupIndex">
|
||||||
|
<uni-icons @click="handleDelete(item)" type="minus" size="20" color="#FF4D4F"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="device-content" @click.stop="handleFile(item)">
|
||||||
|
<view class="device-header">
|
||||||
|
<view class="deviceIMG">
|
||||||
|
<image :src="item.devicePic" class="IMG"></image>
|
||||||
|
</view>
|
||||||
|
<view class="device-name">
|
||||||
|
<view>设备:{{item.deviceName}}</view>
|
||||||
|
<view class="ID">
|
||||||
|
<view class="ID">
|
||||||
|
ID:{{item.deviceImei}}</view>
|
||||||
|
<view class="onlines">在线</view>
|
||||||
|
<view>电量:{{item.battery || '80'}}%</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<!-- 加载状态提示 -->
|
||||||
|
<!-- <view class="loading-status">
|
||||||
|
<text v-if="loading">加载中...</text>
|
||||||
|
<text v-if="finished">没有更多数据了</text>
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
<view v-else class="noDATA">
|
||||||
|
<view> <uni-icons type="image-filled" size="120" color="rgba(255, 255, 255, 0.9)"></uni-icons>
|
||||||
|
</view>
|
||||||
|
暂无数据
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
<!-- 删除弹框 -->
|
||||||
|
<view class="agreement-mask" v-if="deleteShow" @click="closePopup('delete')">
|
||||||
|
<view class="agreement-popupC" @click.stop>
|
||||||
|
<view class="popup-content">
|
||||||
|
<image src="/static/images/delel.png" mode="" class="svg"></image>
|
||||||
|
<uni-icon class="trash"></uni-icon>
|
||||||
|
<view>
|
||||||
|
<view class="popup-Title">确定停止分享该设备</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 按钮组 -->
|
||||||
|
<view class="popup-buttons">
|
||||||
|
<button class="btn agreeBtn" @click="handleBtn">确定</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
deviceShareList,
|
||||||
|
otherDeviceShareList,
|
||||||
|
deviceShareDelete
|
||||||
|
} from '@/api/6170/share.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
deviceList: [],
|
||||||
|
tabs: [{
|
||||||
|
name: '我的分享',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '他人分享',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
activeTab: 0,
|
||||||
|
deleteShow: false,
|
||||||
|
page: 1, // 当前页码
|
||||||
|
size: 10, // 每页条数
|
||||||
|
total: 0, // 总数据量
|
||||||
|
loading: false,
|
||||||
|
finished: false,
|
||||||
|
deviceId: '',
|
||||||
|
editingGroup: null, // 编辑的分组索引
|
||||||
|
currentGroup: null // 当前操作的分组
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 根据分享用户分组设备
|
||||||
|
groupedDevices() {
|
||||||
|
const groups = {};
|
||||||
|
this.deviceList.forEach(device => {
|
||||||
|
// 这里假设device.sharedTo是分享目标的手机号
|
||||||
|
const key = device.sharedTo || '未分享';
|
||||||
|
if (!groups[key]) {
|
||||||
|
groups[key] = {
|
||||||
|
sharedTo: key,
|
||||||
|
devices: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
groups[key].devices.push(device);
|
||||||
|
});
|
||||||
|
return Object.values(groups);
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 点击弹框外的区域关闭
|
||||||
|
closePopup(type) {
|
||||||
|
if (type === 'delete') {
|
||||||
|
this.deleteShow = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 跳转到详情页面
|
||||||
|
handleFile(item) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/6170/deviceControl/index",
|
||||||
|
success: (res) => {
|
||||||
|
// 页面跳转成功后的回调函数
|
||||||
|
res.eventChannel.emit('deviceControl', {
|
||||||
|
data: item,
|
||||||
|
apiType: 'listB' // 自定义标识 // 自定义标识,详情哪里根据这个参数不同信息
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
toggleEdit(groupIndex) {
|
||||||
|
if (this.editingGroup === groupIndex) {
|
||||||
|
this.editingGroup = null;
|
||||||
|
} else {
|
||||||
|
this.editingGroup = groupIndex;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 停止分享
|
||||||
|
handleDelete(item) {
|
||||||
|
console.log(item, 'www');
|
||||||
|
this.deleteShow = true
|
||||||
|
this.delelteItemInfo = item
|
||||||
|
},
|
||||||
|
// 确认停止移除
|
||||||
|
handleBtn() {
|
||||||
|
let allId = this.delelteItemInfo.id
|
||||||
|
deviceShareDelete(allId).then((res) => {
|
||||||
|
if (res.code = 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
this.deleteShow = false
|
||||||
|
this.editingGroup = null;
|
||||||
|
this.onIntall()
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
//
|
||||||
|
},
|
||||||
|
// tab切换页
|
||||||
|
switchTab(tab, index) {
|
||||||
|
console.log(tab, 'tabsss');
|
||||||
|
this.deviceList = [];
|
||||||
|
this.activeTab = index;
|
||||||
|
this.page = 1; // 重置页
|
||||||
|
this.getData(tab);
|
||||||
|
},
|
||||||
|
// 获取设备列表
|
||||||
|
getData(tab) {
|
||||||
|
console.log(tab.name, 'tab');
|
||||||
|
if (this.loading) return;
|
||||||
|
this.loading = true;
|
||||||
|
let data = {
|
||||||
|
pageNum: this.page,
|
||||||
|
pageSize: this.size,
|
||||||
|
}
|
||||||
|
// 根据当前tab决定调用哪个接口
|
||||||
|
const apiCall = tab.name === '我的分享' ? deviceShareList : otherDeviceShareList;
|
||||||
|
console.log('nihao');
|
||||||
|
apiCall(data).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
const newDevices = res.rows.map(device => ({
|
||||||
|
...device,
|
||||||
|
showConfirm: false,
|
||||||
|
sharedTo: device.phonenumber || '未分享'
|
||||||
|
}));
|
||||||
|
// 分页处理
|
||||||
|
if (this.page === 1) {
|
||||||
|
this.deviceList = newDevices;
|
||||||
|
} else {
|
||||||
|
this.deviceList = [...this.deviceList, ...newDevices];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.total = res.total;
|
||||||
|
// 判断是否已加载全部数据
|
||||||
|
if (res.rows.length < this.size || this.deviceList.length >= this.total) {
|
||||||
|
this.finished = true;
|
||||||
|
} else {
|
||||||
|
this.page++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
// 滚动触底事件处理
|
||||||
|
onScrollToLower() {
|
||||||
|
this.getData();
|
||||||
|
},
|
||||||
|
onIntall() {
|
||||||
|
this.page = 1;
|
||||||
|
const currentTab = this.tabs[this.activeTab];
|
||||||
|
this.getData(currentTab);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.onIntall()
|
||||||
|
// 绑定页面做了监听,新增成功,刷新页面
|
||||||
|
uni.$on('refreshDeviceList', () => {
|
||||||
|
this.onIntall()
|
||||||
|
});
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
// 组件销毁前移除监听器
|
||||||
|
uni.$off('refreshDeviceList');
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* 页面整体样式 */
|
||||||
|
.device-page {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: rgb(18, 18, 18);
|
||||||
|
padding: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-bar {
|
||||||
|
width: 100%;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
white-space: nowrap;
|
||||||
|
/* 禁止换行 */
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-container {
|
||||||
|
display: flex;
|
||||||
|
/* justify-content: space-around; */
|
||||||
|
cursor: pointer;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
/* min-width: 100%; */
|
||||||
|
/* 最小宽度 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-item {
|
||||||
|
font-size: 28rpx;
|
||||||
|
/* min-width: 120rpx; */
|
||||||
|
padding: 0 30rpx;
|
||||||
|
/* 左右内边距 */
|
||||||
|
text-align: center;
|
||||||
|
/* 文字居中 */
|
||||||
|
/* 设置最小宽度 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.active {
|
||||||
|
color: rgba(187, 230, 0, 1);
|
||||||
|
border-bottom: 6rpx solid rgba(187, 230, 0, 1);
|
||||||
|
height: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 设备卡片 */
|
||||||
|
.device-card {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-content {
|
||||||
|
background-color: rgb(26, 26, 26);
|
||||||
|
border-radius: 16rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
position: relative;
|
||||||
|
padding: 20rpx;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 15rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.device-name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
margin-left: 24rpx;
|
||||||
|
line-height: 50rpx;
|
||||||
|
width: 78%;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ID {
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
font-size: 26rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.circle {
|
||||||
|
width: 8rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
position: absolute;
|
||||||
|
right: 25rpx;
|
||||||
|
top: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.online {
|
||||||
|
color: rgb(187, 230, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.deviceIMG {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
position: relative;
|
||||||
|
background-color: rgba(42, 42, 42, 0.6);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.IMG {
|
||||||
|
width: 68rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
margin-left: 17%;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.onlines {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.onlines::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
width: 15rpx;
|
||||||
|
height: 15rpx;
|
||||||
|
background: rgb(0, 171, 103);
|
||||||
|
border-radius: 50%;
|
||||||
|
top: 20rpx;
|
||||||
|
left: -20rpx
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
width: 2rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
background: linear-gradient(90deg,
|
||||||
|
rgba(0, 0, 0, 0) 0%,
|
||||||
|
rgb(255, 255, 255) 50%,
|
||||||
|
rgba(255, 255, 255, 0) 100%);
|
||||||
|
margin-top: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-status {
|
||||||
|
text-align: center;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
padding: 20rpx;
|
||||||
|
font-size: 22rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.noDATA {
|
||||||
|
text-align: center;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
transform: translate(-0%, 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
font-size: 28rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-btn {
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 遮罩层 */
|
||||||
|
.agreement-mask {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-Title {
|
||||||
|
color: rgba(255, 255, 255, 0.86);
|
||||||
|
text-align: center;
|
||||||
|
padding: 30rpx 0rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-buttons {
|
||||||
|
display: flex;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 弹窗主体 */
|
||||||
|
.agreement-popup {
|
||||||
|
width: 100%;
|
||||||
|
height: 50%;
|
||||||
|
background-color: rgb(42, 42, 42);
|
||||||
|
border-radius: 60rpx 60rpx 0rpx 0rpx;
|
||||||
|
padding: 40rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-popupC {
|
||||||
|
width: 60%;
|
||||||
|
background-color: rgb(42, 42, 42);
|
||||||
|
border-radius: 40rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid rgba(255, 200, 78, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-flex {
|
||||||
|
display: flex;
|
||||||
|
white-space: nowrap;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
height: 50rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-input {
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.4);
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin-left: 15rpx;
|
||||||
|
padding: 10rpx 0rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg {
|
||||||
|
width: 58rpx;
|
||||||
|
height: 62rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 通用按钮样式 */
|
||||||
|
.btn {
|
||||||
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
margin: 10rpx auto;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 同意按钮 */
|
||||||
|
.agreeBtn {
|
||||||
|
background: rgba(224, 52, 52, 1);
|
||||||
|
color: #232323;
|
||||||
|
border: none;
|
||||||
|
width: 170rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.closeBtn {
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
|
background-color: rgba(35, 35, 35, 0.87);
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,13 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
|
<!-- 添加全局加载遮罩 -->
|
||||||
|
<view v-if="pageLoading" class="page-loading-mask">
|
||||||
|
</view>
|
||||||
<!-- 使用自定义导航栏 -->
|
<!-- 使用自定义导航栏 -->
|
||||||
<custom-navbar :title="navTitle" :showBack="true" color="#FFFFFF" rightIcon="/static/images/shape.png"
|
<view v-show="!pageLoading">
|
||||||
|
<custom-navbar :title="navTitle" :showBack="true" color="#FFFFFF"
|
||||||
|
:rightIcon="isRightIconVisible ? '/static/images/shape.png' : ''"
|
||||||
@right-click="shareUp"></custom-navbar>
|
@right-click="shareUp"></custom-navbar>
|
||||||
<view class="device-detail-container" :style="{ paddingTop: navBarHeight + 'px' }">
|
<view class="device-detail-container" :style="{ paddingTop: navBarHeight + 'px' }">
|
||||||
<!-- 设备电量信息 -->
|
<!-- 设备电量信息 -->
|
||||||
<view class="battery-section">
|
<view class="battery-section">
|
||||||
<view class="battery-sectionLeft">
|
<view class="battery-sectionLeft">
|
||||||
<image :src="itemInfo.devicePic" class="bipImg"></image>
|
<image :src="deviceInfo.devicePic" class="bipImg"></image>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view class="battery-v1">
|
<view class="battery-v1">
|
||||||
@ -26,7 +31,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -34,7 +38,7 @@
|
|||||||
<view class="info-card">
|
<view class="info-card">
|
||||||
<view class="info-row">
|
<view class="info-row">
|
||||||
<text class="info-label">IMEI号</text>
|
<text class="info-label">IMEI号</text>
|
||||||
<text class="info-value">123456</text>
|
<text class="info-value">{{deviceInfo.deviceImei}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-row">
|
<view class="info-row">
|
||||||
<text class="info-label">设备状态</text>
|
<text class="info-label">设备状态</text>
|
||||||
@ -65,7 +69,7 @@
|
|||||||
<!-- 灯光模式选择 -->
|
<!-- 灯光模式选择 -->
|
||||||
<view class="mode-section">
|
<view class="mode-section">
|
||||||
<view class="mode-buttons">
|
<view class="mode-buttons">
|
||||||
<view class="mode-v1">
|
<view class="mode-v1" v-if="hasPermission('1')">
|
||||||
<view class="mode-v2" @click="selectMode('main')">
|
<view class="mode-v2" @click="selectMode('main')">
|
||||||
<image src="/static/images/set.png" class="setIMG"></image>
|
<image src="/static/images/set.png" class="setIMG"></image>
|
||||||
<view>
|
<view>
|
||||||
@ -74,7 +78,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mode-v1">
|
<view class="mode-v1" v-if="hasPermission('2')">
|
||||||
<view class="mode-v2" @click="lasermode">
|
<view class="mode-v2" @click="lasermode">
|
||||||
<image src="/static/images/jg.png" class="setIMG"></image>
|
<image src="/static/images/jg.png" class="setIMG"></image>
|
||||||
<view>
|
<view>
|
||||||
@ -83,7 +87,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mode-v1">
|
<view class="mode-v1" v-if="hasPermission('3')">
|
||||||
<view class="mode-v2" @click="uploadStartup">
|
<view class="mode-v2" @click="uploadStartup">
|
||||||
<image src="/static/images/path7.png" class="setIMG"></image>
|
<image src="/static/images/path7.png" class="setIMG"></image>
|
||||||
<view>
|
<view>
|
||||||
@ -96,7 +100,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 人员信息登记 -->
|
<!-- 人员信息登记 -->
|
||||||
<view class="form-section">
|
<view class="form-section" v-if="hasPermission('4')">
|
||||||
<view class="mode-buttons">
|
<view class="mode-buttons">
|
||||||
<view class="section-title">人员信息登记</view>
|
<view class="section-title">人员信息登记</view>
|
||||||
<!-- <button class="send-btn">发送</button> -->
|
<!-- <button class="send-btn">发送</button> -->
|
||||||
@ -109,7 +113,7 @@
|
|||||||
<button class="send-btn1" @click="sendPersonnelInfo">发送</button>
|
<button class="send-btn1" @click="sendPersonnelInfo">发送</button>
|
||||||
<view class="form-row">
|
<view class="form-row">
|
||||||
<text class="form-label">单位:</text>
|
<text class="form-label">单位:</text>
|
||||||
<input class="form-input" placeholder="请输入单位" v-model="personnelInfo.unit" />
|
<input class="form-input" placeholder="请输入单位" v-model="personnelInfo.unitName" />
|
||||||
</view>
|
</view>
|
||||||
<view class="form-row">
|
<view class="form-row">
|
||||||
<text class="form-label">姓名:</text>
|
<text class="form-label">姓名:</text>
|
||||||
@ -121,12 +125,12 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="form-row">
|
<view class="form-row">
|
||||||
<text class="form-label">ID:</text>
|
<text class="form-label">ID:</text>
|
||||||
<input class="form-input" placeholder="请输入ID号" v-model="personnelInfo.id" />
|
<input class="form-input" placeholder="请输入ID号" v-model="personnelInfo.code" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 人员信息登记 -->
|
<!-- 人员信息登记 -->
|
||||||
<view class="form-section">
|
<view class="form-section" v-if="hasPermission('5')">
|
||||||
<view class="mode-buttons">
|
<view class="mode-buttons">
|
||||||
<view class="section-title">发送信息</view>
|
<view class="section-title">发送信息</view>
|
||||||
<button class="send-btn" @click="sendTextMessage">发送</button>
|
<button class="send-btn" @click="sendTextMessage">发送</button>
|
||||||
@ -137,6 +141,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 产品信息 -->
|
<!-- 产品信息 -->
|
||||||
|
<view v-if="hasPermission('6')">
|
||||||
<view class="section-title">产品信息</view>
|
<view class="section-title">产品信息</view>
|
||||||
<view class="mode-buttons">
|
<view class="mode-buttons">
|
||||||
<view class="mode_1" @click="productparams">
|
<view class="mode_1" @click="productparams">
|
||||||
@ -153,6 +158,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
<!-- 弹框 -->
|
<!-- 弹框 -->
|
||||||
<view class="agreement-mask" v-if="lightModeA">
|
<view class="agreement-mask" v-if="lightModeA">
|
||||||
<!-- 协议弹窗 -->
|
<!-- 协议弹窗 -->
|
||||||
@ -213,14 +219,25 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MqttClient from '@/utils/mqtt.js';
|
import MqttClient from '@/utils/mqtt.js';
|
||||||
|
import {
|
||||||
|
deviceDetail,
|
||||||
|
registerPersonInfo,
|
||||||
|
deviceSendMessage,
|
||||||
|
deviceShareId
|
||||||
|
} from '@/api/6170/deviceControl.js'
|
||||||
|
import {
|
||||||
|
getDeviceId
|
||||||
|
} from '../../../store/BLETools';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
pageLoading: true,
|
||||||
mainMode: 'string',
|
mainMode: 'string',
|
||||||
secondaryMode: 'string',
|
secondaryMode: 'string',
|
||||||
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
||||||
@ -238,11 +255,22 @@
|
|||||||
mqttClient: null,
|
mqttClient: null,
|
||||||
messageToSend: '',
|
messageToSend: '',
|
||||||
personnelInfo: {
|
personnelInfo: {
|
||||||
unit: '',
|
unitName: '',
|
||||||
name: '',
|
name: '',
|
||||||
position: '',
|
position: '',
|
||||||
id: ''
|
code: '',
|
||||||
}
|
},
|
||||||
|
deviceInfo: {},
|
||||||
|
modeInstructions: {
|
||||||
|
'关灯': [1, 0, 0, 0, 0],
|
||||||
|
'强光': [1, 1, 0, 0, 0],
|
||||||
|
'弱光': [1, 2, 0, 0, 0],
|
||||||
|
'爆闪': [1, 3, 0, 0, 0],
|
||||||
|
'泛光': [1, 4, 0, 0, 0]
|
||||||
|
},
|
||||||
|
activePermissions: [], // 存储当前设备的权限数组
|
||||||
|
isSharedDevice: false, // 标记是否来自分享
|
||||||
|
isRightIconVisible: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -292,29 +320,32 @@
|
|||||||
|
|
||||||
onItemClick(index) {
|
onItemClick(index) {
|
||||||
const selectedItem = this.items[index];
|
const selectedItem = this.items[index];
|
||||||
console.log(selectedItem.text, 'selectedItem.text');
|
|
||||||
if (selectedItem.text === '激光') {
|
if (selectedItem.text === '激光') {
|
||||||
this.lightModeC = true
|
this.lightModeC = true
|
||||||
this.selectedItemIndex = index; // 记录当前选择的索引
|
this.selectedItemIndex = index; // 记录当前选择的索引
|
||||||
} else {
|
} else {
|
||||||
this.updateSelectedItem(index);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
updateSelectedItem(index) {
|
|
||||||
this.items = this.items.map((item, i) => ({
|
this.items = this.items.map((item, i) => ({
|
||||||
...item,
|
...item,
|
||||||
selected: i === index
|
selected: i === index
|
||||||
}));
|
}));
|
||||||
if (this.modeType === 'main') {
|
// 记录当前选中的 index,但不发送
|
||||||
this.currentMainMode = this.items[index].text + '模式';
|
this.selectedItemIndex = index;
|
||||||
} else {
|
console.log(selectedItem.text, 'selectedItem.text');
|
||||||
this.currentSecondaryMode = this.items[index].text + '模式';
|
|
||||||
}
|
}
|
||||||
this.showPopup = false; // 关闭弹窗
|
|
||||||
},
|
},
|
||||||
// 确认
|
// 灯光模式的确认
|
||||||
handleSumbit() {
|
handleSumbit() {
|
||||||
this.lightModeA = false
|
if (this.selectedItemIndex === null) return;
|
||||||
|
const selectedItem = this.items[this.selectedItemIndex];
|
||||||
|
const instruction = this.modeInstructions[selectedItem.text];
|
||||||
|
if (instruction) {
|
||||||
|
const topic = `B/${this.itemInfo.deviceImei}`;
|
||||||
|
const message = JSON.stringify(instruction);
|
||||||
|
this.mqttClient.publish(topic, message);
|
||||||
|
console.log('已发送指令:', instruction);
|
||||||
|
}
|
||||||
|
this.lightModeA = false;
|
||||||
|
// this.lightModeA = false
|
||||||
},
|
},
|
||||||
// 上传开机画面
|
// 上传开机画面
|
||||||
uploadStartup() {
|
uploadStartup() {
|
||||||
@ -358,42 +389,87 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
// 同意
|
// 激光确认框
|
||||||
handleBtn() {
|
handleBtn() {
|
||||||
this.lightModeC = false
|
this.lightModeC = false
|
||||||
this.updateSelectedItem(this.selectedItemIndex); // 使用记录的索引来更新选择项
|
|
||||||
this.lightModeA = false //关闭大弹框
|
|
||||||
},
|
},
|
||||||
// 不同意
|
//取消
|
||||||
handleDisagree() {
|
handleDisagree() {
|
||||||
this.lightModeC = false
|
this.lightModeC = false
|
||||||
},
|
},
|
||||||
// 发送人员信息
|
// 发送人员信息
|
||||||
sendPersonnelInfo() {
|
sendPersonnelInfo() {
|
||||||
if (!this.mqttClient || !this.mqttClient.client.isConnected()) {
|
// if (!this.mqttClient || !this.mqttClient.client.isConnected()) {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: 'MQTT未连接',
|
||||||
|
// icon: 'none'
|
||||||
|
// });
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// const topic = `device/command/${this.deviceID}/personnel`;
|
||||||
|
// const message = JSON.stringify(this.personnelInfo);
|
||||||
|
// this.mqttClient.publish(topic, message);
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '人员信息已发送',
|
||||||
|
// icon: 'success'
|
||||||
|
// });
|
||||||
|
|
||||||
|
if (!this.personnelInfo.unitName) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: 'MQTT未连接',
|
title: '单位名称不能为空',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const topic = `device/command/${this.deviceID}/personnel`;
|
if (!this.personnelInfo.name) {
|
||||||
const message = JSON.stringify(this.personnelInfo);
|
|
||||||
this.mqttClient.publish(topic, message);
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '人员信息已发送',
|
title: '姓名不能为空',
|
||||||
icon: 'success'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.personnelInfo.position) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '职位不能为空',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.personnelInfo.code) {
|
||||||
|
uni.showToast({
|
||||||
|
title: 'ID不能为空',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({
|
||||||
|
title: '发送中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
let data = {
|
||||||
|
code: this.personnelInfo.code,
|
||||||
|
name: this.personnelInfo.name,
|
||||||
|
position: this.personnelInfo.position,
|
||||||
|
unitName: this.personnelInfo.unitName,
|
||||||
|
deviceId: this.deviceID
|
||||||
|
}
|
||||||
|
registerPersonInfo(data).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 发送文本消息
|
// 发送文本消息
|
||||||
sendTextMessage() {
|
sendTextMessage() {
|
||||||
if (!this.mqttClient || !this.mqttClient.client.isConnected()) {
|
|
||||||
uni.showToast({
|
|
||||||
title: 'MQTT未连接',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!this.messageToSend) {
|
if (!this.messageToSend) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请输入要发送的文字',
|
title: '请输入要发送的文字',
|
||||||
@ -401,29 +477,113 @@
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const topic = `device/command/${this.deviceID}/message`;
|
uni.showLoading({
|
||||||
this.mqttClient.publish(topic, this.messageToSend);
|
title: '发送中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
let data = {
|
||||||
|
sendMsg: this.messageToSend,
|
||||||
|
deviceIds: [this.deviceID]
|
||||||
|
}
|
||||||
|
deviceSendMessage(data).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '消息已发送',
|
title: res.msg,
|
||||||
icon: 'success'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// const topic = `device/command/${this.deviceID}/message`;
|
||||||
|
// this.mqttClient.publish(topic, this.messageToSend);
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '消息已发送',
|
||||||
|
// icon: 'success'
|
||||||
|
// });
|
||||||
|
},
|
||||||
|
// 统一处理返回方法
|
||||||
|
handleDeviceData(res, isFromShared = false) {
|
||||||
|
if (res.code == 200) {
|
||||||
|
// 最后关闭加载状态
|
||||||
|
this.pageLoading = false
|
||||||
|
this.deviceInfo = res.data
|
||||||
|
this.personnelInfo = {
|
||||||
|
unitName: res.data.personnelInfo?.unitName || '',
|
||||||
|
name: res.data.personnelInfo?.name || '',
|
||||||
|
code: res.data.personnelInfo?.code || '',
|
||||||
|
position: res.data.personnelInfo?.position || '',
|
||||||
|
}
|
||||||
|
// 将权限字符串转换为数组 ["1", "2"]
|
||||||
|
if (isFromShared) {
|
||||||
|
this.isSharedDevice = true
|
||||||
|
this.activePermissions = res.data.permission ?
|
||||||
|
res.data.permission.split(',') : []
|
||||||
|
} else {
|
||||||
|
this.isSharedDevice = false
|
||||||
|
this.activePermissions = [] // 非分享设备清空权限
|
||||||
|
}
|
||||||
|
this.messageToSend = res.data.sendMsg || ''
|
||||||
|
// 关闭加载中
|
||||||
|
uni.hideLoading()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 检查权限的方法
|
||||||
|
hasPermission(permissionCode) {
|
||||||
|
// 如果还在加载中,直接返回false
|
||||||
|
if (this.pageLoading) return false
|
||||||
|
// 如果不是分享设备,默认有全部权限
|
||||||
|
if (!this.isSharedDevice) return true
|
||||||
|
return this.activePermissions.includes(permissionCode)
|
||||||
|
},
|
||||||
|
// 获取设备详情(普通详情)
|
||||||
|
async fetchDeviceDetail(id) {
|
||||||
|
try {
|
||||||
|
const res = await deviceDetail(id)
|
||||||
|
this.handleDeviceData(res, false)
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取详情失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取分享设备详情
|
||||||
|
async fetchSharedDeviceDetail(id) {
|
||||||
|
try {
|
||||||
|
const res = await deviceShareId(id)
|
||||||
|
this.handleDeviceData(res, true)
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取分享详情失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const eventChannel = this.getOpenerEventChannel();
|
const eventChannel = this.getOpenerEventChannel();
|
||||||
// 监听 'detailData' 事件,获取传过来的数据
|
// 监听 'detailData' 事件,获取传过来的数据
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...'
|
||||||
|
})
|
||||||
eventChannel.on('deviceControl', (data) => {
|
eventChannel.on('deviceControl', (data) => {
|
||||||
this.itemInfo = data.data;
|
this.itemInfo = data.data;
|
||||||
this.deviceID = data.data.id;
|
this.deviceID = data.data.id;
|
||||||
this.navTitle = data.data.deviceName;
|
this.navTitle = data.data.deviceName;
|
||||||
console.log('Received detail data:', this.navTitle);
|
this.apiType = data.apiType
|
||||||
|
// 根据 apiType 设置右图标的显示状态
|
||||||
|
this.isRightIconVisible = this.apiType === 'listA';
|
||||||
// 初始化并连接MQTT
|
// 初始化并连接MQTT
|
||||||
this.mqttClient = new MqttClient();
|
this.mqttClient = new MqttClient();
|
||||||
this.mqttClient.connect(() => {
|
this.mqttClient.connect(() => {
|
||||||
console.log('MQTT 连接成功,开始订阅主题');
|
console.log('MQTT 连接成功,开始订阅主题');
|
||||||
// 订阅来自设备的状态更新
|
// 订阅来自设备的状态更新
|
||||||
const statusTopic = `device/status/${this.deviceID}`;
|
const statusTopic = `A/${this.itemInfo.deviceImei}`;
|
||||||
this.mqttClient.subscribe(statusTopic, (payload) => {
|
this.mqttClient.subscribe(statusTopic, (payload) => {
|
||||||
console.log(`收到来自 ${statusTopic} 的消息:`, payload);
|
console.log(`收到来自 ${statusTopic} 的消息:`, payload);
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@ -433,9 +593,16 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
if (this.apiType === 'listA') {
|
||||||
|
this.fetchDeviceDetail(data.data.id)
|
||||||
|
} else {
|
||||||
|
this.fetchSharedDeviceDetail(data.data.deviceId)
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
// 如果需要向调用页面返回数据,可以触发 'ack' 事件
|
// 如果需要向调用页面返回数据,可以触发 'ack' 事件
|
||||||
eventChannel.emit('ack', {})
|
eventChannel.emit('ack', {})
|
||||||
|
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
// 页面卸载时断开MQTT连接
|
// 页面卸载时断开MQTT连接
|
||||||
@ -448,6 +615,24 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.page-loading-mask {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #121212;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
/* 优化权限控制区域的显示 */
|
||||||
|
.mode-section,
|
||||||
|
.form-section {
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
.device-detail-container {
|
.device-detail-container {
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
background: #121212;
|
background: #121212;
|
||||||
|
@ -39,7 +39,15 @@
|
|||||||
// 分享管理
|
// 分享管理
|
||||||
shareManagement(){
|
shareManagement(){
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/6170/shareManagement/index'
|
url: '/pages/6170/shareManagement/index',
|
||||||
|
events: {
|
||||||
|
ack: function(data) {}
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
res.eventChannel.emit('shareManagement', {
|
||||||
|
data: this.itemInfo,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -109,8 +109,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
deviceInfo: {},
|
deviceInfo: {},
|
||||||
phone: '13058067817',
|
phone: '',
|
||||||
code: '123456',
|
code: '',
|
||||||
itemInfo: ''
|
itemInfo: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -227,7 +227,7 @@
|
|||||||
handleBtn() {
|
handleBtn() {
|
||||||
this.shareShow = false
|
this.shareShow = false
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/6170/shareManagement/index'
|
url: '/pages/6170/allShare/index'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<view class="share">
|
<view class="share">
|
||||||
<view class="device-title">已分享用户</view>
|
<view class="device-title">已分享用户</view>
|
||||||
<view class="device-info" v-for="(item, index) in deviceList" :key="index">
|
<view class="device-info" v-for="(item, index) in deviceList" :key="index">
|
||||||
<view class="device-header">
|
<view class="device-header" @click.stop="handleFile(item)">
|
||||||
<view class="deviceIMG">
|
<view class="deviceIMG">
|
||||||
<image :src="item.devicePic" mode="" class="IMG"></image>
|
<image :src="item.devicePic" mode="" class="IMG"></image>
|
||||||
</view>
|
</view>
|
||||||
@ -13,8 +13,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="device-delete" >
|
<view class="device-delete">
|
||||||
<text class="delete" @click="handleDelete(item)">移除</text>
|
<text class="delete" @click.stop="handleDelete(item)">移除</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -38,55 +38,85 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {deviceShareList,deviceShareDelete} from '@/api/6170/share.js'
|
import {
|
||||||
|
deviceShareList,
|
||||||
|
deviceShareDelete
|
||||||
|
} from '@/api/6170/share.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
deviceList: [],
|
deviceList: [],
|
||||||
deleteShow:false,
|
deleteShow: false,
|
||||||
delelteItemInfo:''
|
delelteItemInfo: '',
|
||||||
|
itemInfo: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 点击弹框外的区域关闭
|
||||||
|
closePopup(type) {
|
||||||
|
if (type === 'delete') {
|
||||||
|
this.deleteShow = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
// 删除
|
// 删除
|
||||||
handleDelete(item) {
|
handleDelete(item) {
|
||||||
console.log(item,'www');
|
console.log(item, 'www');
|
||||||
this.deleteShow=true
|
this.deleteShow = true
|
||||||
this.delelteItemInfo=item
|
this.delelteItemInfo = item
|
||||||
},
|
},
|
||||||
handleBtn(){
|
handleBtn() {
|
||||||
let allId=this.delelteItemInfo.id
|
let allId = this.delelteItemInfo.id
|
||||||
deviceShareDelete(allId).then((res)=>{
|
deviceShareDelete(allId).then((res) => {
|
||||||
if (res.code=200) {
|
if (res.code = 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:res.msg,
|
title: res.msg,
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
this.deleteShow=false
|
this.deleteShow = false
|
||||||
this.getData()
|
this.getData()
|
||||||
} else{
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:res.msg,
|
title: res.msg,
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
//
|
//
|
||||||
},
|
},
|
||||||
getData(){
|
getData(val) {
|
||||||
let data ={
|
let data = {
|
||||||
|
deviceid: val
|
||||||
}
|
}
|
||||||
deviceShareList(data).then((res)=>{
|
deviceShareList(data).then((res) => {
|
||||||
if (res.code==200) {
|
if (res.code == 200) {
|
||||||
this.deviceList=res.rows
|
this.deviceList = res.rows
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 跳转分享详情
|
||||||
|
handleFile(item) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/6170/deviceControl/index",
|
||||||
|
success: (res) => {
|
||||||
|
// 页面跳转成功后的回调函数
|
||||||
|
res.eventChannel.emit('deviceControl', {
|
||||||
|
data: item,
|
||||||
|
apiType: 'listB' // 自定义标识 // 自定义标识,详情哪里根据这个参数不同信息
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.getData()
|
const eventChannel = this.getOpenerEventChannel();
|
||||||
|
// 监听 'shareDevice' 事件,获取传过来的数据
|
||||||
|
eventChannel.on('shareManagement', (data) => {
|
||||||
|
console.log(data, 'data1t111');
|
||||||
|
this.itemInfo = data.data;
|
||||||
|
this.getData(this.itemInfo.id)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -97,6 +127,7 @@
|
|||||||
background: #121212;
|
background: #121212;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.device-title {
|
.device-title {
|
||||||
color: rgba(255, 255, 255, 0.87);
|
color: rgba(255, 255, 255, 0.87);
|
||||||
padding: 30rpx 0;
|
padding: 30rpx 0;
|
||||||
@ -173,6 +204,7 @@
|
|||||||
background: rgba(26, 26, 26, 1);
|
background: rgba(26, 26, 26, 1);
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 遮罩层 */
|
/* 遮罩层 */
|
||||||
.agreement-mask {
|
.agreement-mask {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@ -186,11 +218,13 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-Title {
|
.popup-Title {
|
||||||
color: rgba(255, 255, 255, 0.86);
|
color: rgba(255, 255, 255, 0.86);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 30rpx 0rpx;
|
padding: 30rpx 0rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-buttons {
|
.popup-buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -205,6 +239,7 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
border: 1px solid rgba(255, 200, 78, 0.3);
|
border: 1px solid rgba(255, 200, 78, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.svg {
|
.svg {
|
||||||
width: 58rpx;
|
width: 58rpx;
|
||||||
height: 62rpx;
|
height: 62rpx;
|
||||||
|
95
pages/common/allType/index.vue
Normal file
95
pages/common/allType/index.vue
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<template>
|
||||||
|
<view class="alltype">
|
||||||
|
<!-- 车辆列表 -->
|
||||||
|
<view class="vehicle-list">
|
||||||
|
<view v-for="(item, index) in vehicles" :key="index">
|
||||||
|
<view class="vehicle-item" @click="alltypeInfo(item)">
|
||||||
|
<image src="/static/images/bip.6.png" mode="" class="IMG"></image>
|
||||||
|
</view>
|
||||||
|
<view class="plate-number">{{ item.typeName }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
deviceTypeList,
|
||||||
|
} from '@/api/common/index.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
vehicles: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getTab() {
|
||||||
|
deviceTypeList({}).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.vehicles = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
alltypeInfo(item){
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/common/index/index',
|
||||||
|
success: (res) => {
|
||||||
|
res.eventChannel.emit('index', {
|
||||||
|
data: item
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.getTab()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.alltype {
|
||||||
|
padding: 30rpx;
|
||||||
|
background: rgba(18, 18, 18, 1);
|
||||||
|
min-height: 100vh;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-family: PingFang SC, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vehicle-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vehicle-item {
|
||||||
|
padding: 24rpx 0;
|
||||||
|
background: rgba(26, 26, 26, 1);
|
||||||
|
border-radius: 16rpx;
|
||||||
|
width: 156rpx;
|
||||||
|
height: 156rpx;
|
||||||
|
margin-right: 16rpx;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
line-height: 156rpx;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.IMG {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plate-number {
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
}
|
||||||
|
</style>
|
@ -12,8 +12,11 @@
|
|||||||
{{tab.typeName}}
|
{{tab.typeName}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="uniui-more" >
|
||||||
|
<image @click="allMore" src="/static/images/more.png" mode="" class="more"></image>
|
||||||
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<view class="sendFlex" v-if="activeTab && activeTab.id !== ''">
|
<view class="sendFlex" v-if="activeTab && activeTab.id !== '' ||activeTab.communicationMode==0">
|
||||||
<view class="callpolice">报警</view>
|
<view class="callpolice">报警</view>
|
||||||
<view class="Sendmessage" @click="location">位置</view>
|
<view class="Sendmessage" @click="location">位置</view>
|
||||||
<view class="Sendmessage" @click="handleSend">发送信息</view>
|
<view class="Sendmessage" @click="handleSend">发送信息</view>
|
||||||
@ -109,6 +112,17 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- ====分享,类型提示框==== -->
|
||||||
|
<view class="tooltip-share" v-if="showshare">
|
||||||
|
<view class="tooltip-arrow"></view>
|
||||||
|
<view class="tooltip-content">
|
||||||
|
<view class="tooltip-item" v-for="(item, index) in shareItems" :key="index"
|
||||||
|
@click="handleshareClick(item)">
|
||||||
|
<image :src="item.icon" class="item-icon" />
|
||||||
|
<text>{{ item.text }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -127,6 +141,7 @@
|
|||||||
tabs: [],
|
tabs: [],
|
||||||
activeTab: 0,
|
activeTab: 0,
|
||||||
showTooltip: false,
|
showTooltip: false,
|
||||||
|
showshare: false,
|
||||||
Options: [{
|
Options: [{
|
||||||
text: '重命名',
|
text: '重命名',
|
||||||
style: {
|
style: {
|
||||||
@ -158,6 +173,17 @@
|
|||||||
action: 'bluetooth'
|
action: 'bluetooth'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
shareItems: [{
|
||||||
|
text: '所有类型',
|
||||||
|
icon: '/static/images/type.png',
|
||||||
|
action: 'type'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '所有分享',
|
||||||
|
icon: '/static/images/share.png',
|
||||||
|
action: 'share'
|
||||||
|
}
|
||||||
|
],
|
||||||
page: 1, // 当前页码
|
page: 1, // 当前页码
|
||||||
size: 10, // 每页条数
|
size: 10, // 每页条数
|
||||||
total: 0, // 总数据量
|
total: 0, // 总数据量
|
||||||
@ -168,6 +194,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 更多
|
||||||
|
allMore(){
|
||||||
|
this.showshare = !this.showshare;
|
||||||
|
},
|
||||||
|
// 所有分享,所有类型
|
||||||
|
handleshareClick(item){
|
||||||
|
this.showshare = false; // 关闭弹窗
|
||||||
|
switch (item.action) {
|
||||||
|
case 'type':
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/common/allType/index'
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'share':
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/6170/allShare/index"
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
// 点击弹框外的区域关闭
|
// 点击弹框外的区域关闭
|
||||||
closePopup(type) {
|
closePopup(type) {
|
||||||
if (type === 'delete') {
|
if (type === 'delete') {
|
||||||
@ -208,7 +254,6 @@
|
|||||||
const deviceType = tab.id === '' ? undefined : tab.id;
|
const deviceType = tab.id === '' ? undefined : tab.id;
|
||||||
this.getData(deviceType);
|
this.getData(deviceType);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取设备列表
|
// 获取设备列表
|
||||||
getData(deviceType = '') {
|
getData(deviceType = '') {
|
||||||
if (this.loading || this.finished) return;
|
if (this.loading || this.finished) return;
|
||||||
@ -243,10 +288,11 @@
|
|||||||
onScrollToLower() {
|
onScrollToLower() {
|
||||||
this.getData();
|
this.getData();
|
||||||
},
|
},
|
||||||
|
// 添加扫一三图标
|
||||||
scan() {
|
scan() {
|
||||||
this.showTooltip = !this.showTooltip;
|
this.showTooltip = !this.showTooltip;
|
||||||
},
|
},
|
||||||
|
// 添加设备,扫一扫,蓝牙
|
||||||
handleMenuClick(item) {
|
handleMenuClick(item) {
|
||||||
this.showTooltip = false; // 关闭弹窗
|
this.showTooltip = false; // 关闭弹窗
|
||||||
switch (item.action) {
|
switch (item.action) {
|
||||||
@ -256,15 +302,6 @@
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'bluetooth':
|
case 'bluetooth':
|
||||||
// uni.navigateTo({
|
|
||||||
// url: 'pages/common/addBLE/AddDevice',
|
|
||||||
// success:(res)=>{
|
|
||||||
// res.eventChannel.emit('key', { data: 'data from starter page' })
|
|
||||||
// },fail: (ex) => {
|
|
||||||
// console.log("跳转失败了",JSON.stringify(ex));
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/common/addBLE/addEquip"
|
url: "/pages/common/addBLE/addEquip"
|
||||||
})
|
})
|
||||||
@ -391,7 +428,8 @@
|
|||||||
success: (res) => {
|
success: (res) => {
|
||||||
// 页面跳转成功后的回调函数
|
// 页面跳转成功后的回调函数
|
||||||
res.eventChannel.emit('deviceControl', {
|
res.eventChannel.emit('deviceControl', {
|
||||||
data: item
|
data: item,
|
||||||
|
apiType: 'listA' // 自定义标识,详情哪里根据这个参数不同信息
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -454,6 +492,7 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
/* 禁止换行 */
|
/* 禁止换行 */
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,6 +530,21 @@
|
|||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.uniui-more {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.more {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 8rpx;
|
||||||
|
/* position: absolute; */
|
||||||
|
/* right: 0rpx;
|
||||||
|
z-index: 100; */
|
||||||
|
float: right;
|
||||||
|
top: -95rpx
|
||||||
|
}
|
||||||
|
|
||||||
.gprs {
|
.gprs {
|
||||||
width: 28rpx;
|
width: 28rpx;
|
||||||
height: 35rpx;
|
height: 35rpx;
|
||||||
@ -634,10 +688,11 @@
|
|||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
font-size: 22rpx;
|
font-size: 22rpx;
|
||||||
}
|
}
|
||||||
.noDATA{
|
|
||||||
|
.noDATA {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: rgba(255, 255, 255, 0.87);
|
color: rgba(255, 255, 255, 0.87);
|
||||||
transform: translate(-0%,100%);
|
transform: translate(-0%, 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 遮罩层 */
|
/* 遮罩层 */
|
||||||
@ -757,6 +812,13 @@
|
|||||||
/* 根据导航栏高度调整 */
|
/* 根据导航栏高度调整 */
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
|
.tooltip-share{
|
||||||
|
position: fixed;
|
||||||
|
right: 18rpx;
|
||||||
|
top: 230rpx;
|
||||||
|
/* 根据导航栏高度调整 */
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
|
||||||
.tooltip-arrow {
|
.tooltip-arrow {
|
||||||
width: 0;
|
width: 0;
|
||||||
|
@ -34,12 +34,29 @@
|
|||||||
<view style="padding:20rpx;">
|
<view style="padding:20rpx;">
|
||||||
<view class="ql-editor">编辑信息</view>
|
<view class="ql-editor">编辑信息</view>
|
||||||
<view class="ql-input">
|
<view class="ql-input">
|
||||||
<textarea placeholder-style="color:rgba(255, 255, 255, 0.4)" placeholder="请输入内容" class="textarea" />
|
<textarea placeholder-style="color:rgba(255, 255, 255, 0.4)" placeholder="请输入内容" class="textarea"
|
||||||
|
v-model="messageToSend" />
|
||||||
</view>
|
</view>
|
||||||
<button class="login-btn">发送</button>
|
<button class="login-btn" @click="sendTextMessage">发送</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
<!-- 成功提示弹框 -->
|
||||||
|
<view class="agreement-mask" v-if="personalShow" @click="closePopup('delete')">
|
||||||
|
<view class="agreement-popup" @click.stop>
|
||||||
|
<view class="popup-content">
|
||||||
|
<image src="/static/images/sendSucc.png" mode="" class="svg"></image>
|
||||||
|
<uni-icon class="trash"></uni-icon>
|
||||||
|
<view>
|
||||||
|
<view class="popup-Title">信息发送成功</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 按钮组 -->
|
||||||
|
<view class="popup-buttons">
|
||||||
|
<button class="btn agreeBtn" @click="handleBtn">确定</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -47,10 +64,15 @@
|
|||||||
import {
|
import {
|
||||||
deviceInfo,
|
deviceInfo,
|
||||||
} from '@/api/common/index.js'
|
} from '@/api/common/index.js'
|
||||||
|
import {
|
||||||
|
deviceSendMessage
|
||||||
|
} from '@/api/6170/deviceControl.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
deviceList: [],
|
deviceList: [],
|
||||||
|
messageToSend: '', //发送信息
|
||||||
|
personalShow: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -58,14 +80,6 @@
|
|||||||
this.deviceList[index].checked = !this.deviceList[index].checked
|
this.deviceList[index].checked = !this.deviceList[index].checked
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
},
|
},
|
||||||
sendMessage() {
|
|
||||||
const selectedDevices = this.deviceList.filter(item => item.checked)
|
|
||||||
console.log('选中的设备:', selectedDevices)
|
|
||||||
uni.showToast({
|
|
||||||
title: `已发送到${selectedDevices.length}台设备`,
|
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 获取设备列表
|
// 获取设备列表
|
||||||
getData(deviceType) {
|
getData(deviceType) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@ -88,6 +102,36 @@
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 发送文本消息
|
||||||
|
sendTextMessage() {
|
||||||
|
const selectedDevices = this.deviceList.filter(item => item.checked)
|
||||||
|
const deviceIds = selectedDevices.map(item => item.id);
|
||||||
|
if (!this.messageToSend) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请输入要发送的内容',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let data = {
|
||||||
|
sendMsg: this.messageToSend,
|
||||||
|
deviceIds: deviceIds
|
||||||
|
}
|
||||||
|
deviceSendMessage(data).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.personalShow = true
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleBtn(){
|
||||||
|
this.personalShow = false
|
||||||
|
uni.navigateBack()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const eventChannel = this.getOpenerEventChannel();
|
const eventChannel = this.getOpenerEventChannel();
|
||||||
@ -296,4 +340,63 @@
|
|||||||
width: 90%;
|
width: 90%;
|
||||||
margin-left: 10rpx;
|
margin-left: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 遮罩层 */
|
||||||
|
.agreement-mask {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-Title {
|
||||||
|
color: rgba(255, 255, 255, 0.86);
|
||||||
|
text-align: center;
|
||||||
|
padding: 30rpx 0rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-buttons {
|
||||||
|
display: flex;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 弹窗主体 */
|
||||||
|
.agreement-popup {
|
||||||
|
width: 60%;
|
||||||
|
background-color: rgb(42, 42, 42);
|
||||||
|
border-radius: 40rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid rgba(255, 200, 78, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg {
|
||||||
|
width: 58rpx;
|
||||||
|
height: 62rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 通用按钮样式 */
|
||||||
|
.btn {
|
||||||
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
margin: 10rpx auto;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 同意按钮 */
|
||||||
|
.agreeBtn {
|
||||||
|
background: rgba(187, 230, 0, 1);
|
||||||
|
color: #232323;
|
||||||
|
border: none;
|
||||||
|
width: 170rpx !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
BIN
static/images/delel.png
Normal file
BIN
static/images/delel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 486 B |
BIN
static/images/more.png
Normal file
BIN
static/images/more.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 B |
BIN
static/images/sendSucc.png
Normal file
BIN
static/images/sendSucc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 500 B |
BIN
static/images/share.png
Normal file
BIN
static/images/share.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 226 B |
BIN
static/images/type.png
Normal file
BIN
static/images/type.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 209 B |
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
var isReady=false;var onReadyCallbacks=[];
|
var isReady=false;var onReadyCallbacks=[];
|
||||||
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
||||||
var __uniConfig = {"pages":["pages/common/login/index","pages/common/index/index","pages/common/user/index","pages/common/scan/scan","pages/common/qrcode/qrcode","pages/common/send/index","pages/common/userAgreement/index","pages/common/privacyAgreement/index","pages/common/aboutUs/index","pages/6170/deviceControl/index","pages/common/operationVideo/index","pages/common/addvideo/index","pages/common/operatingInstruct/index","pages/common/productDes/index","pages/common/addBLE/addEquip","pages/common/addBLE/LinkBle","pages/6155/deviceDetail","pages/6155/ImgCrop","pages/common/map/index"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#121212","backgroundColor":"#121212"},"tabBar":{"color":"#fff","selectedColor":"#BBE600","backgroundColor":"#202020","list":[{"pagePath":"pages/common/index/index","text":"我的设备","iconPath":"/static/tabs/device.png","selectedIconPath":"/static/tabs/device-HL.png"},{"pagePath":"pages/common/user/index","text":"我的","iconPath":"/static/tabs/my.png","selectedIconPath":"/static/tabs/my-HL.png"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"JingQuan","compilerVersion":"4.66","entryPagePath":"pages/common/login/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
var __uniConfig = {"pages":["pages/common/login/index","pages/common/index/index","pages/common/user/index","pages/common/scan/scan","pages/common/qrcode/qrcode","pages/common/send/index","pages/common/userAgreement/index","pages/common/privacyAgreement/index","pages/common/aboutUs/index","pages/6170/deviceControl/index","pages/common/operationVideo/index","pages/common/addvideo/index","pages/common/operatingInstruct/index","pages/common/productDes/index","pages/common/addBLE/addEquip","pages/common/addBLE/LinkBle","pages/6155/deviceDetail","pages/6155/ImgCrop","pages/common/map/index","pages/common/allType/index","pages/6170/allShare/index","pages/6170/share/index","pages/6170/shareDevices/index","pages/6170/shareManagement/index"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#121212","backgroundColor":"#121212"},"tabBar":{"color":"#fff","selectedColor":"#BBE600","backgroundColor":"#202020","list":[{"pagePath":"pages/common/index/index","text":"我的设备","iconPath":"/static/tabs/device.png","selectedIconPath":"/static/tabs/device-HL.png"},{"pagePath":"pages/common/user/index","text":"我的","iconPath":"/static/tabs/my.png","selectedIconPath":"/static/tabs/my-HL.png"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"JingQuan","compilerVersion":"4.64","entryPagePath":"pages/common/login/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||||
var __uniRoutes = [{"path":"/pages/common/login/index","meta":{"isQuit":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/user/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/common/scan/scan","meta":{},"window":{"navigationBarTitleText":"扫描"}},{"path":"/pages/common/qrcode/qrcode","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/common/send/index","meta":{},"window":{"navigationBarTitleText":"发送信息"}},{"path":"/pages/common/userAgreement/index","meta":{},"window":{"navigationBarTitleText":"用户协议"}},{"path":"/pages/common/privacyAgreement/index","meta":{},"window":{"navigationBarTitleText":"隐私协议"}},{"path":"/pages/common/aboutUs/index","meta":{},"window":{"navigationBarTitleText":"关于我们"}},{"path":"/pages/6170/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operationVideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addvideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operatingInstruct/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/productDes/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addBLE/addEquip","meta":{},"window":{"navigationBarTitleText":"添加设备"}},{"path":"/pages/common/addBLE/LinkBle","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/6155/deviceDetail","meta":{},"window":{"navigationBarTitleText":"HBY 6155"}},{"path":"/pages/6155/ImgCrop","meta":{},"window":{"navigationBarTitleText":"图像裁剪","navigationStyle":"custom","fullscreen":true}},{"path":"/pages/common/map/index","meta":{},"window":{"navigationBarTitleText":"地图"}}];
|
var __uniRoutes = [{"path":"/pages/common/login/index","meta":{"isQuit":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/user/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/common/scan/scan","meta":{},"window":{"navigationBarTitleText":"扫描"}},{"path":"/pages/common/qrcode/qrcode","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/common/send/index","meta":{},"window":{"navigationBarTitleText":"发送信息"}},{"path":"/pages/common/userAgreement/index","meta":{},"window":{"navigationBarTitleText":"用户协议"}},{"path":"/pages/common/privacyAgreement/index","meta":{},"window":{"navigationBarTitleText":"隐私协议"}},{"path":"/pages/common/aboutUs/index","meta":{},"window":{"navigationBarTitleText":"关于我们"}},{"path":"/pages/6170/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operationVideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addvideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operatingInstruct/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/productDes/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addBLE/addEquip","meta":{},"window":{"navigationBarTitleText":"添加设备"}},{"path":"/pages/common/addBLE/LinkBle","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/6155/deviceDetail","meta":{},"window":{"navigationBarTitleText":"HBY 6155"}},{"path":"/pages/6155/ImgCrop","meta":{},"window":{"navigationBarTitleText":"图像裁剪","navigationStyle":"custom","fullscreen":true}},{"path":"/pages/common/map/index","meta":{},"window":{"navigationBarTitleText":"地图"}},{"path":"/pages/common/allType/index","meta":{},"window":{"navigationBarTitleText":"所有类型"}},{"path":"/pages/6170/allShare/index","meta":{},"window":{"navigationBarTitleText":"所有分享"}},{"path":"/pages/6170/share/index","meta":{},"window":{"navigationBarTitleText":"分享"}},{"path":"/pages/6170/shareDevices/index","meta":{},"window":{"navigationBarTitleText":"分享设备"}},{"path":"/pages/6170/shareManagement/index","meta":{},"window":{"navigationBarTitleText":"分享管理"}}];
|
||||||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
||||||
|
2
unpackage/dist/dev/app-plus/manifest.json
vendored
2
unpackage/dist/dev/app-plus/manifest.json
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user