wangxiaohua 2 years ago
parent
commit
3f9a23f5e1
3 changed files with 221 additions and 32 deletions
  1. +9
    -0
      config.js
  2. +212
    -32
      pages/index/index.vue
  3. BIN
      static/images/offline.png

+ 9
- 0
config.js View File

@@ -60,6 +60,15 @@ var config = {
getSpeechAnalysis: `${host}/cms/mobile/getBytargetId`,
//同音转译接口2
getCorpusAnalysis: `${host}/corpus/audioPlay`,
//查询设备电量
findElectricity:`${host}/equipment/findElectricity`,
//首页设备查询
findEquipmentState:`${host}/cusLvStatistics/findEquipmentState`,
//首页实时统计
realTimeStatistics:`${host}/cusLvStatistics/realTimeStatistics`,
//首页本周工作
workThisWeek:`${host}/cusLvStatistics/workThisWeek`,
}
};
module.exports = config;

+ 212
- 32
pages/index/index.vue View File

@@ -8,46 +8,73 @@
<view class="Switching3">{{buildingname}}</view>
<view class="Switching4" v-if="buildingishow" @click="piskbuilding()">切换楼盘</view>
</view>
<view class="title" style="margin-top: 30rpx;">我的工牌</view>
<view class="Workcard">
<view class="Workcard-box">
<view class="Workcardimg">
<image class="Workcardimg1" src="../../static/images/battery.png" mode=""></image>
<view class="title" style="margin-top: 30rpx;" v-if="Myworkcard">我的工牌</view>
<view v-if="Myworkcard">
<view class="Workcard" v-if="Whetheroffline==true">
<view class="Workcard-box">
<view class="Workcardimg">
<view class="Workcardimg1">
<view v-if="percentage>20" class="bar" :style="{width : percentage + '%' }"></view>
<view v-if="percentage<20" class="bar1" :style="{width : percentage + '%' }"></view>
</view>
</view>
<view class="Workcardtext">电量:{{percentage}}%</view>
</view>
<view class="Workcardtext">电量:96%</view>
</view>
<view class="Workcard-box">
<view class="Workcardimg">
<image class="Workcardimg1" src="../../static/images/signal5.png" mode=""></image>
<view class="Workcard-box">
<view class="Workcardimg">
<image v-if="signalDevice==''" class="Workcardimg2" src="../../static/images/signal0.png" mode=""></image>
<image v-else-if="signalDevice<20 && signalDevice>0" class="Workcardimg2" src="../../static/images/signal1.png" mode=""></image>
<image v-else-if="signalDevice<50 && signalDevice>20" class="Workcardimg2" src="../../static/images/signal2.png" mode=""></image>
<image v-else-if="signalDevice<70 && signalDevice>50" class="Workcardimg2" src="../../static/images/signal3.png" mode=""></image>
<image v-else-if="signalDevice<90 && signalDevice>70" class="Workcardimg2" src="../../static/images/signal4.png" mode=""></image>
<image v-else-if="signalDevice<=100 && signalDevice>90" class="Workcardimg2" src="../../static/images/signal5.png" mode=""></image>
</view>
<view class="Workcardtext">信号:{{signalDevicetext}}</view>
</view>
<view class="Workcard-box">
<view class="Workcardimg">
<image v-if="audioStatus=='true'" class="Workcardimg3" src="../../static/images/Thtapedrive1.png" mode=""></image>
<image v-if="audioStatus=='false'" class="Workcardimg3" src="../../static/images/Thtapedrive2.png" mode=""></image>
</view>
<view v-if="audioStatus=='true'" class="Workcardtext">录音:已开启</view>
<view v-if="audioStatus=='false'" class="Workcardtext">录音:未开启</view>
</view>
<view class="Workcardtext">信号:弱</view>
</view>
<view class="Workcard-box">
<view class="Workcardimg">
<image class="Workcardimg3" src="../../static/images/Thtapedrive2.png" mode=""></image>
<view class="Workcard" v-if="Whetheroffline==false">
<view class="Workcard-box">
<view class="Workcardimg">
<image class="Workcardimg4" src="../../static/images/offline.png" mode=""></image>
</view>
<view class="Workcardtext">设备离线</view>
</view>
<view class="Workcardtext">录音:未开启</view>
</view>
</view>
<view class="title">设备</view>
<view class="shebenbox">
<view class="title" v-if="equipmentisshow">设备</view>
<view class="shebenbox" v-if="equipmentisshow">
<view class="shebenche">
<view class="shebenchenum">158</view>
<view class="shebenchenum">{{equipmentobj.totalNum}}</view>
<view class="shebenchetext">设备总数</view>
</view>
<view class="shebenche">
<view class="shebenchenum">5</view>
<view class="shebenchenum">{{equipmentobj.onlineNum}}</view>
<view class="shebenchetext">在线</view>
</view>
<view class="shebenche">
<view class="shebenchenum">2</view>
<view class="shebenchenum">{{equipmentobj.activeNum}}</view>
<view class="shebenchetext">活跃</view>
</view>
<view class="shebenche">
<view class="shebenchenum" style="color: red;">5</view>
<view class="shebenchenum" style="color: red;">{{equipmentobj.lowPowerNum}}</view>
<view class="shebenchetext">急需充电</view>
</view>
</view>
<view class="title">实时统计</view>
<view class="real-timebox">
<view class="timebox">
@@ -178,15 +205,29 @@
</template>

