数据切换到正式环境

This commit is contained in:
仲么了
2023-08-30 18:52:58 +08:00
parent d61a1614f9
commit 05b28a17e7
16 changed files with 116 additions and 75 deletions

View File

@@ -29,18 +29,15 @@
<view class="module">
<view class="grid-card">
<view class="grid-card-content-2">
<view class="item">模块一</view>
<view class="item">
<view class="status-point-success mr10"></view>
<view style="width: 30rpx"> 15</view>
<view> °C</view>
</view>
<view class="item">模块二</view>
<view class="item">
<view class="status-point-error mr10"></view>
<view style="width: 30rpx"> 0</view>
<view> °C</view>
</view>
<template v-for="(item,index) in IOData">
<view class="item">{{ item.clDid }}</view>
<view class="item">
<!-- <view class="status-point-success mr10"></view>-->
<view style="width: 30rpx"> {{ item.value }}</view>
<view> °C</view>
</view>
</template>
</view>
</view>
</view>
@@ -185,7 +182,8 @@ export default {
value: [],
},
],
basicData: []
basicData: [],
IOData: [],
}
},
methods: {
@@ -255,6 +253,7 @@ export default {
this.loading = true
this.domLoading = true
queryTopologyDiagram(this.devId).then((res) => {
res.data.filePath = this.$config.static + res.data.filePath
this.deviceInfo = res.data
uni.setNavigationBarTitle({title: this.deviceInfo.devName || '设备详情'})
this.topolodyData.filter((item) => {
@@ -312,13 +311,22 @@ export default {
this.client
.on('connect', () => {
console.log('连接成功')
this.client.subscribe(`/zl/TemperData/${this.devId}`, (err) => {
if (!err) {
console.log(`订阅成功:/zl/TemperData/${this.devId}`)
}
})
this.client.subscribe(`/zl/devData/${this.devId}`, (err) => {
if (!err) {
console.log(`订阅成功:/zl/devData/${this.devId}`)
// 默认推送
this.client.publish(`/zl/askDevData/${this.devId}`)
this.client.publish(`/zl/askTemperData/${this.devId}`)
this.timer = setInterval(() => {
console.log('askDevData')
this.client.publish(`/zl/askDevData/${this.devId}`)
this.client.publish(`/zl/askTemperData/${this.devId}`)
}, 1000 * 60)
}
})
@@ -335,14 +343,20 @@ export default {
})
.on('message', (topic, message) => {
console.log('接收推送信息:', message.toString(), topic)
if (topic !== `/zl/devData/${this.devId}`) return
if ((!message.toString() || message.toString().length < 10) && this.loading) {
this.$util.toast('该设备暂无数据')
if (topic === `/zl/devData/${this.devId}`) {
if ((!message.toString() || message.toString().length < 10) && this.loading) {
this.$util.toast('该设备暂无数据')
}
this.loading = false
this.handlerData(JSON.parse(message.toString()))
} else if (topic === `/zl/TemperData/${this.devId}`) {
// this.basicData.forEach((item) => {
// if (item.statisticalName === '温度' && item.phase === 'avg') {
// item.statisticalData = message.toString()
// }
// })
this.IOData = JSON.parse(message.toString())
}
this.loading = false
this.handlerData(JSON.parse(message.toString()))
this.$forceUpdate()
})
},
handlerData(data) {