@netang/quasar 0.0.53 → 0.0.55

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 (115) hide show
  1. package/_docs/docs/.vuepress/client.js +39 -0
  2. package/_docs/docs/.vuepress/components/test.vue +23 -0
  3. package/_docs/docs/.vuepress/config.js +40 -0
  4. package/_docs/docs/.vuepress/configs/index.js +2 -0
  5. package/_docs/docs/.vuepress/configs/navbar/index.js +1 -0
  6. package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -0
  7. package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -0
  8. package/_docs/docs/.vuepress/configs/sidebar/zh.js +20 -0
  9. package/_docs/docs/.vuepress/public/css/index.css +3 -0
  10. package/_docs/docs/.vuepress/styles/index.scss +3 -0
  11. package/_docs/docs/components/field-table.md +63 -0
  12. package/_docs/docs/components/field-tree.md +1 -0
  13. package/{docs → _docs}/docs/index.md +0 -0
  14. package/{docs → _docs}/docs/utils/alert.md +0 -0
  15. package/{docs → _docs}/docs/utils/confirm.md +0 -0
  16. package/_docs/docs/utils/index.md +1 -0
  17. package/_docs/package.json +17 -0
  18. package/components/column-title/index.vue +2 -2
  19. package/components/data/index.vue +20 -23
  20. package/components/dialog/index.vue +26 -12
  21. package/components/dialog-table/index.vue +4 -2
  22. package/components/dragger/index.vue +3 -2
  23. package/components/drawer/index.vue +16 -9
  24. package/components/editor-code/index.vue +12 -5
  25. package/components/empty/index.vue +16 -1
  26. package/components/field-date/index.vue +48 -36
  27. package/components/field-table/index.vue +69 -43
  28. package/components/field-text/index.vue +6 -2
  29. package/components/field-tree/index.vue +40 -22
  30. package/components/input-number/index.vue +5 -4
  31. package/components/list-menu/index.vue +14 -2
  32. package/components/power-page/index.vue +10 -0
  33. package/components/private/components/index.js +7 -2
  34. package/components/private/components/move-to-tree/index.vue +7 -3
  35. package/components/private/edit-power-data/index.vue +92 -52
  36. package/components/private/table-visible-columns-button/index.vue +6 -2
  37. package/components/render/index.vue +21 -7
  38. package/components/search/index.vue +30 -2
  39. package/components/search-item/index.vue +24 -8
  40. package/components/select/index.vue +5 -2
  41. package/components/splitter/index.vue +13 -9
  42. package/components/table/index.vue +32 -5
  43. package/components/table-pagination/index.vue +0 -1
  44. package/components/table-splitter/index.vue +22 -3
  45. package/components/table-summary/index.vue +10 -3
  46. package/components/thumbnail/index.vue +16 -6
  47. package/components/toolbar/index.vue +0 -2
  48. package/components/uploader/index.vue +5 -2
  49. package/components/uploader-query/index.vue +48 -27
  50. package/components/value-format/index.vue +19 -12
  51. package/configs/area3.js +1 -0
  52. package/docs/404.html +33 -0
  53. package/docs/assets/404.html-60b35caa.js +1 -0
  54. package/docs/assets/404.html-d1e63d77.js +1 -0
  55. package/docs/assets/alert.html-568d4e94.js +1 -0
  56. package/docs/assets/alert.html-f5dbc3e9.js +1 -0
  57. package/docs/assets/app-8c3ae4de.js +6 -0
  58. package/docs/assets/back-to-top-8efcbe56.svg +1 -0
  59. package/docs/assets/confirm.html-7a1566f6.js +1 -0
  60. package/docs/assets/confirm.html-96f1b004.js +1 -0
  61. package/docs/assets/field-table.html-68d610b0.js +1 -0
  62. package/docs/assets/field-table.html-86cc3511.js +1 -0
  63. package/docs/assets/field-tree.html-45410c3c.js +1 -0
  64. package/docs/assets/field-tree.html-c98ac993.js +1 -0
  65. package/docs/assets/framework-204010b2.js +5 -0
  66. package/docs/assets/index.html-1695dd7c.js +1 -0
  67. package/docs/assets/index.html-65a4aa67.js +1 -0
  68. package/docs/assets/style-ac5a9aa6.css +1 -0
  69. package/docs/components/field-table.html +33 -0
  70. package/docs/components/field-tree.html +33 -0
  71. package/docs/index.html +33 -0
  72. package/docs/utils/alert.html +33 -0
  73. package/docs/utils/confirm.html +33 -0
  74. package/package.json +1 -1
  75. package/package2.json +30 -0
  76. package/store/index.js +3 -20
  77. package/utils/alert.js +3 -1
  78. package/utils/area.js +27 -14
  79. package/utils/arr.js +6 -2
  80. package/utils/auth.js +40 -35
  81. package/utils/bus.js +1 -1
  82. package/utils/config.js +42 -15
  83. package/utils/{confrim.js → confirm.js} +1 -1
  84. package/utils/copy.js +18 -0
  85. package/utils/dialog.js +7 -3
  86. package/utils/dict.js +5 -28
  87. package/utils/dictOptions.js +24 -0
  88. package/utils/form.js +6 -2
  89. package/utils/getData.js +21 -9
  90. package/utils/getFile.js +11 -5
  91. package/utils/getImage.js +23 -12
  92. package/utils/getTime.js +9 -4
  93. package/utils/index.js +61 -0
  94. package/utils/loading.js +3 -1
  95. package/utils/notify.js +1 -1
  96. package/utils/power.js +164 -118
  97. package/utils/previewImage.js +4 -2
  98. package/utils/price.js +12 -3
  99. package/utils/rule.js +5 -9
  100. package/utils/ruleValid.js +10 -0
  101. package/utils/search.js +81 -50
  102. package/utils/table.js +119 -87
  103. package/utils/timestamp.js +2 -2
  104. package/utils/toast.js +1 -1
  105. package/utils/tree.js +69 -46
  106. package/utils/uploader/qiniu.js +31 -15
  107. package/utils/uploader.js +87 -56
  108. package/utils/useAuth.js +12 -5
  109. package/utils/useRouter.js +16 -5
  110. package/utils/useUploader.js +0 -5
  111. package/docs/docs/.vuepress/config.js +0 -32
  112. package/docs/docs/components/field-table.md +0 -1
  113. package/docs/docs/components/field-tree.md +0 -1
  114. package/docs/package.json +0 -11
  115. package/utils/http.js +0 -251
