@netang/quasar 0.1.63 → 0.1.64

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 (2) hide show
  1. package/package.json +1 -1
  2. package/utils/uploader.js +42 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.1.63",
3
+ "version": "0.1.64",
4
4
  "description": "netang-quasar",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/utils/uploader.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ref, isRef, } from 'vue'
2
+ import { useQuasar } from 'quasar'
2
3
  import SparkMD5 from 'spark-md5'
3
4
 
4
5
  import $n_has from 'lodash/has'
@@ -57,6 +58,9 @@ function create(options) {
57
58
 
58
59
  // ==========【数据】=========================================================================================
59
60
 
61
+ // quasar 对象
62
+ const $q = useQuasar()
63
+
60
64
  const {
61
65
  // 上传文件输入框节点
62
66
  fileRef,
@@ -1387,25 +1391,50 @@ function create(options) {
1387
1391
  /**
1388
1392
  * 播放
1389
1393
  */
1390
- function play(fileItem) {
1391
- // 轻提示
1392
- $n_toast({
1393
- message: '播放还没做',
1394
+ function play({ hash, __img }) {
1395
+
1396
+ const src = __img ? __img : $n_getFile(hash)
1397
+
1398
+ let width
1399
+ let height
1400
+ let fullWidth = false
1401
+ let fullHeight = false
1402
+ let ok = true
1403
+ let style = ''
1404
+
1405
+ if ($q.platform.is.mobile) {
1406
+ width = $q.screen.width - 48 - 32
1407
+ height = $q.screen.height - 48 - 32 - 6 - 52
1408
+ fullWidth = true
1409
+ fullHeight = true
1410
+ } else {
1411
+ width = 800 - 32
1412
+ height = 400 - 32 - 6
1413
+ ok = false
1414
+ style = 'width:800px;max-width:800px;height:400px;max-height:400px;'
1415
+ }
1416
+
1417
+ $q.dialog({
1418
+ message: `<video style="width:${width}px;height:${height}px;" playsinline autoplay controls src="${src}" type="video/mp4" muted="muted"></video>`,
1419
+ style,
1420
+ html: true,
1421
+ dark: true,
1422
+ ok,
1423
+ fullWidth,
1424
+ fullHeight,
1394
1425
  })
1395
1426
  }
1396
1427
 
1397
1428
  /**
1398
1429
  * 复制地址
1399
1430
  */
1400
- function copyUrl({ type, hash, url, isNet }) {
1401
-
1402
- const _url = isNet ? url : (
1403
- type === FilE_TYPE.image ?
1404
- // 如果是图片
1405
- $n_getImage(hash)
1406
- // 否则是文件
1407
- : $n_getFile(hash)
1408
- )
1431
+ function copyUrl({ type, hash }) {
1432
+
1433
+ const _url = type === FilE_TYPE.image ?
1434
+ // 如果是图片
1435
+ $n_getImage(hash)
1436
+ // 否则是文件
1437
+ : $n_getFile(hash)
1409
1438
 
1410
1439
  if ($n_isValidString(_url)) {
1411
1440
  copy(_url, '复制地址成功')