From a7dc31c0795da20385234546c1c58b53f794a4db Mon Sep 17 00:00:00 2001 From: liaoxinyu Date: Thu, 11 Jan 2024 19:43:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=88=E7=BA=A6=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E5=92=8Ck=E7=BA=BF=E5=9B=BE=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/handicap.vue | 4 +++- src/views/contract/index.vue | 6 +++++- src/views/option/kline.vue | 12 ++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/views/contract/handicap.vue b/src/views/contract/handicap.vue index 9922f8a..66d1eb7 100644 --- a/src/views/contract/handicap.vue +++ b/src/views/contract/handicap.vue @@ -196,7 +196,9 @@ export default { this.linkSocket(); } 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); }); }, diff --git a/src/views/contract/index.vue b/src/views/contract/index.vue index 6d14d8c..6cf1aaf 100644 --- a/src/views/contract/index.vue +++ b/src/views/contract/index.vue @@ -82,6 +82,7 @@ }" > {{ price1(activeContract.price) }}$ +   {{ activeContract.increaseStr }} @@ -271,7 +272,10 @@ export default { }); // console.info(this.$refs) 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=>{ if(item.symbol==this.activeContract.symbol) item.realtimePrice=this.activeContract.price }) diff --git a/src/views/option/kline.vue b/src/views/option/kline.vue index e966ea7..6ce53af 100644 --- a/src/views/option/kline.vue +++ b/src/views/option/kline.vue @@ -65,6 +65,12 @@ export default { this.unsub(this.ajaxTv.getSymbol(o), this.timer); } }, + periodCurrent(n,o){ + if(n != o && o){ + console.log('切换周期,页数为第一页') + this.page[this.symbol] = 1;//切换周期,页数为第一页 + } + } }, computed: { lang() { @@ -122,7 +128,8 @@ data() { sub: "", isCreateSocket: false, page: {}, - tt:undefined + tt:undefined, + periodCurrent: '' }; }, methods: { @@ -239,11 +246,12 @@ methods: { onErrorCallback ) { // handleClick + this.periodCurrent = this.resolution(resolution); this.page[this.symbol] = this.page[this.symbol] || 1; let page = this.page[this.symbol] > 3 ? 3 : this.page[this.symbol]; let data = { symbol: this.ajaxTv.getSymbol(symbolInfo.name), - period: this.resolution(resolution), + period: this.periodCurrent, form: rangeStartDate, to: rangeEndDate, size: page * 200,