package/utils/http.js DELETED
@@ -1,251 +0,0 @@
1
- import { isRef } from 'vue'
2
- import axios from 'axios'
3
- import createHttp from '@netang/utils/http'
4
- import { statePower } from '../store'
5
-
6
- /**
7
- * 初始化 http
8
- */
9
- $n.http = createHttp({
10
- // 基础 url
11
- baseUrl: $n.config('apiUrl'),
12
- // 是否开启错误提醒(true:普通方式/false:不开启/alert:对话框方式)
13
- warn: 'alert',
14
- // 检查结果的 code 是否正确(前提数据类型必须为 json)
15
- checkCode: true,
16
- // 是否包含头部鉴权认证
17
- token: true,
18
- // 是否强制登录
19
- login: true,
20
- // 是否开启防抖(防止重复请求)
21
- debounce: true,
22
- // 缓存方法
23
- storage: $n.storage,
24
- // 是否已更新过鉴权
25
- _isUpdatedAuthToken: false,
26
-
27
- // 页面状态
28
- pageStatus: null,
29
- // 空状态描述
30
- emptyDescription: '',
31
-
32
- /**
33
- * 设置参数
34
- */
35
- onOptions({ options, para }) {
36
-
37
- // 取消请求
38
- if ($n.isFunction(para.onCancel)) {
39
- const source = axios.CancelToken.source()
40
- options.cancelToken = source.token
41
-
42
- // 取消请求
43
- para.onCancel(function(msg) {
44
- // 取消请求
45
- source.cancel(msg)
46
- })
47
- }
48
-
49
- // 获取上传进度
50
- if (para.upload === true && $n.isFunction(para.onUploadProgress)) {
51
- options.onUploadProgress = function (e) {
52
- para.onUploadProgress(Math.round(e.loaded * 100 / e.total), e)
53
- }
54
- }
55
- },
56
-
57
- /**
58
- * 处理请求
59
- */
60
- async onRequest({ options, para, onError, next }) {
61
-
62
- // 如果无网络
63
- // if (! $n.state.get('network').isOnline) {
64
- // return onError({
65
- // code: dicts.CODE__SERVER_ERROR,
66
- // msg: '网络不给力,请检查设置后重试',
67
- // })
68
- // }
69
-
70
- // const {
71
- // // 应用版本名称
72
- // appVersion,
73
- // // 应用资源(wgt)的版本名称
74
- // appWgtVersion,
75
- // // 【自定义】app 类型(1:app-android,2:app-ios,3:web-mobile,4:web-pc)
76
- // appType,
77
- // } = $n.getSystemInfo()
78
-
79
- // 如果验证 code, 说明是请求业务服务器
80
- if (para.checkCode) {
81
-
82
- // 加载设备信息
83
- // if (para.device) {
84
- // Object.assign(options.headers, {
85
- // // app 类型(1:app-android,2:app-ios,3:web-mobile,4:web-pc)
86
- // Apptype: appType,
87
- // // app 版本号
88
- // Appversion: appVersion,
89
- // // app wgt 版本号
90
- // Appwgtversion: appWgtVersion,
91
- // })
92
- // }
93
-
94
- // 如果需要头部鉴权
95
- if (para.token) {
96
-
97
- // 如果已登录
98
- if ($n.auth.isLogin()) {
99
- const { token } = $n.auth.getAdminUserInfo()
100
-
101
- // 头部添加鉴权认证
102
- options.headers.Authorization = token
103
-
104
- // 如果有权限
105
- if (statePower.value.v) {
106
- // 头部添加权限版本号
107
- options.headers.Pv = statePower.value.v
108
- }
109
-
110
- // 否则未登录 && 如果开启强制登录, 则跳转登录页面
111
- } else if (para.login) {
112
- $n.auth.pushLogin()
113
- return false
114
- }
115
- }
116
- }
117
-
118
- // 【调试模式】
119
- // --------------------------------------------------
120
- // #ifdef IS_DEBUG
121
- console.log('【请求 http】options', options)
122
- // #endif
123
- // --------------------------------------------------
124
-
125
- const res = await next(await axios(options))
126
-
127
- // 如果请求成功
128
- if (res.status && para.checkCode && para.token) {
129
- // 设置权限数据
130
- $n.power.setData($n.get(res, 'response.data.power'))
131
- }
132
-
133
- return res
134
- },
135
-
136
- /**
137
- * 处理错误
138
- */
139
- onError({ data, para, r }) {
140
-
141
- if (para.upload === true && axios.isCancel(r)) {
142
- return {
143
- cancel: true,
144
- msg: r.message,
145
- }
146
- }
147
-
148
- // 【调试模式】
149
- // --------------------------------------------------
150
- // #if IS_DEBUG
151
- console.error('【请求错误 http error】', r?.response)
152
- // #endif
153
- // --------------------------------------------------
154
-
155
- // 如果开启错误提醒
156
- if (
157
- para.warn !== false
158
- && (
159
- data.code < dicts.CODE__BUSINESS_ERROR
160
- || data.code === dicts.CODE__SERVER_ERROR
161
- )
162
- ) {
163
- // 错误消息
164
- let message = data.msg
165
-
166
- // 【调试模式】
167
- // --------------------------------------------------
168
- // #if IS_DEBUG
169
- if (
170
- data.code === dicts.CODE__SERVER_ERROR
171
- && $n.isValidString($n.get(r, 'response.data'))
172
- ) {
173
- message = r.response.data
174
- }
175
- // #endif
176
- // --------------------------------------------------
177
-
178
- // 如果错误方式为提示框
179
- if (para.warn === 'alert') {
180
-
181
- // 提示框
182
- $n.alert({
183
- message,
184
-
185
- // #if IS_DEBUG
186
- // --------------------------------------------------
187
- style: 'width:80vw;max-width:80vw;',
188
- html: true,
189
- // #endif
190
- // --------------------------------------------------
191
-
192
- })
193
-
194
- // 否则为轻提示
195
- } else {
196
- // 轻提示
197
- $n.toast({
198
- message,
199
-
200
- // #if IS_DEBUG
201
- // --------------------------------------------------
202
- html: true,
203
- // #endif
204
- // --------------------------------------------------
205
- })
206
- }
207
- }
208
-
209
- // 页面状态
210
- if (! $n.isNil(para.pageStatus) && isRef(para.pageStatus)) {
211
- para.pageStatus.value = false
212
- }
213
-
214
- // 空状态描述
215
- if (! $n.isNil(para.emptyDescription) && isRef(para.emptyDescription)) {
216
- para.emptyDescription.value = data.msg
217
- }
218
- },
219
-
220
- /**
221
- * 处理业务错误
222
- */
223
- async onBusinessError({ data, para, onHttp }) {
224
-
225
- if ($n.indexOf([
226
- // 状态码(411:强制退出)
227
- dicts.CODE__LOGOUT,
228
- // 状态码(410:token 过期需要重新鉴权)
229
- dicts.CODE__TOKEN_EXPIRED,
230
- // 状态码(412:当前用户账号被禁用,需要退出并重新跳转至登录页面)
231
- dicts.CODE__ACCOUNT_DISABLED,
232
- // 状态码(415:没有权限访问当前页面)
233
- dicts.CODE__NO_PERMISSION,
234
-
235
- ], data.code) > -1) {
236
-
237
- // 轻提示
238
- $n.toast({
239
- message: data.msg || '请重新登录',
240
- })
241
-
242
- // 退出登录
243
- $n.auth.logout()
244
-
245
- // 跳转登录页面
246
- $n.auth.pushLogin()
247
-
248
- return false
249
- }
250
- },
251
- })