@netang/quasar 0.2.7 → 0.2.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.
- package/components/img/index.vue +0 -2
- package/components/input-number/index.vue +8 -12
- package/components/uploader/index.vue +5 -0
- package/components/uploader-query/index.vue +18 -1
- package/package.json +1 -1
- package/utils/config.js +15 -7
- package/utils/getFile.js +9 -4
- package/utils/getImage.js +11 -2
- package/utils/index.js +2 -0
- package/utils/play.js +40 -0
- package/utils/uploader.js +578 -108
- package/utils/useFileUrl.js +4 -4
- package/utils/useUploader.js +0 -303
package/components/img/index.vue
CHANGED
|
@@ -454,21 +454,17 @@ export default {
|
|
|
454
454
|
// 格式化当前值
|
|
455
455
|
let val = formatToCurrentValue(currentValue.value, false)
|
|
456
456
|
|
|
457
|
-
//
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
// 更新当前值
|
|
461
|
-
currentValue.value = val
|
|
457
|
+
// 更新当前值
|
|
458
|
+
currentValue.value = val
|
|
462
459
|
|
|
463
|
-
|
|
464
|
-
|
|
460
|
+
// 将当前值转为声明值
|
|
461
|
+
val = formatToModelValue(val)
|
|
465
462
|
|
|
466
|
-
|
|
467
|
-
|
|
463
|
+
// 触发更新值
|
|
464
|
+
emitModelValue(val)
|
|
468
465
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
466
|
+
// 失去焦点触发
|
|
467
|
+
emit('blur', val)
|
|
472
468
|
}
|
|
473
469
|
|
|
474
470
|
/**
|
|
@@ -39,6 +39,8 @@ export default {
|
|
|
39
39
|
props: {
|
|
40
40
|
// 值
|
|
41
41
|
modelValue: [String, Array],
|
|
42
|
+
// 上传器类型
|
|
43
|
+
uploaderType: String,
|
|
42
44
|
// 上传文件类型, 可选值 file image video audio
|
|
43
45
|
type: {
|
|
44
46
|
type: String,
|
|
@@ -99,6 +101,9 @@ export default {
|
|
|
99
101
|
|
|
100
102
|
// 创建上传器
|
|
101
103
|
const uploader = $n_uploader.create({
|
|
104
|
+
// 上传器类型
|
|
105
|
+
uploaderType: props.uploaderType,
|
|
106
|
+
// 上传文件类型, 可选值 file image video audio
|
|
102
107
|
type: props.type,
|
|
103
108
|
// 声明属性
|
|
104
109
|
props,
|
|
@@ -315,6 +315,21 @@
|
|
|
315
315
|
/>
|
|
316
316
|
|
|
317
317
|
<!-- 播放图标 -->
|
|
318
|
+
<n-thumbnail
|
|
319
|
+
class="rounded-borders cursor-pointer"
|
|
320
|
+
:src="fileItem.json.p"
|
|
321
|
+
:size="currentSize / 1.5"
|
|
322
|
+
title="播放"
|
|
323
|
+
@click.prevent.stop="uploader.play(fileItem)"
|
|
324
|
+
v-else-if="fileItem.json.p"
|
|
325
|
+
>
|
|
326
|
+
<div class="absolute-full no-padding row items-center justify-center">
|
|
327
|
+
<q-icon
|
|
328
|
+
name="play_circle"
|
|
329
|
+
:size="toPx(currentSize / 3)"
|
|
330
|
+
/>
|
|
331
|
+
</div>
|
|
332
|
+
</n-thumbnail>
|
|
318
333
|
<q-icon
|
|
319
334
|
class="n-uploader-query__item__icon__icon cursor-pointer"
|
|
320
335
|
name="play_circle"
|
|
@@ -431,13 +446,14 @@ import $n_getImage from '../../utils/getImage'
|
|
|
431
446
|
import $n_previewImage from '../../utils/previewImage'
|
|
432
447
|
|
|
433
448
|
import NDragger from '../dragger'
|
|
449
|
+
import NThumbnail from '../thumbnail'
|
|
434
450
|
|
|
435
451
|
import { NUploaderKey } from '../../utils/symbols'
|
|
436
452
|
|
|
437
453
|
import {
|
|
438
454
|
// 上传状态
|
|
439
455
|
UPLOAD_STATUS,
|
|
440
|
-
} from '../../utils/
|
|
456
|
+
} from '../../utils/uploader'
|
|
441
457
|
|
|
442
458
|
export default {
|
|
443
459
|
|
|
@@ -451,6 +467,7 @@ export default {
|
|
|
451
467
|
*/
|
|
452
468
|
components: {
|
|
453
469
|
NDragger,
|
|
470
|
+
NThumbnail,
|
|
454
471
|
},
|
|
455
472
|
|
|
456
473
|
/**
|
package/package.json
CHANGED
package/utils/config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import $n_get from 'lodash/get'
|
|
2
|
+
import $n_merge from 'lodash/merge'
|
|
2
3
|
|
|
3
4
|
// 用户配置 参数
|
|
4
5
|
// userConfig: {
|
|
@@ -26,14 +27,21 @@ export const configs = {
|
|
|
26
27
|
routers: {},
|
|
27
28
|
// 表格配置
|
|
28
29
|
tablesConfig: {},
|
|
30
|
+
// 组件配置
|
|
31
|
+
components: {},
|
|
29
32
|
// 对话框组件
|
|
30
33
|
dialogComponents: {},
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
// 上传器配置
|
|
35
|
+
uploader: {
|
|
36
|
+
// 如果是 Minio 上传, 则在后面加上下划线
|
|
37
|
+
hasMinioSuffix: true,
|
|
38
|
+
// 格式化上传文件 hash
|
|
39
|
+
formatUploadFileHash: null,
|
|
40
|
+
// 格式化上传网络链接
|
|
41
|
+
formatUploadNet: null,
|
|
42
|
+
// 获取文件地址
|
|
43
|
+
getFileUrl: null,
|
|
44
|
+
},
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
/**
|
|
@@ -41,7 +49,7 @@ export const configs = {
|
|
|
41
49
|
* @param options
|
|
42
50
|
*/
|
|
43
51
|
export function settings(options) {
|
|
44
|
-
|
|
52
|
+
$n_merge(configs, options)
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
/**
|
package/utils/getFile.js
CHANGED
|
@@ -50,11 +50,16 @@ export default function getFile(src) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const {
|
|
53
|
-
|
|
53
|
+
type,
|
|
54
54
|
domain,
|
|
55
|
-
} = $n_uploader.getUpload(
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
} = $n_uploader.getUpload(
|
|
56
|
+
null,
|
|
57
|
+
src && src.slice(-1) === '_'
|
|
58
|
+
? 'minio'
|
|
59
|
+
: ''
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
return useFileUrl({ type, domain, src })
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
65
|
|
package/utils/getImage.js
CHANGED
|
@@ -130,7 +130,16 @@ export default function getImage(src, options) {
|
|
|
130
130
|
const {
|
|
131
131
|
type,
|
|
132
132
|
domain,
|
|
133
|
-
} = $n_uploader.getUpload(
|
|
133
|
+
} = $n_uploader.getUpload(
|
|
134
|
+
null,
|
|
135
|
+
$n_has(options, 'upload')
|
|
136
|
+
? options.upload
|
|
137
|
+
: (
|
|
138
|
+
src && src.slice(-1) === '_'
|
|
139
|
+
? 'minio'
|
|
140
|
+
: ''
|
|
141
|
+
)
|
|
142
|
+
)
|
|
134
143
|
|
|
135
144
|
// 判断图片上传方式
|
|
136
145
|
switch (type) {
|
|
@@ -219,7 +228,7 @@ export default function getImage(src, options) {
|
|
|
219
228
|
// #endif
|
|
220
229
|
// --------------------------------------------------
|
|
221
230
|
|
|
222
|
-
return useFileUrl(domain, src)
|
|
231
|
+
return useFileUrl({ type, domain, src })
|
|
223
232
|
}
|
|
224
233
|
}
|
|
225
234
|
|
package/utils/index.js
CHANGED
|
@@ -24,6 +24,7 @@ import getImage from './getImage'
|
|
|
24
24
|
import getTime from './getTime'
|
|
25
25
|
import loading from './loading'
|
|
26
26
|
import notify from './notify'
|
|
27
|
+
import play from './play'
|
|
27
28
|
import previewImage from './previewImage'
|
|
28
29
|
import price from './price'
|
|
29
30
|
import timestamp from './timestamp'
|
|
@@ -57,6 +58,7 @@ export default {
|
|
|
57
58
|
getTime,
|
|
58
59
|
loading,
|
|
59
60
|
notify,
|
|
61
|
+
play,
|
|
60
62
|
previewImage,
|
|
61
63
|
price,
|
|
62
64
|
timestamp,
|
package/utils/play.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Platform, Screen, Dialog } from 'quasar'
|
|
2
|
+
|
|
3
|
+
import $n_getFile from './getFile'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 播放视频 / 音频
|
|
7
|
+
*/
|
|
8
|
+
export default function play(hash) {
|
|
9
|
+
|
|
10
|
+
const src = $n_getFile(hash)
|
|
11
|
+
|
|
12
|
+
let width
|
|
13
|
+
let height
|
|
14
|
+
let fullWidth = false
|
|
15
|
+
let fullHeight = false
|
|
16
|
+
let ok = true
|
|
17
|
+
let style = ''
|
|
18
|
+
|
|
19
|
+
if (Platform.is.mobile) {
|
|
20
|
+
width = Screen.width - 48 - 32
|
|
21
|
+
height = Screen.height - 48 - 32 - 6 - 52
|
|
22
|
+
fullWidth = true
|
|
23
|
+
fullHeight = true
|
|
24
|
+
} else {
|
|
25
|
+
width = 800 - 32
|
|
26
|
+
height = 400 - 32 - 6
|
|
27
|
+
ok = false
|
|
28
|
+
style = 'width:800px;max-width:800px;height:400px;max-height:400px;'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Dialog.create({
|
|
32
|
+
message: `<video style="width:${width}px;height:${height}px;" playsinline autoplay controls src="${src}" type="video/mp4" muted="muted"></video>`,
|
|
33
|
+
style,
|
|
34
|
+
html: true,
|
|
35
|
+
dark: true,
|
|
36
|
+
ok,
|
|
37
|
+
fullWidth,
|
|
38
|
+
fullHeight,
|
|
39
|
+
})
|
|
40
|
+
}
|