修改获取大棚列表信息逻辑

feasure-livedata
lld 2026-04-05 18:19:35 +08:00
parent a47d7d2f00
commit c2a38758b0
6 changed files with 69 additions and 44 deletions

View File

@ -131,7 +131,7 @@ export default {
}) })
}, },
getAgriList() { getAgriList() {
listAgri().then(response => { listAgri({status: 1}).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.agriList = response.rows.map(item => ({ this.agriList = response.rows.map(item => ({
agriId: item.id, agriId: item.id,

View File

@ -281,7 +281,8 @@ export default {
}) })
}, },
getAgriList() { getAgriList() {
listAgri().then(response => { //
listAgri({status: 1}).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.range = response.rows.map(item => ({ this.range = response.rows.map(item => ({
agriId: item.id, agriId: item.id,

View File

@ -1,15 +1,15 @@
<template> <template>
<view class="page-bg"> <view class="page-bg">
<!-- 顶部标签切换 --> <!-- 顶部标签切换 -->
<view class="tab-bar"> <!-- <view class="tab-bar">-->
<view <!-- <view-->
v-for="tab in tabs" <!-- v-for="tab in tabs"-->
:key="tab.value" <!-- :key="tab.value"-->
class="tab-item" <!-- class="tab-item"-->
:class="{ active: activeTab === tab.value }" <!-- :class="{ active: activeTab === tab.value }"-->
@click="activeTab = tab.value" <!-- @click="activeTab = tab.value"-->
>{{ tab.label }}</view> <!-- >{{ tab.label }}</view>-->
</view> <!-- </view>-->
<!-- 步骤引导条 --> <!-- 步骤引导条 -->
<view class="steps-bar"> <view class="steps-bar">
@ -48,26 +48,26 @@
class="device-item" class="device-item"
@click="goToDetail(device)" @click="goToDetail(device)"
> >
<image :src="device.img" class="device-img" mode="aspectFit" /> <image :src="agriImg" class="device-img" mode="aspectFit" />
<view class="device-info"> <view class="device-info">
<text class="device-name">{{ device.name }}</text> <text class="device-name">{{ device.agriName }}</text>
<text class="device-sub">已分享{{ device.sharedCount }}</text> <text class="device-sub">已分享{{ device.sharedCount }}</text>
</view> </view>
<view class="arrow"></view> <view class="arrow"></view>
</view> </view>
</view> </view>
<!-- 分享给我的列表 --> <!-- 分享给我的列表 仅显示已接受的-->
<view v-if="activeSubTab === 'tome'"> <view v-if="activeSubTab === 'tome'">
<view <view
v-for="device in toMeDevices" v-for="device in toMeDevices"
:key="device.id" :key="device.id"
class="device-item" class="device-item"
> >
<image :src="device.img" class="device-img" mode="aspectFit" /> <image :src="agriImg" class="device-img" mode="aspectFit" />
<view class="device-info"> <view class="device-info">
<text class="device-name">{{ device.name }}</text> <text class="device-name">{{ device.agriName }}</text>
<text class="device-sub">{{ device.channels }}个通道 | {{ device.serial }}</text> <!-- <text class="device-sub">{{ device.channels }}个通道 | {{ device.serial }}</text>-->
</view> </view>
<button class="quit-btn" @click="quitShare(device)">退</button> <button class="quit-btn" @click="quitShare(device)">退</button>
</view> </view>
@ -83,6 +83,9 @@
</template> </template>
<script> <script>
import {listAgri} from "@/api/system/assets/agri";
import store from "@/store";
export default { export default {
data() { data() {
return { return {
@ -92,30 +95,27 @@ export default {
{ label: '分享团队', value: 'team' } { label: '分享团队', value: 'team' }
], ],
steps: [ steps: [
{ icon: '/static/images/share/step_send.png', label: '发起分享' }, { icon: 'https://img.xiaoces.com/photos/share/share.png', label: '发起分享' },
{ icon: '/static/images/share/step_add.png', label: '添加分享对象' }, { icon: 'https://img.xiaoces.com/photos/share/user2.png', label: '添加分享对象' },
{ icon: '/static/images/share/step_key.png', label: '选择视频和权限' }, { icon: 'https://img.xiaoces.com/photos/share/access.png', label: '选择视频和权限' },
{ icon: '/static/images/share/step_mail.png', label: '接受分享' } { icon: 'https://img.xiaoces.com/photos/share/share__.png', label: '接受分享' }
], ],
featureTags: ['功能按需分享', '最多分享10人', '仅视频设备'], featureTags: ['功能按需分享', '最多分享 5 人', '仅视频设备'],
activeSubTab: 'mine', activeSubTab: 'mine',
subTabs: [ subTabs: [
{ label: '我的分享', value: 'mine' }, { label: '我的分享', value: 'mine' },
{ label: '分享给我的', value: 'tome' } { label: '分享给我的', value: 'tome' }
], ],
// API // API
mySharedDevices: [ mySharedDevices: [],
{ id: 1, name: '八方', img: '/static/images/share/camera1.png', sharedCount: 1 },
{ id: 2, name: '十方', img: '/static/images/share/camera2.png', sharedCount: 1 },
{ id: 3, name: 'DS-2DE4423DW-D/GLT/XM(...', img: '/static/images/share/camera1.png', sharedCount: 1 },
{ id: 4, name: 'DS-7804N-Z1/X(D)(FR5725238)', img: '/static/images/share/nvr.png', sharedCount: 5 }
],
// //
toMeDevices: [ toMeDevices: [],
{ id: 5, name: 'DS-7804N-Z1/X(D)(F...', img: '/static/images/share/nvr.png', channels: 3, serial: 'FX3773731' } agriImg: 'https://img.xiaoces.com/photos/share/agri.png'
]
} }
}, },
onShow() {
this.getShareAgriList()
},
methods: { methods: {
goToDetail(device) { goToDetail(device) {
uni.navigateTo({ uni.navigateTo({
@ -135,7 +135,28 @@ export default {
} }
} }
}) })
} },
getShareAgriList() {
//
listAgri({inviteBy: store.getters.id, status:1}).then(response => {
if (response.code === 200) {
//
var mySharedDevices
= response.rows.filter(item => item.userId === store.getters.id);
//
var sharedDevices
= response.rows.filter(item => item.userId !== store.getters.id);
mySharedDevices.forEach(shareDevice => {
shareDevice.sharedCount = sharedDevices.filter(device => device.imei===shareDevice.imei
&& device.inviteBy === store.getters.id).length
});
this.mySharedDevices = mySharedDevices;
//
this.toMeDevices = mySharedDevices.filter(item => item.inviteBy && item.userId !== item.inviteBy );
}
})
},
} }
} }
</script> </script>
@ -182,7 +203,7 @@ page {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
margin: 30rpx 30rpx 0; margin: 50rpx 30rpx 20rpx;
.step-item { .step-item {
display: flex; display: flex;
@ -228,11 +249,12 @@ page {
/* 功能标签 */ /* 功能标签 */
.feature-tags { .feature-tags {
display: flex; display: flex;
margin: 20rpx 30rpx; justify-content: center;
gap: 16rpx; margin: 40rpx 30rpx;
gap: 20rpx;
.feature-tag { .feature-tag {
padding: 8rpx 20rpx; padding: 8rpx 40rpx;
border-radius: 8rpx; border-radius: 8rpx;
font-size: 22rpx; font-size: 22rpx;
@ -245,8 +267,8 @@ page {
color: #f5a623; color: #f5a623;
} }
&:nth-child(3) { &:nth-child(3) {
background: #fff3e0; background: rgba(253, 60, 60, 0.13);
color: #f5a623; color: #fd3c3c;
} }
} }
} }

View File

@ -46,11 +46,11 @@
</view> </view>
<view class="func-item" @click="goToAI"> <view class="func-item" @click="goToAI">
<view class="func-icon"> <view class="func-icon">
<image style="width: 40rpx; height: 30rpx; " <image style="width: 30rpx; height: 30rpx; "
src="https://img.xiaoces.com/photos/news/ai1.png"/> src="https://img.xiaoces.com/photos/news/interact.png"/>
</view> </view>
<view class="func-title">AI识别</view> <view class="func-title">互动消息</view>
<view class="func-desc">AI识别精准过滤无效报警</view> <view class="func-desc">暂无互动消息...</view>
</view> </view>
</view> </view>

View File

@ -163,7 +163,8 @@ export default {
}, },
getImeiList() { getImeiList() {
listAgri().then(response => { //
listAgri({status: 1}).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.range = response.rows.map(item => ({ this.range = response.rows.map(item => ({
agriId: item.id, agriId: item.id,

View File

@ -362,7 +362,8 @@ export function updateSubscribeTopic() {
} }
const agriList = []; const agriList = [];
// 1. 获取设备列表(纯.then/.catch回调 // 1. 获取设备列表(纯.then/.catch回调
listAgri().then(response => { // 获取已启用的设备列表
listAgri({status: 1}).then(response => {
if (response.code === 200) { if (response.code === 200) {
// 生成设备订阅主题校验imei非空 // 生成设备订阅主题校验imei非空