Browse Source

更多的错误校验,更多的优化提示

zhuf 1 year ago
parent
commit
6aa5920f01
3 changed files with 61 additions and 52 deletions
  1. 7 5
      src/main.ts
  2. 44 43
      src/pages/caiji/sy/name.vue
  3. 10 4
      src/pages/caiji/sy/record/[id].vue

+ 7 - 5
src/main.ts

@@ -10,13 +10,15 @@ import 'vant/es/dialog/style';
 import 'vant/es/notify/style';
 import 'vant/es/image-preview/style';
 
-import { urlParams } from '~/utils/utils'
+// import { urlParams } from '~/utils/utils'
 
 import VConsole from 'vconsole'
-const search = new URLSearchParams(location.search)
-if (search.get('debug') || urlParams?.debug) {
-  new VConsole()
-}
+new VConsole()
+
+// const search = new URLSearchParams(location.search)
+// if (search.get('debug') || urlParams?.debug) {
+//   new VConsole()
+// }
 
 const app = createApp(App)
 

+ 44 - 43
src/pages/caiji/sy/name.vue

@@ -24,49 +24,50 @@ function onSubmit(values: any) {
         axa_is_system: 2
       }
     }
-  }).then(res => {
-    if(res.data.code === '1') {
-    const info = res.data.one_info
-    console.log('info : ', info)
-    // {
-    //   "axa_id": "58",
-    //   "axa_sycj_json_v2": "",
-    //   "axa_sycj_syxb_v2": "male",
-    //   "axa_sycj_sywj_v2": "bbe539bb8ad24e4ea14e36e16922c9cf",
-    //   "axa_sycj_zdysyid_v2": "szbzaimooc170348221150",
-    //   "axa_sycj_shzt_v2": "3",
-    //   "axa_sycj_scbz_v2": "0",
-    //   "axa_keyword": "",
-    //   "axa_name": "朱凡1",
-    //   "axa_img": "",
-    //   "axa_file": "",
-    //   "axa_code": "",
-    //   "axa_yyfw": "",
-    //   "axa_bzms": "",
-    //   "axa_mssc": "朱凡测试1",
-    //   "axa_status": "2",
-    //   "axa_ext": null,
-    //   "axa_scenario_v2": "",
-    //   "axa_is_system": "2",
-    //   "area_id1": "10",
-    //   "area_id2": "166",
-    //   "area_id3": "2069",
-    //   "area_id4": "0",
-    //   "sm_id": "3",
-    //   "dept_id": "0",
-    //   "user_id": "0",
-    //   "create_user_id": "199200",
-    //   "modify_user_id": "0",
-    //   "create_dateline": "1703482211",
-    //   "modify_dateline": "0",
-    //   "isdelete": "0",
-    //   "create_dateline_format": "2023-12-25 13:30:11"
-    // }
-    router.replace({ name: "caiji-sy-record-id", params: { id: info.axa_sycj_zdysyid_v2 } })
-  }else{
-    console.log('res.data.msg : ', res.data.msg)
-    showFailToast(res.data.msg)
-  }
+  }).then((res: any) => {
+    console.log('onSubmit res : ', res)
+    if (res.code === '1') {
+      const info = res.data.one_info
+      console.log('info : ', info)
+      // {
+      //   "axa_id": "58",
+      //   "axa_sycj_json_v2": "",
+      //   "axa_sycj_syxb_v2": "male",
+      //   "axa_sycj_sywj_v2": "bbe539bb8ad24e4ea14e36e16922c9cf",
+      //   "axa_sycj_zdysyid_v2": "szbzaimooc170348221150",
+      //   "axa_sycj_shzt_v2": "3",
+      //   "axa_sycj_scbz_v2": "0",
+      //   "axa_keyword": "",
+      //   "axa_name": "朱凡1",
+      //   "axa_img": "",
+      //   "axa_file": "",
+      //   "axa_code": "",
+      //   "axa_yyfw": "",
+      //   "axa_bzms": "",
+      //   "axa_mssc": "朱凡测试1",
+      //   "axa_status": "2",
+      //   "axa_ext": null,
+      //   "axa_scenario_v2": "",
+      //   "axa_is_system": "2",
+      //   "area_id1": "10",
+      //   "area_id2": "166",
+      //   "area_id3": "2069",
+      //   "area_id4": "0",
+      //   "sm_id": "3",
+      //   "dept_id": "0",
+      //   "user_id": "0",
+      //   "create_user_id": "199200",
+      //   "modify_user_id": "0",
+      //   "create_dateline": "1703482211",
+      //   "modify_dateline": "0",
+      //   "isdelete": "0",
+      //   "create_dateline_format": "2023-12-25 13:30:11"
+      // }
+      router.replace({ name: "caiji-sy-record-id", params: { id: info.axa_sycj_zdysyid_v2 } })
+    } else {
+      console.log('res.msg : ', res.msg)
+      showFailToast(res.msg)
+    }
   })
 };
 

+ 10 - 4
src/pages/caiji/sy/record/[id].vue

@@ -41,11 +41,17 @@ request({
   }
 }).then(res => {
   console.log('完整信息 : ', res.data)
+  if (props.id !== res.data?.pre_data?.axa_sycj_zdysyid_v2) {
+    showFailToast('任务ID不匹配');
+    setTimeout(() => {
+      router.replace({ name: 'caiji-sy-name' })
+    }, 1000);
+  }
 
   list.value = Object.values(res.data.data).sort((a: any, b: any) => a.audioId - b.audioId)
   console.log('文本列表 : ', list.value)
   let _current = res.data.pre_data?.axa_sycj_scbz_v2 ? parseInt(res.data.pre_data?.axa_sycj_scbz_v2) : 0
-  console.log('已读到 : ', current.value)
+  console.log('上次已读到 : ', _current + 1)
   if (_current === list.value.length) {
     // showSuccessToast('已完成全部录音')
     showDialog({
@@ -252,9 +258,9 @@ function submitAudio() {
         ],
       })
         .then((res: any) => {
-          // console.log(res.data?.url?.url)
+          console.log('声音采集识别结果 : ', res)
           if (res?.code === '1') {
-            console.log('current : ', current.value)
+            console.log('声音采集识别成功 当前读到: ', current.value + 1)
             if (current.value === list.value.length - 1) {
               handleSubmitTask()
             } else {
@@ -263,7 +269,7 @@ function submitAudio() {
               current.value++
             }
           } else {
-            console.info('声音采集识别失败', res)
+            console.info('声音采集识别失败')
             showFailToast(res?.msg ? res?.msg : '网络错误,请重新录制')
           }
           resolve(res?.data)