Skip to content

Commit

Permalink
Improve reconnect feature
Browse files Browse the repository at this point in the history
  • Loading branch information
voocel committed Jul 10, 2020
1 parent b3fcee7 commit 99696ea
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/views/room/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import Action from './Action'
import Fade from './Fade'
import Setting from './Setting'
import poker from '@/utils/poker'
import { getDirection, getUserInfo } from '@/utils/auth'
import { getDirection, getToken, getUserInfo } from '@/utils/auth'
export default {
name: 'Room',
components: {
Expand Down Expand Up @@ -156,14 +156,14 @@ export default {
return
}
// const actions = {
// cmd: 'ddz/reconnect',
// param: { room_no: this.roomNo, grade: 'simple' },
// access_token: getToken()
// }
// setTimeout(() => {
// this.$socket.sendObj(actions)
// }, 1000)
const actions = {
cmd: 'ddz/enterRoom',
param: { room_no: this.roomNo, grade: 'simple' },
access_token: getToken()
}
setTimeout(() => {
this.$socket.sendObj(actions)
}, 1000)
this.message()
},
methods: {
Expand Down Expand Up @@ -261,20 +261,21 @@ export default {
}
},
roomInfo(data) {
// console.log(data)
console.log(data)
const playerInfo = data.player_info
playerInfo.forEach((item) => {
this.$store.commit('user/setReady', [item['uid'], item['is_ready']])
})
if (data.remain_card) {
this.landlordCards = data.remain_card
}
if (data.player_hand_cards) {
this.handCards['mine'] = data.player_hand_cards
this.handCards['mine'] = this.common.batchFormatCards(data.player_hand_cards)
this.$store.commit('user/setStartState', true)
}
if (data.remain_card) {
this.landlordCards = this.common.batchFormatCards(data.remain_card)
}
},
playerInfo(data) {
console.log(data)
// console.log(data)
let playerInfo = []
if (sessionStorage.player_info !== undefined) {
playerInfo = JSON.parse(sessionStorage.player_info)
Expand Down

0 comments on commit 99696ea

Please sign in to comment.