123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <view class="content" :rise-fall="stocksColor">
- <!-- 头部 -->
- <headContent>
- <template #left>
- <loginStatus></loginStatus>
- </template>
- <template #content>
- <view class="haed-title">
- <image src="../../static/images/logo.png" mode="aspectFit"></image>
- <image src="../../static/images/name.png" mode="aspectFit"></image>
- </view>
- </template>
- <template #right>
- <message></message>
- <share @openShare="openShare"></share>
- </template>
- </headContent>
- <!-- 轮播图 -->
- <carousels :BannerList="BannerList"></carousels>
- <!-- 滚动消息 -->
- <rollMessage :rollMsg="Announcement"></rollMessage>
- <view style="width: 100%;height: 1rpx;"></view>
- <!-- usdt -->
- <usdt :usdtList="usdtList"></usdt>
- <view style="width: 100%;height: 8rpx;"></view>
- <gap />
- <!-- 快捷买币 -->
- <shortcut></shortcut>
- <gap />
- <!-- 快捷菜单 -->
- <navMuen></navMuen>
- <!-- 自选 / 市场 -->
- <market :market="quotationNew"></market>
- <!-- 邀请 -->
- <sharePage ref="sharePageRef" :tabBar="false" />
- </view>
- </template>
- <script>
- import loginStatus from "@/components/headModules/login.vue"
- import message from "@/components/headModules/message.vue"
- import share from "@/components/headModules/share.vue"
- import usdt from "./modules/usdt.vue"
- import shortcut from "./modules/shortcut.vue"
- import navMuen from "./modules/nav.vue"
- import market from "./modules/market.vue"
- import {
- Api_getNewsList,
- Api_getQuotationNew
- } from "@/api/index.js"
- import {
- mapGetters
- } from 'vuex'
- export default {
- components: {
- loginStatus,
- message,
- share,
- usdt,
- shortcut,
- navMuen,
- market
- },
- data() {
- return {
- usdtList: [],
- title: 'Hello',
- BannerList: [],
- Announcement: [],
- quotationNew: [],
- refreshStatus: false,
- }
- },
- computed: {
- ...mapGetters([
- 'stocksColor'
- ]),
- },
- watch: {
- quotationNew: {
- handler(newArr) {
- this.usdtList = [];
- if (newArr && newArr.length > 0) {
- const nums = newArr.length > 3 ? 3 : newArr.length;
- this.usdtList = newArr.slice(0, nums);
- } else {
- this.usdtList = []
- }
- },
- deep: true
- }
- },
- onLoad() {
- this.getBanner();
- this.getAnnouncement();
- },
- onShow() {
- this.refreshStatus = true;
- this.getQuotationNew();
- },
- onHide() {
- this.refreshStatus = false;
- console.log('00000' , this.refreshStatus)
- },
- methods: {
- openShare() {
- console.log('00000')
- this.$nextTick(() => {
- this.$refs.sharePageRef.openShare()
- })
- },
- // 获取banner
- getBanner() {
- Api_getNewsList({
- cid: 5,
- limit: 10
- }).then(res => {
- this.BannerList = res.list
- })
- },
- // 获取公告
- getAnnouncement() {
- Api_getNewsList({
- cid: 3,
- limit: 10
- }).then(res => {
- this.Announcement = res.list
- })
- },
- // 获取行情 / 首页推荐
- getQuotationNew() {
- Api_getQuotationNew().then(res => {
- if (res && res.length > 0) {
- this.quotationNew = res.find((item) => item.name == 'USDT').quotation || [];
- } else {
- this.quotationNew = []
- }
- }).catch(err => {
- this.quotationNew = [];
- }).finally(() => {
- setTimeout(() => {
- if (this.refreshStatus) {
- this.getQuotationNew()
- }
- }, 3000)
- })
- },
- clearInt() {
- try {
- clearInterval(this.timeInterval);
- } catch (e) {
- //TODO handle the exception
- }
- this.timeInterval = null;
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content {
- // padding: 0 30rpx;
- }
- .haed-title {
- image {
- width: 85rpx;
- height: 67rpx;
- }
- }
- </style>
|