validate.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <transition name="msgbox-fade">
  3. <div class="pub-modal" v-if="visible">
  4. <div class="mask"></div>
  5. <div class="modal validate-modal">
  6. <i class="close-icon" @click="visible = false"></i>
  7. <div class="title">
  8. <span>{{$t('validate.title')}}</span>
  9. </div>
  10. <div class="content">
  11. <div class="validate-dice-wrapper">
  12. <div class="dice-item" :class="`dice-${resultData.num1}`"></div>
  13. <div class="dice-item" :class="`dice-${resultData.num2}`"></div>
  14. <div class="dice-item" :class="`dice-${resultData.num3}`"></div>
  15. </div>
  16. <div class="validate-result">
  17. <span class="text">{{$t('validate.text10')}}</span>
  18. <p class="num-box" v-if="resultData.transfer_block_num">
  19. <a target="_blank" :href="createLink" class="num-item block-num">{{resultData.transfer_block_num}}</a>
  20. </p>
  21. </div>
  22. <div class="validate-result">
  23. <span class="text">{{$t('validate.text8')}}</span>
  24. <p class="num-box" v-if="resultData.result_block_num">
  25. <a target="_blank" :href="resultLink" class="num-item block-num">{{resultData.result_block_num}}</a>
  26. <a target="_blank" :href="resultLink" class="num-item block-hash" v-html="hashSource"></a>
  27. </p>
  28. </div>
  29. <div class="validate-tips">{{$t('validate.text6')}}</div>
  30. </div>
  31. </div>
  32. </div>
  33. </transition>
  34. </template>
  35. <script>
  36. export default {
  37. name: 'validatePopup',
  38. computed: {
  39. hashSource () {
  40. if (this.resultData.result_block_id) {
  41. let hash = this.resultData.result_block_id
  42. let diceNum = [this.resultData.num1, this.resultData.num2, this.resultData.num3]
  43. let subHash = hash.substring(hash.length - 32, hash.length)
  44. let hashArr = subHash.split('')
  45. let resultLen = diceNum.length
  46. let k = 0
  47. for (let i = hashArr.length - 1; i >= 0; i--) {
  48. let char = hashArr[i]
  49. if (diceNum.indexOf(char) > -1 && k < resultLen) {
  50. let newChar = `<span class="yellow">${char}</span>`
  51. hashArr.splice(i, 1, newChar)
  52. k++
  53. }
  54. }
  55. return '...' + hashArr.join('')
  56. } else {
  57. return ''
  58. }
  59. },
  60. createLink () {
  61. return `https://eospark.com/tx/${this.resultData.transfer_trx_id}`
  62. },
  63. resultLink () {
  64. return `https://eospark.com/block/${this.resultData.result_block_num}`
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss">
  70. .validate-modal{
  71. width: px2rem(900);
  72. .validate-dice-wrapper{
  73. text-align: center;
  74. font-size: 0;
  75. margin: px2rem(50) 0;
  76. }
  77. .dice-item{
  78. display: inline-block;
  79. width: px2rem(62);
  80. height: px2rem(62);
  81. margin: 0 px2rem(40);
  82. }
  83. .validate-result{
  84. color: #ffffff;
  85. font-size: 0;
  86. display: flex;
  87. margin-bottom: px2rem(20);
  88. .text{
  89. display: inline-block;
  90. font-size: px2rem(20);
  91. line-height: px2rem(32);
  92. min-width: px2rem(100);
  93. text-align: left;
  94. }
  95. }
  96. .num-item{
  97. display: inline-block;
  98. margin-right: px2rem(20);
  99. .yellow{
  100. color: #ffeb00;
  101. }
  102. }
  103. .num-box{
  104. flex: 1;
  105. background-color: #1e334b;
  106. height: px2rem(32);
  107. line-height: px2rem(32);
  108. padding: 0 px2rem(10);
  109. border-radius: 4px;
  110. font-size: px2rem(24);
  111. }
  112. .validate-tips{
  113. color: #82a8c6;
  114. line-height: px2rem(32);
  115. font-size: px2rem(20);
  116. text-align: center;
  117. }
  118. a{
  119. text-decoration: none;
  120. color: #ffffff;
  121. }
  122. @media #{$phone} {
  123. width: 98% !important;
  124. padding-left: px2rem(10) !important;
  125. padding-right: px2rem(10) !important;
  126. .num-item{
  127. margin-right: px2rem(4);
  128. }
  129. }
  130. }
  131. </style>