Browse Source

优化

master
ltlzx 4 years ago
parent
commit
0ea910a40a
  1. 54
      src/views/contract/index.vue

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

Loading…
Cancel
Save