lhl 3 years ago
parent
commit
7801a776c5

+ 40 - 31
hybrid/html/js/kline.js

@@ -68,7 +68,9 @@ var app = new Vue({
 			data: [],
 			data: [],
 			dates: [],
 			dates: [],
 			volumes: [],
 			volumes: [],
-		}
+		},
+		// 保存初始未处理的时间数据
+		oldDataKLine: ''
 
 
 	},
 	},
 	created() {
 	created() {
@@ -82,7 +84,7 @@ var app = new Vue({
 	mounted() {
 	mounted() {
 		myChart = echarts.init(document.getElementById('main'));
 		myChart = echarts.init(document.getElementById('main'));
 		this.draw()
 		this.draw()
-		this.getKline();
+		this.getKline((new Date()).getTime());
 		// 获取成交记录
 		// 获取成交记录
 		this.getDealHis();
 		this.getDealHis();
 	},
 	},
@@ -167,7 +169,15 @@ var app = new Vue({
 
 
 			});
 			});
 			that.webSocket.onclose = function(event) {
 			that.webSocket.onclose = function(event) {
-				console.log("WebSocket is closed now.");
+				that.$nextTick(() => {
+					that.scoketInit()
+					that.dataKLine = {
+						data: [],
+						dates: [],
+						volumes: [],
+					};
+					that.getKline((new Date()).getTime())
+				})
 			};
 			};
 		},
 		},
 		// 获取24小时交易数据统计
 		// 获取24小时交易数据统计
@@ -185,9 +195,9 @@ var app = new Vue({
 			}
 			}
 			if (type == 2) {
 			if (type == 2) {
 				items = data.map(function(item) {
 				items = data.map(function(item) {
-					console.log(
-						`[${+item[1]},${+item[2]},${+item[3]},${+item[4]},${+item[5]}, ${+item[1] > +item[2] ? 1 : -1}]`,
-						'数据结果');
+					// 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]];
 					return [+item[1], +item[4], +item[3], +item[2], +item[5]];
 				});
 				});
 			}
 			}
@@ -221,34 +231,33 @@ var app = new Vue({
 			return fmt;
 			return fmt;
 		},
 		},
 		// 获取k线数据,生成k线
 		// 获取k线数据,生成k线
