|
|
|
@ -10,7 +10,7 @@ |
|
|
|
<div class="container-fluid no-fluid" style="background-color: #f5f5f5;padding: 15px 15px;"> |
|
|
|
<div class="row sm-gutters"> |
|
|
|
|
|
|
|
<div class="col-md-9" style="padding-right:0px!important;margin-right: 15px;"> |
|
|
|
<div class="col-md-8" style="padding-right:0px!important;margin-right: 15px;"> |
|
|
|
<div class="row"> |
|
|
|
<div class="col-md-12" style="padding-right: 0px!important;"> |
|
|
|
<div class="px-4 py-3 heading"> |
|
|
|
@ -274,7 +274,6 @@ export default { |
|
|
|
|
|
|
|
// 加载新页面 重新订阅所有数据 |
|
|
|
$route( /*newRouter, oldRouter*/ ) { |
|
|
|
|
|
|
|
this.addSub(); |
|
|
|
|
|
|
|
// 初始化market信息 |
|
|
|
@ -315,9 +314,6 @@ export default { |
|
|
|
}, { |
|
|
|
cmd: 'sub', |
|
|
|
msg: `tradeList_${this.symbol}` |
|
|
|
}, { |
|
|
|
cmd: 'sub', |
|
|
|
msg: `swapMarketList` |
|
|
|
}]); |
|
|
|
|
|
|
|
}, |
|
|
|
@ -337,9 +333,6 @@ export default { |
|
|
|
}, { |
|
|
|
cmd: 'unsub', |
|
|
|
msg: `tradeList_${symbol}` |
|
|
|
}, { |
|
|
|
cmd: 'sub', |
|
|
|
msg: `swapMarketList` |
|
|
|
}]); |
|
|
|
|
|
|
|
}, |
|
|
|
@ -497,7 +490,6 @@ export default { |
|
|
|
this.initMarket(); |
|
|
|
// 如果指定了id 订阅该行情的所有其他信息 |
|
|
|
if (this.symbol) this.addSub(); |
|
|
|
// this.getSwapMarketList(); |
|
|
|
}) |
|
|
|
|
|
|
|
this.ws.on("message", (response) => { |
|
|
|
@ -517,7 +509,7 @@ export default { |
|
|
|
switch (sub) { |
|
|
|
|
|
|
|
case "exchangeMarketList": |
|
|
|
console.log(data,'----000---') |
|
|
|
// console.log(data,'----000---') |
|
|
|
this.marketList = data; |
|
|
|
// console.log(this.marketList[0].marketInfoList[0].close, '0000------------') |
|
|
|
|
|
|
|
@ -527,22 +519,23 @@ export default { |
|
|
|
this.findMarketBySymbol(); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取最近价格 |
|
|
|
this.activeContract = data |
|
|
|
.map(item => item.marketInfoList) |
|
|
|
.flat() |
|
|
|
.find(item => { |
|
|
|
return item.pair_name.replace('/', '').toLowerCase() == this.symbol |
|
|
|
}); |
|
|
|
console.log(this.activeContract, this.activeContract.close, '122222--------', this.symbol+'symbol') |
|
|
|
// console.log(this.activeContract, this.activeContract.close, '122222--------', this.symbol+'symbol') |
|
|
|
break; |
|
|
|
|
|
|
|
case `buyList_${this.symbol}`: |
|
|
|
|
|
|
|
// console.log(data, '买入列表--------'); |
|
|
|
this.buyList = data; |
|
|
|
break; |
|
|
|
|
|
|
|
case `sellList_${this.symbol}`: |
|
|
|
|
|
|
|
// console.log(data, '卖出列表--------'); |
|
|
|
this.sellList = data; |
|
|
|
break; |
|
|
|
|
|
|
|
@ -556,19 +549,7 @@ export default { |
|
|
|
this.newTrade = _.nth(this.trade); |
|
|
|
if (this.newTrade && this.newTrade.buy_user_id === this.userInfo.user_id || this.newTrade.sell_user_id == this.userInfo.user_id) this.update(); |
|
|
|
break; |
|
|
|
case `swapMarketList`: |
|
|
|
// 这个读不到 |
|
|
|
if( data.symbol=='BTC' )(data.price).toFixed(1) |
|
|
|
let listA = data; |
|
|
|
let listB = listA |
|
|
|
.map(item => item.marketInfoList) |
|
|
|
.flat() |
|
|
|
.find(item => { |
|
|
|
return item.pair_name.replace('/', '').toLowerCase() == this.symbol |
|
|
|
}); |
|
|
|
this.activeContract = listB || {}; |
|
|
|
console.log(this.symbol, this.activeContract, 'ex-activeContract----------------') |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
@ -585,38 +566,7 @@ export default { |
|
|
|
|
|
|
|
}); |
|
|
|
}, |
|
|
|
getSwapMarketList(){ |
|
|
|
let msg = "swapMarketList"; |
|
|
|
this.ws.send({ |
|
|
|
cmd: "sub", |
|
|
|
msg: msg |
|
|
|
}); |
|
|
|
this.ws.on("message", res => { |
|
|
|
let { data, sub,cmd } = res; |
|
|
|
console.log(data, sub,cmd, '000000000000000') |
|
|
|
if (sub == msg) { |
|
|
|
if( data.symbol=='BTC' )(data.price).toFixed(1) |
|
|
|
let listA = data; |
|
|
|
let listB = listA |
|
|
|
.map(item => item.marketInfoList) |
|
|
|
.flat() |
|
|
|
.find(item => { |
|
|
|
return item.pair_name.replace('/', '').toLowerCase() == this.symbol |
|
|
|
}); |
|
|
|
this.activeContract = listB || {}; |
|
|
|
console.log(this.symbol, this.activeContract, 'ex-activeContract----------------') |
|
|
|
}else if (cmd == "ping") { |
|
|
|
this.ws.send({ |
|
|
|
cmd: "pong" |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.ws.on('close',()=>{ |
|
|
|
this.ws= new Socket(this.Globals.Server.Path.WS1), |
|
|
|
console.log('链接关闭'); |
|
|
|
this.wsOpen(); |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
created() { |
|
|
|
|