From 519e3242f475d5f42ccae6032bafd9b24e7df097 Mon Sep 17 00:00:00 2001 From: YuanHuakk <1751826683@qq.com> Date: Fri, 11 Oct 2024 21:40:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=B9=E5=B9=95=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.vue | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 2284706..9413ba3 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -869,7 +869,21 @@ const getWinInfo = async () => { danmus.value = []; const res = await GetWinInfo(); danmus.value = res.list; - // danmus.value = [{ img: "https://img.loliapi.cn/i/pp/img132.webp", name: "huakk", text: "恭喜你中奖了" }]; + Taro.request({ + url: "https://danmu.jdt168.com/get_danmu", + method: "GET", + success: ({ data: res }) => { + const newData = res.data.map(item => ({ + User: { + nickName: item.nick_name, + avatarUrl: item.avatar + }, + DrawNum: item.draw_num, + Number: item.win_number + })); + danmus.value.push(...newData); + }, + }) danmakuRef.value.play(); }; @@ -877,12 +891,13 @@ const joinNum = ref(0); const getJoinNum = async () => { const res = await GetJoinNum(); - joinNum.value = res.number; + const random_num = Math.floor(Math.random() * (300 - 100)); + joinNum.value = res.number ? res.number : random_num; } setInterval(() => { getJoinNum(); -}, 5000) +}, 20 * 1000)