-
Notifications
You must be signed in to change notification settings - Fork 21
/
base.html
137 lines (96 loc) · 3.37 KB
/
base.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
<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">
<title>Klang(金浪)板块实时数据</title>
</head>
<body>
<div id="app">
<div v-if="load" class="row" style="width:60%%;margin:100px;">
%s
</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="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>
%s
<script>
var win = window
function tableClass(){
tables = document.getElementsByTagName('table')
for (i=0;i<tables.length;i++){
tables[i].className = 'table table-bordered'
}
}
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
}
vue.$data.result[code]=[name,close,rise]
console.log(name,close,rise)
}
async function getDatas(that){
for (i=0 ; i < stocklist.length;i+=100){
params = stocklist.slice(i,i+100).join()
response = await axios.get(apihost+"/?list="+params)
eval(response.data)
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 );
}
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:{},
}
},
created() {
},
mounted () {
var that = this
getDatas(that)
},
methods: {
refresh(e){
var that = this
getDatas(that)
}
}
}//VueApp
window.vue = Vue.createApp(VueApp).mount('#app')
</script>
</body>
</html>