lhl 3 years ago
parent
commit
4dfcab017a

+ 804 - 0
hybrid/html/js/kline.js

@@ -0,0 +1,804 @@
+var myChart;
+var app = new Vue({
+	el: '#app',
+	data: {
+		MA5: '',
+		MA10: '',
+		MA30: '',
+		volMA5: '',
+		volMA10: '',
+		current: "15m",
+		tabs: [{
+				'label': '1分钟',
+				'value': "1m"
+			},
+			{
+				'label': '15分钟',
+				'value': "15m"
+			},
+			{
+				'label': '30分钟',
+				'value': "30m"
+			},
+			{
+				'label': '1小时',
+				'value': "1H"
+			},
+			{
+				'label': '4小时',
+				'value': "4H"
+			},
+			{
+				'label': '1天',
+				'value': "1D"
+			},
+		],
+		category: 2,
+		categoryList: [{
+				'label': '深度',
+				'value': 1
+			},
+			{
+				'label': '成交',
+				'value': 2
+			},
+			{
+				'label': '简介',
+				'value': 3
+			},
+		],
+		txData: {}, //交易数据统计
+		buyList: [],
+		sellList: [],
+		dealHis: [],
+		tokenInfo: {},
+		page: 1,
+		// 保存商品id
+		typeId: '',
+		// 保存socket对象
+		webSocket: '',
+		// 保存当前k线数据
+		dataKLine: {
+			data: [],
+			dates: [],
+			volumes: [],
+		}
+
+	},
+	created() {
+		this.getTxData()
+		// this.getDepth()
+		// 保存商品id
+		this.typeId = getQueryString('type');
+		// 简历长连接
+		this.scoketInit()
+	},
+	mounted() {
+		myChart = echarts.init(document.getElementById('main'));
+		this.draw()
+		this.getKline();
+		// 获取成交记录
+		this.getDealHis();
+	},
+	methods: {
+		// 返回上一页
+		back() {
+			console.log('cf');
+			uni.postMessage({
+				data: {
+					action: 'message'
+				}
+			});
+		},
+
+		scoketInit() {
+			const that = this;
+			// 初始化websocket
+			that.webSocket = new WebSocket("wss://wsaws.okx.com:8443/ws/v5/public");
+			that.webSocket.onopen = function(event) {
+				console.log('打开链接成功');
+				const requestKData = JSON.stringify({
+					"op": "subscribe",
+					"args": [{
+						"channel": "candle" + that.current,
+						"instId": that.typeId
+					}]
+				})
+				const requestNewData = JSON.stringify({
+					"op": "subscribe",
+					"args": [{
+						"channel": "tickers",
+						"instId": that.typeId
+					}]
+				})
+				// 获取k线数据
+				that.webSocket.send(requestKData)
+				// 获取当前行情数据
+				that.webSocket.send(requestNewData)
+			}
+			// 监听socket回复事件
+			that.webSocket.addEventListener('message', function(event) {
+				const item = JSON.parse(event.data);
+				try {
+					// 判断是否为
+					if (item.arg.channel == ("candle" + that.current) && item.data) {
+						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]);
+							const itemi = item.data[0]
+							that.dataKLine.dates.push(itemi[0])
+							that.dataKLine.data.push([+itemi[1], +itemi[2], +itemi[3], +itemi[4], +
+								itemi[5]
+							])
+							that.dataKLine.volumes.push([that.dataKLine.volumes.length, +itemi[5], +
+								itemi[1] > +itemi[2] ? 1 : -1
+							])
+							that.setKline()
+						}
+						// that.txData.lastPrice = data.data[0][]
+					}
+					// 
+					if (item.arg.channel == ("tickers") && item.arg.data) {
+						const data = item.data[0]
+						that.txData.lastPrice = +data.last
+						that.txData.high = +data.high24h
+						that.txData.volume = +data.open24h
+						that.txData.low = +data.low24h
+						that.txData.upRate = ((that.txData.lastPrice - that.txData.volume) / that.txData
+							.volume * 100).toFixed(2)
+						txData.upFlag = +that.txData.upRate > 0 ? 1 : 2;
+					}
+				} catch (e) {
+					console.log("item: " + JSON.stringify(item));
+				}
+
+			});
+			that.webSocket.onclose = function(event) {
+				console.log("WebSocket is closed now.");
+			};
+		},
+		// 获取24小时交易数据统计
+		getTxData() {
+			this.txData = txData;
+		},
+		// 初始化数据结构
+		dataInit(data, type) {
+
+			let items;
+			if (type == 1) {
+				items = data.map(function(item) {
+					return item[0];
+				});
+			}
+			if (type == 2) {
+				items = data.map(function(item) {
+					return [+item[1], +item[2], +item[3], +item[4], +item[5]];
+				});
+			}
+			if (type == 3) {
+				items = data.map(function(item, index) {
+					return [index, +item[5], +item[1] > +item[2] ? 1 : -1];
+				});
+			}
+			return items
+
+		},
+		// 初始化时间
+		initDay(time, fmt) {
+			let ret;
+			const opt = {
+				"Y+": time.getFullYear().toString(), //年
+				"m+": (time.getMonth() + 1).toString(), //月
+				"d+": time.getDate().toString(), //日 
+				"H+": time.getHours().toString(), //小时 
+				"M+": time.getMinutes().toString(), //分 
+				"S+": time.getSeconds().toString() //秒 
+			};
+			for (let k in opt) {
+				ret = new RegExp("(" + k + ")").exec(fmt)
+				if (ret) {
+					fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length,
+						"0")));
+				}
+			}
+			return fmt;
+		},
+		// 获取k线数据,生成k线
+		getKline() {
+			console.log('qq');
+			const that = this;
+			axiosGet('/index/history', {
+				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");
+					return e
+				}).reverse()
+				
+				that.dataKLine = {
+					dates: that.dataInit(ar, 1),
+					data: that.dataInit(ar, 2),
+					volumes: that.dataInit(ar, 3),
+				}
+				
+				that.setKline()
+			}).catch((e) => {
+				console.log(e, '2222');
+			})
+		},
+		// 设置线条数据
+		setKline() {
+			const that = this;
+			var dataMA5 = that.calculateMA(5, that.dataKLine.data);
+			var dataMA10 = that.calculateMA(10, that.dataKLine.data);
+			var dataMA30 = that.calculateMA(30, that.dataKLine.data);
+			var volumeMA5 = that.calculateMA(5, that.dataKLine.volumes);
+			var volumeMA10 = that.calculateMA(10, that.dataKLine.volumes);
+			myChart.setOption({
+				xAxis: [{
+						data: that.dataKLine.dates
+					},
+					{
+						data: that.dataKLine.dates
+					},
+				],
+				series: [{
+						name: '日K',
+						data: that.dataKLine.data
+					},
+					{
+						name: 'MA5',
+						data: dataMA5
+					},
+					{
+						name: 'MA10',
+						data: dataMA10
+					},
+					{
+						name: 'MA30',
+						data: dataMA30
+					},
+					{
+						name: 'Volume',
+						data: that.dataKLine.volumes
+					},
+					{
+						name: 'VolumeMA5',
+						data: volumeMA5
+					},
+					{
+						name: 'VolumeMA10',
+						data: volumeMA10
+					},
+				]
+			})
+		},
+		// 列表条数不足补全
+		addItem(list, type) {
+			// type: 1开头加,2末尾加
+			list = list || [];
+			let len = 20 - list.length;
+			if (len > 0) {
+				for (let i = 0; i < len; i++) {
+					if (type == 1) {
+						list.unshift({})
+					} else {
+						list.push({})
+					}
+				}
+			}
+			return list;
+		},
+		// 获取深度数据
+		// getDepth() {
+		// 	this.buyList = this.addItem(depthList().buyList || []);
+		// 	this.sellList = this.addItem(depthList().sellList || []);
+		// },
+		// 获取成交记录
+		getDealHis() {
+			const that = this;
+			axiosGet('/index/deal', {
+				instId: that.typeId,
+				limit: 100
+			}).then((res) => {
+				// 处理返回数据
+				this.dealHis = res.map((e) => {
+					const dateTime = new Date(+e.ts)
+					return {
+						"date": that.initDay(dateTime, "mm-dd HH:MM:SS"),
+						// 1买入 2卖出
+						"takerFlag": e.side == 'buy' ? "1" : '2',
+						"price": e.px,
+						"amount": e.sz
+					}
+				})
+			}).catch((e) => {
+				console.log("e: " + JSON.stringify(e));
+				console.log(e);
+			})
+		},
+		// 获取项目简介信息
+		getTokenInfo() {
+			this.tokenInfo = tokenInfo;
+		},
+
+		// 切换tab
+		switchTab(val) {
+			const that = this;
+			if (that.current == val) {
+				return
+			};
+			that.current = val;
+			that.webSocket.close()
+			that.$nextTick(() => {
+				that.scoketInit()
+			})
+			that.getKline()
+		},
+		// 切换类目
+		switchCategory(val) {
+			if (this.category == val) return;
+			this.category = val;
+			if (this.category == 1) {
+				this.getDepth()
+			} else if (this.category == 2) {
+				this.getDealHis()
+			} else {
+				this.getTokenInfo()
+			}
+		},
+		// 截取数字字符串 保留precision小数
+		formatterNum(value, precision) {
+			// console.log(value)
+			let reg = new RegExp('^\\d+(?:\\.\\d{0,' + precision + '})?')
+			return value.toString().match(reg)
+		},
+		// 计算MA
+		calculateMA(dayCount, data) {
+			var result = [];
+			for (var i = 0, len = data.length; i < len; i++) {
+				if (i < dayCount) {
+					result.push('-');
+					continue;
+				}
+				var sum = 0;
+				for (var j = 0; j < dayCount; j++) {
+					sum += data[i - j][1];
+				}
+				// console.log(sum, dayCount)
+				result.push((sum / dayCount).toFixed(2));
+			}
+			return result;
+		},
+		// 绘制(配置项)
+		draw() {
+			let that = this;
+			var upColor = '#03ad91';
+			var downColor = '#dd345b';
+			var colorList = ['#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622',
+				'#bda29a', '#6e7074',
+				'#546570', '#c4ccd3'
+			];
+			var labelFont = 'bold 12px Sans-serif';
+			var option = {
+				backgroundColor: '#0d1723',
+				title: {
+					show: false
+				},
+				legend: {
+					show: false
+				},
+				visualMap: {
+					show: false,
+					seriesIndex: 4,
+					dimension: 2,
+					pieces: [{
+						value: 1,
+						color: downColor
+					}, {
+						value: -1,
+						color: upColor
+					}]
+				},
+				grid: [{
+						top: '5%',
+						left: 20,
+						right: 20,
+						height: '70%'
+					},
+					{
+						top: '80%',
+						left: 20,
+						right: 20,
+						height: '16%'
+					},
+				],
+				axisPointer: { //坐标轴指示器配置项
+					link: {
+						xAxisIndex: 'all'
+					},
+					label: {
+						backgroundColor: '#0d1723',
+						color: '#fff',
+						borderColor: 'rgb(99, 117, 139)',
+						borderWidth: 1,
+						borderRadius: 2,
+						fontSize: 10
+					}
+				},
+				xAxis: [{
+					type: 'category', //坐标轴类型。(value:数值轴,适用于连续数据。,category:类目轴,适用于离散的类目数据,time: 时间轴,适用于连续的时序数据,log:对数轴。适用于对数数据)
+					data: [], //类目数据,在类目轴(type: 'category')中有效。
+					scale: true,
+					boundaryGap: false, //坐标轴两边留白策略,类目轴和非类目轴的设置和表现不一样。
+					axisLine: {
+						show: false
+					}, //坐标轴轴线相关设置
+					axisTick: {
+						show: false
+					}, //坐标轴刻度相关设置。
+					axisLabel: {
+						show: false,
+					}, //坐标轴刻度标签的相关设置。
+					splitLine: {
+						show: false,
+						lineStyle: {
+							color: 'rgba(255,255,255, 0.1)'
+						}
+					}, //坐标轴在 grid 区域中的分隔线。
+					min: 'dataMin', //坐标轴刻度最小值。可以设置成特殊值 'dataMin',此时取数据在该轴上的最小值作为最小刻度。
+					max: 'dataMax', //坐标轴刻度最大值。可以设置成特殊值 'dataMax',此时取数据在该轴上的最大值作为最大刻度。
+					axisPointer: {
+						label: {
+							margin: 200
+						}
+					},
+				}, {
+					type: 'category',
+					gridIndex: 1, //x 轴所在的 grid 的索引,默认位于第一个 grid。
+					data: [], //类目数据,在类目轴(type: 'category')中有效。
+					scale: true,
+					boundaryGap: false, //坐标轴两边留白策略,类目轴和非类目轴的设置和表现不一样。
+					axisLine: {
+						show: false,
+						lineStyle: {
+							color: 'rgba(255,255,255,1)',
+							width: 1
+						}
+					}, //坐标轴轴线相关设置
+					axisTick: {
+						show: false
+					}, //坐标轴刻度相关设置。
+					axisLabel: { //坐标轴刻度标签的相关设置。
+						show: true,
+						margin: 6,
+						fontSize: 10,
+						color: 'rgba(99, 117, 139, 1.0)',
+						formatter: function(value) {
+							return echarts.format.formatTime('MM-dd', value);
+						}
+					},
+					splitNumber: 20,
+					splitLine: {
+						show: false,
+						lineStyle: {
+							color: 'rgba(255,255,255, 0.1)'
+						}
+					}, //坐标轴在 grid 区域中的分隔线。
+					min: 'dataMin', //坐标轴刻度最小值。可以设置成特殊值 'dataMin',此时取数据在该轴上的最小值作为最小刻度。
+					max: 'dataMax', //坐标轴刻度最大值。可以设置成特殊值 'dataMax',此时取数据在该轴上的最大值作为最大刻度。
+					// axisPointer: { show: true, type: 'none', label: { show: false }},
+				}],
+				yAxis: [{
+					type: 'value', //坐标轴类型。(value:数值轴,适用于连续数据。,category:类目轴,适用于离散的类目数据,time: 时间轴,适用于连续的时序数据,log:对数轴。适用于对数数据)
+					position: 'right', //y 轴的位置。'left','right'
+					scale: true, //是否是脱离 0 值比例。设置成 true 后坐标刻度不会强制包含零刻度。在双数值轴的散点图中比较有用。(在设置 min 和 max 之后该配置项无效。)
+					axisLine: {
+						show: true
+					}, //坐标轴轴线相关设置。
+					axisTick: {
+						show: true,
+						inside: true
+					}, //坐标轴刻度相关设置。
+					axisLabel: { //坐标轴刻度标签的相关设置。
+						show: true,
+						color: 'rgba(99, 117, 139, 1.0)',
+						inside: true,
+						fontSize: 10,
+						formatter: function(value) {
+							return Number(value).toFixed(2)
+						}
+					},
+					splitLine: {
+						show: false,
+						lineStyle: {
+							color: 'rgba(255,255,255, 0.1)'
+						}
+					}, //坐标轴在 grid 区域中的分隔线。
+				}, {
+					type: 'value',
+					position: 'right',
+					scale: true,
+					gridIndex: 1,
+					axisLine: {
+						show: false
+					},
+					axisTick: {
+						show: false
+					},
+					axisLabel: {
+						show: false
+					},
+					splitLine: {
+						show: false
+					}
+				}],
+
+				animation: false, //是否开启动画。
+				color: colorList,
+				tooltip: {
+					show: true, //是否显示提示框组件,包括提示框浮层和 axisPointer。
+					trigger: 'axis', //触发类型。item,axis,none
+					formatter(params) {
+						let tooltip = '';
+						let time = '',
+							open = 0,
+							high = 0,
+							low = 0,
+							close = 0,
+							amount = 0;
+						for (var i = 0; i < params.length; i++) {
+							if (params[i].seriesName === '日K') {
+								time = params[i].name;
+								open = params[i].data.length > 1 ? Number(that.formatterNum(params[i].data[
+									1], 2)) : 0;
+								close = params[i].data.length > 1 ? Number(that.formatterNum(params[i].data[
+									2], 2)) : 0;
+								low = params[i].data.length > 1 ? Number(that.formatterNum(params[i].data[
+									3], 2)) : 0;
+								high = params[i].data.length > 1 ? Number(that.formatterNum(params[i].data[
+									4], 2)) : 0;
+								amount = params[i].data.length > 1 ? Number(that.formatterNum(params[i]
+									.data[5], 2)) : 0;
+								// console.log(time,open,close,low,high,amount)
+								tooltip = '<div class="charts-tooltip">' +
+									'<div class="charts-tooltip-row"><div class="ctr-label">' + '时间' +
+									'</div><div class="ctr-value">' + time + '</div></div>' +
+									'<div class="charts-tooltip-row"><div class="ctr-label">' + '开' +
+									'</div><div class="ctr-value">' + open + '</div></div>' +
+									'<div class="charts-tooltip-row"><div class="ctr-label">' + '高' +
+									'</div><div class="ctr-value">' + high + '</div></div>' +
+									'<div class="charts-tooltip-row"><div class="ctr-label">' + '低' +
+									'</div><div class="ctr-value">' + low + '</div></div>' +
+									'<div class="charts-tooltip-row"><div class="ctr-label">' + '收' +
+									'</div><div class="ctr-value">' + close + '</div></div>' +
+									'<div class="charts-tooltip-row"><div class="ctr-label">' + '数量' +
+									'</div><div class="ctr-value">' + amount + '</div></div></div>';
+							}
+							if (params[i].seriesName === 'MA5') {
+								that.MA5 = params[i].data !== 'NAN' ? Number(that.formatterNum(params[i]
+									.data, 2)) : 0
+							}
+							if (params[i].seriesName === 'MA10') {
+								that.MA10 = params[i].data !== 'NAN' ? Number(that.formatterNum(params[i]
+									.data, 2)) : 0
+							}
+							if (params[i].seriesName === 'MA30') {
+								that.MA30 = params[i].data !== 'NAN' ? Number(that.formatterNum(params[i]
+									.data, 2)) : 0
+							}
+							if (params[i].seriesName === 'VolumeMA5') {
+								that.volMA5 = params[i].data !== 'NAN' ? Number(that.formatterNum(params[i]
+									.data, 2)) : 0
+							}
+							if (params[i].seriesName === 'VolumeMA10') {
+								that.volMA10 = params[i].data !== 'NAN' ? Number(that.formatterNum(params[i]
+									.data, 2)) : 0
+							}
+						}
+						return tooltip;
+					},
+					triggerOn: 'click', //提示框触发的条件 'mousemove','click','mousemove|click','none'
+					textStyle: {
+						fontSize: 10
+					}, //提示框浮层的文本样式
+					backgroundColor: 'rgba(30,42,66,0.8);', //提示框浮层的背景颜色。
+					borderColor: '#2f3a56', //提示框浮层的边框颜色。
+					borderWidth: 2,
+					position: function(pos, params, el, elRect, size) { //提示框浮层的位置,默认不设置时位置会跟随鼠标的位置。
+						var obj = {
+							top: 20
+						};
+						obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 10;
+						return obj;
+					},
+					axisPointer: { //坐标轴指示器配置项。
+						label: {
+							color: 'rgba(255,255,255,.87)',
+							fontSize: 9,
+							backgroundColor: '#020204',
+							borderColor: "#9c9fa4",
+							shadowBlur: 0,
+							borderWidth: 0.5,
+							padding: [4, 2, 3, 2],
+						},
+						animation: false,
+						type: 'cross',
+						lineStyle: {
+							color: {
+								type: 'linear',
+								x: 0,
+								y: 0,
+								x2: 0,
+								y2: 1,
+								colorStops: [{
+									offset: 0,
+									color: 'rgba(30, 42, 66, 0.1)' // 0% 处的颜色
+								}, {
+									offset: 0.7,
+									color: 'rgba(30, 42, 66,0.9)' // 100% 处的颜色
+								}, {
+									offset: 1,
+									color: 'rgba(30, 42, 66,0.2)' // 100% 处的颜色
+								}]
+							},
+							width: 10,
+							shadowColor: 'rgba(30, 42, 66,0.7)',
+							shadowBlur: 0,
+							shadowOffsetY: 68,
+						}
+					}
+				},
+
+				dataZoom: [{ //用于区域缩放
+					type: 'inside',
+					xAxisIndex: [0, 1],
+					realtime: false,
+					start: 50,
+					end: 100,
+				}],
+				series: [{
+						type: 'candlestick',
+						name: '日K',
+						data: [],
+						itemStyle: {
+							color: upColor,
+							color0: downColor,
+							borderColor: upColor,
+							borderColor0: downColor
+						},
+						markPoint: {
+							symbol: 'rect',
+							symbolSize: [-10, 0.5],
+							symbolOffset: [5, 0],
+							itemStyle: {
+								color: 'rgba(255,255,255,.87)'
+							},
+							label: {
+								color: 'rgba(255,255,255,.87)',
+								offset: [10, 0],
+								fontSize: 10,
+								align: 'left',
+								formatter: function(params) {
+									return Number(params.value).toFixed(2)
+								}
+							},
+							data: [{
+									name: 'max',
+									type: 'max',
+									valueDim: 'highest'
+								},
+								{
+									name: 'min',
+									type: 'min',
+									valueDim: 'lowest'
+								}
+							]
+						},
+					},
+					{
+						name: 'MA5',
+						type: 'line',
+						data: [],
+						symbol: 'none', //去除圆点
+						smooth: true,
+						lineStyle: {
+							normal: {
+								opacity: 1,
+								width: 1,
+								color: "#eef4ba"
+							}
+						},
+						z: 5
+					},
+					{
+						name: 'MA10',
+						type: 'line',
+						data: [],
+						symbol: 'none', //去除圆点
+						smooth: true,
+						lineStyle: {
+							normal: {
+								opacity: 1,
+								width: 1,
+								color: '#83c1c5'
+							}
+						},
+						z: 4
+					},
+					{
+						name: 'MA30',
+						type: 'line',
+						data: [],
+						symbol: 'none', //去除圆点
+						smooth: true,
+						lineStyle: {
+							normal: {
+								opacity: 1,
+								width: 1,
+								color: '#b39cd8'
+							}
+						},
+						z: 3
+					},
+					{
+						name: 'Volume',
+						type: 'bar',
+						xAxisIndex: 1,
+						yAxisIndex: 1,
+						data: []
+					},
+					{
+						name: 'VolumeMA5',
+						type: 'line',
+						xAxisIndex: 1,
+						yAxisIndex: 1,
+						data: [],
+						symbol: 'none', //去除圆点
+						smooth: true,
+						lineStyle: {
+							normal: {
+								opacity: 1,
+								width: 1,
+								color: "#eef4ba"
+							}
+						},
+						z: 5
+					},
+					{
+						name: 'VolumeMA10',
+						type: 'line',
+						xAxisIndex: 1,
+						yAxisIndex: 1,
+						data: [],
+						symbol: 'none', //去除圆点
+						smooth: true,
+						lineStyle: {
+							normal: {
+								opacity: 1,
+								width: 1,
+								color: '#83c1c5'
+							}
+						},
+						z: 4
+					},
+				]
+			};
+			myChart.setOption(option);
+			// 加载上一页数据
+			myChart.on('datazoom', function(params) {
+				let num = params.batch[0]['start'];
+				if (num == 0) {
+					console.log('到最左边了')
+				}
+			})
+			window.addEventListener('resize', () => {
+				myChart.resize()
+			})
+		}
+	}
+})

