1
0
forked from dyf/APP

尝试解决主分支冲突

This commit is contained in:
liub
2025-09-24 08:35:34 +08:00
50 changed files with 61143 additions and 13869 deletions

View File

@ -0,0 +1,145 @@
<template>
<div class="pageContent">
<view class="content">
<view class='ver_item'>
<input type="password" v-model="password" placeholder="请输入密码" class="input" />
</view>
<view class='ver_item'>
<input type="password" v-model="surePassword" placeholder="请输入确认密码" class="input" />
</view>
<button class="login-btn" @click="handleLogin">
确认
</button>
</view>
<!-- 成功提示弹框 -->
<CustomPopup :show="showPopupFlag" :title="popupTitle" :message="popupMessage"
icon="/static/images/common/sendSucc.png" :confirm-text="popupConfirmText" :show-cancel="false"
@confirm="onPopupConfirm" />
</div>
</template>
<script>
import CustomPopup from '@/components/CustomPopup/CustomPopup.vue'
import md5 from 'blueimp-md5'
import {
updatePassword
} from '@/api/common/login.js';
export default {
components: {
CustomPopup
},
data() {
return {
password: "",
surePassword: "",
showPopupFlag: false,
popupTitle: '',
popupMessage: '修改成功!',
popupConfirmText: '确认',
}
},
methods: {
// 确认
async handleLogin() {
if (!this.password.trim()) {
return uni.showToast({
title: "请输入密码",
icon: "none",
duration: 1500
});
return false
}
if (!this.surePassword.trim()) {
return uni.showToast({
title: "请输入确认密码",
icon: "none",
duration: 1500
});
return false
}
if (this.password.trim() !== this.surePassword.trim()) {
return uni.showToast({
title: "两次密码输入不一致",
icon: "none",
duration: 1500
});
return false
}
try {
uni.showLoading({
title: '加载中...'
})
// 调用忘记密码接口
const res = await updatePassword({
password: md5(this.password)
})
if (res.code == 200) {
uni.hideLoading()
this.showPopupFlag = true
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
} catch (error) {
uni.showToast({
title: error.msg || '登录失败',
icon: 'none'
});
uni.hideLoading()
}
},
// 确认
onPopupConfirm(){
uni.navigateBack()
}
}
}
</script>
<style scoped>
.pageContent {
background-color: rgb(18, 18, 18);
height: 100vh;
padding: 20rpx;
}
.content_con {
position: absolute;
top: 220rpx;
color: rgba(255, 255, 255, 0.87);
left: 30rpx;
font-size: 60rpx;
}
.input {
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
height: 80rpx;
color: rgba(255, 255, 255, 0.6);
margin-top: 50rpx;
}
.ver_item {
position: relative;
}
.switch-flex {
display: flex;
justify-content: space-between;
margin-top: 40rpx;
color: rgba(255, 255, 255, 0.6);
}
.switch-login {
color: rgb(187, 230, 0);
font-size: 28rpx;
}
.login-btn {
margin-top: 200rpx;
background-color: rgb(187, 230, 0);
color: rgb(35, 35, 35);
border-radius: 50rpx;
}
</style>

View File

@ -0,0 +1,122 @@
<template>
<view class="cancel-account-page">
<view class="content">
<view class="warning-icon">
<text class="icon-text">!</text>
</view>
<view class="tip-text">
注销账号后账号将永久失效且不可恢复并将放弃以下权益与服务
</view>
<view class="rights-list">
<view class="right-item">1. 账号将无法登录</view>
<view class="right-item">2. 设备数据将全部清除</view>
<view class="right-item">3. 个人资料等内容永久失效</view>
</view>
<!-- 确认注销按钮 -->
<button class="confirm-btn" @click="confirmBtn">确认注销</button>
</view>
</view>
</template>
<script>
import {
cancelAccount
} from '@/api/common/login.js'
export default {
data() {
return {}
},
methods: {
confirmBtn() {
let data = {}
cancelAccount(data).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '注销成功',
icon: 'none'
})
setTimeout(() => {
uni.navigateTo({
url: '/pages/common/login/index'
})
}, 1000)
}
})
}
},
}
</script>
<style scoped>
.cancel-account-page {
background: rgba(18, 18, 18, 1);
min-height: 100vh;
display: flex;
flex-direction: column;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
padding: 60rpx 30rpx;
flex: 1;
justify-content: flex-start;
}
.warning-icon {
width: 100rpx;
height: 100rpx;
background: rgba(224, 52, 52, 1);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 40rpx;
}
.icon-text {
color: #333;
font-size: 48rpx;
font-weight: bold;
}
.tip-text {
color: #fff;
font-size: 27rpx;
text-align: center;
margin-bottom: 40rpx;
padding: 40rpx 60rpx;
line-height: 40rpx;
color: rgba(255, 255, 255, 1);
}
.rights-list {
width: 100%;
background: rgba(26, 26, 26, 1);
padding: 30rpx;
border-radius: 16rpx;
margin-bottom: 120rpx;
}
.right-item {
color: rgba(255, 255, 255, 0.6);
font-size: 26rpx;
margin-bottom: 16rpx;
}
.right-item:last-child {
margin-bottom: 0;
}
.confirm-btn {
width: 80%;
color: #fff;
font-size: 30rpx;
border-radius: 91px;
background: rgba(224, 52, 52, 1);
position: absolute;
bottom: 50rpx;
box-sizing: border-box;
}
</style>

View File

@ -0,0 +1,85 @@
<template>
<div class="pageContent">
<view class="content">
<view class="menu-list">
<view class="menu-item" @click="changePassword">
<text class="title">修改登录密码</text>
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
</view>
<view class="menu-item" @click="deleteAccount">
<view class="title">注销账号</view>
<view class="menu_zx"> 注销后无法恢复请谨慎操作</view>
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
</view>
</view>
</view>
</div>
</template>
<script>
export default {
data() {
return {}
},
methods: {
// 修改密码
changePassword() {
uni.navigateTo({
url: '/pages/common/account/changepassword/index'
})
},
// 注销账号
deleteAccount() {
uni.navigateTo({
url: '/pages/common/account/deleteAccount/index'
})
},
},
}
</script>
<style scoped>
.pageContent {
background-color: rgb(18, 18, 18);
height: 100vh;
padding: 20rpx;
}
.menu-item {
font-size: 32rpx;
color: rgb(255, 255, 255);
padding: 30rpx 0;
border-bottom: 1rpx solid rgba(255, 255, 255, 0.04);
align-items: center;
background: rgba(26, 26, 26, 1);
position: relative;
margin-bottom: 24rpx;
}
.menu-item:last-child {
border-bottom: none;
}
.title {
padding-left: 20rpx;
padding-top: -8rpx;
font-size: 28rpx;
}
.uniIcon {
position: absolute;
right: 50rpx;
top: 30%;
}
.user-right {
margin-left: 30rpx;
}
.menu_zx {
color: rgba(255, 255, 255, 0.6);
font-size: 28rpx;
padding-left: 20rpx;
padding-top: 8rpx;
}
</style>

View File

