From e8b30a8f7c92c891a9ec939ddafe65cbcf0cab8e Mon Sep 17 00:00:00 2001 From: wx <645899409@qq.com> Date: Fri, 20 Mar 2026 18:21:27 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E8=B5=B0=E9=A9=AC=E7=81=AF?= =?UTF-8?q?=E4=BB=8E=E5=8F=B3=E4=BE=A7=E8=BF=9B=E5=85=A5=EF=BC=8C=E4=B8=94?= =?UTF-8?q?=E9=80=9F=E5=BA=A6=E6=81=92=E5=AE=9A=E3=80=82=202.=E6=8E=92?= =?UTF-8?q?=E5=90=8D=E5=B1=8F=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6mqtt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dataBoard/dataBoard.vue | 33 ++++++++++++++++++++++--------- src/views/led/led.vue | 3 ++- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/views/dataBoard/dataBoard.vue b/src/views/dataBoard/dataBoard.vue index 8baf22b..d14c4d0 100644 --- a/src/views/dataBoard/dataBoard.vue +++ b/src/views/dataBoard/dataBoard.vue @@ -237,12 +237,13 @@ }, created() { this.initMttqF() + this.initMttqFile() }, computed: { animationCss() { return this.orderListData && this.orderListData.length > 0 ? { // animationName: 'scroll', - animationDuration: (this.orderListData.length * 3 < 10 ? 10 : this.orderListData.length * 3) + 's', + animationDuration: (this.orderListData.length === 0 ? 0 : 45) + 's', animationTimingFunction: 'linear', // animationIterationCount: 'infinite', animationFillMode: 'forwards' @@ -251,15 +252,19 @@ }, mounted() { callBackMqttMessage((data) => { - console.log('loadData===', data) - if (data.message?.type === 'rankingFileUpdate') { - this.initSwiperData() + console.log('loadData=============='+data.topic+'==='+dayjs().format('YYYY-MM-DD HH:mm:ss'), data) + if (data.topic === 'yx/device/rankingScreen/needUpdate') { + // if (data.message?.type === 'rankingFileUpdate') { + // this.initSwiperData() + // } else { + this.initData(data.message?.userId); + // } } else { - this.initData(); + this.initSwiperData() } }) this.initTime(); - this.initData(); + this.initData(''); this.initSwiperData(); // this.$nextTick(() => { // this.initSwiper(); @@ -288,6 +293,15 @@ console.log(err) }) }, + initMttqFile() { + initMqtt('deviceId-' + Math.random().toString(16).substring(2, 8),'yx/device/rankingFile/needUpdate','led', {username: process.env.VUE_APP_LED_MQTT_USERNAME, password: process.env.VUE_APP_LED_MQTT_PASSWORD, head: 'wss'}) + .then((res) => { + console.log(res) + }) + .catch((err) => { + console.log(err) + }) + }, preName(name) { if (!name) return; if (name === '匿名用户') return name @@ -327,10 +341,10 @@ console.log(err) }) }, - initData() { + initData(userId) { let _this = this; this.orderListData = []; - httpRequest("GET", this.url + 'terminal/neglect/large-screen/ranking' , {}, {"authorization": "57ee87183f2a4fa59683ec9ef41c8f5d"}).then(function (res) { + httpRequest("GET", this.url + 'terminal/neglect/large-screen/ranking' , {userId}, {"authorization": "57ee87183f2a4fa59683ec9ef41c8f5d"}).then(function (res) { if (res?.code === '00000') { _this.dinnerType = res.data.dinnerType; _this.dataOverview = res.data.dataOverview || { @@ -921,6 +935,7 @@ .scroll-content { display: inline-block; + width: 100%; div { display: flex; @@ -936,7 +951,7 @@ @keyframes scroll { 0% { - transform: translateX(0); + transform: translateX(100%); } 100% { transform: translateX(-100%); /* 移动一半距离,因为复制了一份 */ diff --git a/src/views/led/led.vue b/src/views/led/led.vue index 4b4dd26..4bb2a5e 100644 --- a/src/views/led/led.vue +++ b/src/views/led/led.vue @@ -22,6 +22,7 @@ import RowDom from "./components/rowDom.vue"; import {callBackMqttMessage, initMqtt} from "@/utils/mqtt"; import {httpRequest} from "@/XMLHttpRequest"; +import dayjs from "dayjs"; export default { name: "led", @@ -216,7 +217,7 @@ export default { }, mounted() { callBackMqttMessage((data) => { - console.log(data) + console.log(`data============${dayjs().format('YYYY-MM-DD HH:mm:ss')}`, data); this.getInfoByDeviceId(data?.message || {}); }) },