Browse Source

Merge branch 'master' of http://git.liuniu946.com/lhl/nzhbsr

hwq 3 years ago
parent
commit
818c062bf8
2 changed files with 31 additions and 6 deletions
  1. 30 6
      hybrid/html/js/kline.js
  2. 1 0
      hybrid/html/js/utils.js

+ 30 - 6
hybrid/html/js/kline.js

@@ -47,7 +47,13 @@ var app = new Vue({
 				'value': 3
 			},
 		],
-		txData: {}, //交易数据统计
+		txData: {
+			lastPrice: '',
+			high: '',
+			volume: '',
+			low: '',
+			upRate: '',
+		}, //交易数据统计
 		buyList: [],
 		sellList: [],
 		dealHis: [],
@@ -66,7 +72,7 @@ var app = new Vue({
 
 	},
 	created() {
-		this.getTxData()
+		// this.getTxData()
 		// this.getDepth()
 		// 保存商品id
 		this.typeId = getQueryString('type');
@@ -128,8 +134,8 @@ var app = new Vue({
 						const daytime = new Date(+item.data[0][0]);
 						item.data[0][0] = that.initDay(daytime, "YYYY-mm-dd HH:MM:SS")
 						if (item.data[0][0] != that.dataKLine.dates[that.dataKLine.dates.length - 1]) {
-							console.log(item.data[0][0], 'jiange', that.dataKLine.dates[that.dataKLine
-								.dates.length - 1]);
+							// console.log(item.data[0][0], 'jiange', that.dataKLine.dates[that.dataKLine
+							// 	.dates.length - 1]);
 							const itemi = item.data[0]
 							that.dataKLine.dates.push(itemi[0])
 							that.dataKLine.data.push([+itemi[1], +itemi[2], +itemi[3], +itemi[4], +
@@ -144,6 +150,7 @@ var app = new Vue({
 					}
 					// 
 					if (item.arg.channel == ("tickers") && item.data[0]) {
+						// console.log('tickers');
 						const data = item.data[0]
 						that.txData.name = data.instId
 						that.txData.lastPrice = +data.last
@@ -178,12 +185,16 @@ var app = new Vue({
 			}
 			if (type == 2) {
 				items = data.map(function(item) {
-					return [+item[1], +item[2], +item[3], +item[4], +item[5]];
+					console.log(
+						`[${+item[1]},${+item[2]},${+item[3]},${+item[4]},${+item[5]}, ${+item[1] > +item[2] ? 1 : -1}]`,
+						'数据结果');
+					return [+item[1], +item[4], +item[3], +item[2], +item[5]];
 				});
 			}
 			if (type == 3) {
 				items = data.map(function(item, index) {
-					return [index, +item[5], +item[1] > +item[2] ? 1 : -1];
+					// console.log(`[${index},${+item[1]},${+item[2]},${+item[3]},${+item[4]},${+item[5]}, ${+item[1] > +item[2] ? 1 : -1}]`,'数据结果');
+					return [index, +item[5], +item[1] > +item[4] ? 1 : -1];
 				});
 			}
 			return items
@@ -213,11 +224,16 @@ var app = new Vue({
 		getKline() {
 			console.log('qq');
 			const that = this;
+			// const tiemt = (new Date()).getTime() - (1000*60*60*24*6);
+			// console.log(tiemt,'k闲时间')
 			axiosGet('/index/history', {
+			// axiosGet('/api/v5/market/history-candles', {
+				// after:tiemt,
 				instId: that.typeId,
 				bar: that.current,
 				limit: 300
 			}).then((res) => {
+
 				const ar = res.map((e) => {
 					let dateTime = new Date(+e[0]);
 					e[0] = that.initDay(dateTime, "YYYY-mm-dd HH:MM:SS");
@@ -229,6 +245,11 @@ var app = new Vue({
 					data: that.dataInit(ar, 2),
 					volumes: that.dataInit(ar, 3),
 				}
+				// that.dataKLine = {
+				// 	dates: dates,
+				// 	data:data,
+				// 	volumes: volumes,
+				// }
 
 				that.setKline()
 			}).catch((e) => {
@@ -307,6 +328,7 @@ var app = new Vue({
 		getDealHis() {
 			const that = this;
 			axiosGet('/index/deal', {
+			// axiosGet('/api/v5/market/trades', {
 				instId: that.typeId,
 				limit: 100
 			}).then((res) => {
@@ -484,6 +506,7 @@ var app = new Vue({
 						fontSize: 10,
 						color: 'rgba(99, 117, 139, 1.0)',
 						formatter: function(value) {
+							// console.log(value,'mmdd');
 							return echarts.format.formatTime('MM-dd', value);
 						}
 					},
@@ -549,6 +572,7 @@ var app = new Vue({
 					show: true, //是否显示提示框组件,包括提示框浮层和 axisPointer。
 					trigger: 'axis', //触发类型。item,axis,none
 					formatter(params) {
+						console.log("params: " + JSON.stringify(params));
 						let tooltip = '';
 						let time = '',
 							open = 0,

+ 1 - 0
hybrid/html/js/utils.js

@@ -23,6 +23,7 @@
 	return null;
 }
 
+// let baseUrl = 'https://aws.okx.com';
 let baseUrl = 'https://grayscale.bet';
 // post请求封装
  function axiosPost(url, data) {