@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.
- package/_docs/docs/.vuepress/client.js +39 -0
- package/_docs/docs/.vuepress/components/test.vue +23 -0
- package/_docs/docs/.vuepress/config.js +40 -0
- package/_docs/docs/.vuepress/configs/index.js +2 -0
- package/_docs/docs/.vuepress/configs/navbar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -0
- package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/sidebar/zh.js +20 -0
- package/_docs/docs/.vuepress/public/css/index.css +3 -0
- package/_docs/docs/.vuepress/styles/index.scss +3 -0
- package/_docs/docs/components/field-table.md +63 -0
- package/_docs/docs/components/field-tree.md +1 -0
- package/{docs → _docs}/docs/index.md +0 -0
- package/{docs → _docs}/docs/utils/alert.md +0 -0
- package/{docs → _docs}/docs/utils/confirm.md +0 -0
- package/_docs/docs/utils/index.md +1 -0
- package/_docs/package.json +17 -0
- package/components/column-title/index.vue +2 -2
- package/components/data/index.vue +20 -23
- package/components/dialog/index.vue +26 -12
- package/components/dialog-table/index.vue +4 -2
- package/components/dragger/index.vue +3 -2
- package/components/drawer/index.vue +16 -9
- package/components/editor-code/index.vue +12 -5
- package/components/empty/index.vue +16 -1
- package/components/field-date/index.vue +48 -36
- package/components/field-table/index.vue +69 -43
- package/components/field-text/index.vue +6 -2
- package/components/field-tree/index.vue +40 -22
- package/components/input-number/index.vue +5 -4
- package/components/list-menu/index.vue +14 -2
- package/components/power-page/index.vue +10 -0
- package/components/private/components/index.js +7 -2
- package/components/private/components/move-to-tree/index.vue +7 -3
- package/components/private/edit-power-data/index.vue +92 -52
- package/components/private/table-visible-columns-button/index.vue +6 -2
- package/components/render/index.vue +21 -7
- package/components/search/index.vue +30 -2
- package/components/search-item/index.vue +24 -8
- package/components/select/index.vue +5 -2
- package/components/splitter/index.vue +13 -9
- package/components/table/index.vue +32 -5
- package/components/table-pagination/index.vue +0 -1
- package/components/table-splitter/index.vue +22 -3
- package/components/table-summary/index.vue +10 -3
- package/components/thumbnail/index.vue +16 -6
- package/components/toolbar/index.vue +0 -2
- package/components/uploader/index.vue +5 -2
- package/components/uploader-query/index.vue +48 -27
- package/components/value-format/index.vue +19 -12
- package/configs/area3.js +1 -0
- package/docs/404.html +33 -0
- package/docs/assets/404.html-60b35caa.js +1 -0
- package/docs/assets/404.html-d1e63d77.js +1 -0
- package/docs/assets/alert.html-568d4e94.js +1 -0
- package/docs/assets/alert.html-f5dbc3e9.js +1 -0
- package/docs/assets/app-8c3ae4de.js +6 -0
- package/docs/assets/back-to-top-8efcbe56.svg +1 -0
- package/docs/assets/confirm.html-7a1566f6.js +1 -0
- package/docs/assets/confirm.html-96f1b004.js +1 -0
- package/docs/assets/field-table.html-68d610b0.js +1 -0
- package/docs/assets/field-table.html-86cc3511.js +1 -0
- package/docs/assets/field-tree.html-45410c3c.js +1 -0
- package/docs/assets/field-tree.html-c98ac993.js +1 -0
- package/docs/assets/framework-204010b2.js +5 -0
- package/docs/assets/index.html-1695dd7c.js +1 -0
- package/docs/assets/index.html-65a4aa67.js +1 -0
- package/docs/assets/style-ac5a9aa6.css +1 -0
- package/docs/components/field-table.html +33 -0
- package/docs/components/field-tree.html +33 -0
- package/docs/index.html +33 -0
- package/docs/utils/alert.html +33 -0
- package/docs/utils/confirm.html +33 -0
- package/package.json +1 -1
- package/package2.json +30 -0
- package/store/index.js +3 -20
- package/utils/alert.js +3 -1
- package/utils/area.js +27 -14
- package/utils/arr.js +6 -2
- package/utils/auth.js +40 -35
- package/utils/bus.js +1 -1
- package/utils/config.js +42 -15
- package/utils/{confrim.js → confirm.js} +1 -1
- package/utils/copy.js +18 -0
- package/utils/dialog.js +7 -3
- package/utils/dict.js +5 -28
- package/utils/dictOptions.js +24 -0
- package/utils/form.js +6 -2
- package/utils/getData.js +21 -9
- package/utils/getFile.js +11 -5
- package/utils/getImage.js +23 -12
- package/utils/getTime.js +9 -4
- package/utils/index.js +61 -0
- package/utils/loading.js +3 -1
- package/utils/notify.js +1 -1
- package/utils/power.js +164 -118
- package/utils/previewImage.js +4 -2
- package/utils/price.js +12 -3
- package/utils/rule.js +5 -9
- package/utils/ruleValid.js +10 -0
- package/utils/search.js +81 -50
- package/utils/table.js +119 -87
- package/utils/timestamp.js +2 -2
- package/utils/toast.js +1 -1
- package/utils/tree.js +69 -46
- package/utils/uploader/qiniu.js +31 -15
- package/utils/uploader.js +87 -56
- package/utils/useAuth.js +12 -5
- package/utils/useRouter.js +16 -5
- package/utils/useUploader.js +0 -5
- package/docs/docs/.vuepress/config.js +0 -32
- package/docs/docs/components/field-table.md +0 -1
- package/docs/docs/components/field-tree.md +0 -1
- package/docs/package.json +0 -11
- 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
|
-
})
|