feat(custom): 澳拾改版
This commit is contained in:
@@ -3,18 +3,19 @@ import { onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import Taro from '@tarojs/taro'
|
||||
import Lottie from 'lottie-web'
|
||||
import * as dayjs from 'dayjs'
|
||||
import dan from '../static/dan.png'
|
||||
import he from '../static/he.png'
|
||||
import shuang from '../static/shuang.png'
|
||||
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 wzj from '../../../static/wzj.json'
|
||||
import zj from '../../../static/zj.json'
|
||||
import './index.scss'
|
||||
|
||||
Taro.useDidShow(() => {
|
||||
// startMusic('https://files.wanzhuanyongcheng.com/file/music/yaotouzi/3.mp3', true)
|
||||
getUserInfo()
|
||||
getBetList()
|
||||
getList()
|
||||
@@ -67,6 +68,21 @@ const bet_index = ref<number | null>(null)
|
||||
|
||||
const timeStr = ref('')
|
||||
|
||||
const innerAudioContext = Taro.createInnerAudioContext()
|
||||
|
||||
const startMusic = (path: string, loop: boolean = false) => {
|
||||
// const innerAudioContext = Taro.createInnerAudioContext()
|
||||
innerAudioContext.autoplay = true
|
||||
innerAudioContext.src = path
|
||||
innerAudioContext.loop = loop
|
||||
innerAudioContext.onPlay(() => {
|
||||
console.log('开始播放')
|
||||
})
|
||||
innerAudioContext.onError(() => {
|
||||
console.log('播放失败')
|
||||
})
|
||||
}
|
||||
|
||||
const initWs = () => {
|
||||
ws.value = new WebSocket(
|
||||
`${process.env.TARO_APP_TURNTABLE_WS}?uid=${Taro.getStorageSync('uid')}&game_id=${
|
||||
@@ -129,7 +145,7 @@ const initWs = () => {
|
||||
duration: 1000,
|
||||
})
|
||||
initWs()
|
||||
}, 3000)
|
||||
}, 5000)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,6 +262,10 @@ const startRun = (name: string) => {
|
||||
})
|
||||
isRunning.value = true
|
||||
|
||||
innerAudioContext.stop()
|
||||
|
||||
startMusic('https://files.wanzhuanyongcheng.com/file/music/yaotouzi/1.mp3', false)
|
||||
|
||||
turntable_list.value.forEach((item) => {
|
||||
item.isActive = false
|
||||
})
|
||||
@@ -274,6 +294,8 @@ const startRun = (name: string) => {
|
||||
|
||||
turntable.value.removeAttribute('style')
|
||||
setTimeout(() => {
|
||||
turntable.value.style.background = `url(${bgUrl.value}) no-repeat`
|
||||
turntable.value.style.backgroundSize = 'contain'
|
||||
turntable.value.style.transform = `translate(-50%, -50%) rotate(${rotate}deg)`
|
||||
turntable.value.style.transition = `transform ${rotateSpeed}s ease-out`
|
||||
}, 10)
|
||||
|
||||
Reference in New Issue
Block a user