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 Contract from "../../api/contract";
import Socket from "@/api/server/Socket.js"; import Socket from "@/api/server/Socket.js";
import Home from "@/api/home"; import Home from "@/api/home";
import bus from "@/components/bus.js";
export default { export default {
components: { components: {
kline, kline,
@ -216,33 +217,35 @@ export default {
}, },
data() { data() {
return { return {
contractList: [], contractList: [],
activeSymbol: "", activeSymbol: "",
holdPositionAll: false, holdPositionAll: false,
holdPositionList: [], holdPositionList: [],
newPriceObj: {}, newPriceObj: {},
pcBannerList:[], pcBannerList:[],
accountInfo: {}, accountInfo: {},
defaultPrice: "", defaultPrice: "",
wsUrl: this.Globals.Server.Path.WS1, wsUrl: this.Globals.Server.Path.WS1,
ws: new Socket(this.Globals.Server.Path.WS1), ws: new Socket(this.Globals.Server.Path.WS1),
_time: null, _time: null,
contractOpen: false, contractOpen: false,
contractAgreement: {}, contractAgreement: {},
symbolDetail:{}, symbolDetail:{},
}; };
}, },
computed: { computed: {
activeContract() { activeContract(val) {
return ( let contractList=this.contractList
this.contractList .map(item => item.marketInfoList)
.map(item => item.marketInfoList) .flat()
.flat() .find(item => item.symbol == this.activeSymbol) || {}
.find(item => item.symbol == this.activeSymbol) || {} if(val.price){
); delete contractList.price
}
return contractList;
}, },
isLogin() { isLogin() {
return Boolean(localStorage.token); return Boolean(localStorage.token);
} }
}, },
watch: { watch: {
@ -266,7 +269,10 @@ export default {
this.ws.on("open", () => { this.ws.on("open", () => {
this.swapMarketList(); this.swapMarketList();
}); });
console.info(this.$refs) // console.info(this.$refs)
bus.$on('collapse', msg => {
this.activeContract.price = (msg.close).toFixed(3);
});
}, },
// //
mounted: function () { mounted: function () {
@ -290,7 +296,7 @@ export default {
if (sub == msg) { if (sub == msg) {
// console.info(data) // console.info(data)
this.contractList = data; this.contractList = data;
}else if (cmd == "ping") { }else if (cmd == "ping") {
this.ws.send({ this.ws.send({
cmd: "pong" cmd: "pong"

Loading…
Cancel
Save