فهرست منبع

解决程序异常导致的页面卡顿

六智科技 7 ماه پیش
والد
کامیت
ab6788d4c5
3فایلهای تغییر یافته به همراه5 افزوده شده و 9 حذف شده
  1. 1 4
      src/modules/camera/camera.page.vue
  2. 1 1
      src/pages/screen.page.vue
  3. 3 4
      src/request/api/questionnaire.api.ts

+ 1 - 4
src/modules/camera/camera.page.vue

@@ -51,14 +51,13 @@ watch([ step, snapshot ], ([ step, snapshot ], old, onCleanup) => {
 
 const cameraRef = useTemplateRef<InstanceType<typeof Camera>>('camera');
 
-const { loading: uploading, send: update, abort: stop } = useRequest((file: File) => uploadFileMethod(file), {
+const { loading: uploading, send: update } = useRequest((file: File) => uploadFileMethod(file), {
   immediate: false,
 });
 
 const handle = () => {
   if ( submitting.value ) return;
   snapshot.value = cameraRef.value?.handle();
-  stop();
 };
 const next = async () => {
   if ( uploading.value || submitting.value ) return;
@@ -98,8 +97,6 @@ tryOnMounted(() => {
 tryOnUnmounted(() => {
   audio?.pause();
   audio = void 0;
-
-  stop();
 });
 </script>
 <template>

+ 1 - 1
src/pages/screen.page.vue

@@ -15,7 +15,7 @@ const { data: copyright } = useRequest(copyrightMethod);
 const { send: handle, loading } = useRequest(processMethod, { immediate: false }).onSuccess(({ data }) => {
   if ( data ) {
     Visitor.$reset();
-    router.push(data);
+    router.push(data).then();
   } else {
     Notify.warning(`[路由] 配置异常无法解析正确路径,请联系管理员`);
   }

+ 3 - 4
src/request/api/questionnaire.api.ts

@@ -9,14 +9,13 @@ let storage: Pick<QuestionnaireStorage, 'dialogId'> & { questions: Questionnaire
 
 export function questionnaireMethod(data = []) {
   if ( !data?.length ) { storage = { questions: [] }; }
-  const step = storage.questions.length;
   return HTTP.Post(
     `/fdhb-tablet/dialogueManage/dialog/${ visitor.patientId }/${ visitor.resultId }`,
-    { step, ...toQuestionnaireData(data, { dialogId: storage.dialogId, questions: storage.questions[ step - 1 ] }) },
+    toQuestionnaireData(data, storage),
     {
       transform(data: Record<string, any>, headers) {
-        const { storage: { dialogId, questions }, model } = fromQuestionnaireData(data);
-        storage = { dialogId, questions: questions.length ? [ ...storage.questions, questions ] : [] };
+        const { storage: _storage, model } = fromQuestionnaireData(data);
+        storage = _storage;
         return model;
       },
     },