@ -8,18 +8,24 @@
<view class="deviceName">
蓝牙名:{{device.name}}
</view>
<view class="deviceName">
状态:{{deviceStatu}}
</view>
<view class="deviceName">
设备名:{{device.deviceName}}
</view>
<view class="deviceId">
ID:{{device.deviceId}}
设备Mac:{{device.macAddress}}
</view>
<view class="deviceId">
设备IMEI:{{device.imei}}
</view>
<view class="bound" v-bind:class="boundStatu">
{{Statu.boundRemark}}
</view>
</view>
<view class="btnLink" @click="Link()">
连接
绑定
</view>
<global-loading ref="loading" />
@ -34,17 +40,20 @@
hideLoading,
updateLoading
} from '@/utils/loading.js';
const pagePath="pages/common/addBLE/LinkBle";
const pagePath = "pages/common/addBLE/LinkBle";
var these = null;
var eventChannel = null;
var ble = null;
export default {
data() {
return {
Statu: {
bound: null
bound: null,
timeInteval:null,
isSearch:false
},
device: {
"deviceId": "",
@ -56,8 +65,11 @@
],
"linkStatu": false,
"macAddress": ""
}
"macAddress": "",
"communicationMode":"",
"imei":""
},
serverDevice:null
}
},
computed: {
@ -70,100 +82,154 @@
} else {
return "red";
}
},
deviceStatu:function(){
if(!this.device.name){
return "";
}
if(!this.device.macAddress){
return '等待设备上报Mac地址';
}
if(!this.device.deviceName ){
if(this.Statu.isSearch){
return "无效设备";
}else{
if(this.Statu.timeInteval===null){
return "等待查询设备"
}else{
return "正在查询设备";
}
}
}else{
return "找到有效设备"
}
return "";
}
},
onBackPress() {
onUnload() {
console.log("返回时断开蓝牙连接,取消订阅");
ble.disconnectDevice(these.device.deviceId);
ble.removeReceiveCallback(pagePath);
},
onUnload() {
ble.removeReceiveCallback(pagePath);
},
onLoad(option) {
these = this;
ble = bleTool.getBleTool();
ble.addReceiveCallback((receive,f,path) => {
console.log("LinkBle")
ble.addReceiveCallback((receive, f, path) => {
console.log("收到设备消息,", receive);
if (these.device.deviceId == receive.deviceId) {
console.log("11111");
console.log("11111:",receive);
these.device.imei=f.imei;
if (receive.bytes[0] == 0xFC || receive.str.indexOf('mac address:') == 0) {
if (f && f.macAddress) {
these.device.macAddress = f.macAddress;
console.log("222222");
console.log("222222");
these.Statu.isSearch=false;
these.initDevice();
}
}
}
},pagePath);
}, pagePath);
eventChannel = this.getOpenerEventChannel();
eventChannel.on('LinkItem', function(data) {
console.log("data=", data);
let f = ble.data.LinkedList.find((v) => {
return v.deviceId = data.deviceId;
return v.deviceId == data.deviceId;
});
if (f) {
these.device = Object.assign({}, these.device, f);
console.log("获取到设备", f);
let keys = Object.keys(f);
keys.forEach((v, index) => {
these.device[v] = f[v];
})
// console.log("LinkedList=", ble.data.LinkedList)
// console.log("f=", f);
// console.log("获取到设备", these.device);
if (f.macAddress) {
these.device.macAddress = f.macAddress;
these.initDevice();
}
} else {
console.log("未获取到设备");
}
})
let inteval = setInterval(this.initDevice, 5000);
},
methods: {
initDevice: function() {
showLoading(these, {
text: '正在获取设备信息'
});
request({
url: '/app/device/getDeviceInfoByDeviceMac',
method: 'GET',
data: {
deviceMac: these.device.macAddress
}
}).then(res => {
console.log("获取设备信息", res);
if (res && res.code == 200) {
let data = res.data;
if (data) {
let keys = Object.keys(data);
ble.data.LinkedList.find((v) => {
if(v.deviceId = these.device.deviceId){
for (var i = 0; i < keys.length; i++) {
let key = keys[i];
v[key] = data[key];
console.log("key="+key);
console.log("value="+data[key]);
these.$set(these.device, key, data[key]);
}
ble.setBleData();
}
});
console.log("device=",these.device);
console.log("LinkedList=",ble.data.LinkedList);
if(!these.device.macAddress){
return;
}
clearTimeout(this.Statu.timeInteval);
this.Statu.timeInteval = setTimeout(() => {
this.Statu.isSearch=true;
showLoading(these, {
text: '正在获取设备信息'
});
console.log("these.device=", these.device);
request({
url: '/app/device/getDeviceInfoByDeviceMac',
method: 'GET',
data: {
deviceMac: these.device.macAddress
}
}
}).then(res => {
console.log("获取设备信息", res);
if (res && res.code == 200) {
let data = res.data;
this.serverDevice=data;
if (data) {
let keys = Object.keys(data);
ble.data.LinkedList.find((v) => {
if (v.deviceId == these.device.deviceId) {
for (var i = 0; i < keys.length; i++) {
let key = keys[i];
// if(!v.device){
// v.device={};
// }
// v.device[key] = data[key];
// console.log("key="+key);
// console.log("value="+data[key]);
these.$set(these.device, key, data[key]);
}
// ble.setBleData();
}
});
console.log("device=", these.device);
console.log("LinkedList=", ble.data.LinkedList);
}
}
}).catch((ex) => {
console.log("获取设备出现异常:", ex);
}).finally(() => {
this.Statu.timeInteval=null;
this.Statu.isSearch=false;
hideLoading(these);
});
}, 500);
}).catch((ex) => {
console.log("获取设备出现异常:", ex);
}).finally(() => {
hideLoading(these);
});
},
Link() {
// 调用绑定设备接口
let f = ble.data.LinkedList.find((v) => {
return v.deviceId = these.device.deviceId;
return v.deviceId == these.device.deviceId;
});
if (!f) {
these.Statu.bound = false;
@ -175,11 +241,16 @@
these.Statu.boundRemark = "设备上报Mac地址异常";
return;
}
if(!this.device.deviceName){
these.Statu.bound = false;
these.Statu.boundRemark = "设备未入库";
return;
}
these.Statu.bound = null;
these.Statu.boundRemark = "";
showLoading(these, {
text: "连接中..."
text: "绑定中..."
})
let promise = request({
url: '/app/device/bind',
@ -187,7 +258,7 @@
data: {
deviceImei: '',
deviceMac: these.device.macAddress,
communicationMode: '1', //0是4g,1是蓝牙
communicationMode: 1, //0是4g,1是蓝牙,2蓝牙&4G
}
});
promise.then((res) => {
@ -195,7 +266,23 @@
if (res.code == 200) {
these.Statu.bound = true;
these.Statu.boundRemark = "设备绑定成功!";
let data=these.serverDevice;
let keys = Object.keys(data);
ble.data.LinkedList.find((v) => {
if (v.deviceId == these.device.deviceId) {
for (var i = 0; i < keys.length; i++) {
let key = keys[i];
if(!v.device){
v.device={};
}
v.device[key] = data[key];
}
ble.updateCache();
}
});
ble.removeReceiveCallback(pagePath);
uni.$emit("refreshDeviceList");
setTimeout(() => {
@ -210,6 +297,7 @@
}).catch((ex) => {
these.Statu.bound = false;
these.Statu.boundRemark = '出现了未知的异常,操作失败';
console.log("ex=",ex);
}).finally(() => {
hideLoading(this);
});

View File

@ -10,7 +10,7 @@
<view class="imgContent center">
<view class="img center">
<image src="/static/images/bluetooth.png" class="titleIco" mode="aspectFit">
<image src="/static/images/common/bluetooth.png" class="titleIco" mode="aspectFit">
</image>
</view>
@ -27,7 +27,7 @@
<view class="item " v-for="item, index in PairEquip" v-show="PairEquip.length>0">
<view class="leftImg ">
<image src="/static/images/BLEAdd/device.png" class="titleIco" mode="aspectFit">
<image src="/static/images/common/bluetooth.png" class="titleIco" mode="heightFix">
</image>
</view>
<view class="centertxt ">
@ -49,7 +49,7 @@
<view class="item" v-on:click="Link(item,index)" v-for="item, index in EquipMents"
v-show="!item['linkStatu']">
<view class="leftImg ">
<image src="/static/images/BLEAdd/device.png" class="titleIco" mode="aspectFit">
<image src="/static/images/common/bluetooth.png" class="titleIco" mode="heightFix">
</image>
</view>
<view class="centertxt ">
@ -81,8 +81,8 @@
</view>
</view>
</BottomSlideMenuPlus>
<global-loading ref="loading" />
<global-loading ref="loading" />
</view>
</template>
@ -94,9 +94,10 @@
hideLoading,
updateLoading
} from '@/utils/loading.js'
const pagePath="pages/common/addBLE/addEquip";
const pagePath = "pages/common/addBLE/addEquip";
var ble = null;
var these = null;
var eventChannel = null;
export default {
data() {
return {
@ -128,7 +129,11 @@
},
PairEquip: [], //已配对设备
EquipMents: [] //搜索出来的设备
EquipMents: [], //搜索出来的设备
device: null,
item: {
deviceId: ''
}
}
},
computed: {
@ -136,28 +141,25 @@
},
onHide: function() {
ble.StopSearch();
ble.removeReceiveCallback(pagePath);
},
onBackPress: (e) => {
ble.StopSearch();
ble.removeDeviceFound(pagePath);
ble.removeReceiveCallback(pagePath);
},
onUnload(){
onUnload() {
ble.StopSearch();
ble.removeDeviceFound(pagePath);
ble.removeReceiveCallback(pagePath);
},
onLoad() {
these = this;
this.EquipMents = [];
ble = bleTool.getBleTool();
ble.addDeviceFound((arr) => {
arr = arr.devices;
for (var i = 0; i < arr.length; i++) {
arr[i].linkStatu = false;
if(!arr[i].name){
if (!arr[i].name) {
continue;
}
let f = these.EquipMents.find(function(v) {
@ -165,41 +167,59 @@
});
if (!f) {
these.EquipMents.push(arr[i]);
} else {
}
}
},pagePath);
// console.log("equip=", these.EquipMents)
}, pagePath);
// console.log("addEquip")
ble.addReceiveCallback((receivData, f, path, arr) => {
if (f.macAddress && these.device) {
showLoading(these, {
text: '正在验证设备'
});
setTimeout(() => {
these.DeviceVerdict(f.deviceId);
}, 0);
}
}, pagePath);
eventChannel = this.getOpenerEventChannel();
eventChannel.on('detailData', function(rec) {
console.log("接收到父页面的参数:", rec);
these.device = rec.data;
});
},
onShow: function() {
this.EquipMents=[];
this.PairEquip=[];
ble.StartSearch().catch((ex) => {
// this.EquipMents = [];
this.PairEquip = [];
ble && ble.StartSearch().then(res=>{
console.log("开始搜索成功",res);
}).catch((ex) => {
console.log("开始搜索出现异常",ex);
if (ex.code == 10001) {
these.showOpenSetting();
}
});
ble.addReceiveCallback((receivData) => {
console.log("收到数据了:", receivData);//数据格式:{bytes:[109,97],str:"",hexs:"FA 01"}
console.log("LinkedList=",ble.data.LinkedList);
let data=uni.getStorageSync(ble.StorageKey);
console.log("data=",data);
},pagePath);
},
methods: {
isItemLink: function(item, index) {
let src = '/static/images/BLEAdd/noLink.png';
if (this.PairEquip && this.PairEquip.length) {
if (this.PairEquip.length > 0) {
let f = this.PairEquip.find(function(v) {
@ -214,7 +234,7 @@
}
return src;
},
showOpenSetting: function() {
this.Status.BottomMenu.show = true;
@ -223,45 +243,121 @@
this.Status.BottomMenu.show = false;
ble.showBlueSetting(false);
},
Link: function(item, index) {
showLoading(this,{
text: "正在连接"
});
setTimeout(() => {
let serviceid=null;
if(item.advertisServiceUUIDs.length>0){
serviceid=item.advertisServiceUUIDs[0];
}
ble.LinkBlue(item.deviceId,serviceid).then((res) => {
let c = these.PairEquip.find(function(v) {
return v.deviceId == item.deviceId;
});
if (!c) {
these.PairEquip.push(item);
DeviceVerdict(deviceId) { //判断是否是目标设备
if (these.device) { //从设备详情过来的,回设备详情去
let f = ble.data.LinkedList.find(v => {
if (v.deviceId == deviceId) {
v.device = these.device;
return true;
}
ble.removeReceiveCallback(pagePath);
return false;
});
if (f.macAddress) {
if (f.macAddress != these.device.deviceMac) {
ble.disconnectDevice(deviceId);
updateLoading(these, {
text: "设备Mac地址错误,请重选设备连接"
})
return;
}
hideLoading(these);
ble.updateCache();
uni.navigateBack();
return true;
} else {
updateLoading(these, {
text: "等待设备上报Mac地址"
})
return undefined;
}
}
return false;
},
Link: function(item) {
this.item.deviceId = item.deviceId;
showLoading(this, {
text: "正在连接:第1次"
});
let index = 1;
let total = 5;
let linkCallback = (res) => {
let c = these.PairEquip.find(function(v) {
return v.deviceId == item.deviceId;
});
if (!c) {
these.PairEquip.push(item);
}
console.log("连接成功", these.device);
if (!these.device) {
console.log("跳转到绑定")
hideLoading(these);
uni.navigateTo({
url:"/pages/common/addBLE/LinkBle",
events:{
url: "/pages/common/addBLE/LinkBle",
events: {
},
success(res) {
res.eventChannel.emit('LinkItem', item);
res.eventChannel.emit('LinkItem', item);
}
});
return;
}
console.log("验证设备")
these.DeviceVerdict(item.deviceId);
}
let execLink = () => {
return new Promise((resolve, reject) => {
if (index > total) {
reject({
msg: "连接超时"
});
return;
}
ble.LinkBlue(item.deviceId).then((res) => {
console.log("连接成功");
resolve(res);
}).catch((ex) => {
if (index == total) {
console.log("连接了N次都没连上");
reject(ex);
return;
}
index++;
updateLoading(this, {
text: ex.msg + ",正在重试第" + index + "次"
})
execLink().then(resolve).catch(reject);
})
}).catch((ex) => {
console.log("ex=",ex)
uni.showModal({
content:"连接失败:"+ex.msg
});
}).finally(()=>{
hideLoading(this);
});
}, 0);
}
execLink().then((res) => {
linkCallback(res);
}).catch(ex => {
console.log("ex=", ex)
uni.showModal({
content: "连接失败:" + ex.msg
});
hideLoading(these);
});
}
@ -436,8 +532,8 @@
}
.list .item .leftImg {
width: 100rpx;
height: 70rpx;
width: 60rpx;
height: 60rpx;
}
.list .item .centertxt {
@ -469,7 +565,7 @@
font-family: "PingFang SC";
font-size: 26rpx;
font-weight: 400;
line-height: 50rpx;
line-height: 36rpx;
text-align: left;
}
@ -478,14 +574,14 @@
font-family: "PingFang SC";
font-size: 24rpx;
font-weight: 400;
line-height: 30rpx;
line-height: 36rpx;
text-align: left;
}
.list .item .rightIco .img {
width: 50rpx;
height: 50rpx;
width: 45rpx;
height: 45rpx;
}
.openBlue {

View File

@ -0,0 +1,524 @@
<template>
<view>
<view class="device-page">
<scroll-view class="tab-bar" scroll-x="true" scroll-with-animation>
<view class="tab-container">
<view v-for="(tab, index) in tabs" :key="index"
:class="['tab-item', activeTab === index ? 'active' : '']" @click="switchTab(tab,index)">
{{tab.name}}
</view>
</view>
</scroll-view>
<scroll-view class="device-list" scroll-y @scrolltolower="onScrollToLower" :lower-threshold="100"
style="height:80vh">
<view v-if="deviceList.length>0">
<view v-for="(group, groupIndex) in groupedDevices" :key="groupIndex">
<view class="share-header">
<text>{{
tabs[activeTab].name === '我的分享'
? `分享给“${group.sharedTo}”的设备`
: `来自“${group.othersharedTo}”分享的设备`
}}</text>
<text class="edit-btn"
@click="toggleEdit(groupIndex)">{{editingGroup === groupIndex ? '完成' : '编辑'}}</text>
</view>
<block>
<view class="device-card" v-for="(item, index) in group.devices" :key="index"
:ref="'swipeItem_' + index">
<view class="checkbox" v-if="editingGroup === groupIndex">
<uni-icons @click="handleDelete(item)" type="minus" size="20"
color="#FF4D4F"></uni-icons>
</view>
<view class="device-content" @click.stop="handleFile(item)">
<view class="device-header">
<view class="deviceIMG">
<image :src="item.devicePic" class="IMG" mode="aspectFit"></image>
</view>
<view class="device-name">
<view>设备:{{item.deviceName}}</view>
<view class="ID">
<view class="ID">
ID:{{item.deviceImei}}</view>
<!-- 在线状态 -->
<view class="onlines" v-if="item.onlineStatus==1">在线</view>
<!-- 离线状态 -->
<view class="offlines" v-if="item.onlineStatus==0">离线</view>
<view>电量{{item.battery || '0'}}%</view>
</view>
</view>
</view>
</view>
</view>
</block>
</view>
</view>
<view v-else class="noDATA">
<view>
<uni-icons type="image-filled" size="120" color="rgba(255, 255, 255, 0.9)"></uni-icons>
</view>
暂无数据
</view>
</scroll-view>
</view>
<!-- 删除弹框 -->
<view class="agreement-mask" v-if="deleteShow" @click="closePopup('delete')">
<view class="agreement-popupC" @click.stop>
<view class="popup-content">
<image src="/static/images/common/delel.png" class="svg" mode="aspectFit"></image>
<uni-icon class="trash"></uni-icon>
<view class="popup-Title">
{{ tabs[activeTab].name === '我的分享' ? '确定停止分享该设备' : '确定移除他人分享给你的这台设备' }}
</view>
</view>
<!-- 按钮组 -->
<view class="popup-buttons">
<button class="btn agreeBtn" @click="handleBtn">确定</button>
</view>
</view>
</view>
</view>
</template>
<script>
import {
deviceShareList,
otherDeviceShareList,
deviceShareDelete
} from '@/api/6170/share.js'
export default {
data() {
return {
deviceList: [],
tabs: [{
name: '我的分享',
},
{
name: '他人分享',
},
],
activeTab: 0,
deleteShow: false,
page: 1, // 当前页码
size: 10, // 每页条数
total: 0, // 总数据量
loading: false,
finished: false,
deviceId: '',
editingGroup: null, // 编辑的分组索引
currentGroup: null // 当前操作的分组
}
},
computed: {
// 根据分享用户分组设备
groupedDevices() {
const groups = {};
this.deviceList.forEach(device => {
// 这里假设device.sharedTo是分享目标的手机号
const key = this.activeTab === 0 ? device.phonenumber : device.otherPhonenumber;
const displayName = this.activeTab === 0 ? device.phonenumber : device.otherPhonenumber;
if (!groups[key]) {
groups[key] = {
sharedTo: displayName, // 显示用名称
othersharedTo: displayName, // 显示用名称
devices: []
};
}
groups[key].devices.push(device);
});
return Object.values(groups);
},
},
methods: {
// 点击弹框外的区域关闭
closePopup(type) {
if (type === 'delete') {
this.deleteShow = false;
}
},
// 跳转到详情页面
handleFile(item) {
let url = item.detailPageUrl;
uni.navigateTo({
// url: "/pages/6170/deviceControl/index",
url:url,
success: (res) => {
// 页面跳转成功后的回调函数
res.eventChannel.emit('detailData', {
data: item,
apiType: 'listB' // 自定义标识 // 自定义标识,详情哪里根据这个参数不同信息
});
}
})
},
// 编辑
toggleEdit(groupIndex) {
if (this.editingGroup === groupIndex) {
this.editingGroup = null;
} else {
this.editingGroup = groupIndex;
}
},
// 停止分享
handleDelete(item) {
console.log(item, 'www');
this.deleteShow = true
this.delelteItemInfo = item
},
// 确认停止移除
handleBtn() {
let allId = this.delelteItemInfo.id
deviceShareDelete(allId).then((res) => {
if (res.code = 200) {
uni.showToast({
title: res.msg,
icon: 'none'
})
this.deleteShow = false
this.editingGroup = null;
this.onIntall()
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
//
},
// tab切换页
switchTab(tab, index) {
//console.log(tab, 'tabsss');
this.deviceList = [];
this.activeTab = index;
this.page = 1; // 重置页
this.getData(tab);
},
// 获取设备列表
getData(tab) {
//console.log(tab.name, 'tab');
if (this.loading) return;
this.loading = true;
let data = {
pageNum: this.page,
pageSize: this.size,
}
// 根据当前tab决定调用哪个接口
const apiCall = tab.name === '我的分享' ? deviceShareList : otherDeviceShareList;
console.log('nihao');
apiCall(data).then((res) => {
if (res.code == 200) {
const newDevices = res.rows.map(device => ({
...device,
showConfirm: false,
sharedTo: device.phonenumber,
othersharedTo: device.otherPhonenumber
}));
// 分页处理
if (this.page === 1) {
this.deviceList = newDevices;
} else {
this.deviceList = [...this.deviceList, ...newDevices];
}
this.total = res.total;
// 判断是否已加载全部数据
if (res.rows.length < this.size || this.deviceList.length >= this.total) {
this.finished = true;
} else {
this.page++;
}
}
}).finally(() => {
this.loading = false;
});
},
// 滚动触底事件处理
onScrollToLower() {
this.getData();
},
onIntall() {
this.page = 1;
const currentTab = this.tabs[this.activeTab];
this.getData(currentTab);
},
},
onLoad() {
this.onIntall()
},
beforeDestroy() {
// 组件销毁前移除监听器
},
}
</script>
<style>
/* 页面整体样式 */
.device-page {
display: flex;
flex-direction: column;
min-height: 100vh;
background-color: rgb(18, 18, 18);
padding: 30rpx;
}
.tab-bar {
width: 100%;
color: rgb(255, 255, 255);
white-space: nowrap;
/* 禁止换行 */
overflow: hidden;
position: relative;
}
.tab-container {
display: flex;
/* justify-content: space-around; */
cursor: pointer;
margin-bottom: 40rpx;
/* min-width: 100%; */
/* 最小宽度 */
}
.tab-item {
font-size: 28rpx;
/* min-width: 120rpx; */
padding: 0 30rpx;
/* 左右内边距 */
text-align: center;
/* 文字居中 */
/* 设置最小宽度 */
}
.active {
color: rgba(187, 230, 0, 1);
border-bottom: 6rpx solid rgba(187, 230, 0, 1);
height: 60rpx;
}
/* 设备卡片 */
.device-card {
position: relative;
display: flex;
align-items: center;
width: 100%;
}
.device-content {
background-color: rgb(26, 26, 26);
border-radius: 16rpx;
margin-bottom: 20rpx;
position: relative;
padding: 20rpx;
width: 100%;
}
.device-header {
display: flex;
align-items: center;
margin-bottom: 15rpx;
}
.device-name {
font-size: 32rpx;
color: rgba(255, 255, 255, 0.87);
margin-left: 24rpx;
line-height: 50rpx;
width: 78%;
white-space: nowrap;
}
.ID {
color: rgba(255, 255, 255, 0.6);
font-size: 26rpx;
display: flex;
justify-content: space-between;
position: relative;
}
.circle {
width: 8rpx;
height: 40rpx;
position: absolute;
right: 25rpx;
top: 60rpx;
}
.online {
color: rgb(187, 230, 0);
}
.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%;
object-fit: contain;
}
.onlines {
position: relative;
}
.onlines::before {
content: '';
position: absolute;
width: 15rpx;
height: 15rpx;
background: rgb(0, 171, 103);
border-radius: 50%;
top: 20rpx;
left: -20rpx
}
.line {
width: 2rpx;
height: 24rpx;
background: linear-gradient(90deg,
rgba(0, 0, 0, 0) 0%,
rgb(255, 255, 255) 50%,
rgba(255, 255, 255, 0) 100%);
margin-top: 12rpx;
}
.loading-status {
text-align: center;
color: rgba(255, 255, 255, 0.6);
padding: 20rpx;
font-size: 22rpx;
}
.noDATA {
text-align: center;
color: rgba(255, 255, 255, 0.87);
transform: translate(-0%, 100%);
}
.share-header {
display: flex;
justify-content: space-between;
align-items: center;
color: rgba(255, 255, 255, 0.6);
font-size: 28rpx;
margin-bottom: 20rpx;
margin-top: 1rpx;
}
.edit-btn {
color: rgba(255, 255, 255, 0.6);
font-size: 26rpx;
}
/* 遮罩层 */
.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: 100%;
height: 50%;
background-color: rgb(42, 42, 42);
border-radius: 60rpx 60rpx 0rpx 0rpx;
padding: 40rpx;
box-sizing: border-box;
position: absolute;
bottom: 0rpx;
}
.agreement-popupC {
width: 65%;
background: rgba(56, 57, 52, 0.4);
border-radius: 40rpx;
padding: 30rpx;
text-align: center;
border: 1px solid rgba(224, 52, 52, 0.3);
}
.popup-flex {
display: flex;
white-space: nowrap;
color: rgba(255, 255, 255, 0.87);
height: 50rpx;
padding: 30rpx;
align-items: center;
}
.popup-input {
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 12rpx;
margin-left: 15rpx;
padding: 10rpx 0rpx;
font-size: 28rpx;
}
.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(224, 52, 52, 1);
color: rgba(255, 255, 255, 0.87);
border: none;
width: 170rpx !important;
}
.closeBtn {
border: 1px solid rgba(255, 255, 255, 0.2);
background-color: rgba(35, 35, 35, 0.87);
color: rgba(255, 255, 255, 1);
}
</style>

View File

@ -0,0 +1,431 @@
<template>
<view class="pageContent">
<image src="/static/images/common/login.png" mode="" class="login-bg"></image>
<view class="content_con">
找回密码
</view>
<view class="content">
<view class='ver_item'>
<input type="number" v-model="phone" :maxlength="11" placeholder="请输入手机号" class="input" />
</view>
<view class='ver_item'>
<input type="number" v-model="code" :maxlength="6" placeholder="请输入验证码" class="input" />
<button :class="showView?' get_phone_number blue':'get_phone_number grad'"
@click="getPhoneCode">{{ isCounting ? `${countdown}s后重新获取` : '获取验证码' }}</button>
</view>
<view class='ver_item'>
<input type="password" v-model="password" placeholder="请设置新密码(6—20个数字或字母)" class="input" />
</view>
<!-- 登录按钮 -->
<button class="login-btn" @click="handleLogin">
确定
</button>
<view class="login-title">已有账号<text class="gologin" @click="goLogin">去登录</text></view>
<!-- 协议勾选 -->
<view class="agreement">
<view class="custom-checkbox" @click="toggleCheck">
<view class="checkbox-icon" :class="{ checked: isChecked }">
<uni-icons v-if="isChecked" type="checkmarkempty" size="8" color="#fff"></uni-icons>
</view>
<text class="checkbox-label">我已认真阅读理解并同意<a class="agreeT"
@click.stop="goToPage('agreement')">用户服务协议</a><a class="agreeT"
@click.stop="goToPage('privacy')">隐私政策</a></text>
</view>
</view>
</view>
<!-- 弹框 -->
<view class="agreement-mask" v-if="showAgreement">
<!-- 协议弹窗 -->
<view class="agreement-popup" @click.stop>
<!-- 标题 -->
<view class="popup-title">服务协议及隐私政策</view>
<!-- 协议内容 -->
<view class="popup-content">
为了更好的保障您的合法权益请您阅读并同意以下协议
<text class="protocol-link" @click="openProtocol('user')">用户服务协议</text>
<text class="protocol-link" @click="openProtocol('privacy')">隐私政策</text>
</view>
<!-- 按钮组 -->
<view class="popup-buttons">
<button class="btn disagree" @click="handleDisagree">不同意</button>
<button class="btn agree" @click="handleAgree">同意</button>
</view>
</view>
</view>
</view>
</template>
<script>
import md5 from 'blueimp-md5'
import {
forgetPassword,
forgetPasswordSmsCode
} from '@/api/common/login.js';
export default {
data() {
return {
showView: false,
phone: '', //手机号码
code: "", //验证码
password: '', //密码
agreed: false,
isCounting: false,
countdown: 0,
isChecked: true,
showAgreement: false, // 控制弹窗显示
}
},
onLoad() {},
methods: {
// 获取验证码
async getPhoneCode() {
const phoneNumber = this.phone
const myreg = /^1[3456789]\d{9}$/;
if (!phoneNumber) {
uni.showToast({
title: '手机号不能为空',
icon: 'none',
duration: 1000
});
return false;
} else if (!myreg.test(phoneNumber)) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
});
return false;
}
try {
const res = await forgetPasswordSmsCode({
phonenumber: this.phone
})
if (res.code == 200) {
// 更新倒计时状态
this.isCounting = true;
this.showView = true;
this.countdown = 60
const timer = setInterval(() => {
this.countdown--
if (this.countdown <= 0) {
clearInterval(timer)
this.isCounting = false;
this.showView = false;
}
}, 1000)
uni.showToast({
title: '验证码已发送',
icon: 'none'
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
} catch (error) {}
},
// 勾选同意
toggleCheck() {
this.isChecked = !this.isChecked
},
// 登录
goLogin() {
uni.navigateTo({
url: '/pages/common/login/index'
})
},
// 登录
async handleLogin() {
if (this.phone == '') {
uni.showToast({
title: '手机号不能为空',
icon: 'none',
duration: 1000
})
return false
} else if (this.code == '') {
uni.showToast({
title: '验证码不能为空',
icon: 'none',
duration: 1000
})
return false
}
if (!this.password) {
uni.showToast({
title: '请设置新密码',
icon: 'none',
duration: 1000
});
return false
}
if (!this.isChecked) {
this.showAgreement = true
return false
}
try {
uni.showLoading({
title: '加载中...'
})
// 调用忘记密码接口
const res = await forgetPassword({
phonenumber: this.phone,
smsCode: this.code,
tenantId: '894078', //租户ID
password: md5(this.password)
})
if (res.code == 200) {
uni.hideLoading()
uni.showToast({
title: '密码修改成功',
icon: 'success'
})
uni.navigateTo({
url: '/pages/common/login/index'
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
} catch (error) {
console.log('捕获错误:', error);
uni.showToast({
title: error.msg || '登录失败',
icon: 'none'
});
uni.hideLoading()
}
},
// 跳转到协议页面
goToPage(type) {
const url = type === 'agreement' ?
'/pages/common/userAgreement/index' // 服务协议
:
'/pages/common/privacyAgreement/index'; // 隐私政策
uni.navigateTo({
url: url
});
},
// 不同意
handleDisagree() {
this.showAgreement = false
},
// 同意
handleAgree() {
this.isChecked = !this.isChecked
this.showAgreement = false
},
},
}
</script>
<style scoped>
.pageContent {
background: rgb(26, 26, 26);
height: 100vh;
}
.login-bg {
background-size: 100% 100%;
width: 100%;
height: 100%;
position: relative;
}
.content {
height: 70%;
width: 100%;
background: rgb(26, 26, 26);
position: absolute;
bottom: 0px;
border-radius: 60px 60px 0px 0px;
box-sizing: border-box;
padding: 30rpx;
}
.content_con {
position: absolute;
top: 220rpx;
color: rgba(255, 255, 255, 0.87);
left: 30rpx;
font-size: 60rpx;
}
.input {
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
height: 80rpx;
color: rgba(255, 255, 255, 0.6);
margin-top: 50rpx;
}
.ver_item {
position: relative;
}
.get_phone_number {
position: absolute;
right: 0px;
color: #999;
top: 1rpx;
background: rgb(26, 26, 26);
border: none;
text-align: right;
font-size: 28rpx;
font-family: PingFangSC-Medium, PingFang SC;
}
.grad {
color: rgb(187, 230, 0);
}
.blue {
color: rgb(187, 230, 0);
}
.agreement {
margin: 50rpx 0;
display: flex;
align-items: center;
font-size: 28rpx;
color: #666;
position: absolute;
bottom: 8rpx
}
.login-btn {
margin-top: 90rpx;
background-color: rgb(187, 230, 0);
color: rgb(35, 35, 35);
border-radius: 50rpx;
}
.login-btn[disabled] {
background-color: #ccc;
}
.login-title {
text-align: center;
color: rgba(255, 255, 255, 0.6);
padding-top: 20rpx;
}
.gologin {
color: rgba(187, 230, 0, 1);
}
.custom-checkbox {
display: flex;
align-items: center;
}
.checkbox-icon {
width: 30rpx;
height: 30rpx;
border: 1px solid rgba(255, 255, 255, 0.87);
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
margin-right: 10rpx;
}
.checkbox-icon.checked {
background-color: #07C160;
border-color: #07C160;
color: white;
}
.checkbox-label {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.87);
}
.agreeT {
color: rgb(187, 230, 0);
}
/* 遮罩层 */
.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: 999;
}
/* 弹窗主体 */
.agreement-popup {
width: 80%;
background-color: rgba(42, 42, 42);
border-radius: 16rpx;
padding: 40rpx;
box-sizing: border-box;
border: 1rpx solid rgba(187, 230, 0, 0.3)
}
/* 标题 */
.popup-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
margin-bottom: 30rpx;
color: rgba(255, 255, 255, 0.87);
}
/* 内容文本 */
.popup-content {
font-size: 30rpx;
line-height: 1.6;
color: rgba(255, 255, 255, 0.87);
margin-bottom: 50rpx;
}
/* 协议链接 */
.protocol-link {
color: rgb(187, 230, 0);
margin: 0 10rpx;
}
/* 按钮容器 */
.popup-buttons {
display: flex;
justify-content: space-between;
}
/* 通用按钮样式 */
.btn {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
font-size: 32rpx;
margin: 0 20rpx;
}
/* 不同意按钮 */
.disagree {
background-color: transparent;
color: rgba(255, 255, 255, 0.87);
border: 1px solid rgb(255, 255, 255);
font-size: 24rpx;
}
/* 同意按钮 */
.agree {
background-color: rgb(187, 230, 0);
color: #232323;
border: none;
font-size: 24rpx;
}
</style>

View File

@ -144,6 +144,8 @@
deviceUnbind, //删除设备
deviceReName
} from '@/api/common/index.js'
import BleHelper from '@/utils/BleHelper.js';
var ble=null;
export default {
onPullDownRefresh() {
// 执行下拉刷新时的操作,比如重新获取数据
@ -225,7 +227,7 @@
break;
case 'share':
uni.navigateTo({
url: "/pages/6170/allShare/index"
url: "/pages/common/allShare/index"
})
break;
}
@ -388,7 +390,9 @@
}, 500);
this.deleteShow = false
// 关闭所有滑动项
this.$refs.swipeAction.closeAll();
this.$refs.swipeAction.closeAll();
ble && ble.DropDevice(data.id);
} else {
uni.showToast({
title: res.msg,
@ -486,6 +490,10 @@
// 列表跳转
handleFile(item) {
let url = item.detailPageUrl;
// console.log("url=",url);
// if(!url){
//url="/pages/670/HBY670"
// }
uni.navigateTo({
url: url,
events: {
@ -498,6 +506,8 @@
deviceType: this.tabs[this.activeTab].id || '',
apiType: 'listA' //标识,根据这个参数,区分普通详情,分享跳转详情,查不一样的权限信息
});
},fail(ex) {
console.log("ex=",ex);
}
})
},
@ -549,6 +559,7 @@
console.log('列表收到消息了么');
this.onIntall()
});
ble=BleHelper.getBleTool();
},
beforeDestroy() {
// 组件销毁前移除监听器

View File

@ -8,11 +8,26 @@
<view class='ver_item'>
<input type="number" v-model="phone" :maxlength="11" placeholder="请输入手机号" class="input" />
</view>
<view class='ver_item'>
<view class='ver_item' v-if="isCodeLogin">
<input type="number" v-model="code" :maxlength="6" placeholder="请输入验证码" class="input" />
<button :class="showView?' get_phone_number blue':'get_phone_number grad'"
@click="getPhoneCode">{{ isCounting ? `${countdown}s后重新获取` : '获取验证码' }}</button>
</view>
<view class='ver_item' v-else>
<input type="password" v-model="password" placeholder="请输入密码" class="input" />
</view>
<view class="switch-flex">
<view class="switch-login" @click="switchLogin">
{{ isCodeLogin ? '密码登录' : '验证码登录' }}
</view>
<view v-if="!isCodeLogin" @click="forgotPassword">忘记密码</view>
</view>
<!-- 登录按钮 -->
<button class="login-btn" @click="handleLogin">
登录
</button>
<view class="login-title">没有账号<text class="gologin" @click="goLogin">去注册</text></view>
<!-- 协议勾选 -->
<view class="agreement">
<view class="custom-checkbox" @click="toggleCheck">
@ -24,10 +39,6 @@
@click.stop="goToPage('privacy')">隐私政策</a></text>
</view>
</view>
<!-- 登录按钮 -->
<button class="login-btn" @click="handleLogin">
登录
</button>
</view>
<!-- 弹框 -->
<view class="agreement-mask" v-if="showAgreement">
@ -52,6 +63,7 @@
</template>
<script>
import md5 from 'blueimp-md5'
import {
login,
resourceSmsCode
@ -60,39 +72,50 @@
data() {
return {
showView: false,
phone: '17671332251', //手机号码
phone: '13800138002', //手机号码
code: "123456", //验证码
password: "",
agreed: false,
isCounting: false,
countdown: 0,
isChecked: true,
showAgreement: false, // 控制弹窗显示
isCodeLogin: false,
}
},
onLoad(){
if(uni.getStorageSync("token") && uni.getStorageSync("clientID")){//免登陆
let time=uni.getStorageSync("tokenTime");
if(!time){
time=0;
onLoad() {
if (uni.getStorageSync("token") && uni.getStorageSync("clientID")) { //免登陆
let time = uni.getStorageSync("tokenTime");
if (!time) {
time = 0;
}
let currTime=new Date().getTime();
if(currTime<time){
let currTime = new Date().getTime();
if (currTime < time) {
console.log("登陆过,并且没过期,自动进入设备页");
uni.switchTab({
url: '/pages/common/index/index'
});
return;
}else{
} else {
//token过期了
uni.removeStorageSync("token")
uni.removeStorageSync("clientID")
uni.removeStorageSync("tokenTime")
}
}
},
methods: {
// 验证码密码切换
switchLogin() {
this.isCodeLogin = !this.isCodeLogin;
// 切换时重置相关输入和状态
this.code = "";
this.password = "";
this.isCounting = false;
this.countdown = 0;
this.showView = false;
},
// 获取验证码
async getPhoneCode() {
const phoneNumber = this.phone
@ -146,6 +169,18 @@
toggleCheck() {
this.isChecked = !this.isChecked
},
// 去登录
goLogin() {
uni.navigateTo({
url: '/pages/common/register/index'
})
},
// 忘记密码
forgotPassword() {
uni.navigateTo({
url: '/pages/common/forgotPassword/index'
})
},
// 登录
async handleLogin() {
if (this.phone == '') {
@ -155,64 +190,74 @@
duration: 1000
})
return false
} else if (this.code == '') {
uni.showToast({
title: '验证码不能为空',
icon: 'none',
duration: 1000
})
return false
}
if (this.isCodeLogin) {
if (this.code == '') {
uni.showToast({
title: '验证码不能为空',
icon: 'none',
duration: 1000
})
return false
}
} else {
if (this.password == '') {
uni.showToast({
title: '密码不能为空',
icon: 'none',
duration: 1000
})
return false
}
}
if (!this.isChecked) {
this.showAgreement = true
return false
}
try {
console.log('44444');
uni.showLoading({
title: '登录中...'
})
// 调用登录接口
const res = await login({
let loginParams = {
phonenumber: this.phone,
smsCode: this.code,
tenantId: '894078' //租户ID
})
tenantId: '894078' // 租户ID
};
if (this.isCodeLogin) {
loginParams.smsCode = this.code;
//登录方式 1:手机验证码登录 2:密码登录
loginParams.loginType=1
} else {
loginParams.loginPassword = md5(this.password);
loginParams.loginType=2
}
// 调用登录接口
const res = await login(loginParams)
if (res.code == 200) {
console.log(res, 'ressss');
uni.hideLoading();
uni.setStorageSync('token', res.data.access_token); // 缓存token
uni.setStorageSync('clientID', res.data.client_id); // 缓存token
uni.setStorageSync('tokenTime',new Date().getTime()+86400000);//过期时间
uni.hideLoading()
uni.setStorageSync('token', res.data.access_token) // 缓存token
uni.setStorageSync('clientID', res.data.client_id) // 缓存token
uni.setStorageSync('tokenTime', new Date().getTime() + 86400000); //过期时间
uni.showToast({
title: '登录成功',
icon: 'success'
})
uni.switchTab({
url: '/pages/common/index/index'
});
// uni.navigateTo({
// url:"/pages/BlueTooth/ModeSetting/index"
// });
})
} else {
uni.showToast({
title: res.msg,
title: res.msg || '服务器异常,请稍后重试',
icon: 'none'
})
}
} catch (error) {
uni.hideLoading()
console.log('捕获错误:', error);
uni.showToast({
title: error.msg,
title: error.msg || '登录失败',
icon: 'none'
});
uni.hideLoading()
}
},
// 跳转到协议页面
goToPage(type) {
@ -281,6 +326,20 @@
position: relative;
}
.switch-flex {
display: flex;
justify-content: space-between;
margin-top: 40rpx;
color: rgba(255, 255, 255, 0.6);
}
.switch-login {
color: rgb(187, 230, 0);
font-size: 28rpx;
}
.get_phone_number {
position: absolute;
right: 0px;
@ -307,10 +366,12 @@
align-items: center;
font-size: 28rpx;
color: #666;
position: absolute;
bottom: 8rpx
}
.login-btn {
margin-top: 150rpx;
margin-top: 90rpx;
background-color: rgb(187, 230, 0);
color: rgb(35, 35, 35);
border-radius: 50rpx;
@ -320,6 +381,16 @@
background-color: #ccc;
}
.login-title {
text-align: center;
color: rgba(255, 255, 255, 0.6);
padding-top: 20rpx;
}
.gologin {
color: rgba(187, 230, 0, 1);
}
.custom-checkbox {
display: flex;
align-items: center;

View File

@ -89,14 +89,29 @@
} catch (error) {}
}
},
},
onLoad(options) {
if (options.deviceId) {
this.deviceId = decodeURIComponent(options.deviceId);
} else {
this.deviceId = '未获取到设备ID';
}
},
// 处理返回键
onBackPress() {
// 如果绑定成功了,返回时也要刷新首页
if (this.isSuccess) {
uni.$emit('refreshDeviceList');
}
return false; // 允许正常返回
},
// 页面卸载时处理
onUnload() {
// 如果绑定成功了,卸载时也要刷新首页
if (this.isSuccess) {
uni.$emit('refreshDeviceList');
}
},
onLoad(options) {
if (options.deviceId) {
this.deviceId = decodeURIComponent(options.deviceId);
} else {
this.deviceId = '未获取到设备ID';
}
}
}
</script>

View File

@ -0,0 +1,433 @@
<template>
<view class="pageContent">
<image src="/static/images/common/login.png" mode="" class="login-bg"></image>
<view class="content_con">
欢迎注册
</view>
<view class="content">
<view class='ver_item'>
<input type="number" v-model="phone" :maxlength="11" placeholder="请输入手机号" class="input" />
</view>
<view class='ver_item'>
<input type="number" v-model="code" :maxlength="6" placeholder="请输入验证码" class="input" />
<button :class="showView?' get_phone_number blue':'get_phone_number grad'"
@click="getPhoneCode">{{ isCounting ? `${countdown}s后重新获取` : '获取验证码' }}</button>
</view>
<view class='ver_item'>
<input type="password" v-model="password" placeholder="请设置密码(6—20个数字或字母" class="input" />
</view>
<!-- 登录按钮 -->
<button class="login-btn" @click="handleLogin">
注册
</button>
<view class="login-title">已有账号<text class="gologin" @click="goLogin">去登录</text></view>
<!-- 协议勾选 -->
<view class="agreement">
<view class="custom-checkbox" @click="toggleCheck">
<view class="checkbox-icon" :class="{ checked: isChecked }">
<uni-icons v-if="isChecked" type="checkmarkempty" size="8" color="#fff"></uni-icons>
</view>
<text class="checkbox-label">我已认真阅读理解并同意<a class="agreeT"
@click.stop="goToPage('agreement')">用户服务协议</a><a class="agreeT"
@click.stop="goToPage('privacy')">隐私政策</a></text>
</view>
</view>
</view>
<!-- 弹框 -->
<view class="agreement-mask" v-if="showAgreement">
<!-- 协议弹窗 -->
<view class="agreement-popup" @click.stop>
<!-- 标题 -->
<view class="popup-title">服务协议及隐私政策</view>
<!-- 协议内容 -->
<view class="popup-content">
为了更好的保障您的合法权益请您阅读并同意以下协议
<text class="protocol-link" @click="openProtocol('user')">用户服务协议</text>
<text class="protocol-link" @click="openProtocol('privacy')">隐私政策</text>
</view>
<!-- 按钮组 -->
<view class="popup-buttons">
<button class="btn disagree" @click="handleDisagree">不同意</button>
<button class="btn agree" @click="handleAgree">同意</button>
</view>
</view>
</view>
</view>
</template>
<script>
import md5 from 'blueimp-md5'
import {
register,
registerSmsCode
} from '@/api/common/login.js';
export default {
data() {
return {
showView: false,
phone: '', //手机号码
code: "", //验证码
password: '', //密码
agreed: false,
isCounting: false,
countdown: 0,
isChecked: true,
showAgreement: false, // 控制弹窗显示
}
},
onLoad() {},
methods: {
// 获取验证码
async getPhoneCode() {
const phoneNumber = this.phone
const myreg = /^1[3456789]\d{9}$/;
if (!phoneNumber) {
uni.showToast({
title: '手机号不能为空',
icon: 'none',
duration: 1000
});
return false;
} else if (!myreg.test(phoneNumber)) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
});
return false;
}
try {
const res = await registerSmsCode({
phonenumber: this.phone
})
if (res.code == 200) {
// 更新倒计时状态
this.isCounting = true;
this.showView = true;
this.countdown = 60
const timer = setInterval(() => {
this.countdown--
if (this.countdown <= 0) {
clearInterval(timer)
this.isCounting = false;
this.showView = false;
}
}, 1000)
uni.showToast({
title: '验证码已发送',
icon: 'none'
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
} catch (error) {}
},
// 勾选同意
toggleCheck() {
this.isChecked = !this.isChecked
},
// 登录
goLogin() {
uni.navigateTo({
url: '/pages/common/login/index'
})
},
// 登录
async handleLogin() {
if (this.phone == '') {
uni.showToast({
title: '手机号不能为空',
icon: 'none',
duration: 1000
})
return false
} else if (this.code == '') {
uni.showToast({
title: '验证码不能为空',
icon: 'none',
duration: 1000
})
return false
} else if (!this.password) {
uni.showToast({
title: '请设置密码',
icon: 'none',
duration: 1000
});
return false
}
if (!this.isChecked) {
this.showAgreement = true
return false
}
try {
uni.showLoading({
title: '注册中...'
})
// 调用登录接口
const res = await register({
phonenumber: this.phone,
smsCode: this.code,
tenantId: '894078', //租户ID
password: md5(this.password)
})
if (res.code == 200) {
uni.hideLoading()
uni.showToast({
title: '注册成功',
icon: 'success'
})
uni.navigateTo({
url: '/pages/common/login/index'
})
} else {
uni.showToast({
title: res.msg || '服务器异常,请稍后重试',
icon: 'none'
})
}
} catch (error) {
console.log('捕获错误:', error);
uni.showToast({
title: error.msg || '登录失败',
icon: 'none'
});
uni.hideLoading()
}
},
// 跳转到协议页面
goToPage(type) {
const url = type === 'agreement' ?
'/pages/common/userAgreement/index' // 服务协议
:
'/pages/common/privacyAgreement/index'; // 隐私政策
uni.navigateTo({
url: url
});
},
// 不同意
handleDisagree() {
this.showAgreement = false
},
// 同意
handleAgree() {
this.isChecked = !this.isChecked
this.showAgreement = false
},
},
}
</script>
<style scoped>
.pageContent {
background: rgb(26, 26, 26);
height: 100vh;
}
.login-bg {
background-size: 100% 100%;
width: 100%;
height: 100%;
position: relative;
}
.content {
height: 70%;
width: 100%;
background: rgb(26, 26, 26);
position: absolute;
bottom: 0px;
border-radius: 60px 60px 0px 0px;
box-sizing: border-box;
padding: 30rpx;
}
.content_con {
position: absolute;
top: 220rpx;
color: rgba(255, 255, 255, 0.87);
left: 30rpx;
font-size: 60rpx;
}
.input {
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
height: 80rpx;
color: rgba(255, 255, 255, 0.6);
margin-top: 50rpx;
}
.ver_item {
position: relative;
}
.get_phone_number {
position: absolute;
right: 0px;
color: #999;
top: 1rpx;
background: rgb(26, 26, 26);
border: none;
text-align: right;
font-size: 28rpx;
font-family: PingFangSC-Medium, PingFang SC;
}
.grad {
color: rgb(187, 230, 0);
}
.blue {
color: rgb(187, 230, 0);
}
.agreement {
margin: 50rpx 0;
display: flex;
align-items: center;
font-size: 28rpx;
color: #666;
position: absolute;
bottom: 8rpx
}
.login-btn {
margin-top: 90rpx;
background-color: rgb(187, 230, 0);
color: rgb(35, 35, 35);
border-radius: 50rpx;
}
.login-btn[disabled] {
background-color: #ccc;
}
.login-title {
text-align: center;
color: rgba(255, 255, 255, 0.6);
padding-top: 20rpx;
}
.gologin {
color: rgba(187, 230, 0, 1);
}
.custom-checkbox {
display: flex;
align-items: center;
}
.checkbox-icon {
width: 30rpx;
height: 30rpx;
border: 1px solid rgba(255, 255, 255, 0.87);
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
margin-right: 10rpx;
}
.checkbox-icon.checked {
background-color: #07C160;
border-color: #07C160;
color: white;
}
.checkbox-label {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.87);
}
.agreeT {
color: rgb(187, 230, 0);
}
/* 遮罩层 */
.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: 999;
}
/* 弹窗主体 */
.agreement-popup {
width: 80%;
background-color: rgba(42, 42, 42);
border-radius: 16rpx;
padding: 40rpx;
box-sizing: border-box;
border: 1rpx solid rgba(187, 230, 0, 0.3)
}
/* 标题 */
.popup-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
margin-bottom: 30rpx;
color: rgba(255, 255, 255, 0.87);
}
/* 内容文本 */
.popup-content {
font-size: 30rpx;
line-height: 1.6;
color: rgba(255, 255, 255, 0.87);
margin-bottom: 50rpx;
}
/* 协议链接 */
.protocol-link {
color: rgb(187, 230, 0);
margin: 0 10rpx;
}
/* 按钮容器 */
.popup-buttons {
display: flex;
justify-content: space-between;
}
/* 通用按钮样式 */
.btn {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
font-size: 32rpx;
margin: 0 20rpx;
}
/* 不同意按钮 */
.disagree {
background-color: transparent;
color: rgba(255, 255, 255, 0.87);
border: 1px solid rgb(255, 255, 255);
font-size: 24rpx;
}
/* 同意按钮 */
.agree {
background-color: rgb(187, 230, 0);
color: #232323;
border: none;
font-size: 24rpx;
}
</style>

View File

@ -157,7 +157,7 @@ export default {
const statusRes = await getdeviceSTatus({
functionMode: 2,
batchId,
typeName,
typeName:'FunctionAccessBatchStatusRule',
deviceImei,
interval: 500
},

View File

@ -0,0 +1,98 @@
<template>
<view class="share">
<!-- 内容区域 -->
<view class="content">
<!-- 分享设备 -->
<view class="section" @click="shareDevice">
<text class="section-title">分享设备</text>
</view>
<!-- 分享管理 -->
<view class="section" @click="shareManagement">
<text class="section-title">分享管理</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
itemInfo:""
}
},
methods: {
// 分享设备
shareDevice(){
uni.navigateTo({
url: '/pages/common/shareDevices/index',
events: {
ack: function(data) {}
},
success: (res) => {
res.eventChannel.emit('shareDevice', {
data: this.itemInfo,
});
}
});
},
// 分享管理
shareManagement(){
uni.navigateTo({
url: '/pages/common/shareManagement/index',
events: {
ack: function(data) {}
},
success: (res) => {
res.eventChannel.emit('shareManagement', {
data: this.itemInfo,
});
}
});
}
},
onLoad() {
const eventChannel = this.getOpenerEventChannel();
// 监听 'shareDevice' 事件,获取传过来的数据
eventChannel.on('share', (data) => {
console.log(data,'datat');
this.itemInfo = data.data;
})
}
}
</script>
<style scoped>
.share {
padding: 30rpx;
background: #121212;
min-height: 100vh;
}
.status-bar {
/* 根据实际情况设置状态栏高度 */
width: 100%;
height: 20px;
background-color: #f3f3f3;
}
.title {
font-size: 20px;
margin-top: 10px;
}
.content {
width: 100%;
margin-top: 20px;
}
.section {
margin-bottom: 20px;
padding:50rpx;
border-radius: 16rpx;
background: rgba(26, 26, 26, 1);
text-align: center;
color: rgba(255, 255, 255, 0.87);
width: 100%;
}
</style>

View File

@ -0,0 +1,449 @@
<template>
<view class="container">
<!-- 设备信息 -->
<view class="device-info">
<view class="device-header">
<view class="deviceIMG">
<image :src="itemInfo.devicePic" mode="aspectFit" class="IMG"></image>
</view>
<view class="device-name">
<view>设备:{{itemInfo.deviceName}}</view>
<view class="ID">
<view class="ID">ID: {{itemInfo.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" v-model="phone" placeholder="输入手机号" class="phone-input" :maxlength="11" />
<view class="verification-code">
<input type="number" v-model="code" placeholder="短信验证码" class="code-input" :maxlength="6" />
<view class="get-code-btn" :class="showView?' get_phone_number blue':'get_phone_number grad'"
@click="getPhoneCode">{{ isCounting ? `${countdown}s后重新获取` : '获取验证码' }}</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/common/success.png" mode="aspectFit" 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>
import {
deviceShareId,
deviceShareCode,
deviceShareAdd
} from '@/api/6170/share.js'
import Common from '@/utils/Common.js'
export default {
data() {
return {
allSelected: false,
shareShow: false,
showView: false,
isCounting: false,
countdown: 0,
permissions: [{
value: "1",
label: "灯光模式",
checked: false
},
{
value: "2",
label: "激光模式",
checked: false
},
{
value: "3",
label: "开机画面",
checked: false
},
{
value: "4",
label: "人员信息登记",
checked: false
},
{
value: "5",
label: "发送信息",
checked: false
},
{
value: "6",
label: "产品信息",
checked: false
}
],
deviceInfo: {},
phone: '',
code: '',
itemInfo: ''
};
},
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);
},
// 获取验证码
async getPhoneCode() {
const phoneNumber = this.phone
const myreg = /^1[3456789]\d{9}$/;
if (!phoneNumber) {
uni.showToast({
title: '手机号不能为空',
icon: 'none',
duration: 1000
});
return false;
} else if (!myreg.test(phoneNumber)) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
});
return false;
}
try {
await deviceShareCode({
phonenumber: this.phone
})
// 更新倒计时状态
this.isCounting = true;
this.showView = true;
this.countdown = 60
const timer = setInterval(() => {
this.countdown--
if (this.countdown <= 0) {
clearInterval(timer)
this.isCounting = false;
this.showView = false;
}
}, 1000)
uni.showToast({
title: '验证码已发送',
icon: 'none'
})
} catch (error) {}
},
// 分享按钮提交
async shareUp() {
if (this.phone == '') {
uni.showToast({
title: '手机号不能为空',
icon: 'none',
duration: 1000
})
return false
} else if (this.code == '') {
uni.showToast({
title: '验证码不能为空',
icon: 'none',
duration: 1000
})
return false
}else if (!this.permissions.some(permission => permission.checked)) {
uni.showToast({
title: '请选择至少一个功能权限',
icon: 'none',
duration: 1000
});
return false;
}
try {
uni.showLoading({
title: '分享中'
})
const selectedPermissions = this.permissions.filter(permission => permission.checked).map(
permission =>
permission.value);
const res = await deviceShareAdd({
phonenumber: this.phone,
smsCode: this.code,
deviceId: this.itemInfo.id,
permission: selectedPermissions.join(',')
})
if (res.code == 200) {
this.shareShow = true
uni.hideLoading()
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
} catch (error) {
uni.showToast({
title: error.msg,
icon: 'none'
});
}
},
handleBtn() {
this.shareShow = false
uni.navigateTo({
url: '/pages/common/allShare/index'
})
},
},
onLoad() {
const eventChannel = this.getOpenerEventChannel();
// 监听 'shareDevice' 事件,获取传过来的数据
eventChannel.on('shareDevice', (data) => {
console.log(data, 'data1t111');
this.itemInfo = data.data;
this.permissions=Common.getPermissions(this.itemInfo.persissonType);
})
}
};
</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:30rpx;
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:35rpx;
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.8);
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: rgba(56, 57, 52, 0.4);
border-radius: 40rpx;
padding: 30rpx;
text-align: center;
border: 1px solid rgba(187, 230, 0, 0.3);
}
.svg {
width: 58rpx;
height:58rpx;
}
/* 通用按钮样式 */
.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>

View File

@ -0,0 +1,266 @@
<template>
<view class="share">
<view class="device-title">已分享用户</view>
<view class="device-info" v-for="(item, index) in deviceList" :key="index">
<view class="device-header" @click.stop="handleFile(item)">
<view class="deviceIMG">
<image src="@/static/images/common/user.png" mode="aspectFit" class="IMG"></image>
</view>
<view class="device-name">
<view>用户名{{item.deviceName}}</view>
<view class="ID">
<view class="ID">{{item.phonenumber}}
</view>
</view>
</view>
<view class="device-delete">
<text class="delete" @click.stop="handleDelete(item)">移除</text>
</view>
</view>
</view>
<!-- 删除弹框 -->
<view class="agreement-mask" v-if="deleteShow" @click="closePopup('delete')">
<view class="agreement-popup" @click.stop>
<view class="popup-content">
<image src="/static/images/common/delel.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>
<script>
import {
deviceShareList,
deviceShareDelete
} from '@/api/6170/share.js'
export default {
data() {
return {
deviceList: [],
deleteShow: false,
delelteItemInfo: '',
itemInfo: ''
}
},
methods: {
// 点击弹框外的区域关闭
closePopup(type) {
if (type === 'delete') {
this.deleteShow = false;
}
},
// 删除
handleDelete(item) {
console.log(item, 'www');
this.deleteShow = true
this.delelteItemInfo = item
},
handleBtn() {
let allId = this.delelteItemInfo.id
deviceShareDelete(allId).then((res) => {
if (res.code = 200) {
uni.showToast({
title: res.msg,
icon: 'none'
})
this.deleteShow = false
this.getData()
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
//
},
getData(val) {
let data = {
deviceId: val
}
deviceShareList(data).then((res) => {
if (res.code == 200) {
this.deviceList = res.rows
}
})
},
// 跳转分享详情
handleFile(item) {
let url = item.detailPageUrl;
console.log(item,'item');
uni.navigateTo({
url: url,
success: (res) => {
// 页面跳转成功后的回调函数
res.eventChannel.emit('detailData', {
data: item,
apiType: 'listB' // 自定义标识 // 自定义标识,详情哪里根据这个参数不同信息
});
}
})
}
},
onLoad() {
const eventChannel = this.getOpenerEventChannel();
// 监听 'shareDevice' 事件,获取传过来的数据
eventChannel.on('shareManagement', (data) => {
console.log(data, 'data1t111');
this.itemInfo = data.data;
this.getData(this.itemInfo.id)
})
}
}
</script>
<style scoped>
.share {
padding: 30rpx;
background: #121212;
min-height: 100vh;
}
.device-title {
color: rgba(255, 255, 255, 0.87);
padding: 30rpx 0;
}
.device-info {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.87);
padding-top: 10rpx;
position: relative;
margin-bottom: 20rpx;
}
.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;
}
.deviceIMG {
/* width: 100rpx; */
/* height: 100rpx; */
position: relative;
display: flex;
align-items: center;
}
.device-delete {
text-align: end;
width: 50%;
}
.delete {
border-radius: 32px;
background: rgba(255, 200, 78, 0.06);
display: inline-block;
width: 152rpx;
height: 60rpx;
text-align: center;
line-height: 60rpx;
color: rgba(224, 52, 52, 1);
cursor: pointer;
}
.IMG {
width: 120rpx;
height: 100rpx;
margin-left: 17%;
}
.title {
font-size: 18px;
color: white;
}
.device-info {
width: 100%;
padding: 10px;
background: rgba(26, 26, 26, 1);
border-radius: 16rpx;
}
/* 遮罩层 */
.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: rgba(56, 57, 52, 0.4);
border-radius: 40rpx;
padding: 30rpx;
text-align: center;
border: 1px solid rgba(224, 52, 52, 0.3);
}
.svg {
width: 58rpx;
height: 58rpx;
}
/* 通用按钮样式 */
.btn {
height: 60rpx;
line-height: 60rpx;
border-radius: 40rpx;
font-size: 24rpx;
margin: 10rpx auto;
text-align: center;
}
/* 同意按钮 */
.agreeBtn {
background: rgba(224, 52, 52, 1);
color: rgba(255, 255, 255, 0.87);
border: none;
width: 170rpx !important;
}
</style>

View File

@ -6,7 +6,7 @@
<image src="/static/images/common/logo.png" class="logo"></image>
</view>
<view class="user-right">
<view class="user-title">武汉研创</view>
<view class="user-title">武汉星汉</view>
<view class="ID">ID:123456</view>
</view>
</view>
@ -27,6 +27,11 @@
<text class="title">关于我们</text>
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
</view>
<view class="menu-item" @click="account">
<image src="/static/images/common/wm.png" class="icon"></image>
<text class="title">账号安全</text>
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
</view>
<view class="btn_footer">
<button class="logout" @click="logout">退出登录</button>
</view>
@ -110,6 +115,12 @@
uni.navigateTo({
url: '/pages/common/aboutUs/index'
})
},
// 账户安全
account(){
uni.navigateTo({
url: '/pages/common/account/index'
})
}
},
}