<script>
var config = require("../../config");
export default {
data() {
return {
userInfo:{},
Showhiddenunits:false,
lpanlist:[],
buildingname:'',
buildingID:'',
buildingishow:false
lpanlist:[],//楼盘列表
buildingname:'',//楼盘名
buildingID:'',//楼盘id
buildingishow:false,//是否选择楼盘
Myworkcard:false,
percentage:'',//设备电量
Whetheroffline:false,//是否离线
signalDevice:0,//信号
signalDevicetext:"",
audioStatus:false,
equipmentisshow:false,
equipmentobj:{
totalNum:'',
onlineNum:'',
activeNum:'',
lowPowerNum:'',
}
};
},
components: {},
@@ -200,16 +241,133 @@
this.buildingishow=true;
this.buildingname=uni.getStorageSync('buildingID').name;
this.buildingID=uni.getStorageSync('buildingID').id;
this.userInfo.zkProperties.forEach(item=>{
item.label=item.propertyName;
item.value=item.id
})
this.lpanlist=this.userInfo.zkProperties
}
if (this.userInfo.dataCode == 6) {
this.Myworkcard=true;
this.equipmentisshow=false;
this.iniodianloang()
}else{
this.equipmentisshow=true;
this.Myworkcard=false;
this.initequipment()
}
this.initworkThisWeek()
// this.initrealTimeStatistics()
},
methods: {
initworkThisWeek(){
uni.request({
url: config.service.workThisWeek,
method: "POST",
header: {
'content-type': 'application/json',
'Access-Token': uni.getStorageSync('weapp_session_login_data').token
},
data: {
houseId:this.buildingID
},
success: (data) => {
if (data.data.data == null) {
return
}else{
}
}
})
},
//实时统计
initrealTimeStatistics(){
uni.request({
url: config.service.realTimeStatistics,
method: "POST",
header: {
'content-type': 'application/json',
'Access-Token': uni.getStorageSync('weapp_session_login_data').token
},
data: {
houseId:this.buildingID
},
success: (data) => {
if (data.data.data == null) {
return
}else{
}
}
})
},
//设备
initequipment(){
uni.request({
url: config.service.findEquipmentState,
method: "POST",
header: {
'content-type': 'application/json',
'Access-Token': uni.getStorageSync('weapp_session_login_data').token
},
data: {
propertyId:this.buildingID
},
success: (data) => {
if (data.data.data == null) {
return
}else{
this.equipmentobj={
totalNum:'0',
onlineNum:'0',
activeNum:'0',
lowPowerNum:'0',
}
}
}
})
},
//我的工牌
iniodianloang() {
uni.request({
url: config.service.findElectricity,
method: "POST",
header: {
'content-type': 'application/json',
'Access-Token': uni.getStorageSync('weapp_session_login_data').token
},
data: {},
success: (data) => {
if (data.data.data == null) {
return
} else {
if (data.data.data > 100) {
this.percentage = 100;
} else {
if(data.data.data.onLine==0){
this.Whetheroffline=false;
}else{
this.Whetheroffline=true;
this.percentage = data.data.data.electricity;
this.signalDevice=data.data.data.signalDevice/1;
console.log(this.signalDevice)
this.audioStatus=data.data.data.audioStatus;
if(this.signalDevice>80){
this.signalDevicetext='高';
}else{
if(this.signalDevice==0){
this.signalDevicetext='无';
}else{
this.signalDevicetext='低';
}
}
}
}
}
}
})
},
//选择楼盘弹框
piskbuilding(){
this.Showhiddenunits=true;
@@ -316,15 +474,37 @@
height: 100%;
.Workcardimg{
width: 100%;
text-align: center;
display: flex;
justify-content: center;
margin-top: 42rpx;
.Workcardimg1{
width: 46rpx;
height: 28rpx;
width: 64rpx;
height: 36rpx;
background-image: url(../../static/images/battery.png);
background-size: 100% 100%;
padding: 8rpx;
.bar {
background-color: #43CD80;
height: 100%;
border-radius: 4rpx;
}
.bar1 {
background-color: red;
height: 100%;
border-radius: 4rpx;
}
}
.Workcardimg2{
width: 56rpx;
height: 36rpx;
}
.Workcardimg3{
width: 28rpx;
height: 32rpx;
width: 34rpx;
height: 36rpx;
}
.Workcardimg4{
width: 50rpx;
height: 40rpx;
}
}
.Workcardtext{


BIN
static/images/offline.png View File

Before After
Width: 68  |  Height: 56  |  Size: 2.5 KiB

Loading…
Cancel
Save