|
|
@@ -13,6 +13,9 @@ import { useRouteParams } from '@vueuse/router';
|
|
|
import { useRequest, useWatcher } from 'alova/client';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
|
|
+import MiniProgram from '@/components/MiniProgram.vue';
|
|
|
+const miniProgramRef = useTemplateRef<InstanceType<typeof MiniProgram>>('mini-program');
|
|
|
+
|
|
|
const hidePulseExceptionTemplate = computed(() => platformIsAIO())
|
|
|
|
|
|
const id = useRouteParams<string>('id');
|
|
|
@@ -25,7 +28,9 @@ const { data, loading } = useWatcher(() => getReportMethod(id.value), [ id ], {
|
|
|
},
|
|
|
immediate: true,
|
|
|
}).onSuccess(({ data }) => {
|
|
|
- if ( data?.miniProgramURL && data.payLock ) panelOpen(100);
|
|
|
+ if ( data?.miniProgramURL && data.payLock ) {
|
|
|
+ nextTick(() => miniProgramRef.value?.open());
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
const { loading: uploading, send: upload } = useRequest(() => updateReportMethod(id.value, data.value), {
|
|
|
@@ -72,36 +77,12 @@ async function print() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-async function miniProgram() {
|
|
|
- let url = data.value.miniProgramURL;
|
|
|
- if ( !url ) {
|
|
|
- Notify.warning(`未获取到小程序地址,请联系管理员或重试`);
|
|
|
- return;
|
|
|
- }
|
|
|
- panelOpen();
|
|
|
-}
|
|
|
-
|
|
|
const router = useRouter();
|
|
|
|
|
|
function toggle() {
|
|
|
const path = `${ router.currentRoute.value.fullPath }/scheme`.replace(/\/{2,}/g, '/');
|
|
|
router.replace({ path });
|
|
|
}
|
|
|
-
|
|
|
-const panelHeight = ref(0);
|
|
|
-const panelProps = reactive({
|
|
|
- anchors: [0, window.innerWidth],
|
|
|
- contentDraggable: false,
|
|
|
- lockScroll: true,
|
|
|
-});
|
|
|
-const panelOpen = (min?: number) => {
|
|
|
- if ( min ) panelProps.anchors[ 0 ] = min;
|
|
|
- panelHeight.value = panelProps.anchors[1];
|
|
|
-};
|
|
|
-
|
|
|
-const scrollable = computed(() => !data.value.payLock &&
|
|
|
- panelHeight.value < panelProps.anchors[ 1 ] || panelHeight.value === 0,
|
|
|
-);
|
|
|
</script>
|
|
|
<template>
|
|
|
<div class="report-wrapper">
|
|
|
@@ -120,7 +101,7 @@ const scrollable = computed(() => !data.value.payLock &&
|
|
|
</div>
|
|
|
<div class="page-content flex flex-col overflow-hidden">
|
|
|
<van-skeleton class="flex-auto" title :row="3" :loading>
|
|
|
- <div class="flex-auto" :class="{ 'overflow-y-auto': scrollable }">
|
|
|
+ <div class="flex-auto overflow-y-auto">
|
|
|
<div class="my-6 text-primary text-2xl text-center">报告日期:{{ data.date }}</div>
|
|
|
<div class="card m-6 text-lg">
|
|
|
<div class="card__title text-primary text-3xl font-bold"></div>
|
|
|
@@ -219,10 +200,7 @@ const scrollable = computed(() => !data.value.payLock &&
|
|
|
<img :src="NavScheme" alt="调理方案">
|
|
|
<div class="mt-2">调理方案</div>
|
|
|
</div>
|
|
|
- <div class="m-auto min-w-16 text-center hover:text-primary" v-if="data.miniProgramURL" @click="miniProgram()">
|
|
|
- <img :src="NavMiniProgram" alt="小程序">
|
|
|
- <div class="mt-2">小程序</div>
|
|
|
- </div>
|
|
|
+ <mini-program ref="mini-program" :url="data.miniProgramURL" :closeable="!data.payLock"></mini-program>
|
|
|
<div class="m-auto min-w-16 text-center hover:text-primary" @click="print()">
|
|
|
<van-loading v-if="uploading" color="#38ff6e" style="font-size: 24px;" />
|
|
|
<img v-else :src="NavPrint" alt="打印">
|
|
|
@@ -230,31 +208,6 @@ const scrollable = computed(() => !data.value.payLock &&
|
|
|
</div>
|
|
|
</div>
|
|
|
<Component :is="ReportPreview" v-bind="reportPreviewProps" v-model:show="reportPreviewProps.show"></Component>
|
|
|
- <van-floating-panel v-model:height="panelHeight" v-bind="panelProps">
|
|
|
- <template #header>
|
|
|
- <div class="van-floating-panel__header !justify-between">
|
|
|
- <div></div>
|
|
|
- <div class="van-floating-panel__header-bar"></div>
|
|
|
- <div>
|
|
|
- <van-icon v-if="!data.payLock" name="cross" @click.stop="panelHeight = panelProps.anchors[0];" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <Transition>
|
|
|
- <div class="panel-content">
|
|
|
- <img
|
|
|
- class="size-full object-contain"
|
|
|
- v-if="panelHeight === panelProps.anchors[1] || panelHeight > panelProps.anchors[0] * 1.5"
|
|
|
- :src="data.miniProgramURL"
|
|
|
- alt="小程序码"
|
|
|
- />
|
|
|
- <div class="flex justify-center items-center" v-else @click="panelOpen()">
|
|
|
- <img class="h-10 w-10" src="@/assets/images/mini-program.svg" alt="小程序" />
|
|
|
- <span class="text-lg ml-2">小程序</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </Transition>
|
|
|
- </van-floating-panel>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -299,7 +252,7 @@ const scrollable = computed(() => !data.value.payLock &&
|
|
|
}
|
|
|
|
|
|
.nav-wrapper {
|
|
|
- img {
|
|
|
+ .nav-img {
|
|
|
margin: auto;
|
|
|
width: 36px;
|
|
|
height: 36px;
|