Browse Source

调整定时获取

master
453530270@qq.com 3 years ago
parent
commit
15752382f4
  1. 25
      src/views/HomeView.vue

25
src/views/HomeView.vue

@ -109,7 +109,7 @@
<!-- 場館實時 --> <!-- 場館實時 -->
<div class="pcg_item" v-for="item in ssjgNumDatas" :key="item.groupId"> <div class="pcg_item" v-for="item in ssjgNumDatas" :key="item.groupId">
<span class="pcpos">{{item.groupName}}</span> <span class="pcpos">{{item.groupName}}</span>
<p class="pcval">{{ item.allEnter }}</p> <p class="pcval" :id="item.groupId">{{ item.allEnter }}</p>
<span class="pcrate" <span class="pcrate"
:class="[{ pcrate2: parseInt(item.proportion) >= 80 && parseInt(item.proportion) < 90 }, { pcrate3: parseInt(item.proportion) >= 90 }]">{{ :class="[{ pcrate2: parseInt(item.proportion) >= 80 && parseInt(item.proportion) < 90 }, { pcrate3: parseInt(item.proportion) >= 90 }]">{{
item.proportion }}</span> item.proportion }}</span>
@ -125,7 +125,7 @@ import * as echarts from 'echarts';
import * as btApi from '../api/home' import * as btApi from '../api/home'
// //
import { numGrow,ecMaxVal ,rtsocket} from '@/utils/comm'; import { numGrow,ecMaxVal} from '@/utils/comm';
// api // api
import * as homeApi from '@/api/home' import * as homeApi from '@/api/home'
@ -185,7 +185,11 @@ export default {
this.getGcgNumDatas() this.getGcgNumDatas()
// //
this.getStat(); this.getStat();
this.getInfoDatas(); //
setInterval(()=>{
this.getInfoDatas();
},3000)
}, },
// //
@ -669,14 +673,11 @@ export default {
}, },
// //
async getInfoDatas() { getInfoDatas() {
// interface // interface
// homeApi.allInfoDatas().then(res => { homeApi.allGcgNumDatas().then(res=>{
// get allTimeData this.ssjgNumDatas = res.data.returnData
// console.log("from api") })
// console.log(res.data.returnData)
// this.ssjgNumDatas = res.data.returnData
// });
// websocket // websocket
const param ={ const param ={
type:'realTimeData', type:'realTimeData',
@ -690,6 +691,10 @@ export default {
var jstr = JSON.parse(e.data) var jstr = JSON.parse(e.data)
func1(jstr) func1(jstr)
}; };
//
ws.onclose=function(e){
}
let func2=function(jstr){ let func2=function(jstr){
const darr = jstr.data; const darr = jstr.data;

Loading…
Cancel
Save