| | |
| | | data: objectToFormData(data), |
| | | }); |
| | | }; |
| | | // ico |
| | | export const itemlist = (params) => { |
| | | return requestHttp({ |
| | | url: "api/icoNewCurrency/getUnlisted.action", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | }; |
| | |
| | | |
| | | <script> |
| | | import { Popup } from "vant"; |
| | | import { mapGetters } from "vuex"; |
| | | import { mapActions, mapGetters } from "vuex"; |
| | | import { _getHomeList } from "@/API/home.api"; |
| | | import { setStorage } from "@/utils/utis"; |
| | | export default { |
| | |
| | | ...mapGetters({ |
| | | coinList: "home/coinList", |
| | | theme: "home/theme", |
| | | newcoinArr: "home/newcoinArr", |
| | | }), |
| | | title() { |
| | | return [this.$t("永续"), this.$t("交割")][this.selectIndex - 1]; |
| | |
| | | }; |
| | | }, |
| | | created() { |
| | | this.NEW_CION_LIST(); |
| | | // this.coins = this.coinList.map(item => item.symbol) |
| | | // console.log('this.coins', this.coins) |
| | | }, |
| | | methods: { |
| | | ...mapActions("home", ["NEW_CION_LIST"]), |
| | | onRoute(item) { |
| | | if (this.$route.params.symbol !== item.symbol) { |
| | | this.$router.push(`/perpetualContract/${item.symbol}`); |
| | |
| | | }, |
| | | fetchList() { |
| | | // 获取行情 |
| | | _getHomeList(this.coins.join(",")).then((list) => { |
| | | const mainArray = this.coins.filter( |
| | | (item) => !this.newcoinArr.includes(item) |
| | | ); |
| | | _getHomeList(mainArray.join(",")).then((list) => { |
| | | // console.log(list) |
| | | this.list = list; |
| | | if (this.timeout) { |
| | |
| | | ...mapGetters({ |
| | | coinList: "home/coinList", |
| | | theme: "home/theme", |
| | | newcoinArr: "home/newcoinArr", |
| | | }), |
| | | }, |
| | | data() { |
| | |
| | | // { name:"ADA/USDT",close:"0.493085",change_ratio:"-4.08"}, |
| | | //] |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.NEW_CION_LIST(); |
| | | }, |
| | | watch: { |
| | | symbol(val) { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | ...mapMutations("home", ["SET_THEME"]), |
| | | ...mapMutations("home", ["SET_THEME", "NEW_CION_LIST"]), |
| | | onRoute(item) { |
| | | if (this.islevel) { |
| | | if (this.$route.params.symbol !== item.symbol) { |
| | |
| | | }, |
| | | fetchList() { |
| | | // 获取行情 |
| | | _getHomeList(this.coins.join(",")).then((list) => { |
| | | const mainArray = this.coins.filter( |
| | | (item) => !this.newcoinArr.includes(item) |
| | | ); |
| | | _getHomeList(mainArray.join(",")).then((list) => { |
| | | // console.log(list) |
| | | this.list = list; |
| | | if (this.timeout) { |
| | |
| | | coinList: "home/coinList", |
| | | currency: "home/currency", |
| | | coinArr: "home/coinArr", |
| | | newcoinArr: "home/newcoinArr", |
| | | hotArr: "home/hotArr", |
| | | userInfo: "user/userInfo", |
| | | theme: "home/theme", |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | ...mapActions("home", [SET_COIN_LIST]), |
| | | ...mapActions("home", [SET_COIN_LIST, "NEW_CION_LIST"]), |
| | | fetchUnread() { |
| | | // 获取未读 |
| | | _getUnreadMsg().then((unread_num) => { |
| | |
| | | }, |
| | | async fetchQList() { |
| | | // 获取行情 |
| | | const list = await _getHomeList(this.coinArr.join(",")).catch(() => { |
| | | // console.log(this.newcoinArr, "[[[[[]]]]]"); |
| | | const mainArray = this.coinArr.filter( |
| | | (item) => !this.newcoinArr.includes(item) |
| | | ); |
| | | |
| | | const list = await _getHomeList(mainArray.join(",")).catch(() => { |
| | | this.timeout = setTimeout(() => { |
| | | this.fetchQList(); |
| | | }, 1000); |
| | |
| | | }, |
| | | }, |
| | | async created() { |
| | | await this.NEW_CION_LIST(); |
| | | this.getIsSave(); |
| | | this.getNews(); |
| | | this.getPopupNews(); |
| | |
| | | async activated() { |
| | | this.getNews(); |
| | | this.getPopupNews(); |
| | | await this.NEW_CION_LIST(); |
| | | await this.SET_COIN_LIST(); |
| | | this.startTimeout(); |
| | | if (this.userInfo.token) { |
| | |
| | | [Tab.name]: Tab, |
| | | [Tabs.name]: Tabs, |
| | | }, |
| | | mounted() { |
| | | this.NEW_CION_LIST(); |
| | | }, |
| | | async created() { |
| | | this.keywords = this.$route.query.inputdata; |
| | | // console.log(this.inputdata, "this.inputdata"); |
| | |
| | | await this.fetchQoutes(); |
| | | }, |
| | | computed: { |
| | | ...mapGetters({ coinList: "home/coinList", userInfo: "user/userInfo" }), |
| | | ...mapGetters({ |
| | | coinList: "home/coinList", |
| | | userInfo: "user/userInfo", |
| | | newcoinArr: "home/newcoinArr", |
| | | }), |
| | | }, |
| | | data() { |
| | | const arr = []; |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | ...mapActions("home", [SET_COIN_LIST]), |
| | | ...mapActions("home", [SET_COIN_LIST], "NEW_CION_LIST"), |
| | | listSort(val) { |
| | | this.sortVal = val; |
| | | }, |
| | |
| | | await this.SET_COIN_LIST(); |
| | | } |
| | | const coins = this.coinList.map((item) => item.symbol); |
| | | const data = await _getHomeList(coins.join(",")); |
| | | const mainArray = coins.filter((item) => !this.newcoinArr.includes(item)); |
| | | const data = await _getHomeList(mainArray.join(",")); |
| | | console.log(data); |
| | | this.tabList[0]["data"] = data.filter((item) => |
| | | this.myList.includes(item.symbol) |
| | |
| | | <div class="px-32 py-30 flex items-center"> |
| | | <!-- <img src="@/assets/image/icon-left_arrow.png" alt="logo" class="w-20 h-33 border-1 mr-32" @click="back"/> --> |
| | | <div class="inputBoxbg h-60 w-full rounded-full flex items-center"> |
| | | <img src="@/assets/image/icon-search.png" alt="logo" class="w-32 h-32 mx-16" /> |
| | | <input type="text" v-model="keywords" :placeholder="$t('搜索')" |
| | | class="h-full flex-1 border-none search-input bg-none" @input="onInput" /> |
| | | <img |
| | | src="@/assets/image/icon-search.png" |
| | | alt="logo" |
| | | class="w-32 h-32 mx-16" |
| | | /> |
| | | <input |
| | | type="text" |
| | | v-model="keywords" |
| | | :placeholder="$t('搜索')" |
| | | class="h-full flex-1 border-none search-input bg-none" |
| | | @input="onInput" |
| | | /> |
| | | </div> |
| | | <div class="cancel" @click="cancel"> |
| | | {{ $t('取消') }} |
| | | {{ $t("取消") }} |
| | | </div> |
| | | </div> |
| | | <van-tabs v-model="active" @change="changeValue"> |
| | |
| | | <van-tab :title="$t('热门功能')"></van-tab> |
| | | </van-tabs> |
| | | <div v-if="active == 0" class="px-32 mt-20"> |
| | | <div class="list-item flex" v-for="(item, index) in currencyList" :key="index" @click.stop="onItemClick(item)"> |
| | | <div |
| | | class="list-item flex" |
| | | v-for="(item, index) in currencyList" |
| | | :key="index" |
| | | @click.stop="onItemClick(item)" |
| | | > |
| | | <div class="flex-1 item-left flex"> |
| | | <div class=""> |
| | | <van-icon class="star-icon-check" v-if="index == 0 || index == 1" name="fire" /> |
| | | <van-icon |
| | | class="star-icon-check" |
| | | v-if="index == 0 || index == 1" |
| | | name="fire" |
| | | /> |
| | | <span v-else class="font-35"> |
| | | {{ index + 1 }} |
| | | </span> |
| | | </div> |
| | | <div class="pl-30 symbol-name">{{ item.symbol.toUpperCase() }}<span>/usdt</span></div> |
| | | <div class="pl-30 symbol-name"> |
| | | {{ item.symbol.toUpperCase() }}<span>/usdt</span> |
| | | </div> |
| | | </div> |
| | | <div class="item-right"> |
| | | <div class="symbol-name">{{ item.close }}</div> |
| | | <div class="increase mt-10" :class="[item.change_ratio > 0 ? 'green' : 'red']">{{ item.change_ratio |
| | | }}%</div> |
| | | <div |
| | | class="increase mt-10" |
| | | :class="[item.change_ratio > 0 ? 'green' : 'red']" |
| | | > |
| | | {{ item.change_ratio }}% |
| | | </div> |
| | | <van-icon :class="[item.isCollection ? 'star-icon-check' : 'star-icon']" class="font-40 ml-20" name="star" |
| | | @click.stop="onCollect(item)" /> |
| | | </div> |
| | | <van-icon |
| | | :class="[item.isCollection ? 'star-icon-check' : 'star-icon']" |
| | | class="font-40 ml-20" |
| | | name="star" |
| | | @click.stop="onCollect(item)" |
| | | /> |
| | | </div> |
| | | </div> |
| | | <div v-if="active == 1" class="px-32 mt-30"> |
| | | <div class="function-item list-item flex" v-for="(item, index) in dataList" @click="jump(item.path)" |
| | | :key="index"> |
| | | <div |
| | | class="function-item list-item flex" |
| | | v-for="(item, index) in dataList" |
| | | @click="jump(item.path)" |
| | | :key="index" |
| | | > |
| | | <div class="flex-1 flex item-left"> |
| | | <div> |
| | | <span v-if="index == 0 || index == 1">{{ index + 1 }}</span> |
| | | <span v-else> |
| | | {{ index + 1 }} |
| | | </span> |
| | | |
| | | </div> |
| | | <div class="imgBox ml-30"><img :src="item.icon" alt=""></div> |
| | | <div class="imgBox ml-30"><img :src="item.icon" alt="" /></div> |
| | | <div class=" ml-30 symbol-name">{{ item.name }}</div> |
| | | </div> |
| | | <div class="item-right"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div v-if="dataList.length == 0 || currencyList.length == 0" |
| | | class="flex flex-col justify-center items-center pt-185"> |
| | | <img src="@/assets/image/assets-center/no-data.png" alt="no-date" class="w-180 h-180" /> |
| | | <p class="textColor">{{ $t('暂无数据') }}</p> |
| | | <div |
| | | v-if="dataList.length == 0 || currencyList.length == 0" |
| | | class="flex flex-col justify-center items-center pt-185" |
| | | > |
| | | <img |
| | | src="@/assets/image/assets-center/no-data.png" |
| | | alt="no-date" |
| | | class="w-180 h-180" |
| | | /> |
| | | <p class="textColor">{{ $t("暂无数据") }}</p> |
| | | </div> |
| | | <div class="loading-box" v-if="isLoading"> |
| | | <van-loading type="spinner" size="24px" /> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { _fundRecord } from '@/API/fund.api' |
| | | import { List } from 'vant' |
| | | import { Tab, Tabs, Loading } from 'vant'; |
| | | import { _getHomeList, _myCoins, _collect, _deleteCollect } from '@/API/home.api' |
| | | import { mapGetters } from "vuex"; |
| | | import { _fundRecord } from "@/API/fund.api"; |
| | | import { List } from "vant"; |
| | | import { Tab, Tabs, Loading } from "vant"; |
| | | import { |
| | | _getHomeList, |
| | | _myCoins, |
| | | _collect, |
| | | _deleteCollect, |
| | | } from "@/API/home.api"; |
| | | import { mapActions, mapGetters } from "vuex"; |
| | | import { TIME_OUT } from "@/config"; |
| | | import { setStorage } from "@/utils/utis"; |
| | | export default { |
| | | name: "search", |
| | | data() { |
| | | return { |
| | | keywords: '', |
| | | keywords: "", |
| | | active: 0, |
| | | allFunList: [], |
| | | dataList: [], |
| | |
| | | currencyList: [], |
| | | timeout: null, |
| | | collectionList: [], |
| | | isLoading: true |
| | | } |
| | | isLoading: true, |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.NEW_CION_LIST(); |
| | | this.allFunList = [ |
| | | { |
| | | name: this.$t('理财'), |
| | | name: this.$t("理财"), |
| | | icon: require(`../../assets/theme/${this.theme}/image/nav/finance.png`), |
| | | path: '/fm-home' |
| | | path: "/fm-home", |
| | | }, |
| | | { |
| | | name: this.$t('充值'), |
| | | name: this.$t("充值"), |
| | | icon: require(`../../assets/theme/${this.theme}/image/nav/account.png`), |
| | | // path: '/recharge/rechargePage' |
| | | path: '/recharge/rechargeList' |
| | | path: "/recharge/rechargeList", |
| | | }, |
| | | { |
| | | name: this.$t('合约交易'), |
| | | name: this.$t("合约交易"), |
| | | icon: require(`../../assets/theme/${this.theme}/image/nav/trading.png`), |
| | | path: '/trendDetails/btc' |
| | | path: "/trendDetails/btc", |
| | | }, |
| | | { |
| | | name: this.$t('闪兑'), |
| | | name: this.$t("闪兑"), |
| | | icon: require(`../../assets/theme/${this.theme}/image/nav/exchange.png`), |
| | | path: '/exchange/exchangePage' |
| | | } |
| | | ] |
| | | this.dataList = this.allFunList |
| | | path: "/exchange/exchangePage", |
| | | }, |
| | | ]; |
| | | this.dataList = this.allFunList; |
| | | if (this.$store.state.user.userInfo.token) { |
| | | this.myCoinsList() |
| | | this.myCoinsList(); |
| | | } |
| | | setTimeout(() => { |
| | | this.fetchQList(); |
| | | }, 1000) |
| | | }, 1000); |
| | | }, |
| | | components: { |
| | | [List.name]: List, |
| | | [Tabs.name]: Tabs, |
| | | [Tab.name]: Tab, |
| | | [Loading.name]: Loading |
| | | [Loading.name]: Loading, |
| | | }, |
| | | watch: { |
| | | collectionList(val) { |
| | |
| | | this.allCurrencyList.map((item) => { |
| | | val.map((item2) => { |
| | | if (item.symbol == item2.symbol) { |
| | | item.isCollection = true |
| | | item.isCollection = true; |
| | | } |
| | | }) |
| | | }) |
| | | }); |
| | | }); |
| | | this.currencyList.map((item) => { |
| | | val.map((item2) => { |
| | | if (item.symbol == item2.symbol) { |
| | | item.isCollection = true |
| | | item.isCollection = true; |
| | | } |
| | | }) |
| | | }) |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | computed: { |
| | | ...mapGetters({ |
| | | coinArr: 'home/coinArr', |
| | | theme: 'home/theme' |
| | | coinArr: "home/coinArr", |
| | | theme: "home/theme", |
| | | newcoinArr: "home/newcoinArr", |
| | | }), |
| | | }, |
| | | filters: { |
| | | |
| | | }, |
| | | filters: {}, |
| | | beforeDestroy() { |
| | | clearInterval(this.timeout) |
| | | clearInterval(this.timeout); |
| | | }, |
| | | methods: { |
| | | ...mapActions("home", ["NEW_CION_LIST"]), |
| | | |
| | | onInput() { |
| | | if (this.active == 1) { |
| | | if (this.keywords) { |
| | | this.dataList = this.dataList.filter((item) => { |
| | | return item.name.indexOf(this.keywords) != -1 |
| | | }) |
| | | return item.name.indexOf(this.keywords) != -1; |
| | | }); |
| | | } else { |
| | | this.dataList = this.allFunList |
| | | this.dataList = this.allFunList; |
| | | } |
| | | } |
| | | }, |
| | | cancel() { |
| | | this.$router.go(-1) |
| | | this.$router.go(-1); |
| | | }, |
| | | jump(path) { |
| | | this.$router.push(path) |
| | | this.$router.push(path); |
| | | }, |
| | | myCoinsList() { |
| | | _myCoins().then((res) => { |
| | | this.collectionList = res |
| | | |
| | | }) |
| | | this.collectionList = res; |
| | | }); |
| | | }, |
| | | onCollect(item) { // 收藏,取消收藏 |
| | | let _api = _collect |
| | | onCollect(item) { |
| | | // 收藏,取消收藏 |
| | | let _api = _collect; |
| | | if (item.isCollection) { |
| | | _api = _deleteCollect |
| | | _api = _deleteCollect; |
| | | } |
| | | _api(item.symbol).then(() => { |
| | | this.myCoinsList() |
| | | item.collected = !item.collected |
| | | this.myCoinsList(); |
| | | item.collected = !item.collected; |
| | | if (!item.isCollection) { |
| | | this.$toast.success(this.$t('收藏成功')) |
| | | this.$toast.success(this.$t("收藏成功")); |
| | | } else { |
| | | this.$toast.success(this.$t('取消收藏')) |
| | | this.$toast.success(this.$t("取消收藏")); |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | fetchQList() { // 获取行情 |
| | | _getHomeList(this.coinArr.join(',')).then((res) => { |
| | | this.isLoading = false |
| | | fetchQList() { |
| | | // 获取行情 |
| | | const mainArray = this.coinArr.filter( |
| | | (item) => !this.newcoinArr.includes(item) |
| | | ); |
| | | _getHomeList(mainArray.join(",")).then((res) => { |
| | | this.isLoading = false; |
| | | res.map((item) => { |
| | | this.$set(item, 'isCollection', false) |
| | | }) |
| | | this.allCurrencyList = res |
| | | this.currencyList = res |
| | | this.$set(item, "isCollection", false); |
| | | }); |
| | | this.allCurrencyList = res; |
| | | this.currencyList = res; |
| | | this.allCurrencyList.map((item) => { |
| | | this.collectionList.map((item2) => { |
| | | if (item.symbol == item2.symbol) { |
| | | item.isCollection = true |
| | | item.isCollection = true; |
| | | } |
| | | }) |
| | | }) |
| | | }); |
| | | }); |
| | | this.currencyList.map((item) => { |
| | | this.collectionList.map((item2) => { |
| | | if (item.symbol == item2.symbol) { |
| | | item.isCollection = true |
| | | item.isCollection = true; |
| | | } |
| | | }) |
| | | }) |
| | | }); |
| | | }); |
| | | if (this.active == 0) { |
| | | if (this.keywords) { |
| | | this.currencyList = this.currencyList.filter((item) => { |
| | | return item.name.toUpperCase().indexOf(this.keywords.toUpperCase()) != -1 |
| | | }) |
| | | return ( |
| | | item.name.toUpperCase().indexOf(this.keywords.toUpperCase()) != |
| | | -1 |
| | | ); |
| | | }); |
| | | } else { |
| | | this.currencyList = this.allCurrencyList |
| | | this.currencyList = this.allCurrencyList; |
| | | } |
| | | } |
| | | this.timeout = setTimeout(() => { |
| | | this.fetchQList() |
| | | }, 1000) |
| | | }) |
| | | this.fetchQList(); |
| | | }, 1000); |
| | | }); |
| | | |
| | | if (this.timeout) { |
| | | clearInterval(this.timeout) |
| | | clearInterval(this.timeout); |
| | | } |
| | | }, |
| | | changeValue() { |
| | | console.log(this.dataList) |
| | | this.keywords = '' |
| | | console.log(this.dataList); |
| | | this.keywords = ""; |
| | | }, |
| | | onItemClick(item) { |
| | | |
| | | setStorage('symbol', item.symbol) |
| | | setStorage("symbol", item.symbol); |
| | | this.$router.push({ |
| | | path: `/perpetualContract/${item.symbol}` |
| | | path: `/perpetualContract/${item.symbol}`, |
| | | }); |
| | | |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .cancel { |
| | | width: 150px; |
| | | text-align: center; |
| | | color: #868D9A; |
| | | color: #868d9a; |
| | | font-size: 28px; |
| | | } |
| | | |
| | |
| | | @include themify() { |
| | | background: themed("tab_background"); |
| | | } |
| | | |
| | | } |
| | | |
| | | .search-input { |
| | |
| | | font-weight: bold; |
| | | |
| | | span { |
| | | color: #868D9A; |
| | | color: #868d9a; |
| | | font-weight: initial; |
| | | font-size: 28px; |
| | | } |
| | |
| | | } |
| | | |
| | | .green { |
| | | color: #5EBA89; |
| | | color: #5eba89; |
| | | } |
| | | |
| | | .red { |
| | | color: #F6465D; |
| | | color: #f6465d; |
| | | } |
| | | |
| | | } |
| | | |
| | | .function-item { |
| | |
| | | } |
| | | |
| | | .item-right { |
| | | color: #B8BDC5; |
| | | color: #b8bdc5; |
| | | font-size: 30px; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | .star-icon-check { |
| | | color: #FCD436; |
| | | color: #fcd436; |
| | | } |
| | | |
| | | .symbol-name { |
| | |
| | | axios.defaults.headers.post["Content-Type"] = |
| | | "application/x-www-form-urlencoded"; |
| | | |
| | | // let baseUrl = "https://stock.niveshnav.com/wap/"; |
| | | let baseUrl = "http://192.168.0.105:18080/wap/"; |
| | | let baseUrl = "https://stock.niveshnav.com/wap/"; |
| | | // let baseUrl = "http://192.168.0.105:18080/wap/"; |
| | | |
| | | // 创建 |
| | | const request = axios.create({ |
| | |
| | | SET_KEFU, |
| | | SET_THEME, |
| | | } from "@/store/const.store"; |
| | | import { _getCoins, _getExchangeRate } from "@/API/home.api"; |
| | | import { _getCoins, _getExchangeRate, itemlist } from "@/API/home.api"; |
| | | import { customer } from "@/API/user.api"; |
| | | |
| | | export default { |
| | |
| | | currency: {}, // 当前汇率 |
| | | coinArr: [], // 解构出来的币种数组 |
| | | hotArr: [], // 热门币种 |
| | | newcoinArr: [], // 热门币种 |
| | | coinList: [], // 品种 |
| | | kefu_url: "", |
| | | theme: "light", |
| | |
| | | coinList: (state) => state.coinList, |
| | | coinArr: (state) => state.coinArr, |
| | | hotArr: (state) => state.hotArr, |
| | | newcoinArr: (state) => state.newcoinArr, |
| | | currency: (state) => state.currency, |
| | | kefu_url: (state) => state.kefu_url, |
| | | theme: (state) => state.theme, |
| | |
| | | [SET_CURRENCY](state, currency) { |
| | | state.currency = currency; |
| | | }, |
| | | SET_NEW_CION_LIST(state, currency) { |
| | | const arr = []; |
| | | currency.map((item) => { |
| | | arr.push(item.tokenCode); |
| | | }); |
| | | |
| | | state.newcoinArr = arr; |
| | | }, |
| | | |
| | | [SET_COIN_SYMBOL_ARR](state, list) { |
| | | const arr = []; |
| | | const hots = []; |
| | |
| | | commit(SET_COIN_LIST, list); // 拆分的单个数据 |
| | | Promise.resolve(list); |
| | | }, |
| | | async NEW_CION_LIST({ commit, state }) { |
| | | // 获取配置的币种 |
| | | |
| | | const list = await itemlist().catch((err) => { |
| | | Promise.reject(err); |
| | | }); |
| | | |
| | | commit("SET_NEW_CION_LIST", list); // 拆分的单个数据 |
| | | Promise.resolve(list); |
| | | }, |
| | | async [SET_CURRENCY]({ commit, state, rootState }) { |
| | | // 设置汇率 |
| | | console.log("rootState", rootState); |