verce-vue-test 0.0.57 → 0.0.59

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.
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import AppTitleBar from '@/components/AppTitleBar.vue'
2
3
  import { useAppStore } from '@/stores/app'
3
4
 
4
5
  const route = useRoute()
@@ -16,6 +17,9 @@ const tabItems = computed(() =>
16
17
  )
17
18
 
18
19
  const showTabbar = computed(() => route.meta.hideTabbar !== true)
20
+ const noBackRouteNames = new Set(['Home', 'Login', 'Articles', 'Mine'])
21
+ const headerTitle = computed(() => String(route.meta.title || ''))
22
+ const showHeaderBack = computed(() => !noBackRouteNames.has(String(route.name || '')))
19
23
 
20
24
  const activeTab = computed({
21
25
  get: () => route.path,
@@ -29,6 +33,8 @@ const activeTab = computed({
29
33
 
30
34
  <template>
31
35
  <div class="app-shell">
36
+ <AppTitleBar :title="headerTitle" :show-back="showHeaderBack" @back="router.back()" />
37
+
32
38
  <router-view v-slot="{ Component }">
33
39
  <keep-alive include="HomePage">
34
40
  <component :is="Component" />
@@ -36,7 +42,12 @@ const activeTab = computed({
36
42
  </router-view>
37
43
 
38
44
  <van-tabbar v-if="showTabbar" v-model="activeTab" fixed placeholder safe-area-inset-bottom>
39
- <van-tabbar-item v-for="item in tabItems" :key="item.path" :name="item.path" :icon="item.icon">
45
+ <van-tabbar-item
46
+ v-for="item in tabItems"
47
+ :key="item.path"
48
+ :name="item.path"
49
+ :icon="item.icon"
50
+ >
40
51
  {{ item.title }}
41
52
  </van-tabbar-item>
42
53
  </van-tabbar>
@@ -4,6 +4,7 @@ import {
4
4
  type TamRequestPayload,
5
5
  type TamResponse,
6
6
  } from '@/api/tam'
7
+ import { useAppStore } from '@/stores/app'
7
8
 
8
9
  export type RmbForecastRecord = {
9
10
  /** 业务类型,用于映射列表中的业务名称。 */
@@ -171,7 +172,7 @@ export function buildRmbForecastQueryPayload({
171
172
  pageIndex,
172
173
  pageSize,
173
174
  }: QueryOptions): RmbForecastQueryPayload {
174
- const tranDate = normalizeDate(form.tranDate)
175
+ const tranDate = normalizeDate(form.tranDate || useAppStore().systemWorkDate)
175
176
 
176
177
  // 当前视图只提供交易日期、落地机构、起始金额、截止金额,其余查询字段按接口约定传空。
177
178
  return buildTamRequestPayload({
@@ -1,5 +1,6 @@
1
1
  import dayjs from 'dayjs'
2
2
  import { request } from '@/core/request'
3
+ import { useAppStore } from '@/stores/app'
3
4
  import { useUserStore } from '@/stores/user'
4
5
 
5
6
  export type TamAppHead = {
@@ -72,7 +73,9 @@ export function buildTamRequestPayload<TBody>({
72
73
  head,
73
74
  }: BuildTamPayloadOptions<TBody>): TamRequestPayload<TBody> {
74
75
  const now = dayjs()
76
+ const appStore = useAppStore()
75
77
  const loginContext = getTamLoginContext()
78
+ const tranDate = appStore.systemWorkDateCompact
76
79
 
77
80
  return {
78
81
  appHead: {
@@ -88,7 +91,7 @@ export function buildTamRequestPayload<TBody>({
88
91
  branchId: loginContext.branchId,
89
92
  consumerId: 'TAM001',
90
93
  // 规则:当前登录用户 ID + 日期 + 8 位运行期递增序列。
91
- consumerSeqNo: `${loginContext.userId}${now.format('YYYYMMDD')}${createConsumerSeq()}`,
94
+ consumerSeqNo: `${loginContext.userId}${tranDate}${createConsumerSeq()}`,
92
95
  digitalSign: '',
93
96
  fileFlag: 'N',
94
97
  filePath: '',
@@ -98,7 +101,7 @@ export function buildTamRequestPayload<TBody>({
98
101
  spanId: '',
99
102
  traceId: '',
100
103
  tranCode,
101
- tranDate: now.format('YYYYMMDD'),
104
+ tranDate,
102
105
  tranTimestamp: now.format('HHmmss'),
103
106
  userId: loginContext.userId,
104
107
  verifyUserId: '',
@@ -14,6 +14,20 @@ export type UserOrg = {
14
14
  orgId: string
15
15
  }
16
16
 
17
+ export type LastLoginTimeInfo = {
18
+ loginTm?: string
19
+ userRealName?: string
20
+ reqMsg?: string
21
+ optType?: string
22
+ loginLogId?: string
23
+ optDesc?: string
24
+ loginUserName?: string
25
+ respMsg?: string
26
+ appDt?: string
27
+ respCd?: string
28
+ reqIpAddr?: string
29
+ }
30
+
17
31
  export function getUserInfoApi(id: number) {
18
32
  return request<UserInfo>({ url: `/user/${id}` })
19
33
  }
@@ -28,6 +42,13 @@ export function getOrgByUserNameApi(username: string) {
28
42
  })
29
43
  }
30
44
 
45
+ export function getLastLoginTimeApi() {
46
+ return request<LastLoginTimeInfo>({
47
+ url: '/uaa/log/lastLoginTime',
48
+ method: 'GET',
49
+ })
50
+ }
51
+
31
52
  export function loginApi(data: { username: string; password: string }) {
32
53
  return request<AuthTokenResponse>({
33
54
  url: '/uaa/oauth/token',
@@ -1,5 +1,7 @@
1
1
  <script setup lang="ts">
2
- defineOptions({ name: 'AnnouncementTitleBar' })
2
+ import { closeWindow, hideWebViewTitle } from '@/core/mxApi'
3
+
4
+ defineOptions({ name: 'AppTitleBar' })
3
5
 
4
6
  withDefaults(
5
7
  defineProps<{
@@ -19,14 +21,23 @@ const emit = defineEmits<{
19
21
  capsuleMore: []
20
22
  capsuleClose: []
21
23
  }>()
24
+
25
+ onMounted(() => {
26
+ hideWebViewTitle()
27
+ })
28
+
29
+ function handleCapsuleClose() {
30
+ emit('capsuleClose')
31
+ closeWindow()
32
+ }
22
33
  </script>
23
34
 
24
35
  <template>
25
- <header class="announcement-title-bar">
26
- <div class="announcement-title-bar__inner">
36
+ <header class="app-title-bar">
37
+ <div class="app-title-bar__inner">
27
38
  <button
28
39
  v-if="showBack"
29
- class="announcement-title-bar__back"
40
+ class="app-title-bar__back"
30
41
  type="button"
31
42
  :aria-label="backAriaLabel"
32
43
  @click="emit('back')"
@@ -34,29 +45,29 @@ const emit = defineEmits<{
34
45
  <van-icon name="arrow-left" />
35
46
  </button>
36
47
 
37
- <h1 class="announcement-title-bar__title">{{ title }}</h1>
48
+ <h1 class="app-title-bar__title">{{ title }}</h1>
38
49
 
39
- <div class="announcement-title-bar__capsule" role="group" aria-label="页面操作">
50
+ <div class="app-title-bar__capsule" role="group" aria-label="页面操作">
40
51
  <button
41
- class="announcement-title-bar__capsule-btn"
52
+ class="app-title-bar__capsule-btn"
42
53
  type="button"
43
54
  aria-label="更多"
44
55
  @click="emit('capsuleMore')"
45
56
  >
46
- <span class="announcement-title-bar__dots" aria-hidden="true">
57
+ <span class="app-title-bar__dots" aria-hidden="true">
47
58
  <i></i>
48
59
  <i></i>
49
60
  <i></i>
50
61
  </span>
51
62
  </button>
52
- <span class="announcement-title-bar__divider" aria-hidden="true"></span>
63
+ <span class="app-title-bar__divider" aria-hidden="true"></span>
53
64
  <button
54
- class="announcement-title-bar__capsule-btn"
65
+ class="app-title-bar__capsule-btn"
55
66
  type="button"
56
67
  aria-label="关闭"
57
- @click="emit('capsuleClose')"
68
+ @click="handleCapsuleClose"
58
69
  >
59
- <span class="announcement-title-bar__circle" aria-hidden="true"></span>
70
+ <span class="app-title-bar__circle" aria-hidden="true"></span>
60
71
  </button>
61
72
  </div>
62
73
  </div>
@@ -64,20 +75,20 @@ const emit = defineEmits<{
64
75
  </template>
65
76
 
66
77
  <style scoped>
67
- .announcement-title-bar {
78
+ .app-title-bar {
68
79
  position: sticky;
69
80
  top: 0;
70
81
  z-index: 20;
71
82
  width: 100%;
72
83
  height: calc(50px + env(safe-area-inset-top));
73
84
  padding-top: env(safe-area-inset-top);
85
+ border-bottom: 1px solid #f0f1f3;
74
86
  color: #171b20;
75
- background: rgba(247, 248, 250, 0.96);
76
- backdrop-filter: blur(12px);
87
+ background: #ffffff;
77
88
  box-sizing: border-box;
78
89
  }
79
90
 
80
- .announcement-title-bar__inner {
91
+ .app-title-bar__inner {
81
92
  position: relative;
82
93
  display: flex;
83
94
  align-items: center;
@@ -90,8 +101,8 @@ const emit = defineEmits<{
90
101
  box-sizing: border-box;
91
102
  }
92
103
 
93
- .announcement-title-bar__back,
94
- .announcement-title-bar__capsule-btn {
104
+ .app-title-bar__back,
105
+ .app-title-bar__capsule-btn {
95
106
  border: 0;
96
107
  padding: 0;
97
108
  font: inherit;
@@ -100,7 +111,7 @@ const emit = defineEmits<{
100
111
  cursor: pointer;
101
112
  }
102
113
 
103
- .announcement-title-bar__back {
114
+ .app-title-bar__back {
104
115
  position: absolute;
105
116
  left: 10px;
106
117
  top: 50%;
@@ -115,11 +126,11 @@ const emit = defineEmits<{
115
126
  transform: translateY(-50%);
116
127
  }
117
128
 
118
- .announcement-title-bar__back:active {
129
+ .app-title-bar__back:active {
119
130
  background: rgba(23, 27, 32, 0.06);
120
131
  }
121
132
 
122
- .announcement-title-bar__title {
133
+ .app-title-bar__title {
123
134
  position: absolute;
124
135
  left: 106px;
125
136
  right: 106px;
@@ -135,7 +146,7 @@ const emit = defineEmits<{
135
146
  pointer-events: none;
136
147
  }
137
148
 
138
- .announcement-title-bar__capsule {
149
+ .app-title-bar__capsule {
139
150
  position: absolute;
140
151
  right: 10px;
141
152
  top: 50%;
@@ -154,7 +165,7 @@ const emit = defineEmits<{
154
165
  transform: translateY(-50%);
155
166
  }
156
167
 
157
- .announcement-title-bar__capsule-btn {
168
+ .app-title-bar__capsule-btn {
158
169
  display: flex;
159
170
  align-items: center;
160
171
  justify-content: center;
@@ -163,30 +174,30 @@ const emit = defineEmits<{
163
174
  color: #171b20;
164
175
  }
165
176
 
166
- .announcement-title-bar__capsule-btn:active {
177
+ .app-title-bar__capsule-btn:active {
167
178
  background: rgba(23, 27, 32, 0.06);
168
179
  }
169
180
 
170
- .announcement-title-bar__divider {
181
+ .app-title-bar__divider {
171
182
  width: 1px;
172
183
  height: 18px;
173
184
  background: rgba(23, 27, 32, 0.12);
174
185
  }
175
186
 
176
- .announcement-title-bar__dots {
187
+ .app-title-bar__dots {
177
188
  display: flex;
178
189
  align-items: center;
179
190
  gap: 4px;
180
191
  }
181
192
 
182
- .announcement-title-bar__dots i {
193
+ .app-title-bar__dots i {
183
194
  width: 4px;
184
195
  height: 4px;
185
196
  border-radius: 50%;
186
197
  background: #171b20;
187
198
  }
188
199
 
189
- .announcement-title-bar__circle {
200
+ .app-title-bar__circle {
190
201
  position: relative;
191
202
  width: 18px;
192
203
  height: 18px;
@@ -195,7 +206,7 @@ const emit = defineEmits<{
195
206
  box-sizing: border-box;
196
207
  }
197
208
 
198
- .announcement-title-bar__circle::after {
209
+ .app-title-bar__circle::after {
199
210
  position: absolute;
200
211
  left: 50%;
201
212
  top: 50%;
@@ -208,7 +219,7 @@ const emit = defineEmits<{
208
219
  }
209
220
 
210
221
  @media (max-width: 360px) {
211
- .announcement-title-bar__title {
222
+ .app-title-bar__title {
212
223
  left: 58px;
213
224
  right: 106px;
214
225
  }
@@ -11,7 +11,7 @@ export {}
11
11
  /* prettier-ignore */
12
12
  declare module 'vue' {
13
13
  export interface GlobalComponents {
14
- AnnouncementTitleBar: typeof import('./components/AnnouncementTitleBar.vue')['default']
14
+ AppTitleBar: typeof import('./components/AppTitleBar.vue')['default']
15
15
  RouterLink: typeof import('vue-router')['RouterLink']
16
16
  RouterView: typeof import('vue-router')['RouterView']
17
17
  VanButton: typeof import('vant/es')['Button']
@@ -84,6 +84,55 @@ interface NXCommonHost {
84
84
  ajax?: (options: MXAjaxParams) => void
85
85
  }
86
86
 
87
+ export type MXWebuiSideSlot = {
88
+ default?: boolean
89
+ hidden?: boolean
90
+ disable?: boolean
91
+ content?: string | 'default'
92
+ action?: (() => void) | 'default' | 'custom' | 'native' | 'both'
93
+ preventDefault?: boolean
94
+ }
95
+
96
+ export type MXWebuiTitleSlot = {
97
+ default?: boolean
98
+ hidden?: boolean
99
+ title?: string
100
+ subtitle?: string
101
+ }
102
+
103
+ export type MXWebuiInteractiveSlot = {
104
+ default?: boolean
105
+ hidden?: boolean
106
+ title: string[]
107
+ action?: (idx: number) => void
108
+ active?: number
109
+ }
110
+
111
+ export type MXWebuiHeaderSlot = {
112
+ left?: MXWebuiSideSlot
113
+ left_1?: MXWebuiSideSlot
114
+ left_2?: MXWebuiSideSlot
115
+ middle?: MXWebuiTitleSlot | MXWebuiInteractiveSlot
116
+ right_1?: MXWebuiSideSlot
117
+ right_2?: MXWebuiSideSlot
118
+ }
119
+
120
+ export type MXWebuiCustomHeaderOptions = {
121
+ slot: MXWebuiHeaderSlot
122
+ onSuccess?: () => void
123
+ onFail?: (error: unknown) => void
124
+ }
125
+
126
+ interface MXWebuiHost {
127
+ hideWebViewTitle?: () => void
128
+ showWebViewTitle?: (title?: string) => void
129
+ setWebViewTitle?: (title: string) => void
130
+ setNavBgColor?: (bgColor: string) => void
131
+ closeWindow?: () => void
132
+ setCustomHeader?: (options: MXWebuiCustomHeaderOptions) => void
133
+ updateCustomHeader?: (options: MXWebuiCustomHeaderOptions) => void
134
+ }
135
+
87
136
  const DEFAULT_NATIVE_TIMEOUT = 5000
88
137
  const NATIVE_POLL_INTERVAL = 100
89
138
 
@@ -92,12 +141,16 @@ declare global {
92
141
  const MXCommon: MXCommonHost | undefined
93
142
  /** 敏行新宿主命名空间,部分客户端使用 NXCommon。 */
94
143
  const NXCommon: NXCommonHost | undefined
144
+ /** 敏行原生 UI 宿主命名空间。 */
145
+ const MXWebui: MXWebuiHost | undefined
95
146
 
96
147
  interface Window {
97
148
  /** 敏行旧宿主命名空间。 */
98
149
  MXCommon?: MXCommonHost
99
150
  /** 敏行新宿主命名空间,部分客户端使用 NXCommon。 */
100
151
  NXCommon?: NXCommonHost
152
+ /** 敏行原生 UI 宿主命名空间。 */
153
+ MXWebui?: MXWebuiHost
101
154
  }
102
155
  }
103
156
 
@@ -115,11 +168,16 @@ const getMXCommon = () => (typeof MXCommon !== 'undefined' ? MXCommon : undefine
115
168
 
116
169
  const getNXCommon = () => (typeof NXCommon !== 'undefined' ? NXCommon : undefined)
117
170
 
171
+ const getMXWebui = () => (typeof MXWebui !== 'undefined' ? MXWebui : undefined)
172
+
118
173
  const getNativeSnapshot = () => ({
119
174
  是否存在MXCommon: typeof MXCommon !== 'undefined',
120
175
  是否存在NXCommon: typeof NXCommon !== 'undefined',
176
+ 是否存在MXWebui: typeof MXWebui !== 'undefined',
121
177
  是否存在MXCommonAjax: typeof MXCommon !== 'undefined' && typeof MXCommon.ajax === 'function',
122
178
  是否存在NXCommonAjax: typeof NXCommon !== 'undefined' && typeof NXCommon.ajax === 'function',
179
+ 是否存在隐藏原生标题栏方法:
180
+ typeof MXWebui !== 'undefined' && typeof MXWebui.hideWebViewTitle === 'function',
123
181
  是否存在获取Token方法:
124
182
  typeof MXCommon !== 'undefined' && typeof MXCommon.getEncryptString === 'function',
125
183
  })
@@ -259,13 +317,62 @@ export function getAppToken(): Promise<string> {
259
317
  */
260
318
  export const getEncryptString = getAppToken
261
319
 
320
+ function callMXWebui(method: keyof MXWebuiHost, ...args: unknown[]) {
321
+ const host = getMXWebui()
322
+ const api = host?.[method]
323
+
324
+ if (typeof api !== 'function') {
325
+ return false
326
+ }
327
+
328
+ try {
329
+ ;(api as (...params: unknown[]) => unknown)(...args)
330
+ return true
331
+ } catch (error) {
332
+ console.error(`[敏行UI] ${String(method)} 调用失败`, error)
333
+ return false
334
+ }
335
+ }
336
+
337
+ export function hideWebViewTitle() {
338
+ return callMXWebui('hideWebViewTitle')
339
+ }
340
+
341
+ export function showWebViewTitle(title?: string) {
342
+ return typeof title === 'string'
343
+ ? callMXWebui('showWebViewTitle', title)
344
+ : callMXWebui('showWebViewTitle')
345
+ }
346
+
347
+ export function setWebViewTitle(title: string) {
348
+ return callMXWebui('setWebViewTitle', title)
349
+ }
350
+
351
+ export function setNavBgColor(bgColor: string) {
352
+ return callMXWebui('setNavBgColor', bgColor)
353
+ }
354
+
355
+ export function closeWindow() {
356
+ return callMXWebui('closeWindow')
357
+ }
358
+
359
+ export function setCustomHeader(options: MXWebuiCustomHeaderOptions) {
360
+ return callMXWebui('setCustomHeader', options)
361
+ }
362
+
363
+ export function updateCustomHeader(options: MXWebuiCustomHeaderOptions) {
364
+ return callMXWebui('updateCustomHeader', options)
365
+ }
366
+
262
367
  /**
263
368
  * 判断当前页面是否运行在敏行宿主环境中。
264
369
  *
265
370
  * 只要宿主注入了 MXCommon 或 NXCommon,就认为是原生环境。
266
371
  */
267
372
  export const isNativeApp = (): boolean =>
268
- typeof MXCommon !== 'undefined' || typeof NXCommon !== 'undefined'
373
+ typeof MXCommon !== 'undefined' ||
374
+ typeof NXCommon !== 'undefined' ||
375
+ typeof MXWebui !== 'undefined'
269
376
 
270
377
  /**
271
378
  * 等待敏行宿主完成注入后再判断是否为 APP 环境。
@@ -8,103 +8,103 @@ const router = createRouter({
8
8
  path: '/',
9
9
  name: 'Home',
10
10
  component: () => import('@/views/home/index.vue'),
11
- meta: { requiresAuth: true },
11
+ meta: { requiresAuth: true, title: '头寸管理平台' },
12
12
  },
13
13
  {
14
14
  path: '/login',
15
15
  name: 'Login',
16
16
  component: () => import('@/views/login/index.vue'),
17
- meta: { hideTabbar: true },
17
+ meta: { hideTabbar: true, title: '账号登录' },
18
18
  },
19
19
  {
20
20
  path: '/rmb-position',
21
21
  name: 'RmbPosition',
22
22
  component: () => import('@/views/rmb-position/index.vue'),
23
- meta: { requiresAuth: true, hideTabbar: true },
23
+ meta: { requiresAuth: true, hideTabbar: true, title: '本币预报信息查询' },
24
24
  },
25
25
  {
26
26
  path: '/rmb-position/new',
27
27
  name: 'RmbPositionCreate',
28
28
  component: () => import('@/views/rmb-position-create/index.vue'),
29
- meta: { requiresAuth: true, hideTabbar: true },
29
+ meta: { requiresAuth: true, hideTabbar: true, title: '新增本币预报' },
30
30
  },
31
31
  {
32
32
  path: '/rmb-position/:predRefNo',
33
33
  name: 'RmbPositionDetail',
34
34
  component: () => import('@/views/rmb-position-detail/index.vue'),
35
- meta: { requiresAuth: true, hideTabbar: true },
35
+ meta: { requiresAuth: true, hideTabbar: true, title: '预报详情' },
36
36
  },
37
37
  {
38
38
  path: '/foreign-position',
39
39
  name: 'ForeignPosition',
40
40
  component: () => import('@/views/foreign-position/index.vue'),
41
- meta: { requiresAuth: true },
41
+ meta: { requiresAuth: true, title: '外币头寸预报及查询' },
42
42
  },
43
43
  {
44
44
  path: '/pbc-position',
45
45
  name: 'PbcPosition',
46
46
  component: () => import('@/views/pbc-position/index.vue'),
47
- meta: { requiresAuth: true, hideTabbar: true },
47
+ meta: { requiresAuth: true, hideTabbar: true, title: '人行头寸余额查询' },
48
48
  },
49
49
  {
50
50
  path: '/position-estimate',
51
51
  name: 'PositionEstimate',
52
52
  component: () => import('@/views/position-estimate/index.vue'),
53
- meta: { requiresAuth: true },
53
+ meta: { requiresAuth: true, title: '头寸匡算' },
54
54
  },
55
55
  {
56
56
  path: '/net-debit',
57
57
  name: 'NetDebit',
58
58
  component: () => import('@/views/net-debit/index.vue'),
59
- meta: { requiresAuth: true },
59
+ meta: { requiresAuth: true, title: '人民币净借记可用额度管理' },
60
60
  },
61
61
  {
62
62
  path: '/clearing-detail',
63
63
  name: 'ClearingDetail',
64
64
  component: () => import('@/views/clearing-detail/index.vue'),
65
- meta: { requiresAuth: true },
65
+ meta: { requiresAuth: true, title: '人民币小额网银清算场次明细' },
66
66
  },
67
67
  {
68
68
  path: '/warning',
69
69
  name: 'Warning',
70
70
  component: () => import('@/views/warning/index.vue'),
71
- meta: { requiresAuth: true },
71
+ meta: { requiresAuth: true, title: '预警信息' },
72
72
  },
73
73
  {
74
74
  path: '/articles',
75
75
  name: 'Articles',
76
76
  component: () => import('@/views/articles/index.vue'),
77
- meta: { requiresAuth: true },
77
+ meta: { requiresAuth: true, title: '公告' },
78
78
  },
79
79
  {
80
80
  path: '/articles/new',
81
81
  name: 'ArticlePublish',
82
82
  component: () => import('@/views/article-edit/index.vue'),
83
- meta: { requiresAuth: true, hideTabbar: true },
83
+ meta: { requiresAuth: true, hideTabbar: true, title: '发布公告' },
84
84
  },
85
85
  {
86
86
  path: '/articles/:id',
87
87
  name: 'ArticleDetail',
88
88
  component: () => import('@/views/article-detail/index.vue'),
89
- meta: { requiresAuth: true, hideTabbar: true },
89
+ meta: { requiresAuth: true, hideTabbar: true, title: '公告详情' },
90
90
  },
91
91
  {
92
92
  path: '/articles/:id/edit',
93
93
  name: 'ArticleEdit',
94
94
  component: () => import('@/views/article-edit/index.vue'),
95
- meta: { requiresAuth: true, hideTabbar: true },
95
+ meta: { requiresAuth: true, hideTabbar: true, title: '编辑公告' },
96
96
  },
97
97
  {
98
98
  path: '/mine',
99
99
  name: 'Mine',
100
100
  component: () => import('@/views/mine/index.vue'),
101
- meta: { requiresAuth: true },
101
+ meta: { requiresAuth: true, title: '我的' },
102
102
  },
103
103
  {
104
104
  path: '/settings',
105
105
  name: 'Settings',
106
106
  component: () => import('@/views/settings/index.vue'),
107
- meta: { requiresAuth: true, hideTabbar: true },
107
+ meta: { requiresAuth: true, hideTabbar: true, title: '设置' },
108
108
  },
109
109
  ],
110
110
  })
@@ -16,6 +16,15 @@ export const useAppStore = defineStore(
16
16
  /** 是否在底部导航中显示公告入口 */
17
17
  const showAnnouncementTab = ref(false)
18
18
 
19
+ /** 后端返回的系统工作日期原始值,来自 /uaa/log/lastLoginTime 的 appDt。 */
20
+ const systemAppDate = ref('')
21
+
22
+ /** 系统工作日期,页面日期控件使用 YYYY-MM-DD。 */
23
+ const systemWorkDate = computed(() => normalizeSystemWorkDate(systemAppDate.value) || today())
24
+
25
+ /** 系统工作日期,TAM 等接口使用 YYYYMMDD。 */
26
+ const systemWorkDateCompact = computed(() => systemWorkDate.value.replaceAll('-', ''))
27
+
19
28
  /**
20
29
  * 初始化原生环境检测
21
30
  *
@@ -29,12 +38,57 @@ export const useAppStore = defineStore(
29
38
  showAnnouncementTab.value = value
30
39
  }
31
40
 
32
- return { isNative, showAnnouncementTab, initNativeDetection, setShowAnnouncementTab }
41
+ function setSystemAppDate(value: string) {
42
+ systemAppDate.value = value
43
+ }
44
+
45
+ function clearSystemAppDate() {
46
+ systemAppDate.value = ''
47
+ }
48
+
49
+ return {
50
+ isNative,
51
+ showAnnouncementTab,
52
+ systemAppDate,
53
+ systemWorkDate,
54
+ systemWorkDateCompact,
55
+ initNativeDetection,
56
+ setShowAnnouncementTab,
57
+ setSystemAppDate,
58
+ clearSystemAppDate,
59
+ }
33
60
  },
34
61
  {
35
62
  persist: {
36
63
  key: 'mini2_app_settings',
37
- pick: ['showAnnouncementTab'],
64
+ pick: ['showAnnouncementTab', 'systemAppDate'],
38
65
  },
39
66
  },
40
67
  )
68
+
69
+ function normalizeSystemWorkDate(value: string) {
70
+ const text = value.trim()
71
+
72
+ if (!text) return ''
73
+
74
+ const dashedDate = text.match(/^(\d{4})-(\d{2})-(\d{2})/)
75
+ if (dashedDate) {
76
+ return `${dashedDate[1]}-${dashedDate[2]}-${dashedDate[3]}`
77
+ }
78
+
79
+ const compactDate = text.match(/^(\d{4})(\d{2})(\d{2})/)
80
+ if (compactDate) {
81
+ return `${compactDate[1]}-${compactDate[2]}-${compactDate[3]}`
82
+ }
83
+
84
+ return ''
85
+ }
86
+
87
+ function today() {
88
+ const now = new Date()
89
+ const year = now.getFullYear()
90
+ const month = String(now.getMonth() + 1).padStart(2, '0')
91
+ const day = String(now.getDate()).padStart(2, '0')
92
+
93
+ return `${year}-${month}-${day}`
94
+ }