From 0ea910a40ac81b758367be84e35a2661398f708b Mon Sep 17 00:00:00 2001 From: ltlzx <942659938@qq.com> Date: Sat, 9 Apr 2022 14:36:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/index.vue | 54 ++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/src/views/contract/index.vue b/src/views/contract/index.vue index 1f54f63..f0285c3 100644 --- a/src/views/contract/index.vue +++ b/src/views/contract/index.vue @@ -206,6 +206,7 @@ import pageBottom from "./page-bottom.vue"; import Contract from "../../api/contract"; import Socket from "@/api/server/Socket.js"; import Home from "@/api/home"; +import bus from "@/components/bus.js"; export default { components: { kline, @@ -216,33 +217,35 @@ export default { }, data() { return { - contractList: [], - activeSymbol: "", - holdPositionAll: false, - holdPositionList: [], - newPriceObj: {}, - pcBannerList:[], - accountInfo: {}, - defaultPrice: "", - wsUrl: this.Globals.Server.Path.WS1, - ws: new Socket(this.Globals.Server.Path.WS1), - _time: null, - contractOpen: false, - contractAgreement: {}, - symbolDetail:{}, + contractList: [], + activeSymbol: "", + holdPositionAll: false, + holdPositionList: [], + newPriceObj: {}, + pcBannerList:[], + accountInfo: {}, + defaultPrice: "", + wsUrl: this.Globals.Server.Path.WS1, + ws: new Socket(this.Globals.Server.Path.WS1), + _time: null, + contractOpen: false, + contractAgreement: {}, + symbolDetail:{}, }; }, computed: { - activeContract() { - return ( - this.contractList - .map(item => item.marketInfoList) - .flat() - .find(item => item.symbol == this.activeSymbol) || {} - ); + activeContract(val) { + let contractList=this.contractList + .map(item => item.marketInfoList) + .flat() + .find(item => item.symbol == this.activeSymbol) || {} + if(val.price){ + delete contractList.price + } + return contractList; }, isLogin() { - return Boolean(localStorage.token); + return Boolean(localStorage.token); } }, watch: { @@ -266,7 +269,10 @@ export default { this.ws.on("open", () => { this.swapMarketList(); }); - console.info(this.$refs) + // console.info(this.$refs) + bus.$on('collapse', msg => { + this.activeContract.price = (msg.close).toFixed(3); + }); }, //三秒更新一次数据 mounted: function () { @@ -290,7 +296,7 @@ export default { if (sub == msg) { // console.info(data) - this.contractList = data; + this.contractList = data; }else if (cmd == "ping") { this.ws.send({ cmd: "pong"