-
Notifications
You must be signed in to change notification settings - Fork 21
/
etf.html
275 lines (214 loc) · 9.42 KB
/
etf.html
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<!-- Vendor CSS Files -->
<link href="http://klang.zhanluejia.net.cn/assets/vendor/aos/aos.css" rel="stylesheet">
<link href="http://klang.zhanluejia.net.cn/assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="http://klang.zhanluejia.net.cn/assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
<link href="http://klang.zhanluejia.net.cn/assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
<link href="http://klang.zhanluejia.net.cn/assets/vendor/glightbox/css/glightbox.min.css" rel="stylesheet">
<!-- Template Main CSS File -->
<link href="http://klang.zhanluejia.net.cn/assets/css/style.css" rel="stylesheet">
<link href="http://www.zhanluejia.net.cn/corlate/css/bootstrap.min.css" rel="stylesheet">
<link href="http://www.zhanluejia.net.cn/corlate/css/font-awesome.min.css" rel="stylesheet">
<link href="http://www.zhanluejia.net.cn/corlate/css/animate.min.css" rel="stylesheet">
<link href="http://www.zhanluejia.net.cn/corlate/css/animation.css" rel="stylesheet">
<link href="http://www.zhanluejia.net.cn/corlate/css/prettyPhoto.css" rel="stylesheet">
<link href="http://www.zhanluejia.net.cn/corlate/css/main.css" rel="stylesheet">
<link href="http://www.zhanluejia.net.cn/corlate/css/responsive.css" rel="stylesheet">
<link href="http://www.zhanluejia.net.cn/zlj/css/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/css/font-awesome.min.css" rel="stylesheet">
<link href="http://www.zhanluejia.net.cn/static/css/site.css">
<title>Klang(金浪)板块实时数据</title>
</head>
<body>
<div id="app">
<div class="row" style="width:80%;margin:100px;" id="content">
<table>
<thead>
<tr role="head" class="tr_hover">
<th style="width: 36px;">序号</th>
<th style="width: 66px;"><span sort="code" style="color: rgb(35, 113, 174); cursor: pointer;">基金代码</span></th>
<th width="130px" style="width: 171px;"><span>基金名称</span></th>
<th width="130px" style="width: 171px;"><span>公司名称</span></th>
<th style="width: 76px;"><span sort="SYENDDATE" style="color: rgb(35, 113, 174); cursor: pointer;">更新日期</span></th>
<th style="width: 54px;"><span sort="F003N_FUND33" style="cursor: pointer; color: rgb(35, 113, 174);">周收益</span></th>
<th style="width: 54px;"><span sort="F008" style="cursor: pointer; color: rgb(35, 113, 174);">月收益</span></th>
<th style="width: 55px;"><span sort="F009" style="cursor: pointer; color: rgb(35, 113, 174);" class="desc">季收益<b class="desc_item"></b></span></th>
<th style="width: 55px;"><span sort="F011" style="cursor: pointer; color: rgb(35, 113, 174);">年收益</span></th>
<th style="width: 71px;"><span sort="F015N_FUND33" style="cursor: pointer; color: rgb(35, 113, 174);">三年收益</span></th>
<th style="width: 63px;"><span sort="F012" style="cursor: pointer; color: rgb(35, 113, 174);">成立以来<br>收益率</span></th>
<th style="width: 63px;"><span style="cursor: pointer; color: rgb(35, 113, 174);">当前价格</spn></th>
<th style="width: 63px;"><span style="cursor: pointer; color: rgb(35, 113, 174);">今日涨跌</spn></th>
</tr>
</thead>
<tbody>
<tr v-for="(e,index) in etflist">
<td>{{index+1}}</td>
<td><a v-bind:href='"http://quote.eastmoney.com/"+e.code+".html"' target=_blank>{{e.code}}</a></td>
<td>{{e.name}}</td>
<td>{{e.orgname}}</td>
<td>{{e.SYENDDATE}}</td>
<td>
<font color="#ef3432" v-if="e.F003N_FUND33 >= 0">{{e.F003N_FUND33}}%</font>
<font color="#34ef32" v-if="e.F003N_FUND33 <0">{{e.F003N_FUND33}}%</font>
</td>
<td>
<font color="#ef3432" v-if="e.F008 >= 0">{{e.F008}}%</font>
<font color="#34ef32" v-if="e.F008 <0">{{e.F008}}%</font>
</td>
<td>
<font color="#ef3432" v-if="e.F009 >= 0">{{e.F009}}%</font>
<font color="#34ef32" v-if="e.F009 <0">{{e.F009}}%</font>
</td>
<td>
<font color="#ef3432" v-if="e.F011 >=0">{{e.F011}}%</font>
<font color="#34ef32" v-if="e.F011 <0">{{e.F011}}%</font>
</td>
<td>
<font color="#ef3432" v-if="e.F015N_FUND33 >= 0">{{e.F015N_FUND33}}%</font>
<font color="#34ef32" v-if="e.F015N_FUND33 <0">{{e.F015N_FUND33}}%</font>
</td>
<td>
<font color="#ef3432" v-if="e.F012 >= 0">{{e.F012}}%</font>
<font color="#34ef32" v-if="e.F012 <0">{{e.F012}}%</font>
</td>
<td>
<span v-if="result[e.code]">{{result[e.code][1]}}</span>
</td>
<td>
<span v-if="result[e.code]">
<a v-bind:href='"https://gu.qq.com/"+e.code' target=_blank ><font color="#ef3432" v-if="result[e.code][2] >= 0">{{result[e.code][2]}}%</font>
<font color="#34ef32" v-if="result[e.code][2] < 0">{{result[e.code][2]}}%</font>
</a>
</span>
</tr>
</tbody>
</table>
</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 src="http://www.zhanluejia.net.cn/corlate/js/jquery.js"></script>
<script src="http://www.zhanluejia.net.cn/corlate/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://www.zhanluejia.net.cn/static/js/jquery.fitvids.js?v=0e648b2512"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/3.1.0/vue.global.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>
var win = window
function formatData(code,datas){
var name = datas[0]
var close1 = datas[2]
var close = datas[3]
var rise = 100 * (close - close1) / close1
if (String(parseFloat(rise)) != "NaN"){ //NaN 是无法直接比较的
rise = parseFloat(rise).toFixed(2)
} else {
rise = 0.000
}
close = parseFloat(close).toFixed(2)
vue.$data.result[code]=[name,close,rise]
vue.$data.result[code.slice(2,8)]=[name,close,rise]
console.log(name,close,rise)
}
async function getstocks(that){
stocklist = that.stocklist
for (i=0 ; i < stocklist.length;i+=100){
params = stocklist.slice(i,i+100).join()
response = await axios.get(apihost+"/?list="+params)
var hq_str_sys_auth;
eval(response.data)
// 服务器返回错误,上面的定义就会在eval时候被赋值
if (hq_str_sys_auth=="FAILED"){
return
}
console.log(response)
}
stocklist.forEach(function(item){
eval('win.'+item +'= hq_str_'+item)
var datas= win[item].split(',')
formatData(item,datas)
})
that.load = 1
that.$nextTick(function(){
tableClass()
});
setTimeout("tableClass()",1000 );
}
function tostocklist(that){
stocklist = []
for (i=0;i<that.etflist.length;i++){
code = that.etflist[i]['code']
if (code > 500000){
stocklist.push('sh'+code)
} else {
stocklist.push('sz'+code)
}
}
return stocklist
}
function tableClass(){
tables = document.getElementsByTagName('table')
for (i=0;i<tables.length;i++){
tables[i].className = 'table table-bordered'
tables[i].border = '1'
}
}
async function getDatas(that){
response = await axios.get(apihost+"/data/Net/info/ETF_F009_desc_0_0_1_9999_0_0_0_jsonp_g.html")
content = document.getElementById('content')
console.log(response.data)
vue.$data.etflist = response.data
that.load = 1
tableClass()
setTimeout("tableClass()",1000 );
that.stocklist = tostocklist(that)
getstocks(that)
}
var hostname = window.location.hostname
var host = window.location.host
if (hostname == ""){
hostname = "127.0.0.1"
apihost = "http://127.0.0.1:9999"
} else {
apihost = "http://"+host
}
const VueApp = {
data() {
return {
load:0,
result:{},
etflist:[],
stocklist:[],
}
},
created() {
},
mounted () {
var that = this
getDatas(that)
},
methods: {
refresh(e){
var that = this
getstocks(that)
}
}
}//VueApp
window.vue = Vue.createApp(VueApp).mount('#app')
</script>
</body>
</html>