diff --git a/src/pages/index.vue b/src/pages/index.vue index 510b8ea..87422df 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -142,6 +142,7 @@ export default { }, data () { return { + timer: null, options1: [], sCode: '', nCode: '', @@ -176,9 +177,15 @@ export default { mounted () { this._queryAllPoints() this._queryMaterials() - this._queryAreas() + // this._queryAreas() + this.refresh() this._queryTaskIds() }, + beforeDestroy () { + if (this.timer !== null) { + clearInterval(this.timer) + } + }, methods: { back () { let flag = !!(document.fullscreenElement || document.mozFullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement) @@ -195,6 +202,12 @@ export default { } this.$router.push('/setup') }, + refresh () { + this._queryAreas() + this.timer = setInterval(() => { + this._queryAreas() + }, 3000) + }, async _queryAllPoints () { let res = await queryAllPoints() this.options1 = [...res]