|
|
@@ -1,40 +1,17 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { Dialog, Notify } from '@/platform';
|
|
|
+import { getApplicationMethod } from '@/request/api';
|
|
|
|
|
|
-import { copyrightMethod, registerVisitorMethod } from '@/request/api';
|
|
|
-import { useRouteNext, getRoutePath } from '@/computable/useRouteNext';
|
|
|
-
|
|
|
-import { useVisitor } from '@/stores';
|
|
|
import getBubbles from '@/tools/bubble';
|
|
|
import { useElementSize } from '@vueuse/core';
|
|
|
import { useRequest } from 'alova/client';
|
|
|
import p5 from 'p5';
|
|
|
|
|
|
+import Start from '@/components/Start.vue';
|
|
|
|
|
|
-const router = useRouter();
|
|
|
-const Visitor = useVisitor();
|
|
|
-
|
|
|
-const title = import.meta.env.SIX_APP_TITLE;
|
|
|
-const { data: visitor, loading: registering, send: register } = useRequest(registerVisitorMethod, { immediate: false, });
|
|
|
-const { data: copyright, send: load } = useRequest(copyrightMethod).onError(async ({ error }) => {
|
|
|
- await Dialog.show({
|
|
|
- message: error.message,
|
|
|
- theme: 'round-button',
|
|
|
- showCancelButton: false,
|
|
|
- confirmButtonText: '刷新',
|
|
|
- width: '350px',
|
|
|
- });
|
|
|
- await load();
|
|
|
-});
|
|
|
-
|
|
|
-const { handle, loading } = useRouteNext({
|
|
|
- async onSuccess(flow) {
|
|
|
- Visitor.$reset();
|
|
|
- await router.push({ path: getRoutePath(flow.next), replace: true })
|
|
|
- if (visitor.value) Visitor.patientId = visitor.value;
|
|
|
- },
|
|
|
- onError(error) { Notify.warning(error.message); },
|
|
|
-});
|
|
|
+const { data } = useRequest(getApplicationMethod, { initialData: { image: { el: '', copyright: '' } } });
|
|
|
+const title = computed(() => data.value.image.title || import.meta.env.SIX_APP_TITLE);
|
|
|
+const copyright = computed(() => data.value.copyright);
|
|
|
+const button = computed(() => data.value.image.el.split('|').includes('btn'));
|
|
|
|
|
|
const container = useTemplateRef<HTMLDivElement>('container');
|
|
|
const { width, height } = useElementSize(container);
|
|
|
@@ -174,11 +151,6 @@ function init({ width, height, container }: { width: number; height: number; con
|
|
|
};
|
|
|
}, container);
|
|
|
}
|
|
|
-
|
|
|
-onBeforeRouteLeave((to, from) => {
|
|
|
- if (to.path === '/register' || Visitor.patientId) return true;
|
|
|
- return register().then((data) => !!data, () => false);
|
|
|
-});
|
|
|
</script>
|
|
|
<template>
|
|
|
<div class="wrapper">
|
|
|
@@ -189,13 +161,7 @@ onBeforeRouteLeave((to, from) => {
|
|
|
</div>
|
|
|
<div class="flex-auto flex flex-col">
|
|
|
<div class="flex-auto flex justify-center items-center">
|
|
|
- <!--<van-button class="decorate" :loading="loading || registering" @click="handle()">开始检测</van-button>-->
|
|
|
- <div class="van-button decorate" @click="!(loading || registering) && handle()">
|
|
|
- <div class="van-button__content">
|
|
|
- <van-loading v-if="loading || registering" />
|
|
|
- <span v-else class="van-button__text">开始检测</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <Start v-if="button" />
|
|
|
</div>
|
|
|
<div class="flex-none text-xl p-8 text-center" v-html="copyright"></div>
|
|
|
</div>
|