koishi-plugin-monetary-bank 2.0.0 → 2.0.1

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.
Files changed (3) hide show
  1. package/package.json +2 -2
  2. package/readme.md +7 -2
  3. package/src/templates.ts +465 -465
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-monetary-bank",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "main": "lib/index.js",
5
5
  "typings": "lib/index.d.ts",
6
6
  "files": [
@@ -43,7 +43,7 @@
43
43
  "url": "https://github.com/BYWled/koishi-plugin-monetary-bank"
44
44
  },
45
45
  "peerDependencies": {
46
- "koishi": "4.18.9",
46
+ "koishi": "^4.18.0",
47
47
  "koishi-plugin-monetary": "0.1.3"
48
48
  },
49
49
  "dependencies": {
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # koishi-plugin-monetary-bank | 货币银行
2
2
 
3
- [![npm](https://img.shields.io/npm/v/koishi-plugin-monetary-bank?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-monetary-bank)
3
+ [![npm](https://img.shields.io/npm/v/koishi-plugin-monetary-bank?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-monetary-bank) [![GitHub stars](https://img.shields.io/github/stars/BYWled/koishi-plugin-monetary-bank?style=flat-square&logo=github)](https://github.com/BYWled/koishi-plugin-monetary-bank) [![Gitee](https://img.shields.io/badge/Gitee-Project-c71d23?style=flat-square&logo=gitee&logoColor=white)](https://gitee.com/BYWled/koishi-plugin-monetary-bank)
4
4
 
5
5
  `Provides banking related services for monetary money`
6
6
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  ---
10
10
 
11
- **版本**: v2.0.0-Alpha.1
11
+ **版本**: v2.0.1
12
12
 
13
13
  **主要更新**
14
14
  - 🎨 **图形化交互**: 引入完整的图形化界面系统(需 puppeteer),提供精美的视觉体验。
@@ -223,6 +223,11 @@ const image = await ctx.puppeteer.render(html);
223
223
 
224
224
  ## 📝 更新日志
225
225
 
226
+ ### v2.0.1
227
+
228
+ - **修复**: 安装插件时对新版本的Koishi显示不兼容的问题。
229
+ - **文档**: 同步更新Github和Gitee至README。
230
+
226
231
  ### v2.0.0-Alpha.1
227
232
  **🎨 图形化大版本更新**
228
233
 
package/src/templates.ts CHANGED
@@ -1,465 +1,465 @@
1
- /**
2
- * HTML模板工具文件
3
- * 提供统一的样式和布局模板
4
- */
5
-
6
- /**
7
- * 通用HTML模板基础
8
- */
9
- export function getBaseTemplate(content: string, width: number = 800): string {
10
- return `
11
- <!DOCTYPE html>
12
- <html>
13
- <head>
14
- <meta charset="UTF-8">
15
- <style>
16
- * { margin: 0; padding: 0; box-sizing: border-box; }
17
- body {
18
- width: ${width}px;
19
- padding: 28px;
20
- font-family: 'Inter', 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
21
- background: linear-gradient(135deg, #eef2f7 0%, #f5f7fb 100%);
22
- color: #2b2b2b;
23
- }
24
- .container {
25
- background: radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.08), transparent 35%),
26
- radial-gradient(circle at 80% 0%, rgba(118, 75, 162, 0.08), transparent 30%),
27
- #ffffff;
28
- border-radius: 18px;
29
- padding: 30px;
30
- box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
31
- border: 1px solid rgba(255, 255, 255, 0.6);
32
- }
33
- .header {
34
- display: flex;
35
- justify-content: space-between;
36
- align-items: center;
37
- margin-bottom: 28px;
38
- padding-bottom: 18px;
39
- border-bottom: 1px solid #e6e8ee;
40
- }
41
- .header-left {
42
- display: flex;
43
- align-items: center;
44
- gap: 12px;
45
- }
46
- .icon { font-size: 30px; }
47
- .title { font-size: 23px; font-weight: 650; color: #1f1f1f; }
48
- .username {
49
- font-size: 15px;
50
- color: #4a5568;
51
- padding: 6px 14px;
52
- background: #f2f4f7;
53
- border-radius: 16px;
54
- border: 1px solid #e5e7eb;
55
- }
56
- .footer {
57
- text-align: center;
58
- padding-top: 18px;
59
- margin-top: 22px;
60
- border-top: 1px solid #e6e8ee;
61
- color: #9aa0b5;
62
- font-size: 12px;
63
- }
64
-
65
- /* 卡片样式 */
66
- .card {
67
- background: linear-gradient(180deg, #ffffff 0%, #fdfdff 100%);
68
- border-radius: 14px;
69
- padding: 22px;
70
- margin-bottom: 18px;
71
- border: 1px solid #eef1f5;
72
- box-shadow: 0 12px 30px rgba(31, 41, 55, 0.08);
73
- }
74
- .card.success { border-left: 4px solid #4ade80; }
75
- .card.info { border-left: 4px solid #60a5fa; }
76
- .card.warning { border-left: 4px solid #fbbf24; }
77
-
78
- /* 余额展示 */
79
- .balance-section {
80
- text-align: center;
81
- padding: 30px;
82
- background: linear-gradient(135deg, #5b7cfa 0%, #7f5af0 100%);
83
- border-radius: 14px;
84
- margin-bottom: 22px;
85
- color: white;
86
- box-shadow: 0 14px 40px rgba(89, 114, 255, 0.28);
87
- }
88
- .balance-label {
89
- font-size: 13px;
90
- opacity: 0.92;
91
- margin-bottom: 6px;
92
- letter-spacing: 0.5px;
93
- }
94
- .balance-value {
95
- font-size: 44px;
96
- font-weight: 760;
97
- margin-bottom: 4px;
98
- }
99
- .balance-currency {
100
- font-size: 20px;
101
- opacity: 0.9;
102
- }
103
-
104
- /* 网格布局 */
105
- .grid {
106
- display: grid;
107
- grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
108
- gap: 16px;
109
- margin-bottom: 20px;
110
- }
111
- .grid-item {
112
- background: #fafafa;
113
- border-radius: 12px;
114
- padding: 24px;
115
- border-left: 4px solid;
116
- }
117
- .grid-item.demand {
118
- border-left-color: #52c41a;
119
- }
120
- .grid-item.fixed {
121
- border-left-color: #1890ff;
122
- }
123
- .grid-item.cash {
124
- border-left-color: #fa8c16;
125
- }
126
- .grid-item.bank {
127
- border-left-color: #13c2c2;
128
- }
129
-
130
- .item-header {
131
- display: flex;
132
- align-items: center;
133
- gap: 8px;
134
- margin-bottom: 16px;
135
- }
136
- .item-icon {
137
- font-size: 20px;
138
- }
139
- .item-title {
140
- font-size: 14px;
141
- color: #666;
142
- font-weight: 500;
143
- }
144
- .item-value {
145
- font-size: 32px;
146
- font-weight: 700;
147
- color: #333;
148
- margin-bottom: 8px;
149
- }
150
- .item-subtitle {
151
- font-size: 14px;
152
- color: #999;
153
- }
154
-
155
- /* 信息行 */
156
- .info-row {
157
- display: flex;
158
- justify-content: space-between;
159
- align-items: center;
160
- padding: 16px 0;
161
- border-bottom: 1px solid #f0f0f0;
162
- }
163
- .info-row:last-child {
164
- border-bottom: none;
165
- }
166
- .info-label {
167
- font-size: 14px;
168
- color: #666;
169
- }
170
- .info-value {
171
- font-size: 16px;
172
- font-weight: 600;
173
- color: #333;
174
- }
175
- .info-value.success {
176
- color: #52c41a;
177
- }
178
- .info-value.error {
179
- color: #f5222d;
180
- }
181
-
182
- /* 列表样式 */
183
- .list-item {
184
- background: #fafafa;
185
- border-radius: 8px;
186
- padding: 16px;
187
- margin-bottom: 12px;
188
- display: flex;
189
- justify-content: space-between;
190
- align-items: center;
191
- }
192
- .list-item:hover {
193
- background: #f0f0f0;
194
- }
195
- .list-left {
196
- flex: 1;
197
- }
198
- .list-title {
199
- font-size: 16px;
200
- font-weight: 600;
201
- color: #333;
202
- margin-bottom: 4px;
203
- }
204
- .list-subtitle {
205
- font-size: 12px;
206
- color: #999;
207
- }
208
- .list-right {
209
- text-align: right;
210
- }
211
- .list-amount {
212
- font-size: 18px;
213
- font-weight: 700;
214
- color: #333;
215
- }
216
- .list-status {
217
- font-size: 12px;
218
- padding: 2px 8px;
219
- border-radius: 4px;
220
- margin-top: 4px;
221
- display: inline-block;
222
- }
223
- .list-status.active {
224
- background: #f6ffed;
225
- color: #52c41a;
226
- }
227
- .list-status.pending {
228
- background: #e6f7ff;
229
- color: #1890ff;
230
- }
231
-
232
- /* 命令网格 */
233
- .cmd-grid {
234
- display: grid;
235
- grid-template-columns: repeat(2, 1fr);
236
- gap: 16px;
237
- margin-bottom: 24px;
238
- }
239
- .cmd-item {
240
- background: #fafafa;
241
- border-radius: 12px;
242
- padding: 24px;
243
- text-align: center;
244
- cursor: pointer;
245
- transition: all 0.3s;
246
- border: 2px solid transparent;
247
- }
248
- .cmd-item:hover {
249
- background: #f0f0f0;
250
- border-color: #667eea;
251
- transform: translateY(-2px);
252
- }
253
- .cmd-icon {
254
- font-size: 36px;
255
- margin-bottom: 12px;
256
- }
257
- .cmd-name {
258
- font-size: 16px;
259
- font-weight: 600;
260
- color: #333;
261
- margin-bottom: 8px;
262
- }
263
- .cmd-desc {
264
- font-size: 12px;
265
- color: #999;
266
- }
267
-
268
- /* 提示框 */
269
- .prompt-box {
270
- border-radius: 12px;
271
- padding: 20px;
272
- margin-bottom: 24px;
273
- border-left: 4px solid;
274
- }
275
- .prompt-box.info {
276
- background: #e6f7ff;
277
- border-left-color: #1890ff;
278
- }
279
- .prompt-box.warning {
280
- background: #fffbe6;
281
- border-left-color: #faad14;
282
- }
283
- .prompt-box.success {
284
- background: #f6ffed;
285
- border-left-color: #52c41a;
286
- }
287
- .prompt-title {
288
- font-size: 16px;
289
- font-weight: 600;
290
- color: #333;
291
- margin-bottom: 8px;
292
- }
293
- .prompt-message {
294
- font-size: 14px;
295
- color: #666;
296
- line-height: 1.6;
297
- }
298
-
299
- /* 确认对话框 */
300
- .confirm-dialog {
301
- background: #fafafa;
302
- border-radius: 12px;
303
- padding: 24px;
304
- margin-bottom: 24px;
305
- }
306
- .confirm-title {
307
- font-size: 18px;
308
- font-weight: 600;
309
- color: #333;
310
- margin-bottom: 20px;
311
- text-align: center;
312
- }
313
- .confirm-row {
314
- display: flex;
315
- justify-content: space-between;
316
- padding: 12px 0;
317
- border-bottom: 1px solid #e8e8e8;
318
- }
319
- .confirm-row:last-child {
320
- border-bottom: none;
321
- }
322
- .confirm-label {
323
- font-size: 14px;
324
- color: #666;
325
- }
326
- .confirm-value {
327
- font-size: 14px;
328
- font-weight: 600;
329
- color: #333;
330
- }
331
- .confirm-hint {
332
- margin-top: 20px;
333
- padding: 12px;
334
- background: #e6f7ff;
335
- border-radius: 8px;
336
- text-align: center;
337
- font-size: 13px;
338
- color: #1890ff;
339
- }
340
- </style>
341
- </head>
342
- <body>
343
- <div class="container">
344
- ${content}
345
- <div class="footer">
346
- Powered by Koishi Monetary Bank
347
- </div>
348
- </div>
349
- </body>
350
- </html>
351
- `
352
- }
353
-
354
- /**
355
- * 页面头部
356
- */
357
- export function renderHeader(icon: string, title: string, username: string): string {
358
- return `
359
- <div class="header">
360
- <div class="header-left">
361
- <span class="icon">${icon}</span>
362
- <span class="title">${title}</span>
363
- </div>
364
- <div class="username">${username}</div>
365
- </div>
366
- `
367
- }
368
-
369
- /**
370
- * 余额卡片(大标题样式)
371
- */
372
- export function renderBalanceCard(label: string, value: number, currency: string): string {
373
- return `
374
- <div class="balance-section">
375
- <div class="balance-label">${label}</div>
376
- <div class="balance-value">${value.toLocaleString()}</div>
377
- <div class="balance-currency">${currency}</div>
378
- </div>
379
- `
380
- }
381
-
382
- /**
383
- * 网格项
384
- */
385
- export function renderGridItem(
386
- icon: string,
387
- title: string,
388
- value: number,
389
- subtitle: string,
390
- type: 'demand' | 'fixed' | 'cash' | 'bank'
391
- ): string {
392
- return `
393
- <div class="grid-item ${type}">
394
- <div class="item-header">
395
- <span class="item-icon">${icon}</span>
396
- <span class="item-title">${title}</span>
397
- </div>
398
- <div class="item-value">${value.toLocaleString()}</div>
399
- <div class="item-subtitle">${subtitle}</div>
400
- </div>
401
- `
402
- }
403
-
404
- /**
405
- * 信息行
406
- */
407
- export function renderInfoRow(label: string, value: string, valueClass: '' | 'success' | 'error' = ''): string {
408
- return `
409
- <div class="info-row">
410
- <span class="info-label">${label}</span>
411
- <span class="info-value ${valueClass}">${value}</span>
412
- </div>
413
- `
414
- }
415
-
416
- /**
417
- * 命令按钮网格
418
- */
419
- export function renderCommandGrid(commands: Array<{ icon: string; name: string; desc: string }>): string {
420
- const items = commands.map(cmd => `
421
- <div class="cmd-item">
422
- <div class="cmd-icon">${cmd.icon}</div>
423
- <div class="cmd-name">${cmd.name}</div>
424
- <div class="cmd-desc">${cmd.desc}</div>
425
- </div>
426
- `).join('')
427
-
428
- return `
429
- <div class="cmd-grid">
430
- ${items}
431
- </div>
432
- `
433
- }
434
-
435
- /**
436
- * 提示信息框
437
- */
438
- export function renderPromptBox(title: string, message: string, type: 'info' | 'warning' | 'success' = 'info'): string {
439
- return `
440
- <div class="prompt-box ${type}">
441
- <div class="prompt-title">${title}</div>
442
- <div class="prompt-message">${message}</div>
443
- </div>
444
- `
445
- }
446
-
447
- /**
448
- * 确认对话框样式
449
- */
450
- export function renderConfirmDialog(title: string, items: Array<{ label: string; value: string }>): string {
451
- const rows = items.map(item => `
452
- <div class="confirm-row">
453
- <span class="confirm-label">${item.label}:</span>
454
- <span class="confirm-value">${item.value}</span>
455
- </div>
456
- `).join('')
457
-
458
- return `
459
- <div class="confirm-dialog">
460
- <div class="confirm-title">${title}</div>
461
- ${rows}
462
- <div class="confirm-hint">请回复 yes 或 y 确认,其他内容取消</div>
463
- </div>
464
- `
465
- }
1
+ /**
2
+ * HTML模板工具文件
3
+ * 提供统一的样式和布局模板
4
+ */
5
+
6
+ /**
7
+ * 通用HTML模板基础
8
+ */
9
+ export function getBaseTemplate(content: string, width: number = 800): string {
10
+ return `
11
+ <!DOCTYPE html>
12
+ <html>
13
+ <head>
14
+ <meta charset="UTF-8">
15
+ <style>
16
+ * { margin: 0; padding: 0; box-sizing: border-box; }
17
+ body {
18
+ width: ${width}px;
19
+ padding: 28px;
20
+ font-family: 'Inter', 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
21
+ background: linear-gradient(135deg, #eef2f7 0%, #f5f7fb 100%);
22
+ color: #2b2b2b;
23
+ }
24
+ .container {
25
+ background: radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.08), transparent 35%),
26
+ radial-gradient(circle at 80% 0%, rgba(118, 75, 162, 0.08), transparent 30%),
27
+ #ffffff;
28
+ border-radius: 18px;
29
+ padding: 30px;
30
+ box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
31
+ border: 1px solid rgba(255, 255, 255, 0.6);
32
+ }
33
+ .header {
34
+ display: flex;
35
+ justify-content: space-between;
36
+ align-items: center;
37
+ margin-bottom: 28px;
38
+ padding-bottom: 18px;
39
+ border-bottom: 1px solid #e6e8ee;
40
+ }
41
+ .header-left {
42
+ display: flex;
43
+ align-items: center;
44
+ gap: 12px;
45
+ }
46
+ .icon { font-size: 30px; }
47
+ .title { font-size: 23px; font-weight: 650; color: #1f1f1f; }
48
+ .username {
49
+ font-size: 15px;
50
+ color: #4a5568;
51
+ padding: 6px 14px;
52
+ background: #f2f4f7;
53
+ border-radius: 16px;
54
+ border: 1px solid #e5e7eb;
55
+ }
56
+ .footer {
57
+ text-align: center;
58
+ padding-top: 18px;
59
+ margin-top: 22px;
60
+ border-top: 1px solid #e6e8ee;
61
+ color: #9aa0b5;
62
+ font-size: 12px;
63
+ }
64
+
65
+ /* 卡片样式 */
66
+ .card {
67
+ background: linear-gradient(180deg, #ffffff 0%, #fdfdff 100%);
68
+ border-radius: 14px;
69
+ padding: 22px;
70
+ margin-bottom: 18px;
71
+ border: 1px solid #eef1f5;
72
+ box-shadow: 0 12px 30px rgba(31, 41, 55, 0.08);
73
+ }
74
+ .card.success { border-left: 4px solid #4ade80; }
75
+ .card.info { border-left: 4px solid #60a5fa; }
76
+ .card.warning { border-left: 4px solid #fbbf24; }
77
+
78
+ /* 余额展示 */
79
+ .balance-section {
80
+ text-align: center;
81
+ padding: 30px;
82
+ background: linear-gradient(135deg, #5b7cfa 0%, #7f5af0 100%);
83
+ border-radius: 14px;
84
+ margin-bottom: 22px;
85
+ color: white;
86
+ box-shadow: 0 14px 40px rgba(89, 114, 255, 0.28);
87
+ }
88
+ .balance-label {
89
+ font-size: 13px;
90
+ opacity: 0.92;
91
+ margin-bottom: 6px;
92
+ letter-spacing: 0.5px;
93
+ }
94
+ .balance-value {
95
+ font-size: 44px;
96
+ font-weight: 760;
97
+ margin-bottom: 4px;
98
+ }
99
+ .balance-currency {
100
+ font-size: 20px;
101
+ opacity: 0.9;
102
+ }
103
+
104
+ /* 网格布局 */
105
+ .grid {
106
+ display: grid;
107
+ grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
108
+ gap: 16px;
109
+ margin-bottom: 20px;
110
+ }
111
+ .grid-item {
112
+ background: #fafafa;
113
+ border-radius: 12px;
114
+ padding: 24px;
115
+ border-left: 4px solid;
116
+ }
117
+ .grid-item.demand {
118
+ border-left-color: #52c41a;
119
+ }
120
+ .grid-item.fixed {
121
+ border-left-color: #1890ff;
122
+ }
123
+ .grid-item.cash {
124
+ border-left-color: #fa8c16;
125
+ }
126
+ .grid-item.bank {
127
+ border-left-color: #13c2c2;
128
+ }
129
+
130
+ .item-header {
131
+ display: flex;
132
+ align-items: center;
133
+ gap: 8px;
134
+ margin-bottom: 16px;
135
+ }
136
+ .item-icon {
137
+ font-size: 20px;
138
+ }
139
+ .item-title {
140
+ font-size: 14px;
141
+ color: #666;
142
+ font-weight: 500;
143
+ }
144
+ .item-value {
145
+ font-size: 32px;
146
+ font-weight: 700;
147
+ color: #333;
148
+ margin-bottom: 8px;
149
+ }
150
+ .item-subtitle {
151
+ font-size: 14px;
152
+ color: #999;
153
+ }
154
+
155
+ /* 信息行 */
156
+ .info-row {
157
+ display: flex;
158
+ justify-content: space-between;
159
+ align-items: center;
160
+ padding: 16px 0;
161
+ border-bottom: 1px solid #f0f0f0;
162
+ }
163
+ .info-row:last-child {
164
+ border-bottom: none;
165
+ }
166
+ .info-label {
167
+ font-size: 14px;
168
+ color: #666;
169
+ }
170
+ .info-value {
171
+ font-size: 16px;
172
+ font-weight: 600;
173
+ color: #333;
174
+ }
175
+ .info-value.success {
176
+ color: #52c41a;
177
+ }
178
+ .info-value.error {
179
+ color: #f5222d;
180
+ }
181
+
182
+ /* 列表样式 */
183
+ .list-item {
184
+ background: #fafafa;
185
+ border-radius: 8px;
186
+ padding: 16px;
187
+ margin-bottom: 12px;
188
+ display: flex;
189
+ justify-content: space-between;
190
+ align-items: center;
191
+ }
192
+ .list-item:hover {
193
+ background: #f0f0f0;
194
+ }
195
+ .list-left {
196
+ flex: 1;
197
+ }
198
+ .list-title {
199
+ font-size: 16px;
200
+ font-weight: 600;
201
+ color: #333;
202
+ margin-bottom: 4px;
203
+ }
204
+ .list-subtitle {
205
+ font-size: 12px;
206
+ color: #999;
207
+ }
208
+ .list-right {
209
+ text-align: right;
210
+ }
211
+ .list-amount {
212
+ font-size: 18px;
213
+ font-weight: 700;
214
+ color: #333;
215
+ }
216
+ .list-status {
217
+ font-size: 12px;
218
+ padding: 2px 8px;
219
+ border-radius: 4px;
220
+ margin-top: 4px;
221
+ display: inline-block;
222
+ }
223
+ .list-status.active {
224
+ background: #f6ffed;
225
+ color: #52c41a;
226
+ }
227
+ .list-status.pending {
228
+ background: #e6f7ff;
229
+ color: #1890ff;
230
+ }
231
+
232
+ /* 命令网格 */
233
+ .cmd-grid {
234
+ display: grid;
235
+ grid-template-columns: repeat(2, 1fr);
236
+ gap: 16px;
237
+ margin-bottom: 24px;
238
+ }
239
+ .cmd-item {
240
+ background: #fafafa;
241
+ border-radius: 12px;
242
+ padding: 24px;
243
+ text-align: center;
244
+ cursor: pointer;
245
+ transition: all 0.3s;
246
+ border: 2px solid transparent;
247
+ }
248
+ .cmd-item:hover {
249
+ background: #f0f0f0;
250
+ border-color: #667eea;
251
+ transform: translateY(-2px);
252
+ }
253
+ .cmd-icon {
254
+ font-size: 36px;
255
+ margin-bottom: 12px;
256
+ }
257
+ .cmd-name {
258
+ font-size: 16px;
259
+ font-weight: 600;
260
+ color: #333;
261
+ margin-bottom: 8px;
262
+ }
263
+ .cmd-desc {
264
+ font-size: 12px;
265
+ color: #999;
266
+ }
267
+
268
+ /* 提示框 */
269
+ .prompt-box {
270
+ border-radius: 12px;
271
+ padding: 20px;
272
+ margin-bottom: 24px;
273
+ border-left: 4px solid;
274
+ }
275
+ .prompt-box.info {
276
+ background: #e6f7ff;
277
+ border-left-color: #1890ff;
278
+ }
279
+ .prompt-box.warning {
280
+ background: #fffbe6;
281
+ border-left-color: #faad14;
282
+ }
283
+ .prompt-box.success {
284
+ background: #f6ffed;
285
+ border-left-color: #52c41a;
286
+ }
287
+ .prompt-title {
288
+ font-size: 16px;
289
+ font-weight: 600;
290
+ color: #333;
291
+ margin-bottom: 8px;
292
+ }
293
+ .prompt-message {
294
+ font-size: 14px;
295
+ color: #666;
296
+ line-height: 1.6;
297
+ }
298
+
299
+ /* 确认对话框 */
300
+ .confirm-dialog {
301
+ background: #fafafa;
302
+ border-radius: 12px;
303
+ padding: 24px;
304
+ margin-bottom: 24px;
305
+ }
306
+ .confirm-title {
307
+ font-size: 18px;
308
+ font-weight: 600;
309
+ color: #333;
310
+ margin-bottom: 20px;
311
+ text-align: center;
312
+ }
313
+ .confirm-row {
314
+ display: flex;
315
+ justify-content: space-between;
316
+ padding: 12px 0;
317
+ border-bottom: 1px solid #e8e8e8;
318
+ }
319
+ .confirm-row:last-child {
320
+ border-bottom: none;
321
+ }
322
+ .confirm-label {
323
+ font-size: 14px;
324
+ color: #666;
325
+ }
326
+ .confirm-value {
327
+ font-size: 14px;
328
+ font-weight: 600;
329
+ color: #333;
330
+ }
331
+ .confirm-hint {
332
+ margin-top: 20px;
333
+ padding: 12px;
334
+ background: #e6f7ff;
335
+ border-radius: 8px;
336
+ text-align: center;
337
+ font-size: 13px;
338
+ color: #1890ff;
339
+ }
340
+ </style>
341
+ </head>
342
+ <body>
343
+ <div class="container">
344
+ ${content}
345
+ <div class="footer">
346
+ Powered by Koishi Monetary Bank
347
+ </div>
348
+ </div>
349
+ </body>
350
+ </html>
351
+ `
352
+ }
353
+
354
+ /**
355
+ * 页面头部
356
+ */
357
+ export function renderHeader(icon: string, title: string, username: string): string {
358
+ return `
359
+ <div class="header">
360
+ <div class="header-left">
361
+ <span class="icon">${icon}</span>
362
+ <span class="title">${title}</span>
363
+ </div>
364
+ <div class="username">${username}</div>
365
+ </div>
366
+ `
367
+ }
368
+
369
+ /**
370
+ * 余额卡片(大标题样式)
371
+ */
372
+ export function renderBalanceCard(label: string, value: number, currency: string): string {
373
+ return `
374
+ <div class="balance-section">
375
+ <div class="balance-label">${label}</div>
376
+ <div class="balance-value">${value.toLocaleString()}</div>
377
+ <div class="balance-currency">${currency}</div>
378
+ </div>
379
+ `
380
+ }
381
+
382
+ /**
383
+ * 网格项
384
+ */
385
+ export function renderGridItem(
386
+ icon: string,
387
+ title: string,
388
+ value: number,
389
+ subtitle: string,
390
+ type: 'demand' | 'fixed' | 'cash' | 'bank'
391
+ ): string {
392
+ return `
393
+ <div class="grid-item ${type}">
394
+ <div class="item-header">
395
+ <span class="item-icon">${icon}</span>
396
+ <span class="item-title">${title}</span>
397
+ </div>
398
+ <div class="item-value">${value.toLocaleString()}</div>
399
+ <div class="item-subtitle">${subtitle}</div>
400
+ </div>
401
+ `
402
+ }
403
+
404
+ /**
405
+ * 信息行
406
+ */
407
+ export function renderInfoRow(label: string, value: string, valueClass: '' | 'success' | 'error' = ''): string {
408
+ return `
409
+ <div class="info-row">
410
+ <span class="info-label">${label}</span>
411
+ <span class="info-value ${valueClass}">${value}</span>
412
+ </div>
413
+ `
414
+ }
415
+
416
+ /**
417
+ * 命令按钮网格
418
+ */
419
+ export function renderCommandGrid(commands: Array<{ icon: string; name: string; desc: string }>): string {
420
+ const items = commands.map(cmd => `
421
+ <div class="cmd-item">
422
+ <div class="cmd-icon">${cmd.icon}</div>
423
+ <div class="cmd-name">${cmd.name}</div>
424
+ <div class="cmd-desc">${cmd.desc}</div>
425
+ </div>
426
+ `).join('')
427
+
428
+ return `
429
+ <div class="cmd-grid">
430
+ ${items}
431
+ </div>
432
+ `
433
+ }
434
+
435
+ /**
436
+ * 提示信息框
437
+ */
438
+ export function renderPromptBox(title: string, message: string, type: 'info' | 'warning' | 'success' = 'info'): string {
439
+ return `
440
+ <div class="prompt-box ${type}">
441
+ <div class="prompt-title">${title}</div>
442
+ <div class="prompt-message">${message}</div>
443
+ </div>
444
+ `
445
+ }
446
+
447
+ /**
448
+ * 确认对话框样式
449
+ */
450
+ export function renderConfirmDialog(title: string, items: Array<{ label: string; value: string }>): string {
451
+ const rows = items.map(item => `
452
+ <div class="confirm-row">
453
+ <span class="confirm-label">${item.label}:</span>
454
+ <span class="confirm-value">${item.value}</span>
455
+ </div>
456
+ `).join('')
457
+
458
+ return `
459
+ <div class="confirm-dialog">
460
+ <div class="confirm-title">${title}</div>
461
+ ${rows}
462
+ <div class="confirm-hint">请回复 yes 或 y 确认,其他内容取消</div>
463
+ </div>
464
+ `
465
+ }