af-mobile-client-vue3 1.1.8 → 1.1.9

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 (80) hide show
  1. package/.env +6 -6
  2. package/.env.development +4 -4
  3. package/.env.envoiceShow +6 -6
  4. package/.env.production +6 -6
  5. package/.husky/commit-msg +1 -1
  6. package/.husky/pre-commit +1 -1
  7. package/.vscode/settings.json +61 -61
  8. package/mock/modules/user.mock.ts +152 -152
  9. package/package.json +1 -1
  10. package/public/favicon.svg +4 -4
  11. package/public/safari-pinned-tab.svg +32 -32
  12. package/scripts/verifyCommit.js +19 -19
  13. package/src/App.vue +43 -43
  14. package/src/api/user/index.ts +40 -40
  15. package/src/bootstrap.ts +18 -18
  16. package/src/components/core/NavBar/index.vue +12 -12
  17. package/src/components/core/Tabbar/index.vue +38 -38
  18. package/src/components/core/XGridDropOption/index.vue +151 -151
  19. package/src/components/core/XMultiSelect/index.vue +183 -183
  20. package/src/components/data/XCellDetail/index.vue +106 -106
  21. package/src/components/data/XFormItem/index.vue +26 -7
  22. package/src/components/data/XOlMap/XLocationPicker/index.vue +7 -9
  23. package/src/components/data/XOlMap/index.vue +103 -96
  24. package/src/components/data/XOlMap/utils/wgs84ToGcj02.js +154 -154
  25. package/src/components/data/XReportForm/XReportFormJsonRender.vue +220 -220
  26. package/src/components/data/XReportForm/index.vue +1079 -1079
  27. package/src/components/data/XReportGrid/XAddReport/index.ts +1 -1
  28. package/src/components/data/XReportGrid/XReportDrawer/index.ts +1 -1
  29. package/src/components/data/XSignature/index.vue +285 -285
  30. package/src/components/data/XTag/index.vue +10 -10
  31. package/src/components/layout/NormalDataLayout/index.vue +70 -70
  32. package/src/components/layout/TabBarLayout/index.vue +40 -40
  33. package/src/components.d.ts +53 -53
  34. package/src/env.d.ts +16 -16
  35. package/src/font-style/font.css +3 -3
  36. package/src/hooks/useCommon.ts +9 -9
  37. package/src/locales/en-US.json +25 -25
  38. package/src/locales/zh-CN.json +25 -25
  39. package/src/plugins/AppData.ts +38 -38
  40. package/src/router/guards.ts +59 -59
  41. package/src/router/index.ts +61 -61
  42. package/src/router/invoiceRoutes.ts +33 -33
  43. package/src/services/api/common.ts +109 -109
  44. package/src/services/api/manage.ts +8 -8
  45. package/src/services/api/search.ts +16 -16
  46. package/src/services/restTools.ts +56 -56
  47. package/src/services/v3Api.ts +11 -11
  48. package/src/stores/modules/setting.ts +52 -52
  49. package/src/stores/mutation-type.ts +7 -7
  50. package/src/utils/authority-utils.ts +84 -84
  51. package/src/utils/crypto.ts +39 -39
  52. package/src/utils/i18n.ts +41 -41
  53. package/src/utils/indexedDB.ts +180 -180
  54. package/src/utils/mobileUtil.ts +26 -26
  55. package/src/utils/routerUtil.ts +271 -271
  56. package/src/utils/runEvalFunction.ts +13 -13
  57. package/src/utils/wechatUtil.ts +9 -9
  58. package/src/views/common/LoadError.vue +64 -64
  59. package/src/views/common/NotFound.vue +68 -68
  60. package/src/views/component/EvaluateRecordView/index.vue +40 -40
  61. package/src/views/component/XCellDetailView/index.vue +217 -217
  62. package/src/views/component/XCellListView/index.vue +3 -88
  63. package/src/views/component/XFormGroupView/index.vue +0 -37
  64. package/src/views/component/XFormView/index.vue +30 -119
  65. package/src/views/component/XFormView/oldindex.vue +50 -0
  66. package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -120
  67. package/src/views/component/XOlMapView/index.vue +3 -5
  68. package/src/views/component/XReportFormIframeView/index.vue +47 -47
  69. package/src/views/component/XReportFormView/index.vue +13 -13
  70. package/src/views/component/XSignatureView/index.vue +50 -50
  71. package/src/views/component/menu.vue +117 -117
  72. package/src/views/component/notice.vue +46 -46
  73. package/src/views/component/topNav.vue +36 -36
  74. package/src/views/invoiceShow/index.vue +61 -61
  75. package/src/views/user/login/ForgetPasswordForm.vue +94 -94
  76. package/src/views/user/login/LoginTitle.vue +68 -68
  77. package/src/views/user/login/index.vue +22 -22
  78. package/src/views/user/my/index.vue +230 -230
  79. package/src/vue-router.d.ts +9 -9
  80. package/tsconfig.json +43 -43
