mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 00:45:55 +08:00
删除无用文件夹
This commit is contained in:
146
wechat/pages/index/index.js
Normal file
146
wechat/pages/index/index.js
Normal file
@@ -0,0 +1,146 @@
|
||||
// pages/index/index.js
|
||||
const amap = require('../../libs/amap-wx.js');
|
||||
const { request } = require('../../API/request.js');
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
weather:{}, //天气信息
|
||||
products:[],
|
||||
DeviceList:null,
|
||||
onlineList:[],
|
||||
unlineList:[]
|
||||
},
|
||||
|
||||
|
||||
async getDevices(){
|
||||
wx.showLoading({
|
||||
title: '获取设备',
|
||||
mask: true
|
||||
})
|
||||
const res = await request('system/device/listDevice','GET');
|
||||
wx.hideLoading();
|
||||
const result = res.rows;
|
||||
if (res.code !== 200) {
|
||||
wx.showToast({
|
||||
title: '请求失败',
|
||||
icon:'error'
|
||||
});
|
||||
return;
|
||||
}
|
||||
wx.showToast({
|
||||
title: '请求成功',
|
||||
});
|
||||
let onlineList = [];
|
||||
let unlineList = [];
|
||||
result.forEach(v=>{
|
||||
if (v.isOnline == 1) {
|
||||
onlineList.push(v)
|
||||
} else if (v.isOnline == 0) {
|
||||
unlineList.push(v);
|
||||
}
|
||||
})
|
||||
this.setData({
|
||||
onlineList,
|
||||
unlineList,
|
||||
DeviceList:result
|
||||
})
|
||||
},
|
||||
|
||||
goToDeviceControl(e){
|
||||
switch (e.currentTarget.dataset.info.categoryId) {
|
||||
case 1:
|
||||
wx.navigateTo({
|
||||
url: '/pages/4Gswitch/index',
|
||||
success:(res)=>{
|
||||
res.eventChannel.emit('getDeviceInfo',e.currentTarget.dataset.info.deviceId)
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 2:
|
||||
wx.navigateTo({
|
||||
url: '/pages/4Gswitch/index',
|
||||
success:(res)=>{
|
||||
res.eventChannel.emit('getDeviceInfo',e.currentTarget.dataset.info.deviceId)
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 4:
|
||||
wx.navigateTo({
|
||||
url: '/pages/someData/index',
|
||||
success:(res)=>{
|
||||
res.eventChannel.emit('getDeviceInfo',e.currentTarget.dataset.deviceId)
|
||||
}
|
||||
})
|
||||
break;
|
||||
|
||||
case 5:
|
||||
wx.navigateTo({
|
||||
url: '/pages/roomSystem/index',
|
||||
success:(res)=>{
|
||||
res.eventChannel.emit('getDeviceInfo',e.currentTarget.dataset.deviceId)
|
||||
}
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
getWeather:async function(){
|
||||
let that = this;
|
||||
var myAmapFun = new amap.AMapWX({key:'5cafa1133f593cfe005081749a46e717'});
|
||||
myAmapFun.getWeather({
|
||||
success: function(data){
|
||||
that.setData({
|
||||
weather:data
|
||||
})
|
||||
},
|
||||
fail: function(info){
|
||||
//失败回调
|
||||
console.log(info)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
setTimeout(()=>{
|
||||
this.getDevices();
|
||||
},1000)
|
||||
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
this.getWeather();
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
this.getDevices();
|
||||
this.getWeather();
|
||||
wx.stopPullDownRefresh();
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
5
wechat/pages/index/index.json
Normal file
5
wechat/pages/index/index.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"enablePullDownRefresh":true,
|
||||
"backgroundTextStyle":"dark"
|
||||
}
|
||||
171
wechat/pages/index/index.wxml
Normal file
171
wechat/pages/index/index.wxml
Normal file
@@ -0,0 +1,171 @@
|
||||
<!--miniprogram/pages/myDevice/index.wxml-->
|
||||
<view class='body'>
|
||||
<view class='top'>
|
||||
<view class='top_left'>
|
||||
<view class='top_big_info'>
|
||||
<text class='temperature'>{{ weather.temperature.data }}℃</text>
|
||||
<text class='city'>城市: {{ weather.city.data }}</text>
|
||||
</view>
|
||||
<view class='top_small_info'>
|
||||
<view>
|
||||
<text class='humidity'>湿度: {{ weather.humidity.data }}</text>
|
||||
<text class='weather'>天气: {{ weather.weather.data }}</text>
|
||||
</view>
|
||||
<text class='winddirection'>风向: {{ weather.winddirection.data }}</text>
|
||||
<text class='windpower'>风力: {{ weather.windpower.data }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class='top_right'>
|
||||
<view class='start'>
|
||||
<image src='/icons/start.png' />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='devices'>
|
||||
<view class='devices_tab'>全部 ({{ DeviceList.length }})</view>
|
||||
<van-tabs swipeable animated>
|
||||
<van-tab title="在线设备({{ onlineList.length }})">
|
||||
<scroll-view scroll-y>
|
||||
<view class="devices_list">
|
||||
<block wx:if="{{ onlineList.length !== 0 }}">
|
||||
<view wx:for='{{ onlineList }}' wx:key='index' class='border'>
|
||||
<!-- <block wx:if="{{ item.isOnline === 2 }}">
|
||||
<view class='devices_item' style="background-color:rgba(0,0,0,.05)" bindtap='deviceNone' data-info='{{item}}'>
|
||||
<view class="info">
|
||||
<view class='img'>
|
||||
<image src='/icons/4g.png' />
|
||||
</view>
|
||||
<view class="_right">
|
||||
<view style="color:#bfbfbf" class="status">未激活</view>
|
||||
<view style="font-size:24rpx;color:#666">{{ item.categoryName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='name'>{{ item.deviceName }}</view>
|
||||
</view>
|
||||
</block> -->
|
||||
<block wx:if="{{ item.isOnline === 1 }}">
|
||||
<view class='devices_item' bindtap='goToDeviceControl' data-info='{{item}}'>
|
||||
<view class="info">
|
||||
<view class='img'>
|
||||
<image src='/icons/4g.png' />
|
||||
</view>
|
||||
<view class="_right">
|
||||
<view style="color:green" class="status">在线</view>
|
||||
<view style="font-size:24rpx;color:#666">{{ item.categoryName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='name'>
|
||||
<view>
|
||||
{{ item.deviceName }}
|
||||
</view>
|
||||
<view>
|
||||
<text style="color:#ff0000;font-size:24rpx;font-weight:600">NO.</text>
|
||||
<text style="color:#ff0000;font-size:22rpx;">{{ item.deviceNum }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:if="{{ item.isOnline === 0 }}">
|
||||
<view style="background-color:rgba(0,0,0,.05)" class='devices_item' bindtap='goToDeviceControl' data-info='{{item}}'>
|
||||
<view class="info">
|
||||
<view class='img'>
|
||||
<image src='/icons/4g.png' />
|
||||
</view>
|
||||
<view class="_right">
|
||||
<view style="color:#ff0000" class="status">离线</view>
|
||||
<view style="font-size:24rpx;color:#666">{{ item.categoryName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='name'>
|
||||
<view>
|
||||
{{ item.deviceName }}
|
||||
</view>
|
||||
<view>
|
||||
<text style="color:#ff0000;font-size:24rpx; font-weight:600">NO.</text>
|
||||
<text style="color:#ff0000;font-size:22rpx;">{{ item.deviceNum }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:elif='{{ onlineList.length === 0 }}'>
|
||||
<view class='noDevice'> 暂无设备,请添加。 </view>
|
||||
</block>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</van-tab>
|
||||
<van-tab title="离线设备({{ unlineList.length }})">
|
||||
<scroll-view scroll-y>
|
||||
<view class="devices_list">
|
||||
<block wx:if="{{ unlineList.length !== 0 }}">
|
||||
<view wx:for='{{ unlineList }}' wx:key='index' class='border'>
|
||||
<!-- <block wx:if="{{ item.isOnline === 2 }}">
|
||||
<view class='devices_item' style="background-color:rgba(0,0,0,.05)" bindtap='deviceNone' data-info='{{item}}'>
|
||||
<view class="info">
|
||||
<view class='img'>
|
||||
<image src='/icons/4g2.png' />
|
||||
</view>
|
||||
<view class="_right">
|
||||
<view style="color:#bfbfbf" class="status">未激活</view>
|
||||
<view style="font-size:24rpx;color:#666">{{ item.categoryName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='name'>{{ item.deviceName }}</view>
|
||||
</view>
|
||||
</block> -->
|
||||
<block wx:if="{{ item.isOnline === 1 }}">
|
||||
<view class='devices_item' bindtap='goToDeviceControl' data-info='{{item}}'>
|
||||
<view class="info">
|
||||
<view class='img'>
|
||||
<image src='/icons/4g2.png' />
|
||||
</view>
|
||||
<view class="_right">
|
||||
<view style="color:green" class="status">在线</view>
|
||||
<view style="font-size:24rpx;color:#666">{{ item.categoryName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='name'>
|
||||
<view>
|
||||
{{ item.deviceName }}
|
||||
</view>
|
||||
<view>
|
||||
<text style="color:#ff0000;font-size:24rpx;font-weight:600">NO.</text>
|
||||
<text style="color:#ff0000;font-size:22rpx;">{{ item.deviceNum }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:if="{{ item.isOnline === 0 }}">
|
||||
<view style="background-color:rgba(0,0,0,.05)" class='devices_item' bindtap='goToDeviceControl' data-info='{{item}}'>
|
||||
<view class="info">
|
||||
<view class='img'>
|
||||
<image src='/icons/4g2.png' />
|
||||
</view>
|
||||
<view class="_right">
|
||||
<view style="color:#ff0000" class="status">离线</view>
|
||||
<view style="font-size:24rpx;color:#666">{{ item.categoryName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='name'>
|
||||
<view>
|
||||
{{ item.deviceName }}
|
||||
</view>
|
||||
<view>
|
||||
<text style="color:#ff0000;font-size:24rpx;font-weight:600">NO.</text>
|
||||
<text style="color:#ff0000;font-size:22rpx;">{{ item.deviceNum }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:elif='{{ unlineList.length === 0 }}'>
|
||||
<view class='noDevice'> 暂无设备,请添加。 </view>
|
||||
</block>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
</view>
|
||||
</view>
|
||||
154
wechat/pages/index/index.wxss
Normal file
154
wechat/pages/index/index.wxss
Normal file
@@ -0,0 +1,154 @@
|
||||
|
||||
.top{
|
||||
display:flex;
|
||||
justify-content:space-around;
|
||||
background-color:skyblue;
|
||||
background-image: linear-gradient(to bottom right, skyblue, blue);
|
||||
padding:30rpx 0;
|
||||
border-radius:0 0 25rpx 25rpx;
|
||||
color:#ffffff;
|
||||
height:270rpx;
|
||||
}
|
||||
|
||||
.top .top_left{
|
||||
width:420rpx;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
justify-content:center;
|
||||
}
|
||||
.top .top_left .top_big_info{
|
||||
padding:10rpx 0;
|
||||
}
|
||||
.top .top_left .top_small_info{
|
||||
padding:10rpx 20rpx;
|
||||
font-size:30rpx;
|
||||
}
|
||||
|
||||
.temperature{
|
||||
font-size:60rpx;
|
||||
display:inline-block;
|
||||
padding:0 20rpx;
|
||||
}
|
||||
.humidity::after{
|
||||
content:'|';
|
||||
width:55rpx;
|
||||
display:inline-block;
|
||||
text-align:center;
|
||||
color:rgba(255,255,255,.5);
|
||||
}
|
||||
.winddirection::after{
|
||||
content:'|';
|
||||
width:55rpx;
|
||||
display:inline-block;
|
||||
text-align:center;
|
||||
color:rgba(255,255,255,.5);
|
||||
}
|
||||
.top .top_right{
|
||||
width:250rpx;
|
||||
display:flex;
|
||||
justify-content:center;
|
||||
align-items:center;
|
||||
}
|
||||
.top .top_right .start{
|
||||
position:relative;
|
||||
width:220rpx;
|
||||
height:220rpx;
|
||||
animation:move 4s linear infinite;
|
||||
}
|
||||
@keyframes move{
|
||||
0%{ top:0rpx }
|
||||
25%{ top:-30rpx }
|
||||
50%{ top:0rpx }
|
||||
75%{ top:30rpx }
|
||||
100%{ top:0rpx }
|
||||
}
|
||||
.top .top_right .start image{
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
.devices .devices_tab{
|
||||
font-size:36rpx;
|
||||
padding:20rpx;
|
||||
}
|
||||
.devices .devices_list{
|
||||
padding:10rpx 0;
|
||||
display:flex;
|
||||
flex-wrap:wrap;
|
||||
}
|
||||
.devices .devices_list .border{
|
||||
width:50%;
|
||||
display:flex;
|
||||
justify-content:center;
|
||||
}
|
||||
.devices .devices_list .devices_item{
|
||||
width:280rpx;
|
||||
height:220rpx;
|
||||
margin:30rpx 20rpx;
|
||||
border-radius:10rpx;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
justify-content:center;
|
||||
box-shadow:0rpx 5rpx 10rpx #bfbfbf;
|
||||
}
|
||||
.info{
|
||||
flex: 3;
|
||||
display: flex;
|
||||
}
|
||||
.status{
|
||||
padding: 15rpx;
|
||||
text-align: right;
|
||||
flex: 1;
|
||||
}
|
||||
.devices .devices_list .devices_item:active{
|
||||
background-color:rgba(0,0,0,.1);
|
||||
}
|
||||
.devices .devices_list .devices_item .img{
|
||||
width:50%;
|
||||
display:flex;
|
||||
justify-content:center;
|
||||
align-items:center;
|
||||
}
|
||||
.devices .devices_list .devices_item image{
|
||||
width:100rpx;
|
||||
height:100rpx;
|
||||
}
|
||||
.devices .devices_list .devices_item .name{
|
||||
flex:2;
|
||||
padding:0 20rpx;
|
||||
/* background-color:rgba(0,0,0,.1); */
|
||||
border-top:1rpx solid #bfbfbf;
|
||||
display:flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
.noDevice{
|
||||
display:block;
|
||||
width:100%;
|
||||
height:200rpx;
|
||||
text-align:center;
|
||||
line-height:200rpx;
|
||||
}
|
||||
.addDevice{
|
||||
background-color:blue;
|
||||
width:80rpx;
|
||||
height:80rpx;
|
||||
border-radius:50%;
|
||||
position:fixed;
|
||||
right:0;
|
||||
top:30%;
|
||||
display:flex;
|
||||
justify-content:center;
|
||||
align-items:center;
|
||||
}
|
||||
.addDevice:active{
|
||||
background-color:deepskyblue;
|
||||
}
|
||||
.addDevice image{
|
||||
width:40rpx;
|
||||
height:40rpx;
|
||||
}
|
||||
scroll-view{
|
||||
height: 60vh;
|
||||
width: 100vw;
|
||||
}
|
||||
Reference in New Issue
Block a user