mine.vue 5.1 KB

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