diff --git a/src/views/dataBoard/dataBoard.vue b/src/views/dataBoard/dataBoard.vue index a1bbf7d..5fce02a 100644 --- a/src/views/dataBoard/dataBoard.vue +++ b/src/views/dataBoard/dataBoard.vue @@ -197,7 +197,7 @@ }, data() { return { - url: "https://dev.yixiong-tech.com:8081/terminal/neglect/large-screen/ranking", + url: "https://dev.yixiong-tech.com:8081/", nowTimeInterval: null, nowTime: dayjs(), dinnerType: '', @@ -237,12 +237,17 @@ this.initMttqF() }, mounted() { - callBackMqttMessage(() => { - console.log('loadData===') - this.initData(); + callBackMqttMessage((data) => { + console.log('loadData===', data) + if (data.message?.type === 'rankingFileUpdate') { + this.initSwiperData() + } else { + this.initData(); + } }) this.initTime(); this.initData(); + this.initSwiperData(); // this.$nextTick(() => { // this.initSwiper(); // this.startSwiperAutoPlay(); @@ -283,9 +288,33 @@ preDate(d) { return dayjs(d).format('HH:mm:ss'); }, + initSwiperData() { + let _this = this; + httpRequest("GET", this.url + 'terminal/neglect/large-screen/ranking/file', {}, {"authorization": "57ee87183f2a4fa59683ec9ef41c8f5d"}) + .then(function (res) { + console.log(res) + if (res.code === '00000') { + _this.swiperList = res.data || []; + if (_this.swiperInstance) { + _this.swiperInstance.destroy(true, true); + _this.swiperInstance = null; + } + if (_this.swiperTimer) { + clearTimeout(_this.swiperTimer); + } + _this.$nextTick(() => { + _this.initSwiper(); + _this.startSwiperAutoPlay(); + }); + } + }) + .catch((err) => { + console.log(err) + }) + }, initData() { let _this = this; - httpRequest("GET", this.url , {}, {"authorization": "57ee87183f2a4fa59683ec9ef41c8f5d"}).then(function (res) { + httpRequest("GET", this.url + 'terminal/neglect/large-screen/ranking' , {}, {"authorization": "57ee87183f2a4fa59683ec9ef41c8f5d"}).then(function (res) { if (res?.code === '00000') { _this.dinnerType = res.data.dinnerType; _this.dataOverview = res.data.dataOverview || { @@ -301,18 +330,6 @@ item['weightPoint'] = maxWeight === 0 ? 0 : parseFloat(((item?.foodWeight || 0) / maxWeight * 100).toFixed(2)); return item; }); - _this.swiperList = res.data.fileList || []; - if (_this.swiperInstance) { - _this.swiperInstance.destroy(true, true); - _this.swiperInstance = null; - } - if (_this.swiperTimer) { - clearTimeout(_this.swiperTimer); - } - _this.$nextTick(() => { - _this.initSwiper(); - _this.startSwiperAutoPlay(); - }); } else { } }).catch(function(err) {