@@ -1,56 +1,56 @@
1
- import { http } from '@af-mobile-client-vue3/utils/http'
2
-
3
- /**
4
- * GET请求
5
- * @param url 请求地址
6
- * @param params 路径参数
7
- */
8
- export function get<T = any>(url: string, params?: any): Promise<T> {
9
- return http.request<T>({
10
- url,
11
- method: 'GET',
12
- params,
13
- })
14
- }
15
-
16
- /**
17
- * POST请求
18
- * @param url 请求地址
19
- * @param data 请求参数
20
- */
21
- /**
22
- * POST请求
23
- * @param url 请求地址
24
- * @param data 请求参数
25
- */
26
- export function post<T = any>(url: string, data: any): Promise<T> {
27
- return http.request <T>({
28
- url,
29
- method: 'POST',
30
- data,
31
- })
32
- }
33
-
34
- export function postWithConfig<T = any>(url: string, data: any, config: any): Promise<T> {
35
- return http.request<T>({
36
- url,
37
- method: 'POST',
38
- data,
39
- headers: { ...config },
40
- })
41
- }
42
-
43
- /**
44
- * DELETE请求
45
- * @param url 请求地址
46
- * @param data 查询参数
47
- * @param config 额外的配置项(如自定义头信息等)
48
- */
49
- export function del<T = any>(url: string, data?: any, config?: any): Promise<T> {
50
- return http.request<T>({
51
- url,
52
- method: 'DELETE',
53
- data,
54
- ...config,
55
- })
56
- }
1
+ import { http } from '@af-mobile-client-vue3/utils/http'
2
+
3
+ /**
4
+ * GET请求
5
+ * @param url 请求地址
6
+ * @param params 路径参数
7
+ */
8
+ export function get<T = any>(url: string, params?: any): Promise<T> {
9
+ return http.request<T>({
10
+ url,
11
+ method: 'GET',
12
+ params,
13
+ })
14
+ }
15
+
16
+ /**
17
+ * POST请求
18
+ * @param url 请求地址
19
+ * @param data 请求参数
20
+ */
21
+ /**
22
+ * POST请求
23
+ * @param url 请求地址
24
+ * @param data 请求参数
25
+ */
26
+ export function post<T = any>(url: string, data: any): Promise<T> {
27
+ return http.request <T>({
28
+ url,
29
+ method: 'POST',
30
+ data,
31
+ })
32
+ }
33
+
34
+ export function postWithConfig<T = any>(url: string, data: any, config: any): Promise<T> {
35
+ return http.request<T>({
36
+ url,
37
+ method: 'POST',
38
+ data,
39
+ headers: { ...config },
40
+ })
41
+ }
42
+
43
+ /**
44
+ * DELETE请求
45
+ * @param url 请求地址
46
+ * @param data 查询参数
47
+ * @param config 额外的配置项(如自定义头信息等)
48
+ */
49
+ export function del<T = any>(url: string, data?: any, config?: any): Promise<T> {
50
+ return http.request<T>({
51
+ url,
52
+ method: 'DELETE',
53
+ data,
54
+ ...config,
55
+ })
56
+ }
@@ -9,7 +9,7 @@ function getLeafNodes(nodes) {
9
9
  if (node.children && node.children.length) {
10
10
  // 递归处理子节点并合并结果
11
11
  leaves.push(...getLeafNodes(node.children))
12
- }
12
+ }
13
13
  else {
14
14
  // 当前节点是叶子节点时,直接加入结果
15
15
  leaves.push(node)
@@ -45,7 +45,7 @@ function getLeafNodesByCondition(type, nodes, parent = null) {
45
45
  }
46
46
  // 递归处理子节点
47
47
  leaves.push(...getLeafNodesByCondition(type, node.children, updatedParent))
48
- }
48
+ }
49
49
  else if (isValidNode) {
50
50
  // 无子节点但符合条件时,直接加入叶子节点列表
51
51
  if (node.resourcetype === 'organization') {
@@ -53,7 +53,7 @@ function getLeafNodesByCondition(type, nodes, parent = null) {
53
53
  ...node,
54
54
  name: parent ? `${node.name}-${parent}` : node.name,
55
55
  })
56
- }
56
+ }
57
57
  else if (node.resourcetype === 'department' && !nodeArray.includes(node.name)) {
58
58
  // console.log('数组',nodeArray.includes(node.name))
59
59
  leaves.push({
@@ -86,16 +86,16 @@ function getResData(params, toCallback) {
86
86
  const data = { userId: params.userid, roleName: params.roleName }
87
87
  if (params.source === '获取分公司') {
88
88
  runLogic('getOrgBySearch', data, 'af-system').then(res => toCallback(res))
89
- }
89
+ }
90
90
  else if (params.source === '获取部门') {
91
91
  runLogic('getDepBySearch', data, 'af-system').then(res => toCallback(res))
92
- }
92
+ }
93
93
  else if (params.source === '获取人员') {
94
94
  runLogic('getUserBySearch', data, 'af-system').then(res => toCallback(res))
95
- }
95
+ }
96
96
  else if (params.source === '根据角色获取人员') {
97
97
  runLogic('getUserBySearchRole', data, 'af-system').then(res => toCallback(res))
98
- }
98
+ }
99
99
  else {
100
100
  return search(params).then(res => toCallback(res))
101
101
  }
