live.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div>
  3. <table class="live-table" :class="{'en-lang': $i18n.locale == 'en'}">
  4. <thead>
  5. <th>{{$t('validate.text3')}}</th>
  6. <th>{{$t('table.col2')}}</th>
  7. <th>{{$t('table.col4')}}</th>
  8. <th>{{$t('table.col5')}}</th>
  9. <th>{{$t('table.col3')}}</th>
  10. </thead>
  11. <tbody>
  12. <tr v-for="(item, index) in list" :key="index">
  13. <td>
  14. <a class="link" target="_blank" :href="`https://eospark.com/block/${item.result_block_num}`" v-if="item.result_block_num">{{item.result_block_num}}</a>
  15. </td>
  16. <td>
  17. <i class="vip-level" :class="`icon-level${item.vip_level}`"></i>
  18. <span class="player-name"><a :href="`https://eospark.com/MainNet/account/${item.player}`" target="_blank" class="link">{{item.player}}</a></span>
  19. </td>
  20. <td>
  21. <i class="money-icon"></i>
  22. <a class="link" target="_blank" :href="`https://eospark.com/tx/${item.transfer_trx_id}`">
  23. {{item.offerall.split(" ")[0]}} ({{getOffer(item.offertype)}})
  24. </a>
  25. </td>
  26. <td>
  27. <template v-if="item.win_int > 0">
  28. <a target="_blank" class="link win-amount" :href="`https://eospark.com/tx/${item.result_trx_id}`">
  29. <i class="money-icon"></i>{{item.win_int / 10000}}
  30. </a>
  31. </template>
  32. </td>
  33. <td class="left enable result" @click="$showValidate(item)" v-if="item.status == '1'">
  34. <span class="dice" :class="`dice-${item.num1}`"></span>
  35. <span class="dice" :class="`dice-${item.num2}`"></span>
  36. <span class="dice" :class="`dice-${item.num3}`"></span>
  37. <span class="type">{{belMap(item.result.split('|')[0])}}</span>
  38. <span class="type">{{belMap(item.result.split('|')[1])}}</span>
  39. <span class="type">{{belMap(item.result.split('|')[2])}}</span>
  40. </td>
  41. <td v-else>
  42. <span class="dice dice-round-1"></span>
  43. <span class="dice dice-round-2"></span>
  44. <span class="dice dice-round-3"></span>
  45. </td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. <div class="moblie-list">
  50. <div class="list-item" v-for="(item, index) in list" :key="index" @click="$showValidate(item)">
  51. <div class="top">
  52. <i class="vip-level" :class="`icon-level${item.vip_level}`"></i>{{item.player}}
  53. <span class="amount">
  54. {{$t('table.col4')}}:<i class="game-eos-icon"></i>
  55. {{item.offerall.split(" ")[0]}} ({{getOffer(item.offertype)}})
  56. </span>
  57. </div>
  58. <div class="content">
  59. <template v-if="item.status == '1'">
  60. <div class="m-dice-item" :class="`dice-${item.num1}`"></div>
  61. <div class="m-dice-item" :class="`dice-${item.num2}`"></div>
  62. <div class="m-dice-item" :class="`dice-${item.num3}`"></div>
  63. <span class="type">{{belMap(item.result.split('|')[0])}}</span>
  64. <span class="type">{{belMap(item.result.split('|')[1])}}</span>
  65. <span class="type">{{belMap(item.result.split('|')[2])}}</span>
  66. </template>
  67. <template v-else>
  68. <div class="dice dice-round-1"></div>
  69. <div class="dice dice-round-2"></div>
  70. <div class="dice dice-round-3"></div>
  71. </template>
  72. <div class="right" v-if="item.win_int > 0">
  73. {{$t('table.col5')}}<i class="game-eos-icon"></i><em>{{item.win_int / 10000}}</em>
  74. </div>
  75. </div>
  76. <div class="bottom">
  77. <div class="time" v-if="item.result_block_num">{{item.result_block_num}}</div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import { mapState } from 'vuex'
  85. import API from '@/api'
  86. export default {
  87. data () {
  88. return {
  89. list: []
  90. }
  91. },
  92. props: ['bot'],
  93. computed: {
  94. ...mapState({
  95. newOpen: state => state.newOpen,
  96. newOffer: state => state.newOffer
  97. }),
  98. belMap (value) {
  99. return (value) => {
  100. let map = {
  101. '0': this.$t('game.small.title'),
  102. '1': this.$t('game.big.title'),
  103. '3': this.$t('game.single.title'),
  104. '2': this.$t('game.double.title')
  105. }
  106. return value > 3 ? value / 1 - 1 : map[value]
  107. }
  108. }
  109. },
  110. mounted () {
  111. this.getLiveHistory()
  112. },
  113. methods: {
  114. getLiveHistory (limit = 50, page = this.bot) {
  115. API.table.getLiveHistory({ limit, page }).then(({ data }) => {
  116. this.list = this.list.concat(data.data.list)
  117. this.$emit('endloading')
  118. })
  119. },
  120. getOffer (offertype) {
  121. var belMap = (value) => {
  122. let map = {
  123. '0': this.$t('game.small.title'),
  124. '1': this.$t('game.big.title'),
  125. '3': this.$t('game.single.title'),
  126. '2': this.$t('game.double.title')
  127. }
  128. return value > 3 ? value / 1 - 1 : map[value]
  129. }
  130. let arr = offertype.split('|')
  131. arr.map((e, i) => {
  132. arr[i] = belMap(arr[i])
  133. })
  134. return arr.join(',')
  135. }
  136. },
  137. watch: {
  138. newOpen (to, from) {
  139. let open = to
  140. let id = open.id
  141. let index = this.list.findIndex(item => Number(item.id) === id)
  142. let item = Object.assign(this.list[index], to)
  143. item.status = '1'
  144. this.$set(this.list, index, item)
  145. },
  146. newOffer (to, from) {
  147. let item = to
  148. item.status = '0'
  149. this.list.unshift(item)
  150. },
  151. bot () {
  152. this.getLiveHistory()
  153. }
  154. }
  155. }
  156. </script>