<template>
|
<view style="display:flex;justify-content: center;fontSize:20px;flex-direction: column;">
|
<h2 style="font-size:30px;text-align:center"> {{globalweigh}}</h2>
|
<button style="margin-top:90%" @click="rest">点击重连</button>
|
</view>
|
</template>
|
|
<script>
|
import { mapState, mapMutations } from 'vuex';
|
export default {
|
data() {
|
return {
|
roleType: null,
|
orderPlanDataStore: [],
|
indexHuoDaiOrderPlanData: [],
|
indexHistoryCoalData: [],
|
indexdriverBillOfLoadingData: {},
|
messagePushShow: false,
|
messageList: {
|
title: '',
|
content: "",
|
},
|
isconnect: false,
|
dotShow: false,
|
appHide: false,
|
phone: ''
|
}
|
},
|
computed: {
|
...mapState(['globalweighHouseCode', 'globalweigh', 'globalisconnect', 'globalSocket', 'websocketData',
|
'globalIntervalId'
|
])
|
},
|
watch:{
|
'$store.state.websocketData'(v) {
|
console.log(v,'接受的ws数据');
|
if (v.startsWith('weigh')) {
|
let nowWeighObj = JSON.parse(v.slice(7));
|
console.log(v, this.globalweighHouseCode == false , nowWeighObj.eqCode,'接受的ws数据');
|
if (this.globalweighHouseCode && nowWeighObj.eqCode == this.globalweighHouseCode) {
|
if (nowWeighObj.eqInfraredStatus) {
|
this.changeinfraredStatus(true);
|
this.changeWeigh(nowWeighObj.weigh);
|
let warningState = nowWeighObj.warning == 1
|
this.changeWarning(warningState)
|
} else {
|
this.changeinfraredStatus(false);
|
this.changeWeigh(nowWeighObj.weigh);
|
let warningState = nowWeighObj.warning == 1
|
this.changeWarning(warningState)
|
}
|
}
|
} else if (v.startsWith('msg')) {
|
function removeTags(str) {
|
return str.replace(/<\/?[^>]+>/gi, '');
|
}
|
this.messageList = JSON.parse(v.slice(5));
|
this.messageList = {
|
...this.messageList,
|
title: this.messageList.title.slice(0, 8) + '...',
|
content: removeTags(this.messageList.content).trim().slice(0, 8) + '...'
|
}
|
this.messagePushShow = true;
|
} else {}
|
}
|
|
},
|
onShow(){
|
this.$store.dispatch('websocketInit')
|
},
|
rest(){
|
this.$store.dispatch('websocketInit')
|
}
|
|
}
|
</script>
|
|
<style>
|
|
</style>
|