设备分享模块页面功能开发

This commit is contained in:
fengerli
2025-07-16 16:43:22 +08:00
parent 9b3be8c7d7
commit bc3bea6df0
9 changed files with 752 additions and 48 deletions

View File

@ -0,0 +1,348 @@
<template>
<view class="container">
<!-- 设备信息 -->
<view class="device-info" v-for="(item, index) in deviceList" :key="index">
<view class="device-header">
<view class="deviceIMG">
<image :src="item.devicePic" mode="" class="IMG"></image>
</view>
<view class="device-name">
<view>设备:{{item.deviceName}}</view>
<view class="ID">
<view class="ID">ID:{{item.deviceImei}}
</view>
</view>
</view>
</view>
</view>
<!-- 功能权限 -->
<view class="permissions">
<view class="permissions-title">功能权限</view>
<view :checked="allSelected" class="allSelect" @click="toggleAllSelection()">全选</view>
<text class="permissions-title"></text>
<view class="permission-item" v-for="(item, index) in permissions" :key="index"
@click="toggleSelection(index)">
<view class="checkbox" :class="{ checked: item.checked }">
<uni-icons v-if="item.checked" type="checkmarkempty" size="18" color="rgb(0, 0, 0)"></uni-icons>
</view>
<view> {{ item.label }}</view>
</view>
</view>
<!-- 被分享人信息 -->
<view class="recipient-info">
<view class="recipient-title">被分享人信息</view>
<input type="number" placeholder="输入手机号" class="phone-input" :maxlength="11" />
<view class="verification-code">
<input type="number" placeholder="短信验证码" class="code-input" />
<view class="get-code-btn">获取验证码</view>
</view>
</view>
<!-- 分享按钮 -->
<button class="share-btn" @click="shareUp">分享</button>
<!-- 分享弹框 -->
<view class="agreement-mask" v-if="shareShow" @click="closePopup('share')">
<view class="agreement-popup" @click.stop>
<view class="popup-content">
<image src="/static/images/success.png" mode="" class="svg"></image>
<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>
export default {
data() {
return {
allSelected: false,
shareShow: false,
permissions: [{
value: "light-mode",
label: "灯光模式",
checked: false
},
{
value: "laser-mode",
label: "激光模式",
checked: false
},
{
value: "startup-image",
label: "开机画面",
checked: false
},
{
value: "person-registration",
label: "人员信息登记",
checked: false
},
{
value: "send-message",
label: "发送信息",
checked: false
},
{
value: "product-info",
label: "产品信息",
checked: false
}
],
deviceList: [{}]
};
},
methods: {
closePopup(){
this.shareShow=false
},
toggleAllSelection() {
this.allSelected = !this.allSelected;
this.permissions.forEach(permission => permission.checked = this.allSelected);
},
toggleSelection(index) {
this.$set(this.permissions[index], 'checked', !this.permissions[index].checked);
this.allSelected = this.permissions.every(permission => permission.checked);
},
shareUp() {
// const selectedPermissions = this.permissions.filter(permission => permission.checked).map(permission =>
// permission.value);
// console.log('Selected Permissions:', selectedPermissions);
this.shareShow=true
},
handleBtn(){
this.shareShow=false
}
}
};
</script>
<style scoped>
.container {
width: 100%;
background: #121212;
min-height: 100vh;
padding: 30rpx;
}
.device-header {
display: flex;
align-items: center;
margin-bottom: 15rpx;
}
.device-name {
font-size: 32rpx;
color: rgba(255, 255, 255, 0.87);
margin-left: 25rpx;
line-height: 50rpx;
white-space: nowrap;
}
.ID {
color: rgba(255, 255, 255, 0.6);
font-size: 26rpx;
display: flex;
justify-content: space-between;
position: relative;
}
.device-info {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.87);
padding-top: 10rpx;
position: relative;
}
.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%;
}
.title {
font-size: 18px;
color: white;
}
.device-info {
width: 100%;
padding: 10px;
border-bottom: 1rpx solid rgba(255, 255, 255, 0.06);
}
.allSelect {
color: rgba(255, 255, 255, 0.87);
float: right;
}
.device-icon {
width: 30px;
height: 30px;
}
.device-id,
.device-serial {
color: white;
}
.permissions {
width: 100%;
margin-top: 20px;
padding: 10px;
border-bottom: 1rpx solid rgba(255, 255, 255, 0.06);
}
.permissions-title {
color: rgba(255, 255, 255, 0.87);
font-size: 30rpx;
/* padding: 30rpx 0rpx; */
}
.checkbox {
width: 40rpx;
height: 40rpx;
border: 2rpx solid rgba(255, 255, 255, 0.5);
margin-right: 20rpx;
border-radius: 4rpx;
display: flex;
align-items: center;
justify-content: center;
}
.checkbox.checked {
background-color: rgb(187, 230, 0);
border-color: rgb(187, 230, 0);
}
.permission-item {
margin-top: 10px;
display: flex;
color: rgba(255, 255, 255, 0.87);
line-height: 60rpx;
align-items: center;
cursor: pointer;
}
.recipient-info {
width: 100%;
margin-top: 20px;
padding: 10px;
border-radius: 5px;
}
.recipient-title {
color: rgba(255, 255, 255, 0.87);
font-size: 30rpx;
}
.phone-input {
width: 100%;
margin-top: 20rpx;
padding: 40rpx 0;
border-bottom: 1rpx solid rgba(255, 255, 255, 0.06);
color: rgba(255, 255, 255, 0.87);
}
.verification-code {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1rpx solid rgba(255, 255, 255, 0.06);
padding: 40rpx 0;
color: rgba(255, 255, 255, 0.87);
}
.get-code-btn {
margin-top: 10px;
background-color: transparent;
color: rgba(255, 255, 255, 0.87);
font-size: 30rpx;
white-space: nowrap;
}
.share-btn {
margin-top: 20px;
width: 100%;
padding: 5rpx;
border-radius: 91rpx;
background: rgba(187, 230, 0, 1);
}
/* 遮罩层 */
.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(187, 230, 0, 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>