| | |
| | | <div :key="symbol" class="pb-108 no_touch"> |
| | | |
| | | <!-- 头部区 --> |
| | | |
| | | <ContractHeader :symbol="symbol" :newname="newname" :range="range" :selectIndex="selectIndex" |
| | | :balance="userInfo.balance" @tab="onTopTab" @update-coin="onUpdate"> |
| | | <ContractHeader |
| | | :symbol="symbol" |
| | | :newname="newname" |
| | | :range="range" |
| | | :selectIndex="selectIndex" |
| | | :balance="userInfo.balance" |
| | | @tab="onTopTab" |
| | | @update-coin="onUpdate" |
| | | > |
| | | </ContractHeader> |
| | | |
| | | |
| | | <div :class="{ slide2: animated1 }" v-if="selectIndex === 1"> |
| | | <div class="mainBackground" key="x"> |
| | | <PerpetualOpen class="pl-30 pr-30" :key="keyIndex + 'a'" :selectIndex="selectIndex" :symbol="symbol" |
| | | :green-data="bids" :red-data="asks" :price="price" :init-open="initOpen" :init-close="initClose" |
| | | :init-futrue="initFutrue" @ordered="onOrdered" :currentType="currentType" |
| | | @changeCurrentType="changeCurrentType" @changeValueBack="changeValueBack"> |
| | | <PerpetualOpen |
| | | class="pl-30 pr-30" |
| | | :key="keyIndex + 'a'" |
| | | :selectIndex="selectIndex" |
| | | :symbol="symbol" |
| | | :green-data="bids" |
| | | :red-data="asks" |
| | | :price="price" |
| | | :init-open="initOpen" |
| | | :init-close="initClose" |
| | | :init-futrue="initFutrue" |
| | | @ordered="onOrdered" |
| | | :currentType="currentType" |
| | | @changeCurrentType="changeCurrentType" |
| | | @changeValueBack="changeValueBack" |
| | | > |
| | | </PerpetualOpen> |
| | | <!-- <div class="line"></div> --> |
| | | <PerpetualOrder class="pl-30 pr-30" :key="keyIndex + 'b'" :symbol="symbol" :order-cur="orderCur" |
| | | :order-hold="orderHold" :topIndex="selectIndex" :futrue-hold="futrueHold" |
| | | :futrue-histroy="futrueHistroy" @tab="onTab" @recall="onRecall"> |
| | | <PerpetualOrder |
| | | class="pl-30 pr-30" |
| | | :key="keyIndex + 'b'" |
| | | :symbol="symbol" |
| | | :order-cur="orderCur" |
| | | :order-hold="orderHold" |
| | | :topIndex="selectIndex" |
| | | :futrue-hold="futrueHold" |
| | | :futrue-histroy="futrueHistroy" |
| | | @tab="onTab" |
| | | @recall="onRecall" |
| | | > |
| | | </PerpetualOrder> |
| | | </div> |
| | | </div> |
| | | <div :class="{ slide1: animated2 }" v-else> |
| | | <div class="mainBackground" key="y"> |
| | | <PerpetualOpen class="pl-30 pr-30" :key="keyIndex + 'c'" :selectIndex="selectIndex" :symbol="symbol" |
| | | :green-data="bids" :red-data="asks" :price="price" :init-open="initOpen" :init-close="initClose" |
| | | :init-futrue="initFutrue" @ordered="onOrdered" @changeValueBack="changeValueBack" |
| | | @iszyzs="oniszyzs"> |
| | | <PerpetualOpen |
| | | class="pl-30 pr-30" |
| | | :key="keyIndex + 'c'" |
| | | :selectIndex="selectIndex" |
| | | :symbol="symbol" |
| | | :green-data="bids" |
| | | :red-data="asks" |
| | | :price="price" |
| | | :init-open="initOpen" |
| | | :init-close="initClose" |
| | | :init-futrue="initFutrue" |
| | | @ordered="onOrdered" |
| | | @changeValueBack="changeValueBack" |
| | | @iszyzs="oniszyzs" |
| | | > |
| | | </PerpetualOpen> |
| | | <div class="line"></div> |
| | | <!-- 委托/持仓--> |
| | | <PerpetualOrder class="pl-30 pr-30" :key="keyIndex + 'd'" :symbol="symbol" :order-cur="orderCur" |
| | | :order-hold="orderHold" :price="price" :topIndex="selectIndex" :futrue-hold="futrueHold" |
| | | :futrue-histroy="futrueHistroy" @tab="onTab" @recall="onRecall" @iszyzs="oniszyzs"> |
| | | <PerpetualOrder |
| | | class="pl-30 pr-30" |
| | | :key="keyIndex + 'd'" |
| | | :symbol="symbol" |
| | | :order-cur="orderCur" |
| | | :order-hold="orderHold" |
| | | :price="price" |
| | | :topIndex="selectIndex" |
| | | :futrue-hold="futrueHold" |
| | | :futrue-histroy="futrueHistroy" |
| | | @tab="onTab" |
| | | @recall="onRecall" |
| | | @iszyzs="oniszyzs" |
| | | > |
| | | </PerpetualOrder> |
| | | </div> |
| | | </div> |
| | |
| | | <span class="font-24 textColor2"> |
| | | {{ newname}} {{ $t("k线图表") }} |
| | | </span> |
| | | <van-icon class="textColor" @click.stop="showCharts = !showCharts" |
| | | :name="showCharts ? 'arrow-down' : 'arrow-up'"></van-icon> |
| | | <van-icon |
| | | class="textColor" |
| | | @click.stop="showCharts = !showCharts" |
| | | :name="showCharts ? 'arrow-down' : 'arrow-up'" |
| | | ></van-icon> |
| | | </div> |
| | | <k-line-charts :update-key="updateKey" :update-data="quote" :symbol="symbol" v-if="symbol && showCharts" |
| | | :showBottom="false" /> |
| | | <k-line-charts |
| | | :update-key="updateKey" |
| | | :update-data="quote" |
| | | :symbol="symbol" |
| | | v-if="symbol && showCharts" |
| | | :showBottom="false" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | _futrueOrderInit, |
| | | _futrueOrderList, |
| | | } from "@/API/trade.api"; |
| | | import { |
| | | _getHomeList |
| | | } from "@/API/home.api"; |
| | | import { |
| | | Popup, |
| | | Swipe, |
| | | SwipeItem |
| | | } from "vant"; |
| | | import { |
| | | mapActions, |
| | | mapGetters |
| | | } from "vuex"; |
| | | import { |
| | | SET_COIN_LIST |
| | | } from "@/store/const.store"; |
| | | import { |
| | | WS_URL |
| | | } from "@/config"; |
| | | import { |
| | | getStorage |
| | | } from "@/utils/utis"; |
| | | import { _getHomeList } from "@/API/home.api"; |
| | | import { Popup, Swipe, SwipeItem } from "vant"; |
| | | import { mapActions, mapGetters } from "vuex"; |
| | | import { SET_COIN_LIST } from "@/store/const.store"; |
| | | import { WS_URL } from "@/config"; |
| | | import { getStorage } from "@/utils/utis"; |
| | | import KLineCharts from "@/components/kline-charts"; |
| | | var showLength = 7; |
| | | export default { |
| | |
| | | } |
| | | _getBalance().then((data) => { |
| | | // 获取用户余额 |
| | | this.$store.commit("user/SET_USERINFO", { |
| | | balance: data.money |
| | | }); |
| | | this.$store.commit("user/SET_USERINFO", { balance: data.money }); |
| | | // const { money } = data |
| | | // this.balance = money |
| | | }); |
| | |
| | | this.init(symbol); |
| | | }, |
| | | oniszyzs() { |
| | | debugger |
| | | this.iszyzs = true |
| | | }, |
| | | onRecall() { |
| | |
| | | _getHomeList(symbol).then((data) => { |
| | | // 获取行情 |
| | | this.handleQoutes(data); |
| | | this.startQuoteSocket(); // k线socket |
| | | this.startDeepSocket(); // socket |
| | | this.startQuoteSocket(); // socket |
| | | }); |
| | | }, |
| | | handleQoutes(data) { |
| | |
| | | return; |
| | | } |
| | | this.deepData = data; |
| | | const { |
| | | asks, |
| | | bids |
| | | } = data; |
| | | const { asks, bids } = data; |
| | | this.asks = asks.sort((a, b) => a.price - b.price).slice(0, showLength); |
| | | this.bids = bids.sort((a, b) => a.price - b.price).slice(-showLength); |
| | | }, |
| | |
| | | // socket.send('hello') |
| | | // } |
| | | this.sockets.quotes.onmessage = (evt) => { |
| | | const { |
| | | data |
| | | } = evt; |
| | | const { |
| | | code, |
| | | data: _data |
| | | } = JSON.parse(data); |
| | | const { data } = evt; |
| | | const { code, data: _data } = JSON.parse(data); |
| | | if (code / 1 === 0) { |
| | | this.handleQoutes(_data); |
| | | } |
| | |
| | | }; |
| | | |
| | | this.socket.onmessage = (evt) => { |
| | | const { |
| | | data |
| | | } = evt; |
| | | const { |
| | | code, |
| | | data: _data |
| | | } = JSON.parse(data); |
| | | const { data } = evt; |
| | | const { code, data: _data } = JSON.parse(data); |
| | | if (code / 1 === 0) { |
| | | this.handleDeep(_data); |
| | | } |
| | |
| | | this.clearTimer(); |
| | | }, |
| | | activated() { |
| | | this.currentType = this.$route.query.currentType ? |
| | | this.$route.query.currentType : |
| | | "long"; |
| | | this.currentType = this.$route.query.currentType |
| | | ? this.$route.query.currentType |
| | | : "long"; |
| | | }, |
| | | beforeDestroy() { |
| | | this.closeSocket(); |
| | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | |
| | | //.list-enter-active, .list-leave-active { |
| | | // transition: all .5s; |
| | | // transform: translateY(30px) |
| | |
| | | width: 100%; |
| | | } |
| | | |
| | | .my-swipe .van-swipe-item {} |
| | | .my-swipe .van-swipe-item { |
| | | } |
| | | |
| | | .line { |
| | | height: 13px; |