index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. import {
  56. getCurrencyMarket,
  57. setCurrencySuspend
  58. } from "@/utils/currency-market.js"
  59. export default {
  60. components: {
  61. loginStatus,
  62. message,
  63. share,
  64. usdt,
  65. shortcut,
  66. navMuen,
  67. market
  68. },
  69. data() {
  70. return {
  71. ws: null,
  72. usdtList: [],
  73. title: 'Hello',
  74. BannerList: [],
  75. Announcement: [],
  76. refreshStatus: false,
  77. }
  78. },
  79. // watch:{
  80. // aa:{
  81. // handler(newAAA){
  82. // console.log('newAAA' , newAAA)
  83. // },
  84. // immediate:true,
  85. // deep:true
  86. // }
  87. // },
  88. computed: {
  89. ...mapGetters([
  90. 'stocksColor'
  91. ]),
  92. },
  93. onLoad() {
  94. // this.aa =
  95. // currencyMarket()
  96. this.getBanner();
  97. this.getAnnouncement();
  98. },
  99. onShow() {
  100. // 获取行情 / 首页推荐 , 市场
  101. getCurrencyMarket('home')
  102. // getQuotationNew() {
  103. // this.$store.dispatch('websocket/getQuotationNew')
  104. // },
  105. // this.$store.dispatch('websocket/getQuotationNew')
  106. // this.refreshStatus = true;
  107. // this.getQuotationNew();
  108. },
  109. onHide() {
  110. setCurrencySuspend('home')
  111. // this.$store.commit('websocket/set_currencySuspend' , false)
  112. // this.$store.commit('websocket/set_currencySuspend', false)
  113. },
  114. methods: {
  115. openShare() {
  116. this.$nextTick(() => {
  117. this.$refs.sharePageRef.openShare()
  118. })
  119. },
  120. // 获取banner
  121. getBanner() {
  122. Api_getNewsList({
  123. cid: 5,
  124. limit: 10
  125. }).then(res => {
  126. this.BannerList = res.list
  127. })
  128. },
  129. // 获取公告
  130. getAnnouncement() {
  131. Api_getNewsList({
  132. cid: 3,
  133. limit: 10
  134. }).then(res => {
  135. this.Announcement = res.list
  136. })
  137. },
  138. clearInt() {
  139. try {
  140. clearInterval(this.timeInterval);
  141. } catch (e) {
  142. //TODO handle the exception
  143. }
  144. this.timeInterval = null;
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .content {
  151. // padding: 0 30rpx;
  152. }
  153. .haed-title {
  154. image {
  155. width: 85rpx;
  156. height: 67rpx;
  157. }
  158. .logo {
  159. width: 85rpx;
  160. height: 67rpx;
  161. }
  162. .name {
  163. width: 85rpx;
  164. height: 80rpx;
  165. }
  166. }
  167. </style>