From 7613b12b90af20814194a0e6f6858a2fd1246eb5 Mon Sep 17 00:00:00 2001 From: vee <897831508@qq.com> Date: Tue, 13 Sep 2022 18:34:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entrustOrderList/entrustOrderList.vue | 4 - pages/markets/kLine.vue | 331 +----------------- utils/websocket.js | 6 - 3 files changed, 3 insertions(+), 338 deletions(-) diff --git a/components/entrustOrderList/entrustOrderList.vue b/components/entrustOrderList/entrustOrderList.vue index ad8ef6e..b7f4506 100644 --- a/components/entrustOrderList/entrustOrderList.vue +++ b/components/entrustOrderList/entrustOrderList.vue @@ -236,12 +236,8 @@ status: 'opened', closeModalShow: false, stopModalShow: false, -<<<<<<< HEAD type: 1, -======= stopModalShowZui:false, - type: 0, ->>>>>>> 1e578ec94e2ad85c6c797e5669f396b7f88e1b91 test: 0, dealList: [{ dealType: 'long' diff --git a/pages/markets/kLine.vue b/pages/markets/kLine.vue index fbe5362..b59f4f2 100644 --- a/pages/markets/kLine.vue +++ b/pages/markets/kLine.vue @@ -70,15 +70,15 @@ - + - {{ i18n.LONG }} + {{ i18n.open }} - {{ i18n.SHORT }} + {{ i18n.close }} @@ -292,22 +292,11 @@ } else if (data.channel === 'market.' + that.symbol.symbol + '.detail') { that.marketDetail = data.data; } else if (data.channel === 'market.' + that.symbol.symbol + ".kline." + that.type) { - // console.log('k线回来') if (data.event === 'req') { -<<<<<<< HEAD //that.kdata = that.splitData(data.data) } else { //that.upkline(data.data) -======= - // console.log('k线回来req') - // console.log(11111,data) - that.kdata = that.splitData(data.data) - } else { - - that.upkline(data.data) ->>>>>>> 1e578ec94e2ad85c6c797e5669f396b7f88e1b91 } - } }); @@ -343,320 +332,6 @@ } -<<<<<<< HEAD -======= - if (this.channel != newValue.webSocketChannel) { - this.is = false - } - this.channel = newValue.webSocketChannel - - const script = document.createElement('script'); - // view 层的页面运行在 www 根目录,其相对路径相对于 www 计算 - script.src = './static/echarts.js'; - script.onload = this.upData.bind(this); - document.head.appendChild(script); - }, - - calculateMA(dayCount, data) { - var result = []; - if(data.values){ - for (var i = 0, len = data.values.length; i < len; i++) { - if (i < dayCount) { - result.push('-'); - continue; - } - var sum = 0; - for (var j = 0; j < dayCount; j++) { - sum += data.values[i - j][1]; - } - result.push(+(sum / dayCount).toFixed(3)); - } - - } - return result; - }, - upData(myChart) { - const upColor = '#00C873'; - const downColor = '#FF3750'; - var chartDom = document.getElementById('kline'); - if (!this.is) { - // console.log("this.is11111111", this.is) - this.myChart = echarts.init(chartDom); - - if(this.kdata.categoryData){ - if (this.kdata.categoryData.length < 100) { - this.start = 50 - this.end = 100 - } else if (this.kdata.categoryData.length < 200) { - this.start = 85 - this.end = 100 - } else { - this.start = 98 - this.end = 100 - } - } - - - } else { - // console.log(this.myChart.getModel().option.dataZoom[0].start) - this.start = this.myChart.getModel().option.dataZoom[0].start - this.end = this.myChart.getModel().option.dataZoom[0].end - } - - - this.is = true; - var option; - this.myChart.setOption( - (option = { - - tooltip: { - trigger: 'axis', - axisPointer: { - animation: false, - type: 'cross', - lineStyle: { - width: 1, - opacity: 3 - } - } - }, - xAxis: [{ - type: 'category', - data: this.kdata.categoryData, - boundaryGap: false, - axisLine: { - show: false, - onZero: false - }, - - axisTick: { - show: false - }, - splitLine: { - show: false - }, - min: 'dataMin', - max: 'dataMax', - axisPointer: { - z: 100 - } - }, - { - type: 'category', - gridIndex: 1, - data: this.kdata.categoryData, - boundaryGap: false, - axisLine: { - onZero: false - }, - axisTick: { - show: false - }, - splitLine: { - show: false - }, - axisLabel: { - show: false - }, - min: 'dataMin', - max: 'dataMax' - } - ], - yAxis: [{ - position: 'right', - scale: true, - - axisLine: { - - show: false - }, - axisTick: { - show: true - }, - splitArea: { - show: false, // areaStyle: { - // color: 'transparency', - // }, - }, - splitLine: { - show: true, - lineStyle: { - // 使用深浅的间隔色 - color: ['#211F32'] - } - } - }, - { - scale: true, - gridIndex: 1, - splitNumber: 2, - axisLabel: { - show: false - }, - axisLine: { - show: false - }, - axisTick: { - show: false - }, - splitLine: { - show: false - } - } - ], - - - visualMap: { - show: false, - seriesIndex: 5, - dimension: 2, - pieces: [{ - value: 1, - color: downColor - }, - { - value: -1, - color: upColor - } - ] - }, - grid: [{ - top: '8%', - left: '10rpx', - right: '50rpx', - height: '60%', - - backgroundColor: 'transparent', - }, - { - left: '10rpx', - right: '50rpx', - top: '80%', - height: '16%' - } - ], - - dataZoom: [{ - type: 'inside', - start: this.start, - end: this.end - }, - { - show: false, - xAxisIndex: [0, 1], - type: 'slider', - top: '85%', - start: this.start, - end: this.end - } - ], - series: [{ - - type: 'candlestick', - data: this.kdata.values, - itemStyle: { - color: upColor, - color0: downColor, - borderColor: undefined, - borderColor0: undefined - }, - markLine: { - symbol: ['none', 'none'], - data: [ - - - { - name: 'max line on close', - type: 'max', - valueDim: 'highest' - } - ] - }, - - tooltip: { - formatter: function(param) { - param = param[0]; - return [ - 'Date: ' + param.name + - '
', - 'Open: ' + param.data[0] + '
', - 'Close: ' + param.data[1] + '
', - 'Lowest: ' + param.data[2] + '
', - 'Highest: ' + param.data[3] + '
' - ].join(''); - } - } - }, - { - name: 'MA5', - type: 'line', - showSymbol: false, - data: this.calculateMA(5, this.kdata), - smooth: true, - lineStyle: { - opacity: 0.5 - } - }, - { - name: 'MA10', - type: 'line', - showSymbol: false, - data: this.calculateMA(10, this.kdata), - smooth: true, - lineStyle: { - opacity: 0.5 - } - }, - { - name: 'MA20', - type: 'line', - showSymbol: false, - data: this.calculateMA(20, this.kdata), - smooth: true, - lineStyle: { - opacity: 0.5 - } - }, - { - name: 'MA30', - type: 'line', - showSymbol: false, - data: this.calculateMA(30, this.kdata), - smooth: true, - lineStyle: { - opacity: 0.5 - } - }, - - { - name: 'Volume', - type: 'bar', - xAxisIndex: 1, - yAxisIndex: 1, - data: this.kdata.volumes, - itemStyle: { - color: upColor, - borderColor: undefined, - }, - } - - ] - }), - true - ); - - } - }, - watch: { - // 如果 `question` 发生改变,这个函数就会运行 - columData: function(newQuestion, oldQuestion) { - - // this.updateEcharts(this.option) - } - }, - } - ->>>>>>> 1e578ec94e2ad85c6c797e5669f396b7f88e1b91