index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="content" :rise-fall="stocksColor">
  3. <!-- 头部 -->
  4. <headContent>
  5. <template #left>
  6. <loginStatus></loginStatus>
  7. </template>
  8. <template #content>
  9. <view class="haed-title">
  10. <image class="logo" src="../../static/images/logo.png" mode="aspectFit"></image>
  11. <image class="name" src="../../static/images/name.png" mode="aspectFit"></image>
  12. </view>
  13. </template>
  14. <template #right>
  15. <message></message>
  16. <share @openShare="openShare"></share>
  17. </template>
  18. </headContent>
  19. <!-- 轮播图 -->
  20. <carousels :BannerList="BannerList"></carousels>
  21. <!-- 滚动消息 -->
  22. <rollMessage :rollMsg="Announcement"></rollMessage>
  23. <!-- usdt -->
  24. <usdt :usdtList="usdtList"></usdt>
  25. <gap />
  26. <!-- 快捷买币 -->
  27. <shortcut></shortcut>
  28. <gap />
  29. <!-- 快捷菜单 -->
  30. <navMuen></navMuen>
  31. <!-- 自选 / 市场 -->
  32. <market></market>
  33. <!-- 邀请 -->
  34. <sharePage ref="sharePageRef" :tabBar="false" />
  35. </view>
  36. </template>
  37. <script>
  38. import loginStatus from "@/components/headModules/login.vue"
  39. import message from "@/components/headModules/message.vue"
  40. import share from "@/components/headModules/share.vue"
  41. import usdt from "./modules/usdt.vue"
  42. import shortcut from "./modules/shortcut.vue"
  43. import navMuen from "./modules/nav.vue"
  44. import market from "./modules/market.vue"
  45. import {
  46. Api_getNewsList,
  47. Api_getQuotationNew
  48. } from "@/api/index.js"
  49. import {
  50. Way_getQuotationNew
  51. } from "@/utils/common-request.js"
  52. import {
  53. mapGetters
  54. } from 'vuex'
  55. export default {
  56. components: {
  57. loginStatus,
  58. message,
  59. share,
  60. usdt,
  61. shortcut,
  62. navMuen,
  63. market
  64. },
  65. data() {
  66. return {
  67. usdtList: [],
  68. title: 'Hello',
  69. BannerList: [],
  70. Announcement: [],
  71. refreshStatus: false,
  72. }
  73. },
  74. computed: {
  75. ...mapGetters([
  76. 'stocksColor'
  77. ]),
  78. },
  79. onLoad() {
  80. this.getBanner();
  81. this.getAnnouncement();
  82. },
  83. onShow() {
  84. this.refreshStatus = true;
  85. this.getQuotationNew();
  86. },
  87. onHide() {
  88. this.refreshStatus = false;
  89. },
  90. methods: {
  91. openShare() {
  92. this.$nextTick(() => {
  93. this.$refs.sharePageRef.openShare()
  94. })
  95. },
  96. // 获取banner
  97. getBanner() {
  98. Api_getNewsList({
  99. cid: 5,
  100. limit: 10
  101. }).then(res => {
  102. this.BannerList = res.list
  103. })
  104. },
  105. // 获取公告
  106. getAnnouncement() {
  107. Api_getNewsList({
  108. cid: 3,
  109. limit: 10
  110. }).then(res => {
  111. this.Announcement = res.list
  112. })
  113. },
  114. // 获取行情 / 首页推荐
  115. getQuotationNew() {
  116. this.$store.dispatch('websocket/getQuotationNew')
  117. },
  118. clearInt() {
  119. try {
  120. clearInterval(this.timeInterval);
  121. } catch (e) {
  122. //TODO handle the exception
  123. }
  124. this.timeInterval = null;
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. .content {
  131. // padding: 0 30rpx;
  132. }
  133. .haed-title {
  134. image {
  135. width: 85rpx;
  136. height: 67rpx;
  137. }
  138. .logo {
  139. width: 85rpx;
  140. height: 67rpx;
  141. }
  142. .name {
  143. width: 85rpx;
  144. height: 80rpx;
  145. }
  146. }
  147. </style>