Browse Source

人流数据优化

master
xuhuajiao 3 months ago
parent
commit
d1506c6649
  1. 22
      src/views/index.vue
  2. 64
      src/views/pageOne/index.vue

22
src/views/index.vue

@ -147,6 +147,24 @@ export default {
})
}, 15)
},
clearExistingTimer(type) {
if (type === 'middle' && this.middleTimer) {
clearInterval(this.middleTimer)
this.middleTimer = null
} else if (type === 'left' && this.leftTimer) {
clearInterval(this.leftTimer)
this.leftTimer = null
} else if (type === 'device') {
clearInterval(this.deviceTimer)
this.deviceTimer = null
} else if (type === 'todayTotal') {
clearInterval(this.todayTimer)
this.todayTimer = null
} else if (type === 'yearTotal') {
clearInterval(this.yearTimer)
this.yearTimer = null
}
},
//
initInterval(targetList, time) {
const { setNumberTransform } = this
@ -161,6 +179,10 @@ export default {
},
//
timedRefresh(targetList, type) {
// const self = this
//
this.clearExistingTimer(type)
if (type === 'middle') {
this.middleTimer = this.initInterval2(targetList, 8000)
} else if (type === 'left') {

64
src/views/pageOne/index.vue

@ -5,10 +5,11 @@
<div class="database-left">
<h3 class="database-title">到馆统计</h3>
<ul class="inLib-num">
<!-- , {'lastYearTotal': item.id === 'lastYearTotal'} -->
<li
v-for="(item, index) in leftData"
:key="index"
:class="[{'totayTotal': item.id === 'totayTotal'}, {'lastYearTotal': item.id === 'lastYearTotal'}]"
v-for="item in leftData"
:key="item.timestamp"
:class="[{'totayTotal': item.id === 'totayTotal'}]"
>
<div class="pageLeft-flop-box">
<div>
@ -306,29 +307,40 @@ export default {
}
)
this.leftData.push(
{
// name: '',
// value: result.todayVisitBase,
// type: 1
id: 'totayTotal',
name: '今日到馆',
value: this.$parent.formatter(result.todayVisitBase),
valueArr: this.$parent.formatter(result.todayVisitBase).split('')
}
// {
// id: 'allTotal',
// name: '',
// value: this.$parent.formatter(result.visitBase),
// valueArr: this.$parent.formatter(result.visitBase).split('')
// },
// {
// id: 'lastYearTotal',
// name: '',
// value: this.$parent.formatter(result.lastYearVisitBase),
// valueArr: this.$parent.formatter(result.lastYearVisitBase).split('')
// }
)
// this.leftData.push(
// {
// // name: '',
// // value: result.todayVisitBase,
// // type: 1
// id: 'totayTotal',
// name: '',
// value: this.$parent.formatter(result.todayVisitBase),
// valueArr: this.$parent.formatter(result.todayVisitBase)
// }
// // {
// // id: 'allTotal',
// // name: '',
// // value: this.$parent.formatter(result.visitBase),
// // valueArr: this.$parent.formatter(result.visitBase).split('')
// // },
// // {
// // id: 'lastYearTotal',
// // name: '',
// // value: this.$parent.formatter(result.lastYearVisitBase),
// // valueArr: this.$parent.formatter(result.lastYearVisitBase).split('')
// // }
// )
//
const newData = [{
id: 'totayTotal',
name: '今日到馆',
value: this.$parent.formatter(result.todayVisitBase),
valueArr: this.$parent.formatter(result.todayVisitBase).split(''),
timestamp: Date.now()
}]
this.$set(this, 'leftData', newData)
this.$parent.timedRefresh(this.leftData, 'left')
},

Loading…
Cancel
Save