提交 dac9edbb authored 作者: 王鹏飞's avatar 王鹏飞

增加定时刷新

上级 b3fe6671
......@@ -12,7 +12,8 @@ export default {
data() {
return {
loading: false,
response: { sell_data: [] }
response: { sell_data: [] },
timer: null
}
},
computed: {
......@@ -91,6 +92,9 @@ export default {
}
},
methods: {
init() {
!this.data && this.getData()
},
getData() {
this.loading = true
api
......@@ -101,10 +105,20 @@ export default {
.finally(() => {
this.loading = false
})
},
setTimer() {
this.timer = setInterval(this.init, 5 * 60 * 1000)
},
clearTimer() {
this.timer && clearInterval(this.timer)
}
},
beforeMount() {
!this.data && this.getData()
this.init()
this.setTimer()
},
destroyed() {
this.clearTimer()
}
}
</script>
......@@ -22,7 +22,7 @@
<b>单条留资成本:</b><span>{{ numbers.app_cost }}</span>
</li>
<li>
<b>&nbsp;&nbsp;&nbsp;本月缴费数:</b><span>{{ numbers.pay_count }}</span>
<b>&nbsp;&nbsp;&nbsp;本月缴费数:</b><span>{{ currentData.all_pay_count }}</span>
</li>
</ul>
</div>
......@@ -41,7 +41,8 @@ export default {
loading: false,
response: { sell_data: [] },
list: [],
dateStr: ''
dateStr: '',
timer: null
}
},
computed: {
......@@ -122,10 +123,20 @@ export default {
},
formatValue(value = '') {
return value.toLocaleString()
},
setTimer() {
this.timer = setInterval(this.init, 5 * 60 * 1000)
},
clearTimer() {
this.timer && clearInterval(this.timer)
}
},
beforeMount() {
this.init()
this.setTimer()
},
destroyed() {
this.clearTimer()
}
}
</script>
......
......@@ -16,7 +16,8 @@ export default {
return {
loading: false,
response: [],
legendselect: {}
legendselect: {},
timer: null
}
},
computed: {
......@@ -122,6 +123,9 @@ export default {
}
},
methods: {
init() {
this.getData()
},
getData() {
this.loading = true
api
......@@ -135,10 +139,20 @@ export default {
},
legendselectchanged({ selected }) {
this.legendselect = selected
},
setTimer() {
this.timer = setInterval(this.init, 5 * 60 * 1000)
},
clearTimer() {
this.timer && clearInterval(this.timer)
}
},
beforeMount() {
this.getData()
this.init()
this.setTimer()
},
destroyed() {
this.clearTimer()
}
}
</script>
......@@ -10,7 +10,8 @@ export default {
data() {
return {
loading: false,
response: []
response: [],
timer: null
}
},
computed: {
......@@ -54,6 +55,9 @@ export default {
}
},
methods: {
init() {
this.getData()
},
getData() {
this.loading = true
api
......@@ -64,10 +68,20 @@ export default {
.finally(() => {
this.loading = false
})
},
setTimer() {
this.timer = setInterval(this.init, 5 * 60 * 1000)
},
clearTimer() {
this.timer && clearInterval(this.timer)
}
},
beforeMount() {
this.getData()
this.init()
this.setTimer()
},
destroyed() {
this.clearTimer()
}
}
</script>
......@@ -16,7 +16,8 @@ export default {
return {
loading: false,
response: [],
legendselect: {}
legendselect: {},
timer: null
}
},
computed: {
......@@ -127,6 +128,9 @@ export default {
}
},
methods: {
init() {
this.getData()
},
getData() {
this.loading = true
api
......@@ -140,10 +144,20 @@ export default {
},
legendselectchanged({ selected }) {
this.legendselect = selected
},
setTimer() {
this.timer = setInterval(this.init, 5 * 60 * 1000)
},
clearTimer() {
this.timer && clearInterval(this.timer)
}
},
beforeMount() {
this.getData()
this.init()
this.setTimer()
},
destroyed() {
this.clearTimer()
}
}
</script>
......
......@@ -18,7 +18,8 @@ export default {
loading: false,
response: [],
legendselect: {},
height: 0
height: 0,
timer: null
}
},
computed: {
......@@ -81,6 +82,9 @@ export default {
}
},
methods: {
init() {
this.getData()
},
getData() {
this.loading = true
api
......@@ -97,16 +101,24 @@ export default {
},
getChartHeight() {
this.height = this.$refs.chart.$el.offsetHeight
},
setTimer() {
this.timer = setInterval(this.init, 5 * 60 * 1000)
},
clearTimer() {
this.timer && clearInterval(this.timer)
}
},
beforeMount() {
this.getData()
this.init()
this.setTimer()
},
mounted() {
this.getChartHeight()
window.addEventListener('resize', this.getChartHeight)
},
destroyed() {
this.clearTimer()
window.removeEventListener('resize', this.getChartHeight)
}
}
......
......@@ -81,18 +81,29 @@ export default {
el: '.swiper-pagination'
}
},
month: {}
month: {},
timer: null
}
},
methods: {
init() {
this.getMonthData()
},
getMonthData() {
api.getMonthIncome().then(response => {
this.month = response
})
},
setTimer() {
this.timer = setInterval(this.init, 5 * 60 * 1000)
},
clearTimer() {
this.timer && clearInterval(this.init)
}
},
beforeMount() {
this.getMonthData()
this.init()
this.setTimer()
},
mounted() {
document.body.addEventListener(
......@@ -102,6 +113,9 @@ export default {
},
{ passive: false }
)
},
destroyed() {
this.clearTimer()
}
}
</script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论