bayi 2 years ago
parent
commit
bad99428a8
3 changed files with 16 additions and 34 deletions
  1. 0 1
      components/uploadFile/index.js
  2. 16 24
      pages/reading/index.js
  3. 0 9
      pages/score/index.js

+ 0 - 1
components/uploadFile/index.js

@@ -55,7 +55,6 @@ Component({
             this.setData({
             this.setData({
                 uploadFlag: true
                 uploadFlag: true
             })
             })
-            return
             const uploadTask = wx.uploadFile({
             const uploadTask = wx.uploadFile({
                 url: 'https://reader-api.ai160.com//file/upload',
                 url: 'https://reader-api.ai160.com//file/upload',
                 filePath: this.data.readDetail.tempFilePath,
                 filePath: this.data.readDetail.tempFilePath,

+ 16 - 24
pages/reading/index.js

@@ -40,6 +40,14 @@ let resultAudioContext = null
 let wsEngine = aiengine.createWsEngine({});
 let wsEngine = aiengine.createWsEngine({});
 /*微信录音*/
 /*微信录音*/
 let recorderManager = wx.getRecorderManager();
 let recorderManager = wx.getRecorderManager();
+let options = {
+    duration: 600000,
+    sampleRate: 44100, //采样率
+    numberOfChannels: 1, //录音通道数
+    encodeBitRate: 192000, //编码码率
+    format: 'mp3', //音频格式,有效值aac/mp3
+    frameSize: 50 //指定帧大小,单位 KB
+};
 Page({
 Page({
     data: {
     data: {
         videoInfo: {},
         videoInfo: {},
@@ -90,12 +98,12 @@ Page({
         })
         })
         this.getreadInfo(videoId, options.reset).then(res => {
         this.getreadInfo(videoId, options.reset).then(res => {
             wx.nextTick(() => {
             wx.nextTick(() => {
-                if (options.voluntarily && this.data.isVip) {
-                    this.setCountDown()
-                }
-                if (options.autoPlay) {
-                    this.videoPlay()
-                }
+                /*   if (options.voluntarily && this.data.isVip) {
+                      this.setCountDown()
+                  }
+                  if (options.autoPlay) {
+                      this.videoPlay()
+                  } */
             })
             })
         })
         })
         // 手工绑定 
         // 手工绑定 
@@ -319,16 +327,8 @@ Page({
             },
             },
             success: (res) => {
             success: (res) => {
                 /*引擎启动成功,可以启动录音机开始录音,并将音频片传给引擎*/
                 /*引擎启动成功,可以启动录音机开始录音,并将音频片传给引擎*/
-                let options = {
-                    duration: 600000,
-                    sampleRate: 44100, //采样率
-                    numberOfChannels: 1, //录音通道数
-                    encodeBitRate: 192000, //编码码率
-                    format: 'mp3', //音频格式,有效值aac/mp3
-                    frameSize: 50 //指定帧大小,单位 KB
-                };
                 //开始录音,在开始录音回调中feed音频片
                 //开始录音,在开始录音回调中feed音频片
-                recorderManager.start(options);
+                recorderManager.start(this.options);
             },
             },
             fail: (res) => {
             fail: (res) => {
                 console.log("fail=============  ", res);
                 console.log("fail=============  ", res);
@@ -371,16 +371,8 @@ Page({
         });
         });
     },
     },
     songRecording() {
     songRecording() {
-        let options = {
-            duration: 600000,
-            sampleRate: 44100, //采样率
-            numberOfChannels: 1, //录音通道数
-            encodeBitRate: 192000, //编码码率
-            format: 'mp3', //音频格式,有效值aac/mp3
-            frameSize: 50 //指定帧大小,单位 KB
-        };
         //开始录音,在开始录音回调中feed音频片
         //开始录音,在开始录音回调中feed音频片
-        recorderManager.start(options);
+        recorderManager.start(this.options);
         recorderManager.onError(res => {
         recorderManager.onError(res => {
             console.log(res, 'songError');
             console.log(res, 'songError');
         })
         })

+ 0 - 9
pages/score/index.js

@@ -22,15 +22,6 @@ Page({
      */
      */
     async onLoad(options) {
     async onLoad(options) {
         console.log(options);
         console.log(options);
-        /*     wx.enableAlertBeforeUnload({
-              message: "未完成上传,是否退出?",
-              success: function (res) {
-                console.log(res)
-              },
-              fail: function (e) {
-                console.log(e)
-              }
-            }) */
         this.storeBindings = createStoreBindings(this, {
         this.storeBindings = createStoreBindings(this, {
             store,
             store,
             fields: {
             fields: {