mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 00:45:55 +08:00
添加了一些页面
This commit is contained in:
91
wechat/miniprogram/pages/someData/index.js
Normal file
91
wechat/miniprogram/pages/someData/index.js
Normal file
@@ -0,0 +1,91 @@
|
||||
// miniprogram/pages/someData/index.js
|
||||
const { requestApi } = require('../../API/request.js');
|
||||
let timer = null;
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
deviceInfo:{},
|
||||
deviceData:{}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
wx.setNavigationBarTitle({
|
||||
title: '环境监测'
|
||||
})
|
||||
this.getLastPageData();
|
||||
this.getData();
|
||||
timer = setInterval(() => {
|
||||
this.getData();
|
||||
}, 1000);
|
||||
},
|
||||
|
||||
|
||||
async getData(){
|
||||
let that = this;
|
||||
const res = await requestApi(`/system/status/newByNum/${this.data.deviceInfo.deviceNum}`,{ method:'GET' });
|
||||
const data = JSON.parse(res.result);
|
||||
data.data.remark = JSON.parse(data.data.remark)
|
||||
this.setData({ deviceData:data.data })
|
||||
},
|
||||
|
||||
getLastPageData(){
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
eventChannel.on('getDeviceInfo',(data)=>{
|
||||
this.setData({ deviceInfo:data })
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
clearInterval(timer);
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
5
wechat/miniprogram/pages/someData/index.json
Normal file
5
wechat/miniprogram/pages/someData/index.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-divider": "@vant/weapp/divider/index"
|
||||
}
|
||||
}
|
||||
112
wechat/miniprogram/pages/someData/index.wxml
Normal file
112
wechat/miniprogram/pages/someData/index.wxml
Normal file
@@ -0,0 +1,112 @@
|
||||
<!--miniprogram/pages/someData/index.wxml-->
|
||||
<div class="bg"></div>
|
||||
<div class="wave-box">
|
||||
<div class="wave-cover" style="top:{{100 - deviceData.airTemperature }}%">
|
||||
<div class="a"></div>
|
||||
<div class="b"></div>
|
||||
</div>
|
||||
<div class="slot">
|
||||
<div class="temp">
|
||||
<div class="temp-title">
|
||||
<image class="big-icon" src="/icons/temp.png" />
|
||||
<text style="font-size:42rpx">空气温度</text>
|
||||
</div>
|
||||
<div class="value">
|
||||
<text style="font-size:86rpx">{{ deviceData.airTemperature }}</text>
|
||||
<text>℃</text>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hr"></div>
|
||||
<div class="humi">
|
||||
<div class="humi-title">
|
||||
<image class="sm-icon" src="/icons/humi.png" />
|
||||
<text style="font-size:32rpx">空气湿度:</text>
|
||||
</div>
|
||||
<div class="value">
|
||||
<text style="font-size:46rpx">{{ deviceData.airHumidity }}</text>
|
||||
<text>%</text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="info-card">
|
||||
<div class="card-title">其他数据</div>
|
||||
<div class="card-body">
|
||||
<div class="card-item">
|
||||
<div class="item-name">
|
||||
<image class="mid-icon" src="/icons/redline.png" />
|
||||
<text class="item-title">人体红外:</text>
|
||||
<text wx:if="{{ deviceData.remark.isHuman === 1}}" style="color:green">检测到人体</text>
|
||||
<text wx:if="{{ deviceData.remark.isHuman === 0}}" style="color:red">未检测到人体</text>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-item">
|
||||
<div class="item-name">
|
||||
<image class="mid-icon" src="/icons/device_temp.png" />
|
||||
<text class="item-title">设备温度:</text>
|
||||
<text>{{ deviceData.deviceTemperature||'--' }}</text>
|
||||
<text>℃</text>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-item">
|
||||
<div class="item-name">
|
||||
<image class="mid-icon" src="/icons/qiya.png" />
|
||||
<text class="item-title">气压:</text>
|
||||
<text>{{ deviceData.remark.pressure||'--' }}</text>
|
||||
<text>Pa</text>
|
||||
</div>
|
||||
</div>
|
||||
<van-divider contentPosition="center" dashed>加速度</van-divider>
|
||||
<div class="card-item">
|
||||
<div class="item-name">
|
||||
<image class="mid-icon" src="/icons/jiasudu.png" />
|
||||
<text class="item-title">加速度</text>
|
||||
</div>
|
||||
<div class="jiasudu">
|
||||
<div class="jiasudu-item"><div class="point"></div> x方向:{{ deviceData.remark.acc_x || '--' }} m/s²</div>
|
||||
<div class="jiasudu-item"><div class="point"></div> y方向:{{ deviceData.remark.acc_y || '--' }} m/s²</div>
|
||||
<div class="jiasudu-item"><div class="point"></div> z方向:{{ deviceData.remark.acc_z ||'--' }} m/s²</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="data_one">
|
||||
<div class="data-item">
|
||||
<div class="item-name">
|
||||
<image class="mid-icon" src="/icons/device_temp.png" />
|
||||
<text class="item-title">设备温度:</text>
|
||||
<text>{{ deviceData.deviceTemperature||'--' }}</text>
|
||||
<text>℃</text>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="item-name">
|
||||
<image class="mid-icon" src="/icons/qiya.png" />
|
||||
<text class="item-title">气压:</text>
|
||||
<text>{{ deviceData.remark.pressure||'--' }}</text>
|
||||
<text>Pa</text>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data-item long">
|
||||
<div class="item-name l">
|
||||
<image class="mid-icon" src="/icons/redline.png" />
|
||||
<text class="item-title">人体红外:</text>
|
||||
<text wx:if="{{ deviceData.remark.isHuman === 1}}" style="color:green">检测到人体</text>
|
||||
<text wx:if="{{ deviceData.remark.isHuman === 0}}" style="color:red">未检测到人体</text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="h">
|
||||
<van-divider contentPosition="center" dashed>加速度</van-divider>
|
||||
</div>
|
||||
<div class="data_two">
|
||||
<div class="data">
|
||||
<image class="mid-icon" src="/icons/jiasudu.png" />
|
||||
<text class="item-title">加速度</text>
|
||||
</div>
|
||||
<div class="jiasudu">
|
||||
<div class="jiasudu-item"><div class="point"></div> X 方向:{{ deviceData.remark.acc_x || '--' }} m/s²</div>
|
||||
<div class="jiasudu-item"><div class="point"></div> Y 方向:{{ deviceData.remark.acc_y || '--' }} m/s²</div>
|
||||
<div class="jiasudu-item"><div class="point"></div> Z 方向:{{ deviceData.remark.acc_z ||'--' }} m/s²</div>
|
||||
</div>
|
||||
</div>
|
||||
210
wechat/miniprogram/pages/someData/index.wxss
Normal file
210
wechat/miniprogram/pages/someData/index.wxss
Normal file
@@ -0,0 +1,210 @@
|
||||
/* miniprogram/pages/someData/index.wxss */
|
||||
page{
|
||||
color: #ffffff;
|
||||
}
|
||||
.wave-box{
|
||||
width: 500rpx;
|
||||
height: 500rpx;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 10rpx 5rpx #31f1ff;
|
||||
margin: 20rpx auto;
|
||||
position: relative;
|
||||
z-index: 99;
|
||||
overflow: hidden;
|
||||
/* background-color: rgb(197, 253, 236); */
|
||||
background-image:linear-gradient(120deg, gray , deepskyblue);
|
||||
}
|
||||
.wave-cover{
|
||||
width: 250%;
|
||||
height: 250%;
|
||||
position: absolute;
|
||||
left: -60%;
|
||||
top:100%;
|
||||
}
|
||||
.wave-cover .a{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #85f7fb;
|
||||
position: absolute;
|
||||
z-index: 11;
|
||||
border-radius: 47% 49% 63% 60% / 60% 48%;
|
||||
animation: wave 8s linear infinite;
|
||||
}
|
||||
.wave-cover .b{
|
||||
width: 95%;
|
||||
height: 95%;
|
||||
background-color: #d0f4ff;
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
border-radius: 42% 58% 43% 60% / 48% 35%;
|
||||
animation: wave 7s linear infinite;
|
||||
}
|
||||
|
||||
.slot{
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
z-index: 99;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.big-icon{
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
}
|
||||
.temp,.humi{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.temp-title,.humi-title{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.hr{
|
||||
width: 60%;
|
||||
height: 1rpx;
|
||||
background-color: #fff0f0;
|
||||
margin: 15rpx auto;
|
||||
}
|
||||
.sm-icon{
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
}
|
||||
.humi{
|
||||
/* color: #666; */
|
||||
}
|
||||
|
||||
|
||||
@keyframes wave{
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* .info-card{
|
||||
margin: 0 auto;
|
||||
width: 70vw;
|
||||
padding: 100rpx 15rpx 30rpx;
|
||||
border-radius: 25rpx;
|
||||
box-shadow: 0 0 10rpx 5rpx #ffffff;
|
||||
transform: translateY(-100rpx);
|
||||
background-image:linear-gradient(-120deg, skyblue , gray);
|
||||
} */
|
||||
.mid-icon{
|
||||
width: 66rpx;
|
||||
height: 66rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
/* .card-title{
|
||||
font-size: 42rpx;
|
||||
display: block;
|
||||
width: 60%;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
border-bottom: #bfbfbf 1rpx solid;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
.card-body{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 30rpx 60rpx;
|
||||
}
|
||||
.card-item{
|
||||
margin: 5rpx 0;
|
||||
padding: 10rpx 0;
|
||||
} */
|
||||
.data-item{
|
||||
width: 50vw;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.item-name{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding:10rpx 15rpx;
|
||||
width: 80%;
|
||||
box-shadow: 3rpx 3rpx 5rpx #eee;
|
||||
border-radius:10rpx ;
|
||||
margin: 15rpx 0;
|
||||
/* background-color: skyblue; */
|
||||
background-color: rgb(87, 181, 204);
|
||||
|
||||
}
|
||||
.long{
|
||||
width: 100vw;
|
||||
}
|
||||
.l{
|
||||
width: 90%;
|
||||
}
|
||||
.item-title{
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.bg{
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: -1;
|
||||
/* background-image: linear-gradient(120deg,rgb(119, 217, 255),#eee); */
|
||||
background-image:linear-gradient(to bottom, #dbdbdb , rgb(94, 214, 253));
|
||||
|
||||
}
|
||||
.jiasudu{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: rgb(87, 181, 204);
|
||||
border-radius: 0 15rpx 15rpx 15rpx;
|
||||
padding: 30rpx;
|
||||
box-shadow: 3rpx 3rpx 3rpx #eee;
|
||||
}
|
||||
.jiasudu-item{
|
||||
margin: 10rpx;
|
||||
display: block;
|
||||
padding: 5rpx;
|
||||
/* color: rgb(85, 85, 85); */
|
||||
}
|
||||
.point{
|
||||
display: inline-block;
|
||||
width: 15rpx;
|
||||
height: 15rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #85f7fb;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.data_one{
|
||||
width: 100vw;
|
||||
/* padding: 30rpx; */
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.h{
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.van-divider{
|
||||
color: #ffffff !important;
|
||||
}
|
||||
.data_two{
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.data{
|
||||
width: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding:10rpx 15rpx;
|
||||
border-bottom: 2rpx solid #eee;
|
||||
background-color: rgb(87, 181, 204);
|
||||
border-radius:15rpx 15rpx 0 0;
|
||||
box-shadow: 3rpx 3rpx 3rpx #eee;
|
||||
}
|
||||
Reference in New Issue
Block a user