Browse Source

AI参谋页面优化-按下录音震动效果

zhujindu 1 year ago
parent
commit
c8192c2385
1 changed files with 18 additions and 2 deletions
  1. 18 2
      src/views/intelligence/index.vue

+ 18 - 2
src/views/intelligence/index.vue

@@ -405,7 +405,7 @@
             <div class="tip">{{ tips }}</div>
             <div
               style="position: absolute; width: 100%; height: 80px; z-index: 999999"
-              @touchstart="startRecord"
+              @touchstart="touchstart"
               @touchend="stopRecord"></div>
             <van-icon :name="yt" size="40" style="top: 20px; left: 50%; margin-left: -20px" />
           </div>
@@ -490,7 +490,14 @@ export default {
     this.Ggreet = [];
     this.onLoad();
     // 授权
-    getTicketFun(['getLocation', 'startRecord', 'stopRecord', 'onVoiceRecordEnd', 'uploadVoice']);
+    getTicketFun([
+      'getLocation',
+      'startRecord',
+      'stopRecord',
+      'onVoiceRecordEnd',
+      'uploadVoice',
+      'vibrateShort',
+    ]);
   },
   methods: {
     // 保存上一个播放audio
@@ -637,6 +644,15 @@ export default {
         }
       });
     },
+    touchstart() {
+      // 按下录音震动效果
+      this.wx.vibrateShort({
+        type: 'heavy',
+        complete: () => {
+          this.startRecord();
+        },
+      });
+    },
     startRecord() {
       this.tips = '松开 发送';
       this.wx.startRecord();