From c78e5f521a6bd93de2e553cda6d0eee58de46347 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 09 六月 2023 18:06:44 +0800
Subject: [PATCH] 看盘页面优化

---
 kp_html/kp/js/code_list.js |   63 +++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/kp_html/kp/js/code_list.js b/kp_html/kp/js/code_list.js
index 87e3ae0..8fdf6b1 100644
--- a/kp_html/kp/js/code_list.js
+++ b/kp_html/kp/js/code_list.js
@@ -1,5 +1,43 @@
+document.addEventListener("DOMContentLoaded", function() {
+	//鎶婂璞¤祴鍊煎埌JS涓�
+	try {
+		new QWebChannel(qt.webChannelTransport, function(channel) {
+			window.pyjs = channel.objects.Bridge;
+			console.log("鍥炶皟鎴愬姛");
+		});
+	} catch (e) {
+
+	}
+});
 var app;
 $(function() {
+	function is_trade_time() {
+		var nowdate = new Date();
+		h = nowdate.getHours();
+		m = nowdate.getMinutes();
+		total_m = h * 60 + m;
+		if ((total_m >= (9 * 60 + 25) && total_m <= (11 * 60 + 30)) || (total_m >= 13 * 60 && total_m <= 15 *
+				60)) {
+			return true;
+		} else {
+			return false;
+		}
+	}
+	// 瀹氭椂鎷夊彇H鎾ゆ暟鎹�
+	setInterval(function() {
+		if (app.code != '000000' && app.trade_data) {
+			if (is_trade_time()) {
+				http_util.get_h_cancel_data(app.code, function(res) {
+					res = JSON.parse(res);
+					console.log("缁撴灉:", res)
+					if (res.code == 0) {
+						app.$set(app.trade_data, 'h_cancel', res.data)
+					}
+				});
+			}
+		}
+	}, 3000)
+
 	new VConsole();
 	app = new Vue({
 		el: "#app",
@@ -11,14 +49,28 @@
 				open_limit_up: "",
 				records: []
 			},
+			same_reason_codes: null
 		},
 		methods: {
+			get_last_trade_day_reasons: function(code) {
+				http_util.get_last_trade_day_reasons(code, function(res) {
+                       res= JSON.parse(res);
+					   console.log("杩斿洖鍐呭",res);
+					   if(res.code==0){
+						   app.same_reason_codes = res.data;
+					   }else{
+						   app.same_reason_codes = null;
+					   }
+				});
+			},
+
 			set_trade_info: function(code, code_name, trade_data, trade_record, initiative_buy_codes,
 				passive_buy_codes) {
 				console.log("浜ゆ槗鏁版嵁", code, code_name, trade_data, trade_record)
 				console.log("涓诲姩涔板叆", initiative_buy_codes)
 				console.log("琚姩涔板叆", passive_buy_codes)
 				app.code = code;
+				app.get_last_trade_day_reasons(code);
 				app.code_name = code_name;
 				if (trade_data) {
 					var trade_data = JSON.parse(trade_data);
@@ -62,15 +114,16 @@
 				} else {
 					app.initiative_buy_codes = null;
 				}
-				
-				if(passive_buy_codes){
+
+				if (passive_buy_codes) {
 					app.passive_buy_codes = JSON.parse(passive_buy_codes);
-				}else{
+				} else {
 					app.passive_buy_codes = null;
 				}
-				
-				
+
+
 			}
+
 		}
 	})
 

--
Gitblit v1.8.0