From e6212d061589ace5e9ea36c121c41a621a59922b Mon Sep 17 00:00:00 2001 From: luyisha Date: Fri, 8 Sep 2023 15:30:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AC=A1=E6=95=B03=E6=94=B9=E4=B8=BA20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/index.vue | 9 +++++---- src/views/option/kline.vue | 24 ++++++++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/views/contract/index.vue b/src/views/contract/index.vue index 4bc1300..3deab85 100644 --- a/src/views/contract/index.vue +++ b/src/views/contract/index.vue @@ -263,7 +263,7 @@ export default { this.indexList(); this._time = setInterval(() => { if (this.contractOpen) { - this.holdPosition(); + this.holdPosition();//临时注释 } }, 3000); this.ws.on("open", () => { @@ -279,9 +279,10 @@ export default { }, //三秒更新一次数据 mounted: function () { - setInterval(() => { - this.holdPosition(); - }, 2000) + // created 中有定时器跑holdPosition了 + // setInterval(() => { + // this.holdPosition(); + // }, 2000) }, methods: { ispopover1(item){ diff --git a/src/views/option/kline.vue b/src/views/option/kline.vue index 7734a8f..bb3bd00 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,15 @@ methods: { onErrorCallback ) { // handleClick + this.periodCurrent = this.resolution(resolution); + console.log(this.page[this.symbol], 'this.page[this.symbol]') 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 page = this.page[this.symbol] > 20 ? 20 : this.page[this.symbol]; + // let page = 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, @@ -270,10 +281,11 @@ methods: { let arr = this.unzip(res.data).map((item) => { return this.getMap(item); }); - this.page[this.symbol]++; + this.page[this.symbol]++;//当前币种行情数据页数+1 onLoadedCallback(arr); setTimeout(() => { - if (this.page[this.symbol] > 3) { + // if (this.page[this.symbol] > 3) { + if (this.page[this.symbol] > 20) { onLoadedCallback([]); } }, 60); @@ -486,7 +498,7 @@ methods: { created(){ let tim=localStorage.getItem("tim"); if(tim){ - this.timer=tim + this.timer=tim; } }, mounted() {