|
|
@@ -243,13 +243,24 @@
|
|
|
// this.getStatistics()
|
|
|
},
|
|
|
onUnload() {
|
|
|
+ console.log('onUnload~~~~~home')
|
|
|
uni.$off('scancodedate')
|
|
|
- clearTimeout(this.timer);
|
|
|
-
|
|
|
+ if (this.timer) {
|
|
|
+ clearInterval(this.timer)
|
|
|
+ this.timer = null
|
|
|
+ }
|
|
|
+ // 子组件 homeNew 是组件而非页面,需手动停止其定时器
|
|
|
+ this.$refs.homeNewRef && this.$refs.homeNewRef.stopTimer()
|
|
|
},
|
|
|
onHide() {
|
|
|
+ console.log('onHide~~~~~home')
|
|
|
uni.$off('scancodedate')
|
|
|
- clearTimeout(this.timer);
|
|
|
+ if (this.timer) {
|
|
|
+ clearInterval(this.timer)
|
|
|
+ this.timer = null
|
|
|
+ }
|
|
|
+ // 子组件 homeNew 是组件而非页面,需手动停止其定时器
|
|
|
+ this.$refs.homeNewRef && this.$refs.homeNewRef.stopTimer()
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -320,17 +331,13 @@
|
|
|
},
|
|
|
init() {
|
|
|
this.getStatistics()
|
|
|
- // this.$refs.navigationRef && this.$refs.navigationRef.getCount()
|
|
|
- // this.$refs.equipmentRef && this.$refs.equipmentRef.getData()
|
|
|
- // this.$refs.mochaRef && this.$refs.mochaRef.getData()
|
|
|
- // this.$refs.mouldRef &&
|
|
|
- // (this.$refs.mouldRef.getBoatInventoryCountList(),
|
|
|
- // this.$refs.mouldRef.getModeInventoryCountList())
|
|
|
- // this.$refs.sparePartRef && this.$refs.sparePartRef.getData()
|
|
|
- this.timer = setTimeout(() => {
|
|
|
- console.log('timer~~~home')
|
|
|
- this.init()
|
|
|
- }, 12000)
|
|
|
+ // 启动循环定时器,避免重复创建
|
|
|
+ if (!this.timer) {
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ console.log('timer~~~home~~~~')
|
|
|
+ this.getStatistics()
|
|
|
+ }, 12000)
|
|
|
+ }
|
|
|
},
|
|
|
// 获取工单统计数
|
|
|
getStatistics() {
|