index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. ws: null,
  68. usdtList: [],
  69. title: 'Hello',
  70. BannerList: [],
  71. Announcement: [],
  72. refreshStatus: false,
  73. }
  74. },
  75. computed: {
  76. ...mapGetters([
  77. 'stocksColor'
  78. ]),
  79. },
  80. onLoad() {
  81. this.getBanner();
  82. this.getAnnouncement();
  83. },
  84. onShow() {
  85. // 获取行情 / 首页推荐
  86. // getQuotationNew() {
  87. // this.$store.dispatch('websocket/getQuotationNew')
  88. // },
  89. this.$store.dispatch('websocket/getQuotationNew')
  90. // this.refreshStatus = true;
  91. // this.getQuotationNew();
  92. },
  93. onHide() {
  94. this.$store.commit('websocket/set_currencySuspend', false)
  95. },
  96. methods: {
  97. openShare() {
  98. this.$nextTick(() => {
  99. this.$refs.sharePageRef.openShare()
  100. })
  101. },
  102. // 获取banner
  103. getBanner() {
  104. Api_getNewsList({
  105. cid: 5,
  106. limit: 10
  107. }).then(res => {
  108. this.BannerList = res.list
  109. })
  110. },
  111. // 获取公告
  112. getAnnouncement() {
  113. Api_getNewsList({
  114. cid: 3,
  115. limit: 10
  116. }).then(res => {
  117. this.Announcement = res.list
  118. })
  119. },
  120. clearInt() {
  121. try {
  122. clearInterval(this.timeInterval);
  123. } catch (e) {
  124. //TODO handle the exception
  125. }
  126. this.timeInterval = null;
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang="scss" scoped>
  132. .content {
  133. // padding: 0 30rpx;
  134. }
  135. .haed-title {
  136. image {
  137. width: 85rpx;
  138. height: 67rpx;
  139. }
  140. .logo {
  141. width: 85rpx;
  142. height: 67rpx;
  143. }
  144. .name {
  145. width: 85rpx;
  146. height: 80rpx;
  147. }
  148. }
  149. </style>