verce-vue-test 0.0.18 → 0.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verce-vue-test",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,20 +1,64 @@
1
1
  <script setup lang="ts">
2
- import { onMounted, ref } from 'vue'
2
+ import { nextTick, onMounted, onUnmounted, ref } from 'vue'
3
3
  import { ArrowDown, Minus, RefreshRight, Setting } from '@element-plus/icons-vue'
4
- import { ringOption, useChartRegistry } from './chart'
4
+ import * as echarts from 'echarts'
5
+ import type { ECharts, EChartsOption } from 'echarts'
5
6
 
6
7
  const balanceChart = ref<HTMLElement>()
7
8
  const quotaChart = ref<HTMLElement>()
8
- const { panelChart, mountCharts } = useChartRegistry()
9
+ const charts: ECharts[] = []
9
10
 
10
- onMounted(() => {
11
- mountCharts(() => {
12
- panelChart(balanceChart.value, ringOption('55%', [
11
+ function createChart(el: HTMLElement | undefined, option: EChartsOption) {
12
+ if (!el) return
13
+ const chart = echarts.init(el)
14
+ chart.setOption(option)
15
+ charts.push(chart)
16
+ }
17
+
18
+ function resizeCharts() {
19
+ charts.forEach((chart) => chart.resize())
20
+ }
21
+
22
+ function ringOption(
23
+ centerText: string,
24
+ data: Array<{ value: number; name: string; itemStyle?: object }>,
25
+ ): EChartsOption {
26
+ return {
27
+ color: ['#1267f2', '#e7f0ff'],
28
+ animationDuration: 900,
29
+ title: {
30
+ text: centerText,
31
+ left: 'center',
32
+ top: '42%',
33
+ textStyle: { color: '#05070b', fontSize: 30, fontWeight: 800 },
34
+ },
35
+ series: [
36
+ {
37
+ type: 'pie',
38
+ radius: ['57%', '77%'],
39
+ center: ['50%', '51%'],
40
+ startAngle: 90,
41
+ avoidLabelOverlap: false,
42
+ label: { show: false },
43
+ labelLine: { show: false },
44
+ itemStyle: { borderColor: '#fff', borderWidth: 4 },
45
+ data,
46
+ },
47
+ ],
48
+ }
49
+ }
50
+
51
+ onMounted(async () => {
52
+ await nextTick()
53
+ createChart(
54
+ balanceChart.value,
55
+ ringOption('55%', [
13
56
  { value: 55, name: '账户余额', itemStyle: { color: '#1267f2' } },
14
57
  { value: 45, name: '其他', itemStyle: { color: '#e7f0ff' } },
15
- ]))
58
+ ]),
59
+ )
16
60
 
17
- panelChart(quotaChart.value, {
61
+ createChart(quotaChart.value, {
18
62
  color: ['#1267f2', '#0b55d9', '#57aaf7', '#bfeeff'],
19
63
  series: [
20
64
  {
@@ -33,7 +77,13 @@ onMounted(() => {
33
77
  },
34
78
  ],
35
79
  })
36
- })
80
+
81
+ window.addEventListener('resize', resizeCharts)
82
+ })
83
+
84
+ onUnmounted(() => {
85
+ window.removeEventListener('resize', resizeCharts)
86
+ charts.forEach((chart) => chart.dispose())
37
87
  })
38
88
  </script>
39
89
 
@@ -92,3 +142,297 @@ onMounted(() => {
92
142
  </div>
93
143
  </article>
94
144
  </template>
145
+
146
+ <style scoped>
147
+ .account-board {
148
+ --blue: #1267f2;
149
+ --line: #dce4ef;
150
+ min-width: 0;
151
+ height: calc(100vh - 190px);
152
+ min-height: 700px;
153
+ padding: 14px;
154
+ display: flex;
155
+ flex-direction: column;
156
+ background: rgba(255, 255, 255, .96);
157
+ border-radius: 10px;
158
+ box-shadow: 0 10px 22px rgba(34, 67, 123, .16);
159
+ }
160
+
161
+ .board-head {
162
+ height: 38px;
163
+ display: flex;
164
+ align-items: flex-start;
165
+ justify-content: space-between;
166
+ }
167
+
168
+ .board-head h2 {
169
+ display: flex;
170
+ align-items: center;
171
+ gap: 10px;
172
+ font-size: 20px;
173
+ line-height: 1.1;
174
+ font-weight: 900;
175
+ }
176
+
177
+ .board-head h2 span {
178
+ width: 13px;
179
+ height: 14px;
180
+ border-radius: 4px;
181
+ background: var(--blue);
182
+ box-shadow: inset 0 0 4px rgba(255, 255, 255, .35);
183
+ }
184
+
185
+ .actions {
186
+ display: flex;
187
+ align-items: center;
188
+ gap: 16px;
189
+ color: #6c7480;
190
+ font-size: 15px;
191
+ }
192
+
193
+ .actions button {
194
+ height: 26px;
195
+ display: flex;
196
+ align-items: center;
197
+ gap: 3px;
198
+ border: 0;
199
+ background: transparent;
200
+ color: #6c7480;
201
+ font-size: 13px;
202
+ font-weight: 600;
203
+ }
204
+
205
+ .account-layout {
206
+ display: grid;
207
+ flex: 1;
208
+ margin-top: 8px;
209
+ gap: 12px;
210
+ grid-template-columns: 1fr 1fr;
211
+ grid-template-rows: minmax(0, 1fr) auto;
212
+ }
213
+
214
+ .metric-box {
215
+ min-width: 0;
216
+ position: relative;
217
+ min-height: 0;
218
+ border: 1px solid var(--line);
219
+ border-radius: 10px;
220
+ background: #fff;
221
+ }
222
+
223
+ .metric-box h3 {
224
+ position: absolute;
225
+ left: 18px;
226
+ top: 18px;
227
+ z-index: 1;
228
+ font-size: 18px;
229
+ font-weight: 900;
230
+ }
231
+
232
+ .ring,
233
+ .pie {
234
+ position: absolute;
235
+ left: 38%;
236
+ top: 53%;
237
+ width: min(58%, 340px);
238
+ height: min(72%, 340px);
239
+ transform: translate(-50%, -50%);
240
+ }
241
+
242
+ .pie {
243
+ left: 36%;
244
+ width: min(60%, 360px);
245
+ height: min(74%, 360px);
246
+ }
247
+
248
+ .balance-copy {
249
+ position: absolute;
250
+ right: 8%;
251
+ top: 50%;
252
+ width: 132px;
253
+ transform: translateY(-42%);
254
+ }
255
+
256
+ .balance-copy p,
257
+ .quota-list li {
258
+ display: flex;
259
+ align-items: center;
260
+ gap: 10px;
261
+ color: #56606d;
262
+ font-size: 15px;
263
+ white-space: nowrap;
264
+ }
265
+
266
+ .balance-copy strong {
267
+ display: block;
268
+ margin: 14px 0 22px 20px;
269
+ font-size: 32px;
270
+ font-weight: 800;
271
+ }
272
+
273
+ .balance-copy small {
274
+ display: block;
275
+ margin-left: 21px;
276
+ color: #7b828c;
277
+ font-size: 14px;
278
+ }
279
+
280
+ .dot,
281
+ .quota-list b,
282
+ .pie-foot b {
283
+ width: 8px;
284
+ height: 8px;
285
+ border-radius: 50%;
286
+ background: var(--blue);
287
+ }
288
+
289
+ .sky {
290
+ background: #58aef7 !important;
291
+ }
292
+
293
+ .quota-list {
294
+ position: absolute;
295
+ right: 8%;
296
+ top: 50%;
297
+ transform: translateY(-55%);
298
+ display: grid;
299
+ gap: 18px;
300
+ list-style: none;
301
+ }
302
+
303
+ .quota-list b:nth-child(n) {
304
+ background: #399df7;
305
+ }
306
+
307
+ .pie-foot {
308
+ position: absolute;
309
+ left: 40px;
310
+ right: 30px;
311
+ bottom: 28px;
312
+ display: flex;
313
+ justify-content: space-between;
314
+ font-size: 14px;
315
+ }
316
+
317
+ .pie-foot span {
318
+ display: flex;
319
+ align-items: center;
320
+ gap: 8px;
321
+ }
322
+
323
+ .progress-box {
324
+ grid-column: 1 / -1;
325
+ height: 124px;
326
+ position: relative;
327
+ border: 1px solid var(--line);
328
+ border-radius: 10px;
329
+ background: #fff;
330
+ padding: 16px 19px;
331
+ }
332
+
333
+ .progress-box p {
334
+ color: #4d5868;
335
+ font-size: 14px;
336
+ }
337
+
338
+ .progress-box strong {
339
+ display: block;
340
+ margin-top: 10px;
341
+ color: var(--blue);
342
+ font-size: 30px;
343
+ font-weight: 800;
344
+ }
345
+
346
+ .progress-box > b {
347
+ position: absolute;
348
+ left: 143px;
349
+ top: 52px;
350
+ font-size: 36px;
351
+ line-height: 1;
352
+ }
353
+
354
+ em {
355
+ color: #10b990;
356
+ font-style: normal;
357
+ }
358
+
359
+ .progress-line {
360
+ position: absolute;
361
+ left: 222px;
362
+ right: 21px;
363
+ top: 41px;
364
+ height: 44px;
365
+ border-top: 6px solid #e4e8ee;
366
+ }
367
+
368
+ .progress-line i {
369
+ display: block;
370
+ width: 57%;
371
+ height: 6px;
372
+ margin-top: -6px;
373
+ background: var(--blue);
374
+ }
375
+
376
+ .progress-line span {
377
+ position: absolute;
378
+ left: 55%;
379
+ top: -17px;
380
+ min-width: 52px;
381
+ height: 28px;
382
+ padding: 5px 14px;
383
+ transform: translateX(-50%);
384
+ border-radius: 14px;
385
+ background: var(--blue);
386
+ color: #fff;
387
+ font-size: 14px;
388
+ font-weight: 600;
389
+ text-align: center;
390
+ }
391
+
392
+ .scale-row {
393
+ position: absolute;
394
+ left: 222px;
395
+ right: 16px;
396
+ bottom: 14px;
397
+ display: flex;
398
+ justify-content: space-between;
399
+ color: #6b7280;
400
+ font-size: 14px;
401
+ }
402
+
403
+ @media (max-width: 1200px) {
404
+ .account-board {
405
+ height: auto;
406
+ }
407
+
408
+ .account-layout {
409
+ grid-template-columns: 1fr;
410
+ }
411
+
412
+ .metric-box {
413
+ min-height: 253px;
414
+ }
415
+ }
416
+
417
+ @media (max-width: 720px) {
418
+ .actions {
419
+ gap: 10px;
420
+ }
421
+
422
+ .board-head {
423
+ height: auto;
424
+ gap: 12px;
425
+ flex-wrap: wrap;
426
+ margin-bottom: 12px;
427
+ }
428
+
429
+ .account-layout {
430
+ gap: 10px;
431
+ }
432
+
433
+ .balance-copy,
434
+ .quota-list {
435
+ right: 16px;
436
+ }
437
+ }
438
+ </style>