index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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.dispatch('websocket/getQuotationNew', {suspend:true})
  95. this.ws && this.ws.closeSocket(1000);
  96. // this.refreshStatus = false;
  97. },
  98. methods: {
  99. openShare() {
  100. this.$nextTick(() => {
  101. this.$refs.sharePageRef.openShare()
  102. })
  103. },
  104. // 获取banner
  105. getBanner() {
  106. Api_getNewsList({
  107. cid: 5,
  108. limit: 10
  109. }).then(res => {
  110. this.BannerList = res.list
  111. })
  112. },
  113. // 获取公告
  114. getAnnouncement() {
  115. Api_getNewsList({
  116. cid: 3,
  117. limit: 10
  118. }).then(res => {
  119. this.Announcement = res.list
  120. })
  121. },
  122. clearInt() {
  123. try {
  124. clearInterval(this.timeInterval);
  125. } catch (e) {
  126. //TODO handle the exception
  127. }
  128. this.timeInterval = null;
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. .content {
  135. // padding: 0 30rpx;
  136. }
  137. .haed-title {
  138. image {
  139. width: 85rpx;
  140. height: 67rpx;
  141. }
  142. .logo {
  143. width: 85rpx;
  144. height: 67rpx;
  145. }
  146. .name {
  147. width: 85rpx;
  148. height: 80rpx;
  149. }
  150. }
  151. </style>