home-index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <script>
  2. import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
  3. import {
  4. getTotalMoney
  5. } from "@/api/money";
  6. import {
  7. getDividendList
  8. } from "@/api/pledge";
  9. import blank from "@/components/en-utils/en-blank/en-blank.vue"
  10. export default {
  11. name: "home-index",
  12. props: {
  13. address: {
  14. default: ''
  15. }
  16. },
  17. components: {
  18. blank
  19. },
  20. watch: {
  21. 'address': function() {
  22. this.getIconNum()
  23. }
  24. },
  25. data() {
  26. return {
  27. coinNum: '',
  28. pledgeTotal: '',
  29. revenueTotal: '',
  30. price: '',
  31. page: 1,
  32. total: '',
  33. list: []
  34. };
  35. },
  36. mounted() {
  37. this.getIconNum()
  38. this.getTotalMoney()
  39. this.getDividendList()
  40. },
  41. methods: {
  42. getDividendList() {
  43. getDividendList({
  44. 'page': this.page
  45. }).then(res => {
  46. if (res.code === 1) {
  47. this.list.push(...res.data.items)
  48. this.total = res.data.total
  49. }
  50. })
  51. },
  52. scrolltolower() {
  53. if (this.list.length < this.total) {
  54. ++this.page
  55. this.getDividendList()
  56. // console.log('触底');
  57. }
  58. },
  59. getTotalMoney() {
  60. getTotalMoney().then(res => {
  61. if (res.code === 1) {
  62. this.pledgeTotal = res.data.pledgeTotal
  63. this.revenueTotal = res.data.revenueTotal
  64. this.price = res.data.price
  65. }
  66. })
  67. },
  68. async getIconNum() {
  69. if (this.address === '') {
  70. return
  71. }
  72. setTimeout(async () => {
  73. this.coinNum = await tokenpocketBnb.getTokenBalance(this.address, 0)
  74. console.log(this.coinNum, "icon-num----------------------")
  75. }, 100)
  76. },
  77. },
  78. }
  79. </script>
  80. <template>
  81. <view>
  82. <view class="bgc-f p-20 box-sizing-border b-rad-20 mb-40">
  83. <image class="head-img" :src="require('@/static/img/index/index/bannerhome.png')" mode="widthFix"></image>
  84. </view>
  85. <view class="bgc-f p-20 box-sizing-border b-rad-20 mb-40">
  86. <view class="b-rad-20 h-80 align-items-center bgc-f1f9fe">
  87. <view class="flex-1 flex-direction-column align-items-center flex-justify-center">
  88. <view class="fs-28 mb-8">
  89. DAO價格($)
  90. </view>
  91. <view class="fs-28 fw-b">
  92. {{price}}
  93. </view>
  94. </view>
  95. <view class="flex-1 flex-direction-column align-items-center flex-justify-center">
  96. <view class="fs-28 mb-8">
  97. DAO餘額
  98. </view>
  99. <view class="fs-28 fw-b">
  100. {{coinNum}}
  101. </view>
  102. </view>
  103. <view class="flex-1 flex-direction-column align-items-center flex-justify-center">
  104. <view class="fs-28 mb-8">
  105. 贡献总额
  106. </view>
  107. <view class="fs-28 fw-b">
  108. {{pledgeTotal}}
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. <view class="bgc-f p-20 box-sizing-border b-rad-20">
  114. <view class="fs-28 pt-5 mb-8">
  115. 贡献收益记录
  116. </view>
  117. <view v-if="list.length<=0" class="blank-box align-items-center flex-justify-center">
  118. <blank :showBlank="list.length<=0?true:false" message="暂无数据"></blank>
  119. </view>
  120. <view class="bgc-F6F7FA" v-else>
  121. <view class="item-box align-items-center flex-justify-space" v-for="item in list" :key="item.id">
  122. <view>
  123. <view class="mb-8 fs-28 fw-b">贡献数量</view>
  124. <view class="fs-24">{{item.created_date}}</view>
  125. </view>
  126. <view class="align-items-center">
  127. <view class="fs-24">奖励:</view>
  128. <view class="fs-28 fc-ED301D">{{item.sorting_money}}</view>
  129. </view>
  130. </view>
  131. <view class="h-50 text-align-center fs-28">
  132. ~暂无记录
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. </template>
  138. <style scoped lang="scss">
  139. .head-img {
  140. width: 100%;
  141. // height: 128px;
  142. }
  143. .h-80 {
  144. height: 160rpx;
  145. }
  146. .h-50 {
  147. height: 100rpx;
  148. line-height: 100rpx;
  149. }
  150. .item-box {
  151. width: 100%;
  152. height: 120rpx;
  153. padding: 10rpx 20rpx;
  154. box-sizing: border-box;
  155. border-top: 2rpx solid #e5e5e5;
  156. }
  157. .item-box:first-child {
  158. border-top: none;
  159. }
  160. </style>