@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.
@@ -21,7 +21,6 @@
21
21
  :name="errorIcon"
22
22
  />
23
23
  </div>
24
-
25
24
  <!-- 默认插槽 -->
26
25
  <slot />
27
26
  </slot>
@@ -58,7 +57,6 @@
58
57
  :name="errorIcon"
59
58
  />
60
59
  </div>
61
-
62
60
  <!-- 默认插槽 -->
63
61
  <slot />
64
62
  </slot>
@@ -454,21 +454,17 @@ export default {
454
454
  // 格式化当前值
455
455
  let val = formatToCurrentValue(currentValue.value, false)
456
456
 
457
- // 如果当前值有变动
458
- if (val !== currentValue.value) {
459
-
460
- // 更新当前值
461
- currentValue.value = val
457
+ // 更新当前值
458
+ currentValue.value = val
462
459
 
463
- // 将当前值转为声明值
464
- val = formatToModelValue(val)
460
+ // 将当前值转为声明值
461
+ val = formatToModelValue(val)
465
462
 
466
- // 触发更新值
467
- emitModelValue(val)
463
+ // 触发更新值
464
+ emitModelValue(val)
468
465
 
469
- // 失去焦点触发
470
- emit('blur', val)
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/useUploader'
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
 
5
5
  "description": "netang-quasar",
6
6
  "scripts": {
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
- // 格式化上传文件 hash
32
- formatUploadFileHash: null,
33
- // 格式化上传网络链接
34
- formatUploadNet: null,
35
- // 获取文件地址
36
- getFileUrl: null,
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
- Object.assign(configs, options)
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
- // type,
53
+ type,
54
54
  domain,
55
- } = $n_uploader.getUpload()
56
-
57
- return useFileUrl(domain, src)
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(null, $n_get(options, 'upload', ''))
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
+ }