-		getKline() {
+		getKline(time) {
 			console.log('qq');
 			console.log('qq');
 			const that = this;
 			const that = this;
 			// const tiemt = (new Date()).getTime() - (1000*60*60*24*6);
 			// const tiemt = (new Date()).getTime() - (1000*60*60*24*6);
 			// console.log(tiemt,'k闲时间')
 			// console.log(tiemt,'k闲时间')
 			axiosGet('/index/history', {
 			axiosGet('/index/history', {
-			// axiosGet('/api/v5/market/history-candles', {
-				// after:tiemt,
+				// axiosGet('/api/v5/market/history-candles', {
+				after: time,
 				instId: that.typeId,
 				instId: that.typeId,
 				bar: that.current,
 				bar: that.current,
-				limit: 300
 			}).then((res) => {
 			}).then((res) => {
-
+				// 保存初始返回res对象
+				that.oldDataKLine = res[res.length-1][0];
+				// console.log(that.initDay(new Date(+that.oldDataKLine), "YYYY-mm-dd HH:MM:SS"))
+				// console.log(that.initDay(new Date(+res[0][0]), "YYYY-mm-dd HH:MM:SS"))
 				const ar = res.map((e) => {
 				const ar = res.map((e) => {
 					let dateTime = new Date(+e[0]);
 					let dateTime = new Date(+e[0]);
 					e[0] = that.initDay(dateTime, "YYYY-mm-dd HH:MM:SS");
 					e[0] = that.initDay(dateTime, "YYYY-mm-dd HH:MM:SS");
 					return e
 					return e
 				}).reverse()
 				}).reverse()
-
-				that.dataKLine = {
-					dates: that.dataInit(ar, 1),
-					data: that.dataInit(ar, 2),
-					volumes: that.dataInit(ar, 3),
-				}
+				that.dataKLine.dates.unshift(...that.dataInit(ar, 1))
+				that.dataKLine.data.unshift(...that.dataInit(ar, 2))
+				that.dataKLine.volumes.unshift(...that.dataInit(ar, 3))
 				// that.dataKLine = {
 				// that.dataKLine = {
-				// 	dates: dates,
-				// 	data:data,
-				// 	volumes: volumes,
+				// 	dates: that.dataInit(ar, 1),
+				// 	data: that.dataInit(ar, 2),
+				// 	volumes: that.dataInit(ar, 3),
 				// }
 				// }
 
 
 				that.setKline()
 				that.setKline()
@@ -328,9 +337,9 @@ var app = new Vue({
 		getDealHis() {
 		getDealHis() {
 			const that = this;
 			const that = this;
 			axiosGet('/index/deal', {
 			axiosGet('/index/deal', {
-			// axiosGet('/api/v5/market/trades', {
+				// axiosGet('/api/v5/market/trades', {
 				instId: that.typeId,
 				instId: that.typeId,
-				limit: 100
+				limit: 150
 			}).then((res) => {
 			}).then((res) => {
 				// 处理返回数据
 				// 处理返回数据
 				this.dealHis = res.map((e) => {
 				this.dealHis = res.map((e) => {
@@ -361,10 +370,7 @@ var app = new Vue({
 			};
 			};
 			that.current = val;
 			that.current = val;
 			that.webSocket.close()
 			that.webSocket.close()
-			that.$nextTick(() => {
-				that.scoketInit()
-			})
-			that.getKline()
+
 		},
 		},
 		// 切换类目
 		// 切换类目
 		switchCategory(val) {
 		switchCategory(val) {
@@ -463,7 +469,7 @@ var app = new Vue({
 					type: 'category', //坐标轴类型。(value:数值轴,适用于连续数据。,category:类目轴,适用于离散的类目数据,time: 时间轴,适用于连续的时序数据,log:对数轴。适用于对数数据)
 					type: 'category', //坐标轴类型。(value:数值轴,适用于连续数据。,category:类目轴,适用于离散的类目数据,time: 时间轴,适用于连续的时序数据,log:对数轴。适用于对数数据)
 					data: [], //类目数据,在类目轴(type: 'category')中有效。
 					data: [], //类目数据,在类目轴(type: 'category')中有效。
 					scale: true,
 					scale: true,
-					boundaryGap: true, //坐标轴两边留白策略,类目轴和非类目轴的设置和表现不一样。
+					boundaryGap: false, //坐标轴两边留白策略,类目轴和非类目轴的设置和表现不一样。
 					axisLine: {
 					axisLine: {
 						show: false
 						show: false
 					}, //坐标轴轴线相关设置
 					}, //坐标轴轴线相关设置
@@ -706,17 +712,18 @@ var app = new Vue({
 						markPoint: {
 						markPoint: {
 							symbol: 'rect',
 							symbol: 'rect',
 							symbolSize: [-10, 0.5],
 							symbolSize: [-10, 0.5],
-							symbolOffset: [5, 0],
+							symbolOffset: [-5, 0],
 							itemStyle: {
 							itemStyle: {
 								color: 'rgba(255,255,255,.87)'
 								color: 'rgba(255,255,255,.87)'
 							},
 							},
 							label: {
 							label: {
 								color: 'rgba(255,255,255,.87)',
 								color: 'rgba(255,255,255,.87)',
-								offset: [10, 0],
+								offset: [3, 0],
 								fontSize: 10,
 								fontSize: 10,
-								align: 'left',
+								position: "left",
+								align: 'right',
 								formatter: function(params) {
 								formatter: function(params) {
-									console.log(params.value,'传入的处理数值');
+									// console.log(params.value,'传入的处理数值');
 									// return Number(params.value).toFixed(2)
 									// return Number(params.value).toFixed(2)
 									return Number(params.value)
 									return Number(params.value)
 								}
 								}
@@ -828,6 +835,8 @@ var app = new Vue({
 				let num = params.batch[0]['start'];
 				let num = params.batch[0]['start'];
 				if (num == 0) {
 				if (num == 0) {
 					console.log('到最左边了')
 					console.log('到最左边了')
+					// console.log(that.initDay(new Date(+that.oldDataKLine), "YYYY-mm-dd HH:MM:SS"));
+					// that.getKline(that.oldDataKLine)
 				}
 				}
 			})
 			})
 			window.addEventListener('resize', () => {
 			window.addEventListener('resize', () => {

+ 1 - 1
hybrid/html/local.html

@@ -18,7 +18,7 @@
 					<div class="head-item-cell">
 					<div class="head-item-cell">
 						<span class="hic-label">漲跌幅</span>
 						<span class="hic-label">漲跌幅</span>
 						<span class="hic-value"
 						<span class="hic-value"
-							:class="txData.upFlag==1?'price-green':'price-red'">{{txData.upRate || 0}}</span>
+							:class="txData.upFlag==1?'price-green':'price-red'">{{txData.upRate || 0}}%</span>
 					</div>
 					</div>
 					<div class="head-item-cell">
 					<div class="head-item-cell">
 						<span class="hic-label">高</span>
 						<span class="hic-label">高</span>

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "GRAYSCALE",
     "name" : "GRAYSCALE",
     "appid" : "__UNI__F0EBD91",
     "appid" : "__UNI__F0EBD91",
     "description" : "",
     "description" : "",
-    "versionName" : "1.0.4",
-    "versionCode" : 104,
+    "versionName" : "1.0.5",
+    "versionCode" : 105,
     "transformPx" : false,
     "transformPx" : false,
     "app-plus" : {
     "app-plus" : {
         /* 5+App特有相关 */
         /* 5+App特有相关 */

BIN
unpackage/cache/apk/__UNI__F0EBD91_cm.apk


+ 1 - 1
unpackage/cache/apk/apkurl

@@ -1 +1 @@
-https://ide.dcloud.net.cn/build/download/d8d6c7f0-6d96-11ed-9d15-bb710cb884ab
+https://ide.dcloud.net.cn/build/download/10d4b320-6ed7-11ed-99fa-2dbc2edea1d8

File diff suppressed because it is too large
+ 0 - 0
unpackage/cache/apk/cmManifestCache.json


+ 5 - 1
unpackage/dist/build/h5/index.html

@@ -1,2 +1,6 @@
 <!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>GRAYSCALE</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
 <!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>GRAYSCALE</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
-            document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/index/static/index.b0707a6a.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/index/static/js/chunk-vendors.01ecbba6.js></script><script src=/index/static/js/index.659f0446.js></script></body></html>
+<<<<<<< HEAD
+            document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/index/static/index.b0707a6a.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/index/static/js/chunk-vendors.01ecbba6.js></script><script src=/index/static/js/index.659f0446.js></script></body></html>
+=======
+            document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/index/static/index.b0707a6a.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/index/static/js/chunk-vendors.d0617b07.js></script><script src=/index/static/js/index.160365f1.js></script></body></html>
+>>>>>>> 0ce1c28c467bbb81a121885c2b753c272ecc63f5

+ 1 - 1
utils/request.js

@@ -51,7 +51,7 @@ service.interceptors.response(
 	},
 	},
 	error => {
 	error => {
 		uni.showToast({
 		uni.showToast({
-			title: "加载错误请重试",
+			title: "加載中",
 			duration: 1500,
 			duration: 1500,
 			mask: false,
 			mask: false,
 			icon: 'none',
 			icon: 'none',

Some files were not shown because too many files changed in this diff