97 lines
2.8 KiB
Vue
97 lines
2.8 KiB
Vue
<template>
|
||
<view class="documents-page">
|
||
<ModulePageBackground module="records" />
|
||
<view class="page-layer">
|
||
<PageHeader title="重要证件" custom-back @back="requestBack" />
|
||
</view>
|
||
<view class="documents-content page-layer">
|
||
<view v-if="!valid" class="documents-card">
|
||
<text>暂时无法打开重要证件</text>
|
||
<text>未找到家谱信息,请返回后重新进入。</text>
|
||
</view>
|
||
<view v-else class="documents-card">
|
||
<text>家谱证件档案</text>
|
||
<text>集中查看当前家谱中有权访问的重要证件;新增证件仍从对应人物资料进入。</text>
|
||
<AppButton block label="查看全部证件" :disabled="documentBusy" @click="openDocuments" />
|
||
</view>
|
||
</view>
|
||
<PersonDocumentDialog
|
||
ref="documentDialog"
|
||
:genealogy-id="genealogyId"
|
||
@busy-change="documentBusy = $event"
|
||
@transient-change="documentTransientOpen = $event"
|
||
/>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { computed, ref } from "vue";
|
||
import { onBackPress, onLoad, onReady } from "@dcloudio/uni-app";
|
||
import AppButton from "@/components/AppButton.vue";
|
||
import ModulePageBackground from "@/components/ModulePageBackground.vue";
|
||
import PageHeader from "@/components/PageHeader.vue";
|
||
import PersonDocumentDialog from "@/components/tree/PersonDocumentDialog.vue";
|
||
import { goBack, handleBackPress } from "@/utils/navigation/gateway.js";
|
||
|
||
const genealogyId = ref("");
|
||
const documentDialog = ref(null);
|
||
const documentBusy = ref(false);
|
||
const documentTransientOpen = ref(false);
|
||
const valid = computed(() => /^[1-9]\d*$/.test(genealogyId.value));
|
||
|
||
const openDocuments = () => {
|
||
if (!valid.value || documentBusy.value) return;
|
||
documentDialog.value?.open();
|
||
};
|
||
const requestBack = () => {
|
||
if (documentTransientOpen.value) return documentDialog.value?.closeTransient() ?? true;
|
||
return goBack();
|
||
};
|
||
|
||
onLoad((query) => {
|
||
genealogyId.value = String(query?.genealogyId || "");
|
||
});
|
||
onReady(() => {
|
||
if (valid.value) openDocuments();
|
||
});
|
||
onBackPress((event) => handleBackPress(event, requestBack));
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
@import "../../styles/adaptive-frame-profiles.scss";
|
||
.documents-page {
|
||
display: flex;
|
||
min-height: 100vh;
|
||
flex-direction: column;
|
||
background: $paper;
|
||
}
|
||
.page-layer {
|
||
z-index: 1;
|
||
}
|
||
.documents-content {
|
||
flex: 1;
|
||
padding: 24rpx 28rpx calc(72rpx + env(safe-area-inset-bottom));
|
||
}
|
||
.documents-card {
|
||
@include adaptive-records-content;
|
||
padding: 48rpx 36rpx;
|
||
text-align: center;
|
||
}
|
||
.documents-card text {
|
||
display: block;
|
||
color: $ink-muted;
|
||
font-size: clamp(14px, 23rpx, 17px);
|
||
line-height: 1.65;
|
||
}
|
||
.documents-card text:first-child {
|
||
color: $ink;
|
||
font-family: STKaiti, KaiTi, serif;
|
||
font-size: clamp(19px, 34rpx, 24px);
|
||
font-weight: 700;
|
||
}
|
||
.documents-card text + text,
|
||
.documents-card .app-button {
|
||
margin-top: 20rpx;
|
||
}
|
||
</style>
|