remove audio and fixed some bug

This commit is contained in:
wzdwc
2021-06-19 11:56:40 +08:00
parent 0e59f93b47
commit e723042a41
8 changed files with 101 additions and 68 deletions
+6 -6
View File
@@ -123,12 +123,12 @@ import { IPlayer } from '@/interface/IPlayer';
}
private action(command: string) {
if (command.indexOf('raise') > -1 || command === 'allin' || command === 'call' ) {
this.playRaise = true;
}
if (command === 'fold' || command === 'check') {
this.playFold = true;
}
// if (command.indexOf('raise') > -1 || command === 'allin' || command === 'call' ) {
// this.playRaise = true;
// }
// if (command === 'fold' || command === 'check') {
// this.playFold = true;
// }
if (!this.actioned) {
this.actioned = true;
this.$emit('action', command);
+42 -46
View File
@@ -1,46 +1,42 @@
<template>
<div class="audio-container">
<audio ref="click" controls>
<source src="../assets/mp3/click.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio ref="raise" controls>
<source src="../assets/mp3/raise.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio ref="fold" controls>
<source src="../assets/mp3/fold.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio ref="income" controls>
<source src="../assets/mp3/income.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
</template>
<script lang="ts">
import {Component, Prop, Vue, Watch} from 'vue-property-decorator';
@Component
export default class Audio extends Vue {
@Prop() private type!: string;
@Prop() private play!: boolean;
@Watch('play')
private wPlay(val: boolean) {
if (val) {
(this.$refs[this.type] as HTMLAudioElement).play();
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped
lang="less">
.audio-container {
position: absolute;
z-index: -99;
display: none;
}
</style>
<template>
<div class="audio-container">
<!-- <audio ref="click" controls>-->
<!-- <source src="../assets/mp3/click.mp3" type="audio/mpeg">-->
<!-- Your browser does not support the audio element.-->
<!-- </audio>-->
<!-- <audio ref="raise" controls>-->
<!-- <source src="../assets/mp3/raise.mp3" type="audio/mpeg">-->
<!-- Your browser does not support the audio element.-->
<!-- </audio>-->
<!-- <audio ref="fold" controls>-->
<!-- <source src="../assets/mp3/fold.mp3" type="audio/mpeg">-->
<!-- Your browser does not support the audio element.-->
<!-- </audio>-->
</div>
</template>
<script lang="ts">
import {Component, Prop, Vue, Watch} from 'vue-property-decorator';
@Component
export default class Audio extends Vue {
@Prop() private type!: string;
@Prop() private play!: boolean;
@Watch('play')
private wPlay(val: boolean) {
if (val) {
(this.$refs[this.type] as HTMLAudioElement).play();
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped
lang="less">
.audio-container {
position: absolute;
z-index: -99;
display: none;
}
</style>
+6 -9
View File
@@ -58,7 +58,7 @@
<record :players="players"
v-model="showRecord"></record>
<sendMsg @send = 'sendMsgHandle' :msg-list="msgListReverse"></sendMsg>
<iAudio :play="playIncome" type="income"></iAudio>
<!-- <iAudio :play="playIncome" type="income"></iAudio>-->
<gameRecord v-model="showCommandRecord"
:game-list="gameList"
@getRecord = "getRecord"
@@ -145,7 +145,7 @@
private actionUserId = '';
private showAllin = false;
private showMsg = false;
private playIncome = false;
// private playIncome = false;
private msg = '';
private time = ACTION_TIME;
private timeSt = 0;
@@ -277,7 +277,6 @@
return;
}
this.timeSt = setTimeout(() => {
console.log('this.actionEndTime', this.actionEndTime)
const now = Date.now();
this.time = Math.floor((this.actionEndTime - now) / 1000);
this.doCountDown();
@@ -315,7 +314,6 @@
}
private delay() {
console.log('delay')
this.emit('delayTime');
}
@@ -443,10 +441,10 @@
});
});
// income music
this.playIncome = true;
setTimeout(() => {
this.playIncome = false;
}, 1000);
// this.playIncome = true;
// setTimeout(() => {
// this.playIncome = false;
// }, 1000);
}
if (msg.action === 'newGame') {
@@ -462,7 +460,6 @@
}
if (msg.action === 'delayTime') {
console.log('delay======', msg)
this.actionEndTime = msg.data.actionEndTime;
const now = Date.now();
this.time = Math.floor((this.actionEndTime - now) / 1000);