| | |
| | | <template> |
| | | <div class="home"> |
| | | <!-- <ex-header :unread_num="`${unreadMsg_num}`"></ex-header> --> |
| | | <ioe-swiper /> |
| | | <div class="py-10"> |
| | | <!-- <ioe-swiper /> --> |
| | | <!-- <div class="py-10"> --> |
| | | |
| | | |
| | | <van-notice-bar class="font-26 textColor" left-icon="" :scrollable="false" background="transparent"> |
| | | <!-- <van-notice-bar class="font-26 textColor" left-icon="" :scrollable="false" background="transparent"> |
| | | <div slot="left-icon" class=" flex items-center more-img"><img class="w-20 h-20 more-img" |
| | | src="../../assets/Horn.png" alt=""> |
| | | </div> |
| | |
| | | <div class="ml-20 flex items-center " slot="right-icon" @click.stop="$router.push('/cryptos/announce')"><img |
| | | class="w-20 h-20 more-img" src="../../assets/more.png" alt=""> |
| | | </div> |
| | | </van-notice-bar> |
| | | </div> |
| | | <cry-nav /> |
| | | <div class="quickly"> |
| | | </van-notice-bar> --> |
| | | <!-- </div> --> |
| | | <!-- <cry-nav /> --> |
| | | <!-- <div class="quickly"> |
| | | <div class="quickBox chongbi" :class="THEME == 'dark' ? 'dark' : 'white'" |
| | | @click="$router.push('/cryptos/recharge/rechargeList')"> |
| | | <div class="left"> |
| | |
| | | </div> |
| | | <div class="right"><img src="@/assets/theme/dark/image/goto.png" alt=""></div> |
| | | </div> |
| | | </div> |
| | | <ex-hot :listData="hList"></ex-hot> |
| | | <list-quatation :listData="qList" /> |
| | | </div> --> |
| | | <!-- <ex-hot :listData="hList"></ex-hot> --> |
| | | <list-quatation :listData="qList" @onfetchQList="fetchQList"/> |
| | | <van-popup v-model:show="item.showPopUp" style="border-radius:10px;" :close-on-click-overlay="false" |
| | | v-for="item in popupNewsList" :key="item.id"> |
| | | <div class="w-350 p-20 box-border"> |
| | |
| | | import { _getUnreadMsg } from '@/service/im.api' |
| | | import { _getNewsList1, _getPopupNews } from '@/service/user.api' |
| | | import { BASE_URL } from "@/config"; |
| | | import { _getCoinList } from '@/service/quotes.api'; |
| | | const THEME = 'dark' |
| | | export default { |
| | | name: "HomePage", |
| | |
| | | currency: 'home/currency', |
| | | coinArr: 'home/coinArr', |
| | | hotArr: 'home/hotArr', |
| | | userInfo: 'user/userInfo' |
| | | userInfo: 'user/userInfo', |
| | | }), |
| | | }, |
| | | data() { |
| | |
| | | unreadMsg_timer: null, |
| | | unreadMsg_num: '', |
| | | popupNewsList: [], |
| | | getVal: 1, |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | //console.log('\n *** \n'+unread_num*1+'\n *** \n') |
| | | }) |
| | | }, |
| | | async fetchQList() { // 获取行情 |
| | | const list = await _getHomeList(this.coinArr.join(',')).catch(() => { |
| | | //TODO: 轮询 |
| | | // this.timeout = setTimeout(() => { |
| | | // this.fetchQList() |
| | | // }, 1000) |
| | | async fetchQList(v) { // 获取行情 |
| | | let coninArr = '' |
| | | // if (v) { this.getVal = v } |
| | | let arr = getStorage('qoutes') |
| | | |
| | | // 优先用本地缓存的 coins |
| | | let coins = (arr && arr.coins && arr.coins.length) ? arr.coins : arr |
| | | |
| | | if (coins && coins.length) { |
| | | // 如果本地有 coins,优先用本地 |
| | | coins.forEach(item => { |
| | | coninArr += item.symbol + ',' |
| | | }) |
| | | } else { |
| | | // 如果本地没有 coins,拉取接口 |
| | | const quotesData = await _getCoinList() |
| | | if (quotesData && quotesData.coins && quotesData.coins.length) { |
| | | quotesData.coins.forEach(item => { |
| | | coninArr += item.symbol + ',' |
| | | }) |
| | | } |
| | | } |
| | | console.log('fetchQList', v, coninArr) |
| | | // if() |
| | | const list = await _getHomeList(coninArr).catch(() => { |
| | | //请求失败时,1秒后重试 |
| | | this.timeout = setTimeout(() => { |
| | | this.fetchQList() |
| | | }, 1000) |
| | | }) |
| | | if (!(list instanceof Array)) { |
| | | return |
| | | } |
| | | // console.log('接口:_getHomeList 热门:',list) |
| | | this.loading = false |
| | | // this.qList = list.slice(0,10); |
| | | this.qList = list; |