蓝牙设备添加分享功能

This commit is contained in:
liub
2026-01-29 16:52:52 +08:00
parent dae3561235
commit 23fe40902b
8 changed files with 852 additions and 64 deletions

View File

@ -1,5 +1,26 @@
<template>
<view class="content contentBg">
<uni-nav-bar class="nvbar" leftIcon="left" @clickLeft="navigatorBack">
<view slot="left">
<uni-icons type="back" size="23" color="#FFFFFF"></uni-icons>
</view>
<view slot="default" class="center uninavebartext">
{{Status.navbar.title}}
</view>
<view slot="right">
<view class="navbarRight center">
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
<image class="img" :src="item.src" mode="aspectFit"></image>
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
</view>
</view>
</view>
</uni-nav-bar>
<view class="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -243,7 +264,7 @@
<global-loading ref="loading" />
</view>
</view>
</view>
</template>
<script>
@ -255,7 +276,9 @@
hideLoading,
updateLoading
} from '@/utils/loading.js'
import request, { baseURL } from '@/utils/request.js';
import request, {
baseURL
} from '@/utils/request.js';
import Common from '@/utils/Common.js'
const pagePath = "/pages/100/HBY100";
@ -271,6 +294,16 @@ import request, { baseURL } from '@/utils/request.js';
data() {
return {
Status: {
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType: 'listA'
}],
title: 'HBY100'
},
curr: 0,
total: 0,
pageHide: false,
@ -464,7 +497,7 @@ import request, { baseURL } from '@/utils/request.js';
detailPageUrl: "/pages/650/HBY650",
showConfirm: false
},
permissions: [],
audioData: {
packetCtn: 0,
hexs: []
@ -496,6 +529,17 @@ import request, { baseURL } from '@/utils/request.js';
// console.log("收到父页面的参数:" + JSON.stringify(data));
var device = data.data;
these.device = device;
these.Status.apiType = data.apiType;
these.Status.navbar.title = device.deviceName;
if (data.apiType !== 'listA') {
Common.getdeviceShareId(data.data.id).then(res => {
if (res.code == 200) {
if (res.data.permission) {
these.permissions = res.data.permission.split(',');
}
}
});
}
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) {
// console.log("找到设备了", v);
@ -544,8 +588,49 @@ import request, { baseURL } from '@/utils/request.js';
},
methods: {
audioManager() {
handleRightClick(item, s) {
if (item && item.callback) {
item.callback(item, s);
} else {
uni.showModal({
content: '敬请期待'
})
}
},
navigatorBack() {
uni.navigateBack();
},
gotoShare(item, s) {
uni.navigateTo({
url: '/pages/common/share/index',
events: {
ack: function(data) {}
},
success: (res) => {
let json = {
persissonType: '100'
};
Object.assign(json, this.device);
res.eventChannel.emit('share', {
data: json
});
}
})
},
audioManager() {
if (!this.permissions.includes('52') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
uni.navigateTo({
url: '/pages/common/audioManager/AudioList',
events: {
@ -860,6 +945,19 @@ import request, { baseURL } from '@/utils/request.js';
}, 100);
},
lightTypeSet(item, index) {
if (!this.permissions.includes('51') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
let f = this.getDevice();
// #ifdef APP-PLUS
if (!f) {
@ -899,6 +997,20 @@ import request, { baseURL } from '@/utils/request.js';
this.Status.usrToggle = !this.Status.usrToggle;
},
openVolume(item, index) {
if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
let f = this.getDevice();
// #ifdef APP-PLUS
if (!f) {
@ -950,6 +1062,20 @@ import request, { baseURL } from '@/utils/request.js';
});
},
sosSetting(item, isOk) {
if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
if (item === 0 && this.formData.sta_SOSType === item) {
return;
}
@ -1115,7 +1241,7 @@ import request, { baseURL } from '@/utils/request.js';
let json = recei.ReceiveData(receive, device, pagePath, recArr);
console.log("收到设备的数据", json)
console.log("收到设备的数据", json)
let key = 'sta_VoiceDate';
if (key in json) {
@ -2102,4 +2228,71 @@ import request, { baseURL } from '@/utils/request.js';
letter-spacing: 0.07px;
}
.navbarRight {
width: 40px;
height: 100%;
}
.navbarRight .imgContent {
width: 36rpx;
height: 36rpx;
position: relative;
}
.navbarRight .imgContent:first-child {
width: 38rpx !important;
height: 38rpx !important;
margin-top: -2rpx;
}
.navbarRight .imgContent .baber {
position: absolute;
z-index: 100;
width: 30rpx;
height: 30rpx;
line-height: 30rpx;
right: -15rpx;
top: -15rpx;
border-radius: 50%;
background: #f12828;
color: #ffffff;
font-family: 'PingFang SC';
font-style: Regular;
font-size: 20rpx;
font-weight: 400;
text-align: center;
overflow: hidden;
white-space: nowrap;
}
.navbarRight .imgContent .img {
width: 100%;
height: 100%;
box-sizing: border-box;
position: relative;
}
.navbarRight .imgContent .img:last-child {
padding: 1rpx;
}
.nvbar {
top: 0px;
}
/deep/ .uni-navbar--fixed {
top: 0px;
}
.uninavebartext {
width: 100%;
font-size: 32rpx;
}
</style>