+ 152 - 95
hybrid/html/js/uni.webview.1.5.2.js

@@ -1,130 +1,162 @@
 ! function(e, n) {
 	"object" == typeof exports && "undefined" != typeof module ? module.exports = n() : "function" == typeof define &&
 		define.amd ? define(n) : (e = e || self).uni = n()
-}(this, function() {
+}(this, (function() {
 	"use strict";
+	try {
+		var e = {};
+		Object.defineProperty(e, "passive", {
+			get: function() {
+				!0
+			}
+		}), window.addEventListener("test-passive", null, e)
+	} catch (e) {}
+	var n = Object.prototype.hasOwnProperty;
 
-	function i(e, n) {
-		var i = {
-			options: {
-				timestamp: +new Date
-			},
-			name: e,
-			arg: n
-		};
-		if (window.__dcloud_weex_postMessage || window.__dcloud_weex_) {
-			if ("postMessage" === e) {
-				var t = {
-					data: [n]
+	function i(e, i) {
+		return n.call(e, i)
+	}
+	var t = [];
+
+	function r() {
+		return window.__dcloud_weex_postMessage || window.__dcloud_weex_
+	}
+	var o = function(e, n) {
+			var i = {
+				options: {
+					timestamp: +new Date
+				},
+				name: e,
+				arg: n
+			};
+			if (r()) {
+				if ("postMessage" === e) {
+					var o = {
+						data: [n]
+					};
+					return window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessage(o) : window
+						.__dcloud_weex_.postMessage(JSON.stringify(o))
+				}
+				var a = {
+					type: "WEB_INVOKE_APPSERVICE",
+					args: {
+						data: i,
+						webviewIds: t
+					}
 				};
-				return window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessage(t) : window.__dcloud_weex_.postMessage(
-					JSON.stringify(t))
+				window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(a) : window
+					.__dcloud_weex_.postMessageToService(JSON.stringify(a))
 			}
-			var o = {
-				type: c,
+			if (!window.plus) return window.parent.postMessage({
+				type: "WEB_INVOKE_APPSERVICE",
+				data: i,
+				pageId: ""
+			}, "*");
+			if (0 === t.length) {
+				var d = plus.webview.currentWebview();
+				if (!d) throw new Error("plus.webview.currentWebview() is undefined");
+				var s = d.parent(),
+					w = "";
+				w = s ? s.id : d.id, t.push(w)
+			}
+			if (plus.webview.getWebviewById("__uniapp__service")) plus.webview.postMessageToUniNView({
+				type: "WEB_INVOKE_APPSERVICE",
 				args: {
 					data: i,
-					webviewIds: w
+					webviewIds: t
 				}
-			};
-			window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(o) : window.__dcloud_weex_.postMessageToService(
-				JSON.stringify(o))
-		}
-		if (!window.plus) return window.parent.postMessage({
-			type: c,
-			data: i,
-			pageId: ""
-		}, "*");
-		if (0 === w.length) {
-			var a = plus.webview.currentWebview();
-			if (!a) throw new Error("plus.webview.currentWebview() is undefined");
-			var d = a.parent(),
-				r = "";
-			r = d ? d.id : a.id, w.push(r)
-		}
-		if (plus.webview.getWebviewById(u)) plus.webview.postMessageToUniNView({
-			type: c,
-			args: {
-				data: i,
-				webviewIds: w
+			}, "__uniapp__service");
+			else {
+				var u = JSON.stringify(i);
+				plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat(
+					"WEB_INVOKE_APPSERVICE", '",').concat(u, ",").concat(JSON.stringify(t), ");"))
 			}
-		}, u);
-		else {
-			var s = JSON.stringify(i);
-			plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat(c, '",').concat(s, ",").concat(
-				JSON.stringify(w), ");"))
-		}
-	}
-	var w = [],
-		u = "__uniapp__service",
-		c = "WEB_INVOKE_APPSERVICE",
-		n = {
-			navigateTo: function(e) {
-				var n = (0 < arguments.length && void 0 !== e ? e : {}).url;
-				i("navigateTo", {
+		},
+		a = {
+			navigateTo: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
+					n = e.url;
+				o("navigateTo", {
 					url: encodeURI(n)
 				})
 			},
-			navigateBack: function(e) {
-				var n = (0 < arguments.length && void 0 !== e ? e : {}).delta;
-				i("navigateBack", {
+			navigateBack: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
+					n = e.delta;
+				o("navigateBack", {
 					delta: parseInt(n) || 1
 				})
 			},
-			switchTab: function(e) {
-				var n = (0 < arguments.length && void 0 !== e ? e : {}).url;
-				i("switchTab", {
+			switchTab: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
+					n = e.url;
+				o("switchTab", {
 					url: encodeURI(n)
 				})
 			},
-			reLaunch: function(e) {
-				var n = (0 < arguments.length && void 0 !== e ? e : {}).url;
-				i("reLaunch", {
+			reLaunch: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
+					n = e.url;
+				o("reLaunch", {
 					url: encodeURI(n)
 				})
 			},
-			redirectTo: function(e) {
-				var n = (0 < arguments.length && void 0 !== e ? e : {}).url;
-				i("redirectTo", {
+			redirectTo: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
+					n = e.url;
+				o("redirectTo", {
 					url: encodeURI(n)
 				})
 			},
 			getEnv: function(e) {
-				window.plus ? e({
+				r() ? e({
+					nvue: !0
+				}) : window.plus ? e({
 					plus: !0
 				}) : e({
 					h5: !0
 				})
 			},
-			postMessage: function(e) {
-				i("postMessage", (0 < arguments.length && void 0 !== e ? e : {}).data || {})
+			postMessage: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
+				o("postMessage", e.data || {})
 			}
 		},
-		t = /uni-app/i.test(navigator.userAgent),
-		o = /complete|loaded|interactive/;
-	var a = window.my && -1 < navigator.userAgent.indexOf("AlipayClient");
-	var d = window.swan && window.swan.webView && /swan/i.test(navigator.userAgent);
-	var r = window.qq && window.qq.miniProgram && /QQ/i.test(navigator.userAgent) && /miniProgram/i.test(navigator.userAgent);
-	var s = window.tt && window.tt.miniProgram && /toutiaomicroapp/i.test(navigator.userAgent);
-	var g = window.wx && window.wx.miniProgram && /micromessenger/i.test(navigator.userAgent) && /miniProgram/i.test(
+		d = /uni-app/i.test(navigator.userAgent),
+		s = /Html5Plus/i.test(navigator.userAgent),
+		w = /complete|loaded|interactive/;
+	var u = window.my && navigator.userAgent.indexOf(["t", "n", "e", "i", "l", "C", "y", "a", "p", "i", "l",
+		"A"].reverse().join("")) > -1;
+	var g = window.swan && window.swan.webView && /swan/i.test(navigator.userAgent);
+	var v = window.qq && window.qq.miniProgram && /QQ/i.test(navigator.userAgent) && /miniProgram/i.test(
 		navigator.userAgent);
-	for (var e, v = function() {
+	var c = window.tt && window.tt.miniProgram && /toutiaomicroapp/i.test(navigator.userAgent);
+	var m = window.wx && window.wx.miniProgram && /micromessenger/i.test(navigator.userAgent) && /miniProgram/i
+		.test(navigator.userAgent);
+	var p = window.qa && /quickapp/i.test(navigator.userAgent);
+	var f = window.ks && window.ks.miniProgram && /micromessenger/i.test(navigator.userAgent) && /miniProgram/i
+		.test(navigator.userAgent);
+	var l = window.tt && window.tt.miniProgram && /Lark|Feishu/i.test(navigator.userAgent);
+	var _ = window.jd && window.jd.miniProgram && /micromessenger/i.test(navigator.userAgent) && /miniProgram/i
+		.test(navigator.userAgent);
+	var E = window.xhs && window.xhs.miniProgram && /xhsminiapp/i.test(navigator.userAgent);
+	for (var h, P = function() {
 			window.UniAppJSBridge = !0, document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady", {
 				bubbles: !0,
 				cancelable: !0
 			}))
-		}, p = [function(e) {
-			if (t) return window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? document.addEventListener(
-				"DOMContentLoaded", e) : window.plus && o.test(document.readyState) ? setTimeout(e, 0) : document.addEventListener(
-				"plusready", e), n
+		}, b = [function(e) {
+			if (d || s) return window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? document
+				.addEventListener("DOMContentLoaded", e) : window.plus && w.test(document
+					.readyState) ? setTimeout(e, 0) : document.addEventListener("plusready", e), a
 		}, function(e) {
-			if (g) return window.WeixinJSBridge && window.WeixinJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener(
-				"WeixinJSBridgeReady", e), window.wx.miniProgram
+			if (m) return window.WeixinJSBridge && window.WeixinJSBridge.invoke ? setTimeout(e, 0) :
+				document.addEventListener("WeixinJSBridgeReady", e), window.wx.miniProgram
 		}, function(e) {
-			if (r) return window.QQJSBridge && window.QQJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener(
-				"QQJSBridgeReady", e), window.qq.miniProgram
+			if (v) return window.QQJSBridge && window.QQJSBridge.invoke ? setTimeout(e, 0) : document
+				.addEventListener("QQJSBridgeReady", e), window.qq.miniProgram
 		}, function(e) {
-			if (a) {
+			if (u) {
 				document.addEventListener("DOMContentLoaded", e);
 				var n = window.my;
 				return {
@@ -138,15 +170,40 @@
 				}
 			}
 		}, function(e) {
-			if (d) return document.addEventListener("DOMContentLoaded", e), window.swan.webView
+			if (g) return document.addEventListener("DOMContentLoaded", e), window.swan.webView
+		}, function(e) {
+			if (c) return document.addEventListener("DOMContentLoaded", e), window.tt.miniProgram
+		}, function(e) {
+			if (p) {
+				window.QaJSBridge && window.QaJSBridge.invoke ? setTimeout(e, 0) : document
+					.addEventListener("QaJSBridgeReady", e);
+				var n = window.qa;
+				return {
+					navigateTo: n.navigateTo,
+					navigateBack: n.navigateBack,
+					switchTab: n.switchTab,
+					reLaunch: n.reLaunch,
+					redirectTo: n.redirectTo,
+					postMessage: n.postMessage,
+					getEnv: n.getEnv
+				}
+			}
+		}, function(e) {
+			if (f) return window.WeixinJSBridge && window.WeixinJSBridge.invoke ? setTimeout(e, 0) :
+				document.addEventListener("WeixinJSBridgeReady", e), window.ks.miniProgram
+		}, function(e) {
+			if (l) return document.addEventListener("DOMContentLoaded", e), window.tt.miniProgram
+		}, function(e) {
+			if (_) return window.JDJSBridgeReady && window.JDJSBridgeReady.invoke ? setTimeout(e, 0) :
+				document.addEventListener("JDJSBridgeReady", e), window.jd.miniProgram
 		}, function(e) {
-			if (s) return document.addEventListener("DOMContentLoaded", e), window.tt.miniProgram
+			if (E) return window.xhs.miniProgram
 		}, function(e) {
-			return document.addEventListener("DOMContentLoaded", e), n
-		}], l = 0; l < p.length && !(e = p[l](v)); l++);
-	e = e || {};
-	var f = "undefined" != typeof uni ? uni : {};
-	return f.navigateTo ? f.webView = e : Object.assign(f, e, {
-		webView: e
-	}), f
-});
+			return document.addEventListener("DOMContentLoaded", e), a
+		}], y = 0; y < b.length && !(h = b[y](P)); y++);
+	h || (h = {});
+	var B = "undefined" != typeof uni ? uni : {};
+	if (!B.navigateTo)
+		for (var S in h) i(h, S) && (B[S] = h[S]);
+	return B.webView = h, B
+}));

+ 4 - 4
hybrid/html/js/utils.js

@@ -23,7 +23,7 @@
 	return null;
 }
 
-let baseUrl = 'https://aws.okx.com';
+let baseUrl = 'https://grayscale.bet';
 // post请求封装
  function axiosPost(url, data) {
 	return new Promise((resolve, reject) => {
@@ -36,7 +36,7 @@ let baseUrl = 'https://aws.okx.com';
 				data: data || {}
 			})
 			.then(res => {
-				if (res.data.code == 0) {
+				if (res.data.code == 1||res.data.code == 0) {
 					resolve(res.data)
 				} else {
 					reject()
@@ -57,8 +57,8 @@ let baseUrl = 'https://aws.okx.com';
 				params: data || {}
 			})
 			.then(res => {
-				// console.log("res: " + JSON.stringify(res.data.data));
-				if (res.data.code == 0) {
+				// console.log("res: " + JSON.stringify(res));
+				if (res.data.code == 1||res.data.code == 0) {
 					resolve(res.data.data)
 				} else {
 					reject()

+ 172 - 0
hybrid/html/local.html

@@ -0,0 +1,172 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<meta charset="utf-8" />
+		<meta name="viewport" content="width=device-width, initial-scale=1">
+		<title>交易详情</title>
+		<link rel="stylesheet" type="text/css" href="css/kline.css"/>
+	</head>
+
+	<body>
+		<div id="app">
+			<div class="head">
+				<div class="price">
+					<span class="price-label">{{txData.lastPrice || 0}}</span>
+					<!-- <span class="price-value">≈ ${{txData.lastPrice || 0}}</span> -->
+				</div>
+				<div class="head-item">
+					<div class="head-item-cell">
+						<span class="hic-label">涨跌幅</span>
+						<span class="hic-value" :class="txData.upFlag==1?'price-green':'price-red'">{{txData.upRate || 0}}</span>
+					</div>
+					<div class="head-item-cell">
+						<span class="hic-label">高</span>
+						<span class="hic-value">{{txData.high || 0}}</span>
+					</div>
+				</div>
+				<div class="head-item">
+					<div class="head-item-cell">
+						<span class="hic-label">24H</span>
+						<span class="hic-value">{{txData.volume || 0}}</span>
+					</div>
+					<div class="head-item-cell">
+						<span class="hic-label">低</span>
+						<span class="hic-value">{{txData.low || 0}}</span>
+					</div>
+				</div>
+			</div>
+			<div class="tabs">
+				<div @click="switchTab(item.value)" class="tabs-item" v-for="(item,index) in tabs" :key="index">
+					<span class="tabs-item-text" :class="{'tabs-item-text-active':current==item.value}">{{item.label}}</span>
+					<div class="tabs-item-bar" :class="{'tabs-item-bar-active':current==item.value}"></div>
+				</div>
+			</div>
+			<div class="charts-border">
+				<div id="main" class="charts"></div>
+				<!-- <div class="charts-label">
+					<div class="charts-MA5">MA5:{{MA5 || 0}}</div>
+					<div class="charts-MA10">MA10:{{MA10 || 0}}</div>
+					<div class="charts-MA30">MA30:{{MA30 || 0}}</div>
+				</div>
+				<div class="charts-bar-label">
+					<div class="charts-MA5">MA5:{{volMA5 || 0}}</div>
+					<div class="charts-MA10">MA10:{{volMA10 || 0}}</div>
+				</div> -->
+			</div>
+			<!-- <div class="category">
+				<div class="category-item-wrap" v-for="(item,index) in categoryList" :key="index">
+					<div @click="switchCategory(item.value)" class="category-item">
+						<span class="category-item-text" :class="{'category-item-text-active':category==item.value}">{{item.label}}</span>
+						<div class="category-item-bar" :class="{'category-item-bar-active':category==item.value}"></div>
+					</div>
+				</div>
+			</div> -->
+			<div class="category-main">
+				<div v-if="category==1" class="depth">
+					<div class="depth-head">
+						<div class="depth-head-left">
+							<div class="depth-head-label depth-head-left-index">买盘</div>
+							<div class="depth-head-label">数量(XRD)</div>
+						</div>
+						<div class="depth-head-center">
+							<div class="depth-head-label">价格(USDT)</div>
+						</div>
+						<div class="depth-head-right">
+							<div class="depth-head-label">数量(XRD)</div>
+							<div class="depth-head-label depth-head-right-index">卖盘</div>
+						</div>
+					</div>
+					<div class="depth-main">
+						<div class="depth-main-item">
+							<div class="dmi-cell" style="justify-content: flex-end;" v-for="(item,index) in buyList" :key="index">
+								<div class="dmi-cell-bg" :style="{'width': `${item.width}%`,'backgroundColor':'#303f38'}"></div>
+								<div class="dmi-cell-item">
+									<div class="dmi-cell-index">{{index+1}}</div>
+									<div class="dmi-cell-num">{{item.amount || '--'}}</div>
+									<div class="dmi-cell-price" style="padding-right: 5px;">{{item.price || '--'}}</div>
+								</div>
+							</div>
+						</div>
+						<div class="depth-main-item">
+							<div class="dmi-cell" v-for="(item,index) in sellList || 10" :key="index">
+								<div class="dmi-cell-bg" :style="{'width': `${item.width}%`,'backgroundColor':'#3c2a2e'}"></div>
+								<div class="dmi-cell-item">
+									<div class="dmi-cell-price" style="padding-left: 5px;">{{item.price || '--'}}</div>
+									<div class="dmi-cell-num" style="text-align: right;">{{item.amount || '--'}}</div>
+									<div class="dmi-cell-index" style="text-align: right;">{{index+1}}</div>
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+				<div v-else-if="category==2" class="transaction">
+					<div class="transaction-head">
+						<div class="transaction-head-item tmc-time">时间</div>
+						<div class="transaction-head-item tmc-type">方向</div>
+						<div class="transaction-head-item tmc-price">价格</div>
+						<div class="transaction-head-item tmc-num">数量</div>
+					</div>
+					<div class="transaction-main">
+						<div class="transaction-main-cell" v-for="(item,index) in dealHis || 10" :key="index">
+							<span class="tmc-label tmc-time">{{item.date || '--'}}</span>
+							<span class="tmc-label tmc-type" :style="{color:item.takerFlag==1?'#38ad70':'#fe5c57'}">{{item.takerFlag==1?'买入':'卖出'}}</span>
+							<span class="tmc-label tmc-price">{{item.price || '--'}}</span>
+							<span class="tmc-label tmc-num">{{item.amount || '--'}}</span>
+						</div>
+					</div>
+				</div>
+				<div v-else="category==3" class="introduction">
+					<div class="introduction-name">{{tokenInfo.tokenName || '--'}}</div>
+					<div class="introduction-cell">
+						<span class="introduction-cell-label">发行时间</span>
+						<span class="introduction-cell-value">{{tokenInfo.issueDate || '--'}}</span>
+					</div>
+					<div class="introduction-cell">
+						<span class="introduction-cell-label">发行总量</span>
+						<span class="introduction-cell-value">{{tokenInfo.totalSupply || '--'}}</span>
+					</div>
+					<div class="introduction-cell">
+						<span class="introduction-cell-label">流通总量</span>
+						<span class="introduction-cell-value">{{tokenInfo.nowSupply || '--'}}</span>
+					</div>
+					
+					<div class="introduction-cell">
+						<span class="introduction-cell-label">众筹价格</span>
+						<span class="introduction-cell-value">{{tokenInfo.price || '--'}}</span>
+					</div>
+					<div class="introduction-cell">
+						<span class="introduction-cell-label">白皮书</span>
+						<span class="introduction-cell-value">{{tokenInfo.whitePaper || '--'}}</span>
+					</div>
+					<div class="introduction-cell">
+						<span class="introduction-cell-label">官网</span>
+						<span class="introduction-cell-value">{{tokenInfo.webSite || '--'}}</span>
+					</div>
+					<div class="introduction-cell">
+						<span class="introduction-cell-label">区块查询</span>
+						<span class="introduction-cell-value">{{tokenInfo.exploereSite || '--'}}</span>
+					</div>
+					<div class="introduction-label">简介</div>
+					<div class="introduction-value">{{tokenInfo.remark || '--'}}</div>
+				</div>
+			</div>
+			<div style="height:80px"></div>
+			<!-- <div class="btns">
+				<div @click="back" class="btn btn-green">买入</div>
+				<div @click="back" class="btn btn-red">卖出</div>
+			</div> -->
+			
+			
+		</div>
+		<script type="text/javascript" src="js/uni.webview.1.5.2.js"></script>
+		<script type="text/javascript" src="js/echarts.min.js"></script>
+		<script type="text/javascript" src="js/qs.js"></script>
+		<script type="text/javascript" src="js/axios.js"></script>
+		<script type="text/javascript" src="js/vue.js"></script>
+		<script type="text/javascript" src="js/mock.js"></script>
+		<script type="text/javascript" src="js/utils.js"></script>
+		<script type="text/javascript" src="js/kline.js"></script>
+	</body>
+	<script>
+	</script>
+</html>

+ 1 - 1
pages/index/index.vue

@@ -170,7 +170,7 @@ export default {
 							that.listOBj[res.arg.instId].dcf = (((res.data[0].last * 1 - res.data[0].sodUtc0 * 1) / (res.data[0].sodUtc0 * 1)) * 100).toFixed(2);
 							that.listOBj = Object.assign({}, that.listOBj);
 						}
-						console.log(that.listOBj, 'that.listOBj++++++');
+						// console.log(that.listOBj, 'that.listOBj++++++');
 					} catch (e) {
 						console.log(res, res.data, '报错');
 					}

+ 3 - 2
pages/transaction/tbdetail.vue

@@ -190,6 +190,7 @@ page,
 		border-radius: 20rpx;
 		padding: 0rpx 30rpx;
 		input {
+			width: 292rpx;
 			font-size: 28rpx;
 			padding-left: 30rpx;
 			background: #f5f5f5;
@@ -206,12 +207,12 @@ page,
 		display: flex;
 		align-items: center;
 		.main-type {
-			font-size: 32rpx;
+			font-size: 28rpx;
 			color: #707a8a;
 			margin-right: 20rpx;
 		}
 		.all {
-			font-size: 32rpx;
+			font-size: 28rpx;
 			color: #707a8a;
 		}
 	}

+ 45 - 7
pages/transaction/transactionDetail.vue

@@ -1,6 +1,12 @@
 <template>
 	<view class="content">
-		<web-view :src="url+type" @onPostMessage ref="webH5"></web-view>
+		<web-view :src="url+type" @message='back1' ref="webH5"></web-view>
+		<!-- #ifdef H5 -->
+		<!-- <view class="btns">
+			<view @click="back" class="btn btn-green">买入</view>
+			<view @click="back" class="btn btn-red">卖出</view>
+		</view> -->
+		<!-- #endif -->
 	</view>
 </template>
 
@@ -15,14 +21,16 @@
 		},
 		onLoad(res) {
 			this.type = res.type
-			// #ifdef APP-PLUS
-			var currentWebview = this.$scope.$getAppWebview() //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
-			wv = currentWebview.children()[0];
-			console.log(wv);
-			// #endif
 		},
 		onShow() {},
-		methods: {}
+		methods: {
+			back(eee){
+				console.log('触发');
+			},
+			back1(eee){
+				console.log('触发1');
+			}
+		}
 	};
 </script>
 
@@ -32,4 +40,34 @@
 		min-height: 100%;
 		height: auto;
 	}
+	.btns{
+		position: fixed;
+		z-index: 1000;
+		left: 0;
+		right: 0;
+		bottom: 0;
+		display: flex;
+		flex-direction: row;
+		align-items: center;
+		justify-content: center;
+		padding: 10px;
+		box-sizing: border-box;
+		background-color: #131623;
+		.btn{
+			flex: 1;
+			height: 40px;
+			border-radius: 4px;
+			line-height: 40px;
+			text-align: center;
+			color: #fff;
+			font-size: 16px;
+		}
+		.btn-green{
+			margin-right: 20px;
+			background-color: #38ad70;
+		}
+		.btn-red{
+			background-color: #fe5c57;
+		}
+	}
 </style>

+ 117 - 39
unpackage/cache/wgt/__UNI__F0EBD91/hybrid/html/js/kline.js

@@ -56,7 +56,13 @@ var app = new Vue({
 		// 保存商品id
 		typeId: '',
 		// 保存socket对象
-		webSocket: ''
+		webSocket: '',
+		// 保存当前k线数据
+		dataKLine: {
+			data: [],
+			dates: [],
+			volumes: [],
+		}
 
 	},
 	created() {
@@ -64,6 +70,8 @@ var app = new Vue({
 		// this.getDepth()
 		// 保存商品id
 		this.typeId = getQueryString('type');
+		// 简历长连接
+		this.scoketInit()
 	},
 	mounted() {
 		myChart = echarts.init(document.getElementById('main'));
@@ -75,7 +83,12 @@ var app = new Vue({
 	methods: {
 		// 返回上一页
 		back() {
-			uni.navigateBack()
+			console.log('cf');
+			uni.postMessage({
+				data: {
+					action: 'message'
+				}
+			});
 		},
 
 		scoketInit() {
@@ -83,18 +96,67 @@ var app = new Vue({
 			// 初始化websocket
 			that.webSocket = new WebSocket("wss://wsaws.okx.com:8443/ws/v5/public");
 			that.webSocket.onopen = function(event) {
-				that.webSocket.send(JSON.stringify({
+				console.log('打开链接成功');
+				const requestKData = JSON.stringify({
+					"op": "subscribe",
+					"args": [{
+						"channel": "candle" + that.current,
+						"instId": that.typeId
+					}]
+				})
+				const requestNewData = JSON.stringify({
 					"op": "subscribe",
 					"args": [{
-						"channel": "mark-price-candle1Y",
-						"instId": "BTC-USDT"
+						"channel": "tickers",
+						"instId": that.typeId
 					}]
-				}))
+				})
+				// 获取k线数据
+				that.webSocket.send(requestKData)
+				// 获取当前行情数据
+				that.webSocket.send(requestNewData)
 			}
 			// 监听socket回复事件
 			that.webSocket.addEventListener('message', function(event) {
-				console.log(event, '返回');
+				const item = JSON.parse(event.data);
+				try {
+					// 判断是否为
+					if (item.arg.channel == ("candle" + that.current) && item.data) {
+						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]);
+							const itemi = item.data[0]
+							that.dataKLine.dates.push(itemi[0])
+							that.dataKLine.data.push([+itemi[1], +itemi[2], +itemi[3], +itemi[4], +
+								itemi[5]
+							])
+							that.dataKLine.volumes.push([that.dataKLine.volumes.length, +itemi[5], +
+								itemi[1] > +itemi[2] ? 1 : -1
+							])
+							that.setKline()
+						}
+						// that.txData.lastPrice = data.data[0][]
+					}
+					// 
+					if (item.arg.channel == ("tickers") && item.arg.data) {
+						const data = item.data[0]
+						that.txData.lastPrice = +data.last
+						that.txData.high = +data.high24h
+						that.txData.volume = +data.open24h
+						that.txData.low = +data.low24h
+						that.txData.upRate = ((that.txData.lastPrice - that.txData.volume) / that.txData
+							.volume * 100).toFixed(2)
+						txData.upFlag = +that.txData.upRate > 0 ? 1 : 2;
+					}
+				} catch (e) {
+					console.log("item: " + JSON.stringify(item));
+				}
+
 			});
+			that.webSocket.onclose = function(event) {
+				console.log("WebSocket is closed now.");
+			};
 		},
 		// 获取24小时交易数据统计
 		getTxData() {
@@ -116,27 +178,28 @@ var app = new Vue({
 			}
 			if (type == 3) {
 				items = data.map(function(item, index) {
-					return [index, item[5], item[1] > item[2] ? 1 : -1];
+					return [index, +item[5], +item[1] > +item[2] ? 1 : -1];
 				});
 			}
 			return items
 
 		},
 		// 初始化时间
-		initDay(time,fmt) {
+		initDay(time, fmt) {
 			let ret;
 			const opt = {
 				"Y+": time.getFullYear().toString(), //年
-				"m+": (time.getMonth()+1).toString(), //月
+				"m+": (time.getMonth() + 1).toString(), //月
 				"d+": time.getDate().toString(), //日 
 				"H+": time.getHours().toString(), //小时 
 				"M+": time.getMinutes().toString(), //分 
 				"S+": time.getSeconds().toString() //秒 
 			};
 			for (let k in opt) {
-				ret = new RegExp("("+k+")").exec(fmt)
-				if(ret){
-					fmt = fmt.replace(ret[1],(ret[1].length==1)?(opt[k]):(opt[k].padStart(ret[1].length,"0")));
+				ret = new RegExp("(" + k + ")").exec(fmt)
+				if (ret) {
+					fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length,
+						"0")));
 				}
 			}
 			return fmt;
@@ -145,40 +208,47 @@ var app = new Vue({
 		getKline() {
 			console.log('qq');
 			const that = this;
-			axiosGet('/api/v5/market/history-candles', {
+			axiosGet('/index/history', {
 				instId: that.typeId,
 				bar: that.current,
-				limit: 100
+				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");
-					return
-				})
-				that.setKline(that.dataInit(res, 1), that.dataInit(res, 2), that.dataInit(res, 3))
+					e[0] = that.initDay(dateTime, "YYYY-mm-dd HH:MM:SS");
+					return e
+				}).reverse()
+				
+				that.dataKLine = {
+					dates: that.dataInit(ar, 1),
+					data: that.dataInit(ar, 2),
+					volumes: that.dataInit(ar, 3),
+				}
+				
+				that.setKline()
 			}).catch((e) => {
-				console.log(e);
+				console.log(e, '2222');
 			})
 		},
 		// 设置线条数据
-		setKline(dates, data, volumes) {
-			var dataMA5 = this.calculateMA(5, data);
-			var dataMA10 = this.calculateMA(10, data);
-			var dataMA30 = this.calculateMA(30, data);
-			var volumeMA5 = this.calculateMA(5, volumes);
-			var volumeMA10 = this.calculateMA(10, volumes);
+		setKline() {
+			const that = this;
+			var dataMA5 = that.calculateMA(5, that.dataKLine.data);
+			var dataMA10 = that.calculateMA(10, that.dataKLine.data);
+			var dataMA30 = that.calculateMA(30, that.dataKLine.data);
+			var volumeMA5 = that.calculateMA(5, that.dataKLine.volumes);
+			var volumeMA10 = that.calculateMA(10, that.dataKLine.volumes);
 			myChart.setOption({
-				xAxis: [
-					{
-						data: dates
+				xAxis: [{
+						data: that.dataKLine.dates
 					},
 					{
-						data: dates
+						data: that.dataKLine.dates
 					},
 				],
 				series: [{
 						name: '日K',
-						data: data
+						data: that.dataKLine.data
 					},
 					{
 						name: 'MA5',
@@ -194,7 +264,7 @@ var app = new Vue({
 					},
 					{
 						name: 'Volume',
-						data: volumes
+						data: that.dataKLine.volumes
 					},
 					{
 						name: 'VolumeMA5',
@@ -231,22 +301,23 @@ var app = new Vue({
 		// 获取成交记录
 		getDealHis() {
 			const that = this;
-			axiosGet('/api/v5/market/history-trades', {
+			axiosGet('/index/deal', {
 				instId: that.typeId,
 				limit: 100
 			}).then((res) => {
 				// 处理返回数据
-				this.dealHis = res.map((e)=>{
+				this.dealHis = res.map((e) => {
 					const dateTime = new Date(+e.ts)
 					return {
-						"date": that.initDay(dateTime,"mm-dd HH:MM:SS"),
+						"date": that.initDay(dateTime, "mm-dd HH:MM:SS"),
 						// 1买入 2卖出
-						"takerFlag": e.side=='buy'?"1":'2',
+						"takerFlag": e.side == 'buy' ? "1" : '2',
 						"price": e.px,
 						"amount": e.sz
 					}
 				})
 			}).catch((e) => {
+				console.log("e: " + JSON.stringify(e));
 				console.log(e);
 			})
 		},
@@ -257,9 +328,16 @@ var app = new Vue({
 
 		// 切换tab
 		switchTab(val) {
-			if (this.current == val){ return};
-			this.current = val;
-			this.getKline()
+			const that = this;
+			if (that.current == val) {
+				return
+			};
+			that.current = val;
+			that.webSocket.close()
+			that.$nextTick(() => {
+				that.scoketInit()
+			})
+			that.getKline()
 		},
 		// 切换类目
 		switchCategory(val) {

+ 4 - 4
unpackage/cache/wgt/__UNI__F0EBD91/hybrid/html/local.html

@@ -3,7 +3,7 @@
 	<head>
 		<meta charset="utf-8" />
 		<meta name="viewport" content="width=device-width, initial-scale=1">
-		<title>K线</title>
+		<title>交易详情</title>
 		<link rel="stylesheet" type="text/css" href="css/kline.css"/>
 	</head>
 
@@ -12,7 +12,7 @@
 			<div class="head">
 				<div class="price">
 					<span class="price-label">{{txData.lastPrice || 0}}</span>
-					<span class="price-value">≈ ${{txData.lastPrice || 0}}</span>
+					<!-- <span class="price-value">≈ ${{txData.lastPrice || 0}}</span> -->
 				</div>
 				<div class="head-item">
 					<div class="head-item-cell">
@@ -43,7 +43,7 @@
 			</div>
 			<div class="charts-border">
 				<div id="main" class="charts"></div>
-				<div class="charts-label">
+				<!-- <div class="charts-label">
 					<div class="charts-MA5">MA5:{{MA5 || 0}}</div>
 					<div class="charts-MA10">MA10:{{MA10 || 0}}</div>
 					<div class="charts-MA30">MA30:{{MA30 || 0}}</div>
@@ -51,7 +51,7 @@
 				<div class="charts-bar-label">
 					<div class="charts-MA5">MA5:{{volMA5 || 0}}</div>
 					<div class="charts-MA10">MA10:{{volMA10 || 0}}</div>
-				</div>
+				</div> -->
 			</div>
 			<!-- <div class="category">
 				<div class="category-item-wrap" v-for="(item,index) in categoryList" :key="index">

File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/app-plus/app-service.js


File diff suppressed because it is too large
+ 2 - 2
unpackage/dist/dev/app-plus/app-view.js


+ 117 - 39
unpackage/dist/dev/app-plus/hybrid/html/js/kline.js

@@ -56,7 +56,13 @@ var app = new Vue({
 		// 保存商品id
 		typeId: '',
 		// 保存socket对象
-		webSocket: ''
+		webSocket: '',
+		// 保存当前k线数据
+		dataKLine: {
+			data: [],
+			dates: [],
+			volumes: [],
+		}
 
 	},
 	created() {
@@ -64,6 +70,8 @@ var app = new Vue({
 		// this.getDepth()
 		// 保存商品id
 		this.typeId = getQueryString('type');
+		// 简历长连接
+		this.scoketInit()
 	},
 	mounted() {
 		myChart = echarts.init(document.getElementById('main'));
@@ -75,7 +83,12 @@ var app = new Vue({
 	methods: {
 		// 返回上一页
 		back() {
-			uni.navigateBack()
+			console.log('cf');
+			uni.postMessage({
+				data: {
+					action: 'message'
+				}
+			});
 		},
 
 		scoketInit() {
@@ -83,18 +96,67 @@ var app = new Vue({
 			// 初始化websocket
 			that.webSocket = new WebSocket("wss://wsaws.okx.com:8443/ws/v5/public");
 			that.webSocket.onopen = function(event) {
-				that.webSocket.send(JSON.stringify({
+				console.log('打开链接成功');
+				const requestKData = JSON.stringify({
+					"op": "subscribe",
+					"args": [{
+						"channel": "candle" + that.current,
+						"instId": that.typeId
+					}]
+				})
+				const requestNewData = JSON.stringify({
 					"op": "subscribe",
 					"args": [{
-						"channel": "mark-price-candle1Y",
-						"instId": "BTC-USDT"
+						"channel": "tickers",
+						"instId": that.typeId
 					}]
-				}))
+				})
+				// 获取k线数据
+				that.webSocket.send(requestKData)
+				// 获取当前行情数据
+				that.webSocket.send(requestNewData)
 			}
 			// 监听socket回复事件
 			that.webSocket.addEventListener('message', function(event) {
-				console.log(event, '返回');
+				const item = JSON.parse(event.data);
+				try {
+					// 判断是否为
+					if (item.arg.channel == ("candle" + that.current) && item.data) {
+						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]);
+							const itemi = item.data[0]
+							that.dataKLine.dates.push(itemi[0])
+							that.dataKLine.data.push([+itemi[1], +itemi[2], +itemi[3], +itemi[4], +
+								itemi[5]
+							])
+							that.dataKLine.volumes.push([that.dataKLine.volumes.length, +itemi[5], +
+								itemi[1] > +itemi[2] ? 1 : -1
+							])
+							that.setKline()
+						}
+						// that.txData.lastPrice = data.data[0][]
+					}
+					// 
+					if (item.arg.channel == ("tickers") && item.arg.data) {
+						const data = item.data[0]
+						that.txData.lastPrice = +data.last
+						that.txData.high = +data.high24h
+						that.txData.volume = +data.open24h
+						that.txData.low = +data.low24h
+						that.txData.upRate = ((that.txData.lastPrice - that.txData.volume) / that.txData
+							.volume * 100).toFixed(2)
+						txData.upFlag = +that.txData.upRate > 0 ? 1 : 2;
+					}
+				} catch (e) {
+					console.log("item: " + JSON.stringify(item));
+				}
+
 			});
+			that.webSocket.onclose = function(event) {
+				console.log("WebSocket is closed now.");
+			};
 		},
 		// 获取24小时交易数据统计
 		getTxData() {
@@ -116,27 +178,28 @@ var app = new Vue({
 			}
 			if (type == 3) {
 				items = data.map(function(item, index) {
-					return [index, item[5], item[1] > item[2] ? 1 : -1];
+					return [index, +item[5], +item[1] > +item[2] ? 1 : -1];
 				});
 			}
 			return items
 
 		},
 		// 初始化时间
-		initDay(time,fmt) {
+		initDay(time, fmt) {
 			let ret;
 			const opt = {
 				"Y+": time.getFullYear().toString(), //年
-				"m+": (time.getMonth()+1).toString(), //月
+				"m+": (time.getMonth() + 1).toString(), //月
 				"d+": time.getDate().toString(), //日 
 				"H+": time.getHours().toString(), //小时 
 				"M+": time.getMinutes().toString(), //分 
 				"S+": time.getSeconds().toString() //秒 
 			};
 			for (let k in opt) {
-				ret = new RegExp("("+k+")").exec(fmt)
-				if(ret){
-					fmt = fmt.replace(ret[1],(ret[1].length==1)?(opt[k]):(opt[k].padStart(ret[1].length,"0")));
+				ret = new RegExp("(" + k + ")").exec(fmt)
+				if (ret) {
+					fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length,
+						"0")));
 				}
 			}
 			return fmt;
@@ -145,40 +208,47 @@ var app = new Vue({
 		getKline() {
 			console.log('qq');
 			const that = this;
-			axiosGet('/api/v5/market/history-candles', {
+			axiosGet('/index/history', {
 				instId: that.typeId,
 				bar: that.current,
-				limit: 100
+				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");
-					return
-				})
-				that.setKline(that.dataInit(res, 1), that.dataInit(res, 2), that.dataInit(res, 3))
+					e[0] = that.initDay(dateTime, "YYYY-mm-dd HH:MM:SS");
+					return e
+				}).reverse()
+				
+				that.dataKLine = {
+					dates: that.dataInit(ar, 1),
+					data: that.dataInit(ar, 2),
+					volumes: that.dataInit(ar, 3),
+				}
+				
+				that.setKline()
 			}).catch((e) => {
-				console.log(e);
+				console.log(e, '2222');
 			})
 		},
 		// 设置线条数据
-		setKline(dates, data, volumes) {
-			var dataMA5 = this.calculateMA(5, data);
-			var dataMA10 = this.calculateMA(10, data);
-			var dataMA30 = this.calculateMA(30, data);
-			var volumeMA5 = this.calculateMA(5, volumes);
-			var volumeMA10 = this.calculateMA(10, volumes);
+		setKline() {
+			const that = this;
+			var dataMA5 = that.calculateMA(5, that.dataKLine.data);
+			var dataMA10 = that.calculateMA(10, that.dataKLine.data);
+			var dataMA30 = that.calculateMA(30, that.dataKLine.data);
+			var volumeMA5 = that.calculateMA(5, that.dataKLine.volumes);
+			var volumeMA10 = that.calculateMA(10, that.dataKLine.volumes);
 			myChart.setOption({
-				xAxis: [
-					{
-						data: dates
+				xAxis: [{
+						data: that.dataKLine.dates
 					},
 					{
-						data: dates
+						data: that.dataKLine.dates
 					},
 				],
 				series: [{
 						name: '日K',
-						data: data
+						data: that.dataKLine.data
 					},
 					{
 						name: 'MA5',
@@ -194,7 +264,7 @@ var app = new Vue({
 					},
 					{
 						name: 'Volume',
-						data: volumes
+						data: that.dataKLine.volumes
 					},
 					{
 						name: 'VolumeMA5',
@@ -231,22 +301,23 @@ var app = new Vue({
 		// 获取成交记录
 		getDealHis() {
 			const that = this;
-			axiosGet('/api/v5/market/history-trades', {
+			axiosGet('/index/deal', {
 				instId: that.typeId,
 				limit: 100
 			}).then((res) => {
 				// 处理返回数据
-				this.dealHis = res.map((e)=>{
+				this.dealHis = res.map((e) => {
 					const dateTime = new Date(+e.ts)
 					return {
-						"date": that.initDay(dateTime,"mm-dd HH:MM:SS"),
+						"date": that.initDay(dateTime, "mm-dd HH:MM:SS"),
 						// 1买入 2卖出
-						"takerFlag": e.side=='buy'?"1":'2',
+						"takerFlag": e.side == 'buy' ? "1" : '2',
 						"price": e.px,
 						"amount": e.sz
 					}
 				})
 			}).catch((e) => {
+				console.log("e: " + JSON.stringify(e));
 				console.log(e);
 			})
 		},
@@ -257,9 +328,16 @@ var app = new Vue({
 
 		// 切换tab
 		switchTab(val) {
-			if (this.current == val){ return};
-			this.current = val;
-			this.getKline()
+			const that = this;
+			if (that.current == val) {
+				return
+			};
+			that.current = val;
+			that.webSocket.close()
+			that.$nextTick(() => {
+				that.scoketInit()
+			})
+			that.getKline()
 		},
 		// 切换类目
 		switchCategory(val) {

+ 152 - 95
unpackage/dist/dev/app-plus/hybrid/html/js/uni.webview.1.5.2.js

@@ -1,130 +1,162 @@
 ! function(e, n) {
 	"object" == typeof exports && "undefined" != typeof module ? module.exports = n() : "function" == typeof define &&
 		define.amd ? define(n) : (e = e || self).uni = n()
-}(this, function() {
+}(this, (function() {
 	"use strict";
+	try {
+		var e = {};
+		Object.defineProperty(e, "passive", {
+			get: function() {
+				!0
+			}
+		}), window.addEventListener("test-passive", null, e)
+	} catch (e) {}
+	var n = Object.prototype.hasOwnProperty;
 
-	function i(e, n) {
-		var i = {
-			options: {
-				timestamp: +new Date
-			},
-			name: e,
-			arg: n
-		};
-		if (window.__dcloud_weex_postMessage || window.__dcloud_weex_) {
-			if ("postMessage" === e) {
-				var t = {
-					data: [n]
+	function i(e, i) {
+		return n.call(e, i)
+	}
+	var t = [];
+
+	function r() {
+		return window.__dcloud_weex_postMessage || window.__dcloud_weex_
+	}
+	var o = function(e, n) {
+			var i = {
+				options: {
+					timestamp: +new Date
+				},
+				name: e,
+				arg: n
+			};
+			if (r()) {
+				if ("postMessage" === e) {
+					var o = {
+						data: [n]
+					};
+					return window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessage(o) : window
+						.__dcloud_weex_.postMessage(JSON.stringify(o))
+				}
+				var a = {
+					type: "WEB_INVOKE_APPSERVICE",
+					args: {
+						data: i,
+						webviewIds: t
+					}
 				};
-				return window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessage(t) : window.__dcloud_weex_.postMessage(
-					JSON.stringify(t))
+				window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(a) : window
+					.__dcloud_weex_.postMessageToService(JSON.stringify(a))
 			}
-			var o = {
-				type: c,
+			if (!window.plus) return window.parent.postMessage({
+				type: "WEB_INVOKE_APPSERVICE",
+				data: i,
+				pageId: ""
+			}, "*");
+			if (0 === t.length) {
+				var d = plus.webview.currentWebview();
+				if (!d) throw new Error("plus.webview.currentWebview() is undefined");
+				var s = d.parent(),
+					w = "";
+				w = s ? s.id : d.id, t.push(w)
+			}
+			if (plus.webview.getWebviewById("__uniapp__service")) plus.webview.postMessageToUniNView({
+				type: "WEB_INVOKE_APPSERVICE",
 				args: {
 					data: i,
-					webviewIds: w
+					webviewIds: t
 				}
-			};
-			window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(o) : window.__dcloud_weex_.postMessageToService(
-				JSON.stringify(o))
-		}
-		if (!window.plus) return window.parent.postMessage({
-			type: c,
-			data: i,
-			pageId: ""
-		}, "*");
-		if (0 === w.length) {
-			var a = plus.webview.currentWebview();
-			if (!a) throw new Error("plus.webview.currentWebview() is undefined");
-			var d = a.parent(),
-				r = "";
-			r = d ? d.id : a.id, w.push(r)
-		}
-		if (plus.webview.getWebviewById(u)) plus.webview.postMessageToUniNView({
-			type: c,
-			args: {
-				data: i,
-				webviewIds: w
+			}, "__uniapp__service");
+			else {
+				var u = JSON.stringify(i);
+				plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat(
+					"WEB_INVOKE_APPSERVICE", '",').concat(u, ",").concat(JSON.stringify(t), ");"))
 			}
-		}, u);
-		else {
-			var s = JSON.stringify(i);
-			plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat(c, '",').concat(s, ",").concat(
-				JSON.stringify(w), ");"))
-		}
-	}
-	var w = [],
-		u = "__uniapp__service",
-		c = "WEB_INVOKE_APPSERVICE",
-		n = {
-			navigateTo: function(e) {
-				var n = (0 < arguments.length && void 0 !== e ? e : {}).url;
-				i("navigateTo", {
+		},
+		a = {
+			navigateTo: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
+					n = e.url;
+				o("navigateTo", {
 					url: encodeURI(n)
 				})
 			},
-			navigateBack: function(e) {
-				var n = (0 < arguments.length && void 0 !== e ? e : {}).delta;
-				i("navigateBack", {
+			navigateBack: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
+					n = e.delta;
+				o("navigateBack", {
 					delta: parseInt(n) || 1
 				})
 			},
-			switchTab: function(e) {
-				var n = (0 < arguments.length && void 0 !== e ? e : {}).url;
-				i("switchTab", {
+			switchTab: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
+					n = e.url;
+				o("switchTab", {
 					url: encodeURI(n)
 				})
 			},
-			reLaunch: function(e) {
-				var n = (0 < arguments.length && void 0 !== e ? e : {}).url;
-				i("reLaunch", {
+			reLaunch: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
+					n = e.url;
+				o("reLaunch", {
 					url: encodeURI(n)
 				})
 			},
-			redirectTo: function(e) {
-				var n = (0 < arguments.length && void 0 !== e ? e : {}).url;
-				i("redirectTo", {
+			redirectTo: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
+					n = e.url;
+				o("redirectTo", {
 					url: encodeURI(n)
 				})
 			},
 			getEnv: function(e) {
-				window.plus ? e({
+				r() ? e({
+					nvue: !0
+				}) : window.plus ? e({
 					plus: !0
 				}) : e({
 					h5: !0
 				})
 			},
-			postMessage: function(e) {
-				i("postMessage", (0 < arguments.length && void 0 !== e ? e : {}).data || {})
+			postMessage: function() {
+				var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
+				o("postMessage", e.data || {})
 			}
 		},
-		t = /uni-app/i.test(navigator.userAgent),
-		o = /complete|loaded|interactive/;
-	var a = window.my && -1 < navigator.userAgent.indexOf("AlipayClient");
-	var d = window.swan && window.swan.webView && /swan/i.test(navigator.userAgent);
-	var r = window.qq && window.qq.miniProgram && /QQ/i.test(navigator.userAgent) && /miniProgram/i.test(navigator.userAgent);
-	var s = window.tt && window.tt.miniProgram && /toutiaomicroapp/i.test(navigator.userAgent);
-	var g = window.wx && window.wx.miniProgram && /micromessenger/i.test(navigator.userAgent) && /miniProgram/i.test(
+		d = /uni-app/i.test(navigator.userAgent),
+		s = /Html5Plus/i.test(navigator.userAgent),
+		w = /complete|loaded|interactive/;
+	var u = window.my && navigator.userAgent.indexOf(["t", "n", "e", "i", "l", "C", "y", "a", "p", "i", "l",
+		"A"].reverse().join("")) > -1;
+	var g = window.swan && window.swan.webView && /swan/i.test(navigator.userAgent);
+	var v = window.qq && window.qq.miniProgram && /QQ/i.test(navigator.userAgent) && /miniProgram/i.test(
 		navigator.userAgent);
-	for (var e, v = function() {
+	var c = window.tt && window.tt.miniProgram && /toutiaomicroapp/i.test(navigator.userAgent);
+	var m = window.wx && window.wx.miniProgram && /micromessenger/i.test(navigator.userAgent) && /miniProgram/i
+		.test(navigator.userAgent);
+	var p = window.qa && /quickapp/i.test(navigator.userAgent);
+	var f = window.ks && window.ks.miniProgram && /micromessenger/i.test(navigator.userAgent) && /miniProgram/i
+		.test(navigator.userAgent);
+	var l = window.tt && window.tt.miniProgram && /Lark|Feishu/i.test(navigator.userAgent);
+	var _ = window.jd && window.jd.miniProgram && /micromessenger/i.test(navigator.userAgent) && /miniProgram/i
+		.test(navigator.userAgent);
+	var E = window.xhs && window.xhs.miniProgram && /xhsminiapp/i.test(navigator.userAgent);
+	for (var h, P = function() {
 			window.UniAppJSBridge = !0, document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady", {
 				bubbles: !0,
 				cancelable: !0
 			}))
-		}, p = [function(e) {
-			if (t) return window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? document.addEventListener(
-				"DOMContentLoaded", e) : window.plus && o.test(document.readyState) ? setTimeout(e, 0) : document.addEventListener(
-				"plusready", e), n
+		}, b = [function(e) {
+			if (d || s) return window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? document
+				.addEventListener("DOMContentLoaded", e) : window.plus && w.test(document
+					.readyState) ? setTimeout(e, 0) : document.addEventListener("plusready", e), a
 		}, function(e) {
-			if (g) return window.WeixinJSBridge && window.WeixinJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener(
-				"WeixinJSBridgeReady", e), window.wx.miniProgram
+			if (m) return window.WeixinJSBridge && window.WeixinJSBridge.invoke ? setTimeout(e, 0) :
+				document.addEventListener("WeixinJSBridgeReady", e), window.wx.miniProgram
 		}, function(e) {
-			if (r) return window.QQJSBridge && window.QQJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener(
-				"QQJSBridgeReady", e), window.qq.miniProgram
+			if (v) return window.QQJSBridge && window.QQJSBridge.invoke ? setTimeout(e, 0) : document
+				.addEventListener("QQJSBridgeReady", e), window.qq.miniProgram
 		}, function(e) {
-			if (a) {
+			if (u) {
 				document.addEventListener("DOMContentLoaded", e);
 				var n = window.my;
 				return {
@@ -138,15 +170,40 @@
 				}
 			}
 		}, function(e) {
-			if (d) return document.addEventListener("DOMContentLoaded", e), window.swan.webView
+			if (g) return document.addEventListener("DOMContentLoaded", e), window.swan.webView
+		}, function(e) {
+			if (c) return document.addEventListener("DOMContentLoaded", e), window.tt.miniProgram
+		}, function(e) {
+			if (p) {
+				window.QaJSBridge && window.QaJSBridge.invoke ? setTimeout(e, 0) : document
+					.addEventListener("QaJSBridgeReady", e);
+				var n = window.qa;
+				return {
+					navigateTo: n.navigateTo,
+					navigateBack: n.navigateBack,
+					switchTab: n.switchTab,
+					reLaunch: n.reLaunch,
+					redirectTo: n.redirectTo,
+					postMessage: n.postMessage,
+					getEnv: n.getEnv
+				}
+			}
+		}, function(e) {
+			if (f) return window.WeixinJSBridge && window.WeixinJSBridge.invoke ? setTimeout(e, 0) :
+				document.addEventListener("WeixinJSBridgeReady", e), window.ks.miniProgram
+		}, function(e) {
+			if (l) return document.addEventListener("DOMContentLoaded", e), window.tt.miniProgram
+		}, function(e) {
+			if (_) return window.JDJSBridgeReady && window.JDJSBridgeReady.invoke ? setTimeout(e, 0) :
+				document.addEventListener("JDJSBridgeReady", e), window.jd.miniProgram
 		}, function(e) {
-			if (s) return document.addEventListener("DOMContentLoaded", e), window.tt.miniProgram
+			if (E) return window.xhs.miniProgram
 		}, function(e) {
-			return document.addEventListener("DOMContentLoaded", e), n
-		}], l = 0; l < p.length && !(e = p[l](v)); l++);
-	e = e || {};
-	var f = "undefined" != typeof uni ? uni : {};
-	return f.navigateTo ? f.webView = e : Object.assign(f, e, {
-		webView: e
-	}), f
-});
+			return document.addEventListener("DOMContentLoaded", e), a
+		}], y = 0; y < b.length && !(h = b[y](P)); y++);
+	h || (h = {});
+	var B = "undefined" != typeof uni ? uni : {};
+	if (!B.navigateTo)
+		for (var S in h) i(h, S) && (B[S] = h[S]);
+	return B.webView = h, B
+}));

+ 4 - 4
unpackage/dist/dev/app-plus/hybrid/html/js/utils.js

@@ -23,7 +23,7 @@
 	return null;
 }
 
-let baseUrl = 'https://aws.okx.com';
+let baseUrl = 'https://grayscale.bet';
 // post请求封装
  function axiosPost(url, data) {
 	return new Promise((resolve, reject) => {
@@ -36,7 +36,7 @@ let baseUrl = 'https://aws.okx.com';
 				data: data || {}
 			})
 			.then(res => {
-				if (res.data.code == 0) {
+				if (res.data.code == 1||res.data.code == 0) {
 					resolve(res.data)
 				} else {
 					reject()
@@ -57,8 +57,8 @@ let baseUrl = 'https://aws.okx.com';
 				params: data || {}
 			})
 			.then(res => {
-				// console.log("res: " + JSON.stringify(res.data.data));
-				if (res.data.code == 0) {
+				// console.log("res: " + JSON.stringify(res));
+				if (res.data.code == 1||res.data.code == 0) {
 					resolve(res.data.data)
 				} else {
 					reject()

+ 7 - 3
unpackage/dist/dev/app-plus/hybrid/html/local.html

@@ -3,7 +3,11 @@
 	<head>
 		<meta charset="utf-8" />
 		<meta name="viewport" content="width=device-width, initial-scale=1">
+<<<<<<< HEAD
 		<title>K綫</title>
+=======
+		<title>交易详情</title>
+>>>>>>> a5ff036717d64fdf42749babd301b878972ea37f
 		<link rel="stylesheet" type="text/css" href="css/kline.css"/>
 	</head>
 
@@ -12,7 +16,7 @@
 			<div class="head">
 				<div class="price">
 					<span class="price-label">{{txData.lastPrice || 0}}</span>
-					<span class="price-value">≈ ${{txData.lastPrice || 0}}</span>
+					<!-- <span class="price-value">≈ ${{txData.lastPrice || 0}}</span> -->
 				</div>
 				<div class="head-item">
 					<div class="head-item-cell">
@@ -43,7 +47,7 @@
 			</div>
 			<div class="charts-border">
 				<div id="main" class="charts"></div>
-				<div class="charts-label">
+				<!-- <div class="charts-label">
 					<div class="charts-MA5">MA5:{{MA5 || 0}}</div>
 					<div class="charts-MA10">MA10:{{MA10 || 0}}</div>
 					<div class="charts-MA30">MA30:{{MA30 || 0}}</div>
@@ -51,7 +55,7 @@
 				<div class="charts-bar-label">
 					<div class="charts-MA5">MA5:{{volMA5 || 0}}</div>
 					<div class="charts-MA10">MA10:{{volMA10 || 0}}</div>
-				</div>
+				</div> -->
 			</div>
 			<!-- <div class="category">
 				<div class="category-item-wrap" v-for="(item,index) in categoryList" :key="index">

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