|
|
|
@ -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" |
|
|
|
|