1 line
13 KiB
JSON
1 line
13 KiB
JSON
{"ast":null,"code":"import { mapState } from \"vuex\";\nexport default {\n name: \"PokerView\",\n data() {\n return {\n routeName: null,\n isfrist: true,\n show: false,\n //false\n game_id: \"\",\n isPoker: false,\n //false\n bankerIsWin: false,\n playerIsWin: false,\n win_player_1: null,\n win_player_2: null,\n win_player_3: null,\n bankernum: \"\",\n playernum: \"\",\n role4: \"\",\n role1: \"\",\n role2: \"\",\n role3: \"\",\n timeResult1: null,\n timeResult2: null\n };\n },\n created: function () {\n this.routeName = this.$route.name;\n },\n methods: {\n showCard(data) {\n var game_id = this.game_id;\n var card = data.card_info;\n if (game_id == 1) {\n if (card.banker_1 != 0) {\n this.cardreform(21, card.banker_1);\n }\n if (card.banker_2 != 0) {\n this.cardreform(22, card.banker_2);\n }\n if (card.banker_3 != 0) {\n this.cardreform(23, card.banker_3);\n }\n if (card.player_1 != 0) {\n this.cardreform(11, card.player_1);\n }\n if (card.player_2 != 0) {\n this.cardreform(12, card.player_2);\n }\n if (card.player_3 != 0) {\n this.cardreform(13, card.player_3);\n }\n } else if (game_id == 2) {\n if (card.player_1 != 0) {\n this.cardreform(11, card.player_1);\n }\n if (card.banker_1 != 0) {\n this.cardreform(21, card.banker_1);\n }\n } else if (game_id == 4 || game_id == 5) {\n if (card.card_first != 0) {\n this.cardreform(0, card.card_first);\n }\n if (card.banker_card_1 != 0) {\n this.cardreform(41, card.banker_card_1);\n }\n if (card.banker_card_2 != 0) {\n this.cardreform(42, card.banker_card_2);\n }\n if (card.banker_card_3 != 0) {\n if (game_id == 5) {\n this.cardreform(43, card.banker_card_3, data.tc_result.banker_result);\n } else {\n this.cardreform(43, card.banker_card_3);\n }\n }\n if (card.banker_card_4 != 0 && game_id == 4) {\n this.cardreform(44, card.banker_card_4);\n }\n if (card.banker_card_5 != 0 && game_id == 4) {\n this.cardreform(45, card.banker_card_5, data.nn_result.banker_result);\n }\n if (card.player_1_card_1 != 0) {\n this.cardreform(11, card.player_1_card_1);\n }\n if (card.player_1_card_2 != 0) {\n this.cardreform(12, card.player_1_card_2);\n }\n if (card.player_1_card_3 != 0) {\n if (game_id == 5) {\n this.cardreform(13, card.player_1_card_3, data.tc_result.player_1_result);\n } else {\n this.cardreform(13, card.player_1_card_3);\n }\n }\n if (card.player_1_card_4 != 0 && game_id == 4) {\n this.cardreform(14, card.player_1_card_4);\n }\n if (card.player_1_card_5 != 0 && game_id == 4) {\n this.cardreform(15, card.player_1_card_5, data.nn_result.player_1_result);\n }\n if (card.player_2_card_1 != 0) {\n this.cardreform(21, card.player_2_card_1);\n }\n if (card.player_2_card_2 != 0) {\n this.cardreform(22, card.player_2_card_2);\n }\n if (card.player_2_card_3 != 0) {\n if (game_id == 5) {\n this.cardreform(23, card.player_2_card_3, data.tc_result.player_2_result);\n } else {\n this.cardreform(23, card.player_2_card_3);\n }\n }\n if (card.player_2_card_4 != 0 && game_id == 4) {\n this.cardreform(24, card.player_2_card_4);\n }\n if (card.player_2_card_5 != 0 && game_id == 4) {\n this.cardreform(25, card.player_2_card_5, data.nn_result.player_2_result);\n }\n if (card.player_3_card_1 != 0) {\n this.cardreform(31, card.player_3_card_1);\n }\n if (card.player_3_card_2 != 0) {\n this.cardreform(32, card.player_3_card_2);\n }\n if (card.player_3_card_3 != 0) {\n if (game_id == 5) {\n this.cardreform(33, card.player_3_card_3, data.tc_result.player_3_result);\n } else {\n this.cardreform(33, card.player_3_card_3);\n }\n }\n if (card.player_3_card_4 != 0 && game_id == 4) {\n this.cardreform(34, card.player_3_card_4);\n }\n if (card.player_3_card_5 != 0 && game_id == 4) {\n this.cardreform(35, card.player_3_card_5, data.nn_result.player_3_result);\n }\n }\n },\n cardreform(position, num, result) {\n this.card = {};\n this.card.status = true;\n this.card.round = {};\n this.card.round.card = num;\n if (this.game_id == 1 || this.game_id == 2) {\n this.card.round.position = position;\n } else if (this.game_id == 4 || this.game_id == 5) {\n if (result != undefined) {\n this.card.round.result = result;\n console.log(result);\n }\n this.card.round.order_num = position;\n }\n this.Flop(this.card);\n },\n Flop(data) {\n let which, position, pokerindex;\n if (data.status == true) {\n if (this.game_id == 1 || this.game_id == 2) {\n which = data.round.position.toString();\n } else if (this.game_id == 4) {\n which = data.round.order_num.toString();\n position = parseInt(which / 10);\n pokerindex = which % 10;\n if (pokerindex == 5) {\n this[\"role\" + position] = data.round.result;\n }\n } else if (this.game_id == 5) {\n which = data.round.order_num.toString();\n position = parseInt(which / 10);\n pokerindex = which % 10;\n if (pokerindex == 3) {\n this[\"role\" + position] = data.round.result;\n }\n }\n var pokercard = data.round.card;\n var pokersrc = require(\"../assets/images/poker/\" + pokercard + \".png\");\n setTimeout(() => {\n var $position = this.$refs[\"position_\" + which];\n var $poker = this.$refs[\"pocker_\" + which];\n if (this.game_id == 1) {\n if (which == 13) {\n if (this.$refs.position_13) {\n this.$refs.position_13.style.display = \"inline-block\";\n }\n }\n if (which == 23) {\n if (this.$refs.position_23) {\n this.$refs.position_23.style.display = \"inline-block\";\n }\n }\n }\n if ($position) {\n $position.classList.add(\"active\");\n $poker.style.backgroundImage = \"url('\" + pokersrc + \"')\";\n }\n }, 100);\n }\n },\n openResult(data) {\n // console.log(\"openResult\", data)\n if (this.game_id == 1 || this.game_id == 2) {\n if (data.round.opening == 1) {\n this.bankerIsWin = true;\n } else if (data.round.opening == 2) {\n this.playerIsWin = true;\n }\n this.bankernum = data.round.banker;\n this.playernum = data.round.player;\n } else if (this.game_id == 4 || this.game_id == 5) {\n this.win_player_1 = data.round.win_player_1;\n this.win_player_2 = data.round.win_player_2;\n this.win_player_3 = data.round.win_player_3;\n }\n var that = this;\n this.timeResult1 = setTimeout(() => {\n that.show = false;\n that.bankerIsWin = false;\n that.playerIsWin = false;\n that.win_player_1 = null;\n that.win_player_2 = null;\n that.win_player_3 = null;\n that.bankernum = \"\";\n that.playernum = \"\";\n that.role4 = \"\";\n that.role1 = \"\";\n that.role2 = \"\";\n that.role3 = \"\";\n if (that.game_id == 4 || that.game_id == 5) {\n var firstfaces = require(\"../assets/images/poker/faces.png\");\n if (that.$refs.pocker_0) {\n that.$refs.pocker_0.style.backgroundImage = \"url(\" + firstfaces + \")\";\n }\n }\n }, 7000);\n this.timeResult2 = setTimeout(() => {\n that.isPoker = false;\n }, 7500);\n },\n resetPock() {\n this.bankerIsWin = false;\n this.playerIsWin = false;\n this.win_player_1 = null;\n this.win_player_2 = null;\n this.win_player_3 = null;\n this.bankernum = \"\";\n this.playernum = \"\";\n this.role4 = \"\";\n this.role1 = \"\";\n this.role2 = \"\";\n this.role3 = \"\";\n if (this.game_id == 4 || this.game_id == 5) {\n var firstfaces = require(\"../assets/images/poker/faces.png\");\n if (this.$refs.pocker_0) {\n this.$refs.pocker_0.style.backgroundImage = \"url(\" + firstfaces + \")\";\n }\n }\n this.show = false;\n this.isPoker = false;\n }\n },\n computed: {\n ...mapState({\n $Type: state => state.config.$Type,\n $lang: state => state.config.$lang,\n online: state => state.config.online\n })\n },\n watch: {\n $route: {\n handler() {\n clearTimeout(this.timeResult1);\n clearTimeout(this.timeResult2);\n this.timeResult1 = null;\n this.timeResult2 = null;\n this.bankerIsWin = false;\n this.playerIsWin = false;\n },\n deep: true,\n immediate: true\n },\n online: {\n handler(online) {\n if (online == true) {\n if (this.thisData.bet_status == 2) {\n var that = this;\n setTimeout(() => {\n that.show = true;\n }, 100);\n // 已翻牌\n this.$nextTick(() => {\n this.showCard(this.thisData);\n });\n } else {\n this.resetPock();\n }\n }\n },\n deep: true,\n immediate: true\n },\n thisData: {\n handler(newData) {\n if (newData && newData.game_id) {\n const that = this;\n // 第一次赋值判断\n if (this.isfrist == true || newData.sendMode == \"getState\") {\n this.isfrist = false;\n this.game_id = newData.game_id;\n if (newData.bet_status == 2) {\n that.isPoker = true;\n setTimeout(() => {\n that.show = true;\n }, 100);\n // 已翻牌\n this.$nextTick(() => {\n this.showCard(newData);\n });\n } else if (newData.bet_status == 0) {\n this.isPoker = false;\n }\n if (newData.sendMode == \"startBetCountDown\") {\n if (this.show == true) {\n this.resetPock();\n }\n }\n }\n // 翻牌 开结果\n if (newData.sendMode != \"\" && newData.sendMode != undefined) {\n if (newData.sendMode == \"endBet\") {\n const that = this;\n that.isPoker = true;\n setTimeout(() => {\n that.show = true;\n }, 100);\n } else if (newData.sendMode == \"sendScanResult\") {\n this.Flop(newData);\n } else if (newData.sendMode == \"openingBaccaratResult\") {\n this.openResult(newData);\n } else if (newData.sendMode == \"openingDtResult\") {\n this.openResult(newData);\n } else if (newData.sendMode == \"openingNnResult\") {\n this.openResult(newData);\n } else if (newData.sendMode == \"openingTcResult\") {\n this.openResult(newData);\n } else if (newData.sendMode == \"resetNumberTab\") {\n this.bankerIsWin = false;\n this.playerIsWin = false;\n this.win_player_1 = null;\n this.win_player_2 = null;\n this.win_player_3 = null;\n this.bankernum = \"\";\n this.playernum = \"\";\n this.role4 = \"\";\n this.role1 = \"\";\n this.role2 = \"\";\n this.role3 = \"\";\n if (this.game_id == 4 || this.game_id == 5) {\n var firstfaces = require(\"../assets/images/poker/faces.png\");\n if (this.$refs.pocker_0) {\n this.$refs.pocker_0.style.backgroundImage = \"url(\" + firstfaces + \")\";\n }\n }\n this.show = false;\n this.isPoker = false;\n } else if (newData.sendMode == \"startBet\" || newData.sendMode == \"startBetCountDown\") {\n if (this.show == true) {\n this.resetPock();\n }\n }\n }\n }\n },\n deep: true,\n immediate: true\n }\n },\n props: {\n thisData: Object\n }\n};","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]} |