From da9cdc9be42f8817081cd3dc4f5907a26dc2ea92 Mon Sep 17 00:00:00 2001 From: teaim <20551753+teaim@users.noreply.github.com> Date: Sat, 13 Apr 2024 23:58:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B9=9D=E5=AE=AB?= =?UTF-8?q?=E6=A0=BC=E6=8A=BD=E5=A5=96=E6=A1=88=E4=BE=8B=E9=A6=96=E6=AC=A1?= =?UTF-8?q?=E5=BC=80=E5=A5=96=E5=90=8E=E5=86=8D=E6=8A=BD=E5=A5=96=E5=93=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=B9=E4=B8=8D=E4=B8=8A=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/demo/page/lottery/nine-grid.vue | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/pages/demo/page/lottery/nine-grid.vue b/src/pages/demo/page/lottery/nine-grid.vue index 0d3ce42a..2c102fa5 100644 --- a/src/pages/demo/page/lottery/nine-grid.vue +++ b/src/pages/demo/page/lottery/nine-grid.vue @@ -90,7 +90,7 @@ const startBtn = { prizeList.splice(4, 0, startBtn) // 奖品高亮顺序 -const prizeSort = [0, 1, 2, 5, 8, 7, 6, 3] +let prizeSort = [0, 1, 2, 5, 8, 7, 6, 3] // 获取随机数 const getRandomNum = () => prizeSort[Math.floor(Math.random() * prizeSort.length)] @@ -101,11 +101,7 @@ let timerIns = null // 定时器实例 let currentRunCount = 0 // 已跑次数 const totalRunCount = 32 // 总共跑动次数,8的倍数即可 let prizeId = 0 // 中奖id(0-8,不能是4) - -// 要执行总步数 -const totalRunStep = computed(() => { - return totalRunCount + prizeSort.indexOf(prizeId) -}) +let totalRunStep = 0 // 要执行总步数 const stopRun = () => { // eslint-disable-next-line no-unused-expressions @@ -113,10 +109,10 @@ const stopRun = () => { } const startRun = () => { stopRun() - console.log(currentRunCount, totalRunStep.value) + console.log(currentRunCount, totalRunStep) // 要执行总步数 // 已走步数超过 - if (currentRunCount > totalRunStep.value) { + if (currentRunCount > totalRunStep) { isRunning = false if (isLeaved) { console.log('已经离开页面了,不用显示弹窗') @@ -143,10 +139,15 @@ const startRun = () => { const start = (i) => { if (i === 4 && !isRunning) { + uni.showLoading() // 重置数据 currentRunCount = 0 speed = 100 isRunning = true + prizeSort = [ + ...prizeSort.slice(prizeSort.indexOf(prizeId), prizeSort.length), + ...prizeSort.slice(0, prizeSort.indexOf(prizeId)), + ] console.log('开始抽奖,后台请求中奖奖品') // 请求返回的奖品编号 这里使用随机数 但不能为4 @@ -155,11 +156,14 @@ const start = (i) => { // prizeId = prizeId // 模拟接口延时返回 如果接口突然报错如何处理?直接调用stopRun()方法停止转动 setTimeout(() => { + uni.hideLoading() prizeId = getRandomNum() console.log('中奖ID>>>', prizeId, prizeList[prizeId]) + totalRunStep = totalRunCount + prizeSort.indexOf(prizeId) + console.log('prizeSort', prizeSort, 'totalRunStep', totalRunStep) // 拿到数据才可以跑 - }, 2000) - startRun() + startRun() + }, 500) } } From f21c0607ddf7fb9f6c16f7ff3992591db2445d43 Mon Sep 17 00:00:00 2001 From: teaim <20551753+teaim@users.noreply.github.com> Date: Sun, 14 Apr 2024 19:41:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2h5=E8=BF=90=E8=A1=8C=E6=97=B6=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=86=85=E5=AE=B9=E8=A2=ABtabbar=E9=81=AE=E6=8C=A1?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/demo/index.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/demo/index.vue b/src/pages/demo/index.vue index 6c797d75..4a0782c8 100644 --- a/src/pages/demo/index.vue +++ b/src/pages/demo/index.vue @@ -115,4 +115,8 @@ page { .tab-container { display: flex; } + +.list-container { + padding-bottom: var(--window-bottom); +}