Browse Source

Merge branch 'develop' of http://121.43.162.141:13000/aio/webview into develop

kumu 5 months ago
parent
commit
8eb427ca69
2 changed files with 5 additions and 7 deletions
  1. 3 5
      src/pages/screen.page.vue
  2. 2 2
      src/request/api/account.api.ts

+ 3 - 5
src/pages/screen.page.vue

@@ -27,11 +27,9 @@ const { data: copyright, send: load } = useRequest(copyrightMethod).onError(asyn
 });
 const { send: handle, loading } = useRequest(processMethod, { immediate: false })
   .onSuccess(({ data }) => {
+    Visitor.$reset();
     router.push({ path: data, replace: true }).then(
-      () => {
-        Visitor.$reset();
-        if (visitor.value) Visitor.patientId = visitor.value;
-      },
+      () => { if (visitor.value) Visitor.patientId = visitor.value; },
       () => {}
     );
   })
@@ -180,7 +178,7 @@ function init({ width, height, container }: { width: number; height: number; con
 }
 
 onBeforeRouteLeave((to, from) => {
-  if (to.path === '/register') return true;
+  if (to.path === '/register' || Visitor.patientId) return true;
   return register().then((data) => !!data, () => false);
 });
 </script>

+ 2 - 2
src/request/api/account.api.ts

@@ -55,8 +55,8 @@ export function scanAccountMethod(key: string) {
     hitSource: 'register',
     params: { scanCode: key },
     transform(data: Record<string, any>, headers) {
-      const { patientId, processModule, ..._data } = data;
-      if ( patientId ) useVisitor().patientId = data.patientId;
+      const { id: patientId, processModule, ..._data } = data;
+      if ( patientId ) useVisitor().patientId = patientId;
       return {
         key, patientId, path: getPath(processModule),
         model: Object.fromEntries(Object.entries(_data).filter(([ item, value ]) => !!value)) as Partial<RegisterModel>,