分享设备相关的功能
This commit is contained in:
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}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="uniui-more" >
|
||||
<image @click="allMore" src="/static/images/more.png" mode="" class="more"></image>
|
||||
</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="Sendmessage" @click="location">位置</view>
|
||||
<view class="Sendmessage" @click="handleSend">发送信息</view>
|
||||
@ -109,6 +112,17 @@
|
||||
</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>
|
||||
</template>
|
||||
|
||||
@ -127,6 +141,7 @@
|
||||
tabs: [],
|
||||
activeTab: 0,
|
||||
showTooltip: false,
|
||||
showshare: false,
|
||||
Options: [{
|
||||
text: '重命名',
|
||||
style: {
|
||||
@ -158,6 +173,17 @@
|
||||
action: 'bluetooth'
|
||||
}
|
||||
],
|
||||
shareItems: [{
|
||||
text: '所有类型',
|
||||
icon: '/static/images/type.png',
|
||||
action: 'type'
|
||||
},
|
||||
{
|
||||
text: '所有分享',
|
||||
icon: '/static/images/share.png',
|
||||
action: 'share'
|
||||
}
|
||||
],
|
||||
page: 1, // 当前页码
|
||||
size: 10, // 每页条数
|
||||
total: 0, // 总数据量
|
||||
@ -168,6 +194,26 @@
|
||||
}
|
||||
},
|
||||
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) {
|
||||
if (type === 'delete') {
|
||||
@ -208,7 +254,6 @@
|
||||
const deviceType = tab.id === '' ? undefined : tab.id;
|
||||
this.getData(deviceType);
|
||||
},
|
||||
|
||||
// 获取设备列表
|
||||
getData(deviceType = '') {
|
||||
if (this.loading || this.finished) return;
|
||||
@ -243,10 +288,11 @@
|
||||
onScrollToLower() {
|
||||
this.getData();
|
||||
},
|
||||
// 添加扫一三图标
|
||||
scan() {
|
||||
this.showTooltip = !this.showTooltip;
|
||||
},
|
||||
|
||||
// 添加设备,扫一扫,蓝牙
|
||||
handleMenuClick(item) {
|
||||
this.showTooltip = false; // 关闭弹窗
|
||||
switch (item.action) {
|
||||
@ -256,15 +302,6 @@
|
||||
});
|
||||
break;
|
||||
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({
|
||||
url: "/pages/common/addBLE/addEquip"
|
||||
})
|
||||
@ -391,7 +428,8 @@
|
||||
success: (res) => {
|
||||
// 页面跳转成功后的回调函数
|
||||
res.eventChannel.emit('deviceControl', {
|
||||
data: item
|
||||
data: item,
|
||||
apiType: 'listA' // 自定义标识,详情哪里根据这个参数不同信息
|
||||
});
|
||||
}
|
||||
})
|
||||
@ -454,6 +492,7 @@
|
||||
white-space: nowrap;
|
||||
/* 禁止换行 */
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
@ -491,6 +530,21 @@
|
||||
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 {
|
||||
width: 28rpx;
|
||||
height: 35rpx;
|
||||
@ -634,10 +688,11 @@
|
||||
padding: 20rpx;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.noDATA{
|
||||
|
||||
.noDATA {
|
||||
text-align: center;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
transform: translate(-0%,100%);
|
||||
transform: translate(-0%, 100%);
|
||||
}
|
||||
|
||||
/* 遮罩层 */
|
||||
@ -757,6 +812,13 @@
|
||||
/* 根据导航栏高度调整 */
|
||||
z-index: 9999;
|
||||
}
|
||||
.tooltip-share{
|
||||
position: fixed;
|
||||
right: 18rpx;
|
||||
top: 230rpx;
|
||||
/* 根据导航栏高度调整 */
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.tooltip-arrow {
|
||||
width: 0;
|
||||
|
@ -34,12 +34,29 @@
|
||||
<view style="padding:20rpx;">
|
||||
<view class="ql-editor">编辑信息</view>
|
||||
<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>
|
||||
<button class="login-btn">发送</button>
|
||||
<button class="login-btn" @click="sendTextMessage">发送</button>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
@ -47,10 +64,15 @@
|
||||
import {
|
||||
deviceInfo,
|
||||
} from '@/api/common/index.js'
|
||||
import {
|
||||
deviceSendMessage
|
||||
} from '@/api/6170/deviceControl.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
deviceList: [],
|
||||
messageToSend: '', //发送信息
|
||||
personalShow: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -58,14 +80,6 @@
|
||||
this.deviceList[index].checked = !this.deviceList[index].checked
|
||||
this.$forceUpdate()
|
||||
},
|
||||
sendMessage() {
|
||||
const selectedDevices = this.deviceList.filter(item => item.checked)
|
||||
console.log('选中的设备:', selectedDevices)
|
||||
uni.showToast({
|
||||
title: `已发送到${selectedDevices.length}台设备`,
|
||||
icon: 'success'
|
||||
})
|
||||
},
|
||||
// 获取设备列表
|
||||
getData(deviceType) {
|
||||
this.loading = true;
|
||||
@ -88,6 +102,36 @@
|
||||
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) {
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
@ -296,4 +340,63 @@
|
||||
width: 90%;
|
||||
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>
|
Reference in New Issue
Block a user