@94ai/nf-audio 3.3.70 → 3.3.72

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const nfMessage = require("@94ai/nf-message");
3
+ const NfMessage = require("@94ai/nf-message");
4
4
  const vue2RuntimeHelpers = require("@94ai/vue2-runtime-helpers");
5
5
  function timeFormat(value) {
6
6
  const minute = parseInt(String(value / 60));
@@ -10,6 +10,10 @@ function timeFormat(value) {
10
10
  const _sfc_main = {
11
11
  name: "nf-audio",
12
12
  props: {
13
+ copySuccessDesc: {
14
+ type: String,
15
+ default: "复制成功"
16
+ },
13
17
  debuglog: {
14
18
  type: Boolean,
15
19
  default: false
@@ -25,6 +29,14 @@ const _sfc_main = {
25
29
  type: String,
26
30
  default: "下载"
27
31
  },
32
+ copyAddressDesc: {
33
+ type: String,
34
+ default: "复制音频地址"
35
+ },
36
+ openWindowDesc: {
37
+ type: String,
38
+ default: "新标签页打开"
39
+ },
28
40
  speedPreDesc: {
29
41
  type: String,
30
42
  default: "x "
@@ -259,7 +271,7 @@ const _sfc_main = {
259
271
  this.$emit("pauseOrPlay", this.paused);
260
272
  } else {
261
273
  console.log("Audio is not ready yet.");
262
- nfMessage.Message.warning(this.unloadTip);
274
+ NfMessage.Message.warning(this.unloadTip);
263
275
  this.paused = true;
264
276
  this.betweenPlaying = false;
265
277
  }
@@ -374,7 +386,7 @@ const _sfc_main = {
374
386
  betweenPlay() {
375
387
  if (!this.disabled) {
376
388
  if (this.checkAudioEffectNull()) {
377
- nfMessage.Message.warning(this.unloadTip);
389
+ NfMessage.Message.warning(this.unloadTip);
378
390
  this.paused = true;
379
391
  this.betweenPlaying = false;
380
392
  return false;
@@ -402,7 +414,7 @@ const _sfc_main = {
402
414
  if (!this.disabled) {
403
415
  if (this.checkAudioEffectNull()) {
404
416
  if (!this.paused) {
405
- nfMessage.Message.warning(this.unloadTip);
417
+ NfMessage.Message.warning(this.unloadTip);
406
418
  }
407
419
  this.paused = true;
408
420
  this.betweenPlaying = false;
@@ -423,7 +435,7 @@ const _sfc_main = {
423
435
  handleMouseup() {
424
436
  if (!this.disabled) {
425
437
  if (this.checkAudioEffectNull()) {
426
- nfMessage.Message.warning(this.unloadTip);
438
+ NfMessage.Message.warning(this.unloadTip);
427
439
  this.paused = true;
428
440
  this.betweenPlaying = false;
429
441
  return false;
@@ -477,6 +489,27 @@ const _sfc_main = {
477
489
  this.$emit("download", e);
478
490
  }
479
491
  },
492
+ copyText(text) {
493
+ var _a;
494
+ const textareaC = document.createElement("textarea");
495
+ textareaC.setAttribute("readonly", "readonly");
496
+ textareaC.value = text;
497
+ document.body.appendChild(textareaC);
498
+ textareaC.select();
499
+ const res = document.execCommand("copy");
500
+ document.body.removeChild(textareaC);
501
+ (_a = this.$openMessage) == null ? void 0 : _a.info({
502
+ message: this.copySuccessDesc,
503
+ duration: 2e3
504
+ });
505
+ return res;
506
+ },
507
+ copyAddress() {
508
+ this.copyText(this.src);
509
+ },
510
+ openWindow() {
511
+ window.open(this.src);
512
+ },
480
513
  calcMoveX() {
481
514
  if (!this.audio.paused) {
482
515
  let MoveX = this.$refs.progressContainer.clientWidth * (this.audio.currentTime / this.audio.duration);
@@ -491,7 +524,7 @@ const _sfc_main = {
491
524
  if (!this.disabled) {
492
525
  this.pauseAudio();
493
526
  if (this.checkAudioEffectNull()) {
494
- nfMessage.Message.warning(this.unloadTip);
527
+ NfMessage.Message.warning(this.unloadTip);
495
528
  this.paused = true;
496
529
  this.betweenPlaying = false;
497
530
  return false;
@@ -804,7 +837,17 @@ var _sfc_render = function render() {
804
837
  on: {
805
838
  "click": _vm.downRecord
806
839
  }
807
- }, [_vm._v(_vm._s(_vm.downloadDesc))])], 1)];
840
+ }, [_vm._v(_vm._s(_vm.downloadDesc))]), _c("div", {
841
+ staticClass: "nf-audio-btn-item",
842
+ on: {
843
+ "click": _vm.openWindow
844
+ }
845
+ }, [_vm._v(_vm._s(_vm.openWindowDesc))]), _c("div", {
846
+ staticClass: "nf-audio-btn-item",
847
+ on: {
848
+ "click": _vm.copyAddress
849
+ }
850
+ }, [_vm._v(_vm._s(_vm.copyAddressDesc))])], 1)];
808
851
  }), _c("div", {
809
852
  staticClass: "nf-audio-more-icon-container",
810
853
  attrs: {
@@ -822,6 +865,9 @@ var _sfc_staticRenderFns = [];
822
865
  var __component__ = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
823
866
  const NfAudio = __component__.exports;
824
867
  NfAudio.install = (app) => {
868
+ if (!app.$openMessage) {
869
+ app.use(NfMessage);
870
+ }
825
871
  app.component("nf-audio", NfAudio);
826
872
  };
827
873
  exports.default = NfAudio;
@@ -1,4 +1,4 @@
1
- import { Message } from "@94ai/nf-message";
1
+ import NfMessage, { Message } from "@94ai/nf-message";
2
2
  import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
3
3
  function timeFormat(value) {
4
4
  const minute = parseInt(String(value / 60));
@@ -8,6 +8,10 @@ function timeFormat(value) {
8
8
  const _sfc_main = {
9
9
  name: "nf-audio",
10
10
  props: {
11
+ copySuccessDesc: {
12
+ type: String,
13
+ default: "复制成功"
14
+ },
11
15
  debuglog: {
12
16
  type: Boolean,
13
17
  default: false
@@ -23,6 +27,14 @@ const _sfc_main = {
23
27
  type: String,
24
28
  default: "下载"
25
29
  },
30
+ copyAddressDesc: {
31
+ type: String,
32
+ default: "复制音频地址"
33
+ },
34
+ openWindowDesc: {
35
+ type: String,
36
+ default: "新标签页打开"
37
+ },
26
38
  speedPreDesc: {
27
39
  type: String,
28
40
  default: "x "
@@ -475,6 +487,27 @@ const _sfc_main = {
475
487
  this.$emit("download", e);
476
488
  }
477
489
  },
490
+ copyText(text) {
491
+ var _a;
492
+ const textareaC = document.createElement("textarea");
493
+ textareaC.setAttribute("readonly", "readonly");
494
+ textareaC.value = text;
495
+ document.body.appendChild(textareaC);
496
+ textareaC.select();
497
+ const res = document.execCommand("copy");
498
+ document.body.removeChild(textareaC);
499
+ (_a = this.$openMessage) == null ? void 0 : _a.info({
500
+ message: this.copySuccessDesc,
501
+ duration: 2e3
502
+ });
503
+ return res;
504
+ },
505
+ copyAddress() {
506
+ this.copyText(this.src);
507
+ },
508
+ openWindow() {
509
+ window.open(this.src);
510
+ },
478
511
  calcMoveX() {
479
512
  if (!this.audio.paused) {
480
513
  let MoveX = this.$refs.progressContainer.clientWidth * (this.audio.currentTime / this.audio.duration);
@@ -802,7 +835,17 @@ var _sfc_render = function render() {
802
835
  on: {
803
836
  "click": _vm.downRecord
804
837
  }
805
- }, [_vm._v(_vm._s(_vm.downloadDesc))])], 1)];
838
+ }, [_vm._v(_vm._s(_vm.downloadDesc))]), _c("div", {
839
+ staticClass: "nf-audio-btn-item",
840
+ on: {
841
+ "click": _vm.openWindow
842
+ }
843
+ }, [_vm._v(_vm._s(_vm.openWindowDesc))]), _c("div", {
844
+ staticClass: "nf-audio-btn-item",
845
+ on: {
846
+ "click": _vm.copyAddress
847
+ }
848
+ }, [_vm._v(_vm._s(_vm.copyAddressDesc))])], 1)];
806
849
  }), _c("div", {
807
850
  staticClass: "nf-audio-more-icon-container",
808
851
  attrs: {
@@ -820,6 +863,9 @@ var _sfc_staticRenderFns = [];
820
863
  var __component__ = /* @__PURE__ */ normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
821
864
  const NfAudio = __component__.exports;
822
865
  NfAudio.install = (app) => {
866
+ if (!app.$openMessage) {
867
+ app.use(NfMessage);
868
+ }
823
869
  app.component("nf-audio", NfAudio);
824
870
  };
825
871
  export {
package/package/index.ts CHANGED
@@ -1,8 +1,15 @@
1
1
  import NfAudio from './nf-audio.vue'
2
2
  import { Vue2, PluginObject } from 'vue-demi'
3
+ import NfMessage from '@94ai/nf-message'
3
4
 
4
5
  NfAudio.install = (app: typeof Vue2) => {
6
+ // @ts-ignore
7
+ if (!app.$openMessage) {
8
+ // @ts-ignore
9
+ app.use(NfMessage)
10
+ }
11
+ // @ts-ignore
5
12
  app!.component('nf-audio', NfAudio)
6
13
  }
7
14
 
8
- export default NfAudio as typeof NfAudio & PluginObject<undefined>
15
+ export default NfAudio as typeof NfAudio & PluginObject<undefined>
@@ -149,6 +149,8 @@
149
149
  </el-popover>
150
150
 
151
151
  <div class="nf-audio-btn-item" @click="downRecord">{{ downloadDesc }}</div>
152
+ <div class="nf-audio-btn-item" @click="openWindow">{{ openWindowDesc }}</div>
153
+ <div class="nf-audio-btn-item" @click="copyAddress">{{ copyAddressDesc }}</div>
152
154
  </div>
153
155
  </slot>
154
156
  <div slot="reference" class="nf-audio-more-icon-container">
@@ -168,6 +170,10 @@ import { timeFormat } from './util'
168
170
  export default {
169
171
  name: 'nf-audio',
170
172
  props: {
173
+ copySuccessDesc: {
174
+ type: String,
175
+ default: '复制成功'
176
+ },
171
177
  debuglog: {
172
178
  type: Boolean,
173
179
  default: false
@@ -183,6 +189,14 @@ export default {
183
189
  type: String,
184
190
  default: '下载'
185
191
  },
192
+ copyAddressDesc: {
193
+ type: String,
194
+ default: '复制音频地址'
195
+ },
196
+ openWindowDesc: {
197
+ type: String,
198
+ default: '新标签页打开'
199
+ },
186
200
  speedPreDesc: {
187
201
  type: String,
188
202
  default: 'x '
@@ -649,6 +663,27 @@ export default {
649
663
  this.$emit('download', e)
650
664
  }
651
665
  },
666
+ copyText(text){
667
+ const textareaC = document.createElement('textarea');
668
+ textareaC.setAttribute('readonly', 'readonly'); //设置只读属性防止手机上弹出软键盘
669
+ textareaC.value = text;
670
+ document.body.appendChild(textareaC); //将textarea添加为body子元素
671
+ textareaC.select();
672
+ const res = document.execCommand('copy');
673
+ document.body.removeChild(textareaC);//移除DOM元素
674
+ // @ts-ignore
675
+ this.$openMessage?.info({
676
+ message: this.copySuccessDesc,
677
+ duration: 2000,
678
+ })
679
+ return res;
680
+ },
681
+ copyAddress() {
682
+ this.copyText(this.src)
683
+ },
684
+ openWindow() {
685
+ window.open(this.src)
686
+ },
652
687
  calcMoveX() {
653
688
  if (!this.audio.paused) {
654
689
  // 设置当前时间
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-audio",
3
- "version": "3.3.70",
3
+ "version": "3.3.72",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "liuxiangxiang <liuxiangxiang@94ai.com>",
@@ -14,7 +14,8 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/nf-theme-chalk": "^3.3.70",
17
+ "@94ai/nf-message": "^3.3.72",
18
+ "@94ai/nf-theme-chalk": "^3.3.72",
18
19
  "vue-demi": "^0.14.5"
19
20
  },
20
21
  "peerDependenciesMeta": {
@@ -30,5 +31,5 @@
30
31
  "types": "lib/index.d.ts",
31
32
  "main": "lib/nf-audio.cjs.js",
32
33
  "module": "lib/nf-audio.esm-bundler.js",
33
- "gitHead": "1bf946dcf2e1977ee3779c3d1c7d204e161e3b71"
34
+ "gitHead": "4eebd978be0f247c218d57b0909f71e84a24734b"
34
35
  }