Browse Source

修改合约价格和k线图一致

master
liaoxinyu 2 years ago
parent
commit
a7dc31c079
  1. 4
      src/views/contract/handicap.vue
  2. 6
      src/views/contract/index.vue
  3. 12
      src/views/option/kline.vue

4
src/views/contract/handicap.vue

@ -196,7 +196,9 @@ export default {
this.linkSocket(); this.linkSocket();
} }
bus.$on('collapse', msg => { bus.$on('collapse', msg => {
this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3); // this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3);
const closeStr = msg.close.toString();
this.newPriceObj.price = this.symbol === 'BTC' ? closeStr.slice(0, closeStr.indexOf('.') + 2) : closeStr.slice(0, closeStr.indexOf('.') + 4);
this.$emit("input", this.newPriceObj); this.$emit("input", this.newPriceObj);
}); });
}, },

6
src/views/contract/index.vue

@ -82,6 +82,7 @@
}" }"
> >
<span class="current">{{ price1(activeContract.price) }}$</span> <span class="current">{{ price1(activeContract.price) }}$</span>
<!-- <span class="current">{{ activeContract.price }}$</span> -->
&nbsp; &nbsp;
<span class="zf">{{ activeContract.increaseStr }}</span> <span class="zf">{{ activeContract.increaseStr }}</span>
</div> </div>
@ -271,7 +272,10 @@ export default {
}); });
// console.info(this.$refs) // console.info(this.$refs)
bus.$on('collapse', msg => { bus.$on('collapse', msg => {
this.activeContract.price =this.activeContract.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3); //
const closeStr = msg.close.toString();
// this.activeContract.price =this.activeContract.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3);
this.activeContract.price = this.activeContract.symbol === 'BTC' ? closeStr.slice(0, closeStr.indexOf('.') + 2) : closeStr.slice(0, closeStr.indexOf('.') + 4);
this.holdPositionList.map(item=>{ this.holdPositionList.map(item=>{
if(item.symbol==this.activeContract.symbol) item.realtimePrice=this.activeContract.price if(item.symbol==this.activeContract.symbol) item.realtimePrice=this.activeContract.price
}) })

12
src/views/option/kline.vue

@ -65,6 +65,12 @@ export default {
this.unsub(this.ajaxTv.getSymbol(o), this.timer); this.unsub(this.ajaxTv.getSymbol(o), this.timer);
} }
}, },
periodCurrent(n,o){
if(n != o && o){
console.log('切换周期,页数为第一页')
this.page[this.symbol] = 1;//
}
}
}, },
computed: { computed: {
lang() { lang() {
@ -122,7 +128,8 @@ data() {
sub: "", sub: "",
isCreateSocket: false, isCreateSocket: false,
page: {}, page: {},
tt:undefined tt:undefined,
periodCurrent: ''
}; };
}, },
methods: { methods: {
@ -239,11 +246,12 @@ methods: {
onErrorCallback onErrorCallback
) { ) {
// handleClick // handleClick
this.periodCurrent = this.resolution(resolution);
this.page[this.symbol] = this.page[this.symbol] || 1; this.page[this.symbol] = this.page[this.symbol] || 1;
let page = this.page[this.symbol] > 3 ? 3 : this.page[this.symbol]; let page = this.page[this.symbol] > 3 ? 3 : this.page[this.symbol];
let data = { let data = {
symbol: this.ajaxTv.getSymbol(symbolInfo.name), symbol: this.ajaxTv.getSymbol(symbolInfo.name),
period: this.resolution(resolution), period: this.periodCurrent,
form: rangeStartDate, form: rangeStartDate,
to: rangeEndDate, to: rangeEndDate,
size: page * 200, size: page * 200,

Loading…
Cancel
Save