113 lines
3.4 KiB
Vue
113 lines
3.4 KiB
Vue
<!-- 页面编号:R-09;用途:校验人物身份并明确关闭缺失的线上服务。 -->
|
||
<template>
|
||
<view class="service-page" :class="`service-state--${serviceState}`">
|
||
<ModulePageBackground module="records" />
|
||
<view class="page-header">
|
||
<PageHeader title="人生事" custom-back @back="requestBack" />
|
||
</view>
|
||
<view v-if="serviceState === 'loading'" class="page-loading">
|
||
<AppLoading
|
||
text="正在核对人物身份"
|
||
description="请稍候,页面正在确认当前家谱与人物。"
|
||
/>
|
||
</view>
|
||
<view v-else class="page-content">
|
||
<view class="state-card">
|
||
<text>{{ stateCopy.title }}</text>
|
||
<text v-if="personRecord && serviceState === 'unavailable'" class="person-name">
|
||
当前人物:{{ personRecord.name }}
|
||
</text>
|
||
<text>{{ stateCopy.copy }}</text>
|
||
<AppButton type="secondary" block label="返回上一页" @click="requestBack" />
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
<script setup>
|
||
import { computed, ref } from "vue";
|
||
import { onBackPress, onLoad } from "@dcloudio/uni-app";
|
||
import AppButton from "@/components/AppButton.vue";
|
||
import AppLoading from "@/components/AppLoading.vue";
|
||
import ModulePageBackground from "@/components/ModulePageBackground.vue";
|
||
import PageHeader from "@/components/PageHeader.vue";
|
||
import {
|
||
findTreeMemberPresentationFixture,
|
||
getGenealogyFixtureAccess,
|
||
} from "@/data/mock.js";
|
||
import { goBack, handleBackPress } from "@/utils/navigation.js";
|
||
|
||
const serviceState = ref("loading");
|
||
const personRecord = ref(null);
|
||
const stateCopy = computed(() =>
|
||
serviceState.value === "unavailable"
|
||
? {
|
||
title: "人生事件接口尚未开放",
|
||
copy: "线上接口文档没有独立的人生事件资源。为避免把其他记录类型冒充人生事,本页暂不展示或提交数据。",
|
||
}
|
||
: {
|
||
title: "人生事入口无效",
|
||
copy: "人物不存在、缺少身份或不属于当前家谱,页面不会回退到其他人物。",
|
||
},
|
||
);
|
||
onLoad((query) => {
|
||
const genealogyId = String(query.genealogyId || "");
|
||
const personId = String(query.personId || "");
|
||
if (query.state === "loading") return;
|
||
const access = getGenealogyFixtureAccess(genealogyId);
|
||
personRecord.value = findTreeMemberPresentationFixture(genealogyId, personId);
|
||
serviceState.value =
|
||
["owner", "member"].includes(access.accessRole) && personRecord.value
|
||
? "unavailable"
|
||
: "invalid";
|
||
});
|
||
const requestBack = () => goBack();
|
||
onBackPress((event) => handleBackPress(event, requestBack));
|
||
</script>
|
||
<style scoped lang="scss">
|
||
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
|
||
|
||
.service-page {
|
||
display: flex;
|
||
min-height: 100vh;
|
||
flex-direction: column;
|
||
background: $paper;
|
||
}
|
||
.page-header,
|
||
.page-loading,
|
||
.page-content {
|
||
z-index: 1;
|
||
}
|
||
.page-loading {
|
||
min-height: calc(100vh - 100rpx);
|
||
}
|
||
.page-content {
|
||
padding: 18rpx 24rpx 72rpx;
|
||
}
|
||
.state-card {
|
||
box-sizing: border-box;
|
||
min-height: 380rpx;
|
||
padding: 78rpx 52rpx 50rpx;
|
||
@include adaptive.adaptive-records-content;
|
||
text-align: center;
|
||
}
|
||
.state-card > text { display: block; }
|
||
.state-card > text:first-child {
|
||
color: $ink;
|
||
font-size: 35rpx;
|
||
font-weight: 700;
|
||
}
|
||
.state-card > text:last-of-type {
|
||
margin-top: 18rpx;
|
||
color: $ink-muted;
|
||
font-size: 24rpx;
|
||
line-height: 1.65;
|
||
}
|
||
.person-name {
|
||
color: $brand-red;
|
||
font-weight: 700;
|
||
}
|
||
.state-card .app-button {
|
||
margin-top: 28rpx;
|
||
}
|
||
</style>
|