index.vue 3.4 KB

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