af-mobile-client-vue3 1.1.7 → 1.1.8

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 (74) 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/XCellList/index.vue +2 -1
  22. package/src/components/data/XOlMap/utils/wgs84ToGcj02.js +154 -154
  23. package/src/components/data/XReportForm/XReportFormJsonRender.vue +220 -220
  24. package/src/components/data/XReportForm/index.vue +1079 -1079
  25. package/src/components/data/XReportGrid/XAddReport/index.ts +1 -1
  26. package/src/components/data/XReportGrid/XReportDrawer/index.ts +1 -1
  27. package/src/components/data/XSignature/index.vue +285 -285
  28. package/src/components/data/XTag/index.vue +10 -10
  29. package/src/components/layout/NormalDataLayout/index.vue +70 -70
  30. package/src/components/layout/TabBarLayout/index.vue +40 -40
  31. package/src/components.d.ts +53 -53
  32. package/src/env.d.ts +16 -16
  33. package/src/font-style/font.css +3 -3
  34. package/src/hooks/useCommon.ts +9 -9
  35. package/src/locales/en-US.json +25 -25
  36. package/src/locales/zh-CN.json +25 -25
  37. package/src/plugins/AppData.ts +38 -38
  38. package/src/router/guards.ts +59 -59
  39. package/src/router/index.ts +61 -61
  40. package/src/router/invoiceRoutes.ts +33 -33
  41. package/src/services/api/common.ts +109 -109
  42. package/src/services/api/manage.ts +8 -8
  43. package/src/services/api/search.ts +16 -16
  44. package/src/services/restTools.ts +56 -56
  45. package/src/services/v3Api.ts +11 -11
  46. package/src/stores/modules/setting.ts +52 -52
  47. package/src/stores/mutation-type.ts +7 -7
  48. package/src/utils/authority-utils.ts +84 -84
  49. package/src/utils/crypto.ts +39 -39
  50. package/src/utils/i18n.ts +41 -41
  51. package/src/utils/indexedDB.ts +180 -180
  52. package/src/utils/mobileUtil.ts +26 -26
  53. package/src/utils/routerUtil.ts +271 -271
  54. package/src/utils/runEvalFunction.ts +13 -13
  55. package/src/utils/wechatUtil.ts +9 -9
  56. package/src/views/common/LoadError.vue +64 -64
  57. package/src/views/common/NotFound.vue +68 -68
  58. package/src/views/component/EvaluateRecordView/index.vue +40 -40
  59. package/src/views/component/XCellDetailView/index.vue +217 -217
  60. package/src/views/component/XCellListView/index.vue +2 -2
  61. package/src/views/component/XOlMapView/XLocationPicker/index.vue +120 -120
  62. package/src/views/component/XReportFormIframeView/index.vue +47 -47
  63. package/src/views/component/XReportFormView/index.vue +13 -13
  64. package/src/views/component/XSignatureView/index.vue +50 -50
  65. package/src/views/component/menu.vue +117 -117
  66. package/src/views/component/notice.vue +46 -46
  67. package/src/views/component/topNav.vue +36 -36
  68. package/src/views/invoiceShow/index.vue +61 -61
  69. package/src/views/user/login/ForgetPasswordForm.vue +94 -94
  70. package/src/views/user/login/LoginTitle.vue +68 -68
  71. package/src/views/user/login/index.vue +22 -22
  72. package/src/views/user/my/index.vue +230 -230
  73. package/src/vue-router.d.ts +9 -9
  74. package/tsconfig.json +43 -43
