koishi-plugin-monetary-bourse 2.0.3-Alpha.12 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +20 -24
- package/lib/templates/holding-card.html +556 -379
- package/lib/templates/stock-chart.html +478 -468
- package/lib/templates/trade-result.html +624 -559
- package/package.json +1 -1
- package/readme.md +1 -1
|
@@ -1,379 +1,556 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
--
|
|
8
|
-
--
|
|
9
|
-
--
|
|
10
|
-
--
|
|
11
|
-
--
|
|
12
|
-
--
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
--
|
|
17
|
-
|
|
18
|
-
--profit-
|
|
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
|
-
font-
|
|
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
|
-
padding:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.stock-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
font-
|
|
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
|
-
content:
|
|
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
|
-
margin-top:
|
|
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
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
1
|
+
<html>
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<style>
|
|
5
|
+
:root {
|
|
6
|
+
/* 统一配色 (From trade-result) */
|
|
7
|
+
--bg-color: #0c0f15;
|
|
8
|
+
--card-bg: #161b22;
|
|
9
|
+
--item-bg: #1f242e;
|
|
10
|
+
--text-primary: #f0f3f5;
|
|
11
|
+
--text-secondary: #8b949e;
|
|
12
|
+
--border-color: #30363d;
|
|
13
|
+
--accent-color: #58a6ff;
|
|
14
|
+
|
|
15
|
+
/* 兼容变量 & 语义色 */
|
|
16
|
+
--accent-gradient: linear-gradient(135deg, #58a6ff 0%, #2563eb 100%);
|
|
17
|
+
|
|
18
|
+
--profit-up: #f87171;
|
|
19
|
+
--profit-down: #4ade80;
|
|
20
|
+
--profit-up-bg: rgba(248, 113, 113, 0.15);
|
|
21
|
+
--profit-down-bg: rgba(74, 222, 128, 0.15);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
body {
|
|
25
|
+
position: relative;
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 32px;
|
|
28
|
+
font-family: 'Roboto Mono', 'Trebuchet MS', 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
|
|
29
|
+
background-color: var(--bg-color);
|
|
30
|
+
width: 480px;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
color: var(--text-primary);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.card {
|
|
36
|
+
position: relative;
|
|
37
|
+
background-color: var(--card-bg);
|
|
38
|
+
padding: 32px;
|
|
39
|
+
border-radius: 16px;
|
|
40
|
+
box-shadow: 0 32px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-color);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Header */
|
|
44
|
+
.header {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: 16px;
|
|
48
|
+
margin-bottom: 32px;
|
|
49
|
+
padding-bottom: 20px;
|
|
50
|
+
border-bottom: 1px solid var(--border-color);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.avatar {
|
|
54
|
+
width: 56px;
|
|
55
|
+
height: 56px;
|
|
56
|
+
background: var(--accent-gradient);
|
|
57
|
+
border-radius: 16px;
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
color: white;
|
|
62
|
+
font-size: 24px;
|
|
63
|
+
font-weight: 700;
|
|
64
|
+
box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.user-info {
|
|
68
|
+
flex: 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.username {
|
|
72
|
+
font-size: 20px;
|
|
73
|
+
font-weight: 700;
|
|
74
|
+
color: var(--text-primary);
|
|
75
|
+
margin-bottom: 4px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.account-label {
|
|
79
|
+
font-size: 13px;
|
|
80
|
+
color: var(--text-secondary);
|
|
81
|
+
font-weight: 500;
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
gap: 6px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.account-label::before {
|
|
88
|
+
content: '';
|
|
89
|
+
display: block;
|
|
90
|
+
width: 6px;
|
|
91
|
+
height: 6px;
|
|
92
|
+
background-color: #22c55e;
|
|
93
|
+
border-radius: 50%;
|
|
94
|
+
box-shadow: 0 0 8px #22c55e;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Sections */
|
|
98
|
+
.section {
|
|
99
|
+
margin-bottom: 36px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.section:last-child {
|
|
103
|
+
margin-bottom: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.section-title {
|
|
107
|
+
font-size: 13px;
|
|
108
|
+
font-weight: 600;
|
|
109
|
+
color: var(--text-secondary);
|
|
110
|
+
margin-bottom: 16px;
|
|
111
|
+
text-transform: uppercase;
|
|
112
|
+
letter-spacing: 1px;
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
gap: 8px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.section-title::after {
|
|
119
|
+
content: '';
|
|
120
|
+
flex: 1;
|
|
121
|
+
height: 1px;
|
|
122
|
+
background: var(--border-color);
|
|
123
|
+
opacity: 0.5;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Stock Card */
|
|
127
|
+
.stock-card {
|
|
128
|
+
background-color: var(--item-bg);
|
|
129
|
+
border-radius: 16px;
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
border: 1px solid var(--border-color);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.stock-header {
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: space-between;
|
|
137
|
+
align-items: center;
|
|
138
|
+
padding: 20px 24px;
|
|
139
|
+
background: rgba(255, 255, 255, 0.02);
|
|
140
|
+
border-bottom: 1px solid var(--border-color);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.stock-name {
|
|
144
|
+
font-size: 18px;
|
|
145
|
+
font-weight: 700;
|
|
146
|
+
color: var(--text-primary);
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
gap: 8px;
|
|
150
|
+
letter-spacing: -0.2px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.stock-amount {
|
|
154
|
+
font-size: 13px;
|
|
155
|
+
font-weight: 600;
|
|
156
|
+
background: rgba(255, 255, 255, 0.1);
|
|
157
|
+
color: var(--text-primary);
|
|
158
|
+
padding: 4px 10px;
|
|
159
|
+
border-radius: 6px;
|
|
160
|
+
font-family: 'Roboto Mono', 'Trebuchet MS', monospace;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.stock-body {
|
|
164
|
+
padding: 24px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.stat-grid {
|
|
168
|
+
display: grid;
|
|
169
|
+
grid-template-columns: 1fr 1fr;
|
|
170
|
+
gap: 20px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.stat-item {
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
gap: 4px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.stat-label {
|
|
180
|
+
font-size: 13px;
|
|
181
|
+
color: var(--text-secondary);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.stat-value {
|
|
185
|
+
font-size: 18px;
|
|
186
|
+
font-weight: 450;
|
|
187
|
+
color: var(--text-primary);
|
|
188
|
+
font-family: 'Roboto Mono', 'Trebuchet MS', monospace;
|
|
189
|
+
letter-spacing: -0.3px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.stat-value.highlight {
|
|
193
|
+
color: var(--accent-color);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Profit Section */
|
|
197
|
+
.profit-section {
|
|
198
|
+
display: flex;
|
|
199
|
+
justify-content: space-between;
|
|
200
|
+
align-items: center;
|
|
201
|
+
padding: 16px 24px;
|
|
202
|
+
border-top: 1px solid var(--border-color);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.profit-label {
|
|
206
|
+
font-size: 13px;
|
|
207
|
+
font-weight: 600;
|
|
208
|
+
color: var(--text-secondary);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.profit-value {
|
|
212
|
+
font-size: 20px;
|
|
213
|
+
font-weight: 700;
|
|
214
|
+
font-family: 'Roboto Mono';
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.profit-percent {
|
|
218
|
+
font-size: 13px;
|
|
219
|
+
font-weight: 600;
|
|
220
|
+
margin-left: 8px;
|
|
221
|
+
opacity: 0.9;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.profit-hint {
|
|
225
|
+
font-size: 15px;
|
|
226
|
+
font-weight: 400;
|
|
227
|
+
display: block;
|
|
228
|
+
margin-top: 4px;
|
|
229
|
+
opacity: 0.7;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* Empty State */
|
|
233
|
+
.empty-state {
|
|
234
|
+
background: var(--item-bg);
|
|
235
|
+
border-radius: 16px;
|
|
236
|
+
padding: 40px 20px;
|
|
237
|
+
text-align: center;
|
|
238
|
+
border: 1px dashed var(--border-color);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.empty-icon {
|
|
242
|
+
font-size: 32px;
|
|
243
|
+
margin-bottom: 12px;
|
|
244
|
+
opacity: 0.5;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.empty-text {
|
|
248
|
+
font-size: 16px;
|
|
249
|
+
color: var(--text-secondary);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* Pending Items - Grid Layout */
|
|
253
|
+
.pending-wrapper {
|
|
254
|
+
display: flex;
|
|
255
|
+
gap: 16px;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.pending-column {
|
|
259
|
+
flex: 1;
|
|
260
|
+
display: flex;
|
|
261
|
+
flex-direction: column;
|
|
262
|
+
gap: 12px;
|
|
263
|
+
min-width: 0;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.column-header {
|
|
267
|
+
font-size: 12px;
|
|
268
|
+
font-weight: 700;
|
|
269
|
+
color: var(--text-secondary);
|
|
270
|
+
text-transform: uppercase;
|
|
271
|
+
letter-spacing: 0.5px;
|
|
272
|
+
margin-bottom: 4px;
|
|
273
|
+
display: flex;
|
|
274
|
+
align-items: center;
|
|
275
|
+
gap: 6px;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.column-header::before {
|
|
279
|
+
content: '';
|
|
280
|
+
display: block;
|
|
281
|
+
width: 6px;
|
|
282
|
+
height: 6px;
|
|
283
|
+
border-radius: 50%;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.column-header.buy::before {
|
|
287
|
+
background-color: var(--profit-up);
|
|
288
|
+
box-shadow: 0 0 8px var(--profit-up);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.column-header.sell::before {
|
|
292
|
+
background-color: var(--profit-down);
|
|
293
|
+
box-shadow: 0 0 8px var(--profit-down);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.pending-list {
|
|
297
|
+
display: flex;
|
|
298
|
+
flex-direction: column;
|
|
299
|
+
gap: 10px;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* Modern Card Item */
|
|
303
|
+
.pending-item {
|
|
304
|
+
background: var(--item-bg);
|
|
305
|
+
border-radius: 12px;
|
|
306
|
+
padding: 12px;
|
|
307
|
+
border: 1px solid var(--border-color);
|
|
308
|
+
display: flex;
|
|
309
|
+
flex-direction: column;
|
|
310
|
+
gap: 8px;
|
|
311
|
+
position: relative;
|
|
312
|
+
overflow: hidden;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/* Top Row */
|
|
316
|
+
.pi-header {
|
|
317
|
+
display: flex;
|
|
318
|
+
justify-content: space-between;
|
|
319
|
+
align-items: center;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.pi-badge {
|
|
323
|
+
font-size: 10px;
|
|
324
|
+
font-weight: 700;
|
|
325
|
+
padding: 2px 6px;
|
|
326
|
+
border-radius: 4px;
|
|
327
|
+
text-transform: uppercase;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.pi-badge.buy {
|
|
331
|
+
background: var(--profit-up-bg);
|
|
332
|
+
color: var(--profit-up);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.pi-badge.sell {
|
|
336
|
+
background: var(--profit-down-bg);
|
|
337
|
+
color: var(--profit-down);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.pi-time {
|
|
341
|
+
font-size: 13px;
|
|
342
|
+
color: var(--text-secondary);
|
|
343
|
+
opacity: 0.8;
|
|
344
|
+
display: flex;
|
|
345
|
+
align-items: center;
|
|
346
|
+
gap: 4px;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/* Middle Row */
|
|
350
|
+
.pi-amount {
|
|
351
|
+
font-size: 18px;
|
|
352
|
+
font-weight: 600;
|
|
353
|
+
color: var(--text-primary);
|
|
354
|
+
font-family: 'Roboto Mono', monospace;
|
|
355
|
+
letter-spacing: -0.5px;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/* Bottom Row */
|
|
359
|
+
.pi-footer {
|
|
360
|
+
display: flex;
|
|
361
|
+
justify-content: space-between;
|
|
362
|
+
align-items: flex-end;
|
|
363
|
+
padding-top: 4px;
|
|
364
|
+
border-top: 1px dashed rgba(255, 255, 255, 0.05);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.pi-price {
|
|
368
|
+
font-size: 14px;
|
|
369
|
+
color: var(--text-secondary);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.pi-cost {
|
|
373
|
+
font-size: 12px;
|
|
374
|
+
color: var(--text-secondary);
|
|
375
|
+
opacity: 0.6;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
#pending-container {
|
|
379
|
+
margin-top: 16px;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* Footer */
|
|
383
|
+
.footer {
|
|
384
|
+
position: absolute;
|
|
385
|
+
bottom: 8px;
|
|
386
|
+
right: 8px;
|
|
387
|
+
font-size: 11px;
|
|
388
|
+
color: var(--text-secondary);
|
|
389
|
+
opacity: 0.6;
|
|
390
|
+
z-index: 2;
|
|
391
|
+
}
|
|
392
|
+
</style>
|
|
393
|
+
</head>
|
|
394
|
+
|
|
395
|
+
<body>
|
|
396
|
+
<div class="card">
|
|
397
|
+
<div class="header">
|
|
398
|
+
<div class="avatar" id="avatar"></div>
|
|
399
|
+
<div class="user-info">
|
|
400
|
+
<div class="username" id="username"></div>
|
|
401
|
+
<div class="account-label">股票账户</div>
|
|
402
|
+
</div>
|
|
403
|
+
</div>
|
|
404
|
+
<div id="holding-container"></div>
|
|
405
|
+
<div id="pending-container"></div>
|
|
406
|
+
<div class="footer" id="footer"></div>
|
|
407
|
+
</div>
|
|
408
|
+
|
|
409
|
+
<script type="application/json" id="data-source">
|
|
410
|
+
{{DATA}}
|
|
411
|
+
</script>
|
|
412
|
+
<script>
|
|
413
|
+
// 从 JSON 标签中读取数据
|
|
414
|
+
const DATA = JSON.parse(document.getElementById('data-source').textContent);
|
|
415
|
+
|
|
416
|
+
// 统一字体:数字和金额统一使用与其他页面一致的等宽字体
|
|
417
|
+
const monoTargets = document.querySelectorAll('.stat-value, .profit-value, .pending-amount, .pending-price, .pending-cost, .pending-type, .stock-amount')
|
|
418
|
+
monoTargets.forEach(el => {
|
|
419
|
+
el.style.fontFamily = "'Roboto Mono','Trebuchet MS','Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif"
|
|
420
|
+
el.style.letterSpacing = '-0.2px'
|
|
421
|
+
})
|
|
422
|
+
|
|
423
|
+
// 渲染用户信息
|
|
424
|
+
document.getElementById('avatar').textContent = DATA.username.charAt(0).toUpperCase();
|
|
425
|
+
document.getElementById('username').textContent = DATA.username;
|
|
426
|
+
document.getElementById('footer').textContent = `数据更新于 ${DATA.updateTime}`;
|
|
427
|
+
|
|
428
|
+
// 渲染持仓信息
|
|
429
|
+
const holdingContainer = document.getElementById('holding-container');
|
|
430
|
+
if (DATA.holding) {
|
|
431
|
+
const h = DATA.holding;
|
|
432
|
+
const hasCostData = h.totalCost !== null;
|
|
433
|
+
const isProfit = hasCostData ? h.profit >= 0 : true;
|
|
434
|
+
|
|
435
|
+
// 适配深色模式的颜色
|
|
436
|
+
const profitColor = isProfit ? '#f87171' : '#4ade80';
|
|
437
|
+
const profitSign = isProfit ? '+' : '';
|
|
438
|
+
const profitBgColor = isProfit ? 'rgba(248, 113, 113, 0.1)' : 'rgba(74, 222, 128, 0.1)';
|
|
439
|
+
|
|
440
|
+
const profitSection = hasCostData ? `
|
|
441
|
+
<div class="profit-section" style="background: ${profitBgColor}">
|
|
442
|
+
<div class="profit-label">盈亏</div>
|
|
443
|
+
<div class="profit-value" style="color: ${profitColor}">
|
|
444
|
+
${profitSign}${h.profit.toFixed(2)} ${DATA.currency}
|
|
445
|
+
<span class="profit-percent">(${profitSign}${h.profitPercent.toFixed(2)}%)</span>
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
` : `
|
|
449
|
+
<div class="profit-section no-data" style="background: rgba(255, 255, 255, 0.03)">
|
|
450
|
+
<div class="profit-label">盈亏</div>
|
|
451
|
+
<div class="profit-value" style="color: #8b919e">
|
|
452
|
+
暂无成本记录
|
|
453
|
+
<span class="profit-hint">(新交易后将自动记录)</span>
|
|
454
|
+
</div>
|
|
455
|
+
</div>
|
|
456
|
+
`;
|
|
457
|
+
|
|
458
|
+
holdingContainer.innerHTML = `
|
|
459
|
+
<div class="section">
|
|
460
|
+
<div class="section-title">持仓详情 Holding</div>
|
|
461
|
+
<div class="stock-card">
|
|
462
|
+
<div class="stock-header">
|
|
463
|
+
<div class="stock-name">
|
|
464
|
+
<span>⚡</span>
|
|
465
|
+
${h.stockName}
|
|
466
|
+
</div>
|
|
467
|
+
<div class="stock-amount">${h.amount} 股</div>
|
|
468
|
+
</div>
|
|
469
|
+
<div class="stock-body">
|
|
470
|
+
<div class="stat-grid">
|
|
471
|
+
<div class="stat-item">
|
|
472
|
+
<div class="stat-label">现价 Current</div>
|
|
473
|
+
<div class="stat-value">${h.currentPrice.toFixed(2)}</div>
|
|
474
|
+
</div>
|
|
475
|
+
<div class="stat-item">
|
|
476
|
+
<div class="stat-label">成本价 Cost</div>
|
|
477
|
+
<div class="stat-value">${hasCostData ? h.avgCost.toFixed(2) : '--'}</div>
|
|
478
|
+
</div>
|
|
479
|
+
<div class="stat-item">
|
|
480
|
+
<div class="stat-label">持仓成本 Total Cost</div>
|
|
481
|
+
<div class="stat-value">${hasCostData ? h.totalCost.toFixed(2) : '--'}</div>
|
|
482
|
+
</div>
|
|
483
|
+
<div class="stat-item">
|
|
484
|
+
<div class="stat-label">市值 Market Value</div>
|
|
485
|
+
<div class="stat-value highlight">${h.marketValue.toFixed(2)}</div>
|
|
486
|
+
</div>
|
|
487
|
+
</div>
|
|
488
|
+
</div>
|
|
489
|
+
${profitSection}
|
|
490
|
+
</div>
|
|
491
|
+
</div>
|
|
492
|
+
`;
|
|
493
|
+
} else {
|
|
494
|
+
holdingContainer.innerHTML = `
|
|
495
|
+
<div class="section">
|
|
496
|
+
<div class="section-title">持仓详情 Holding</div>
|
|
497
|
+
<div class="empty-state">
|
|
498
|
+
<div class="empty-icon">📭</div>
|
|
499
|
+
<div class="empty-text">暂无持仓</div>
|
|
500
|
+
</div>
|
|
501
|
+
</div>
|
|
502
|
+
`;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// 渲染待处理交易
|
|
506
|
+
const pendingContainer = document.getElementById('pending-container');
|
|
507
|
+
if (DATA.pending && DATA.pending.length > 0) {
|
|
508
|
+
const renderItem = (p) => `
|
|
509
|
+
<div class="pending-item">
|
|
510
|
+
<div class="pi-header">
|
|
511
|
+
<span class="pi-badge ${p.typeClass}">${p.type}</span>
|
|
512
|
+
<span class="pi-time">⏱ ${p.timeLeft}</span>
|
|
513
|
+
</div>
|
|
514
|
+
<div class="pi-amount">${p.amount} 股</div>
|
|
515
|
+
<div class="pi-footer">
|
|
516
|
+
<span class="pi-price">@ ${p.price.toFixed(2)}</span>
|
|
517
|
+
<span class="pi-cost">Est. ${p.cost.toFixed(2)}</span>
|
|
518
|
+
</div>
|
|
519
|
+
</div>`;
|
|
520
|
+
|
|
521
|
+
const buys = DATA.pending.filter(p => p.typeClass === 'buy');
|
|
522
|
+
const sells = DATA.pending.filter(p => p.typeClass === 'sell');
|
|
523
|
+
|
|
524
|
+
// Wraps whole pending block in one section, containing a wrapper with columns
|
|
525
|
+
let html = '<div class="section"><div class="section-title">挂单 Pending</div><div class="pending-wrapper">';
|
|
526
|
+
|
|
527
|
+
if (buys.length > 0) {
|
|
528
|
+
html += `
|
|
529
|
+
<div class="pending-column">
|
|
530
|
+
<div class="column-header buy">买入 Buying</div>
|
|
531
|
+
<div class="pending-list">
|
|
532
|
+
${buys.map(renderItem).join('')}
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
`;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if (sells.length > 0) {
|
|
539
|
+
html += `
|
|
540
|
+
<div class="pending-column">
|
|
541
|
+
<div class="column-header sell">卖出 Selling</div>
|
|
542
|
+
<div class="pending-list">
|
|
543
|
+
${sells.map(renderItem).join('')}
|
|
544
|
+
</div>
|
|
545
|
+
</div>
|
|
546
|
+
`;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
html += '</div></div>';
|
|
550
|
+
|
|
551
|
+
pendingContainer.innerHTML = html;
|
|
552
|
+
}
|
|
553
|
+
</script>
|
|
554
|
+
</body>
|
|
555
|
+
|
|
556
|
+
</html>
|