-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathgn.html
More file actions
259 lines (201 loc) · 7.79 KB
/
gn.html
File metadata and controls
259 lines (201 loc) · 7.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<!-- Vendor CSS Files -->
<!-- Template Main CSS File -->
<!-- Vendor CSS Files -->
<link href="https://klang.org.cn/assets/vendor/aos/aos.css" rel="stylesheet">
<link href="https://klang.org.cn/assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="https://klang.org.cn/assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
<link href="https://klang.org.cn/assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
<link href="https://klang.org.cn/assets/vendor/glightbox/css/glightbox.min.css" rel="stylesheet">
<title>Klang(金浪)板块实时数据</title>
</head>
<body>
<div id="app">
<div class="row" style="width:80%;margin:100px;" id="content">
</div>
<div class="row" style="width:80%;margin:100px;" id="gnblock" >
<div v-for="a,index in gn50list">
<div class="alert alert-primary" role="alert">
<a @click="getbkcode(a.href,index)">{{index+1}}、 {{a.name}} </a>
</div>
<div v-bind:id="'bk'+index">
</div>
</div> <!-- for -->
</div>
<div id="window2" class="row" style="width:80%;margin:100px;min-height:600px;">
<iframe id="win2_iframe" src=""></iframe>
</div>
<div style="z-index: 9999; position:fixed; right: 50px; bottom: 50px;">
<button class="btn btn-primary" @click="refresh">刷</button>
</div>
</div> <!--app -->
<script crossorigin="anonymous" integrity="sha512-n/4gHW3atM3QqRcbCn6ewmpxcLAHGaDjpEBu4xZd47N0W2oQ+6q7oc3PXstrJYXcbNU1OHdQ1T7pAP+gi5Yu8g==" src="https://lib.baomitu.com/jquery/3.6.0/jquery.js"></script>
<script type="text/javascript" src="https://klang.org.cn/js/vendors.min.js"></script>
<!-- Template Main JS File -->
<script src="https://klang.org.cn/assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="https://klang.org.cn/assets/vendor/glightbox/js/glightbox.min.js"></script>
<script crossorigin="anonymous" integrity="sha512-KvaXQuRkPKYVQnd5RtRnFPR51W3+Vz+uq0IX8/TYaA2F6hDS2VQQv11BjdHES9boHiHXmqT9oC4H3AJLbq2Szg==" src="https://lib.baomitu.com/vue/3.2.31/vue.global.js"></script>
<script crossorigin="anonymous" integrity="sha512-bPh3uwgU5qEMipS/VOmRqynnMXGGSRv+72H/N260MQeXZIK4PG48401Bsby9Nq5P5fz7hy5UGNmC/W1Z51h2GQ==" src="https://lib.baomitu.com/axios/0.26.1/axios.min.js"></script>
<script crossorigin="anonymous" integrity="sha512-GtM/5c/Ie0lStj6QwEG0HkpMQuGr9vrOAgFD4nNmImviyZvsJxN7TYU7b+R7Kthob0zFBUpuxfl3R3Mn1qekTw==" src="https://lib.baomitu.com/socket.io/4.5.3/socket.io.min.js"></script>
<script>
// 保存原始的 document.cookie 的 setter 行为
var originalCookieDescriptor = Object.getOwnPropertyDescriptor(Document.prototype, 'cookie');
// 重写 document.cookie 的 setter
Object.defineProperty(document, 'cookie', {
set: function(value) {
// 自定义逻辑:在设置 Cookie 之前执行
console.log("拦截 document.cookie 设置:", value);
value = value.replace(/;\s*domain=[^;]+/, '');
// 调用原始的 document.cookie 的 setter
originalCookieDescriptor.set.call(document, value);
// 自定义逻辑:在设置 Cookie 之后执行
console.log("Cookie 设置完成!");
},
get: function() {
// 保留原始的 document.cookie 的 getter 行为
return originalCookieDescriptor.get.call(document);
}
});
var codetree={}
function savemain(code){
codetree1 = localStorage.getItem("klangcodelist")
if (codetree1 != null){
codetree = JSON.parse(codetree1)
}
if (codetree[code]) {
return
}
codetree[code] = []
localStorage.setItem("klangcodelist",JSON.stringify(codetree))
}
function savesub(code,subcode){
savemain(code)
if (codetree[code].includes(subcode) == false){
codetree[code].push(subcode)
}
localStorage.setItem("klangcodelist",JSON.stringify(codetree))
}
</script>
<script>
var win = window
function tableClass(){
tables = document.getElementsByTagName('table')
for (i=0;i<tables.length;i++){
tables[i].className = 'table table-bordered'
tables[i].border = '1'
}
}
function getgn50(){
gn50data = $("#content table tr").slice(1,51)
for (i=0;i<50;i++){
var tr = gn50data[i]
var td = tr.cells[1]
var a = td.firstElementChild
vue.$data.gn50list.push({"href":a.href,"name":a.text})
}
//setTimeout("getblock(0)",1500)
}
function winiframe(href){
$("#win2_iframe").attr('src',href)
}
function loadScript(href) {
// 创建一个 script 元素
const script = document.createElement('script');
script.src = href; // 设置脚本路径
script.onload = function() {
console.log("Script loaded and executed!");
};
document.body.appendChild(script); // 将脚本添加到页面
}
function winiframecontent(content){
const timestamp = Date.now();
const timestampStr = timestamp.toString();
const firstSevenDigits = timestampStr.substring(0, 7);
href = "https://s.thsi.cn/js/chameleon/chameleon.min."+firstSevenDigits+".js"
const regex = /<script\s+.*?src="([^"]+)"/;
const match = content.match(regex);
if (match && match[1]) {
href = match[1];
}
loadScript(href);
return
var iframe = $("#win2_iframe")[0]; // 或者使用 $("#win2_iframe").get(0)
// 获取 iframe 的文档对象
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
// 写入内容
iframeDoc.open();
iframeDoc.write(content);
iframeDoc.close();
}
async function getbkdata(code,index){
axios.get(apihost+"/gn/detail/field/199112/order/desc/page/1/ajax/1/code/"+code).then((response) => {
$('#bk'+index).html(response.data)
tableClass()
setTimeout("tableClass()",1000 );
})
.catch((error) => {
console.log(error.response.status);
function recall()
{
getbkdata(code,index)
}
if (error.response.status == 401){
winiframecontent(error.response.data)
setTimeout(recall,500)
}
});
}
async function getDatas(that){
response = await axios.get(apihost+"/funds/gnzjl/")
content = document.getElementById('content')
content.innerHTML = response.data
that.load = 1
that.$nextTick(function(){
tableClass()
getgn50()
});
tableClass()
setTimeout("tableClass()",1000 );
}
var hostname = window.location.hostname
var host = window.location.host
if (hostname == "" || hostname=="127.0.0.1"){
hostname = "127.0.0.1"
apihost = "http://127.0.0.1:9998"
} else {
apihost = "https://"+host + "/v2"
}
//apihost="https://api.klang.org.cn"
const VueApp = {
data() {
return {
load:0,
result:{},
gn50list:[],
}
},
created() {
},
mounted () {
var that = this
getDatas(that)
},
methods: {
refresh(e){
var that = this
getDatas(that)
},
getbkcode(href,index){
var reg = /\d+\/$/
var code = reg.exec(href)[0].replace('/','')
//winiframe(href)
getbkdata(code,index)
}
}
}//VueApp
window.vue = Vue.createApp(VueApp).mount('#app')
</script>
</body>
</html>