verce-vue-test 0.0.54 → 0.0.56

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 (88) hide show
  1. package/{mini2.0-main 2/src/App.vue → mini2.0-main/src/App.vue} +8 -1
  2. package/mini2.0-main/src/api/rmb-position.ts +232 -0
  3. package/mini2.0-main/src/api/tam.ts +170 -0
  4. package/{mini2.0-main 2/src/api/user.ts → mini2.0-main/src/api/user.ts} +17 -0
  5. package/{mini2.0-main 2/src/components.d.ts → mini2.0-main/src/components.d.ts} +1 -0
  6. package/mini2.0-main/src/config/plugin.properties.test +6 -0
  7. package/{mini2.0-main 2/src/router/index.ts → mini2.0-main/src/router/index.ts} +18 -0
  8. package/mini2.0-main/src/stores/app.ts +40 -0
  9. package/{mini2.0-main 2/src/stores/user.ts → mini2.0-main/src/stores/user.ts} +55 -3
  10. package/{mini2.0-main 2/src/types/api.d.ts → mini2.0-main/src/types/api.d.ts} +1 -1
  11. package/{mini2.0-main 2/src/utils/auth-token.ts → mini2.0-main/src/utils/auth-token.ts} +50 -6
  12. package/{mini2.0-main 2/src/utils/request.ts → mini2.0-main/src/utils/request.ts} +10 -6
  13. package/mini2.0-main/src/utils/rmb-forecast.ts +84 -0
  14. package/{mini2.0-main 2/src/views/login/index.vue → mini2.0-main/src/views/login/index.vue} +46 -6
  15. package/{mini2.0-main 2/src/views/mine/index.vue → mini2.0-main/src/views/mine/index.vue} +5 -0
  16. package/{mini2.0-main 2/src/views/rmb-position/index.vue → mini2.0-main/src/views/rmb-position/index.vue} +138 -255
  17. package/mini2.0-main/src/views/rmb-position-create/index.vue +258 -0
  18. package/mini2.0-main/src/views/rmb-position-detail/index.vue +392 -0
  19. package/mini2.0-main/src/views/settings/index.vue +110 -0
  20. package/package.json +1 -1
  21. package/mini2.0-main 2/src/api/rmb-position.ts +0 -287
  22. package/mini2.0-main 2/src/config/plugin.properties.test +0 -6
  23. package/mini2.0-main 2/src/stores/app.ts +0 -24
  24. /package/{mini2.0-main 2 → mini2.0-main}/.editorconfig +0 -0
  25. /package/{mini2.0-main 2 → mini2.0-main}/.env.development +0 -0
  26. /package/{mini2.0-main 2 → mini2.0-main}/.env.production +0 -0
  27. /package/{mini2.0-main 2 → mini2.0-main}/.env.test +0 -0
  28. /package/{mini2.0-main 2 → mini2.0-main}/.gitattributes +0 -0
  29. /package/{mini2.0-main 2 → mini2.0-main}/.oxlintrc.json +0 -0
  30. /package/{mini2.0-main 2 → mini2.0-main}/.prettierrc.json +0 -0
  31. /package/{mini2.0-main 2 → mini2.0-main}/.vscode/extensions.json +0 -0
  32. /package/{mini2.0-main 2 → mini2.0-main}/README.md +0 -0
  33. /package/{mini2.0-main 2 → mini2.0-main}/auto-imports.d.ts +0 -0
  34. /package/{mini2.0-main 2 → mini2.0-main}/components.d.ts +0 -0
  35. /package/{mini2.0-main 2 → mini2.0-main}/design-qa.md +0 -0
  36. /package/{mini2.0-main 2 → mini2.0-main}/docs/MX_API.md +0 -0
  37. /package/{mini2.0-main 2 → mini2.0-main}/docs/REQUEST.md +0 -0
  38. /package/{mini2.0-main 2 → mini2.0-main}/docs/jsapi.js +0 -0
  39. /package/{mini2.0-main 2 → mini2.0-main}/docs/package-json-guide.md +0 -0
  40. /package/{mini2.0-main 2 → mini2.0-main}/env.d.ts +0 -0
  41. /package/{mini2.0-main 2 → mini2.0-main}/eslint.config.ts +0 -0
  42. /package/{mini2.0-main 2 → mini2.0-main}/index.html +0 -0
  43. /package/{mini2.0-main 2 → mini2.0-main}/output/playwright/rmb-position/design-comparison.png +0 -0
  44. /package/{mini2.0-main 2 → mini2.0-main}/output/playwright/rmb-position/rmb-position-back-top.png +0 -0
  45. /package/{mini2.0-main 2 → mini2.0-main}/output/playwright/rmb-position/rmb-position-page.png +0 -0
  46. /package/{mini2.0-main 2 → mini2.0-main}/output/playwright/rmb-position/rmb-position-sticky-check.png +0 -0
  47. /package/{mini2.0-main 2 → mini2.0-main}/output/playwright/rmb-position/rmb-position-sticky-scrolled.png +0 -0
  48. /package/{mini2.0-main 2 → mini2.0-main}/package-lock.json +0 -0
  49. /package/{mini2.0-main 2 → mini2.0-main}/package.json +0 -0
  50. /package/{mini2.0-main 2 → mini2.0-main}/plugins/bump-version.ts +0 -0
  51. /package/{mini2.0-main 2 → mini2.0-main}/postcss.config.ts +0 -0
  52. /package/{mini2.0-main 2 → mini2.0-main}/public/favicon.ico +0 -0
  53. /package/{mini2.0-main 2 → mini2.0-main}/public/images/12a73787-86a9-4891-a65f-66104746f6a8.png +0 -0
  54. /package/{mini2.0-main 2 → mini2.0-main}/public/images/5798d7aa-ba8b-4605-8079-58b35495ac55.png +0 -0
  55. /package/{mini2.0-main 2 → mini2.0-main}/public/images/73fef1e4-0fd0-4a1a-9b8b-a70a5b6acbbc.png +0 -0
  56. /package/{mini2.0-main 2 → mini2.0-main}/public/images/bc685b4c-0cca-4a79-924c-a8ee10e6f8eb.png +0 -0
  57. /package/{mini2.0-main 2 → mini2.0-main}/public/images/c3dbbd9d-be56-490e-b9f4-6ee17ebefffc.png +0 -0
  58. /package/{mini2.0-main 2 → mini2.0-main}/public/images/ea745a10-42aa-4f44-8d7f-3ab02cc0adcd.png +0 -0
  59. /package/{mini2.0-main 2 → mini2.0-main}/public/images/f5876785-b927-4347-ba19-999114240649.png +0 -0
  60. /package/{mini2.0-main 2 → mini2.0-main}/public/images/img.png +0 -0
  61. /package/{mini2.0-main 2 → mini2.0-main}/src/api/announcement.ts +0 -0
  62. /package/{mini2.0-main 2 → mini2.0-main}/src/api/health.ts +0 -0
  63. /package/{mini2.0-main 2 → mini2.0-main}/src/auto-imports.d.ts +0 -0
  64. /package/{mini2.0-main 2 → mini2.0-main}/src/config/config.properties +0 -0
  65. /package/{mini2.0-main 2 → mini2.0-main}/src/config/env.ts +0 -0
  66. /package/{mini2.0-main 2 → mini2.0-main}/src/config/plugin.properties.pro +0 -0
  67. /package/{mini2.0-main 2 → mini2.0-main}/src/core/mxApi/index.ts +0 -0
  68. /package/{mini2.0-main 2 → mini2.0-main}/src/core/request/index.ts +0 -0
  69. /package/{mini2.0-main 2 → mini2.0-main}/src/main.ts +0 -0
  70. /package/{mini2.0-main 2 → mini2.0-main}/src/stores/counter.ts +0 -0
  71. /package/{mini2.0-main 2 → mini2.0-main}/src/types/nprogress.d.ts +0 -0
  72. /package/{mini2.0-main 2 → mini2.0-main}/src/utils/code-highlight.ts +0 -0
  73. /package/{mini2.0-main 2 → mini2.0-main}/src/utils/copy.ts +0 -0
  74. /package/{mini2.0-main 2 → mini2.0-main}/src/utils/query.ts +0 -0
  75. /package/{mini2.0-main 2 → mini2.0-main}/src/views/article-detail/index.vue +0 -0
  76. /package/{mini2.0-main 2 → mini2.0-main}/src/views/article-edit/index.vue +0 -0
  77. /package/{mini2.0-main 2 → mini2.0-main}/src/views/articles/index.vue +0 -0
  78. /package/{mini2.0-main 2 → mini2.0-main}/src/views/clearing-detail/index.vue +0 -0
  79. /package/{mini2.0-main 2 → mini2.0-main}/src/views/foreign-position/index.vue +0 -0
  80. /package/{mini2.0-main 2 → mini2.0-main}/src/views/home/index.vue +0 -0
  81. /package/{mini2.0-main 2 → mini2.0-main}/src/views/net-debit/index.vue +0 -0
  82. /package/{mini2.0-main 2 → mini2.0-main}/src/views/pbc-position/index.vue +0 -0
  83. /package/{mini2.0-main 2 → mini2.0-main}/src/views/position-estimate/index.vue +0 -0
  84. /package/{mini2.0-main 2 → mini2.0-main}/src/views/warning/index.vue +0 -0
  85. /package/{mini2.0-main 2 → mini2.0-main}/tsconfig.app.json +0 -0
  86. /package/{mini2.0-main 2 → mini2.0-main}/tsconfig.json +0 -0
  87. /package/{mini2.0-main 2 → mini2.0-main}/tsconfig.node.json +0 -0
  88. /package/{mini2.0-main 2 → mini2.0-main}/vite.config.ts +0 -0
