| | |
| | | bower_components/ |
| | | .pnp/ |
| | | .pnp.js |
| | | *.zip |
| | | |
| | | # 测试相关 |
| | | coverage/ |
| | |
| | | </div> |
| | | <div class="text-right"> |
| | | <div class="textColor font-28">{{ item.close }}</div> |
| | | <div class="mt-10 font-28" :class="item.change_ratio > 0 ? 'text-green' : 'text-red'">{{ item.change_ratio |
| | | <div class="mt-10 font-28" :class="item.change_ratio_str > 0 ? 'text-green' : 'text-red'">{{ item.change_ratio_str |
| | | }}%</div> |
| | | </div> |
| | | </div> |
| | |
| | | import { _getHomeList } from "@/service/home.api"; |
| | | import { useQuotesStore } from '@/store/quotes.store'; |
| | | import { THEME } from '@/config/theme' |
| | | import { setStorage } from '@/utils/utis' |
| | | import { setStorage, getStorage } from '@/utils/utis' |
| | | import { _getCoinList } from '@/service/quotes.api'; |
| | | export default { |
| | | name: "contractHeader", |
| | | props: { |
| | |
| | | } |
| | | this.show = false |
| | | }, |
| | | onSidebar() { // 侧边栏打开 |
| | | async onSidebar() { // 侧边栏打开 |
| | | // console.log('侧边栏打开: ', this.selectIndex) |
| | | if (this.selectIndex == 2) { |
| | | const quotesData = JSON.parse(localStorage.getItem('qoutes')); |
| | | this.coins = quotesData.coins || []; |
| | | this.coins = quotesData.coins.map(item => item.symbol) |
| | | // if (this.selectIndex == 2) { |
| | | // 优先用本地缓存的 coins |
| | | let arr = getStorage('qoutes') |
| | | let coninArr = '' |
| | | console.log('arr:', arr) |
| | | |
| | | if (arr && arr.length) { |
| | | // 如果本地有 coins,优先用本地 |
| | | arr.forEach(item => { |
| | | coninArr += item.symbol + ',' |
| | | }) |
| | | } else { |
| | | this.coins = this.coinList.map(item => item.symbol); |
| | | // 如果本地没有 coins,拉取接口 |
| | | const quotesData = await _getCoinList() |
| | | console.log('quotesData:', quotesData) |
| | | quotesData.forEach(item => { |
| | | coninArr += item.symbol + ',' |
| | | }) |
| | | setStorage('qoutes', { coins: quotesData }) // 存到本地 |
| | | } |
| | | this.coins = coninArr |
| | | // const quotesData = JSON.parse(localStorage.getItem('qoutes')); |
| | | // this.coins = quotesData.coins || []; |
| | | // this.coins = quotesData.coins.map(item => item.symbol) |
| | | // } else { |
| | | // this.coins = this.coinList.map(item => item.symbol); |
| | | // } |
| | | |
| | | // quotesStore.coins |
| | | |
| | |
| | | this.fetchList() |
| | | }, |
| | | fetchList() { // 获取行情 |
| | | _getHomeList(this.coins.join(',')).then(list => { |
| | | _getHomeList(this.coins).then(list => { |
| | | // console.log(list) |
| | | this.list = list |
| | | if (this.timeout) { |
| | |
| | | </li> |
| | | <li class="flex flex-col items-end mid"> |
| | | <p class="textColor font-32 font-600">{{ item.close || '--' }}</p> |
| | | <p class="font-24 text-grey">{{ currency.currency_symbol }} |
| | | <!-- <p class="font-24 text-grey">{{ currency.currency_symbol }} |
| | | {{ item.close && item.symbol_data.toUpperCase() == 'SHIB' ? (item.close * currency.rate).toFixed(8) : (item.close * |
| | | currency.rate).toFixed(2) || '--' }}</p> |
| | | currency.rate).toFixed(2) || '--' }}</p> --> |
| | | </li> |
| | | <li class="right flex items-center justify-end"> |
| | | <p class="w-153 font-31 h-71 bg-green text-white border-0 text-center btn" v-if="item.change_ratio_str > 0"> |
| | |
| | | </li> |
| | | <li class="flex flex-col items-end mid"> |
| | | <p class="textColor font-32 font-600">{{ item.close }}</p> |
| | | <p class="font-24 text-grey">{{ currency.currency_symbol }} {{ item.close && item.symbol_data.toUpperCase() == 'SHIB' ? (item.close * currency.rate).toFixed(8) : (item.close * |
| | | currency.rate).toFixed(2) || '--' }}</p> |
| | | <!-- <p class="font-24 text-grey">{{ currency.currency_symbol }} {{ item.close && item.symbol_data.toUpperCase() == 'SHIB' ? (item.close * currency.rate).toFixed(8) : (item.close * |
| | | currency.rate).toFixed(2) || '--' }}</p> --> |
| | | </li> |
| | | <li class="right flex items-center justify-end text-right"> |
| | | <div v-if="active == 3" class="textColor w-182 font-700 font-24"> |
| | |
| | | </div> |
| | | <div class="text-right"> |
| | | <div class="textColor font-28">{{ item.close || '--' }}</div> |
| | | <div class="mt-10 font-28" :class="item.change_ratio > 0 ? 'text-green' : 'text-red'"> |
| | | {{ item.change_ratio }}%</div> |
| | | <div class="mt-10 font-28" :class="item.change_ratio_str > 0 ? 'text-green' : 'text-red'"> |
| | | {{ item.change_ratio_str }}%</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { setStorage, handleImage } from '@/utils/utis.js' |
| | | import { getStorage, setStorage, handleImage } from '@/utils/utis.js' |
| | | import { Popup, showSuccessToast } from "vant"; |
| | | import { mapGetters } from "vuex"; |
| | | import { _getHomeList, _collect, _deleteCollect, _checkIsInCollect } from "@/service/home.api"; |
| | |
| | | import { useRouter } from "vue-router"; |
| | | import addCurrency from '@/components/add-currency/index.vue' |
| | | import { _isItemHasAdd, _isItemHasAddGlobal } from '@/service/quotes.api' |
| | | import {_getCoinList} from '@/service/quotes.api' |
| | | const router = useRouter() |
| | | export default { |
| | | name: "contractHeader", |
| | |
| | | } |
| | | this.show = false |
| | | }, |
| | | onSidebar() { // 侧边栏打开 |
| | | async onSidebar() { // 侧边栏打开 |
| | | // console.log(this.userInfo) |
| | | this.coins = this.coinList.map(item => item.symbol) |
| | | // 优先用本地缓存的 coins |
| | | let arr = getStorage('qoutes') |
| | | let coninArr = '' |
| | | console.log('arr:', arr) |
| | | |
| | | if (arr && arr.length) { |
| | | // 如果本地有 coins,优先用本地 |
| | | arr.forEach(item => { |
| | | coninArr += item.symbol + ',' |
| | | }) |
| | | } else { |
| | | // 如果本地没有 coins,拉取接口 |
| | | const quotesData = await _getCoinList() |
| | | console.log('quotesData:', quotesData) |
| | | quotesData.forEach(item => { |
| | | coninArr += item.symbol + ',' |
| | | }) |
| | | setStorage('qoutes', { coins: quotesData }) // 存到本地 |
| | | } |
| | | this.coins = coninArr |
| | | // this.coins = this.coinList.map(item => item.symbol) |
| | | this.show = true |
| | | this.fetchList() |
| | | }, |
| | | fetchList() { // 获取行情 |
| | | _getHomeList(this.coins.join(',')).then(list => { |
| | | _getHomeList(this.coins).then(list => { |
| | | // console.log(list) |
| | | this.list = list |
| | | if (this.timeout) { |
| | |
| | | // const ENV_PRO = 'qheufhj.site' // app域名 |
| | | // const ENV_PRO = window.location.hostname // 接口域名跟随 H5zhapi.coinbtcs.com |
| | | // const ENV_PRO = 'openapi.yanshiz.com' // 接口域名跟随 H5zhapi.coinbtcs.com |
| | | const ENV_PRO = '192.168.10.18:8086' // 接口域名跟随 H5zhapi.coinbtcs.com |
| | | const ENV_PRO = 'aa.yanshiz.com' // 接口域名跟随 H5zhapi.coinbtcs.com |
| | | |
| | | let base_url = '' |
| | | let ws_url = '' |
| | |
| | | if (import.meta.env.MODE === 'development') { |
| | | host_url = 'https://' + ENV_DEV |
| | | base_url = 'https://' + ENV_DEV |
| | | ws_url = 'ws://' + ENV_DEV + '/api/websocket' |
| | | ws_url = 'wss://' + ENV_DEV + '/api/websocket' |
| | | } else { |
| | | host_url = 'https://' + ENV_PRO |
| | | base_url = 'https://' + ENV_PRO |
| | |
| | | export const BASE_URL = base_url |
| | | export const WS_URL = ws_url |
| | | export const IMG_PATH = host_url |
| | | export const HOST_URL = host_url |
| | | // export const HOST_URL = host_url |
| | | export const HOST_URL = 'https://forex.yanshiz.com'; // 静态资源地址 |
| | | |
| | | export default { |
| | | sliderOptions: { |
| | |
| | | }) |
| | | }, |
| | | handleQoutes(data) { |
| | | // console.log('handleQoutes: ', data); |
| | | console.log('handleQoutes: ', data); |
| | | if (data && data.length) { |
| | | const cur = data[0] |
| | | this.price = cur.close |
| | | this.range = cur.changeRatioStr + '' |
| | | this.range = (cur.change_ratio_str || cur.changeRatioStr) |
| | | this.quote = cur |
| | | this.updateKey++ |
| | | } |
| | |
| | | if (data && data.length) { |
| | | const cur = data[0] |
| | | this.price = cur.close |
| | | this.range = cur.change_ratio + '' |
| | | this.range = cur.change_ratio_str || cur.changeRatioStr |
| | | this.quote = cur |
| | | this.updateKey++ |
| | | } |
| | |
| | | <div class="data-index"> |
| | | <div class="flex flex-1 px-32 mt-40"> |
| | | <div class="flex flex-col font-22"> |
| | | <p class="font-70 font-600" :class="quote.change_ratio > 0 ? 'text-green' : 'text-red'"> |
| | | <p class="font-70 font-600" :class="quote.change_ratio_str > 0 ? 'text-green' : 'text-red'"> |
| | | {{ quote.close || '--' }}</p> |
| | | <p class="font-22 mt-10">≈ {{ currency.currency_symbol }}{{ quote.close ? (quote.close * |
| | | currency.rate).toFixed(2) : '--' }} |
| | | <span :class="quote.change_ratio > 0 ? 'text-green' : 'text-red'">{{ quote.change_ratio |
| | | <span :class="quote.change_ratio_str > 0 ? 'text-green' : 'text-red'">{{ quote.changeRatioStr |
| | | || |
| | | '--' }}%</span> |
| | | </p> |
| | |
| | | } |
| | | |
| | | :deep(.van-tabs__nav) { |
| | | background-color: $night !important; |
| | | // background-color: $night !important; |
| | | } |
| | | |
| | | @keyframes animate1 { |
| | |
| | | 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", |
| | |
| | | }, |
| | | async fetchQList(v) { // 获取行情 |
| | | let coninArr = '' |
| | | if (v) { this.getVal = v } |
| | | // if(this.getVal == 2) { |
| | | let arr = getStorage('qoutes').coins |
| | | arr.map((item) => { |
| | | // 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{ |
| | | // coninArr = this.coinArr.join(',') |
| | | // } |
| | | } 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(() => { |
| | | //TODO: 轮询 |
| | | // this.timeout = setTimeout(() => { |
| | | // this.fetchQList() |
| | | // }, 1000) |
| | | //请求失败时,1秒后重试 |
| | | this.timeout = setTimeout(() => { |
| | | this.fetchQList() |
| | | }, 1000) |
| | | }) |
| | | if (!(list instanceof Array)) { |
| | | return |
| | |
| | | </div> |
| | | </div> |
| | | <div class="flex justify-between"> |
| | | <div class="py-2 px-8 rounded-full text-13 font-medium bg-white">{{item.change_ratio}}</div> |
| | | <div class="py-2 px-8 rounded-full text-13 font-medium bg-white">{{item.change_ratio_str}}</div> |
| | | <span class="text-18">→</span> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | <div class="text-center">{{t('理財')}}</div> |
| | | </div> |
| | | <div class="flex-1 flex flex-col items-center" @click="goToPage('/cryptos/trade/btcusdt')"> |
| | | <div class="flex-1 flex flex-col items-center" @click="goToPage('/cryptos/trade/USDSGD')"> |
| | | <div class="w-40 h-40 rounded-full flex items-center justify-center"> |
| | | <img class="w-33 h-33" src="@/assets/c.jpg" draggable="false"> |
| | | </div> |
| | |
| | | import { showToast } from 'vant' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { useRouter } from 'vue-router' |
| | | import { _getCoinList } from '@/service/quotes.api' |
| | | import { setStorage } from '@/utils/index' |
| | | const router = useRouter() |
| | | |
| | | const { t } = useI18n() |
| | |
| | | console.log('user', user) |
| | | username.value = user.userInfo?.username || '' |
| | | usercode.value = user.userInfo?.usercode || '' |
| | | |
| | | // 如果本地没有 coins,拉取接口 |
| | | const quotesData = await _getCoinList() |
| | | setStorage('qoutes', { coins: quotesData }) // 存到本地 |
| | | }) |
| | | |
| | | const goToExplanation = () => { |