verce-vue-test 0.0.49 → 0.0.50

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.49",
3
+ "version": "0.0.50",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -30,6 +30,13 @@ type HomeBalanceAmount = {
30
30
  decimal: string
31
31
  }
32
32
 
33
+ type ForeignBalanceScope = 'domestic' | 'overseas'
34
+
35
+ type ScopedBalanceAmount = HomeBalanceAmount & {
36
+ key: ForeignBalanceScope
37
+ label: string
38
+ }
39
+
33
40
  /**
34
41
  * 首页余额卡片的渲染模型。
35
42
  *
@@ -43,6 +50,7 @@ type BalanceCard = {
43
50
  title: string
44
51
  amount: string
45
52
  decimal: string
53
+ balances?: ScopedBalanceAmount[]
46
54
  unit: string
47
55
  symbol?: string
48
56
  icon?: Component
@@ -93,6 +101,10 @@ const balanceCards = shallowRef<BalanceCard[]>([
93
101
  title: '美元',
94
102
  amount: '24,567,890',
95
103
  decimal: '.35',
104
+ balances: [
105
+ { key: 'domestic', label: '境内', amount: '24,567,890', decimal: '.35' },
106
+ { key: 'overseas', label: '境外', amount: '0', decimal: '.00' },
107
+ ],
96
108
  unit: 'USD',
97
109
  symbol: '$',
98
110
  background: cardUsdBg,
@@ -121,6 +133,10 @@ const balanceCards = shallowRef<BalanceCard[]>([
121
133
  title: '欧元',
122
134
  amount: '15,678,234',
123
135
  decimal: '.56',
136
+ balances: [
137
+ { key: 'domestic', label: '境内', amount: '15,678,234', decimal: '.56' },
138
+ { key: 'overseas', label: '境外', amount: '0', decimal: '.00' },
139
+ ],
124
140
  unit: 'EUR',
125
141
  symbol: '€',
126
142
  background: cardEurBg,
@@ -146,9 +162,13 @@ const balanceCards = shallowRef<BalanceCard[]>([
146
162
  },
147
163
  {
148
164
  id: 'hkd',
149
- title: '港币',
165
+ title: '港元',
150
166
  amount: '8,765,432',
151
167
  decimal: '.10',
168
+ balances: [
169
+ { key: 'domestic', label: '境内', amount: '8,765,432', decimal: '.10' },
170
+ { key: 'overseas', label: '境外', amount: '0', decimal: '.00' },
171
+ ],
152
172
  unit: 'HKD',
153
173
  symbol: 'HK$',
154
174
  iconSize: 'compact',
@@ -178,6 +198,10 @@ const balanceCards = shallowRef<BalanceCard[]>([
178
198
  title: '日元',
179
199
  amount: '1,234,567,890',
180
200
  decimal: '.00',
201
+ balances: [
202
+ { key: 'domestic', label: '境内', amount: '1,234,567,890', decimal: '.00' },
203
+ { key: 'overseas', label: '境外', amount: '0', decimal: '.00' },
204
+ ],
181
205
  unit: 'JPY',
182
206
  symbol: '¥',
183
207
  background: cardJpyBg,
@@ -191,9 +215,9 @@ const balanceCards = shallowRef<BalanceCard[]>([
191
215
 
192
216
  const menuItems: HomeMenuItem[] = [
193
217
  { label: '总览', route: '/', icon: HomeFilled, active: true },
194
- { label: '驾驶舱', route: '/fund-cockpit', icon: TrendCharts },
195
- { label: '头寸', route: '/position-forecast', icon: DataLine },
196
- { label: '公告', route: '/notice-announcement', icon: Bell },
218
+ // { label: '驾驶舱', route: '/fund-cockpit', icon: TrendCharts },
219
+ // { label: '头寸', route: '/position-forecast', icon: DataLine },
220
+ { label: '公告', route: '/notice-list', icon: Bell },
197
221
  ]
198
222
 
199
223
  /** 右侧快捷菜单跳转;当前首页项不重复 push,避免无意义路由刷新。 */