@@ -1,180 +1,180 @@
1
- // indexDB 存储
2
- import { post } from '@af-mobile-client-vue3/services/restTools'
3
-
4
- // 避免重复请求相同配置key的锁
5
- const locks: any = {}
6
-
7
- export const indexedDB = {
8
- db: undefined,
9
- indexedDB: window.indexedDB,
10
- IDBKeyRange: window.IDBKeyRange, // 键范围
11
- openDB(callback: Function) {
12
- // 建立或打开数据库,建立对象存储空间(ObjectStore)
13
- if (this.db) {
14
- callback(this.db)
15
- }
16
- else {
17
- const version = 1
18
- const request = this.indexedDB.open('view', version)
19
-
20
- request.onerror = function (e: any) {
21
- console.error(`打开数据库失败:${e.currentTarget.error.message}`)
22
- }
23
- request.onsuccess = function (e: any) {
24
- this.db = e.target.result
25
- callback(this.db)
26
- }
27
- request.onupgradeneeded = function (e: any) {
28
- const db = e.target.result
29
- if (!db.objectStoreNames.contains('metaCache')) {
30
- // 没有该对象空间时创建该对象空间
31
- db.createObjectStore('metaCache', {
32
- keyPath: 'key',
33
- })
34
- }
35
- }
36
- }
37
- },
38
- deleteDB(dbname: string) {
39
- // 删除数据库
40
- this.indexedDB.deleteDatabase(dbname)
41
- },
42
- closeDB() {
43
- if (!this.db)
44
- this.db.close()
45
- },
46
- add(key: string, data: any) {
47
- // eslint-disable-next-line ts/no-this-alias
48
- const self = this
49
- self.openDB((res: IDBDatabase) => {
50
- const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').add({
51
- key,
52
- data,
53
- })
54
- request.onerror = function () {
55
- self.update(key, data)
56
- }
57
- request.onsuccess = function () {
58
- }
59
- })
60
- },
61
- update(key: string, data: any) {
62
- this.openDB((res: IDBDatabase) => {
63
- const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').put({
64
- key,
65
- data,
66
- })
67
- request.onerror = function () {
68
- console.error('数据更新失败')
69
- }
70
- request.onsuccess = function () {
71
- }
72
- })
73
- },
74
- get(key: string, callback: Function) {
75
- this.openDB((res: IDBDatabase) => {
76
- // 根据存储空间的键找到对应数据
77
- const store = res.transaction('metaCache', 'readwrite').objectStore('metaCache')
78
- const request = store.get(key)
79
- request.onerror = function () {
80
- }
81
- request.onsuccess = function (e: any) {
82
- const result = e.target.result
83
- if (typeof (callback) === 'function')
84
- callback(result.data)
85
- }
86
- })
87
- },
88
- getByWeb(key: string, url: string, params: any, callback: Function, processFun: Function) {
89
- // 如果这个键正在被使用,等待它完成
90
- if (locks[key]) {
91
- locks[key].then(() => {
92
- this.getByWeb(key, url, params, callback, processFun)
93
- })
94
- return
95
- }
96
-
97
- // 创建一个新的 Promise
98
- locks[key] = new Promise<void>((resolve, reject) => {
99
- // eslint-disable-next-line ts/no-this-alias
100
- const self = this
101
- self.openDB((res: IDBDatabase) => {
102
- // 根据存储空间的键找到对应数据
103
- const store = res.transaction('metaCache', 'readwrite').objectStore('metaCache')
104
- const request = store.get(key)
105
- request.onerror = function (e) {
106
- reject(e)
107
- }
108
- request.onsuccess = function (e: any) {
109
- const result = e.target.result
110
- if (!result && url) {
111
- post(url, params).then((res) => {
112
- if (processFun)
113
- res = processFun(res)
114
-
115
- if (import.meta.env.NODE_ENV === 'production' || key !== 'webMobileConfig')
116
- self.add(key, res)
117
-
118
- try {
119
- callback(res)
120
- }
121
- catch (e) {
122
- console.error(e)
123
- }
124
-
125
- // 解锁这个键
126
- resolve()
127
- }).catch(() => {
128
- if (import.meta.env.NODE_ENV === 'production' || key !== 'webMobileConfig')
129
- self.add(key, null)
130
- callback(null)
131
-
132
- // 解锁这个键
133
- resolve()
134
- })
135
- }
136
- else {
137
- callback(result.data)
138
-
139
- // 解锁这个键
140
- resolve()
141
- }
142
- }
143
- })
144
- }).finally(() => {
145
- // 移除这个键的锁
146
- delete locks[key]
147
- })
148
- },
149
- delete(key: string) {
150
- this.openDB((res: IDBDatabase) => {
151
- // 删除某一条记录
152
- const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').delete(key)
153
-
154
- request.onerror = function () {
155
- console.error('数据删除失败')
156
- }
157
- request.onsuccess = function () {
158
- }
159
- })
160
- },
161
- clear(callback?: Function) {
162
- this.openDB((res: IDBDatabase) => {
163
- // 删除存储空间全部记录
164
- const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').clear()
165
-
166
- request.onerror = function () {
167
- console.error('数据删除失败')
168
- }
169
- request.onsuccess = function () {
170
- if (typeof callback === 'function')
171
- callback()
172
- }
173
- })
174
- },
175
- clearCache() {
176
- indexedDB.clear(() => {
177
- location.reload()
178
- })
179
- },
180
- }
1
+ // indexDB 存储
2
+ import { post } from '@af-mobile-client-vue3/services/restTools'
3
+
4
+ // 避免重复请求相同配置key的锁
5
+ const locks: any = {}
6
+
7
+ export const indexedDB = {
8
+ db: undefined,
9
+ indexedDB: window.indexedDB,
10
+ IDBKeyRange: window.IDBKeyRange, // 键范围
11
+ openDB(callback: Function) {
12
+ // 建立或打开数据库,建立对象存储空间(ObjectStore)
13
+ if (this.db) {
14
+ callback(this.db)
15
+ }
16
+ else {
17
+ const version = 1
18
+ const request = this.indexedDB.open('view', version)
19
+
20
+ request.onerror = function (e: any) {
21
+ console.error(`打开数据库失败:${e.currentTarget.error.message}`)
22
+ }
23
+ request.onsuccess = function (e: any) {
24
+ this.db = e.target.result
25
+ callback(this.db)
26
+ }
27
+ request.onupgradeneeded = function (e: any) {
28
+ const db = e.target.result
29
+ if (!db.objectStoreNames.contains('metaCache')) {
30
+ // 没有该对象空间时创建该对象空间
31
+ db.createObjectStore('metaCache', {
32
+ keyPath: 'key',
33
+ })
34
+ }
35
+ }
36
+ }
37
+ },
38
+ deleteDB(dbname: string) {
39
+ // 删除数据库
40
+ this.indexedDB.deleteDatabase(dbname)
41
+ },
42
+ closeDB() {
43
+ if (!this.db)
44
+ this.db.close()
45
+ },
46
+ add(key: string, data: any) {
47
+ // eslint-disable-next-line ts/no-this-alias
48
+ const self = this
49
+ self.openDB((res: IDBDatabase) => {
50
+ const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').add({
51
+ key,
52
+ data,
53
+ })
54
+ request.onerror = function () {
55
+ self.update(key, data)
56
+ }
57
+ request.onsuccess = function () {
58
+ }
59
+ })
60
+ },
61
+ update(key: string, data: any) {
62
+ this.openDB((res: IDBDatabase) => {
63
+ const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').put({
64
+ key,
65
+ data,
66
+ })
67
+ request.onerror = function () {
68
+ console.error('数据更新失败')
69
+ }
70
+ request.onsuccess = function () {
71
+ }
72
+ })
73
+ },
74
+ get(key: string, callback: Function) {
75
+ this.openDB((res: IDBDatabase) => {
76
+ // 根据存储空间的键找到对应数据
77
+ const store = res.transaction('metaCache', 'readwrite').objectStore('metaCache')
78
+ const request = store.get(key)
79
+ request.onerror = function () {
80
+ }
81
+ request.onsuccess = function (e: any) {
82
+ const result = e.target.result
83
+ if (typeof (callback) === 'function')
84
+ callback(result.data)
85
+ }
86
+ })
87
+ },
88
+ getByWeb(key: string, url: string, params: any, callback: Function, processFun: Function) {
89
+ // 如果这个键正在被使用,等待它完成
90
+ if (locks[key]) {
91
+ locks[key].then(() => {
92
+ this.getByWeb(key, url, params, callback, processFun)
93
+ })
94
+ return
95
+ }
96
+
97
+ // 创建一个新的 Promise
98
+ locks[key] = new Promise<void>((resolve, reject) => {
99
+ // eslint-disable-next-line ts/no-this-alias
100
+ const self = this
101
+ self.openDB((res: IDBDatabase) => {
102
+ // 根据存储空间的键找到对应数据
103
+ const store = res.transaction('metaCache', 'readwrite').objectStore('metaCache')
104
+ const request = store.get(key)
105
+ request.onerror = function (e) {
106
+ reject(e)
107
+ }
108
+ request.onsuccess = function (e: any) {
109
+ const result = e.target.result
110
+ if (!result && url) {
111
+ post(url, params).then((res) => {
112
+ if (processFun)
113
+ res = processFun(res)
114
+
115
+ if (import.meta.env.NODE_ENV === 'production' || key !== 'webMobileConfig')
116
+ self.add(key, res)
117
+
118
+ try {
119
+ callback(res)
120
+ }
121
+ catch (e) {
122
+ console.error(e)
123
+ }
124
+
125
+ // 解锁这个键
126
+ resolve()
127
+ }).catch(() => {
128
+ if (import.meta.env.NODE_ENV === 'production' || key !== 'webMobileConfig')
129
+ self.add(key, null)
130
+ callback(null)
131
+
132
+ // 解锁这个键
133
+ resolve()
134
+ })
135
+ }
136
+ else {
137
+ callback(result.data)
138
+
139
+ // 解锁这个键
140
+ resolve()
141
+ }
142
+ }
143
+ })
144
+ }).finally(() => {
145
+ // 移除这个键的锁
146
+ delete locks[key]
147
+ })
148
+ },
149
+ delete(key: string) {
150
+ this.openDB((res: IDBDatabase) => {
151
+ // 删除某一条记录
152
+ const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').delete(key)
153
+
154
+ request.onerror = function () {
155
+ console.error('数据删除失败')
156
+ }
157
+ request.onsuccess = function () {
158
+ }
159
+ })
160
+ },
161
+ clear(callback?: Function) {
162
+ this.openDB((res: IDBDatabase) => {
163
+ // 删除存储空间全部记录
164
+ const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').clear()
165
+
166
+ request.onerror = function () {
167
+ console.error('数据删除失败')
168
+ }
169
+ request.onsuccess = function () {
170
+ if (typeof callback === 'function')
171
+ callback()
172
+ }
173
+ })
174
+ },
175
+ clearCache() {
176
+ indexedDB.clear(() => {
177
+ location.reload()
178
+ })
179
+ },
180
+ }
@@ -1,26 +1,26 @@
1
- interface Param {
2
- funcName: string // 注册列表中的对应函数的key
3
- param: Record<string, unknown> // 入参json格式
4
- callbackFunc: (result: unknown) => unknown // 回调函数
5
- callBackMethodName?: string // 随机回调函数名字-不用传
6
- }
7
- // js端调用flutter中工具函数
8
- /*
9
- * 例:mobileUtil.execute({
10
- funcName:'getLocationResult',
11
- param: {a: 1},
12
- callbackFunc: (result) => {
13
- console.log('回调了test111', JSON.stringify(result))
14
- message.value = JSON.stringify(result)
15
- return 222
16
- }
17
- });
18
- * */
19
- export class mobileUtil {
20
- // 执行flutter端函数
21
- static execute(locationParam: Param): any {
22
- locationParam.callBackMethodName = `mobile_func_${Math.random().toString(36).substring(7)}`
23
- window[locationParam.callBackMethodName] = locationParam.callbackFunc
24
- window[locationParam.funcName].postMessage(JSON.stringify(locationParam))
25
- }
26
- }
1
+ interface Param {
2
+ funcName: string // 注册列表中的对应函数的key
3
+ param: Record<string, unknown> // 入参json格式
4
+ callbackFunc: (result: unknown) => unknown // 回调函数
5
+ callBackMethodName?: string // 随机回调函数名字-不用传
6
+ }
7
+ // js端调用flutter中工具函数
8
+ /*
9
+ * 例:mobileUtil.execute({
10
+ funcName:'getLocationResult',
11
+ param: {a: 1},
12
+ callbackFunc: (result) => {
13
+ console.log('回调了test111', JSON.stringify(result))
14
+ message.value = JSON.stringify(result)
15
+ return 222
16
+ }
17
+ });
18
+ * */
19
+ export class mobileUtil {
20
+ // 执行flutter端函数
21
+ static execute(locationParam: Param): any {
22
+ locationParam.callBackMethodName = `mobile_func_${Math.random().toString(36).substring(7)}`
23
+ window[locationParam.callBackMethodName] = locationParam.callbackFunc
24
+ window[locationParam.funcName].postMessage(JSON.stringify(locationParam))
25
+ }
26
+ }