feat(custom): 转盘调整

This commit is contained in:
2024-01-19 11:09:55 +08:00
parent 2abffd85bb
commit a55d5ee914
8 changed files with 603 additions and 593 deletions

View File

@@ -1,7 +1,7 @@
{ {
"printWidth": 100, "printWidth": 100,
"singleQuote": true, "singleQuote": true,
"semi": false, "semi": false,
"endOfLine": "lf", "endOfLine": "lf",
"htmlWhitespaceSensitivity": "ignore" "htmlWhitespaceSensitivity": "ignore"
} }

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,10 @@ import * as dayjs from 'dayjs'
import dan from '../static/dan.png' import dan from '../static/dan.png'
import he from '../static/he.png' import he from '../static/he.png'
import shuang from '../static/shuang.png' import shuang from '../static/shuang.png'
import kd from '../../../static/kd.png'
import kh from '../../../static/kh.png'
import ks from '../../../static/ks.png'
import wu from '../../../static/wu.png'
import wzj from '../static/wzj.json' import wzj from '../static/wzj.json'
import zj from '../static/zj.json' import zj from '../static/zj.json'
import './index.scss' import './index.scss'
@@ -160,7 +164,7 @@ const handelBetClick = (index: number) => {
const light = ref({ const light = ref({
container: null, container: null,
num: 8, num: 8,
itemNum: 6, itemNum: 3,
}) })
const turntable_light = ref() const turntable_light = ref()
@@ -173,33 +177,21 @@ const turntable_list = ref([
url: he, url: he,
name: '和', name: '和',
isActive: false, isActive: false,
}, activeUrl: kh,
{
id: 5,
url: null,
isActive: false,
},
{
id: 2,
name: '双',
url: shuang,
isActive: false,
},
{
id: 4,
url: null,
isActive: false,
}, },
{ {
id: 1, id: 1,
url: dan, url: dan,
name: '单', name: '单',
isActive: false, isActive: false,
activeUrl: kd,
}, },
{ {
id: 6, id: 2,
url: null, name: '双',
url: shuang,
isActive: false, isActive: false,
activeUrl: ks,
}, },
]) ])
@@ -215,11 +207,14 @@ const getBetList = () => {
}) })
} }
const handelDzClick = (index: number) => { const bgUrl = ref(wu)
turntable_list.value.forEach((item) => {
item.isActive = false const handelDzClick = (item) => {
turntable_list.value.forEach((itm) => {
itm.isActive = false
}) })
turntable_list.value[index].isActive = true item.isActive = true
bgUrl.value = item.activeUrl
} }
const init = () => { const init = () => {
@@ -242,6 +237,13 @@ onMounted(() => {
}) })
const startRun = (name: string) => { const startRun = (name: string) => {
if (!name)
return Taro.showToast({
title: '未知开奖结果',
mask: true,
icon: 'none',
duration: 1000,
})
isRunning.value = true isRunning.value = true
turntable_list.value.forEach((item) => { turntable_list.value.forEach((item) => {
@@ -254,19 +256,19 @@ const startRun = (name: string) => {
switch (name) { switch (name) {
case '单': case '单':
kj_num = 6 kj_num = 1
break break
case '双': case '双':
kj_num = 2 kj_num = 2
break break
case '和': case '和':
kj_num = 4 kj_num = 3
break break
} }
let rotateItemDeg = (kj_num - 1) * (360 / turntable_list.value.length) let rotateItemDeg = (kj_num - 1) * (360 / turntable_list.value.length)
let rotate = rotateItemDeg + 5 * 360 let rotate = rotateItemDeg + 5 * 360 - 70
const rotateSpeed = Number((rotateItemDeg / 360 + 5).toFixed(2)) const rotateSpeed = Number((rotateItemDeg / 360 + 5).toFixed(2))
@@ -278,6 +280,7 @@ const startRun = (name: string) => {
setTimeout(() => { setTimeout(() => {
isRunning.value = false isRunning.value = false
bgUrl.value = wu
getBetJl() getBetJl()
setTimeout(() => { setTimeout(() => {
getList() getList()
@@ -451,16 +454,23 @@ onBeforeUnmount(() => {
<view class="turntable-wrap" id="turntable-wrap"> <view class="turntable-wrap" id="turntable-wrap">
<view class="light" id="turntable_light"></view> <view class="light" id="turntable_light"></view>
<view class="turntable" id="turntable"> <view
:style="{
background: `url(${bgUrl}) no-repeat`,
backgroundSize: 'contain',
}"
class="turntable"
id="turntable"
>
<view class="prize" v-if="turntable_list && turntable_list.length"> <view class="prize" v-if="turntable_list && turntable_list.length">
<view <view
class="item" class="item"
v-for="(item, index) in turntable_list" v-for="(item, index) in turntable_list"
:key="index" :key="index"
@click="handelDzClick(index)" @click="handelDzClick(item)"
> >
<image class="img" :src="item.url" /> <image class="img" :src="item.url" />
<view v-if="item.url" :class="item.isActive ? 'icon' : ''"></view> <!-- <view v-if="item.url" :class="item.isActive ? 'icon' : ''"></view> -->
</view> </view>
</view> </view>
</view> </view>

View File

@@ -3,9 +3,8 @@
<template v-if="typeNum === 1"> <template v-if="typeNum === 1">
<view class="card" v-for="(item,index) in list as any[]" :key="index"> <view class="card" v-for="(item,index) in list as any[]" :key="index">
<view> <view>
<view>{{ item.Periods }}期开奖</view>
<view> <view>
开奖数字: {{ item.Periods }}开奖:
<text <text
:style="{ :style="{
color: numColor(item.Name), color: numColor(item.Name),

BIN
src/static/kd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

BIN
src/static/kh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

BIN
src/static/ks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

BIN
src/static/wu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB