agri-app/pages/home/invite/sharedToMe/index.vue

372 lines
8.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class="page-bg">
<!-- 顶部标签切换 -->
<view class="tab-bar">
<view
v-for="tab in tabs"
:key="tab.value"
class="tab-item"
:class="{ active: activeTab === tab.value }"
@click="activeTab = tab.value"
>{{ tab.label }}</view>
</view>
<!-- 步骤引导条 -->
<view class="steps-bar">
<view v-for="(step, idx) in steps" :key="idx" class="step-item">
<view class="step-icon-wrap">
<image :src="step.icon" class="step-icon" mode="aspectFit" />
</view>
<text class="step-label">{{ step.label }}</text>
<view v-if="idx < steps.length - 1" class="step-line">···</view>
</view>
</view>
<!-- 功能说明标签 -->
<view class="feature-tags">
<view v-for="tag in featureTags" :key="tag" class="feature-tag">{{ tag }}</view>
</view>
<!-- 我的分享 / 分享给我的 切换 -->
<view class="sub-tabs">
<view
v-for="sub in subTabs"
:key="sub.value"
class="sub-tab"
:class="{ 'sub-tab-active': activeSubTab === sub.value }"
@click="activeSubTab = sub.value"
>{{ sub.label }}</view>
</view>
<!-- 已接受分组 -->
<view v-if="activeSubTab === 'tome'" class="device-section">
<text class="section-label">已接受</text>
<view class="device-list">
<view
v-for="device in toMeDevices"
:key="device.id"
class="device-item"
>
<image :src="device.img" class="device-img" mode="aspectFit" />
<view class="device-info">
<text class="device-name">{{ device.name }}</text>
<text class="device-sub">{{ device.channels }}个通道 | {{ device.serial }}</text>
</view>
<button class="quit-btn" @click="quitShare(device)">退出分享</button>
</view>
<view v-if="!toMeDevices.length" class="empty-tip">暂无分享给我的设备</view>
</view>
</view>
<!-- 我的分享列表 -->
<view v-if="activeSubTab === 'mine'" class="device-list">
<view
v-for="device in mySharedDevices"
:key="device.id"
class="device-item"
@click="goToDetail(device)"
>
<image :src="device.img" class="device-img" mode="aspectFit" />
<view class="device-info">
<text class="device-name">{{ device.name }}</text>
<text class="device-sub">已分享:{{ device.sharedCount }}次</text>
</view>
<view class="arrow"></view>
</view>
</view>
<!-- 底部发起分享按钮 -->
<view class="bottom-bar">
<button class="share-btn" @click="goToShareTarget"></button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
activeTab: 'device',
tabs: [
{ label: '分享设备', value: 'device' },
{ label: '分享团队', value: 'team' }
],
steps: [
{ icon: '/static/images/share/step_send.png', label: '发起分享' },
{ icon: '/static/images/share/step_add.png', label: '添加分享对象' },
{ icon: '/static/images/share/step_key.png', label: '选择视频和权限' },
{ icon: '/static/images/share/step_mail.png', label: '接受分享' }
],
featureTags: ['功能按需分享', '最多分享10人', '仅视频设备'],
activeSubTab: 'tome', // 默认展示"分享给我的"
subTabs: [
{ label: '我的分享', value: 'mine' },
{ label: '分享给我的', value: 'tome' }
],
toMeDevices: [
{
id: 5,
name: 'DS-7804N-Z1/X(D)(F...',
img: '/static/images/share/nvr.png',
channels: 3,
serial: 'FX3773731'
}
],
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 }
]
}
},
methods: {
goToDetail(device) {
uni.navigateTo({ url: `/pages/home/invite/myShareDetail/index?id=${device.id}` })
},
goToShareTarget() {
uni.navigateTo({ url: '/pages/home/invite/shareTarget/index' })
},
quitShare(device) {
uni.showModal({
title: '提示',
content: `确定退出【${device.name}】的分享?`,
success: (res) => {
if (res.confirm) {
this.toMeDevices = this.toMeDevices.filter(d => d.id !== device.id)
uni.showToast({ title: '已退出分享', icon: 'none' })
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
page {
background: linear-gradient(180deg, #e8f0ff 0%, #f5f7fa 60%, #ffffff 100%);
}
.page-bg {
min-height: 100vh;
padding-bottom: 120rpx;
}
.tab-bar {
display: flex;
justify-content: center;
align-items: center;
margin: 24rpx 30rpx 0;
background: #e0e5ef;
border-radius: 40rpx;
padding: 6rpx;
.tab-item {
flex: 1;
text-align: center;
padding: 14rpx 0;
border-radius: 34rpx;
font-size: 28rpx;
color: #666;
&.active {
background: #1a1a1a;
color: #fff;
font-weight: bold;
}
}
}
.steps-bar {
display: flex;
align-items: center;
justify-content: space-between;
margin: 30rpx 30rpx 0;
.step-item {
display: flex;
flex-direction: column;
align-items: center;
flex: 1;
position: relative;
}
.step-icon-wrap {
width: 72rpx;
height: 72rpx;
border-radius: 50%;
background: #fff;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.08);
}
.step-icon {
width: 40rpx;
height: 40rpx;
}
.step-label {
font-size: 22rpx;
color: #666;
margin-top: 8rpx;
text-align: center;
}
.step-line {
position: absolute;
top: 30rpx;
right: -20rpx;
font-size: 24rpx;
color: #4a90e2;
letter-spacing: 2rpx;
}
}
.feature-tags {
display: flex;
margin: 20rpx 30rpx;
gap: 16rpx;
.feature-tag {
padding: 8rpx 20rpx;
border-radius: 8rpx;
font-size: 22rpx;
&:first-child { background: #e8f0fe; color: #3d7ff5; }
&:nth-child(2) { background: #fff3e0; color: #f5a623; }
&:nth-child(3) { background: #fff3e0; color: #f5a623; }
}
}
.sub-tabs {
display: flex;
margin: 0 30rpx 0;
border-bottom: 2rpx solid #e5e5e5;
.sub-tab {
padding: 16rpx 30rpx;
font-size: 28rpx;
color: #999;
position: relative;
&-active {
color: #1a1a1a;
font-weight: bold;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 40rpx;
height: 4rpx;
background: #1a1a1a;
border-radius: 2rpx;
}
}
}
}
.section-label {
display: block;
font-size: 26rpx;
color: #999;
padding: 20rpx 20rpx 8rpx;
}
.device-list {
margin: 0 20rpx;
background: #fff;
border-radius: 16rpx;
overflow: hidden;
.device-item {
display: flex;
align-items: center;
padding: 24rpx 28rpx;
border-bottom: 1rpx solid #f2f2f2;
&:last-child { border-bottom: none; }
.device-img {
width: 90rpx;
height: 90rpx;
margin-right: 20rpx;
flex-shrink: 0;
}
.device-info {
flex: 1;
overflow: hidden;
.device-name {
font-size: 28rpx;
color: #333;
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.device-sub {
font-size: 24rpx;
color: #999;
display: block;
margin-top: 6rpx;
}
}
.arrow {
color: #ccc;
font-size: 36rpx;
margin-left: 10rpx;
}
.quit-btn {
font-size: 24rpx;
color: #555;
background: #fff;
border: 2rpx solid #ddd;
border-radius: 30rpx;
padding: 10rpx 28rpx;
line-height: 1.4;
}
}
}
.device-section {
margin-top: 10rpx;
}
.empty-tip {
text-align: center;
color: #bbb;
font-size: 26rpx;
padding: 60rpx 0;
}
.bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 20rpx 30rpx;
background: #edf1f7;
.share-btn {
background: #3d7ff5;
color: #fff;
border-radius: 50rpx;
font-size: 32rpx;
height: 90rpx;
line-height: 90rpx;
text-align: center;
border: none;
}
}
</style>