cnhis-design-vue 3.1.55-beta.6 → 3.1.55-beta.7
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.
|
@@ -7,8 +7,9 @@ export default class AudioSDK {
|
|
|
7
7
|
private recordingDialog;
|
|
8
8
|
private onProcess;
|
|
9
9
|
static instance: AudioSDK | null;
|
|
10
|
+
static serverUrl: string;
|
|
10
11
|
constructor();
|
|
11
|
-
static create(): AudioSDK;
|
|
12
|
+
static create(option?: AnyObject): AudioSDK;
|
|
12
13
|
private initRecorder;
|
|
13
14
|
private recorderOpen;
|
|
14
15
|
recorderStart(instance: ComponentInternalInstance, afterLeave: Function): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"axios";import e from"recorder-core";import"recorder-core/src/engine/mp3";import"recorder-core/src/engine/mp3-engine";import{uuidGenerator as t}from"../../../shared/utils/index.js";import{useThrottleFn as
|
|
1
|
+
import r from"axios";import e from"recorder-core";import"recorder-core/src/engine/mp3";import"recorder-core/src/engine/mp3-engine";import{uuidGenerator as t}from"../../../shared/utils/index.js";import{useThrottleFn as s}from"@vueuse/core";import{RecordingDialog as i}from"./utils/recordingDialog.js";const o=class{constructor(){if(this.recorder=null,this.recordingDialog=new i,this.onProcess=s(((r,e)=>{if(!this.recordingDialog.target)return;const t=this.recordingDialog.target.querySelector(".animation");if(t){const r="translateX(-50%) translateY(-50%)";if(e>.5){const s=1+.02*e;t.style.transform=r+" scale("+s+")"}else t.style.transform=r+" scale(1)"}}),200),o.instance)return o.instance;this.initRecorder(),o.instance=this}static create(r){return(null==r?void 0:r.serverUrl)&&(this.serverUrl=r.serverUrl),new o}initRecorder(){this.recorder=e({type:"mp3",sampleRate:16e3,bitRate:16,onProcess:this.onProcess})}async recorderOpen(){return this.recorder||this.initRecorder(),new Promise(((r,e)=>{this.recorder.open((()=>{r({})}),((r,t)=>{e({result:"fail",msg:r,isUserNotAllow:t})}))}))}async recorderStart(r,e){try{return await this.recorderOpen(),this.recorder.start(),await this.recordingDialog.show(r,e),Promise.resolve({result:"success"})}catch(r){return Promise.reject(r)}}recorderStop(r=!0){return this.recorder?(this.recordingDialog.hide(),new Promise(((e,s)=>{this.recorder.stop((async(i,n)=>{const a=new File([i],`${t()}.mp3`,{type:i.type});try{let t;if(r){const r=new FormData;r.append("audio",a);const{data:e}=await o.audioRecognition(r);t=e}e({result:"success",file:a,duration:n,...t?{data:t}:{}})}catch(r){s({result:"fail",msg:r})}}),(r=>{s({result:"fail",msg:r})}))}))):Promise.reject({result:"fail",msg:"请先打开麦克风录音"})}destroy(){var r;null==(r=this.recorder)||r.close(),this.recorder=null}static async audioRecognition(e){return await r.post(`${this.serverUrl}/audio/recognition`,e,{headers:{"Content-Type":"multipart/form-data"}})}static async audioRevise(e){return await r.post(`${this.serverUrl}/audio/revise`,e)}};let n=o;n.serverUrl="";export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="@cnhis-design-vue/shared",i="3.1.55-beta.
|
|
1
|
+
var e="@cnhis-design-vue/shared",i="3.1.55-beta.7",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.55-beta.7",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.55-beta.
|
|
3
|
+
"version": "3.1.55-beta.7",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"iOS 7",
|
|
65
65
|
"last 3 iOS versions"
|
|
66
66
|
],
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "1877ea41e3ea622c31ae0bafe5a572701573c1d9"
|
|
68
68
|
}
|