@@ -1,13 +1,20 @@
1
1
  <script setup lang="ts">
2
+ import { useAppStore } from '@/stores/app'
3
+
2
4
  const route = useRoute()
3
5
  const router = useRouter()
6
+ const appStore = useAppStore()
4
7
 
5
- const tabItems = [
8
+ const baseTabItems = [
6
9
  { title: '首页', path: '/', icon: 'wap-home-o' },
7
10
  { title: '公告', path: '/articles', icon: 'records-o' },
8
11
  { title: '我的', path: '/mine', icon: 'manager-o' },
9
12
  ]
10
13
 
14
+ const tabItems = computed(() =>
15
+ baseTabItems.filter((item) => item.path !== '/articles' || appStore.showAnnouncementTab),
16
+ )
17
+
11
18
  const showTabbar = computed(() => route.meta.hideTabbar !== true)
12
19
 
13
20
  const activeTab = computed({
@@ -0,0 +1,232 @@
1
+ import {
2
+ buildTamRequestPayload,
3
+ tamRequest,
4
+ type TamRequestPayload,
5
+ type TamResponse,
6
+ } from '@/api/tam'
7
+
8
+ export type RmbForecastRecord = {
9
+ /** 业务类型,用于映射列表中的业务名称。 */
10
+ busiType?: string
11
+ /** 客户名称,客户类型为空时作为展示兜底。 */
12
+ clientName?: string
13
+ /** 客户类型,用于映射列表中的客户类型文案。 */
14
+ clientType?: string
15
+ /** 交易对手名称,客户名称为空时作为展示兜底。 */
16
+ competName?: string
17
+ /** 落地机构,列表主标题展示字段。 */
18
+ groundBranch?: string
19
+ /** 预报金额,接口按元返回,页面转换为亿元展示。 */
20
+ predAmt?: string
21
+ /** 预报流水号,点击列表进入详情的主键。 */
22
+ predRefNo?: string
23
+ /** 预报状态,用于判断列表状态标签。 */
24
+ predStatus?: string
25
+ /** 交易日期,列表日期展示字段。 */
26
+ tranDate?: string
27
+ /** 核销状态,用于判断列表状态标签。 */
28
+ verifyStatus?: string
29
+ }
30
+
31
+ export type RmbForecastQueryForm = {
32
+ /** 交易时间,当前视图必填筛选项。 */
33
+ tranDate: string
34
+ /** 落地机构,当前视图按关键字查询。 */
35
+ groundBranch?: string
36
+ /** 起始金额,页面单位为亿元。 */
37
+ startTranAmt?: string
38
+ /** 截止金额,页面单位为亿元。 */
39
+ endTranAmt?: string
40
+ }
41
+
42
+ export type RmbForecastQueryPayload = {
43
+ appHead: TamRequestPayload<RmbForecastQueryBody>['appHead']
44
+ body: RmbForecastQueryBody
45
+ head: TamRequestPayload<RmbForecastQueryBody>['head']
46
+ }
47
+
48
+ export type RmbForecastQueryResult = {
49
+ body: RmbForecastQueryResultBody
50
+ head: TamResponse<RmbForecastQueryResultBody>['head']
51
+ }
52
+
53
+ export type RmbForecastDetailPayload = {
54
+ appHead: TamRequestPayload<RmbForecastDetailBody>['appHead']
55
+ body: RmbForecastDetailBody
56
+ head: TamRequestPayload<RmbForecastDetailBody>['head']
57
+ }
58
+
59
+ export type RmbForecastDetailResult = {
60
+ body: RmbForecastDetailRecord
61
+ head: TamResponse<RmbForecastDetailRecord>['head']
62
+ }
63
+
64
+ type RmbForecastQueryBody = {
65
+ /** 业务类型,当前视图未开放筛选,固定传空。 */
66
+ busiType: string
67
+ /** 客户名称,当前视图未开放筛选,固定传空。 */
68
+ clientName: string
69
+ /** 交易对手名称,当前视图未开放筛选,固定传空。 */
70
+ competName: string
71
+ /** 截止金额,页面亿元转换为接口元级整数字符串。 */
72
+ endTransAmt: string
73
+ /** 落地机构,来自当前视图输入框。 */
74
+ groundBranch: string
75
+ /** 支付渠道,当前视图未开放筛选,固定传空。 */
76
+ payChannel: string
77
+ /** 收支方向,当前视图未开放筛选,固定传空。 */
78
+ payDirec: string
79
+ /** 预报状态,当前视图未开放筛选,固定传空。 */
80
+ predStatus: string
81
+ /** 排序规则,当前视图未开放筛选,固定传空。 */
82
+ sortRule: string
83
+ /** 起始金额,页面亿元转换为接口元级整数字符串。 */
84
+ startTransAmt: string
85
+ /** 交易时间,接口格式为 YYYYMMDD。 */
86
+ tranDate: string
87
+ /** 核销状态,当前视图未开放筛选,固定传空。 */
88
+ verifyStatus: string
89
+ }
90
+
91
+ type RmbForecastQueryResultBody = {
92
+ resultList: RmbForecastRecord[]
93
+ totalCount: string
94
+ }
95
+
96
+ type RmbForecastDetailBody = {
97
+ /** 预报流水号,详情查询主键。 */
98
+ predRefNo: string
99
+ }
100
+
101
+ export type RmbForecastDetailRecord = {
102
+ /** 出票日 */
103
+ billDate?: string
104
+ /** 票号 */
105
+ billNo?: string
106
+ /** 业务类型 */
107
+ busiType?: string
108
+ /** 客户名称 */
109
+ clientName?: string
110
+ /** 客户类型 */
111
+ clientType?: string
112
+ /** 交易对手账号 */
113
+ competAcct?: string
114
+ /** 交易对手名称 */
115
+ competName?: string
116
+ /** 额度标志 */
117
+ eduFlag?: string
118
+ /** 落地机构名称 */
119
+ groundBranch?: string
120
+ /** 落地机构代码 */
121
+ groundBranchCode?: string
122
+ /** 联系人 */
123
+ linkMan?: string
124
+ /** 支付渠道 */
125
+ payChannel?: string
126
+ /** 收支方向 */
127
+ payDirec?: string
128
+ /** 联系电话 */
129
+ phoneNo?: string
130
+ /** 预报金额 */
131
+ predAmt?: string
132
+ /** 预报机构 */
133
+ predBranch?: string
134
+ /** 预报机构 */
135
+ predBranchName?: string
136
+ /** 预报人员编号 */
137
+ predCode?: string
138
+ /** 预报日期 */
139
+ predDate?: string
140
+ /** 预报人员姓名 */
141
+ predName?: string
142
+ /** 预报流水号 */
143
+ predRefNo?: string
144
+ /** 预报状态 */
145
+ predStatus?: string
146
+ /** 用途 */
147
+ purpose?: string
148
+ /** 备注 */
149
+ remark?: string
150
+ /** 标准名称 */
151
+ standardName?: string
152
+ /** 交易日期 */
153
+ tranDate?: string
154
+ /** 已核销金额 */
155
+ verifyAmt?: string
156
+ /** 核销状态 */
157
+ verifyStatus?: string
158
+ }
159
+
160
+ type QueryOptions = {
161
+ form: RmbForecastQueryForm
162
+ pageIndex: number
163
+ pageSize: number
164
+ }
165
+
166
+ const QUERY_TRAN_CODE = '/TAM/0001/140101001'
167
+ const DETAIL_TRAN_CODE = '/TAM/0001/140101002'
168
+
169
+ export function buildRmbForecastQueryPayload({
170
+ form,
171
+ pageIndex,
172
+ pageSize,
173
+ }: QueryOptions): RmbForecastQueryPayload {
174
+ const tranDate = normalizeDate(form.tranDate)
175
+
176
+ // 当前视图只提供交易日期、落地机构、起始金额、截止金额,其余查询字段按接口约定传空。
177
+ return buildTamRequestPayload({
178
+ tranCode: QUERY_TRAN_CODE,
179
+ pageIndex,
180
+ pageSize,
181
+ body: {
182
+ busiType: '',
183
+ clientName: '',
184
+ competName: '',
185
+ endTransAmt: toRequestAmount(form.endTranAmt),
186
+ groundBranch: form.groundBranch || '',
187
+ payChannel: '',
188
+ payDirec: '',
189
+ predStatus: '',
190
+ sortRule: '',
191
+ // 后端字段名为 TransAmt,保持与交易入参一致。
192
+ startTransAmt: toRequestAmount(form.startTranAmt),
193
+ tranDate,
194
+ verifyStatus: '',
195
+ },
196
+ })
197
+ }
198
+
199
+ export async function queryRmbForecastPage(
200
+ payload: RmbForecastQueryPayload,
201
+ ): Promise<RmbForecastQueryResult> {
202
+ return tamRequest<RmbForecastQueryBody, RmbForecastQueryResultBody>(payload)
203
+ }
204
+
205
+ export function buildRmbForecastDetailPayload(predRefNo: string): RmbForecastDetailPayload {
206
+ return buildTamRequestPayload({
207
+ tranCode: DETAIL_TRAN_CODE,
208
+ body: {
209
+ predRefNo,
210
+ },
211
+ })
212
+ }
213
+
214
+ export async function queryRmbForecastDetail(
215
+ payload: RmbForecastDetailPayload,
216
+ ): Promise<RmbForecastDetailResult> {
217
+ return tamRequest<RmbForecastDetailBody, RmbForecastDetailRecord>(payload)
218
+ }
219
+
220
+ function normalizeDate(value: string) {
221
+ // 日期选择器产出 YYYY-MM-DD;接口需要 YYYYMMDD。
222
+ if (/^\d{8}$/.test(value)) return value
223
+ return value.replaceAll('-', '')
224
+ }
225
+
226
+ function toRequestAmount(value?: string) {
227
+ if (!value?.trim()) return ''
228
+
229
+ // 页面按“亿元”录入,接口按元级整数金额查询。
230
+ const amount = Number(value)
231
+ return Number.isFinite(amount) ? String(Math.round(amount * 100000000)) : ''
232
+ }
@@ -0,0 +1,170 @@
1
+ import dayjs from 'dayjs'
2
+ import { request } from '@/core/request'
3
+ import { useUserStore } from '@/stores/user'
4
+
5
+ export type TamAppHead = {
6
+ fileName: string
7
+ opType: string
8
+ ip: string
9
+ }
10
+
11
+ export type TamHead = {
12
+ adminUserId: string
13
+ apprUserId: string
14
+ areaCode: string
15
+ branchId: string
16
+ consumerId: string
17
+ consumerSeqNo: string
18
+ digitalSign: string
19
+ fileFlag: string
20
+ filePath: string
21
+ isBatch: boolean
22
+ pageIndex: number
23
+ pageSize: number
24
+ spanId: string
25
+ traceId: string
26
+ tranCode: string
27
+ tranDate: string
28
+ tranTimestamp: string
29
+ userId: string
30
+ verifyUserId: string
31
+ versionId: string
32
+ }
33
+
34
+ export type TamRequestPayload<TBody> = {
35
+ appHead: TamAppHead
36
+ head: TamHead
37
+ body: TBody
38
+ }
39
+
40
+ export type TamResponseHead = Omit<TamHead, 'pageIndex' | 'pageSize'> & {
41
+ ctrlBits?: string
42
+ extra?: Record<string, unknown>
43
+ pageIndex: number | string
44
+ pageSize: number | string
45
+ retCode: string
46
+ retMsg: string
47
+ retStatus: string
48
+ }
49
+
50
+ export type TamResponse<TBody> = {
51
+ head: TamResponseHead
52
+ body: TBody
53
+ }
54
+
55
+ type BuildTamPayloadOptions<TBody> = {
56
+ tranCode: string
57
+ body: TBody
58
+ pageIndex?: number
59
+ pageSize?: number
60
+ appHead?: Partial<TamAppHead>
61
+ head?: Partial<TamHead>
62
+ }
63
+
64
+ let consumerSeqSeed = Math.floor(Math.random() * 100000000)
65
+
66
+ export function buildTamRequestPayload<TBody>({
67
+ tranCode,
68
+ body,
69
+ pageIndex = 1,
70
+ pageSize = 10,
71
+ appHead,
72
+ head,
73
+ }: BuildTamPayloadOptions<TBody>): TamRequestPayload<TBody> {
74
+ const now = dayjs()
75
+ const loginContext = getTamLoginContext()
76
+
77
+ return {
78
+ appHead: {
79
+ fileName: '',
80
+ opType: '',
81
+ ip: loginContext.ip,
82
+ ...appHead,
83
+ },
84
+ head: {
85
+ adminUserId: '',
86
+ apprUserId: '',
87
+ areaCode: '0000',
88
+ branchId: loginContext.branchId,
89
+ consumerId: 'TAM001',
90
+ // 规则:当前登录用户 ID + 日期 + 8 位运行期递增序列。
91
+ consumerSeqNo: `${loginContext.userId}${now.format('YYYYMMDD')}${createConsumerSeq()}`,
92
+ digitalSign: '',
93
+ fileFlag: 'N',
94
+ filePath: '',
95
+ isBatch: false,
96
+ pageIndex,
97
+ pageSize,
98
+ spanId: '',
99
+ traceId: '',
100
+ tranCode,
101
+ tranDate: now.format('YYYYMMDD'),
102
+ tranTimestamp: now.format('HHmmss'),
103
+ userId: loginContext.userId,
104
+ verifyUserId: '',
105
+ versionId: '0001',
106
+ ...head,
107
+ },
108
+ body,
109
+ }
110
+ }
111
+
112
+ export async function tamRequest<TBody, TResponseBody>(
113
+ payload: TamRequestPayload<TBody>,
114
+ ): Promise<TamResponse<TResponseBody>> {
115
+ const response = await request<TamResponse<TResponseBody>, TamRequestPayload<TBody>>({
116
+ url: payload.head.tranCode,
117
+ method: 'POST',
118
+ data: payload,
119
+ })
120
+ const result = response as unknown as TamResponse<TResponseBody>
121
+
122
+ if (result.head?.retStatus && result.head.retStatus !== 'S') {
123
+ throw new Error(result.head.retMsg || '交易失败')
124
+ }
125
+
126
+ return result
127
+ }
128
+
129
+ function getTamLoginContext() {
130
+ const userStore = useUserStore()
131
+ const principal = userStore.authPayload?.principal
132
+
133
+ return {
134
+ // TAM 用户号优先取登录返回的 userId,兼容只返回 username 的场景。
135
+ userId: firstText(principal?.userId, principal?.username, userStore.username),
136
+ // 当前登录机构来自 /uaa/user/getOrgByUserName 的第一条记录。
137
+ branchId: firstText(
138
+ userStore.loginOrg?.orgNo,
139
+ userStore.loginOrg?.orgId,
140
+ principal?.branchId,
141
+ principal?.orgId,
142
+ principal?.currentOrgId,
143
+ getLastText(principal?.orgIds),
144
+ ),
145
+ // appHead.ip 使用登录返回的请求 IP。
146
+ ip: firstText(principal?.reqIpAddr, principal?.ip, principal?.loginIp),
147
+ }
148
+ }
149
+
150
+ function createConsumerSeq() {
151
+ consumerSeqSeed = (consumerSeqSeed + 1) % 100000000
152
+ return String(consumerSeqSeed).padStart(8, '0')
153
+ }
154
+
155
+ function getLastText(value: unknown) {
156
+ if (!Array.isArray(value)) return undefined
157
+
158
+ return [...value].reverse().find((item) => typeof item === 'string' && item.trim())
159
+ }
160
+
161
+ function firstText(...values: unknown[]) {
162
+ for (const value of values) {
163
+ if (typeof value !== 'string') continue
164
+
165
+ const text = value.trim()
166
+ if (text) return text
167
+ }
168
+
169
+ return ''
170
+ }
@@ -7,10 +7,27 @@ interface UserInfo {
7
7
  avatar: string
8
8
  }
9
9
 
10
+ export type UserOrg = {
11
+ orgNo: string
12
+ orgCnAbre: string
13
+ SORTNO: number
14
+ orgId: string
15
+ }
16
+
10
17
  export function getUserInfoApi(id: number) {
11
18
  return request<UserInfo>({ url: `/user/${id}` })
12
19
  }
13
20
 
21
+ export function getOrgByUserNameApi(username: string) {
22
+ return request<UserOrg[]>({
23
+ url: '/uaa/user/getOrgByUserName',
24
+ method: 'POST',
25
+ params: {
26
+ username,
27
+ },
28
+ })
29
+ }
30
+
14
31
  export function loginApi(data: { username: string; password: string }) {
15
32
  return request<AuthTokenResponse>({
16
33
  url: '/uaa/oauth/token',
@@ -25,6 +25,7 @@ declare module 'vue' {
25
25
  VanLoading: typeof import('vant/es')['Loading']
26
26
  VanPopup: typeof import('vant/es')['Popup']
27
27
  VanSearch: typeof import('vant/es')['Search']
28
+ VanSwitch: typeof import('vant/es')['Switch']
28
29
  VanTabbar: typeof import('vant/es')['Tabbar']
29
30
  VanTabbarItem: typeof import('vant/es')['TabbarItem']
30
31
  }
@@ -0,0 +1,6 @@
1
+ app_id=vue_demo;
2
+ version_code=10002;
3
+ version_name=1.0.0.02;
4
+ type=html5;
5
+ frame=vue;
6
+ platform=[mac,win,ios,android];
@@ -22,6 +22,18 @@ const router = createRouter({
22
22
  component: () => import('@/views/rmb-position/index.vue'),
23
23
  meta: { requiresAuth: true, hideTabbar: true },
24
24
  },
25
+ {
26
+ path: '/rmb-position/new',
27
+ name: 'RmbPositionCreate',
28
+ component: () => import('@/views/rmb-position-create/index.vue'),
29
+ meta: { requiresAuth: true, hideTabbar: true },
30
+ },
31
+ {
32
+ path: '/rmb-position/:predRefNo',
33
+ name: 'RmbPositionDetail',
34
+ component: () => import('@/views/rmb-position-detail/index.vue'),
35
+ meta: { requiresAuth: true, hideTabbar: true },
36
+ },
25
37
  {
26
38
  path: '/foreign-position',
27
39
  name: 'ForeignPosition',
@@ -88,6 +100,12 @@ const router = createRouter({
88
100
  component: () => import('@/views/mine/index.vue'),
89
101
  meta: { requiresAuth: true },
90
102
  },
103
+ {
104
+ path: '/settings',
105
+ name: 'Settings',
106
+ component: () => import('@/views/settings/index.vue'),
107
+ meta: { requiresAuth: true, hideTabbar: true },
108
+ },
91
109
  ],
92
110
  })
93
111
 
@@ -0,0 +1,40 @@
1
+ import { defineStore } from 'pinia'
2
+ import { waitNativeReady } from '@/core/mxApi'
3
+
4
+ /**
5
+ * 应用级状态 Store
6
+ *
7
+ * 存放全局共享的运行时状态,应用设置通过 persistedstate 持久化。
8
+ * initNativeDetection 在 main.ts 挂载前调用,组件读取时值已就绪。
9
+ */
10
+ export const useAppStore = defineStore(
11
+ 'app',
12
+ () => {
13
+ /** 是否在原生 APP WebView 环境中 */
14
+ const isNative = ref(false)
15
+
16
+ /** 是否在底部导航中显示公告入口 */
17
+ const showAnnouncementTab = ref(false)
18
+
19
+ /**
20
+ * 初始化原生环境检测
21
+ *
22
+ * 等待敏行宿主注入完成后判断当前运行环境。
23
+ */
24
+ async function initNativeDetection() {
25
+ isNative.value = await waitNativeReady()
26
+ }
27
+
28
+ function setShowAnnouncementTab(value: boolean) {
29
+ showAnnouncementTab.value = value
30
+ }
31
+
32
+ return { isNative, showAnnouncementTab, initNativeDetection, setShowAnnouncementTab }
33
+ },
34
+ {
35
+ persist: {
36
+ key: 'mini2_app_settings',
37
+ pick: ['showAnnouncementTab'],
38
+ },
39
+ },
40
+ )
@@ -1,12 +1,17 @@
1
1
  import { defineStore } from 'pinia'
2
+ import type { UserOrg } from '@/api/user'
3
+ import type { AuthTokenPayload } from '@/utils/auth-token'
2
4
 
3
5
  const LEGACY_TOKEN_KEYS = ['token', 'refresh_token', 'user']
4
6
 
7
+ /** 用户登录态在本地存储中的 key,由 pinia-plugin-persistedstate 使用。 */
8
+ const AUTH_PERSIST_KEY = 'mini2_user_auth'
9
+
5
10
  /**
6
11
  * 用户状态 Store
7
12
  *
8
13
  * 使用 Composition API 风格(setup 语法)定义。
9
- * token 只保存在 Pinia 内存态中,刷新页面后需要重新登录或通过敏行自动登录恢复。
14
+ * 登录信息通过 pinia-plugin-persistedstate 保存到本地,刷新页面后可继续使用。
10
15
  */
11
16
  export const useUserStore = defineStore(
12
17
  'user',
@@ -21,6 +26,12 @@ export const useUserStore = defineStore(
21
26
  const realName = ref('')
22
27
  const organizationName = ref('')
23
28
 
29
+ /** 登录接口原始返回信息,已在保存前去除敏感字段。 */
30
+ const authPayload = ref<AuthTokenPayload | null>(null)
31
+
32
+ /** 当前登录机构,登录后取机构列表第一条。 */
33
+ const loginOrg = ref<UserOrg | null>(null)
34
+
24
35
  clearLegacyStoredTokens()
25
36
 
26
37
  // ------------------------------ Actions --------------------------------
@@ -37,20 +48,41 @@ export const useUserStore = defineStore(
37
48
  refreshToken.value = value
38
49
  }
39
50
 
40
- function setAuthTokens(accessToken: string, newRefreshToken?: string) {
51
+ function setAuthTokens(
52
+ accessToken: string,
53
+ newRefreshToken?: string,
54
+ payload?: AuthTokenPayload,
55
+ ) {
41
56
  setToken(accessToken)
42
57
 
43
58
  if (newRefreshToken) {
44
59
  setRefreshToken(newRefreshToken)
45
60
  }
61
+
62
+ if (payload) {
63
+ authPayload.value = payload
64
+ }
46
65
  }
47
66
 
48
- function setUserInfo(info: { username?: string; realName?: string; organizationName?: string }) {
67
+ function setUserInfo(info: {
68
+ username?: string
69
+ realName?: string
70
+ organizationName?: string
71
+ }) {
49
72
  username.value = info.username || username.value
50
73
  realName.value = info.realName || realName.value
51
74
  organizationName.value = info.organizationName || organizationName.value
52
75
  }
53
76
 
77
+ function setAuthPayload(payload: AuthTokenPayload | null) {
78
+ authPayload.value = payload
79
+ }
80
+
81
+ function setLoginOrg(org: UserOrg) {
82
+ loginOrg.value = org
83
+ organizationName.value = org.orgCnAbre || organizationName.value
84
+ }
85
+
54
86
  /**
55
87
  * 清空 token
56
88
  * 退出登录或刷新 token 失败时调用。
@@ -61,6 +93,8 @@ export const useUserStore = defineStore(
61
93
  username.value = ''
62
94
  realName.value = ''
63
95
  organizationName.value = ''
96
+ authPayload.value = null
97
+ loginOrg.value = null
64
98
  }
65
99
 
66
100
  // ----------------------------- Return ----------------------------------
@@ -71,13 +105,31 @@ export const useUserStore = defineStore(
71
105
  username,
72
106
  realName,
73
107
  organizationName,
108
+ authPayload,
109
+ loginOrg,
74
110
  setToken,
75
111
  setRefreshToken,
76
112
  setAuthTokens,
77
113
  setUserInfo,
114
+ setAuthPayload,
115
+ setLoginOrg,
78
116
  clearToken,
79
117
  }
80
118
  },
119
+ {
120
+ persist: {
121
+ key: AUTH_PERSIST_KEY,
122
+ pick: [
123
+ 'token',
124
+ 'refreshToken',
125
+ 'username',
126
+ 'realName',
127
+ 'organizationName',
128
+ 'authPayload',
129
+ 'loginOrg',
130
+ ],
131
+ },
132
+ },
81
133
  )
82
134
 
83
135
  function clearLegacyStoredTokens() {
@@ -1,6 +1,6 @@
1
1
  /** 后端统一响应格式 */
2
2
  export interface ApiResponse<T = unknown> {
3
- code: number
3
+ code: number | string
4
4
  message: string
5
5
  data: T
6
6
  }