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,
"singleQuote": true,
"semi": false,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "ignore"
}
{
"printWidth": 100,
"singleQuote": true,
"semi": false,
"endOfLine": "lf",
"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 he from '../static/he.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 zj from '../static/zj.json'
import './index.scss'
@@ -160,7 +164,7 @@ const handelBetClick = (index: number) => {
const light = ref({
container: null,
num: 8,
itemNum: 6,
itemNum: 3,
})
const turntable_light = ref()
@@ -173,33 +177,21 @@ const turntable_list = ref([
url: he,
name: '和',
isActive: false,
},
{
id: 5,
url: null,
isActive: false,
},
{
id: 2,
name: '双',
url: shuang,
isActive: false,
},
{
id: 4,
url: null,
isActive: false,
activeUrl: kh,
},
{
id: 1,
url: dan,
name: '单',
isActive: false,
activeUrl: kd,
},
{
id: 6,
url: null,
id: 2,
name: '双',
url: shuang,
isActive: false,
activeUrl: ks,
},
])
@@ -215,11 +207,14 @@ const getBetList = () => {
})
}
const handelDzClick = (index: number) => {
turntable_list.value.forEach((item) => {
item.isActive = false
const bgUrl = ref(wu)
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 = () => {
@@ -242,6 +237,13 @@ onMounted(() => {
})
const startRun = (name: string) => {
if (!name)
return Taro.showToast({
title: '未知开奖结果',
mask: true,
icon: 'none',
duration: 1000,
})
isRunning.value = true
turntable_list.value.forEach((item) => {
@@ -254,19 +256,19 @@ const startRun = (name: string) => {
switch (name) {
case '单':
kj_num = 6
kj_num = 1
break
case '双':
kj_num = 2
break
case '和':
kj_num = 4
kj_num = 3
break
}
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))
@@ -278,6 +280,7 @@ const startRun = (name: string) => {
setTimeout(() => {
isRunning.value = false
bgUrl.value = wu
getBetJl()
setTimeout(() => {
getList()
@@ -451,16 +454,23 @@ onBeforeUnmount(() => {
<view class="turntable-wrap" id="turntable-wrap">
<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="item"
v-for="(item, index) in turntable_list"
:key="index"
@click="handelDzClick(index)"
@click="handelDzClick(item)"
>
<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 File

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