@@ -208,6 +232,10 @@ function openMenu(item: HomeMenuItem) {
208
232
  * 这里按最终展示文本长度判断,而不是按原始数值判断,能覆盖接口返回字符串的情况。
209
233
  */
210
234
  function isLongAmount(card: BalanceCard) {
235
+ if (card.balances?.length) {
236
+ return card.balances.some((balance) => `${balance.amount}${balance.decimal}`.length >= 16)
237
+ }
238
+
211
239
  return `${card.amount}${card.decimal}`.length >= 16
212
240
  }
213
241
 
@@ -216,15 +244,35 @@ function isLongAmount(card: BalanceCard) {
216
244
  *
217
245
  * 用法示例:
218
246
  * updateBalanceCardAmount('rmb', res.body.balanceAmt)
219
- * updateBalanceCardAmount('usd', usdItem.mainAcctAmt)
247
+ * updateBalanceCardAmount('usd', usdDomesticAmt, 'domestic')
248
+ * updateBalanceCardAmount('usd', usdOverseasAmt, 'overseas')
220
249
  *
221
250
  * 这里不读取后端返回结构,只负责把单个金额值格式化后更新到指定卡片。
222
251
  */
223
- function updateBalanceCardAmount(cardId: string, value: unknown) {
252
+ function updateBalanceCardAmount(
253
+ cardId: string,
254
+ value: unknown,
255
+ scope: ForeignBalanceScope = 'domestic',
256
+ ) {
224
257
  const amount = formatHomeBalanceAmount(value)
225
258
 
226
259
  balanceCards.value = balanceCards.value.map((card) => {
227
- return card.id === cardId ? { ...card, ...amount } : card
260
+ if (card.id !== cardId) {
261
+ return card
262
+ }
263
+
264
+ if (!card.balances?.length) {
265
+ return { ...card, ...amount }
266
+ }
267
+
268
+ const balances = card.balances.map((balance) => {
269
+ return balance.key === scope ? { ...balance, ...amount } : balance
270
+ })
271
+ const firstBalance = balances[0]
272
+
273
+ return firstBalance
274
+ ? { ...card, amount: firstBalance.amount, decimal: firstBalance.decimal, balances }
275
+ : { ...card, balances }
228
276
  })
229
277
  updatedAt.value = formatDateTime(new Date())
230
278
  }
@@ -347,12 +395,28 @@ function addThousands(value: string) {
347
395
 
348
396
  <h2>{{ card.title }}</h2>
349
397
 
350
- <div class="amount-block">
351
- <div class="amount-row">
352
- <span class="amount-main">{{ card.amount }}</span>
353
- <span class="amount-decimal">{{ card.decimal }}</span>
354
- </div>
355
- <div class="unit-label">{{ card.unit }}</div>
398
+ <div class="amount-block" :class="{ 'is-multiple': card.balances?.length }">
399
+ <template v-if="card.balances?.length">
400
+ <div
401
+ v-for="balance in card.balances"
402
+ :key="balance.key"
403
+ class="split-amount-row"
404
+ >
405
+ <span class="scope-label">{{ balance.label }}</span>
406
+ <span class="split-amount-value">
407
+ <span class="amount-main">{{ balance.amount }}</span>
408
+ <span class="amount-decimal">{{ balance.decimal }}</span>
409
+ </span>
410
+ </div>
411
+ <div class="unit-label">{{ card.unit }}</div>
412
+ </template>
413
+ <template v-else>
414
+ <div class="amount-row">
415
+ <span class="amount-main">{{ card.amount }}</span>
416
+ <span class="amount-decimal">{{ card.decimal }}</span>
417
+ </div>
418
+ <div class="unit-label">{{ card.unit }}</div>
419
+ </template>
356
420
  </div>
357
421
  </article>
358
422
  </div>
@@ -676,6 +740,12 @@ function addThousands(value: string) {
676
740
  padding-top: clamp(0.2rem, 0.55vw, 0.6rem);
677
741
  }
678
742
 
743
+ .amount-block.is-multiple {
744
+ gap: clamp(0.14rem, 0.32vw, 0.34rem);
745
+ justify-items: stretch;
746
+ padding-top: 0;
747
+ }
748
+
679
749
  /* 金额整数和小数拆开排版:整数强调,decimal 使用较小字号贴齐右侧。 */
680
750
  .amount-row {
681
751
  display: flex;
@@ -696,6 +766,52 @@ function addThousands(value: string) {
696
766
  white-space: nowrap;
697
767
  }
698
768
 
769
+ .split-amount-row {
770
+ display: grid;
771
+ grid-template-columns: clamp(2rem, 2.85vw, 2.8rem) minmax(0, 1fr);
772
+ width: 100%;
773
+ min-width: 0;
774
+ align-items: center;
775
+ column-gap: clamp(0.28rem, 0.55vw, 0.6rem);
776
+ }
777
+
778
+ .scope-label {
779
+ display: inline-grid;
780
+ min-width: 0;
781
+ height: clamp(1.08rem, 1.35vw, 1.42rem);
782
+ place-items: center;
783
+ padding-inline: clamp(0.22rem, 0.36vw, 0.38rem);
784
+ overflow: hidden;
785
+ border: 1px solid color-mix(in srgb, var(--accent-soft) 48%, rgba(255, 255, 255, 0.72));
786
+ border-radius: 999px;
787
+ color: color-mix(in srgb, var(--accent-deep) 86%, #00164e);
788
+ background: rgba(255, 255, 255, 0.62);
789
+ font-size: clamp(0.62rem, 0.8vw, 0.86rem);
790
+ font-weight: 800;
791
+ line-height: 1;
792
+ text-align: center;
793
+ white-space: nowrap;
794
+ }
795
+
796
+ .split-amount-value {
797
+ display: flex;
798
+ min-width: 0;
799
+ align-items: flex-start;
800
+ justify-content: flex-end;
801
+ color: var(--accent);
802
+ font-family:
803
+ "Arial Narrow",
804
+ "DIN Condensed",
805
+ "Bahnschrift",
806
+ "Microsoft YaHei",
807
+ sans-serif;
808
+ font-weight: 900;
809
+ line-height: 0.94;
810
+ text-align: right;
811
+ text-shadow: 0 0.08rem 0.15rem rgba(255, 255, 255, 0.92);
812
+ white-space: nowrap;
813
+ }
814
+
699
815
  .amount-main {
700
816
  min-width: 0;
701
817
  overflow: hidden;
@@ -712,6 +828,10 @@ function addThousands(value: string) {
712
828
  letter-spacing: 0;
713
829
  }
714
830
 
831
+ .split-amount-value .amount-main {
832
+ flex: 1 1 auto;
833
+ }
834
+
715
835
  .unit-label {
716
836
  max-width: 100%;
717
837
  margin-top: clamp(0.35rem, 0.75vw, 0.85rem);
@@ -723,6 +843,20 @@ function addThousands(value: string) {
723
843
  text-align: right;
724
844
  }
725
845
 
846
+ .amount-block.is-multiple .amount-main {
847
+ font-size: clamp(1.1rem, 1.82vw, 2.15rem);
848
+ }
849
+
850
+ .amount-block.is-multiple .amount-decimal {
851
+ margin-top: clamp(0.2rem, 0.4vw, 0.46rem);
852
+ font-size: clamp(0.62rem, 0.9vw, 1.02rem);
853
+ }
854
+
855
+ .amount-block.is-multiple .unit-label {
856
+ margin-top: 0;
857
+ font-size: clamp(0.72rem, 0.95vw, 1.05rem);
858
+ }
859
+
726
860
  .balance-card.is-long-amount .amount-main {
727
861
  font-size: clamp(1.65rem, 2.23vw, 3rem);
728
862
  }
@@ -732,6 +866,15 @@ function addThousands(value: string) {
732
866
  font-size: clamp(0.85rem, 1.1vw, 1.3rem);
733
867
  }
734
868
 
869
+ .balance-card.is-long-amount .amount-block.is-multiple .amount-main {
870
+ font-size: clamp(0.98rem, 1.62vw, 1.9rem);
871
+ }
872
+
873
+ .balance-card.is-long-amount .amount-block.is-multiple .amount-decimal {
874
+ margin-top: clamp(0.18rem, 0.36vw, 0.42rem);
875
+ font-size: clamp(0.58rem, 0.82vw, 0.94rem);
876
+ }
877
+
735
878
  .right-menu {
736
879
  position: relative;
737
880
  z-index: 2;
@@ -837,16 +980,30 @@ function addThousands(value: string) {
837
980
  font-size: clamp(1.3rem, 2.22vw, 2.1rem);
838
981
  }
839
982
 
983
+ .amount-block.is-multiple .amount-main {
984
+ font-size: clamp(0.98rem, 1.72vw, 1.6rem);
985
+ }
986
+
840
987
  .amount-decimal {
841
988
  margin-top: clamp(0.25rem, 0.55vw, 0.58rem);
842
989
  font-size: clamp(0.72rem, 1.12vw, 1.1rem);
843
990
  }
844
991
 
992
+ .amount-block.is-multiple .amount-decimal {
993
+ margin-top: clamp(0.16rem, 0.34vw, 0.38rem);
994
+ font-size: clamp(0.58rem, 0.82vw, 0.86rem);
995
+ }
996
+
845
997
  .unit-label {
846
998
  margin-top: clamp(0.25rem, 0.58vw, 0.65rem);
847
999
  font-size: clamp(0.82rem, 1.2vw, 1.2rem);
848
1000
  }
849
1001
 
1002
+ .amount-block.is-multiple .unit-label {
1003
+ margin-top: 0;
1004
+ font-size: clamp(0.65rem, 0.9vw, 0.9rem);
1005
+ }
1006
+
850
1007
  .balance-card.is-long-amount .amount-main {
851
1008
  font-size: clamp(1.15rem, 1.95vw, 1.85rem);
852
1009
  }
@@ -856,6 +1013,15 @@ function addThousands(value: string) {
856
1013
  font-size: clamp(0.68rem, 0.98vw, 1rem);
857
1014
  }
858
1015
 
1016
+ .balance-card.is-long-amount .amount-block.is-multiple .amount-main {
1017
+ font-size: clamp(0.9rem, 1.48vw, 1.38rem);
1018
+ }
1019
+
1020
+ .balance-card.is-long-amount .amount-block.is-multiple .amount-decimal {
1021
+ margin-top: clamp(0.14rem, 0.3vw, 0.34rem);
1022
+ font-size: clamp(0.54rem, 0.74vw, 0.78rem);
1023
+ }
1024
+
859
1025
  .menu-label {
860
1026
  font-size: clamp(0.7rem, 1.05vw, 0.85rem);
861
1027
  }
@@ -911,10 +1077,18 @@ function addThousands(value: string) {
911
1077
  font-size: clamp(1.55rem, 5.3vw, 2.65rem);
912
1078
  }
913
1079
 
1080
+ .amount-block.is-multiple .amount-main {
1081
+ font-size: clamp(1.18rem, 4.1vw, 2.05rem);
1082
+ }
1083
+
914
1084
  .amount-decimal {
915
1085
  font-size: clamp(0.8rem, 2.65vw, 1.25rem);
916
1086
  }
917
1087
 
1088
+ .amount-block.is-multiple .amount-decimal {
1089
+ font-size: clamp(0.62rem, 2vw, 1rem);
1090
+ }
1091
+
918
1092
  .right-menu {
919
1093
  gap: clamp(0.4rem, 1vh, 0.65rem);
920
1094
  padding-inline: clamp(0.25rem, 0.9vw, 0.45rem);