浏览代码

Merge branch 'feature-patch' into gym-test

TIANYONG 1 周之前
父节点
当前提交
2db2b533f1
共有 2 个文件被更改,包括 12 次插入2 次删除
  1. 6 1
      src/helpers/communication.ts
  2. 6 1
      src/view/evaluating/index.tsx

+ 6 - 1
src/helpers/communication.ts

@@ -557,4 +557,9 @@ export const simple_musicPage = (content: any) => {
 /** 监听重新评测消息 */
 export const api_retryEvaluating = (callback: any) => {
 	listenerMessage("retryEvaluating", callback);
-}
+}
+
+/** 通知app上传评测音频 */
+export const api_recordAudioUpload = (): Promise<IPostMessage | undefined> => {
+	return promisefiyPostMessage({ api: "recordAudioUpload" });
+};

+ 6 - 1
src/view/evaluating/index.tsx

@@ -36,6 +36,7 @@ import {
   api_closeDelayCheck,
   api_openCamera,
   api_closeCamera,
+  api_recordAudioUpload
 } from "/src/helpers/communication";
 import state, { IPlayState, clearSelection, handleStopPlay, onPlay, resetPlaybackToStart, togglePlay, initSetPlayRate, resetBaseRate, scrollViewNote } from "/src/state";
 import { IPostMessage } from "/src/utils/native-message";
@@ -313,7 +314,7 @@ export const addMeasureScore = (measureScore: any, show = true) => {
   // console.log("🚀 ~ measureScore:", evaluatingData.evaluatings)
 };
 
-const handleScoreResult = (res?: IPostMessage) => {
+const handleScoreResult = async (res?: IPostMessage) => {
   console.log("返回", res, evaluatingData.oneselfCancleEvaluating);
   // 如果是手动取消评测,不生成评测记录
   // if (evaluatingData.oneselfCancleEvaluating) {
@@ -334,6 +335,10 @@ const handleScoreResult = (res?: IPostMessage) => {
     if (header?.commond === "overall") {
       console.log("🚀 ~ 评测返回:", res);
       console.log("评测结束", body);
+      // 如果评测结果没有返回音频,需要调用api通知APP端上传音频
+      if (!body.url) {
+        await api_recordAudioUpload()
+      }
       state.isHideEvaluatReportSaveBtn = false;
       setTimeout(() => {
         // 评测作业,如果不是完整评测,不展示评测弹窗