@@ -107,15 +107,15 @@ export async function searchToOption(params, callback) {
107
107
  if (res[0].children && res[0].children.length) {
108
108
  if (res[0].children[0].children) {
109
109
  callback(transformData(res[0].children[0].children))
110
- }
110
+ }
111
111
  else {
112
112
  callback(transformData(res[0].children))
113
113
  }
114
- }
114
+ }
115
115
  else {
116
116
  callback(res[0].children)
117
117
  }
118
- }
118
+ }
119
119
  else {
120
120
  callback(res)
121
121
  }
@@ -129,7 +129,7 @@ export async function searchToListOption(params, callback) {
129
129
  if (params.source.includes('人员')) {
130
130
  // console.log('ren---------',res)
131
131
  callback(transformData(getLeafNodes(res)))
132
- }
132
+ }
133
133
  else {
134
134
  const type = params.source.includes('公司') ? 'organization' : 'department'
135
135
  // console.log('bumenpgonngsi',res)
@@ -1,52 +1,52 @@
1
- import { getConfigByNameAsync } from '@af-mobile-client-vue3/services/api/common'
2
- import { APP_WEB_CONFIG_KEY } from '@af-mobile-client-vue3/stores/mutation-type'
3
- import { createStorage } from '@af-mobile-client-vue3/utils/Storage'
4
- import { defineStore } from 'pinia'
5
- import { ref } from 'vue'
6
-
7
- export interface WebConfig {
8
- systemName: string
9
- routerName: string
10
- systemDesc: string
11
- homePage: string
12
- defaultAvatarUrl: string
13
- wechatLogin: boolean
14
- }
15
-
16
- // 存放 webConfig 中的 setting 配置
17
- export const useSettingStore = defineStore('setting', () => {
18
- const setting = ref<WebConfig>(undefined)
19
- const setSetting = (newSetting: WebConfig) => {
20
- setting.value = newSetting
21
- }
22
- const getSetting = () => {
23
- return setting.value
24
- }
25
-
26
- const useStore = createStorage()
27
-
28
- const store = useSettingStore()
29
-
30
- const init = async () => {
31
- const catchWebConfig = useStore.get(APP_WEB_CONFIG_KEY)
32
- if (catchWebConfig) {
33
- setSetting(catchWebConfig)
34
- }
35
- else {
36
- const res = await getConfigByNameAsync('webMobileConfig')
37
- useStore.set(APP_WEB_CONFIG_KEY, res)
38
- const setting: WebConfig = res.setting
39
- if (setting)
40
- store.setSetting(setting)
41
- }
42
- }
43
-
44
- init().then(() => {})
45
-
46
- return {
47
- setSetting,
48
- getSetting,
49
- }
50
- })
51
-
52
- export default useSettingStore
1
+ import { getConfigByNameAsync } from '@af-mobile-client-vue3/services/api/common'
2
+ import { APP_WEB_CONFIG_KEY } from '@af-mobile-client-vue3/stores/mutation-type'
3
+ import { createStorage } from '@af-mobile-client-vue3/utils/Storage'
4
+ import { defineStore } from 'pinia'
5
+ import { ref } from 'vue'
6
+
7
+ export interface WebConfig {
8
+ systemName: string
9
+ routerName: string
10
+ systemDesc: string
11
+ homePage: string
12
+ defaultAvatarUrl: string
13
+ wechatLogin: boolean
14
+ }
15
+
16
+ // 存放 webConfig 中的 setting 配置
17
+ export const useSettingStore = defineStore('setting', () => {
18
+ const setting = ref<WebConfig>(undefined)
19
+ const setSetting = (newSetting: WebConfig) => {
20
+ setting.value = newSetting
21
+ }
22
+ const getSetting = () => {
23
+ return setting.value
24
+ }
25
+
26
+ const useStore = createStorage()
27
+
28
+ const store = useSettingStore()
29
+
30
+ const init = async () => {
31
+ const catchWebConfig = useStore.get(APP_WEB_CONFIG_KEY)
32
+ if (catchWebConfig) {
33
+ setSetting(catchWebConfig)
34
+ }
35
+ else {
36
+ const res = await getConfigByNameAsync('webMobileConfig')
37
+ useStore.set(APP_WEB_CONFIG_KEY, res)
38
+ const setting: WebConfig = res.setting
39
+ if (setting)
40
+ store.setSetting(setting)
41
+ }
42
+ }
43
+
44
+ init().then(() => {})
45
+
46
+ return {
47
+ setSetting,
48
+ getSetting,
49
+ }
50
+ })
51
+
52
+ export default useSettingStore
@@ -1,7 +1,7 @@
1
- export const CURRENT_USER = 'CURRENT-USER'
2
- export const ACCESS_TOKEN = 'Authorization'
3
- export const APP_LOGIN_KEY = 'admin.login'
4
- export const APP_PERMISSIONS_KEY = 'admin.permissions'
5
- export const APP_ROLES_KEY = 'admin.roles'
6
- export const APP_ROUTES_KEY = 'admin.routes'
7
- export const APP_WEB_CONFIG_KEY = 'admin.webconfig'
1
+ export const CURRENT_USER = 'CURRENT-USER'
2
+ export const ACCESS_TOKEN = 'Authorization'
3
+ export const APP_LOGIN_KEY = 'admin.login'
4
+ export const APP_PERMISSIONS_KEY = 'admin.permissions'
5
+ export const APP_ROLES_KEY = 'admin.roles'
6
+ export const APP_ROUTES_KEY = 'admin.routes'
7
+ export const APP_WEB_CONFIG_KEY = 'admin.webconfig'
@@ -1,84 +1,84 @@
1
- /**
2
- * 判断是否有路由的权限
3
- * @param authority 路由权限配置
4
- * @param permissions 用户权限集合
5
- */
6
- function hasPermission(authority: any, permissions: any): boolean {
7
- let required: string = '*'
8
- if (typeof authority === 'string')
9
- required = authority
10
- else if (Array.isArray(authority))
11
- required = authority.toString()
12
- else if (typeof authority === 'object')
13
- required = authority.permission
14
-
15
- return required === '*' || hasAnyItem(required, permissions, (r, t) => !!(r === t || r === t.id))
16
- }
17
-
18
- /**
19
- * 判断是否有路由需要的角色
20
- * @param authority 路由权限配置
21
- * @param roles 用户角色集合
22
- */
23
- function hasRole(authority, roles) {
24
- let required
25
- if (typeof authority === 'object')
26
- required = authority.role
27
-
28
- return authority === '*' || hasAnyItem(required, roles, (r, t) => !!(r === t || r === t.id))
29
- }
30
-
31
- /**
32
- * 判断目标数组是否有所需元素
33
- * @param {string | string[]}required 所需元素,数组或单个元素
34
- * @param {string[] | object[]} source 目标数组
35
- * @param {Function} filter 匹配条件
36
- * (r: String, s: String|Object) => boolean
37
- */
38
- function hasAnyItem(required, source, filter): boolean {
39
- if (!required)
40
- return false
41
-
42
- const checkedList = Array.isArray(required) ? required : [required]
43
- return !!source.find(s => checkedList.find(r => filter(r, s)))
44
- }
45
-
46
- /**
47
- * 路由权限校验
48
- * @param route 路由
49
- * @param permissions 用户权限集合
50
- * @param roles 用户角色集合
51
- */
52
- function hasAuthority(route, permissions, roles) {
53
- // TODO 此处判断可能有问题
54
- if (!route.meta.pAuthorities)
55
- return true
56
-
57
- const authorities = [...route.meta.pAuthorities, route.meta.authority]
58
- for (const authority of authorities) {
59
- if (!hasPermission(authority, permissions) && !hasRole(authority, roles))
60
- return false
61
- }
62
- return true
63
- }
64
-
65
- /**
66
- * 根据权限配置过滤菜单数据
67
- * @param menuData
68
- * @param permissions
69
- * @param roles
70
- */
71
- function filterMenu(menuData, permissions, roles) {
72
- return menuData.filter((menu) => {
73
- if (menu.meta && menu.meta.invisible === undefined) {
74
- if (!hasAuthority(menu, permissions, roles))
75
- return false
76
- }
77
- if (menu.children && menu.children.length > 0)
78
- menu.children = filterMenu(menu.children, permissions, roles)
79
-
80
- return true
81
- })
82
- }
83
-
84
- export { filterMenu, hasAuthority }
1
+ /**
2
+ * 判断是否有路由的权限
3
+ * @param authority 路由权限配置
4
+ * @param permissions 用户权限集合
5
+ */
6
+ function hasPermission(authority: any, permissions: any): boolean {
7
+ let required: string = '*'
8
+ if (typeof authority === 'string')
9
+ required = authority
10
+ else if (Array.isArray(authority))
11
+ required = authority.toString()
12
+ else if (typeof authority === 'object')
13
+ required = authority.permission
14
+
15
+ return required === '*' || hasAnyItem(required, permissions, (r, t) => !!(r === t || r === t.id))
16
+ }
17
+
18
+ /**
19
+ * 判断是否有路由需要的角色
20
+ * @param authority 路由权限配置
21
+ * @param roles 用户角色集合
22
+ */
23
+ function hasRole(authority, roles) {
24
+ let required
25
+ if (typeof authority === 'object')
26
+ required = authority.role
27
+
28
+ return authority === '*' || hasAnyItem(required, roles, (r, t) => !!(r === t || r === t.id))
29
+ }
30
+
31
+ /**
32
+ * 判断目标数组是否有所需元素
33
+ * @param {string | string[]}required 所需元素,数组或单个元素
34
+ * @param {string[] | object[]} source 目标数组
35
+ * @param {Function} filter 匹配条件
36
+ * (r: String, s: String|Object) => boolean
37
+ */
38
+ function hasAnyItem(required, source, filter): boolean {
39
+ if (!required)
40
+ return false
41
+
42
+ const checkedList = Array.isArray(required) ? required : [required]
43
+ return !!source.find(s => checkedList.find(r => filter(r, s)))
44
+ }
45
+
46
+ /**
47
+ * 路由权限校验
48
+ * @param route 路由
49
+ * @param permissions 用户权限集合
50
+ * @param roles 用户角色集合
51
+ */
52
+ function hasAuthority(route, permissions, roles) {
53
+ // TODO 此处判断可能有问题
54
+ if (!route.meta.pAuthorities)
55
+ return true
56
+
57
+ const authorities = [...route.meta.pAuthorities, route.meta.authority]
58
+ for (const authority of authorities) {
59
+ if (!hasPermission(authority, permissions) && !hasRole(authority, roles))
60
+ return false
61
+ }
62
+ return true
63
+ }
64
+
65
+ /**
66
+ * 根据权限配置过滤菜单数据
67
+ * @param menuData
68
+ * @param permissions
69
+ * @param roles
70
+ */
71
+ function filterMenu(menuData, permissions, roles) {
72
+ return menuData.filter((menu) => {
73
+ if (menu.meta && menu.meta.invisible === undefined) {
74
+ if (!hasAuthority(menu, permissions, roles))
75
+ return false
76
+ }
77
+ if (menu.children && menu.children.length > 0)
78
+ menu.children = filterMenu(menu.children, permissions, roles)
79
+
80
+ return true
81
+ })
82
+ }
83
+
84
+ export { filterMenu, hasAuthority }
@@ -1,39 +1,39 @@
1
- import AesEncryptJS from 'crypto-js'
2
-
3
- export default {
4
- /**
5
- * AES加密
6
- *
7
- * @param word
8
- * @param encryKey
9
- */
10
- AESEncrypt(word: string, encryKey: string): string {
11
- const key = AesEncryptJS.enc.Utf8.parse(encryKey)
12
- const srcs = AesEncryptJS.enc.Utf8.parse(word)
13
- const encrypted = AesEncryptJS.AES.encrypt(srcs, key, {
14
- mode: AesEncryptJS.mode.ECB,
15
- padding: AesEncryptJS.pad.Pkcs7,
16
- })
17
- return encrypted.toString()
18
- },
19
- /**
20
- * AES解密
21
- *
22
- * @param word
23
- * @param encryKey
24
- */
25
- AESDecrypt(word: string, encryKey: string): any {
26
- const key = AesEncryptJS.enc.Utf8.parse(encryKey)
27
- const decrypt = AesEncryptJS.AES.decrypt(word, key, {
28
- mode: AesEncryptJS.mode.ECB,
29
- padding: AesEncryptJS.pad.Pkcs7,
30
- })
31
- const ret = AesEncryptJS.enc.Utf8.stringify(decrypt).toString()
32
- try {
33
- return JSON.parse(ret)
34
- }
35
- catch {
36
- return ret
37
- }
38
- },
39
- }
1
+ import AesEncryptJS from 'crypto-js'
2
+
3
+ export default {
4
+ /**
5
+ * AES加密
6
+ *
7
+ * @param word
8
+ * @param encryKey
9
+ */
10
+ AESEncrypt(word: string, encryKey: string): string {
11
+ const key = AesEncryptJS.enc.Utf8.parse(encryKey)
12
+ const srcs = AesEncryptJS.enc.Utf8.parse(word)
13
+ const encrypted = AesEncryptJS.AES.encrypt(srcs, key, {
14
+ mode: AesEncryptJS.mode.ECB,
15
+ padding: AesEncryptJS.pad.Pkcs7,
16
+ })
17
+ return encrypted.toString()
18
+ },
19
+ /**
20
+ * AES解密
21
+ *
22
+ * @param word
23
+ * @param encryKey
24
+ */
25
+ AESDecrypt(word: string, encryKey: string): any {
26
+ const key = AesEncryptJS.enc.Utf8.parse(encryKey)
27
+ const decrypt = AesEncryptJS.AES.decrypt(word, key, {
28
+ mode: AesEncryptJS.mode.ECB,
29
+ padding: AesEncryptJS.pad.Pkcs7,
30
+ })
31
+ const ret = AesEncryptJS.enc.Utf8.stringify(decrypt).toString()
32
+ try {
33
+ return JSON.parse(ret)
34
+ }
35
+ catch {
36
+ return ret
37
+ }
38
+ },
39
+ }
package/src/utils/i18n.ts CHANGED
@@ -1,41 +1,41 @@
1
- // // import { createI18n } from 'vue-i18n'
2
- // import enUS from 'vant/es/locale/lang/en-US'
3
- // import zhCN from 'vant/es/locale/lang/zh-CN'
4
- //
5
- // /**
6
- // * All i18n resources specified in the plugin `include` option can be loaded
7
- // * at once using the import syntax
8
- // */
9
- // // import messages from '@intlify/unplugin-vue-i18n/messages'
10
- // import { Locale, type PickerColumn } from 'vant'
11
- //
12
- // // export const i18n = createI18n({
13
- // // locale: localStorage.getItem('language') || navigator.language,
14
- // // fallbackLocale: 'zhCN',
15
- // // messages,
16
- // // })
17
- //
18
- // /** 多语言 picker columns */
19
- // export const languageColumns: PickerColumn = [
20
- // { text: '简体中文', value: 'zh-CN' },
21
- // { text: 'English', value: 'en-US' },
22
- // ]
23
- //
24
- // /** 当前语言 */
25
- // export const locale = computed({
26
- // get() {
27
- // return (i18n.global.locale as unknown as Ref<string>).value
28
- // },
29
- // set(language: string) {
30
- // localStorage.setItem('language', language);
31
- // (i18n.global.locale as unknown as Ref<string>).value = language
32
- // Locale.use(language)
33
- // },
34
- // })
35
- //
36
- // // 载入 vant 语言包
37
- // Locale.use('zh-CN', zhCN)
38
- // Locale.use('en-US', enUS)
39
- //
40
- // // 根据当前语言切换 vant 语言包
41
- // Locale.use(locale.value)
1
+ // // import { createI18n } from 'vue-i18n'
2
+ // import enUS from 'vant/es/locale/lang/en-US'
3
+ // import zhCN from 'vant/es/locale/lang/zh-CN'
4
+ //
5
+ // /**
6
+ // * All i18n resources specified in the plugin `include` option can be loaded
7
+ // * at once using the import syntax
8
+ // */
9
+ // // import messages from '@intlify/unplugin-vue-i18n/messages'
10
+ // import { Locale, type PickerColumn } from 'vant'
11
+ //
12
+ // // export const i18n = createI18n({
13
+ // // locale: localStorage.getItem('language') || navigator.language,
14
+ // // fallbackLocale: 'zhCN',
15
+ // // messages,
16
+ // // })
17
+ //
18
+ // /** 多语言 picker columns */
19
+ // export const languageColumns: PickerColumn = [
20
+ // { text: '简体中文', value: 'zh-CN' },
21
+ // { text: 'English', value: 'en-US' },
22
+ // ]
23
+ //
24
+ // /** 当前语言 */
25
+ // export const locale = computed({
26
+ // get() {
27
+ // return (i18n.global.locale as unknown as Ref<string>).value
28
+ // },
29
+ // set(language: string) {
30
+ // localStorage.setItem('language', language);
31
+ // (i18n.global.locale as unknown as Ref<string>).value = language
32
+ // Locale.use(language)
33
+ // },
34
+ // })
35
+ //
36
+ // // 载入 vant 语言包
37
+ // Locale.use('zh-CN', zhCN)
38
+ // Locale.use('en-US', enUS)
39
+ //
40
+ // // 根据当前语言切换 vant 语言包
41
+ // Locale.use(locale.value)