@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/uploader.js
CHANGED
|
@@ -1,9 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref, isRef } from 'vue'
|
|
2
2
|
import SparkMD5 from 'spark-md5'
|
|
3
3
|
|
|
4
|
+
import $n_has from 'lodash/has'
|
|
5
|
+
import $n_get from 'lodash/get'
|
|
6
|
+
import $n_toLower from 'lodash/toLower'
|
|
7
|
+
import $n_findIndex from 'lodash/findIndex'
|
|
8
|
+
|
|
9
|
+
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
10
|
+
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
11
|
+
import $n_isValidString from '@netang/utils/isValidString'
|
|
12
|
+
import $n_isRequired from '@netang/utils/isRequired'
|
|
13
|
+
import $n_forEach from '@netang/utils/forEach'
|
|
14
|
+
import $n_json from '@netang/utils/json'
|
|
15
|
+
import $n_join from '@netang/utils/join'
|
|
16
|
+
import $n_split from '@netang/utils/split'
|
|
17
|
+
import $n_trimString from '@netang/utils/trimString'
|
|
18
|
+
import $n_run from '@netang/utils/run'
|
|
19
|
+
import $n_isValidValue from '@netang/utils/isValidValue'
|
|
20
|
+
import $n_copy from '@netang/utils/copy'
|
|
21
|
+
import $n_http from '@netang/utils/http'
|
|
22
|
+
|
|
23
|
+
import $n_config from './config'
|
|
24
|
+
import $n_toast from './toast'
|
|
25
|
+
import $n_confirm from './confirm'
|
|
26
|
+
import $n_alert from './alert'
|
|
27
|
+
|
|
28
|
+
import { configs } from './config'
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
// api 文件请求地址
|
|
32
|
+
apiFileUrl,
|
|
33
|
+
} = configs
|
|
34
|
+
|
|
4
35
|
import {
|
|
5
|
-
// 文件请求地址
|
|
6
|
-
REQUEST_URL,
|
|
7
36
|
// 文件类型映射
|
|
8
37
|
FilE_TYPE,
|
|
9
38
|
// 文件名称映射
|
|
@@ -60,10 +89,10 @@ function create(params) {
|
|
|
60
89
|
loadInfo: false,
|
|
61
90
|
// 单文件上传提示
|
|
62
91
|
confirm: false,
|
|
63
|
-
}, $
|
|
92
|
+
}, $n_get(params, 'props'))
|
|
64
93
|
|
|
65
94
|
// 上传文件列表
|
|
66
|
-
const uploadFileLists = $
|
|
95
|
+
const uploadFileLists = $n_has(params, 'uploadFileLists') && isRef(params.uploadFileLists) ? params.uploadFileLists : ref([])
|
|
67
96
|
|
|
68
97
|
/**
|
|
69
98
|
* 上传配置
|
|
@@ -72,12 +101,12 @@ function create(params) {
|
|
|
72
101
|
{
|
|
73
102
|
type: 'local',
|
|
74
103
|
},
|
|
75
|
-
$
|
|
104
|
+
$n_config('uploader.upload')
|
|
76
105
|
)
|
|
77
106
|
const configLimit = Object.assign({
|
|
78
107
|
maxSize: 100,
|
|
79
108
|
exts: [],
|
|
80
|
-
}, $
|
|
109
|
+
}, $n_config('uploader.limit.' + props.type))
|
|
81
110
|
|
|
82
111
|
// 如果有单个文件的最大大小
|
|
83
112
|
if (props.maxSize) {
|
|
@@ -85,7 +114,7 @@ function create(params) {
|
|
|
85
114
|
}
|
|
86
115
|
|
|
87
116
|
// 如果有单个文件的限制后缀
|
|
88
|
-
if ($
|
|
117
|
+
if ($n_isValidArray(props.exts)) {
|
|
89
118
|
configLimit.exts = props.exts
|
|
90
119
|
}
|
|
91
120
|
|
|
@@ -94,9 +123,9 @@ function create(params) {
|
|
|
94
123
|
/**
|
|
95
124
|
* 上传文件后缀名
|
|
96
125
|
*/
|
|
97
|
-
const accept = computed(function () {
|
|
98
|
-
|
|
99
|
-
})
|
|
126
|
+
// const accept = computed(function () {
|
|
127
|
+
//
|
|
128
|
+
// })
|
|
100
129
|
|
|
101
130
|
// ==========【监听数据】==============================================================================================
|
|
102
131
|
|
|
@@ -121,7 +150,7 @@ function create(params) {
|
|
|
121
150
|
}
|
|
122
151
|
}
|
|
123
152
|
|
|
124
|
-
const hashsString = $
|
|
153
|
+
const hashsString = $n_join(hashs, ',')
|
|
125
154
|
|
|
126
155
|
return {
|
|
127
156
|
value: props.valueArray ? hashs : hashsString,
|
|
@@ -140,10 +169,10 @@ function create(params) {
|
|
|
140
169
|
const result = getValue()
|
|
141
170
|
|
|
142
171
|
// 更新值
|
|
143
|
-
$
|
|
172
|
+
$n_run(onUpdateModelValue)(result)
|
|
144
173
|
|
|
145
174
|
// 更新
|
|
146
|
-
$
|
|
175
|
+
$n_run(onUpdate)(result)
|
|
147
176
|
}
|
|
148
177
|
|
|
149
178
|
/**
|
|
@@ -151,24 +180,24 @@ function create(params) {
|
|
|
151
180
|
*/
|
|
152
181
|
function update() {
|
|
153
182
|
// 更新
|
|
154
|
-
$
|
|
183
|
+
$n_run(onUpdate)(getValue())
|
|
155
184
|
}
|
|
156
185
|
|
|
157
186
|
/**
|
|
158
187
|
* 初始化上传列表
|
|
159
188
|
*/
|
|
160
189
|
async function initUploadFileLists() {
|
|
161
|
-
if ($
|
|
190
|
+
if ($n_isRequired(props.modelValue)) {
|
|
162
191
|
|
|
163
192
|
// 获取值数组
|
|
164
|
-
const hashs = props.valueArray ? props.modelValue : $
|
|
193
|
+
const hashs = props.valueArray ? props.modelValue : $n_split(props.modelValue, ',')
|
|
165
194
|
|
|
166
195
|
// 如果类型不是图片 || 初始加载文件信息, 则请求文件信息
|
|
167
196
|
if (props.type !== 'image' || props.loadInfo) {
|
|
168
197
|
|
|
169
198
|
// 请求 - 获取文件
|
|
170
|
-
const { status, data: resExisted } = await $
|
|
171
|
-
url:
|
|
199
|
+
const { status, data: resExisted } = await $n_http({
|
|
200
|
+
url: apiFileUrl + 'get_file',
|
|
172
201
|
data: {
|
|
173
202
|
hashs,
|
|
174
203
|
},
|
|
@@ -177,7 +206,7 @@ function create(params) {
|
|
|
177
206
|
})
|
|
178
207
|
if (status) {
|
|
179
208
|
|
|
180
|
-
$
|
|
209
|
+
$n_forEach(resExisted, function (existedItem) {
|
|
181
210
|
|
|
182
211
|
// 创建原始单个文件
|
|
183
212
|
const fileItem = createRawFileItem()
|
|
@@ -197,7 +226,7 @@ function create(params) {
|
|
|
197
226
|
return
|
|
198
227
|
}
|
|
199
228
|
|
|
200
|
-
$
|
|
229
|
+
$n_forEach(hashs, function(hash) {
|
|
201
230
|
|
|
202
231
|
// 添加至上传文件列表
|
|
203
232
|
uploadFileLists.value.push(Object.assign(createRawFileItem(), {
|
|
@@ -271,7 +300,7 @@ function create(params) {
|
|
|
271
300
|
if (props.confirm) {
|
|
272
301
|
|
|
273
302
|
// 确认框
|
|
274
|
-
$
|
|
303
|
+
$n_confirm({
|
|
275
304
|
message: '最多只能上传1个文件,确认上传并替换吗?',
|
|
276
305
|
})
|
|
277
306
|
// 点击确认执行
|
|
@@ -301,7 +330,7 @@ function create(params) {
|
|
|
301
330
|
&& uploadFileLists.value.length >= props.count
|
|
302
331
|
) {
|
|
303
332
|
// 轻提示
|
|
304
|
-
$
|
|
333
|
+
$n_toast({
|
|
305
334
|
message: `最多只能上传${props.count}个文件,请先删除后再上传`,
|
|
306
335
|
})
|
|
307
336
|
return
|
|
@@ -319,8 +348,8 @@ function create(params) {
|
|
|
319
348
|
} catch (e) {
|
|
320
349
|
|
|
321
350
|
// 错误提示
|
|
322
|
-
$
|
|
323
|
-
message: $
|
|
351
|
+
$n_alert({
|
|
352
|
+
message: $n_getThrowMessage(e),
|
|
324
353
|
})
|
|
325
354
|
}
|
|
326
355
|
|
|
@@ -369,13 +398,13 @@ function create(params) {
|
|
|
369
398
|
async function upload() {
|
|
370
399
|
try {
|
|
371
400
|
if (! _upload) {
|
|
372
|
-
const run = $
|
|
401
|
+
const run = $n_get(UPLOADERS, configUpload.type)
|
|
373
402
|
if (run) {
|
|
374
403
|
_upload = (await run()).default
|
|
375
404
|
}
|
|
376
405
|
if (! _upload) {
|
|
377
406
|
// 错误提示
|
|
378
|
-
$
|
|
407
|
+
$n_alert({
|
|
379
408
|
message: '没有定义上传器',
|
|
380
409
|
})
|
|
381
410
|
return
|
|
@@ -406,8 +435,8 @@ function create(params) {
|
|
|
406
435
|
|
|
407
436
|
} catch (e) {
|
|
408
437
|
// 错误提示
|
|
409
|
-
$
|
|
410
|
-
message: $
|
|
438
|
+
$n_alert({
|
|
439
|
+
message: $n_getThrowMessage(e),
|
|
411
440
|
})
|
|
412
441
|
}
|
|
413
442
|
}
|
|
@@ -504,10 +533,10 @@ function create(params) {
|
|
|
504
533
|
// 如果开启去重
|
|
505
534
|
props.unique
|
|
506
535
|
// 如果该文件 hash 在上传文件列表中
|
|
507
|
-
&& $
|
|
536
|
+
&& $n_findIndex(uploadFileLists.value, { hash }) > -1
|
|
508
537
|
) {
|
|
509
538
|
// 轻提示
|
|
510
|
-
$
|
|
539
|
+
$n_toast({
|
|
511
540
|
message: '该文件已存在,不可重复上传',
|
|
512
541
|
})
|
|
513
542
|
|
|
@@ -573,7 +602,7 @@ function create(params) {
|
|
|
573
602
|
! ext
|
|
574
603
|
// 如果后缀名不在允许范围内, 则无效
|
|
575
604
|
|| (
|
|
576
|
-
$
|
|
605
|
+
$n_isValidArray(exts)
|
|
577
606
|
&& exts.indexOf(ext) === -1
|
|
578
607
|
)
|
|
579
608
|
) {
|
|
@@ -623,10 +652,10 @@ function create(params) {
|
|
|
623
652
|
}
|
|
624
653
|
|
|
625
654
|
// 请求 - 检查文件是否存在 hash
|
|
626
|
-
const { status, data: resExisted } = await $
|
|
627
|
-
url:
|
|
655
|
+
const { status, data: resExisted } = await $n_http({
|
|
656
|
+
url: apiFileUrl + 'check_exist',
|
|
628
657
|
data: {
|
|
629
|
-
hashs: $
|
|
658
|
+
hashs: $n_uniq(checkHashs),
|
|
630
659
|
},
|
|
631
660
|
// 关闭错误
|
|
632
661
|
warn: false,
|
|
@@ -648,7 +677,7 @@ function create(params) {
|
|
|
648
677
|
}
|
|
649
678
|
|
|
650
679
|
// 如果有存在的文件列表
|
|
651
|
-
if ($
|
|
680
|
+
if ($n_isValidArray(resExisted)) {
|
|
652
681
|
|
|
653
682
|
// 已存在文件数量
|
|
654
683
|
let existedNum = 0
|
|
@@ -658,11 +687,11 @@ function create(params) {
|
|
|
658
687
|
for (const fileItem of checkFileLists) {
|
|
659
688
|
|
|
660
689
|
// 如果文件已存在(已经上传过了, 就是检查是否秒传文件)
|
|
661
|
-
const existedItem = $
|
|
690
|
+
const existedItem = $n_find(resExisted, { hash: fileItem.hash })
|
|
662
691
|
if (existedItem) {
|
|
663
692
|
|
|
664
693
|
// 如果 类型为文件, 则不受限制 || 文件类型正确
|
|
665
|
-
if (props.type === 'file' || fileItem.type === $
|
|
694
|
+
if (props.type === 'file' || fileItem.type === $n_get(existedItem, 'type')) {
|
|
666
695
|
|
|
667
696
|
// 设置已存在文件
|
|
668
697
|
setExistedFileItem(fileItem, existedItem)
|
|
@@ -763,10 +792,10 @@ function create(params) {
|
|
|
763
792
|
// 如果开启去重
|
|
764
793
|
props.unique
|
|
765
794
|
// 如果该文件 key 在上传文件列表中
|
|
766
|
-
&& $
|
|
795
|
+
&& $n_findIndex(uploadFileLists.value, { key }) > -1
|
|
767
796
|
) {
|
|
768
797
|
// 轻提示
|
|
769
|
-
$
|
|
798
|
+
$n_toast({
|
|
770
799
|
message: '该文件已存在,不可重复上传',
|
|
771
800
|
})
|
|
772
801
|
|
|
@@ -782,7 +811,7 @@ function create(params) {
|
|
|
782
811
|
const index = name.lastIndexOf('.')
|
|
783
812
|
if (index > -1) {
|
|
784
813
|
title = name.substring(0, index)
|
|
785
|
-
ext = $
|
|
814
|
+
ext = $n_toLower(name.substring(index + 1))
|
|
786
815
|
}
|
|
787
816
|
|
|
788
817
|
// 创建单个文件
|
|
@@ -843,7 +872,7 @@ function create(params) {
|
|
|
843
872
|
json,
|
|
844
873
|
} = existedItem
|
|
845
874
|
|
|
846
|
-
const fileJson = $
|
|
875
|
+
const fileJson = $n_json.parse(json)
|
|
847
876
|
|
|
848
877
|
// 设置文件
|
|
849
878
|
Object.assign(fileItem, {
|
|
@@ -858,7 +887,7 @@ function create(params) {
|
|
|
858
887
|
// 大小
|
|
859
888
|
size,
|
|
860
889
|
// 信息
|
|
861
|
-
json: $
|
|
890
|
+
json: $n_isValidObject(fileJson) ? fileJson : {},
|
|
862
891
|
// 状态
|
|
863
892
|
status: UPLOAD_STATUS.success,
|
|
864
893
|
// 进度
|
|
@@ -890,7 +919,7 @@ function create(params) {
|
|
|
890
919
|
* 删除单个文件
|
|
891
920
|
*/
|
|
892
921
|
function deleteFileItem(fileItem) {
|
|
893
|
-
const index = $
|
|
922
|
+
const index = $n_findIndex(uploadFileLists.value, { id: fileItem.id })
|
|
894
923
|
if (index > -1) {
|
|
895
924
|
|
|
896
925
|
const {
|
|
@@ -917,7 +946,7 @@ function create(params) {
|
|
|
917
946
|
function previewImage(fileItem) {
|
|
918
947
|
// 预览图片
|
|
919
948
|
if (fileItem.type === FilE_TYPE.image) {
|
|
920
|
-
$
|
|
949
|
+
$n_previewImage($n_has(fileItem, '__img') ? fileItem.__img : fileItem.hash)
|
|
921
950
|
}
|
|
922
951
|
}
|
|
923
952
|
|
|
@@ -926,9 +955,9 @@ function create(params) {
|
|
|
926
955
|
*/
|
|
927
956
|
async function editFileTitle(newTitle, fileItem) {
|
|
928
957
|
|
|
929
|
-
if ($
|
|
958
|
+
if ($n_isValidValue(newTitle)) {
|
|
930
959
|
|
|
931
|
-
newTitle = $
|
|
960
|
+
newTitle = $n_trimString(newTitle)
|
|
932
961
|
|
|
933
962
|
const {
|
|
934
963
|
hash,
|
|
@@ -943,8 +972,8 @@ function create(params) {
|
|
|
943
972
|
fileItem.title = newTitle
|
|
944
973
|
|
|
945
974
|
// 请求 - 修改文件名
|
|
946
|
-
const { status } = await $
|
|
947
|
-
url:
|
|
975
|
+
const { status } = await $n_http({
|
|
976
|
+
url: apiFileUrl + 'edit_file_title',
|
|
948
977
|
data: {
|
|
949
978
|
hash,
|
|
950
979
|
title: newTitle,
|
|
@@ -959,7 +988,7 @@ function create(params) {
|
|
|
959
988
|
}
|
|
960
989
|
|
|
961
990
|
// 轻提示
|
|
962
|
-
$
|
|
991
|
+
$n_toast({
|
|
963
992
|
type: 'positive',
|
|
964
993
|
message: '修改成功',
|
|
965
994
|
})
|
|
@@ -971,7 +1000,7 @@ function create(params) {
|
|
|
971
1000
|
*/
|
|
972
1001
|
function play(fileItem) {
|
|
973
1002
|
// 轻提示
|
|
974
|
-
$
|
|
1003
|
+
$n_toast({
|
|
975
1004
|
message: '播放还没做',
|
|
976
1005
|
})
|
|
977
1006
|
}
|
|
@@ -983,12 +1012,12 @@ function create(params) {
|
|
|
983
1012
|
|
|
984
1013
|
const url = fileItem.type === FilE_TYPE.image ?
|
|
985
1014
|
// 如果是图片
|
|
986
|
-
$
|
|
1015
|
+
$n_getImage(fileItem.hash)
|
|
987
1016
|
// 否则是文件
|
|
988
|
-
: $
|
|
1017
|
+
: $n_getFile(fileItem.hash)
|
|
989
1018
|
|
|
990
|
-
if ($
|
|
991
|
-
$
|
|
1019
|
+
if ($n_isValidString(url)) {
|
|
1020
|
+
$n_copy(url, '复制地址成功')
|
|
992
1021
|
}
|
|
993
1022
|
}
|
|
994
1023
|
|
|
@@ -1023,7 +1052,9 @@ function create(params) {
|
|
|
1023
1052
|
/**
|
|
1024
1053
|
* 上传器
|
|
1025
1054
|
*/
|
|
1026
|
-
|
|
1055
|
+
const uploader = {
|
|
1027
1056
|
// 创建对话框
|
|
1028
1057
|
create,
|
|
1029
1058
|
}
|
|
1059
|
+
|
|
1060
|
+
export default uploader
|
package/utils/useAuth.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import validator from '@netang/utils/validator'
|
|
2
|
+
import $n_cookie from '@netang/utils/cookie'
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
validator: $n_validator,
|
|
6
|
+
} = validator
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
9
|
* 初始化鉴权状态
|
|
3
10
|
*/
|
|
4
11
|
export function initAuthStore() {
|
|
5
12
|
// 获取管理员信息缓存
|
|
6
|
-
const cache = $
|
|
7
|
-
return
|
|
13
|
+
const cache = $n_cookie.get('_tk')
|
|
14
|
+
return checkUserInfo(cache) ? cache : {
|
|
8
15
|
id: 0,
|
|
9
16
|
isLogin: false,
|
|
10
17
|
info: {},
|
|
@@ -12,10 +19,10 @@ export function initAuthStore() {
|
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
/**
|
|
15
|
-
*
|
|
22
|
+
* 验证用户信息
|
|
16
23
|
*/
|
|
17
|
-
export function
|
|
18
|
-
return ! $
|
|
24
|
+
export function checkUserInfo(data) {
|
|
25
|
+
return ! $n_validator(data, {
|
|
19
26
|
// 管理员 id
|
|
20
27
|
id: 'required|natural_no_zero',
|
|
21
28
|
// 登录 token
|
package/utils/useRouter.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import $n_has from 'lodash/has'
|
|
2
|
+
import $n_get from 'lodash/get'
|
|
3
|
+
|
|
4
|
+
import $n_forIn from '@netang/utils/forIn'
|
|
5
|
+
import $n_slash from '@netang/utils/slash'
|
|
6
|
+
|
|
7
|
+
import { configs } from './config'
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
// 自定义路由
|
|
11
|
+
routers,
|
|
12
|
+
} = configs
|
|
2
13
|
|
|
3
14
|
/**
|
|
4
15
|
* 获取路由
|
|
@@ -9,18 +20,18 @@ export function getRouters(mainRouter, errorRouter) {
|
|
|
9
20
|
mainRouter
|
|
10
21
|
]
|
|
11
22
|
|
|
12
|
-
$
|
|
23
|
+
$n_forIn(routers, function(item, key) {
|
|
13
24
|
|
|
14
25
|
// 如果没有 meta
|
|
15
|
-
if (! $
|
|
26
|
+
if (! $n_has(item, 'meta')) {
|
|
16
27
|
item.meta = {}
|
|
17
28
|
}
|
|
18
29
|
|
|
19
30
|
// path
|
|
20
|
-
item.path = $
|
|
31
|
+
item.path = $n_slash(key, 'start', true)
|
|
21
32
|
|
|
22
33
|
// 如果是单独路由
|
|
23
|
-
if ($
|
|
34
|
+
if ($n_get(item.meta, 'parent') === false) {
|
|
24
35
|
routes.push(item)
|
|
25
36
|
|
|
26
37
|
// 否则为框架页面
|
package/utils/useUploader.js
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import { defineUserConfig } from '@vuepress/cli'
|
|
3
|
-
|
|
4
|
-
export default defineUserConfig({
|
|
5
|
-
// 站点的标题
|
|
6
|
-
title: 'netang-quasar',
|
|
7
|
-
// 部署站点的基础路径
|
|
8
|
-
base: '/netang-quasar/docs/dist',
|
|
9
|
-
// 打包目录
|
|
10
|
-
dest: path.join(__dirname, '../../dist'),
|
|
11
|
-
|
|
12
|
-
themeConfig: {
|
|
13
|
-
nav:[
|
|
14
|
-
{
|
|
15
|
-
text: 'components 组件',
|
|
16
|
-
link: '/components/',
|
|
17
|
-
items: [
|
|
18
|
-
{text: 'FieldTable 下拉表格', link: '/field-table'},
|
|
19
|
-
{text: 'FieldTree 下拉树', link: '/field-tree'},
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
text: 'utils 工具',
|
|
24
|
-
link: '/utils/',
|
|
25
|
-
items: [
|
|
26
|
-
{text: 'confirm 确认框', link: '/confirm'},
|
|
27
|
-
{text: 'alert 提示框', link: '/alert'},
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# table
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# tree
|