完成50%

This commit is contained in:
2026-07-23 08:23:59 +08:00
parent 9b0ad62df4
commit f1edc6b533
218 changed files with 24318 additions and 5514 deletions
+35 -2
View File
@@ -12,7 +12,8 @@
:aria-label="title"
tabindex="-1"
@click.stop
@keydown.esc.stop="cancel"
@keydown.esc.stop.prevent="cancel"
@keydown.tab="trapFocus"
>
<scroll-view class="app-dialog__content" scroll-y>
<view class="app-dialog__copy">
@@ -62,6 +63,38 @@ const emit = defineEmits(["confirm", "cancel", "close"]);
const dialogRef = ref(null);
let previousFocus = null;
const getDialogElement = () => {
const target = dialogRef.value;
if (target && typeof target.querySelectorAll === "function") return target;
if (target?.$el && typeof target.$el.querySelectorAll === "function") return target.$el;
return null;
};
const trapFocus = (event) => {
if (typeof document === "undefined") return;
const dialog = getDialogElement() || event.currentTarget;
if (!dialog || typeof dialog.querySelectorAll !== "function") return;
const focusable = Array.from(
dialog.querySelectorAll(
'button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',
),
).filter((element) => element.offsetParent !== null);
if (focusable.length === 0) {
event.preventDefault();
dialog.focus?.();
return;
}
const first = focusable[0];
const last = focusable[focusable.length - 1];
if (event.shiftKey && (document.activeElement === first || document.activeElement === dialog)) {
event.preventDefault();
last.focus();
} else if (!event.shiftKey && document.activeElement === last) {
event.preventDefault();
first.focus();
}
};
watch(
() => props.visible,
async (visible) => {
@@ -69,7 +102,7 @@ watch(
if (visible) {
previousFocus = document.activeElement;
await nextTick();
dialogRef.value?.focus?.();
getDialogElement()?.focus?.();
return;
}
previousFocus?.focus?.();
+20 -8
View File
@@ -1,7 +1,7 @@
<!-- 公共组件根页面底部导航仅维护家谱家族我的三项已确认入口及其透明图标 -->
<template>
<view class="app-tabbar" role="tablist" aria-label="主要导航">
<view
<button
v-for="item in items"
:key="item.key"
class="tab-item"
@@ -9,28 +9,31 @@
:aria-selected="active === item.key"
:aria-label="`${item.label}${active === item.key ? '当前页面' : ''}`"
hover-class="tab-item--pressed"
@click="switchTab(item)"
@click="switchRoot(item)"
>
<image
class="tab-icon"
:src="active === item.key ? item.activeIcon : item.icon"
mode="aspectFit"
aria-hidden="true"
/>
<text :class="['tab-label', { active: active === item.key }]">{{
item.label
}}</text>
</view>
</button>
</view>
</template>
<script setup>
import { goRoot } from "@/utils/navigation.js";
const props = defineProps({ active: { type: String, required: true } });
const items = [
{
key: "genealogy",
label: "家谱",
path: "/pages/genealogy/g01-my-genealogies",
routeKey: "G01",
icon: "/static/assets/foundation/transparent/tab-genealogy.png",
activeIcon:
"/static/assets/foundation/transparent/tab-genealogy-active.png",
@@ -38,21 +41,22 @@ const items = [
{
key: "family",
label: "家族",
path: "/pages/family/f01-family-feed",
routeKey: "F01",
icon: "/static/assets/foundation/transparent/tab-family.png",
activeIcon: "/static/assets/foundation/transparent/tab-family-active.png",
},
{
key: "profile",
label: "我的",
path: "/pages/profile/m01-profile-home",
routeKey: "M01",
icon: "/static/assets/foundation/transparent/tab-profile.png",
activeIcon: "/static/assets/foundation/transparent/tab-profile-active.png",
},
];
const switchTab = (item) => {
if (item.key !== props.active) uni.reLaunch({ url: item.path });
const switchRoot = (item) => {
if (item.key === props.active) return;
return goRoot(item.routeKey);
};
</script>
@@ -78,8 +82,16 @@ const switchTab = (item) => {
flex-direction: column;
align-items: center;
justify-content: center;
margin: 0;
padding: 4rpx 0;
box-sizing: border-box;
border: 0;
border-radius: 0;
background: transparent;
line-height: normal;
}
.tab-item::after {
border: 0;
}
.tab-item--pressed {
opacity: 0.72;
-516
View File
@@ -1,516 +0,0 @@
<!-- 公共组件F/R/N/M 普通任务页母版业务结构按类型区分视觉继承各模块基准页 -->
<template>
<view
class="module-page"
:style="moduleAssetStyle"
:class="[
`module-page--${moduleKey}`,
`module-page--${page.template}`,
`module-state--${moduleState}`,
]"
>
<ModulePageBackground :module="moduleKey" />
<view class="module-page__header"><PageHeader :title="page.title" /></view>
<view v-if="moduleState === 'loading'" class="module-page__loading">
<AppLoading
:text="`正在整理${page.title}`"
description="请稍候,内容正在归卷。"
/>
</view>
<view v-else-if="moduleState === 'ready'" class="module-page__content">
<view class="module-lead">
<text>{{ page.subtitle }}</text>
</view>
<view v-if="page.template === 'form'" class="module-panel module-form">
<text class="section-eyebrow">填写信息</text>
<view v-for="field in page.fields" :key="field" class="form-row">
<text>{{ field }}</text>
<input
:placeholder="`请输入${field}`"
placeholder-class="form-placeholder"
/>
</view>
<text v-if="page.note" class="form-note">{{ normalizedNote }}</text>
<AppButton block :label="page.action" @click="completeAction" />
</view>
<view v-else-if="page.template === 'list'" class="content-stack">
<view
v-for="item in page.sections"
:key="item[0]"
class="list-card"
@click="openPreview(item)"
>
<view class="list-card__copy">
<text>{{ item[0] }}</text>
<text>{{ item[1] }}</text>
<text>查看详情</text>
</view>
</view>
<AppButton block :label="page.action" @click="completeAction" />
</view>
<view
v-else-if="page.template === 'detail'"
class="module-panel module-detail"
>
<text class="section-eyebrow">档案详情</text>
<view v-for="item in page.sections" :key="item[0]" class="detail-card">
<view
><text>{{ item[0] }}</text
><text>{{ item[1] }}</text></view
>
</view>
<AppButton block :label="page.action" @click="completeAction" />
</view>
<view
v-else-if="page.template === 'timeline'"
class="content-stack timeline-stack"
>
<view
v-for="(item, index) in page.sections"
:key="item[0]"
class="timeline-row"
>
<view
><text> {{ index + 1 }} </text><text>{{ item[0] }}</text
><text>{{ item[1] }}</text></view
>
</view>
<AppButton block :label="page.action" @click="completeAction" />
</view>
<view
v-else-if="page.template === 'settings'"
class="module-panel module-settings"
>
<text class="section-eyebrow">服务与设置</text>
<view
v-for="item in page.sections"
:key="item[0]"
class="settings-row"
@click="openPreview(item)"
>
<view
><text>{{ item[0] }}</text
><text>{{ normalizedSectionCopy(item[1]) }}</text></view
>
<text>查看</text>
</view>
<AppButton block :label="page.action" @click="completeAction" />
</view>
<view v-else class="module-panel status-card">
<view class="status-card__body">
<text class="status-card__eyebrow">{{ page.badge }} · 服务说明</text>
<text class="status-card__lead">{{ page.lead }}</text>
<text class="status-card__note">{{ normalizedNote }}</text>
<AppButton block :label="page.action" @click="completeAction" />
</view>
</view>
</view>
<view v-else class="module-page__content module-page__content--state">
<view class="module-panel status-card">
<view class="status-card__body">
<text class="status-card__eyebrow">{{ stateCopy.eyebrow }}</text>
<text class="status-card__lead">{{ stateCopy.title }}</text>
<text class="status-card__note">{{ stateCopy.copy }}</text>
<AppButton
block
:type="moduleState === 'error' ? 'secondary' : 'primary'"
:label="stateCopy.action"
@click="handleStateAction"
/>
</view>
</view>
</view>
<AppTabbar v-if="page.tab" :active="page.tab" />
<AppToast :visible="toastVisible" :message="toastMessage" />
</view>
</template>
<script setup>
import { computed, onUnmounted, ref } from "vue";
import AppButton from "@/components/AppButton.vue";
import AppLoading from "@/components/AppLoading.vue";
import PageHeader from "@/components/PageHeader.vue";
import AppTabbar from "@/components/AppTabbar.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import { pageCatalog } from "@/data/page-catalog.js";
const props = defineProps({ pageId: { type: String, required: true } });
const page = computed(() => pageCatalog[props.pageId]);
const moduleKey = computed(
() =>
({ f: "family", r: "records", n: "notification", m: "profile" })[
props.pageId[0]
] || "profile",
);
const assetModule = computed(
() =>
({
family: "family",
records: "records",
notification: "notification",
profile: "profile",
})[moduleKey.value],
);
const contentAsset = computed(
() =>
`/static/assets/modules/${assetModule.value}/transparent/module-content-frame.png`,
);
const fieldAsset = computed(
() =>
`/static/assets/modules/${assetModule.value}/transparent/module-field-frame.png`,
);
const moduleAssetStyle = computed(() => ({
"--module-content-asset": `url(${contentAsset.value})`,
"--module-field-asset": `url(${fieldAsset.value})`,
}));
const query = (() => {
if (typeof location !== "undefined")
return Object.fromEntries(
new URLSearchParams(location.hash.split("?")[1] || ""),
);
const pages = getCurrentPages();
return pages[pages.length - 1]?.options || {};
})();
const moduleState = ref(
["loading", "empty", "success", "error"].includes(query.state)
? query.state
: "ready",
);
const toastVisible = ref(false);
const toastMessage = ref("");
let toastTimer = null;
const normalizedNote = computed(() =>
(page.value.note || "").replace(
/待接入|服务待接入|功能待接入/g,
"将在后续功能阶段开放",
),
);
const normalizedSectionCopy = (copy) =>
String(copy || "").replace(/待接入|功能待接入/g, "后续功能阶段开放");
const stateCopy = computed(() => {
const pageState = page.value.states?.[moduleState.value];
if (pageState) return pageState;
return (
{
empty: {
eyebrow: "暂无内容",
title: `还没有${page.value.title}记录`,
copy: "完成第一条记录后,内容会按时间或类别整理在这里。",
action: page.value.action,
},
success: {
eyebrow: "操作结果",
title: `${page.value.title}内容已更新`,
copy: "当前页面已展示操作结果;正式数据将在接口阶段接入。",
action: "继续查看",
},
error: {
eyebrow: "内容暂不可用",
title: `暂时无法打开${page.value.title}`,
copy: "请稍后重新进入,现有资料不会受到影响。",
action: "重新查看",
},
}[moduleState.value] || {}
);
});
const handleStateAction = () => {
if (stateCopy.value.actionMode === "back") {
uni.navigateBack();
return;
}
moduleState.value = "ready";
};
const completeAction = () => {
moduleState.value = "success";
};
const openPreview = (item) => {
toastMessage.value = item[0];
toastVisible.value = true;
if (toastTimer) clearTimeout(toastTimer);
toastTimer = setTimeout(() => {
toastVisible.value = false;
toastTimer = null;
}, 1800);
};
onUnmounted(() => {
if (toastTimer) clearTimeout(toastTimer);
});
</script>
<style scoped lang="scss">
@use "../styles/adaptive-frame-profiles.scss" as adaptive;
.module-page {
display: flex;
min-height: 100vh;
flex-direction: column;
background: $paper;
}
.module-page__header,
.module-page__content,
.module-page__loading {
z-index: 1;
}
.module-page__loading {
min-height: calc(100vh - 100rpx);
}
.module-page__content {
padding: 16rpx 26rpx 56rpx;
}
.module-lead {
display: flex;
min-height: 56rpx;
align-items: center;
justify-content: center;
margin: 0 12rpx 18rpx;
color: $ink-muted;
font-size: 23rpx;
text-align: center;
background: url("/static/assets/modules/genealogy/transparent/section-divider.png") center / 100% auto no-repeat;
}
.module-lead text {
display: block;
}
.module-panel {
width: 100%;
}
.section-eyebrow {
display: block;
margin: 2rpx 8rpx 14rpx;
color: $brand-red;
font-family: STKaiti, KaiTi, serif;
font-size: 29rpx;
font-weight: 700;
letter-spacing: 3rpx;
}
.form-row {
display: grid;
grid-template-columns: auto minmax(0, 1fr);
min-height: 84rpx;
align-items: center;
gap: 22rpx;
margin-top: 14rpx;
padding: 14rpx 26rpx;
box-sizing: border-box;
}
.form-row,
.settings-row {
@include adaptive.adaptive-module-field;
}
.form-row > text {
color: $ink;
font-size: 24rpx;
font-weight: 700;
}
.form-row input {
width: 100%;
min-width: 0;
min-height: 56rpx;
color: $ink;
font-size: 23rpx;
text-align: right;
}
.form-placeholder {
color: #9e8e79;
}
.form-note {
display: block;
margin: 18rpx 18rpx 0;
color: $ink-muted;
font-size: 22rpx;
line-height: 1.5;
text-align: center;
}
.module-form > .app-button,
.module-detail > .app-button,
.module-settings > .app-button,
.content-stack > .app-button {
margin-top: 22rpx;
}
.content-stack {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.list-card,
.timeline-row {
width: 100%;
min-height: 188rpx;
}
.list-card,
.detail-card,
.timeline-row,
.status-card {
@include adaptive.adaptive-module-content;
}
.list-card__copy {
padding: 34rpx 46rpx 28rpx;
}
.list-card__copy text {
display: block;
}
.list-card__copy text:first-child {
color: $ink;
font-family: STKaiti, KaiTi, serif;
font-size: 30rpx;
font-weight: 700;
}
.list-card__copy text:nth-child(2) {
margin-top: 10rpx;
color: $ink-muted;
font-size: 23rpx;
line-height: 1.45;
}
.list-card__copy text:last-child {
margin-top: 11rpx;
color: $brand-red;
font-size: 21rpx;
font-weight: 600;
}
.detail-card {
min-height: 170rpx;
margin-top: 16rpx;
}
.detail-card > view {
padding: 34rpx 44rpx;
}
.detail-card text,
.settings-row text {
display: block;
}
.detail-card text:first-child {
color: $brand-red;
font-size: 23rpx;
font-weight: 700;
}
.detail-card text:last-child {
margin-top: 10rpx;
color: $ink;
font-size: 24rpx;
line-height: 1.55;
}
.timeline-row > view {
padding: 29rpx 44rpx;
}
.timeline-row text {
display: block;
}
.timeline-row text:first-child {
color: $brand-red;
font-size: 21rpx;
letter-spacing: 2rpx;
}
.timeline-row text:nth-child(2) {
margin-top: 6rpx;
color: $ink;
font-family: STKaiti, KaiTi, serif;
font-size: 30rpx;
font-weight: 700;
}
.timeline-row text:last-child {
margin-top: 9rpx;
color: $ink-muted;
font-size: 23rpx;
}
.settings-row {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
min-height: 94rpx;
align-items: center;
gap: 20rpx;
margin-top: 14rpx;
padding: 20rpx 28rpx 18rpx 26rpx;
box-sizing: border-box;
}
.settings-row > view text:first-child {
color: $ink;
font-size: 24rpx;
font-weight: 700;
}
.settings-row > view text:last-child {
margin-top: 6rpx;
color: $ink-muted;
font-size: 21rpx;
}
.settings-row > text {
color: $brand-red;
font-size: 21rpx;
font-weight: 600;
}
.status-card {
min-height: 330rpx;
text-align: center;
}
.status-card__body {
padding: 70rpx 60rpx 48rpx;
}
.status-card__eyebrow {
display: block;
color: $brand-red;
font-size: 23rpx;
letter-spacing: 3rpx;
}
.status-card__lead {
display: block;
margin-top: 14rpx;
color: $ink;
font-family: STKaiti, KaiTi, serif;
font-size: 35rpx;
font-weight: 700;
}
.status-card__note {
display: block;
margin-top: 17rpx;
color: $ink-muted;
font-size: 24rpx;
line-height: 1.6;
}
.status-card .app-button {
margin: 28rpx auto 0;
}
.module-page__content--state {
padding-top: 72rpx;
}
.module-page--family .section-eyebrow {
color: #9f2c23;
}
.module-page--records .section-eyebrow {
color: #8c261f;
}
.module-page--notification .section-eyebrow {
color: #9b2b21;
}
.module-page--profile .section-eyebrow {
color: #a22d24;
}
@media (min-width: 400px) {
.module-page__content {
padding-right: 34rpx;
padding-left: 34rpx;
}
}
@media (max-width: 340px) {
.module-page__content {
padding-right: 20rpx;
padding-left: 20rpx;
}
.form-row {
gap: 14rpx;
}
.status-card__body {
padding-right: 44rpx;
padding-left: 44rpx;
}
}
</style>
+54 -23
View File
@@ -8,37 +8,40 @@
class="header-texture"
src="/static/assets/foundation/opaque/root-header-cinnabar.jpg"
mode="scaleToFill"
aria-hidden="true"
/>
<image
v-if="root"
class="header-hall"
src="/static/assets/foundation/transparent/root-header-hall.png"
mode="aspectFit"
aria-hidden="true"
/>
<view class="header-side header-side--left">
<button
<view
v-if="root"
class="header-icon-button"
aria-label="返回首页"
@click="$emit('brand')"
class="header-brand"
aria-hidden="true"
>
<image
class="header-logo"
src="/static/assets/foundation/transparent/brand-seal.png"
mode="aspectFit"
aria-hidden="true"
/>
</button>
</view>
<button
v-else
class="header-back"
aria-label="返回上一页"
hover-class="header-back--pressed"
@click="goBack"
@click="handleBack"
>
<image
class="header-back__icon"
src="/static/assets/foundation/transparent/chevron-right.png"
mode="aspectFit"
aria-hidden="true"
/>
</button>
</view>
@@ -47,49 +50,57 @@
<view class="header-side header-side--right">
<button
v-if="root"
v-if="root && notice"
class="header-icon-button header-notice"
aria-label="打开消息中心"
:aria-label="unreadCount > 0 ? `打开消息中心,${unreadCount} 条未读` : '打开消息中心'"
@click="$emit('notice')"
>
<image
class="header-notice-icon"
src="/static/assets/foundation/transparent/notice.png"
mode="aspectFit"
aria-hidden="true"
/>
<view v-if="unreadCount > 0" class="notice-dot"></view>
</button>
<button v-else class="header-action" :disabled="!action" @click="$emit('action')">{{
<button
v-else-if="root && action"
class="header-action header-action--root"
@click="$emit('action')"
>{{ action }}</button>
<button v-else-if="action" class="header-action" @click="$emit('action')">{{
action
}}</button>
<view
v-else
class="header-action-placeholder"
aria-hidden="true"
></view>
</view>
</view>
</view>
</template>
<script setup>
import { goBack } from "@/utils/navigation.js";
const props = defineProps({
title: { type: String, required: true },
action: { type: String, default: "" },
root: { type: Boolean, default: false },
unreadCount: { type: Number, default: 0 },
fallbackUrl: { type: String, default: "/pages/genealogy/g01-my-genealogies" },
notice: { type: Boolean, default: false },
customBack: { type: Boolean, default: false },
});
const emit = defineEmits(["brand", "notice", "action", "back"]);
const emit = defineEmits(["notice", "action", "back"]);
const goBack = () => {
const handleBack = () => {
if (props.customBack) {
emit("back");
return;
}
const stack = getCurrentPages();
if (stack.length > 1) {
uni.navigateBack();
return;
}
uni.reLaunch({ url: props.fallbackUrl });
return goBack();
};
</script>
@@ -180,6 +191,17 @@ const goBack = () => {
background: transparent;
line-height: normal;
}
.header-brand {
display: grid;
width: 88rpx;
min-height: 88rpx;
place-items: center;
margin: 0;
padding: 0;
border: 0;
background: transparent;
line-height: normal;
}
.header-icon-button::after,
.header-back::after,
.header-action::after {
@@ -214,13 +236,27 @@ const goBack = () => {
}
.header-action {
display: flex;
width: 100%;
min-height: 88rpx;
align-items: center;
justify-content: flex-end;
margin: 0;
padding: 0;
border: 0;
background: transparent;
color: #ffe3a7;
font-size: 27rpx;
line-height: normal;
text-align: right;
}
.header-action-placeholder {
width: 100%;
min-height: 88rpx;
}
.header-action--root {
color: #ffe3a7;
font-weight: 700;
}
.header-back {
@@ -244,11 +280,6 @@ const goBack = () => {
.header-back--pressed {
opacity: 0.62;
}
.header-action {
color: #ffe3a7;
text-align: right;
}
.header-title {
flex: 1;
overflow: hidden;
+564
View File
@@ -0,0 +1,564 @@
<template>
<view
v-show="visible"
class="tac-layer"
:class="{ 'tac-layer--visible': visible }"
:aria-hidden="visible ? 'false' : 'true'"
@click.stop="requestCancel"
>
<view
id="jiapu-tac-dialog"
class="tac-panel"
role="dialog"
aria-modal="true"
tabindex="-1"
aria-labelledby="jiapu-tac-title"
aria-describedby="jiapu-tac-description"
@click.stop
@keydown.esc.stop.prevent="requestCancel"
>
<view class="tac-heading">
<view class="tac-heading__copy">
<text id="jiapu-tac-title" class="tac-title">安全验证</text>
<text id="jiapu-tac-description" class="tac-description"
>拖动滑块完成验证可刷新当前挑战或关闭返回</text
>
</view>
<view class="tac-tools" role="group" aria-label="安全验证操作">
<button
class="tac-tool tac-tool--refresh"
aria-label="刷新安全验证"
@click.stop="requestRefresh"
></button>
<button
class="tac-tool tac-tool--close"
aria-label="关闭安全验证"
@click.stop="requestCancel"
>×</button>
</view>
</view>
<view
id="jiapu-tac-host"
class="tac-host"
:prop="renderContext"
:change:prop="tacRenderer.onContextChange"
/>
</view>
</view>
</template>
<script>
export default {
name: "TacVerification",
data() {
return {
refreshSequence: 0,
};
},
props: {
visible: {
type: Boolean,
default: false,
},
context: {
type: Object,
default: null,
},
},
emits: ["success", "failure", "error", "cancel"],
computed: {
renderContext() {
return {
...(this.context || {}),
visible: this.visible,
refreshSequence: this.refreshSequence,
};
},
},
methods: {
requestCancel() {
if (this.visible) this.$emit("cancel");
},
requestRefresh() {
if (this.visible) this.refreshSequence += 1;
},
handleTacSuccess(payload) {
this.$emit("success", payload);
},
handleTacFailure(payload) {
this.$emit("failure", payload);
},
handleTacError(payload) {
this.$emit("error", payload);
},
handleTacCancel(payload) {
this.$emit("cancel", payload);
},
},
};
</script>
<script module="tacRenderer" lang="renderjs">
const TAC_STYLE_URL = "./static/tac/css/tac.css";
const TAC_SCRIPT_URL = "./static/tac/js/tac.min.js";
const TAC_ADAPTER_URL = "./static/tac/js/jiapu-tac-adapter.js";
const loadStyle = (href) => {
const existing = document.querySelector(`link[data-jiapu-tac="${href}"]`);
if (existing && (existing.dataset.jiapuState === "loaded" || existing.sheet)) {
return Promise.resolve();
}
if (existing && existing.dataset.jiapuState === "loading") {
return new Promise((resolve, reject) => {
existing.addEventListener("load", resolve, { once: true });
existing.addEventListener("error", () => reject(new Error(`安全验证样式加载失败:${href}`)), { once: true });
});
}
if (existing) existing.remove();
return new Promise((resolve, reject) => {
const link = document.createElement("link");
link.rel = "stylesheet";
link.href = href;
link.setAttribute("data-jiapu-tac", href);
link.dataset.jiapuState = "loading";
link.onload = () => {
link.dataset.jiapuState = "loaded";
resolve();
};
link.onerror = () => {
link.remove();
reject(new Error(`安全验证样式加载失败:${href}`));
};
document.head.appendChild(link);
});
};
const loadScript = (src, ready) => {
if (ready()) return Promise.resolve();
const existing = document.querySelector(`script[data-jiapu-tac="${src}"]`);
if (existing && existing.dataset.jiapuState === "loading") {
return new Promise((resolve, reject) => {
existing.addEventListener("load", () => {
if (ready()) {
existing.dataset.jiapuState = "loaded";
resolve();
} else {
existing.remove();
reject(new Error(`安全验证脚本未提供预期能力:${src}`));
}
}, { once: true });
existing.addEventListener("error", () => {
existing.remove();
reject(new Error(`安全验证脚本加载失败:${src}`));
}, { once: true });
});
}
if (existing) existing.remove();
return new Promise((resolve, reject) => {
const script = document.createElement("script");
script.src = src;
script.setAttribute("data-jiapu-tac", src);
script.dataset.jiapuState = "loading";
script.onload = () => {
if (!ready()) {
script.remove();
reject(new Error(`安全验证脚本未提供预期能力:${src}`));
return;
}
script.dataset.jiapuState = "loaded";
resolve();
};
script.onerror = () => {
script.remove();
reject(new Error(`安全验证脚本加载失败:${src}`));
};
document.head.appendChild(script);
});
};
export default {
data() {
return {
generation: 0,
tac: null,
context: null,
challenge: null,
activeXhr: null,
fatalSent: false,
completionSent: false,
previousFocus: null,
focusTrapTarget: null,
focusTrapHandler: null,
};
},
methods: {
async onContextChange(nextContext) {
const wasVisible = Boolean(this.context && this.context.visible === true);
const nextVisible = Boolean(nextContext && nextContext.visible === true);
this.generation += 1;
const generation = this.generation;
if (nextVisible && !wasVisible) this.capturePreviousFocus();
this.destroyTac(!nextVisible);
this.context = nextContext || null;
this.challenge = null;
this.fatalSent = false;
this.completionSent = false;
if (!nextContext || nextContext.visible !== true) return;
try {
await Promise.all([
loadStyle(TAC_STYLE_URL),
loadScript(TAC_SCRIPT_URL, () => Boolean(window.TAC && window.CaptchaConfig)),
]);
await loadScript(TAC_ADAPTER_URL, () => Boolean(window.JiapuTacAdapter));
if (generation !== this.generation || !this.context || this.context.visible !== true) return;
this.createTac();
} catch (error) {
if (generation !== this.generation || !this.context || this.context.visible !== true) return;
this.notifyFatal(error);
}
},
createTac() {
if (!window.TAC || !window.CaptchaConfig || !window.JiapuTacAdapter) {
throw new Error("安全验证组件未完整加载");
}
this.completionSent = false;
const generation = this.generation;
const requestContext = this.context;
const isCurrent = () =>
generation === this.generation &&
this.context === requestContext &&
requestContext.visible === true;
const config = new window.CaptchaConfig({
bindEl: "#jiapu-tac-host",
requestCaptchaDataUrl: this.context.challengeUrl,
validCaptchaUrl: this.context.verifyUrl,
requestHeaders: {
clientid: this.context.clientId,
},
validSuccess: (response, captcha, tac) => {
if (!isCurrent() || this.completionSent) return;
// 供应商脚本在动画结束、窗口销毁等边界下可能重复触发回调。
// 先封闭本轮并使所有旧闭包失效,再通知逻辑层,避免重复发短信或重复提交认证。
this.completionSent = true;
this.generation += 1;
this.abortActiveRequest();
const data = response && response.data;
tac.destroyWindow();
this.tac = null;
this.$ownerInstance.callMethod("handleTacSuccess", {
requestId: requestContext.requestId,
validToken: data && data.validToken,
expireSeconds: data && data.expireSeconds,
});
},
validFail: (response, captcha, tac) => {
if (!isCurrent()) return;
this.$ownerInstance.callMethod("handleTacFailure", {
requestId: requestContext.requestId,
message: (response && response.msg) || "行为验证未通过,请重试",
});
tac.reloadCaptcha();
},
btnCloseFun: (event, tac) => {
if (!isCurrent() || this.completionSent) return;
this.completionSent = true;
this.generation += 1;
this.abortActiveRequest();
tac.destroyWindow();
this.tac = null;
this.$ownerInstance.callMethod("handleTacCancel", {
requestId: requestContext.requestId,
});
},
btnRefreshFun: (event, tac) => {
if (isCurrent()) tac.reloadCaptcha();
},
});
// SDK 原生传输会把空体 HTTP 500 当成功,并且 verify 只看外层 code。
// 此处统一替换为严格 2xx JSON 传输,再由唯一适配器验证 passed 与 validToken。
config.doSendRequest = (options) => this.sendStrictRequest(options);
config.addRequestChain({
preRequest: (type, request) => this.beforeRequest(type, request),
postRequest: (type, request, response) => this.afterRequest(type, response),
});
this.tac = new window.TAC(config, {
logoUrl: null,
i18n: {
tips_success: "验证成功",
tips_error: "验证失败,请重新尝试",
slider_title: "拖动滑块完成安全验证",
rotate_title: "拖动滑块完成安全验证",
concat_title: "拖动滑块完成拼图",
image_click_title: "请依次点击",
},
});
this.tac.init();
this.activateFocusTrap();
},
beforeRequest(type, request) {
if (type === "requestCaptchaData") {
request.data = {
tenantId: this.context.tenantId,
clientId: this.context.clientId,
sceneCode: this.context.sceneCode,
subject: this.context.subject,
};
return true;
}
if (type === "validCaptcha") {
request.data = window.JiapuTacAdapter.buildVerifyBody(
request.data,
this.context,
this.challenge,
);
}
return true;
},
afterRequest(type, response) {
try {
if (type === "requestCaptchaData") {
const mapped = window.JiapuTacAdapter.normalizeChallengeResponse(response, this.context);
this.challenge = mapped.challenge;
this.replaceResponse(response, mapped.sdkResponse);
} else if (type === "validCaptcha") {
const mapped = window.JiapuTacAdapter.normalizeVerifyResponse(response);
this.replaceResponse(response, mapped);
}
} catch (error) {
const failure = window.JiapuTacAdapter.toSdkFailure(error);
this.replaceResponse(response, failure);
if (type === "requestCaptchaData") this.notifyFatal(error);
}
return true;
},
replaceResponse(target, source) {
Object.keys(target).forEach((key) => delete target[key]);
Object.assign(target, source);
},
sendStrictRequest(options) {
return new Promise((resolve) => {
this.abortActiveRequest();
const generation = this.generation;
const xhr = new XMLHttpRequest();
this.activeXhr = xhr;
let settled = false;
const settle = (response) => {
if (settled || generation !== this.generation || this.activeXhr !== xhr) return;
settled = true;
this.activeXhr = null;
resolve(response);
};
xhr.open(options.method || "POST", options.url);
xhr.timeout = 15000;
Object.keys(options.headers || {}).forEach((name) => {
xhr.setRequestHeader(name, String(options.headers[name]));
});
xhr.onreadystatechange = () => {
if (xhr.readyState !== XMLHttpRequest.DONE) return;
if (!(xhr.status >= 200 && xhr.status < 300)) {
settle({ code: xhr.status || 503, msg: `安全验证服务请求失败(${xhr.status || "网络异常"}` });
return;
}
try {
const data = JSON.parse(xhr.responseText);
settle(data && typeof data === "object" ? data : { code: 502, msg: "安全验证服务返回无效数据" });
} catch (error) {
settle({ code: 502, msg: "安全验证服务返回了非 JSON 数据" });
}
};
xhr.onerror = () => settle({ code: 503, msg: "安全验证服务网络连接失败" });
xhr.ontimeout = () => settle({ code: 504, msg: "安全验证服务请求超时" });
const payload = typeof options.data === "string" ? options.data : JSON.stringify(options.data || {});
xhr.send(payload);
});
},
abortActiveRequest() {
const xhr = this.activeXhr;
this.activeXhr = null;
if (!xhr || xhr.readyState === XMLHttpRequest.DONE) return;
xhr.onreadystatechange = null;
xhr.onerror = null;
xhr.ontimeout = null;
xhr.onabort = null;
xhr.abort();
},
notifyFatal(error) {
if (this.fatalSent) return;
this.fatalSent = true;
this.$ownerInstance.callMethod("handleTacError", {
requestId: this.context && this.context.requestId,
message: (error && error.message) || "安全验证暂不可用",
});
},
capturePreviousFocus() {
const previousFocus = document.activeElement;
this.previousFocus = previousFocus && typeof previousFocus.focus === "function"
? previousFocus
: null;
},
activateFocusTrap() {
this.deactivateFocusTrap(false);
const panel = document.querySelector("#jiapu-tac-dialog");
if (!panel) return;
const getFocusable = () => Array.from(panel.querySelectorAll(
'button:not([disabled]), [href], input:not([disabled]), [tabindex]:not([tabindex="-1"])',
)).filter((element) => element.offsetParent !== null);
this.focusTrapHandler = (event) => {
if (event.key !== "Tab") return;
const focusable = getFocusable();
if (focusable.length === 0) {
event.preventDefault();
panel.focus();
return;
}
const first = focusable[0];
const last = focusable[focusable.length - 1];
if (event.shiftKey && (document.activeElement === first || document.activeElement === panel)) {
event.preventDefault();
last.focus();
} else if (!event.shiftKey && document.activeElement === last) {
event.preventDefault();
first.focus();
}
};
this.focusTrapTarget = panel;
panel.addEventListener("keydown", this.focusTrapHandler);
const initialFocus = panel.querySelector(".tac-tool--refresh") || panel;
setTimeout(() => initialFocus.focus?.(), 0);
},
deactivateFocusTrap(restoreFocus = false) {
if (this.focusTrapTarget && this.focusTrapHandler) {
this.focusTrapTarget.removeEventListener("keydown", this.focusTrapHandler);
}
this.focusTrapTarget = null;
this.focusTrapHandler = null;
if (!restoreFocus) return;
const previousFocus = this.previousFocus;
this.previousFocus = null;
setTimeout(() => previousFocus?.focus?.(), 0);
},
destroyTac(restoreFocus = true) {
this.abortActiveRequest();
if (this.tac) this.tac.destroyWindow();
this.tac = null;
const host = document.querySelector("#jiapu-tac-host");
if (host) host.innerHTML = "";
this.deactivateFocusTrap(restoreFocus);
},
},
};
</script>
<style scoped>
.tac-layer {
position: fixed;
inset: 0;
z-index: 1200;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 32rpx;
background: rgba(34, 19, 12, 0.62);
opacity: 0;
pointer-events: none;
transition: opacity 160ms ease;
}
.tac-layer--visible {
opacity: 1;
pointer-events: auto;
}
.tac-panel {
box-sizing: border-box;
width: 318px;
max-width: 100%;
max-height: calc(var(--app-viewport-height) - 2px);
min-height: 318px;
border: 2rpx solid rgba(117, 25, 19, 0.48);
border-radius: 12rpx;
background: #f7f0e5;
box-shadow: 0 16rpx 52rpx rgba(39, 18, 10, 0.28);
overflow-y: auto;
}
.tac-heading {
display: flex;
min-height: 58px;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 6px 4px 6px 12px;
border-bottom: 1px solid rgba(117, 25, 19, 0.18);
}
.tac-heading__copy {
display: flex;
min-width: 0;
flex: 1;
flex-direction: column;
}
.tac-title {
color: #8f160f;
font-size: 16px;
font-weight: 700;
}
.tac-description {
margin-top: 2px;
color: #5c4330;
font-size: 12px;
line-height: 1.35;
}
.tac-tools {
display: flex;
flex: 0 0 auto;
gap: 2px;
}
.tac-tool {
display: inline-flex;
min-width: 48px;
min-height: 48px;
align-items: center;
justify-content: center;
box-sizing: border-box;
margin: 0;
padding: 0;
border: 0;
background: transparent;
color: #8f160f;
font-size: 25px;
line-height: 1;
}
.tac-tool::after {
border: 0;
}
:deep(.slider-bottom .close-btn),
:deep(.slider-bottom .refresh-btn) {
display: none !important;
}
.tac-host {
width: 318px;
max-width: 100%;
min-height: 318px;
}
@media (max-width: 340px) {
.tac-layer {
padding: 1px;
}
.tac-panel {
border: 0;
}
}
</style>
-334
View File
@@ -1,334 +0,0 @@
<!-- T04-T06 共用成员表单仅复用视觉与交互骨架各页面通过 kind 拥有独立任务和文案 -->
<template>
<view
class="member-form-page"
:class="{
'form-state--form': formState === 'form',
'form-state--success': formState === 'success',
'form-state--conflict': formState === 'conflict',
'form-state--error': formState === 'error',
}"
>
<ModulePageBackground module="tree" />
<view class="member-form-page__header"
><PageHeader :title="config.pageTitle"
/></view>
<view class="member-form-panel">
<view v-if="formState === 'form'" class="member-form">
<text class="member-form__eyebrow">{{ config.eyebrow }}</text>
<text class="member-form__title">{{ config.title }}</text>
<text class="member-form__copy">{{ config.copy }}</text>
<view
v-for="field in config.fields"
:key="field.key"
class="member-field"
>
<text>{{ field.label }}</text>
<input
v-model="form[field.key]"
:placeholder="field.placeholder"
placeholder-class="member-placeholder"
/>
</view>
<text class="member-form__note">{{ config.note }}</text>
<view class="member-form-action" @click="saveForm">
<image
src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png"
mode="aspectFit"
/><text>{{ config.action }}</text>
</view>
</view>
<view v-else class="member-form-result">
<text class="member-form__eyebrow">{{ resultCopy.eyebrow }}</text>
<text class="member-form__title">{{ resultCopy.title }}</text>
<text class="member-form__copy">{{ resultCopy.copy }}</text>
<view v-if="formState === 'conflict'" class="conflict-actions">
<view class="member-form-action" @click="formState = 'form'">
<image
src="/static/assets/foundation/transparent/a01-scroll-secondary-v3.png"
mode="aspectFit"
/><text class="member-form-action__secondary">返回核对</text>
</view>
<view class="member-form-action" @click="showConflictHelp">
<image
src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png"
mode="aspectFit"
/><text>查看冲突</text>
</view>
</view>
<view v-else class="member-form-action" @click="formState = 'form'">
<image
src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png"
mode="aspectFit"
/><text>{{ formState === "success" ? "继续完善" : "重新填写" }}</text>
</view>
</view>
</view>
<AppDialog
:visible="conflictHelpVisible"
eyebrow="关系校验规则"
title="关系冲突说明"
message="同一成员不能同时存在两个生父,也不能形成上下代循环。请返回世系树核对原关系后再调整。"
@confirm="conflictHelpVisible = false"
@close="conflictHelpVisible = false"
/>
</view>
</template>
<script setup>
import { computed, reactive, ref } from "vue";
import AppDialog from "@/components/AppDialog.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
const props = defineProps({ kind: { type: String, required: true } });
const configs = {
add: {
pageTitle: "新增亲属",
eyebrow: "补全家族关系",
title: "为汤文远添加一位亲属",
copy: "先确认与当前成员的关系,再录入基础身份信息。",
action: "保存亲属",
note: "保存后将在世系图中显示,可继续补充详细档案。",
fields: [
{ key: "name", label: "姓名", placeholder: "请输入真实姓名" },
{ key: "relation", label: "与本人关系", placeholder: "例如:长子、配偶" },
{ key: "birthDate", label: "出生日期", placeholder: "例如:1992年" },
{ key: "gender", label: "性别", placeholder: "请选择或输入" },
],
},
edit: {
pageTitle: "编辑成员",
eyebrow: "成员档案维护",
title: "完善汤文远的生命记录",
copy: "基础身份用于世系展示,生平信息可在成员档案中继续补充。",
action: "保存资料",
note: "隐私字段只向本人和有权限的家谱管理员展示。",
fields: [
{ key: "name", label: "姓名", placeholder: "请输入首位成员姓名" },
{ key: "generation", label: "字辈", placeholder: "例如:文" },
{ key: "birthDate", label: "出生日期", placeholder: "1940年" },
{ key: "summary", label: "人物简介", placeholder: "简要记录生平" },
],
},
relation: {
pageTitle: "关系维护",
eyebrow: "亲属关系校正",
title: "确认两位成员的家族关系",
copy: "调整关系会影响世系位置,保存前请核对成员和关系类型。",
action: "保存关系",
note: "若形成重复父母、代际倒置等情况,页面会先提示冲突。",
fields: [
{ key: "source", label: "当前成员", placeholder: "请选择当前成员" },
{ key: "target", label: "关联成员", placeholder: "请选择家谱成员" },
{ key: "relation", label: "关系类型", placeholder: "父子、配偶等" },
{ key: "effectiveDate", label: "生效日期", placeholder: "选填" },
],
},
};
const config = computed(() => configs[props.kind]);
const form = reactive({
name: "",
relation: "",
birthDate: "",
gender: "",
generation: "",
summary: "",
source: "",
target: "",
effectiveDate: "",
});
const query = (() => {
if (typeof location !== "undefined")
return Object.fromEntries(
new URLSearchParams(location.hash.split("?")[1] || ""),
);
const pages = getCurrentPages();
return pages[pages.length - 1]?.options || {};
})();
const formState = ref(
query.state === "success"
? "success"
: query.state === "conflict"
? "conflict"
: query.state === "error"
? "error"
: "form",
);
const conflictHelpVisible = ref(false);
const resultCopy = computed(
() =>
({
success: {
eyebrow: "本地预览已更新",
title: `${config.value.pageTitle}内容已保存`,
copy: "返回世系树后可查看新的展示位置;正式数据将在接口阶段接入。",
},
conflict: {
eyebrow: "发现关系冲突",
title: "这段关系会造成代际矛盾",
copy: "目标成员已经存在父级关系,请先核对原关系,再决定是否调整。",
},
error: {
eyebrow: "内容未保存",
title: "暂时无法完成这次操作",
copy: "请返回成员档案重新进入,当前填写内容不会写入正式数据。",
},
})[formState.value] || {},
);
const saveForm = () => {
if (
props.kind === "relation" &&
(!form.target.trim() || !form.relation.trim())
) {
formState.value = "conflict";
return;
}
formState.value = "success";
};
const showConflictHelp = () => {
conflictHelpVisible.value = true;
};
</script>
<style scoped lang="scss">
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
.member-form-page {
display: flex;
min-height: 100vh;
flex-direction: column;
background: $paper;
}
.member-form-page__header {
z-index: 3;
}
.member-form-panel {
@include adaptive.adaptive-tree-panel;
z-index: 2;
width: calc(100% - 32rpx);
min-height: min(640px, calc((100vw - 16px) * 1.48));
margin: 18rpx auto 0;
padding: 7.5% 8%;
box-sizing: border-box;
}
.member-form,
.member-form-result {
z-index: 1;
}
.member-form__eyebrow {
display: block;
color: $brand-red;
font-size: 22rpx;
letter-spacing: 3rpx;
}
.member-form__title {
display: block;
margin-top: 10rpx;
color: $ink;
font-family: "STKaiti", "KaiTi", serif;
font-size: 34rpx;
font-weight: 700;
}
.member-form__copy {
display: block;
margin-top: 9rpx;
color: $ink-muted;
font-size: 24rpx;
line-height: 1.5;
}
.member-field {
@include adaptive.adaptive-tree-field;
display: grid;
grid-template-columns: auto minmax(0, 1fr);
min-height: 78rpx;
align-items: center;
gap: 20rpx;
margin-top: 12rpx;
padding: 12rpx 22rpx;
box-sizing: border-box;
}
.member-field > text {
z-index: 1;
color: $ink;
font-size: 24rpx;
font-weight: 700;
}
.member-field input {
z-index: 1;
width: 100%;
min-width: 0;
min-height: 54rpx;
color: $ink;
font-size: 24rpx;
text-align: right;
}
.member-placeholder {
color: #a79884;
}
.member-form__note {
display: block;
margin-top: 14rpx;
color: $ink-muted;
font-size: 22rpx;
line-height: 1.45;
text-align: center;
}
.member-form-action {
display: grid;
width: 100%;
min-height: 76rpx;
margin-top: 17rpx;
}
.member-form-action image {
grid-area: 1 / 1;
width: 100%;
height: 100%;
pointer-events: none;
}
.member-form-action text {
z-index: 1;
display: flex;
grid-area: 1 / 1;
align-items: center;
justify-content: center;
height: 100%;
color: #fff9ed;
font-size: 24rpx;
font-weight: 700;
}
.member-form-action .member-form-action__secondary {
color: $ink;
}
.member-form-result {
margin-top: 21.5%;
text-align: center;
}
.member-form-result .member-form__eyebrow {
text-align: center;
}
.member-form-result .member-form__copy {
margin-top: 20rpx;
}
.member-form-result > .member-form-action {
width: 420rpx;
max-width: 100%;
margin: 32rpx auto 0;
}
.conflict-actions {
display: flex;
gap: 14rpx;
margin-top: 30rpx;
}
.conflict-actions .member-form-action {
width: calc(50% - 7rpx);
margin-top: 0;
}
@media (min-width: 400px) {
.member-form-panel {
width: calc(100% - 48rpx);
}
}
</style>
+658 -33
View File
@@ -1,3 +1,8 @@
import {
GENEALOGY_ACCESS_PRESET,
getGenealogyAccessPresetLabel,
} from '../utils/genealogy-contracts.js'
export const currentUser = {
id: 1,
name: '汤文远',
@@ -7,7 +12,7 @@ export const currentUser = {
export const genealogies = [
{
id: 1001,
id: '1001',
surname: '汤',
name: '汤氏家谱',
hall: '敦睦堂',
@@ -15,12 +20,17 @@ export const genealogies = [
memberCount: 158,
updatedAt: '2024-05-12',
activeCount: 8,
visibility: '仅成员可见',
accessPreset: GENEALOGY_ACCESS_PRESET.MEMBER_ONLY,
membership: 'created',
motto: '敦亲睦族,敬祖传家。'
motto: '敦亲睦族,敬祖传家。',
ancestorName: '汤文远',
parentName: '汤氏中华总谱',
branchName: '洛阳主支',
source: '由洛阳汤氏族人整理并维护',
publicDescription: '公开展示家谱身份、地区、堂号与支系信息。'
},
{
id: 1002,
id: '1002',
surname: '汤',
name: '汤氏宗谱',
hall: '承志堂',
@@ -28,43 +38,658 @@ export const genealogies = [
memberCount: 286,
updatedAt: '2024-04-28',
activeCount: 15,
visibility: '公开可申请',
accessPreset: GENEALOGY_ACCESS_PRESET.PUBLIC_APPLY,
membership: 'joined',
motto: '继往开来,世守家风。'
motto: '继往开来,世守家风。',
ancestorName: '汤正明',
parentName: '汤氏鲁西总谱',
branchName: '济宁主支',
source: '由济宁汤氏族人整理并维护',
publicDescription: '公开展示家谱身份、地区、堂号与支系信息。'
}
]
export const treeMembers = [
{ id: 1, name: '汤文远', relation: '始祖', generation: 1, years: '1940—2012', branch: '主支', x: 50, y: 7 },
{ id: 2, name: '汤正国', relation: '长子', generation: 2, years: '1965—', branch: '主支', x: 20, y: 38 },
{ id: 3, name: '汤正华', relation: '次子', generation: 2, years: '1968—', branch: '主支', x: 50, y: 38 },
{ id: 4, name: '汤正强', relation: '三子', generation: 2, years: '1972—', branch: '支系', x: 80, y: 38 },
{ id: 5, name: '汤凯', relation: '长孙', generation: 3, years: '1992—', branch: '主支', x: 16, y: 70 },
{ id: 6, name: '汤', relation: '长女', generation: 3, years: '1995—', branch: '主支', x: 35, y: 70 },
{ id: 7, name: '汤晨', relation: '次子', generation: 3, years: '1998—', branch: '主支', x: 54, y: 70 },
{ id: 8, name: '汤昊', relation: '三子', generation: 3, years: '2001—', branch: '支系', x: 73, y: 70 },
{ id: 9, name: '汤宁', relation: '四女', generation: 3, years: '2005—', branch: '支系', x: 90, y: 70 }
// G01、G05、G06 与 G08 共用这一份家谱展示夹具。成员关系只在
// genealogies 和本地创建预览中出现;公开搜索结果绝不能据此获得管理权限。
const toPublicProjection = ({ membership: _membership, ...genealogy }) => genealogy
export const publicGenealogies = [
{
id: '2001',
surname: '汤',
name: '汤氏南阳宗谱',
hall: '敦睦堂',
location: '河南·南阳',
parentName: '汤氏中华总谱',
branchName: '南阳主支',
manager: '管理员 汤文礼',
certification: '资料已认证',
memberCount: 428,
activeCount: 316,
updatedAt: '2026-07-12',
relation: 'available',
source: '由南阳汤氏族人整理并维护',
publicDescription: '公开展示家谱身份、地区、堂号与支系信息;成员资料和世系详情仅向已加入成员开放。',
motto: '敦亲睦族,敬祖传家。',
accessPreset: GENEALOGY_ACCESS_PRESET.PUBLIC_APPLY,
ancestorName: '汤文远'
},
{
...toPublicProjection(genealogies[1]),
manager: '管理员 汤文远',
certification: '资料已认证',
relation: 'joined'
},
{
id: '2003',
surname: '汤',
name: '汤氏济宁宗谱',
hall: '敬宗堂',
location: '山东·济宁',
parentName: '汤氏鲁西总谱',
branchName: '济宁主支',
manager: '管理员 汤正明',
certification: '管理员已实名',
memberCount: 286,
updatedAt: '2026-07-08',
relation: 'pending',
accessPreset: GENEALOGY_ACCESS_PRESET.PUBLIC_APPLY,
},
{
id: '2004',
surname: '汤',
name: '汤氏清河家谱',
hall: '思源堂',
location: '山东·临清',
parentName: '汤氏鲁西总谱',
branchName: '清河支系',
manager: '管理员 汤志成',
certification: '资料已认证',
memberCount: 96,
updatedAt: '2026-07-05',
relation: 'rejected',
accessPreset: GENEALOGY_ACCESS_PRESET.PUBLIC_APPLY,
},
{
id: '2005',
surname: '汤',
name: '汤氏汝南支谱',
hall: '崇本堂',
location: '河南·驻马店',
parentName: '汤氏中原总谱',
branchName: '汝南三支',
manager: '管理员 汤国安',
certification: '管理员已实名',
memberCount: 72,
updatedAt: '2026-07-02',
relation: 'removed',
accessPreset: GENEALOGY_ACCESS_PRESET.PUBLIC_APPLY,
},
{
...toPublicProjection(genealogies[0]),
manager: '创建者 当前用户',
certification: '资料待完善',
relation: 'owned'
}
]
export const familyFeeds = [
{ id: 1, author: '汤正华', title: '清明祭祖通知', content: '本周六上午举行清明祭祖,敬请各支系族亲相互转告。', date: '今天 09:30', type: '族务' },
{ id: 2, author: '汤', title: '老宅修缮旧影', content: '整理出一组敦睦堂老宅照片,已收入家族相册。', date: '昨天 20:18', type: '相册' }
]
export const familyContent = {
article: [{ id: 1, title: '敦睦堂家训摘录', summary: '孝友传家,勤俭立业,敬祖睦族。', date: '2025年4月' }],
album: [{ id: 1, title: '敦睦堂老宅旧影', summary: '收录修缮前后的珍贵照片,共 6 张。', date: '2025年3月' }],
ceremony: [{ id: 1, title: '清明祭祖', summary: '本周六上午举行祭祖仪式,请族人相互转告。', date: '3 天后' }],
record: [{ id: 1, title: '老宅修缮备忘', summary: '屋脊木构加固方案已确认,等待施工。', date: '今天' }]
const localCreatedGenealogy = {
id: 'local-created-genealogy',
surname: '汤',
name: '本地创建预览',
hall: '堂号待补',
location: '所在地待补',
memberCount: 1,
activeCount: 1,
updatedAt: '尚未同步',
accessPreset: GENEALOGY_ACCESS_PRESET.MEMBER_ONLY,
localPreview: true,
motto: '当前仅为本地流程预览,尚未提交服务器。',
ancestorName: '待补',
parentName: '无上级谱',
branchName: '主支',
source: '本地创建流程预览',
publicDescription: '尚未同步到服务器。'
}
export const notifications = [
{ id: 1, title: '有新的入谱申请', content: '陈先生申请加入四川武胜汤氏族谱,等待你的审核。', time: '10:24', unread: true },
{ id: 2, title: '祭祀活动提醒', content: '清明祭祖将在 3 天后开始。', time: '昨天', unread: true },
{ id: 3, title: '相册有新照片', content: '汤悦上传了 6 张老宅修缮照片。', time: '4月9日', unread: false }
const localGenealogyPreviews = new Map([
[localCreatedGenealogy.id, localCreatedGenealogy]
])
let localPreviewSequence = 0
const buildLocalGenealogyPreview = (id, draft, previous = {}) => {
const accessPreset = Object.values(GENEALOGY_ACCESS_PRESET).includes(draft.accessPreset)
? draft.accessPreset
: GENEALOGY_ACCESS_PRESET.MEMBER_ONLY
return {
...previous,
id,
surname: String(draft.surname || '').trim(),
name: String(draft.name || '').trim(),
hall: String(draft.hall || '').trim() || '堂号待补',
location: String(draft.location || '').trim(),
memberCount: 1,
activeCount: 1,
updatedAt: '尚未同步',
accessPreset,
localPreview: true,
motto: '当前仅为本地流程预览,尚未提交服务器。',
ancestorName: previous.ancestorName || '待补',
parentName: '无上级谱',
branchName: '主支',
source: '本地创建流程预览',
publicDescription: `尚未同步到服务器;访问规则为“${getGenealogyAccessPresetLabel(accessPreset)}”。`
}
}
// G03 与 G05 共用这一份临时预览 owner。它只在当前运行实例中保存用户刚提交的
// 快照,不建立成员关系、不写持久存储,也不冒充后端创建结果。
export const createLocalGenealogyPreview = (draft) => {
localPreviewSequence += 1
const id = `local-created-${Date.now().toString(36)}-${localPreviewSequence}`
localGenealogyPreviews.set(id, buildLocalGenealogyPreview(id, draft))
return id
}
export const updateLocalGenealogyPreview = (genealogyId, draft) => {
const normalizedId = String(genealogyId || '')
const preview = localGenealogyPreviews.get(normalizedId)
if (!preview) return null
localGenealogyPreviews.set(
normalizedId,
buildLocalGenealogyPreview(normalizedId, draft, preview)
)
return normalizedId
}
export const updateLocalGenealogyPreviewAncestor = (genealogyId, draft) => {
const normalizedId = String(genealogyId || '')
const preview = localGenealogyPreviews.get(normalizedId)
if (!preview) return null
const updated = {
...preview,
ancestorName: String(draft.personName || '').trim() || '待补',
ancestor: Object.freeze({ ...draft })
}
localGenealogyPreviews.set(normalizedId, updated)
return updated
}
export const removeLocalGenealogyPreview = (genealogyId) => {
const normalizedId = String(genealogyId || '')
if (!normalizedId || normalizedId === localCreatedGenealogy.id) return false
return localGenealogyPreviews.delete(normalizedId)
}
export const findGenealogyFixture = (genealogyId) => {
const normalizedId = String(genealogyId || '')
return [...genealogies, ...publicGenealogies]
.find((item) => String(item.id) === normalizedId) ||
localGenealogyPreviews.get(normalizedId) || null
}
// 这里只解析本地视觉夹具的显示角色,不代表后端授权。成员关系仍由
// genealogies[*].membership 唯一持有;localPreview 只能进入无业务入口的预览态。
export const getGenealogyFixtureAccess = (genealogyId) => {
const normalizedId = String(genealogyId || '')
const fixture = findGenealogyFixture(normalizedId)
const memberFixture = genealogies.find((item) => item.id === normalizedId)
const publicFixture = publicGenealogies.find((item) => item.id === normalizedId)
const access = fixture?.localPreview
? 'preview'
: memberFixture?.membership === 'created'
? 'owner'
: memberFixture?.membership === 'joined'
? 'member'
: 'public'
const relation = fixture?.localPreview
? 'preview'
: memberFixture?.membership === 'created'
? 'owned'
: memberFixture?.membership === 'joined'
? 'joined'
: publicFixture?.relation || 'unknown'
return Object.freeze({
viewMode: access === 'public' || access === 'preview' ? access : 'member',
accessRole: access === 'owner' || access === 'member' ? access : 'guest',
relation,
canView:
Boolean(fixture?.localPreview) ||
access === 'owner' ||
access === 'member' ||
fixture?.accessPreset === GENEALOGY_ACCESS_PRESET.PUBLIC_APPLY,
canApply:
fixture?.accessPreset === GENEALOGY_ACCESS_PRESET.PUBLIC_APPLY &&
['available', 'rejected', 'removed'].includes(relation)
})
}
// 搜索结果的公开性与操作资格消费同一访问预设。成员可看到自己已经加入或
// 创建的私密家谱;陌生账号只能看到明确为 PUBLIC_APPLY 的投影。
export const isGenealogySearchVisible = (genealogyId) => {
const fixture = findGenealogyFixture(genealogyId)
if (!fixture) return false
const access = getGenealogyFixtureAccess(genealogyId)
return (
access.accessRole !== 'guest' ||
fixture.accessPreset === GENEALOGY_ACCESS_PRESET.PUBLIC_APPLY
)
}
// T01、T03—T08 与旧 mock API 共用这一份成员夹具。utils/api.js 是当前阶段
// 唯一允许写入裸数组的模块;页面必须通过下方查询函数取得深拷贝,避免页面
// 表单或关系投影反向污染世系树和其他页面。
export const treeMembers = [
{
id: '101', appUserId: '2001', genealogyId: '1001', parentId: '', name: '汤文远', relation: '始祖',
generation: 12, generationName: '文字辈', branch: '主支', years: '1940—2012',
birthDate: '1940-03-01', deathDate: '2012-08-16', birthplace: '河南南阳',
status: 'deceased', summary: '一生敦亲睦族,参与整理家族旧谱。',
note: '始祖 · 档案完整',
relatives: [
{ personId: '102', relation: '长子' },
{ personId: '103', relation: '次子' }
]
},
{
id: '102', appUserId: '2002', genealogyId: '1001', parentId: '101', name: '汤正国', relation: '长子',
generation: 13, generationName: '正字辈', branch: '长房', years: '1965—',
birthDate: '1965-05-12', deathDate: '', birthplace: '河南洛阳',
status: 'privacy', summary: '负责长房资料核对。',
note: '家谱管理员',
relatives: [
{ personId: '101', relation: '父亲' },
{ personId: '104', relation: '长子' },
{ personId: '105', relation: '女儿' }
]
},
{
id: '103', appUserId: '2003', genealogyId: '1001', parentId: '101', name: '汤正华', relation: '次子',
generation: 13, generationName: '正字辈', branch: '二房', years: '资料受限',
birthDate: '1968-09-03', deathDate: '', birthplace: '河南洛阳',
status: 'forbidden', summary: '资料仍在补充。',
note: '资料待补充',
relatives: [
{ personId: '101', relation: '父亲' },
{ personId: '106', relation: '长子' }
]
},
{
id: '104', appUserId: '2004', genealogyId: '1001', parentId: '102', name: '汤凯', relation: '长孙',
generation: 14, generationName: '凯字辈', branch: '长房', years: '1992—',
birthDate: '1992-06-01', deathDate: '', birthplace: '河南洛阳',
status: 'privacy', summary: '协助整理年轻一代成员资料。',
note: '档案已核对',
relatives: [{ personId: '102', relation: '父亲' }]
},
{
id: '105', appUserId: '2005', genealogyId: '1001', parentId: '102', name: '汤悦', relation: '长孙女',
generation: 14, generationName: '凯字辈', branch: '长房', years: '1995—',
birthDate: '1995-04-18', deathDate: '', birthplace: '河南洛阳',
status: 'privacy', summary: '参与家族影像与口述资料整理。',
note: '档案已核对',
relatives: [{ personId: '102', relation: '父亲' }]
},
{
id: '106', appUserId: '2006', genealogyId: '1001', parentId: '103', name: '汤晨', relation: '次孙',
generation: 14, generationName: '凯字辈', branch: '二房', years: '1998—',
birthDate: '1998-11-09', deathDate: '', birthplace: '河南洛阳',
status: 'privacy', summary: '二房成员资料已完成初步核对。',
note: '档案已核对',
relatives: [{ personId: '103', relation: '父亲' }]
}
]
export const joinApplications = [
{ id: 1, name: '汤志成', phone: '139****6421', relation: '自述为汤正华堂侄', appliedAt: '今天 10:24', status: 'PENDING' },
{ id: 2, name: '汤雨薇', phone: '136****2798', relation: '自述为汤正国之女', appliedAt: '昨天 18:02', status: 'PENDING' }
const cloneTreeMemberFixture = (member) => ({
...member,
relatives: member.relatives.map((relative) => ({ ...relative }))
})
export const listTreeMemberFixtures = (genealogyId) => {
const normalizedGenealogyId = String(genealogyId || '')
if (!normalizedGenealogyId) return []
return treeMembers
.filter((member) => member.genealogyId === normalizedGenealogyId)
.map(cloneTreeMemberFixture)
}
export const findTreeMemberFixture = (genealogyId, personId) => {
const normalizedGenealogyId = String(genealogyId || '')
const normalizedPersonId = String(personId || '')
if (!normalizedGenealogyId || !normalizedPersonId) return null
const member = treeMembers.find(
(item) => item.genealogyId === normalizedGenealogyId && item.id === normalizedPersonId
)
return member ? cloneTreeMemberFixture(member) : null
}
// 页面展示只能消费这个受控投影。privacy/forbidden 成员在 owner 边界即删除
// 生平、居住地、支系、亲属等字段,避免组件先取得完整对象再依赖模板隐藏。
const projectTreeMemberPresentation = (member) => {
if (!['privacy', 'forbidden'].includes(member.status)) {
return cloneTreeMemberFixture(member)
}
return {
id: member.id,
appUserId: member.appUserId,
genealogyId: member.genealogyId,
name: member.name,
relation: member.relation,
generation: member.generation,
status: member.status
}
}
export const listTreeMemberPresentationFixtures = (genealogyId) => {
const normalizedGenealogyId = String(genealogyId || '')
if (!normalizedGenealogyId) return []
return treeMembers
.filter((member) => member.genealogyId === normalizedGenealogyId)
.map(projectTreeMemberPresentation)
}
export const findTreeMemberPresentationFixture = (genealogyId, personId) => {
const normalizedGenealogyId = String(genealogyId || '')
const normalizedPersonId = String(personId || '')
if (!normalizedGenealogyId || !normalizedPersonId) return null
const member = treeMembers.find(
(item) => item.genealogyId === normalizedGenealogyId && item.id === normalizedPersonId
)
return member ? projectTreeMemberPresentation(member) : null
}
// F01—F09 共用这一组只读内容夹具。家谱 ID 与实体 ID 共同构成身份;页面和
// mock API 只能通过下方 list/find 查询取得深拷贝,不能把页面草稿写回正式列表。
const familyFeeds = [
{
id: '1', genealogyId: '1001', tag: '团圆记忆', time: '今天 10:24',
title: '端午家宴', content: '今年端午全家相聚,长辈讲起祖居旧事,孩子们也为大家拍下了新的全家福。饭后我们把照片和口述片段整理进家族档案,让这份热闹成为往后仍能翻看的共同记忆。',
author: '汤正国',
comments: [
{ id: '1', author: '汤淑华', time: '今天 10:42', content: '一家人能常常相聚,就是最珍贵的福气。' },
{ id: '2', author: '汤文清', time: '今天 11:08', content: '照片已经整理好了,晚些时候放进春节团圆相册。' }
]
},
{
id: '2', genealogyId: '1001', tag: '家族通知', time: '昨天 18:02',
title: '修谱资料征集', content: '请家人补充老照片中的人物姓名、拍摄时间和地点。无法确认的信息也可以先写下线索,由熟悉往事的长辈共同核对。',
author: '谱主', comments: []
}
]
const familyArticles = [
{
id: '101', genealogyId: '1001', category: '家风家训', title: '孝友传家的日常',
summary: '从敬老、睦亲与守信的小事里,看见家风如何代代相传。', author: '汤文正',
updatedAt: '2024 年 5 月 12 日',
paragraphs: [
'孝友传家,不只在族谱序言里,也在一家人每日的言行中。长辈以宽厚待晚辈,晚辈以耐心照料长辈,亲友之间守信互助,便是最朴素也最长久的家风。',
'勤俭并非一味节省,而是珍惜所得、量入为出,也愿意在家人需要时伸出援手。家中每一代人都可以用自己的方式,把这份分寸与担当继续传下去。',
'敬祖睦宗,最终是为了让今天的家人彼此认识、彼此关心。记录姓名与世代之外,也应留下真实的生活、共同经历和温暖记忆。'
]
},
{
id: '102', genealogyId: '1001', category: '家族往事', title: '祖居门前的那棵桂花树',
summary: '长辈口述的旧居记忆,以及每年中秋一家人相聚的故事。', author: '汤淑华',
updatedAt: '2024 年 5 月 10 日',
paragraphs: [
'祖居门前曾有一棵桂花树。每到中秋,院里都是清甜的香气,远道回来的家人也总能循着那股味道找到家门。',
'后来房屋几经修缮,桂花树仍被大家小心保留下来。它见过孩子长大,也见过长辈把往事一遍遍讲给后来人。'
]
},
{
id: '103', genealogyId: '1001', category: '族谱序言', title: '续修族谱序',
summary: '说明本次续修的缘起、资料来源与共同参与的家人。', author: '谱主',
updatedAt: '2024 年 5 月 8 日',
paragraphs: [
'本次续修以旧谱、碑记、户籍资料和长辈口述为基础,由家人共同核对补充。凡暂不能确认之处,均保留来源和疑问,留待后续查证。',
'愿这份记录不仅理清世系,也能保存家风、人物与共同记忆。'
]
}
]
const familyAlbums = [
{
id: '201', genealogyId: '1001', name: '2024 春节团圆', updatedAt: '今天更新',
description: '三代家人的团圆饭与院前合影', cover: '/static/assets/modules/family/f08/f08-reunion-hero.png',
photos: [
{ id: '20101', src: '/static/assets/modules/family/f08/f08-reunion-hero.png', alt: '春节团圆时三代家人的合影', caption: '除夕团圆 · 2024' },
{ id: '20102', src: '/static/assets/modules/family/f08/f08-family-portrait.png', alt: '家人在院落前的春节合影', caption: '院前合影 · 2024' },
{ id: '20103', src: '/static/assets/modules/family/f08/f08-reunion-table.png', alt: '家人围坐吃年夜饭', caption: '围桌守岁 · 2024' },
{ id: '20104', src: '/static/assets/modules/family/f08/f08-ancestral-home.png', alt: '祖居院落的复古旧照', caption: '祖居旧影 · 1968' },
{ id: '20105', src: '/static/assets/modules/family/f08/f08-ancestral-portrait.png', alt: '老一辈家人在祖居门前的合影', caption: '门前合影 · 1972' }
]
},
{
id: '202', genealogyId: '1001', name: '祖居旧影', updatedAt: '5 月 10 日更新',
description: '祖居、旧物与长辈珍藏的老照片', cover: '/static/assets/modules/family/f08/f08-ancestral-home.png',
photos: [
{ id: '20201', src: '/static/assets/modules/family/f08/f08-ancestral-home.png', alt: '祖居院落的复古旧照', caption: '祖居旧影 · 1968' },
{ id: '20202', src: '/static/assets/modules/family/f08/f08-ancestral-portrait.png', alt: '老一辈家人在祖居门前的合影', caption: '门前合影 · 1972' }
]
},
{
id: '203', genealogyId: '1001', name: '儿童成长', updatedAt: '持续更新',
description: '记录孩子们每一个值得珍藏的瞬间', cover: '/static/assets/modules/family/f08/f08-family-portrait.png',
photos: [
{ id: '20301', src: '/static/assets/modules/family/f08/f08-family-portrait.png', alt: '家人在院落前的春节合影', caption: '院前合影 · 2024' }
]
}
]
const cloneFamilyFeedFixture = (feed) => ({
...feed,
comments: feed.comments.map((comment) => ({ ...comment }))
})
const cloneFamilyArticleFixture = (article) => ({
...article,
paragraphs: [...article.paragraphs]
})
const cloneFamilyAlbumFixture = (album) => ({
...album,
photoCount: album.photos.length,
photos: album.photos.map((photo) => ({ ...photo }))
})
const listScopedFamilyFixtures = (items, clone, genealogyId) => {
const normalizedGenealogyId = String(genealogyId || '')
if (!normalizedGenealogyId) return []
return items
.filter((item) => item.genealogyId === normalizedGenealogyId)
.map(clone)
}
const findScopedFamilyFixture = (items, clone, genealogyId, entityId) => {
const normalizedGenealogyId = String(genealogyId || '')
const normalizedEntityId = String(entityId || '')
if (!normalizedGenealogyId || !normalizedEntityId) return null
const item = items.find(
(candidate) => candidate.genealogyId === normalizedGenealogyId && candidate.id === normalizedEntityId
)
return item ? clone(item) : null
}
export const listFamilyFeedFixtures = (genealogyId) =>
listScopedFamilyFixtures(familyFeeds, cloneFamilyFeedFixture, genealogyId)
export const findFamilyFeedFixture = (genealogyId, feedId) =>
findScopedFamilyFixture(familyFeeds, cloneFamilyFeedFixture, genealogyId, feedId)
export const listFamilyArticleFixtures = (genealogyId) =>
listScopedFamilyFixtures(familyArticles, cloneFamilyArticleFixture, genealogyId)
export const findFamilyArticleFixture = (genealogyId, articleId) =>
findScopedFamilyFixture(familyArticles, cloneFamilyArticleFixture, genealogyId, articleId)
export const listFamilyAlbumFixtures = (genealogyId) =>
listScopedFamilyFixtures(familyAlbums, cloneFamilyAlbumFixture, genealogyId)
export const findFamilyAlbumFixture = (genealogyId, albumId) =>
findScopedFamilyFixture(familyAlbums, cloneFamilyAlbumFixture, genealogyId, albumId)
// R03—R11 共用这一组只读记录夹具。它们只描述本地视觉预览,不冒充
// OpenAPI 响应;每个实体都显式携带 genealogyId,详情必须由家谱与实体 ID
// 共同定位。页面只能通过下方 list/find 选择器取得深拷贝,不能把草稿、完成
// 状态或新增记录写回这里。
const relativeRecordFixtures = [
{
relativeId: '301', genealogyId: '1001', relativeName: '汤文正一家', relationName: '族亲',
eventName: '新春贺礼', eventTime: '2024-02-10', giftAmount: 600,
recordContent: '新春团拜时赠予长辈的心意'
},
{
relativeId: '302', genealogyId: '1001', relativeName: '汤淑华', relationName: '家族长辈',
eventName: '寿宴礼单', eventTime: '2024-04-18', giftAmount: 1000,
recordContent: '汤老先生八十寿辰'
}
]
const ceremonyFixtures = [
{
ceremonyId: '501', genealogyId: '1001', ceremonyType: '祭祖', ceremonyTitle: '清明祭祖',
ceremonyTime: '2025-04-04', location: '汤氏宗祠',
ceremonyDesc: '缅怀先祖,整理祭扫礼序,并由长辈讲述家族往事。',
invitees: [
{ inviteeUserId: '2001', inviteStatus: '1' },
{ inviteeUserId: '2002', inviteStatus: '0' }
]
},
{
ceremonyId: '502', genealogyId: '1001', ceremonyType: '家宴', ceremonyTitle: '中秋家宴',
ceremonyTime: '2025-09-17', location: '祖居院落',
ceremonyDesc: '家人团聚,共叙近况并整理年度家族影像。',
invitees: [{ inviteeUserId: '2003', inviteStatus: '1' }]
},
{
ceremonyId: '503', genealogyId: '1001', ceremonyType: '团拜', ceremonyTitle: '新春团拜',
ceremonyTime: '2025-01-29', location: '家族礼堂',
ceremonyDesc: '新春相聚,向长辈问安并记录家族近况。', invitees: []
}
]
const growthRecordFixtures = [
{
recordId: '701', genealogyId: '1001', lineagePersonId: '101', recordTitle: '整理第一册旧谱',
recordDate: '1988-03', recordContent: '第一次独立整理家中保存的旧谱与口述线索。'
},
{
recordId: '702', genealogyId: '1001', lineagePersonId: '104', recordTitle: '第一次参与修谱',
recordDate: '2024-06', recordContent: '协助长辈核对照片人物与出生年份。'
}
]
const memoFixtures = [
{
memoId: '801', genealogyId: '1001', memoTitle: '修谱资料整理', remindTime: '本月底前',
memoContent: '补充老照片中的人物姓名和拍摄时间。', completedLabel: '待办理'
},
{
memoId: '802', genealogyId: '1001', memoTitle: '重阳敬老活动', remindTime: '10 月 11 日上午',
memoContent: '在祠堂集合,并确认接送长辈的车辆。', completedLabel: '已完成'
}
]
const meritRecordFixtures = [
{
meritId: '901', genealogyId: '1001', meritTypeLabel: '共同修缮', meritTitle: '修缮祠堂',
donorName: '汤氏家人共同参与', meritTime: '2024 年春', amount: null,
meritContent: '协助整理院落、修补门窗并登记旧物。'
},
{
meritId: '902', genealogyId: '1001', meritTypeLabel: '奖学助学', meritTitle: '支持后辈勤学',
donorName: '家族教育小组', meritTime: '2024 年夏', amount: null,
meritContent: '为家族中努力求学的孩子提供书籍与经验分享。'
}
]
const cloneRecordFixture = (record) => ({
...record,
...(Array.isArray(record.invitees)
? { invitees: record.invitees.map((invitee) => ({ ...invitee })) }
: {})
})
const listScopedRecordFixtures = (records, genealogyId) => {
const normalizedGenealogyId = String(genealogyId || '')
if (!normalizedGenealogyId) return []
return records
.filter((record) => record.genealogyId === normalizedGenealogyId)
.map(cloneRecordFixture)
}
const findScopedRecordFixture = (records, idField, genealogyId, entityId) => {
const normalizedGenealogyId = String(genealogyId || '')
const normalizedEntityId = String(entityId || '')
if (!normalizedGenealogyId || !normalizedEntityId) return null
const record = records.find(
(item) => item.genealogyId === normalizedGenealogyId && item[idField] === normalizedEntityId
)
return record ? cloneRecordFixture(record) : null
}
export const listRelativeRecordFixtures = (genealogyId) =>
listScopedRecordFixtures(relativeRecordFixtures, genealogyId)
export const findRelativeRecordFixture = (genealogyId, relativeId) =>
findScopedRecordFixture(relativeRecordFixtures, 'relativeId', genealogyId, relativeId)
export const listCeremonyFixtures = (genealogyId) =>
listScopedRecordFixtures(ceremonyFixtures, genealogyId)
export const findCeremonyFixture = (genealogyId, ceremonyId) =>
findScopedRecordFixture(ceremonyFixtures, 'ceremonyId', genealogyId, ceremonyId)
export const listGrowthRecordFixtures = (genealogyId, lineagePersonId = '') => {
const records = listScopedRecordFixtures(growthRecordFixtures, genealogyId)
const normalizedPersonId = String(lineagePersonId || '')
return normalizedPersonId
? records.filter((record) => record.lineagePersonId === normalizedPersonId)
: records
}
export const findGrowthRecordFixture = (genealogyId, recordId) =>
findScopedRecordFixture(growthRecordFixtures, 'recordId', genealogyId, recordId)
export const listMemoFixtures = (genealogyId) =>
listScopedRecordFixtures(memoFixtures, genealogyId)
export const findMemoFixture = (genealogyId, memoId) =>
findScopedRecordFixture(memoFixtures, 'memoId', genealogyId, memoId)
export const listMeritRecordFixtures = (genealogyId) =>
listScopedRecordFixtures(meritRecordFixtures, genealogyId)
export const findMeritRecordFixture = (genealogyId, meritId) =>
findScopedRecordFixture(meritRecordFixtures, 'meritId', genealogyId, meritId)
export const notifications = [
{
id: 'review-1',
title: '申请待审核',
content: '汤志成申请加入汤氏家谱,请核实亲属关系。',
body: '汤志成申请加入汤氏家谱,请核实申请人的亲属关系与世代信息后完成审核。',
time: '今天 10:28',
source: '汝南汤氏家谱',
unread: true,
targetType: 'GENEALOGY_REVIEW',
targetParams: { genealogyId: '1001' },
targetLabel: '前往入谱审核'
},
{
id: 'approved',
title: '入谱申请已通过',
content: '你申请加入汝南汤氏家谱的请求已通过。',
body: '你申请加入汝南汤氏家谱的请求已通过,现在可以查看家谱与家族动态。',
time: '昨天 18:10',
source: '汝南汤氏家谱',
unread: false,
targetType: 'GENEALOGY_HOME',
targetParams: { genealogyId: '1001' },
targetLabel: '查看我的家谱'
}
]
const cloneNotificationFixture = (notification) => ({
...notification,
targetParams: { ...notification.targetParams }
})
export const listNotificationFixtures = () =>
notifications.map(cloneNotificationFixture)
export const findNotificationFixture = (notificationId) => {
const normalizedId = String(notificationId || '')
if (!normalizedId) return null
const notification = notifications.find((item) => item.id === normalizedId)
return notification ? cloneNotificationFixture(notification) : null
}
export const joinApplications = [
{ id: '1', name: '汤志成', phone: '139****6421', relation: '自述为汤正华堂侄', appliedAt: '今天 10:24', status: 'PENDING' },
{ id: '2', name: '汤雨薇', phone: '136****2798', relation: '自述为汤正国之女', appliedAt: '昨天 18:02', status: 'PENDING' }
]
-46
View File
@@ -1,46 +0,0 @@
// 全量视觉交付的本地页面目录:只保存页面内容与状态,样式由 ModulePage 的六类母版统一维护。
export const pageCatalog = {
f03: { number: 'F-03', title: '动态详情', subtitle: '一段属于家人的共同记忆', template: 'detail', sections: [['端午家宴', '今年端午全家相聚,留下了许多温暖照片。'], ['家人评论', '愿家族和睦兴旺,岁岁平安。']], action: '写下评论' },
f04: { number: 'F-04', title: '谱文', subtitle: '收录家族文章、家训与往事', template: 'list', sections: [['家风家训', '代代相传的处世之道'], ['家族往事', '珍贵的口述与文字记录'], ['族谱序言', '一部家谱的起源']], action: '新建谱文' },
f05: {
number: 'F-05',
title: '谱文详情',
subtitle: '家族文字档案',
template: 'detail',
sections: [['家风家训', '孝友传家,勤俭立业;敬祖睦宗,诚实待人。'], ['收录时间', '2024 年 5 月 12 日']],
action: '收藏谱文',
states: {
empty: {
eyebrow: '谱文已失效',
title: '这篇谱文已无法查看',
copy: '内容可能已被作者删除或取消公开,请返回谱文列表查看其他内容。',
action: '返回谱文列表',
actionMode: 'back',
},
},
},
f07: { number: 'F-07', title: '家族相册', subtitle: '让每一张照片都回到家人身边', template: 'list', sections: [['2024 春节团圆', '18 张照片 · 更新于今天'], ['祖居旧影', '32 张照片 · 家族档案'], ['儿童成长', '46 张照片 · 持续更新']], action: '新建相册' },
r01: { number: 'R-01', title: '人物录', subtitle: '记录家族中值得铭记的人', template: 'list', sections: [['汤文正', '家谱管理员 · 第 18 世'], ['汤淑华', '家族长辈 · 第 17 世'], ['汤文清', '青年代表 · 第 19 世']], action: '新建人物' },
r03: { number: 'R-03', title: '贺礼簿', subtitle: '记录每一份家人之间的心意', template: 'list', sections: [['新春贺礼', '2024 年春节 · 12 条记录'], ['寿宴礼单', '汤老先生八十寿辰'], ['添丁祝福', '家族新成员的祝愿']], action: '新增贺礼' },
r04: { number: 'R-04', title: '编辑贺礼', subtitle: '如实留下礼仪往来记录', template: 'form', fields: ['贺礼名称', '赠送人', '日期', '备注'], action: '保存贺礼', note: '删除确认功能待接入' },
r05: { number: 'R-05', title: '礼仪活动', subtitle: '家族的重要时刻与礼序', template: 'list', sections: [['清明祭祖', '2024 年 4 月 4 日'], ['中秋家宴', '2024 年 9 月 17 日'], ['新春团拜', '2025 年 1 月 29 日']], action: '新建礼仪' },
r06: { number: 'R-06', title: '礼仪详情', subtitle: '清明祭祖', template: 'detail', sections: [['活动说明', '缅怀先祖,凝聚家人,共叙家风传承。'], ['参与人员', '已登记 26 位家人']], action: '编辑活动' },
r07: { number: 'R-07', title: '编辑礼仪', subtitle: '补全时间、地点与活动说明', template: 'form', fields: ['活动名称', '活动日期', '举办地点', '活动说明'], action: '保存活动', note: '发布提醒功能待接入' },
r08: { number: 'R-08', title: '成长日志', subtitle: '珍藏生命成长中的每一个瞬间', template: 'timeline', sections: [['第一次叫爸爸', '2024 年 3 月 · 家人共同记录'], ['入园第一天', '2024 年 9 月 · 留下勇敢的笑脸']], action: '记录成长' },
r09: { number: 'R-09', title: '人生事', subtitle: '记录值得回望的人生节点', template: 'timeline', sections: [['大学毕业', '2018 年 6 月 · 新的起点'], ['结为连理', '2022 年 10 月 · 家人见证']], action: '新增人生事' },
r10: { number: 'R-10', title: '家族备忘', subtitle: '把重要的事留给未来的自己', template: 'list', sections: [['修谱资料整理', '请在本月底前补充老照片信息'], ['重阳敬老活动', '10 月 11 日上午在祠堂集合']], action: '新增备忘' },
r11: { number: 'R-11', title: '功德记录', subtitle: '致谢每一份对家族的守护', template: 'list', sections: [['修缮祠堂', '2024 年春 · 家族共同支持'], ['奖学助学', '2024 年夏 · 鼓励后辈勤学']], action: '新增记录' },
n02: { number: 'N-02', title: '消息详情', subtitle: '家谱提醒', template: 'detail', sections: [['申请待审核', '汤文清申请加入家谱,请在审核页面查看。'], ['收到时间', '今天 10:28']], action: '标记已读' },
m02: { number: 'M-02', title: '个人资料', subtitle: '完善你的家谱身份信息', template: 'form', fields: ['头像昵称', '真实姓名', '常住地区', '个人简介'], action: '保存资料', note: '头像上传服务待接入' },
m03: { number: 'M-03', title: '账号与安全', subtitle: '保护你的家谱账号', template: 'settings', sections: [['登录密码', '建议定期更新'], ['绑定手机号', '用于登录和安全验证'], ['登录设备', '暂无异常设备']], action: '检查账号安全' },
m04: { number: 'M-04', title: '修改密码', subtitle: '设置新的安全密码', template: 'form', fields: ['当前密码', '新密码', '确认新密码'], action: '确认修改', note: '密码服务待接入' },
m05: { number: 'M-05', title: '修改手机号', subtitle: '更换用于登录的手机号', template: 'form', fields: ['当前手机号', '新手机号', '验证码'], action: '确认更换', note: '短信验证服务待接入' },
m06: { number: 'M-06', title: '帮助中心', subtitle: '常见问题与使用说明', template: 'settings', sections: [['如何创建家谱', '从家谱首页点击新建家谱'], ['如何邀请家人', '通过申请审核或邀请码加入'], ['资料隐私说明', '个人信息按权限展示']], action: '联系家谱助手' },
m07: { number: 'M-07', title: '意见反馈', subtitle: '你的建议会让家谱更好', template: 'form', fields: ['反馈类型', '问题描述', '联系方式'], action: '提交反馈', note: '反馈服务待接入' },
m08: { number: 'M-08', title: '应用推广', subtitle: '邀请亲友共建家族记忆', template: 'detail', sections: [['邀请家人', '将家谱分享给家人,共同补全家族故事。'], ['推广说明', '邀请功能与奖励规则待接入。']], action: '生成邀请海报' },
m09: { number: 'M-09', title: 'VIP 与订单', subtitle: '家谱服务与订阅记录', template: 'status', badge: '礼', lead: '当前没有订阅订单', note: 'VIP 服务开放后会在这里展示权益与订单', action: '查看服务说明' },
m10: { number: 'M-10', title: '关于家谱', subtitle: '传承每一段值得珍藏的家族记忆', template: 'settings', sections: [['用户协议', '功能待接入'], ['隐私政策', '功能待接入'], ['当前版本', '1.0.0'], ['退出登录', '仅本地演示']], action: '查看版本说明' }
}
@@ -42,8 +42,6 @@
{ "id": "app-modules-genealogy-transparent-shortcut-generation-poem", "output": "static/assets/modules/genealogy/transparent/shortcut-generation-poem.png", "width": 96, "height": 96, "alpha": true, "bytes": 8169, "sha256": "688e593fa88925ea00acf37570852a2dca9e1a505ba3b8107e0ddd3d146a6f4e", "provenance": "committed-binary", "rebuildable": false },
{ "id": "app-modules-genealogy-transparent-shortcut-members", "output": "static/assets/modules/genealogy/transparent/shortcut-members.png", "width": 96, "height": 96, "alpha": true, "bytes": 8931, "sha256": "c89824e8e19210dd746f56019a48c9a833abe4a210b222758a56c3d25dec9d0c", "provenance": "committed-binary", "rebuildable": false },
{ "id": "app-modules-genealogy-transparent-shortcut-tree", "output": "static/assets/modules/genealogy/transparent/shortcut-tree.png", "width": 96, "height": 96, "alpha": true, "bytes": 6636, "sha256": "cafe12a3fa800ca79d6c559baa533d7e26124ec8ac0072482ddb89ac2167422d", "provenance": "committed-binary", "rebuildable": false },
{ "id": "app-modules-notification-transparent-module-content-frame", "output": "static/assets/modules/notification/transparent/module-content-frame.png", "width": 2139, "height": 675, "alpha": true, "bytes": 254885, "sha256": "01cf572ed3f20d99e10a21fee6834dced385e71d6b14693b04c0cb49560a6fd3", "provenance": "committed-binary", "rebuildable": false },
{ "id": "app-modules-notification-transparent-module-field-frame", "output": "static/assets/modules/notification/transparent/module-field-frame.png", "width": 2132, "height": 443, "alpha": true, "bytes": 1065770, "sha256": "bdc65f33e1dbe05ae75562519b0080e2e5cdbe2dba720a6ac49b56b99be75ceb", "provenance": "committed-binary", "rebuildable": false },
{ "id": "app-modules-notification-transparent-n01-notice-card", "output": "static/assets/modules/notification/transparent/n01-notice-card.png", "width": 2139, "height": 675, "alpha": true, "bytes": 254885, "sha256": "01cf572ed3f20d99e10a21fee6834dced385e71d6b14693b04c0cb49560a6fd3", "provenance": "committed-binary", "rebuildable": false },
{ "id": "app-modules-profile-transparent-m01-profile-summary-card", "output": "static/assets/modules/profile/transparent/m01-profile-summary-card.png", "width": 2139, "height": 675, "alpha": true, "bytes": 254885, "sha256": "01cf572ed3f20d99e10a21fee6834dced385e71d6b14693b04c0cb49560a6fd3", "provenance": "committed-binary", "rebuildable": false },
{ "id": "app-modules-profile-transparent-module-content-frame", "output": "static/assets/modules/profile/transparent/module-content-frame.png", "width": 2139, "height": 675, "alpha": true, "bytes": 254885, "sha256": "01cf572ed3f20d99e10a21fee6834dced385e71d6b14693b04c0cb49560a6fd3", "provenance": "committed-binary", "rebuildable": false },
File diff suppressed because it is too large Load Diff
+221 -25
View File
@@ -1,7 +1,7 @@
# 家谱项目全量治理设计
> 日期:2026-07-22
> 状态:阶段 0 已完成;导航栈语义与 T01 大规模世系树设计已经三人终审,尚未实施业务代码
> 状态:阶段 0 已完成;导航任务 1—10 的静态实施和零债务门禁已经完成;A01/A04/A05 TAC 客户端与 M07 反馈客户端已经完成;MuMu 原生矩阵待执行;T01、认证、家谱工作区、M06 帮助、个人资料读写、通知读写、M10 服务端退出、M04 密码凭证与 M05 手机号换绑后端合同均处于硬门禁红灯
> 适用范围:当前 UniApp 家谱项目、根目录 OpenAPI 文档、全部活动页面、共享组件、测试、正式资产与后续真实接口接入
## 一、背景
@@ -509,7 +509,7 @@ MuMu 验证中
### 20.1 当前证据
只读扫描得到以下统一口径:
任务 3 实施前的只读扫描得到以下统一口径:
- 52 个活动页面中共有 `navigateTo 59``navigateBack 11``redirectTo 14``reLaunch 7`,合计 91 次直接调用。
- 活动共享组件另有 `navigateBack 2``reLaunch 2`,活动页面与组件共 95 次。
@@ -517,6 +517,8 @@ MuMu 验证中
- MuMu 已复现 F01→F03→“返回家族圈”后留下两个 F01,A01→A04→“登录”后留下两个 A01,T03 可连续叠出三个同路由页面。
- 栈深为 1 时直接进入 F03,当前 `PageHeader` 会回到固定 G01,而不是业务父页 F01。
任务 3 已把共享页头和自定义底栏的直接调用清零,并删除无活动消费者的通用页面旧入口;任务 4—8 依次迁移认证、G、T、F、R,任务 9 完成 N/M、安全通知目标、账号表单返回守卫与退出会话清理,任务 10 删除最后一个零生产消费者的 `TreeMemberForm.vue` 及其旧专属合同。当前 SFC 分段词法扫描的迁移债务已经清零:pages/components 中 `navigateTo``navigateBack``redirectTo``reLaunch``getCurrentPages` 与业务页面路径字面量均为零,声明式 navigator、动态 Uni 属性、Uni 对象逃逸与 `switchTab` 也为零;验证结果为 `MIGRATION-DEBT=0`。路由与页面栈合同分别只由 `utils/navigation-routes.js``utils/navigation.js` 持有,后续业务批次不得恢复页面私有路径或栈判断。
因此问题不是某几个按钮写错,而是项目没有统一表达“打开页面、替换步骤、返回来源、完成流程、切换根页和直接进入回退”的语义合同。
### 20.2 八类问题的五方案终选
@@ -537,7 +539,7 @@ MuMu 验证中
### 20.3 唯一所有者
- `utils/navigation-routes.js` 是 52 个活动路由的唯一语义注册表,拥有路由键、路径、页面类型、规范父页、父页参数映射、根页、必填参数、可选参数、允许来源和目标页允许消费的结果操作枚举。
- `utils/navigation.js` 是项目唯一允许调用 `uni.navigateTo``uni.redirectTo``uni.reLaunch``uni.switchTab``uni.navigateBack` 的业务模块。
- `utils/navigation.js` 是项目唯一允许调用 `uni.navigateTo``uni.redirectTo``uni.reLaunch``uni.navigateBack` 的业务模块;项目没有原生 tabBar`uni.switchTab` 在该模块内外都禁止
- 页面和组件只调用语义方法,不拼接页面路径,不保存 fallback URL,不接收后端原始跳转 URL。
- 注册表中的路径集合必须与 `pages.json` 的 52 个活动路由精确相等;缺失、重复和陈旧条目均使合同失败。
@@ -549,27 +551,27 @@ MuMu 验证中
openPage(routeKey, params, sourceKey)
打开普通子页;sourceKey 必须等于当前真实页面。当前已经是同一路由且关键参数相同则不重复入栈。
replaceStep(routeKey, params, sourceKey)
只替换同一流程中的临时步骤;sourceKey 同样必须来自当前真实页面,禁止用于“返回列表”。
goBack()
栈内有上一页时 navigateBack;没有时按当前路由的规范父页逐级回退。
returnTo(routeKey, targetParams = {}, result = null)
按路由键寻找最近实例并精确返回;targetParams 只用于目标不在栈内时构造合法回退 URL。
returnTo(routeKey, targetParams = {})
按路由键寻找最近实例并精确返回;显式 targetParams 必须与最近实例一致,目标不在栈内时才用于构造合法回退 URL;普通返回不产生流程结果
finishPage(routeKey, targetParams, result)
校验目标参数和类型化结果后调用 returnTo;结果只能包含 operation、entityId 和 refresh。
是完成并回传结果的唯一公开入口;调用方必须显式提供目标全部必填参数,当前来源页与目标页共同声明且实际存在的上下文字段必须相等;校验参数和类型化结果后精确返回,结果只能包含 operation、entityId 和 refresh。
goRoot(routeKey, params)
只接受 A01、G01、F01、M01 四个根语义;使用 reLaunch 清理旧流程。
handleBackPress(event, requestBack)
同步适配 UniApp 的 onBackPress:网关自己的 navigateBack 回调来源返回 false 放行,其余来源同步返回 true,并异步执行页面唯一 requestBack,避免递归拦截。
```
个公开语义方法中,除纯判断外的导航动作都返回 `Promise`,并共享一个在途转场锁:同一目标的重复调用复用同一个 Promise,其他并发转场明确返回忙碌结果。导航失败或被锁拒绝时必须回滚刚写入的一次性结果。
个公开导航语义方法都返回 `Promise`,并共享一个在途转场锁:相同参数和相同结果语义的重复调用复用同一个 Promise,其他并发转场明确返回忙碌结果。一次性结果写入必须与“取得新锁”原子发生;复用或忙碌调用不得改写结果,导航失败必须回滚。每次转场用独立 flight 身份释放锁,`success/fail` 必须在 Promise settle 前释放自己的 flight;迟到的 `complete` 只能清理原 flight,不能清掉已经开始的新转场。所有调用方导航参数、流程结果和返回守卫上下文只接受普通对象的 own enumerable data propertiesSymbol、访问器、不可枚举字段和原型继承字段一律拒绝,校验后只使用同一次读取形成的冻结快照,禁止重复 getter 读取或校验后别名篡改。`redirectTo` 只允许由网关内部的规范父链回退和目标缺栈返回使用;当前没有可公开授权的“替换步骤”边,因此不暴露无消费者的替换方法
一次性结果只存在于当前 JavaScript 进程,目标页消费一次后立即删除。字段键精确为 `operation、entityId(可选)、refresh``operation` 必须属于目标路由注册的 `resultOperations``entityId` 若存在必须为非空字符串,`refresh` 必须是布尔值。它不是领域数据持久化,不允许加入 `treeVersion、genealogyId、focusId、payload`,也不允许保存完整对象、表单内容、列表快照或接口响应。
一次性结果只存在于当前 JavaScript 进程。网关用模块内 `WeakMap` 为页面实例分配原始值身份令牌,结果 envelope 只保存令牌,不强引用或保存页面/Vue 实例。栈内返回时结果绑定反向搜索选中的最近目标令牌和该实例的规范业务参数;缺栈重建时绑定发起页令牌与完整目标参数。只有当前真实栈顶正是目标实例(或缺栈重建出的非发起页)且业务参数完全一致时才能消费,错页、同路由的更远实例和其他家谱上下文只能得到 `null`,也不得删除正确结果。结果必须在原生目标页 `onShow` 发生前随取得转场锁原子写入,消费一次后立即删除;新完成流程取得锁时淘汰已经错过目标生命周期的未消费旧结果,失败时不复活陈旧结果。字段键精确为 `operation、entityId(可选)、refresh``operation` 必须属于目标路由注册的 `resultOperations``entityId` 若存在必须为非空字符串,`refresh` 必须是布尔值。它不是领域数据持久化,不允许加入 `treeVersion、genealogyId、focusId、payload`,也不允许保存完整对象、表单内容、列表快照或接口响应。
`sourceKey` 只证明当前 JavaScript 进程内的一次真实导航:`openPage/replaceStep` 必须核对它与 `getCurrentPages()` 的当前真实路由一致。栈深为 1 或外部直接进入时,查询串里的 `sourceKey` 一律视为不可信并忽略,只按注册表的 `parent/parentParamMap` 建立回退目标;外部链接不能伪造来源合同。
`sourceKey` 只证明当前 JavaScript 进程内的一次真实导航:`openPage` 必须核对它与 `getCurrentPages()` 的当前真实路由一致。栈深为 1 或外部直接进入时,查询串里的 `sourceKey` 一律视为不可信并忽略,只按注册表的 `parent/parentParamMap` 建立回退目标;外部链接不能伪造来源合同。
### 20.5 根页与页头
@@ -599,20 +601,22 @@ goRoot(routeKey, params)
- A04 取消或“已有账号”返回 A01;注册并建立会话后 `goRoot(G01)`
- A05 取消返回 A01;只有未来真实重设接口成功才写入 `password-reset` 结果并回 A01。本地 `state=success`、计时器或视觉占位成功态只能普通返回,不得生成业务成功结果。
- A01 登录成功 `goRoot(G01)`;会话失效和退出成功也只允许 `goRoot(A01)`
- F02、F03 完成或返回精确 F01F06 新建回 F04编辑回 F05F09 上传完成回 F08
- 当前 F02、F06、F07、F09 只形成明确标注“尚未提交服务器”的独立本地预览;F03 评论草稿不插入评论列表、不清空、不增加计数,F05 收藏明确禁用,F10 明确未开放。F01—F10 均不产生写成功结果;F02/F03 返回精确 F01F06 新建回 F04编辑回精确 F05F09 无结果回同一 `genealogyId + albumId` 的 F08。真实写接口返回服务器 ID 后才能同轮启用完成结果
- `data/mock.js` 是 F 系列 feed/article/album 只读夹具的唯一 owner,只公开按 `genealogyId` 列表和按复合身份详情的深拷贝查询;跨谱、未知实体或缺失身份失败关闭。`utils/api.js::createFeed` 在 mock 模式以 `WRITE_UNAVAILABLE` 拒绝,不得修改列表冒充发布成功。
- R02 回 R01R04 回 R03R06、R07 回 R05。
- T04 保存后回 T01 并定位新成员;T05、T08 回当前 T03;T06 保存后回 T01 并刷新原焦点;T07 选择成员后回 T01 定位或进入 T03
- 当前 T04/T05/T06 只生成“尚未提交服务器”的本地预览,不产生写成功结果;用户确认放弃预览后,T04/T06 无结果回 T01T05 使用 `goBack()` 精确回原 T03 实例,T08 普通返回 T03,T07 可进入 T03。新增亲属、编辑成员和编辑关系的完成定位只能在真实版本化写接口同轮启用
- 当前阶段 `data/mock.js::treeMembers` 是唯一可变成员夹具 owner`utils/api.js` 是唯一写入口;T01/T03—T08 只能通过 `listTreeMemberFixtures(genealogyId)``findTreeMemberFixture(genealogyId, personId)` 取得含亲属数组深拷贝的快照。成员身份必须由家谱与成员复合定位,缺失、未知或跨家谱身份失败关闭;只有 T04 的明确首位成员模式允许没有 `personId`。Task 18 接入真实新图合同后必须原子删除该临时 owner、选择器和旧 `id/parentId` 模型,不保留双读适配层。
- N02 默认回 N01;通知业务目标失效、无权限或字段不足时留在 N02 的明确状态,不猜测页面。
当前 OpenAPI 已确认 `POST /genealogy/app/auth/register` 的成功响应复用 `LoginResult`,其 `LoginVo` 可返回 `token/accessToken/tokenValue`。因此 A04 的正式终点不是“注册后再登录”,而是保存有效会话后直接 `goRoot(G01)`;在真实注册与行为验证尚未接入前不得把当前占位反馈冒充注册完成。
2026-07-22 新线上 OpenAPI 已确认密码登录、短信登录和注册统一返回 `RAppLoginVo`,其 `data` 引用 `AppLoginVo`,唯一会话字段为 `access_token`。因此 A04 的正式终点不是“注册后再登录”,而是保存有效会话后直接 `goRoot(G01)`受保护旧快照的响应形状不再作为兼容读取路径,在真实注册与行为验证尚未接入前不得把当前占位反馈冒充注册完成。
### 20.7 T03 单实例成员轨迹
- T03 原生页面实例只保留一个。初始成员成功读取后先把轨迹初始化为恰好 `[initialPersonId]`;初始读取失败不建立轨迹。点击亲属只更新页面内 `personId` 和成员轨迹,不再 `navigateTo` 同一路由。
- T03 原生页面实例只保留一个。初始路由 `personId` 是不可变的宿主页路由身份,初始成员成功读取后先把轨迹初始化为恰好 `[initialPersonId]`;初始读取失败不建立轨迹。点击亲属只更新页面内活动成员 `personId` 和成员轨迹,不改 URL,也不`navigateTo` 同一路由。
- 新成员资料成功读取后才写入轨迹;读取失败保留原成员和原轨迹。
- 返回先逐项弹出成员轨迹,轨迹结束后才返回 T01、T07、R02 或实际来源。
- T05、T08 返回时刷新当前轨迹项,不新增 T03
- 如果 T03 已位于原生栈下方,再次打开同一 `genealogyId` 的 T03 时必须回到该实例,并用目标页允许的类型化一次性操作请求加载目标成员;不得创建第二个 T03。若栈中 T03 属于不同 `genealogyId`,网关返回 `T03_CONTEXT_CONFLICT` 并拒绝压栈调用方必须先通过根语义切换家谱上下文。
- 当前 T05 本地预览以 `goBack()` 返回并保留原 T03 宿主页身份、活动成员和轨迹,T08 普通返回也不新增 T03。未来真实成员更新结果只允许刷新与 `entityId` 相同的当前活动成员,不得切换轨迹或改写宿主页身份
- 如果 T03 已位于原生栈下方,再次打开同一 `genealogyId` 的 T03 时必须回到该实例,并用目标页允许的类型化一次性操作请求加载目标成员;不得创建第二个 T03。若栈中 T03 属于不同 `genealogyId`,网关返回 `T03_CONTEXT_CONFLICT` 并拒绝压栈;若迁移前遗留栈已有多个 T03,则返回 `T03_STACK_CONFLICT`,不得只激活最近实例后宣称栈已唯一。调用方必须先返回或通过根语义清理冲突上下文。
- 从直接链接进入 T03 且没有来源页时,规范父页为带当前成员定位参数的 T01;缺少 `genealogyId` 时继续回退 G01。
### 20.8 通知和外部进入
@@ -805,6 +809,10 @@ PATCH /genealogy/app/v2/genealogies/{genealogyId}/lineage/relationships/{relatio
- 现有人物搜索只需稳定返回字符串 `personId`;新增人物、编辑人物和编辑关系接口必须加入版本并发合同。当前 OpenAPI 没有 T06 所需的关系修改入口,因此新增上述关系 PATCH。不可变 `relationshipKind` 只允许 `PARTNER/PARENT_CHILD`,必须与服务端既有关系一致;请求使用以该字段为 discriminator 的 `oneOf`PARTNER 分支只更新 `relationType/status`PARENT_CHILD 分支只更新 `relationType/parentRole`。每个分支除 `relationshipKind` 外至少包含一个可修改字段,省略字段保持原值;只有 discriminator 的空更新返回 `422 RELATIONSHIP_PATCH_EMPTY`。参与人和 `relationshipKind` 不可在 PATCH 中偷换,也不以客户端删除再新增模拟修改。
- 旧 v1 `/genealogy/app/genealogies/{genealogyId}/lineage/tree` 保持原合同供既有消费者使用;当前 App 只接入上述四条明确的 `/genealogy/app/v2/...` 路径,不双读、不做运行时版本探测。
四条操作统一声明 `200/400/401/403/404/422/429/5XX`tree、overview 和 relationship PATCH 还必须声明 `409`。稳定业务码字段唯一固定为错误响应根层必填字符串 `businessCode`,对应 HTTP 响应使用 `oneOf` 分支中的单值 enumOpenAPI 3.1 也可使用 `const`。description、example 或无关 metadata 中出现同名文本都不构成合同。`generationRange` 固定为关闭额外字段的 `{ minGeneration, maxGeneration }`,两项均为大于等于 1 的整数;`minGeneration <= maxGeneration` 由运行时校验。
接口门禁分为两层,不能互相冒充:`tests/lineage-openapi-contract.ps1` 的静态层只验证 OpenAPI 能结构化表达的路径、参数全集与单字段边界、响应引用闭包、discriminator/oneOf、精确字段集、枚举、字符串 ID、错误响应、`If-Match`、JSON/YAML 引用一致性以及 v1 隔离。平铺 query Parameter Objects 即使在 OpenAPI 3.1 中也不能证明 FOCUS/BOUNDARY 的跨参数互斥;入口集合、引用、环、bucket 总和、隐私根、locator 分段首尾、cursor/version 绑定、409/422 真实行为及 PATCH 省略字段保持原值同样必须由运行时 validator 与部署集成测试验证,禁止用 description、example 或关键词命中制造假绿。支持 schema 的文件名不由客户端另造,固定根模型之外沿真实 `$ref` 闭包验证结构;YAML 静态层只证明限定块内的路径、operationId 和完整 component 引用闭包与 JSON 一致,字段语义仍必须在后端同版本导出后逐项复核。
### 21.10 明确删除的旧路径
同一迁移中删除:页面内置运行时 members、递归 `children/spouses`、单一 `parentId``fatherId/motherId``parentId` 双读、`person.id || person.personId`、API 或 fixture 的 `x/y`、数字 int64 ID、默认“族人/主支”语义兜底、顶层 `.map(toTreeNode)`、全量 CSS Grid track、多 `<view>` 拼线、Canvas 线叠 DOM 节点、选中态改尺寸和全局 `NODE_HALF_HEIGHT`
@@ -830,14 +838,202 @@ PATCH /genealogy/app/v2/genealogies/{genealogyId}/lineage/relationships/{relatio
性能门槛:单窗口不超过 500 人;`dataReady` 定义为规范图完成校验的时间点,`interactive` 定义为首帧绘制结束且命中索引可用,二者间隔不超过 800ms;输入到反馈 p95 不超过 100ms;持续手势帧耗时 p95 不超过 32ms;不连续出现两帧超过 100ms;20 次聚合跳转与搜索后驻留内存相对稳定态增长不超过 15%。每项 MuMu 时延指标至少采样 30 次并按 nearest-rank 计算 p95;手势帧由 renderjs 的 `requestAnimationFrame` 记录,输入延迟从视图层触摸时间戳量到下一完成帧;内存先预热 3 轮,再在相同空闲点比较 20 轮。不把全 App 冷启动混进 T01 门槛。未达到门槛时缩小窗口或进入列表,不能提高上限掩盖问题。
## 二十二、当前精确执行顺序
## 二十二、认证、TAC 与可访问安全设计
### 22.1 唯一所有者
- `utils/auth-verification.js` 唯一拥有 `APP_SMS_LOGIN/APP_REGISTER/APP_FORGOT_PASSWORD` 三个认证场景、4 位短信码和 require/verify 响应边界。
- `components/TacVerification.vue` 唯一拥有 TAC 浮层、renderjs 加载、可见生命周期、焦点和返回行为;页面不得直接操作供应商全局对象。
- `static/tac/js/jiapu-tac-adapter.js` 唯一拥有 TianAi challenge、proof 与 verify payload 映射。后端提供的 `tac.css/tac.min.js/icon.png/dun.jpeg` 保持原字节,由专项哈希合同保护。
- `utils/api.js` 唯一拥有已审查请求的 HTTP 200 严格 envelope、15 秒超时、RequestTask 中止和错误分类,并拥有认证密码摘要、`validToken` 发码、`AppLoginVo.access_token` 会话写入及反馈 wire payload。页面不复制 header、地址、响应兼容、token 读取或请求控制器。
### 22.2 页面与状态机
A01 默认短信登录;密码登录因为服务端请求体无法消费 TAC 票据而保持可见但不可用,微信登录也不得以视觉入口冒充已接通。A01/A04/A05 的发码顺序固定为:本地字段和协议校验 → `/captcha/require` → 严格 TAC challenge/verify → 取得服务端 `validToken``/genealogy/app/auth/sms/code`。验证码精确 4 位,注册或重设提交只消费短信码,不再重复 TAC。手机号变化、刷新 challenge、切换验证方法、返回或卸载都使旧上下文失效;超时、空响应、非 JSON、重复回调和迟到回调失败关闭并保留表单。短信发送与找回密码返回 `RVoid`,其 schema 未把 `data` 列为必填;客户端仍强制 HTTP 200 和整数成功 `code`,但把省略 `data``data:null` 都归一为 `null`,不把这一合法空响应误判为失败。有实体的 challenge、登录和注册响应继续要求 `data`
短信状态覆盖可发送、验证中、发送中、60 秒倒计时、失败重试、到期、手机号变更和重复点击。客户端倒计时不是服务端限流证据;最终仍须用真实服务验证手机号/IP/设备/租户限流、前后台恢复、过期和并发重放。注册成功只读取 `RAppLoginVo → AppLoginVo.access_token`,保存会话后直接进入 G01;找回成功返回 A01,不自动登录。
### 22.3 后端验证中心合同
`VerificationCenter` 是唯一授权 owner,供应商只提供 evidence,不直接签发或消费短信票据。`/captcha/require` 建立绑定 tenant、client、scene、规范化 subject 和风险策略版本的 `verificationSessionId``required=false` 也直接签发供指定 audience 使用的一次性 grant,不能让短信端点出现无票据分支。同一 session 只允许一个活动 challenge;刷新或切换方法使旧 challenge 失效但不清零累计失败。
`/captcha/verify` 的请求以 evidence/provider 为 discriminator 使用 `oneOf`,根和每个 payload 都 `additionalProperties:false`。provider、type、scene 和 subject 以服务端 challenge 记录为真,客户端字段不能改变绑定。只有供应商 evidence 与本地风险策略共同通过才签发 opaque `validToken`;票据绑定 session、tenant、client、scene、subject、challenge、method、assurance、audience 和过期时间。`/sms/code` 在同一事务中完成 `ISSUED → CONSUMED` 与唯一短信 outbox 创建;同一幂等键返回原结果,不同键或并发重放不能产生第二条短信任务。
当前后端门禁固定为:`API-AUTH-TAC-001` 补齐密码登录票据;`API-AUTH-TAC-002` 修复真实 challenge 空 500 与错误 envelope`API-AUTH-TAC-003` 关闭验证 schema 并建立 discriminator`API-AUTH-TAC-004` 落实 session、多方法、`required=false` 票据和原子消费。`AUTH-TAC-OPENAPI-CONTRACT BLOCKED` 解除前,`runtimeConfig.mode` 必须保持 `mock`
### 22.4 不降风控的可访问路径
TianAi 指针滑块不能因外层 dialog 可聚焦就被宣称为 TalkBack 或键盘可完成;不得生成固定键盘轨迹,也不得检测辅助技术后免验证。不存在 `accessibility=true``skipCaptcha`、供应商故障放行或客服直接发短信等旁路。
三人交叉质询后的统一 P0 是 provider-neutral 验证中心与可恢复的文字/中继 `MANUAL_REVIEW`。文字渠道只是可访问通信媒介,各 scene 仍有独立身份或号码控制证据。案件继承且不可改写原 session 的 subject/scene,具备去重、RBAC、主体/IP/设备/审核员限额、完整审计、服务时段、容量和 SLA;高风险找回或换号双人复核。坐席只提交决定,验证中心才可签票;异步案件和批准授权在合理期限内可恢复,用户重新进入原流程时才激活短时 token,避免在通知前过期,也不得要求残障证明。
中国大陆非交互风控供应商只进入限时 POC;必须在真实 UniApp Android WebView 中证明 TalkBack、外接键盘、Switch Access、弱网、超时、异常/重放票据、误杀和攻击拦截指标,达标后才可成为默认自动路径,不能预先宣称符合无障碍标准。音频验证码只作为另一个 POC 候选,必须验证可懂度、听障覆盖与 ASR 对抗,不能单独上线或成为唯一替代。设备断言只有在同一 subject 的已认证会话绑定硬件保护私钥、服务端 nonce、RP/App 绑定、`userVerification=required`、短时单次、防重放并检查撤销时才可独立放行;普通设备指纹、完整性或仅 user-presence 只能作为风险信号,注册和未绑定设备不得使用。
客户端现有壳层只完成 dialog 命名、说明关联、初始聚焦、Tab 圈定、Escape/Android 返回、焦点恢复、原生刷新/关闭、48px 目标和小视口滚动。最终必须在 MuMu 用 TalkBack、外接键盘与非拖动路径完成 A01/A04/A05;证据缺失时 `ANDROID-AUTH-ACCESSIBILITY-RELEASE BLOCKED` 必须保持红灯。
## 二十三、领域上下文与反馈提交设计
`utils/genealogy-context.js` 是当前家谱词法 ID 与失效 tombstone 的唯一持久 owner`utils/session.js` 是账号令牌边界。只在首次且没有历史上下文或失效标记时自动选择首个可用家谱;调用方给定的新列表不再包含历史 ID,或显式目标不可用时,必须清理 ID、写入 tombstone 并让用户明确重选,后续重载不能用列表第一项继续渲染。令牌损坏、退出和账号切换都同步清理 ID 与标记;导航一次性结果不得承担领域持久化。实际后台撤权仍需 workspace 在 onShow 或失效事件中重新取得服务端列表,当前基础不能被表述为实时权限刷新已完成。
M07 的唯一接口 owner 是 `appApi.submitFeedback`。请求只允许 `feedbackContent/feedbackType/contactInfo` 三个普通字符串数据字段;内容必填,类型和联系方式可选且无客户端枚举映射;请求选项不能覆盖认证要求。remote 只接受 `POST /genealogy/app/feedback` 的 HTTP 200 与整数成功 `code`,反馈响应未声明 `data` 必填且页面不消费实体;mock 必须抛 `WRITE_UNAVAILABLE`。页面提交中锁定表单并捕获规范快照;成功和 uncertain 回流都再次核对当前快照,保留回执或未知结果并阻止原样重复写,迟到输入保持为尚未提交的新内容。超时、断网、意外 2xx/3xx、HTTP 408/5xx 或响应失真进入 `uncertain`,只有确定拒绝允许重试。本地不持久保存反馈原文或哈希 tombstone;跨重启 at-most-once 必须由未来服务端幂等键或状态查询合同解决,不能以隐私数据、无期限锁或伪保证替代。
### 23.1 家谱工作区只读合同
家谱工作区第一批唯一选择 `GET /genealogy/app/genealogies/mine` 持有当前账号可访问集合,选择 `GET /genealogy/app/genealogies/{genealogyId}/overview` 持有 G05 展示;语义重复的 `GET /{genealogyId}` 不同时接入。页面不把 fixture 与远端事实混用,也不在两个详情响应之间择优补字段。
线上 `AppGenealogyVo.genealogyId` 当前是 JSON `integer/int64`。最大合法 int64 经 JavaScript JSON 解析后会不可逆失真,事后 `String()` 无法恢复,因此响应身份必须改为非空词法字符串;URL path 在 wire 上本是文本,手写客户端可保持词法字符串,不机械把 path 声明本身当成同一阻塞。仅拒绝 unsafe number 可以失败关闭,却会使 OpenAPI 合法用户永久不可用,只能用于关闭功能开关的预研,不能作为正式兼容方案。
首批最小实体只消费 `genealogyId/genealogyName/canView/canManage/canEditContent/roleType`。两层响应 envelope 的 `code/data` 与这些实体字段必须进入 `required`;ID、名称为非空字符串,三项 capability 为布尔值,`roleType` 提供至少两个稳定非空枚举供 G01 分组和标签。其他字段保持可选:地点、堂号、人数、简介等有值才展示;未知额外响应字段允许忽略。若产品坚持保留当前 fixture 的来源、管理者、认证、始祖、上级谱、支系、更新时间和激活人数,则后端必须另补合同;首批不为复刻 mock 强制 22 个字段全部必填。
`canView` 是进入 `availableIds` 的授权投影,不能从 `roleType/status/memberStatus` 猜值;后端也可以改为能够由自动化证明“`/mine` 只返回当前仍可查看 ACTIVE 成员”的等价合同。G01 仅在新列表成功校验后 reconcile;网络、超时、5xx 和畸形响应保留旧现场并显示错误,明确无权、撤权或不存在才写 tombstone。G05 每次加载先清空旧数据、取消迟到请求,只消费 `/overview`;能力缺失按最低权限处理,不回退本地角色。
当前线上 OpenAPI 没有有效 security 声明且媒体写作 `*/*`,但无令牌实测三条读取均被拒绝、实际 Content-Type 为 JSON,因此两项是必须修复的发布文档质量问题,不单独声称已经公开泄漏。真正发布门禁还包括有效令牌下的无凭证、跨账号、撤权、删除、401/403/404/5xx、畸形 JSON 与取消反例。当前部署使用 HTTP 200+业务 `code=401`;后端可以保留业务码承载或改为规范 HTTP 状态,但文档、运行时 validator 与部署行为必须一致。
`tests/genealogy-workspace-openapi-contract.ps1` 只读取受保护的同版本 JSON/YAML,固定上述响应身份、typed envelope、required 与 capability/role 边界;当前旧双导出与线上文档都不能通过。门禁关闭前不建立 G01/G05 专属字段 adapter,不让客户端成为第二份猜测合同。问题固定为 `API-GENEALOGY-WORKSPACE-001` 无损身份与最小 schema 闭包、`API-GENEALOGY-WORKSPACE-002` 可访问集合与能力投影、`API-GENEALOGY-WORKSPACE-003` 错误语义及对象级授权行为。
### 23.2 M06 帮助内容只读合同
M06 第一批唯一选择 `GET /genealogy/app/help-articles` 持有完整 FAQ 列表。线上 `HelpArticleVo` 已同时包含 `helpCategory/helpTitle/helpContent`,所以单页手风琴不再调用 `/{helpId}`;详情端点只保留为未来文章深链或其他 surface 的候选,不进入当前页面。这样当前页面不读取、比较、缓存、序列化或回传 `helpId`,线上 JSON `integer/int64` 虽仍是未来详情债务,却不会参与 M06 身份或行为。
成功响应必须由 `RListHelpArticleVo` 唯一拥有,并把 `code/data` 设为 required`data` 是允许为空的 `HelpArticleVo[]`。每行只要求 required、非空的 `helpCategory/helpTitle/helpContent`:分类是可直接展示的标签,正文首版明确为纯文本,数组只含当前可发布文章且顺序就是展示顺序。分类 enum、详情 ID、封面、浏览量、状态和排序字段都不由客户端消费;“全部”是唯一客户端分类值。富文本、Markdown、图片和文章详情只有在另立格式与内容安全合同时才可进入。
adapter 必须使用 allowlist 投影为 `{category,title,content}`,不得 spread 原对象。每次合法响应先按原始顺序分配仅限当前 generation 的 ordinal 展示键,再进行搜索和分类;筛选后的 index 绝不能成为 key。搜索、分类、刷新或原子替换列表前清空展开项;唯一列表 controller 与 generation 共同拒绝取消后的迟到响应。重复标题或正文不会产生 key 冲突,也不能据此生成持久身份。
页面状态固定为加载、正常、服务端空列表、搜索/筛选无结果、失败可重试和认证失效;失败不得回退成本地五条内容并冒充线上成功。搜索只匹配标题与纯文本正文,分类从返回标签按首次出现顺序动态去重。分类与标题使用原生按钮语义并满足至少 44dp 触控目标;分类补 `aria-pressed`,问题补 `aria-expanded/aria-controls`,加载、计数、失败和展开状态提供适当播报。最终系统字号、TalkBack、焦点和视觉只能在 MuMu 验收。
当前受保护 JSON/YAML 仍把列表写成通用 `ListResult/RList`;线上虽已出现 `RListHelpArticleVo/HelpArticleVo`,两者仍无 `required`,正文格式、仅发布与排序保证也未定义。匿名实测列表、带分类列表和详情均为 HTTP 200+`{code:401,data:null}`,而线上文档声明 HTTP 401 string 且 operation 没有有效 security。后端可以选择规范 HTTP 401 或稳定业务 401,但文档、部署和 validator 必须一致。`tests/help-center-openapi-contract.ps1` 当前输出 `HELP-CENTER-OPENAPI-CONTRACT BLOCKED`;问题固定为 `API-M06-001` 专用响应与最小 required 闭包、`API-M06-002` 纯文本/发布范围/顺序语义、`API-M06-003` 认证与错误承载一致性。门禁通过前不写 live-only adapter。
### 23.3 个人资料只读合同
`GET /genealogy/app/auth/profile` 是 M01 身份卡、M02 表单初值和 M03 绑定手机号展示的唯一 wire owner。首批不消费 `userId/avatar/status/tenantId/userNo/sex/birthday/registerSource/loginIp/loginDate/clientKey/deviceType`;数字 ID 与状态字典因此不构成本批门禁。M01 当前显示的“创建者”是家谱级角色,不属于账号 profile,必须删除而不是向后端索要错误字段。
成功响应固定为 `RAppProfileVo → AppProfileVo`envelope 的 `code/data` required。wire 实体仅把 `phone` 设为 required,并要求 canonical `^1[3-9]\d{9}$``nickName/realName/email` 可选,省略是唯一“未设置”形态,出现则拒绝 null、空串和边界空白,姓名为 1—30 字符,邮箱为有效格式且 1—100 字符。把四项全部 required 会让没有实名或邮箱的合法旧账号拖垮 M01/M03;省略可选字段后由 adapter 统一为空串,不是旧字段兼容或双模型。GET 只定义读取;未来 PUT 必须另证省略字段是否保持原值并只发送 dirty fields,不能在本批预判。
唯一 profile normalizer 在 mock 与 remote 中输出固定 `{maskedPhone,phoneAccessibleLabel,nickName,realName,email}`。原始手机号只在函数局部完成格式校验和掩码,页面、缓存、错误详情、日志与路由不得出现明文;可选字段只有真正缺席才规范成空串,出现但非法时整份响应失败。所有其他响应字段使用 allowlist 丢弃。`appApi.getProfile` 必须经 `resolveRuntimeMode()` 区分 mock/remote;非法配置失败关闭,remote 走严格 envelope、15 秒超时和 request controller,不以 `hasRemoteConfig() ? remote : fixture` 把错误配置伪装成本地数据。三个页面可以各自读取同一 adapter,但不建立跨会话缓存。
M01 在 `onShow` 刷新并以 controllergeneration 拒绝迟到结果;资料 loading/error 只替换身份卡,服务菜单和底栏不因普通读取失败而消失。旧 `query.state=error` 与“重新查看即 ready”是假状态,接线时删除;通知未读数在通知域接通前不得与真实 profile 混装为线上事实。M02 首次加载成功后再填充三个字段并重设 baseline,加载不能制造脏表单;普通 GET 失败可重试,编辑期间不后台刷新覆盖输入,保存仍明确是本地校验,不能冒充 PUT。M03 只让手机号行局部加载/失败,密码入口不依赖 profile;M05 的当前手机号展示在真正 remote 前也必须消费同一掩码 owner 或隐藏,不能保留 fixture。
账号失效交给会话 owner,普通 network/timeout/5xx/畸形响应只产生可重试读取失败,没有写请求的 uncertain 状态。实施测试必须证明 optional 缺席、出现非法值、明文不泄漏、超大 `userId/avatar` 丢弃、错误配置、取消、迟到回调、M01/M03 局部失败和 M02 baseline。交互同时改为原生按钮,补加载播报、M02 字段错误关联与聚焦、44dp 目标、长昵称换行和装饰图隐藏;最终系统字号、TalkBack、纹理对比和返回流程仍只由 MuMu 验收。
当前受保护双导出仍引用通用 `ObjectResult/RObject`;线上 `RAppProfileVo/AppProfileVo` 没有 required、phone pattern 或姓名/邮箱边界,GET operation 也缺有效 security/clientid。匿名真实响应是 HTTP 200+业务 `code=401`,文档却列 HTTP 401 string。`tests/profile-openapi-contract.ps1` 当前输出 `PROFILE-OPENAPI-CONTRACT BLOCKED`;问题固定为 `API-PROFILE-READ-001` 专用响应与最小字段闭包、`API-PROFILE-READ-002` 可选字段与隐私投影、`API-PROFILE-READ-003` 认证/媒体/错误一致性。门禁通过前不写 live-only adapter。
### 23.4 通知读取与已读状态合同
通知必须分成读取批次和写入批次,不能为了让页面看起来完整而在同一个本地 clone 中伪造读写闭环。读取只由不带 `readStatus` 筛选的 `GET /genealogy/app/notifications``GET /genealogy/app/notifications/unread-count` 持有;前者返回当前账号完整活动通知集合,集合最多 200 条、按最新优先,后者精确统计同一集合中 `readStatus=UNREAD` 的条目。两个独立请求之间若有新消息或多端读状态变化,短暂不相等是合法并发结果,页面分别展示成功响应并在下一次刷新收敛。
读取成功的最小 wire 形状为 `RListNotificationVo → NotificationVo[]``RNotificationUnreadCount → int32`。两层 `code/data` required;计数范围为 0—200。通知首批只 required `noticeTitle/noticeContent/publishTime/readStatus`:标题 1—50,正文 1—1000、完整且为 plain text,时间为带时区的 RFC3339,状态精确枚举 `READ/UNREAD`。客户端不解释 HTML、Markdown、服务端 URL 或 `bizType`,也不从标题、类型或摘要猜业务目标。N01 只将摘要显示限制在最多 160 个 Unicode 字素,N02 必须持有同一响应中的未截断正文。
读取 adapter 首版公开模型固定为 `{snapshotKey,title,content,publishedAt,unread}``snapshotKey` 使用成功响应 generation 与映射前 ordinal 组成的词法 key;裸 ordinal、数组筛选后 index、服务端 int64 ID 和内容哈希都不能成为页面身份。唯一内存快照不可变且不落盘;成功刷新原子替换 generation,退出或账号切换立即清空。N02 在进入时解析并持有该 generation 的完整条目,应用重启、旧 generation、直接构造或未知 key 统一显示“请返回消息中心重新打开”,不能虚构“服务端已删除/已撤回”。
读取批次显式丢弃 `notificationId/genealogyId/senderUserId/senderPhone/bizId/bizType/noticeType` 等服务端字段;N01 的通用审核 CTA、空态 G10 按钮和 N02 目标按钮一并删除。只有后端以后提供闭合的 `bizType → route key+必填词法参数+权限/失效语义` 字典,并为每种目标给出越权、删除和跨谱反例,才能另立目标分流批次;任何原始 URL 都不得执行。M01 与 G01 共同消费未读数 owner,文案只称“未读消息”,可见数大于 99 时显示 `99+`,可访问名称仍包含真实数量;加载或错误只影响各自消息入口,不锁死根页其他功能。
写入批次由 `POST /genealogy/app/notifications/{notificationId}/read``POST /genealogy/app/notifications/read-all` 唯一持有。此时唯一 notification controller 可以从同一个严格列表响应私有保留 `notificationId`,但页面模型、路由、日志和持久缓存仍只见 `snapshotKey`;ID 必须在列表实体与 path 中同为 1—128 位 URL-safe opaque string,禁止 int64 经 JavaScript 解析后再转字符串。该迁移必须原子删除首版“完全丢弃 ID”的内部实现和 N01/N02/M01/G01 所有 fixture 计数与本地 clone 写入口,不保留双 owner。
单条已读和全部已读对当前账号必须幂等,重复调用成功且无重复副作用。认证失效返回稳定 401;不存在与跨账号单条 ID 统一为 404 `NOTIFICATION_NOT_AVAILABLE`,避免泄露实体存在性。read-all 的截止点是服务端接收该请求时当前账号已经存在的活动通知,截止点之后并发到达的消息保持未读;成功后客户端重取列表和未读数,不用本地递减猜结果。超时、断网、HTTP 408/5xx 或畸形响应属于结果未知,依靠幂等重试或重新读取收敛;明确 4xx 才是确定拒绝。
当前受保护双导出把列表返回写成通用 `ListResult/RList`,完全缺少 unread-count 路径与专用通知模型;线上虽出现专用 VO 和四条操作,但 wrapper/VO 无 required`readStatus` 无枚举、内容无长度/纯文本/完整性、列表无容量和顺序,ID 仍是 int64operation 也缺有效 security/clientid。匿名 list/count 实测均为 HTTP 200+业务 `code=401`,与文档 HTTP 401 string 冲突。`tests/notification-read-openapi-contract.ps1``tests/notification-read-state-openapi-contract.ps1` 当前分别输出 `NOTIFICATION-READ-OPENAPI-CONTRACT BLOCKED``NOTIFICATION-READ-STATE-OPENAPI-CONTRACT BLOCKED`;问题固定为 `API-NOTIFICATION-READ-001``003``API-NOTIFICATION-STATE-001``003`。双门禁通过前不写 live-only adapter,也不把本地已读行为称为成功。
### 23.5 M02 个人资料写入合同
M02 继续只使用 `PUT /genealogy/app/auth/profile`,不同时发布 PATCH 或第二写入口。由于页面只拥有 `nickName/realName/email`PUT 必须在 operation 与专用 `AppProfileMergeUpdateBody` 中明确是原子 dirty-only merge,而不是整个 profile replacement:只允许出现 1—3 个真正改变的可编辑字段,出现字段更新、省略字段保持,额外字段关闭;同一 payload 重复设置相同值不能产生重复通知或其他业务副作用。后端若无法证明 presence-aware merge,就必须先替换现有操作,客户端不能从“字段 optional”推断安全。
`nickName` 出现时必须是去边界空白的 1—30 字符,空串和 null 均非法;这允许没有昵称的旧账号只修改其他字段,但不允许把已有昵称删除。`realName/email` 的精确空串只在 request command 中表示清空,省略仍表示保持;非空值分别满足 1—30 和 email 格式/1—100。null、纯空白、边界空白都非法,服务端不以隐式 trim 把空白偷偷解释成 clear。GET 和成功响应中,清空后的可选字段继续以属性省略表达,不能把请求命令形状泄漏回读取模型。
并发只使用一个 opaque `profileVersion` owner。`AppProfileVo.profileVersion` required,值为 1—128 位 URL-safe stringPUT required `If-Match` 携带同一 token,请求 body 不重复版本。后端以当前 principaltenantversion 原子 compare-and-set,成功 200 返回完整 canonical `RAppProfileVo` 与新版本;旧版本返回 409,唯一稳定码固定为 `PROFILE_VERSION_CHANGED`。本项目 T01 已使用 body versionIf-Match409 模式,资料写入沿用同一并发语义;H5 CORS 必须允许 `If-Match`
客户端先依赖 23.3 的 GET 取得 canonical 初值和版本,完成异步回填后建立 baseline。`normalizeProfileUpdate` 只从普通自有数据属性提取脏字段,禁止 getter、symbol、prototype、avatar/sex/birthday 和额外属性;clean 不发请求。提交开始时冻结三个输入并捕获规范快照、版本与 session generation;成功只接受严格 HTTP 200 typed envelope,以返回模型原子回填表单和 baseline。确定的 400/401/409/422 保留草稿并进入对应状态,409 不静默覆盖。
超时、断网、408/5xx、取消或畸形成功响应都是 outcome unknown。客户端不得自动重复 PUT,而先重新 GET:若本次所有脏字段均等于提交值,视为已提交;仍等于旧 baseline 才可由用户重试;出现第三值或版本无法归因则进入 conflict,并保留当前草稿供用户明确选择重新载入或基于最新值继续。页面卸载、退出和账号切换中止等待并清空未持久草稿;RequestTask 取消不证明服务端没有落库,旧 session generation 的迟到响应永远不能污染新账号。
M02 当前把 `currentUser.name` 同时填入昵称和真实姓名,是必须删除的 PII 伪造;500ms 定时器只形成本地预览,不是接口状态。真正实施时状态至少包括 loading、ready/dirty、saving、success、error、uncertain、conflict、auth-expired;保存期间锁定输入和返回,成功重置 dirty,失败保留草稿。头像假按钮、相册权限和 int64 avatar 不混入本批;“邮箱用于接收通知”在验证/送达合同缺失时删除。原生输入和按钮补齐 `aria-invalid/aria-describedby`、错误关联、首错聚焦、busy/status 播报、email 键盘类型与 44dp 目标,最终只由 MuMu 验收。
受保护双导出仍使用旧 `ProfileUpdateBody`,缺 realName/email,示例还出现 schema 外 `regionCode/addressDetail`,成功为 generic `RObject`。线上改为 `AppProfileUpdateBody → RAppProfileVo`,但 body 无 required/minProperties/关闭额外字段/merge/version,响应无 requiredoperation 无 security/clientid,媒体还是 `*/*` 且只列 200/401。`tests/profile-update-openapi-contract.ps1` 当前输出 `PROFILE-UPDATE-OPENAPI-CONTRACT BLOCKED`;问题固定为 `API-PROFILE-UPDATE-001` 唯一 merge owner 与字段命令、`002` 版本并发和 409、`003` typed 响应/认证/错误/CORS、`004` 超时对账与账号隔离。读取和写入门禁都通过前不接 M02 真实保存。
### 23.6 M10 当前设备退出合同
`DELETE /genealogy/app/auth/logout` 唯一语义是撤销 Authorization bearer 所属的当前设备 credential family,包括同一登录会话的 refresh 能力(如果未来存在);同账号其他设备保持有效。“退出全部设备”必须是另一条接口、另一层确认和另一份权限合同。200 只在撤销已经传播到所有鉴权节点、旧 access token 不能再访问任何受保护接口且旧 refresh 不能换取新 token 时返回;已经在鉴权前通过的并发业务请求无法回滚,产品文案不得承诺取消所有进行中操作。
DELETE 没有 bodyrequired SaToken 和与 token client 绑定的非空 clientid。为形成唯一幂等成功出口,凡能验证为该 client 历史签发的 active、revoked 或 expired credential,重复调用都返回相同的 HTTP 200 `RVoid`,不产生额外副作用;伪造、格式非法和 client 不匹配才返回 401 `RLogoutRejected`,稳定码只允许 `TOKEN_INVALID/TOKEN_CLIENT_MISMATCH`,它们不是撤销成功。200/401 均为 application/json 且 `Cache-Control: private, no-store`RVoid 的 integer code required,同时声明 400/429/500。
客户端唯一 owner 是服务级 `logoutCoordinator`,而不是 M10、A01 和 session 各存一份。一次同步临界段按顺序:捕获 A 的 token/clientid 和当前 session epoch;通过 session owner 立即 bump epoch 并且只清一次 token、家谱上下文与所有已登记账号缓存;使用显式 A 快照创建不绑定页面 controller 的 DELETE RequestTask;发布非敏感 attempt 并立即 `goRoot(A01)`。该同步段没有 await,创建请求同步失败也不恢复 token。M10 页面永远拿不到 token,请求不会因 M10 卸载或 reLaunch 主动 abort。
异步 callback、catch 和 finally 只能按 attemptId 更新 coordinator,绝不能再次 `session.clear()`;否则 A 的迟到响应会抹掉随后登录的 B。coordinator 的公开内存态固定为 `{attemptId,logoutEpoch,status}`status 为 `pending/confirmed/unconfirmed/not-revoked`,不含 token、header、响应 payload 或服务端消息。最多允许用同一 A 快照做一次同进程短时有界重试;不写 storage、日志或持久队列,也不从 session 重新取 token。
A01 仅在 session 仍为空、epoch 与 logoutEpoch 相等时订阅并原子消费一次状态;B 登录或 epoch 改变后丢弃 A 的迟到提示。进程被杀允许丢失提示,但本地退出已经持久完成。唯一主句始终是“已从本机退出”:pending 补“正在结束服务器会话”,严格 200 为 confirmednetwork/timeout/408/429/5xx、畸形响应或 generic 401 为 unconfirmedtyped 401/400/403 为 not-revoked。所有分支都留在 A01、不恢复 token、不返回 M10、不阻塞重新登录;状态必须可播报且不能只靠短 toast 或颜色。
M10 确认前的取消和 Android 返回只关闭确认层,零请求、零清理;确认后立刻退出可关闭弹层态并防双击,根导航失败时显示“本机已退出”遮罩且禁止返回受保护页面。当前文案“本机保存的密码不会被保留”没有任何密码存储 owner 证据,实施时改为“仅退出此设备,其他设备不受影响”。Mock 或错误 runtime config 也必须完成本机退出,并准确标记远端未确认,不能为了发请求把用户困在本地会话。
当前 M10 只做 `session.clear → close → goRoot(A01)`,本机边界正确但没有远端撤销、重复保护、epoch 或跨根提示;旧静态测试也锁定这条本地序列。受保护双导出有 DELETE、SaToken、clientid 和 200 `RVoid`,但缺范围、幂等、required 和错误;线上只有 200/401 `*/*`,又缺 operation security/clientid。`tests/logout-openapi-contract.ps1` 当前输出 `LOGOUT-OPENAPI-CONTRACT BLOCKED`;问题固定为 `API-LOGOUT-001` 当前凭证族与撤销传播、`API-LOGOUT-002` 幂等成功/拒绝模型、`API-LOGOUT-003` 安全/媒体/no-store/部署反例。门禁通过前不新增 logout API 代码,也不把本机退出写成服务端注销成功。
### 23.7 M04 登录态改密与统一密码凭证合同
当前本地双导出要求 `oldPassword/newPassword` 为 32 个十六进制字符的 MD5,线上 `AppPasswordChangeBody` 也只把它放宽为大小写十六进制;登录、注册和找回同样接受静态摘要。该摘要不是一次性 proof,而是后端登录入口直接接受的密码等价物,一旦从日志、代理、调试记录或终端泄漏即可重放;同时服务端看不到原始长度与 blocklist 命中,无法成为生产策略 owner。新合同不得长期双读 raw/MD5,也不得只改 M04 留下其他入口。A01 登录、A04 注册、A05 找回和 M04 改密必须同一批删除全部 MD5 wire fallback;只在认证 HTTPS 通道提交 raw `writeOnly` 密码,服务端使用独立盐与 Argon2id,无法使用时才采用合规 scrypt/PBKDF2。
密码 schema 只有两个 owner`CurrentPasswordSecret` 原样、不 trim,允许 1—64 Unicode code point 以兼容已有账号;`NewPasswordSecret` 在明确 NFC 规则后为 15—64 Unicode code point,允许空格、Unicode、粘贴和密码管理器,不设置字母/数字/符号组成规则。注册、找回与改密新值共用后者;登录与改密当前值共用前者。服务端在写入前执行常见/泄露密码 blocklist、账号级限速、当前密码重新认证和新旧不同;客户端只镜像即时提示,不能成为可绕过的权威。TAC 是反机器人证据,不代替当前密码;用户要求的登录/注册/找回 TAC 继续由认证合同持有,正常 M04 不另建一套 TAC。
M04 的唯一会话方案是 ALL,而不是返回并安装新 token,也不是保留旧 bearer。严格 HTTP 200 `RVoid` 只能在新 verifier 已持久化、账号 `credentialEpoch` 已原子递增,并且包括请求者在内的所有设备、所有 client 的既有 access/refresh/renewal 会话已跨鉴权节点失效后返回。方案 B 会要求 typed 新 token 和响应丢失恢复协议,当前 RVoid 无法承载;方案 C 会让可能被盗的旧 token 在改密后继续有效,均被否决。两个使用同一旧密码的并发请求必须通过服务端 CAS 至多一笔成功,另一笔返回 typed 409 `CREDENTIAL_VERSION_CONFLICT`
PUT required SaToken、非空 clientid、`application/json` 和关闭额外字段的 `PasswordChangeBody`body 只含 oldPassword/newPasswordconfirm 永不出端。200/400/401/409/422/429/500 都必须是 JSON 且 `Cache-Control: private, no-store`429 带 `Retry-After`。409/422 的 `RPasswordChangeRejected.businessCode` 只允许 `CREDENTIAL_VERSION_CONFLICT/CURRENT_PASSWORD_INCORRECT/NEW_PASSWORD_SAME_AS_CURRENT/PASSWORD_POLICY_VIOLATION`;服务端和网关日志、APM、分析、崩溃记录及错误消息不得含密码、摘要或请求体。
客户端在 dispatch 前由 session owner 持久化唯一非敏感 marker `{sessionEpoch,startedAt}`,不保存 token、密码、摘要、body、重试键或 operation id。明确未写的 400/422/429 原子清 marker 并留页;严格 200、401、409 均清同 epoch 全部账号态并回 A01。network、timeout、取消、畸形 2xx 或 5xx 在发出后属于结果未知,同样清秘密与本机会话、回 A01 并只提示“请尝试使用新密码重新登录”,绝不自动重试或宣称失败。冷启动发现同 epoch marker 时,在任何受保护缓存渲染前先清会话;新登录 bump epoch,旧 marker 和 A 的迟到响应不得清掉 B。无需新增 operation-status,重新登录就是最小对账路径。
页面实施时状态至少是 ready/submitting/known-error/unknown/success:提交中冻结三个输入、显隐控制、按钮和返回;确定字段错误聚焦并关联 `aria-invalid/aria-describedby`,显隐改为可键盘操作的原生按钮与 `aria-pressed`,目标至少 44dp,持续状态可播报。成功与 unknown 的跨根提示不能只靠短 toast。M03“建议定期更新”改为风险触发建议;M04 允许自动填充、粘贴和密码管理器。`tests/password-change-openapi-contract.ps1` 当前输出 `PASSWORD-CHANGE-OPENAPI-CONTRACT BLOCKED``API-PASSWORD-001``005`、密码登录 TAC、双设备/并发/故障注入和 MuMu 原生矩阵通过前,不修改 M04 的诚实本地预览。
### 23.8 M05 手机号换绑与统一短信码合同
M05 当前只展示脱敏 fixture,以 500ms 定时器验证新手机号和 4 位验证码并明确“不提交服务器”;没有当前密码、TAC、远端请求、会话迁移或结果未知状态。受保护双导出的 PUT body 是 `clientId/phone/smsCode`,线上则只有 `phone/smsCode` 并返回完整 profile;两者都缺 existing-factor 再认证、号码唯一性、会话撤销和 typed 错误。共享发码接口在线上还明确忽略权限。活动 bearer 加攻击者控制的新号验证码因此足以构成账号接管,不能接线。
三人比较了“共享发码 operation 按 scene 条件鉴权”和“专用受保护 operation”。标准 OpenAPI 3.x 无法把 operation-level security 与 body 中的 `sceneCode` 条件绑定;`security: [{}, {SaToken: []}]`、文字说明或 vendor extension 都不能让通用 validator、网关和 SDK 自动拒绝匿名 `APP_PHONE_CHANGE`,会产生 validator 允许而 runtime 拒绝的双合同。唯一方案是 `POST /genealogy/app/auth/phone/sms/code`required SaToken 与非空 clientid,闭合 body 只有 `phone/validToken`scene 在服务端固定,公共 `/auth/sms/code` 的 enum 删除 `APP_PHONE_CHANGE`。两个 operation 只分协议边界,底层仍调用同一 OTP 生成、存储和限流 owner,不复制策略。
最终 PUT 的身份闭环是活动 sessionraw `currentPassword`+新号 OTP。TAC 只防自动化,不能替代既有因子;新号 OTP 只证明新号码控制权。不强制旧号 OTP,因为旧号丢失是正常换绑原因且不会增加独立因子;成功事务改为持久化旧号安全通知 outbox。所有账号若不保证有密码,稳定返回 `STEP_UP_UNAVAILABLE` 并进入独立找回,M05 不得降级为 bearer+新号 OTP。最终 body 精确为 `currentPassword/phone/smsCode`,不含 currentPhone、clientId、validToken、challengeId 或供应商字段;它依赖 M04 先完成 raw-password/慢哈希迁移,当前 MD5 wire 不得复用。
短信码唯一 schema owner 是 `SmsCodeSecret`CSPRNG 生成恰好 6 位 ASCII 十进制字符串,保留前导零,TTL 5 分钟,60 秒重发冷却,最多 5 次失败,单次消费;重发原子废止旧码且不重置累计失败计数。同一 `(account,session/credentialEpoch,tenant,client,scene,newPhone)` 只有一个 active generation,服务端内部 generation 足以消歧,因此最终 PUT 不新增 challengeId/attemptId。A01/A04/A05/M05、注销等活动消费者、短信模板、生成器、OpenAPI、validator、页面和测试必须同版本从 4 位原子迁移为 6 位,禁止兼容双长度。
服务端在同一事务内验证当前密码与 active OTP、执行 `(tenant,canonicalPhone)` 唯一约束、消费 OTP、更新手机号、递增 credentialEpoch、撤销包括当前在内的全部 access/refresh session,并持久化旧号通知 outbox;严格 200 只返回 `RVoid`。两个并发换绑至多一笔成功,另一笔按 credential CAS 无写入。发码 POST 的结果未知不清登录态,但按服务端冷却避免立即轰炸;最终 PUT dispatch 前复用无秘密 `{sessionEpoch,startedAt}` credential marker200、401、409、network/timeout/5xx/畸形响应或进程终止均清同 epoch 本机会话回 A01且不自动重试。
M05 页面实施时状态至少为 ready/tac/sending/code-sent/submitting/known-error/unknown:新号变化作废 TAC 与 OTP,发码后锁定号码,提交中冻结全部字段和返回。当前密码支持粘贴、密码管理器和带 `aria-pressed` 的显隐按钮;手机号与 OTP 使用能保留前导零的文本/电话输入和 numeric inputmode,错误具备 `aria-invalid/aria-describedby` 与首错聚焦,发送按钮为至少 44dp 的原生按钮,倒计时和持续状态可播报但不每秒打断 TalkBack。`tests/phone-change-openapi-contract.ps1` 当前输出 `PHONE-CHANGE-OPENAPI-CONTRACT BLOCKED``API-PHONE-001``005`、M04/认证前置门禁、两设备/OTP/故障注入和 MuMu 矩阵完成前不修改诚实预览。
### 23.9 G03 家谱与始祖原子创建合同
G03 当前在一个页面实例中先收集家谱资料,再录入始祖,两个 320ms 定时器只生成 `local-created-*` 预览;没有真实 API、可信 `regionCode`、上下文安装或 G01/G05 远端回流。受保护双导出的 `GenealogyCreateBody` 和线上 `AppGenealogyCreateBody` 都只创建家谱;通用 `/lineage/persons` 又允许客户端提交代数、父母和账号字段。若按旧接口先建谱再建根,会制造非产品需求的 `ROOT_REQUIRED` 半成品及两次结果未知。三人先讨论了两写恢复,再反向检查是否存在跨库或“保存空谱”的硬约束;当前没有任何证据,因此一致选择原子 bootstrap。只有后端以后证明事务边界不可跨越时才重新立 saga,而不是把补偿复杂度预埋客户端。
唯一写 owner 仍是 `POST /genealogy/app/genealogies`,但旧 `GenealogyCreateBody/AppGenealogyCreateBody` 必须被 `AppGenealogyBootstrapBody` 原子替换,不保留双收。根对象关闭额外字段,只允许 `genealogyName/surname/ancestralHall/regionCode/accessPreset/rootPerson`,前五项除堂号外均必填;`rootPerson` 关闭额外字段,只允许 `name/sex/birthDate/biography` 且 name/sex 必填。服务端固定根人物 `generation=1` 和唯一首根,不接收 `generationName/personNo/appUserId/fatherId/motherId/status``sex` 只允许 `MALE/FEMALE/UNKNOWN`,页面默认 UNKNOWN;生日是本地日 `format: date`,不保留页面武断的 1800 年下限。文本按 Unicode code point、NFC 和无边界空白统一验证,长度沿用页面现有 4/24/12/20/200 上限。
严格 200 前必须在一个事务内完成配额竞争检查、家谱、OWNER 成员关系、唯一一世始祖、READY 状态和幂等成功回执;任一步失败全部回滚,通用人物 POST 只服务 READY 家谱中的普通人物,不能承担 bootstrap。数据库 `bootstrap-root` 标记是根身份唯一权威,不能从 generation=1 猜测:普通人物 POST 即使提交一世也不能新建/替换根;人物 PUT 对根的可编辑白名单精确且只有 `name/sex/birthDate/biography`operation 以 `x-bootstrap-root-editable-fields` 登记这四项并以 `x-bootstrap-root-noneditable-policy=REJECT_422_BOOTSTRAP_ROOT_IMMUTABLE` 登记拒绝策略;任何 status/personStatus、账号绑定、世代、父母、根标记或其他字段即使出现在通用 body 中也必须以 typed 422 拒绝,不能用“值未变化”掩盖越权字段。人物 DELETE 不能删除根,parents mutation 不能给根新增或重挂父母。未 READY 固定 typed 409 `GENEALOGY_NOT_READY`,触碰白名单外根字段或根身份固定 typed 422 `BOOTSTRAP_ROOT_IMMUTABLE`。成功 `GenealogyBootstrapResult` 必填词法字符串 `genealogyId/rootPersonId``setupState=READY``roleType=OWNER``canView=true`;两个 ID 从 JSON 到 storage、context 和 URL 都不得经过 JavaScript Number。同姓、同名和同地区均合法,页面重复提醒只能是建议,后端不得把名称当唯一键。
访问规则的唯一 wire owner 是共享 `GenealogyAccessPreset`,枚举只有 `MEMBER_ONLY/PUBLIC_APPLY`。这不是 G03 私有别名:同一后端版本必须让 APP 家谱读取 `AppGenealogyVo`、bootstrap 创建和 G11 设置更新都引用它,并删除 `visibility/joinMode`、旧 create/update DTO 和 `utils/genealogy-contracts.js` 的远端数字映射;客户端不得长期同时接受新 enum 与旧 pair。设置请求同步收紧为闭合、至少一个脏字段的 `AppGenealogySettingsUpdateBody`,只含 `genealogyName/intro/accessPreset`。本任务只统一 G11 的字段合同,不代表设置写入已经可上线;G11 的 `If-Match`、版本/CAS、权限刷新和结果未知仍须在独立批次建立门禁。在后端合同尚未落地的当前本地预览阶段,现有 fixture 映射暂不改写,也不能冒充生产 wire。
所在地只能从 required SaToken、非空 clientid 的 `GET /genealogy/app/region/search` typed `RegionSelectVo` 选择;同版删除旧公共 `/genealogy/region/search`,不能让 APP 在两条 owner 间漂移。`regionCode/label/selectable` 必填,code 使用共享词法 `GenealogyRegionCode``leaf` 只表示树导航,不能被客户端猜成“可提交”。页面展示 label、只提交 code,最终 POST 在业务事务中再次验证仍可选;不强制县、乡或 leaf,避免无依据排除省市级、历史地域或要求过细隐私位置。搜索加载、无结果、失败、迟到响应和失效选项分别表达,自由文本不得反推 code。
POST required SaToken、非空 clientid 和 `Idempotency-Key``GenealogyBootstrapOperationKey` 精确为 `gcb.{13位毫秒时间}.{22—43位 base64url 随机量}`,随机量必须来自至少 128 位 CSPRNG;`issuedAt` 从 key 提取,`acceptUntil=issuedAt+10 分钟`,一律以服务端时间判定,issuedAt 晚于 serverNow 5 分钟以上固定 400 `OPERATION_KEY_INVALID`。schema 同时用 `x-issued-at-source=KEY_EPOCH_MILLISECONDS``x-accept-window-seconds=600``x-max-future-skew-seconds=300` 机器锁定公式。仍在窗口内的首次请求先用短控制事务按 `(account,tenant,client,path,key)` 唯一 CAS 认领 `PENDING`、canonical digest、fencing lease 和 `resolveBy``resolveBy<=claimedAt+2 分钟`,并以 `x-resolve-from=CLAIMED_AT/x-resolve-sla-seconds=120` 锁定。相同作用域、key 与 canonical body 的已存在操作即使超过 acceptUntil 也可重放同一结果,不同 digest 固定 409 `IDEMPOTENCY_KEY_REUSED`;截止后仍不存在的 key 固定 409 `OPERATION_KEY_EXPIRED`,不得启动工作。
控制事务认领后,业务事务才原子执行配额竞争检查、家谱、OWNER、唯一一世始祖、READY 和 `SUCCEEDED` 回执;任一写点失败全部回滚,再以 fencing token CAS 成不可变 `FAILED_NO_COMMIT`。超出 lease/resolveBy 的 watchdog 也只能用同一 CAS 终结,旧 worker 失去 fencing 后不得提交,保证 PENDING 最迟 2 分钟内收敛。严格 200 只表示业务事务与成功回执均已提交;SUCCEEDED 防重记录至少覆盖实体生命周期,FAILED_NO_COMMIT 记录至少保留 30 天。
为避免把始祖姓名、生日和生平写入 UniApp 普通持久存储,崩溃恢复选择受鉴权 `GET /genealogy/app/genealogy-bootstrap-operations/{operationKey}`,不持久化完整 body。状态响应必须用带显式 mapping 的 discriminator `oneOf` 精确区分 `PENDING{resolveBy,retryAfterSeconds}``SUCCEEDED{result}``FAILED_NO_COMMIT`,三个 status 均是单值 stringPENDING 的 `retryAfterSeconds` 为 1—30,避免给所有 200 错加 Retry-After。`x-state-transitions` 只登记 `ABSENT→PENDING``PENDING→SUCCEEDED/FAILED_NO_COMMIT`,两个终态无出边,`x-terminal-immutable=true`FAILED schema 同时固定 `x-domain-effects=NONE``x-quota-consumed=false`,机器保证家谱、OWNER、始祖和配额均未提交。SUCCEEDED 返回与 POST 相同严格回执。GET 只允许 operationKey path 与 clientid header、不得有 request body,是纯读且绝不创建墓碑或推进状态:acceptUntil 前无记录返回 typed 404 `BOOTSTRAP_OPERATION_NOT_AVAILABLE`,同时返回服务端 acceptUntil 与 Retry-After;截止后无记录则按 key 时间可计算地返回 FAILED_NO_COMMIT 而不写库,迟到 POST 仍永久拒绝。跨 account、tenant 或 client 查询统一 404且不泄漏存在性,禁止额外 403 分叉。操作记录不进 `/mine`、不占业务配额,也不返回请求 body 或人物 PII;GET 零写入和 FAILED 零领域提交最终仍须数据库观测测试证明,OpenAPI 描述与扩展不能冒充实现证据。
客户端唯一 coordinator 在最终按钮校验全部字段后才冻结 canonical snapshot、生成 key,并在 dispatch 前持久化 `{sessionEpoch,operationKey,startedAt}`;第一步 CTA 只写“下一步:录入首代”,绝不发网络请求。客户端本地校验失败不写 marker;请求对象创建失败且能证明零发出时清 marker。服务端在 claim 前返回的 400/401/403 均保证无 operation,清 marker,其中 401 还必须清会话并回登录,403 失败关闭。409 `IDEMPOTENCY_KEY_REUSED` 视为合同/篡改冲突,marker 转入 fatal/quarantined,不查询或安装该 key 的 status、不自动换 key;只有用户看到明确警告并显式放弃后才清 marker、重新开始。创建上限、过期 key 和 422 是确定未提交,可清 marker后修正。429 保持 marker、同 key/body,先查 status 再按 Retry-After 重试;500、网络、超时、408、发出后的取消、任意意外 2xx/3xx、畸形 200 或进程终止均是 unknown,保持 marker并查 status,绝不换 key。status 的截止前 404 保持 key400 表示本地 marker 已损坏并安全清除,401 执行会话失效,429/500、网络、取消、意外状态和畸形 200 均保持并退避;只有 FAILED_NO_COMMIT 或可证明未认领的确定失败才清 marker。
当前进程 unknown 可用相同 key 与内存 snapshot 重放;进程重启只查状态,不从 `/mine` 按名字猜测,也不自动生成新 key。SUCCEEDED 的唯一次序固定为:持久化 committed receipt → 失效或定点更新 `/mine` 缓存 → 安装 genealogy context → 进入 G05context 或导航失败只重试本地安装/导航,绝不重发创建。退出、换账号和 epoch 变化必须隔离旧操作;任何日志、路由、marker、遥测和崩溃记录都不得包含表单正文。
页面实施必须同步删除伪提交 owner 与 mock fixture mutation,覆盖地区加载、确定拒绝、fatal/quarantined、PENDING、结果未知、已提交待进入、上下文失败和导航失败。文本标签与 input 建立关系;访问预设使用真正 radio/`aria-checked`;按钮至少 44dp,提交中冻结字段和返回;错误具备 `aria-invalid/aria-describedby`、首错聚焦和持续状态播报;重复提醒与成功/放弃层复用具备焦点圈定和恢复的 `AppDialog`。当前源码仍有 clickable view、54rpx 目标、23rpx 选项、无关联错误和 UTC 日期上限,这些只登记为实施项;没有 MuMu 证据前不得宣称视觉或 TalkBack 上线。后端门禁先执行无第三方依赖的 `tests/openapi-yaml-json-parity-runtime-smoke.js`,以无损任意精度数字、严格 YAML mapping 分隔符和完整对象结构深比较 JSON/YAML,确保不安全整数差一也不能假绿,再由 `tests/g03-bootstrap-openapi-contract.ps1` 检查唯一 JSON 语义、组合 schema 内旧字段、同 scope 参数重复、根 PUT 精确白名单和结构化不可变终态;客户端门禁 `tests/g03-bootstrap-client-release-gate.ps1` 实际执行依赖注入的 marker/status 状态机测试,不再用 helper 名称顺序冒充行为证据。两项只是 G03 自身门禁;真实开放还必须同时通过家谱工作区读取门禁、聚焦测试全量回归与 MuMu 原生交互/无障碍验收,任一红灯都不得开放真实创建。
## 二十四、当前精确执行顺序
后续不再按页面样式迁移重做,而按以下独立阶段执行:
1. 导航栈语义统一:先测试和共享所有者,再按认证、G、T、F、R、N/M 小批迁移,每批 MuMu 闭环
2. T01 大规模世系树:先向后端提交新图合同,等待 Apifox 更新并验证,再按图合同、布局、Scene、Canvas页面交互分批实施。
3. 短信验证码完整状态机
4. 跨页面领域数据持久化
5. 全局文字层级与无障碍第二轮
1. 导航栈语义统一:静态任务 1—10 已完成,MuMu 流程矩阵待执行
2. T01 大规模世系树:设计与 OpenAPI 红灯已完成;等待后端新图合同后按规范化、布局、Scene、Canvas页面交互分批实施。
3. TAC 认证:客户端与静态/纯运行时门禁已完成;等待后端关闭 `API-AUTH-TAC-001``004`,随后执行真实环境与 Android 发布门禁
4. 领域上下文基础与 M07 真实反馈客户端已完成;家谱工作区三人审查与 OpenAPI 红灯已完成,等待后端关闭 `API-GENEALOGY-WORKSPACE-001``003` 后再接 G01/G05
5. G03 原子 bootstrap 三人审查与 OpenAPI 红灯已完成;等待后端关闭 `API-G03-001``005` 后,再实现严格 coordinator、无 PII 状态恢复、地区选择、context/G05/G01 闭环和独立 MuMu 矩阵
6. M06 帮助三人审查与 list-only OpenAPI 红灯已完成;等待后端关闭 `API-M06-001``003` 后再接严格 adapter。等待期间继续下一个无依赖只读域,不与验证码、T01 或支付混合。
7. M01/M02/M03 个人资料读取三人审查与 OpenAPI 红灯已完成;等待后端关闭 `API-PROFILE-READ-001``003` 后再接掩码 adapter,不与资料写入混合。
8. 通知读取和已读写入已分别完成三人审查与 OpenAPI 红灯;后端先关闭读取合同后实现无 ID 内存快照,再在独立写批次私有迁移字符串 ID、删除伪本地读状态并验证并发收敛。
9. M02 资料写入三人审查与 OpenAPI 红灯已完成;等待读取与 `API-PROFILE-UPDATE-001``004` 同时关闭后,再分 normalizer、API 和页面状态实现。
10. M10 当前设备退出三人审查与 OpenAPI 红灯已完成;等待后端关闭 `API-LOGOUT-001``003` 后,再实现 session epoch、logoutCoordinator 和 A01 一次性状态。
11. M04 登录态改密与四条密码 wire 三人审查、OpenAPI 红灯已完成;等待后端关闭 `API-PASSWORD-001``005` 后,原子迁移共享策略、MD5 消费者、session marker、页面状态机与全设备撤销。
12. M05 手机号换绑与全活动 OTP 三人审查、OpenAPI 红灯已完成;等待后端关闭 `API-PHONE-001``005` 且 M04/认证前置门禁通过后,再原子迁移六位码、专用受保护发码、最终 PUT 与 credential marker。等待期间转向 G/F/R,不混入本批。
13. 全局文字层级与无障碍第二轮。
14. 生产配置、隐私权限、可观测性、构建发布、升级回滚与 MuMu 全流程终审。
T01 必需的线性目录和 44dp 控件随 T01 一起完成;不借此提前改造全项目文字体系。任何阶段完成前都不开始下一阶段的业务代码
T01 必需的线性目录和 44dp 控件随 T01 一起完成;认证浮层的壳层无障碍不扩张为全项目已通过。外部门禁阻塞时继续无依赖批次,但任何真实成功、接口兼容或视觉通过都必须有对应证据
+342 -92
View File
@@ -1,20 +1,20 @@
# 接口与页面映射总表
> 更新日期:2026-07-22
> 阶段状态:阶段 0 已完成;导航栈与 T01 专项设计已完成三人终审,业务代码尚未实施
> 接口状态:已完成 A04 注册响应和 T01 世系图专项核对;其余 OpenAPI 操作仍待逐项审查
> 阶段状态:阶段 0、导航任务 1—10、A01/A04/A05 TAC 客户端、领域上下文基础与 M07 反馈客户端已完成;家谱工作区、G03 原子创建、M06 帮助、个人资料读写、通知读写、M10 服务端退出、M04 密码凭证与 M05 手机号换绑三人审查及 OpenAPI 红灯已完成;T01、TAC、工作区、G03、帮助、profile、通知、logout、password 与 phone-change 后端接口门禁当前红灯;MuMu 原生矩阵待执行
> 接口状态:已完成 A 系列认证/TAC、G 系列第一轮、G01/G05 工作区专项与 G03 原子创建专项、F 系列当前写接口边界、M06 帮助、M07 反馈、M01/M02/M03 个人资料读取、M02 资料写入、N01/N02/M01/G01 通知读写、M10 当前设备退出、M04/四条密码 wire、M05/全活动 OTP wire、T01 世系图及 2026-07-22 新线上 OpenAPI 差异核对;其余操作仍待逐项审查
## 一、权威边界
本文件是活动页面、业务目标、进入方式、返回或完成目标、适用状态与接口归属关系的唯一总表。`pages.json` 是活动路由的唯一注册清单;两者必须同轮更新并保持精确一致。
接口的唯一源是后端维护的 Apifox 项目。根目录 `APP.openapi.json` 用于自动分析,`APP.openapi.yaml` 用于人工阅读与跨工具导入。阶段 0 保护了两份用户导出;当前仅对导航依赖、A04 注册响应和 T01 世系图做了专项核对,不能把专项结论扩张为 153 个操作均已审查。
接口的唯一编辑源是后端维护的 Apifox 项目。根目录 `APP.openapi.json` 用于离线自动分析,`APP.openapi.yaml` 用于人工阅读与跨工具导入;部署地址的 `/v3/api-docs` 只提供当前线上实现证据。阶段 0 保护的双导出是 OpenAPI 3.0.1、112 路径、153 操作的旧快照;2026-07-22 21:52 只读核对 `https://backend-api.ddxcjp.cn/v3/api-docs` 得到 OpenAPI 3.1.0、722 路径、858 操作、507 模型。发现差异时必须由后端生成同版本双导出,不能手工覆盖受保护文件,也不能把专项结论扩张为全部线上操作均已审查。
当前边界如下:
- `pages.json` 注册 `52` 条活动路由;A02 已并入 A01,A06 保留源码但不属于活动路由。
- 全项目响应式迁移与统一扫描已经完成,实际 `66/66` 个 Vue 文件均在覆盖清单中。
- A 系列及 G01—G10 由用户在 MuMu 中人工确认G11、G12 以及 T、F、R、N、M 页面已由上一位代理按用户授权在 MuMu 中逐页、逐状态审核并修复
- 全项目响应式迁移与统一扫描已经完成;退役通用页面和零消费者旧表单删除后,实际 `64/64` 个 Vue 文件均在覆盖清单中。
- 任务 5 实施前,A 系列及 G01—G10 由用户在 MuMu 中人工确认G11、G12 以及 T、F、R、N、M 页面也曾逐页、逐状态审核并修复;这只是历史视觉基线,不覆盖任务 5—6 后的 G/T 动作、文案、权限和布局变更。任务 4—6 的当前代码仍须按实施计划重新完成 MuMu 流程矩阵
- 上述视觉结论是当前继续工作的基线,不等于真实接口、持久化、系统权限、真实短信、微信、支付或跨页数据闭环已经完成。
- 后续发现明确、可复现的样式、交互或业务问题时可以重新打开页面;不得因为旧结论写着“通过”就忽略证据。
@@ -23,30 +23,30 @@
### 2.1 账户、启动与登录
- APP 不设游客模式。首次打开、无有效凭证或凭证过期时进入 A01;有效登录态进入 G01。
- A01 是唯一活动登录页,承载密码登录、短信登录、注册、找回密码、协议入口和微信登录入口。登录成功统一到 G01,不直接恢复上次浏览的深层页面。
- A04 注册成功的目标是建立登录态后进入 G01。当前 OpenAPI 已确认 `POST /genealogy/app/auth/register` `200` 响应复用 `LoginResult`,其 `LoginVo` 可返回 `token/accessToken/tokenValue`正式接入应保存有效会话后直接进入 G01,不让用户重复登录。行为验证与短信发送时机仍在后续短信状态机阶段核对。
- A01 是唯一活动登录页,承载短信登录、受后端合同阻塞的密码登录入口、注册、找回密码、协议入口和尚未接入的微信登录入口。当前默认短信登录;密码登录在后端能够强制消费 TAC 票据前保持可见但不可用。登录成功统一到 G01,不直接恢复上次浏览的深层页面。
- A04 注册成功的目标是建立登录态后进入 G01。2026-07-22 新线上 OpenAPI 已确认 `POST /genealogy/app/auth/register` 与两种登录操作统一返回 `RAppLoginVo``data` 引用 `AppLoginVo`,会话字段为 `access_token``utils/api.js` 只读取这一当前字段。正式接入应保存有效会话后直接进入 G01,不让用户重复登录,也不为受保护旧快照保留并行兼容路径。行为验证与短信发送时机仍在后续短信状态机阶段核对。
- A05 重设成功后不自动登录:返回 A01,保留合规的手机号信息,切换密码方式、聚焦密码框并让用户使用新密码登录。
- A04、A05、M04 共用 `utils/validation.js`唯一密码策略:密码长度 `832` 位且必须同时包含字母和数字;M04 的新密码还不得与旧密码相同。页面不得各自复制或放宽该规则
- A04、A05、M04 当前预览仍共用 `utils/validation.js` `832+字母数字` 旧策略;Task33 已证明该规则只在客户端且无法作为生产 owner。门禁通过后必须与 A01/A04/A05/M04 的 MD5 wire 同批原子迁移为服务端权威的 15—64 Unicode code point、NFC、允许空格与 Unicode、无组成规则,并同步替换本地唯一 owner、页面文案和测试;不得只改 M04 或保留双轨
- A01 未勾选协议时在协议区域就近高亮并显示错误,不弹原生提示、不跳页;用户勾选后立即清除错误状态。
- A01、A04、A05 最终共用真实行为验证能力,但触发时机必须按业务区分:A01 在本地校验通过后、登录请求前触发;A05 在请求发送短信验证码前触发,最终重设提交不重复验证;A04 当前临时在完整注册表单提交后触发,后端提供短信注册接口时必须迁移到发送短信前,并删除旧触发路径。关闭或验证失败时保留表单内容,不得形成两套并行验证路径
- 短信验证码需要完整状态机:可发送、发送中、倒计时、发送失败、限流、前后台恢复和到期。该状态机在导航栈统一之后单独评估,不在阶段 0 实施
- A01、A04、A05 已接入同一个 `TacVerification``static/tac/`,不能把本地滑动成功冒充服务端验证。A01 短信登录使用 `APP_SMS_LOGIN`A04 使用 `APP_REGISTER`A05 使用 `APP_FORGOT_PASSWORD`;三者都先从 `/captcha/require` 取得严格 provider/type 合同,再由 `/captcha/challenge``/captcha/verify` 换取 `validToken`,携票调用 `POST /genealogy/app/auth/sms/code`。验证只发生在发短信前,注册或重设提交不重复验证;手机号改变会作废旧上下文,关闭、失败或离页保留表单但不得继续发送。密码登录体尚无票据字段或其他强制绑定证据,因此密码登录入口保持不可用
- A01/A04/A05 已实现可发送、发送中、60 秒倒计时、失败重试、手机号变更失效、验证码到期和重复发送保护;短信码精确为 4 位。认证 HTTP 只接受 HTTP 200 严格 envelope,统一 15 秒超时,Android 返回或页面卸载会中止 RequestTask,迟到回调不得改变已离开页面。真实限流、前后台剩余时间恢复和多设备重放仍需后端集成与 MuMu 证明
- 凭证过期先回 A01,再显示项目自定义的单按钮信息弹窗并聚焦登录表单;主动退出清除凭证,但可以保留用户上次选择的密码或短信登录方式,不保存密码。
### 2.2 家谱上下文与加入、创建
- 一个账号允许创建或加入多个家谱。G01 列表按“我创建的”“我加入的”“加入申请”分组,顶部只表示当前选中项。
- G01 下方列表卡只切换顶部当前项,不直接进入详情;顶部可用家谱卡进入 G05。默认选择顺序为:本机保存的上次有效 ID、第一个可操作家谱、列表第一项。只保存 ID,不复制整份家谱数据
- G01 顶部当前家谱卡用于打开切换层;下方可用家谱卡直接进入 G05。只有导航成功后才同步顶部选中项和本机当前家谱 ID,失败或并发点击不得把页面与持久上下文串到不同家谱。首次且没有历史选择或失效标记时可确定使用首个可用家谱;调用方给定的新列表不再包含历史 ID,或显式目标不可用时,必须清空、持久标记并要求用户重选,跨重载也禁止静默回退到另一家谱。只保存词法字符串 ID,不复制整份家谱数据;真实撤权检测等待 workspace 接入 onShow/事件刷新
- 审核中记录只展示进度和“撤回申请”,顶部卡不可进入家谱;被拒绝记录展示原因和“修改后重新提交”,进入 G08 而不是 G05;已退出或被移除记录展示原因和“重新申请”,不得访问原家谱内容。
- 只有可用家谱能够成为全局家谱上下文;审核中、被拒绝、已退出被移除或待录入始祖的记录不得覆盖最近一个可用上下文。
- 只有 READY 且当前账号 `canView=true`家谱能够成为全局家谱上下文;审核中、被拒绝、已退出被移除的记录不得覆盖最近一个可用上下文。G03 新合同不再产生“待录入始祖”业务状态;历史半成品如真实存在应由后端迁移/隔离,不能继续成为客户端正式状态。
- 没有可用家谱时,相关页面不得展示上一个失效家谱的缓存内容,应引导用户搜索家谱、使用邀请码或创建家谱。
- G01 空态的主次顺序为搜索家谱、邀请码加入、创建家谱;非空列表保留“添加家谱”底部弹层。所有者可见世系、成员、字辈诗、申请审核四个快捷入口,普通成员不显示申请审核。
- G06 同时承载搜索与邀请码定位。搜索申请进入审核;邀请码目标是直接加入,不应生成审核记录。邀请码验证和直接加入目前仍是待核对的接口依赖
- G06 同时承载搜索与邀请码定位。产品目标仍是“邀请码直接加入且不生成审核记录”,但当前 OpenAPI 没有邀请码校验或直接加入操作,因此本地流程只展示目标并进入 G08 填写确认,完成后无结果返回 G01,不能选中家谱或声称已经加入。搜索申请进入审核;真实邀请码终点必须等后端合同补齐后替换本地预览
- G06 结果至少需要谱名、姓氏、地区、堂号、所属上级谱、当前支系、管理者或认证信息、成员规模和最近更新时间,以区分同名家谱和支系;未加入、已加入、审核中、被拒绝、已退出或移除、我创建的六种关系各自只出现一个明确动作。
- G08 当前用真实姓名、与已知长辈的文字关系和补充说明表达申请;用户可见示例统一使用“某某某堂侄”等通用占位,不出现具体姓名。后端提供结构化参照成员或关系字段后,应以新合同完整替换文字关系旧路径。
- G03 当前只创建独立家谱。创建完成但始祖未录入时,G01 必须保留“待录入始祖”记录;完成始祖后进入 G05,由用户主动进入 T01,不自动越过家谱总览
- G03 当前在同一页面实例内依次完成“创建家谱”和“录入始祖”,不接收 `step``genealogyId` 路由参数;门禁前本地成功无业务结果进入 G05 明确预览态。生产目标不允许创建中断成空谱:第一步零网络写,最终按钮一次原子创建家谱、OWNER 与唯一始祖;进程终止后按 operationKey 查询服务端操作状态,不恢复已删除的路由步骤合同,也不让 G01 承担半成品恢复卡
- G05 同一路由区分公开预览与成员视图。公开预览不得闪现成员隐私或管理入口;所有者和普通成员采用最小权限模型,最终权限以接口合同为准。
- G05 首屏按身份确认、来源确认、可信度确认三层组织信息;世系是次级入口,不自动抢占首次进入流程。
- G11 只维护当前可解释的名称、公开范围和访问说明;公开范围只有“仅成员可见”“公开可申请”两个当前枚举,不虚构“转让管理员”等后端尚未确认的能力。G12 字辈保存必须保证代次连续;发现历史缺口时停止向后推导并要求明确处理,不能静默错位。
- G11 只维护当前可解释的名称、访问预设和家谱简介;门禁前本地 fixture 的“仅成员可见”“公开可申请”仍由 `utils/genealogy-contracts.js` 映射旧 `visibility/joinMode` 并对未知组合失败关闭。任务 35 已选定后端同版迁移为 APP 读、建、改唯一 `GenealogyAccessPreset`,落地时必须删除旧 pair 与客户端数字映射,不双读;不虚构“转让管理员”等能力。G12 本地批量预览固定按完整序列处理,支持最多 500 代、单代 50 字符和接口声明的分隔符;发现 ACTIVE 世代缺口时停止保存,不能静默错位。
### 2.3 页面状态与请求结果
@@ -61,13 +61,13 @@
### 2.4 导航、弹层与流程终点
- 当前三个业务根页面是 G01“家谱”、F01“家族”和 M01“我的”,A01 是认证根页;书面栈语义已经在导航设计中收口,业务代码仍须按测试先行和 MuMu 矩阵实施验证
- 当前三个业务根页面是 G01“家谱”、F01“家族”和 M01“我的”,A01 是认证根页;导航栈语义统一已经完成,路由注册表、导航网关、共享页头、自定义底栏、认证、G、T、F、R、N/M 系列活动页均按测试先行落地,退役通用页面、临时页面目录和最后一个零消费者旧表单组件均已删除。源码导航扫描为 `MIGRATION-DEBT=0`;认证至 N/M 的 MuMu 原生流程复核仍待执行
- 返回、取消、完成和重复进入必须分别验证。页面完成后不得把已经结束的旧流程继续留在栈中,也不得用 `navigateBack` 猜测一个可能不存在的返回目标。
- 普通底部弹层可由遮罩或 Android 返回键关闭;存在未保存输入时先确认是否放弃。确认弹窗的返回键等同取消;任何取消都不得被记录为成功。
- 弹窗高度只允许使用视口 `max-height` 和内部滚动;普通页面内容高度由内容决定,不为单一设备压缩字号、行高或控件尺寸。
- 用户可见反馈使用项目自定义组件,不新增原生 UniApp Toast、Modal、Loading 或 ActionSheet 作为正式体验。
- 轻提示、底部弹层、居中确认、结果说明和危险操作按决策成本分级。不可逆操作必须说明后果并二次确认;普通操作不滥用确认。
- 产品合同已经定案为“邀请码直接加入且不生成审核记录”:只有邀请码校验成功才执行直接加入。M08 当前“邀请码加入后需要管理员审核”的旧文案属于待删除实现债务,导航任务 9 必须同步删除,不能保留审核与直接加入两套分支;邀请码校验和直接加入接口仍按对应业务阶段向后端核对
- 产品合同已经定案为“邀请码直接加入且不生成审核记录”:只有未来真实邀请码校验与直接加入接口成功才允许建立成员关系。当前 G06/G08 只做本地流程预览并明确未提交服务器;M08 的旧审核分支、硬编码邀请码、复制和海报伪能力已经删除,在真实邀请码签发与校验合同落地前保持不可用
### 2.5 三个根页面与主要流程
@@ -93,20 +93,20 @@ M01 我的
### 2.6 当前本地数据与路由参数边界
当前 `52` 条活动页面仍使用页面内本地状态、fixture 或 mock 数据;活动页面没有 `appApi` 消费者。`utils/api.js` 的存在不能解释为已经接入真实接口。以下只记录页面源码当前主动读取的查询参数,供阶段 1 导航栈与接口审查核对;上游传入但页面未读取的参数属于待审债务,不能写成有效合同。
当前 `52` 条活动页面除 A01/A04/A05 的认证调用外,仍使用页面内本地状态、fixture 或 mock 数据;其他活动页面没有 `appApi` 消费者。认证调用已经对准真实端点,但 `runtimeConfig.mode` 固定为 `mock` 并失败关闭,不能解释为真实后端已经联通。以下只记录页面源码当前主动读取的查询参数;上游传入但页面未读取的参数属于待审债务,不能写成有效合同。
| 页面 | 当前主动读取的查询参数 |
| --- | --- |
| A01、A04、A05 | 无 |
| G01 | `genealogyId``state` |
| G03 | `step``genealogyId` |
| G05 | `genealogyId``mode``role``state``genealogyName` |
| G03 | |
| G05 | `genealogyId``state` |
| G06 | `mode``state` |
| G08 | `genealogyId``source``previous``state``genealogyName` |
| G08 | `genealogyId``source``state` |
| G09 | `state``status` |
| G10 | `genealogyId``state` |
| G11 | `genealogyId``state` |
| G12 | `genealogyId``startGeneration``currentGeneration``state` |
| G12 | `genealogyId``state` |
| T01 | `genealogyId``state``selectedId` |
| T03 | `genealogyId``personId``state` |
| T04 | `genealogyId``personId``mode``state` |
@@ -114,30 +114,32 @@ M01 我的
| T07 | `genealogyId``state` |
| T08 | `genealogyId``personId``state` |
| F01 | `genealogyId``state` |
| F02 | `state` |
| F03 | `feedId``commentResult``state` |
| F04 | `count``state` |
| F05 | `articleId``state` |
| F06 | `articleId``mode``state` |
| F07 | `count``state` |
| F08、F09 | `albumId``state` |
| F10 | |
| R01 | `state` |
| R02 | `mode``personId``state` |
| R03 | `count``state` |
| R04 | `giftId``mode``saveResult``state` |
| R05 | `count``state` |
| R06 | `ritualId``state` |
| R07 | `ritualId``mode``saveResult` |
| R08、R09 | `personName``state` |
| R10、R11 | `state` |
| F02 | `genealogyId``state` |
| F03 | `genealogyId``feedId``state` |
| F04 | `genealogyId``state` |
| F05 | `genealogyId``articleId``state` |
| F06 | `genealogyId``articleId``mode``state` |
| F07 | `genealogyId``state` |
| F08、F09 | `genealogyId``albumId``state` |
| F10 | `genealogyId` |
| R01 | `genealogyId``state` |
| R02 | `genealogyId``mode``personId``state` |
| R03 | `genealogyId``state` |
| R04 | `genealogyId``mode``relativeId``state` |
| R05 | `genealogyId``state` |
| R06 | `genealogyId``ceremonyId``state` |
| R07 | `genealogyId``mode``ceremonyId``state` |
| R08、R09 | `genealogyId``personId``state` |
| R10、R11 | `genealogyId``state` |
| N01 | `genealogyId``state` |
| N02 | `id``state` |
| M01 | `state` |
| M02—M08、M10 | 无 |
| M09 | `state` |
`state``count``saveResult` 等参数目前主要用于本地状态审查和压力测试,不代表后端请求字段导航注册表已经决定删除 G03 的 `step`、G05/G08 的 `genealogyName` 和 G08 的 `previous`:页内步骤留在页面状态,名称按 `genealogyId`现有 fixture 或后续领域数据取得,来源只由真实栈与受验证 `sourceKey` 表达。其余参数仍须在对应业务阶段判断为真实输入、页内状态、领域数据或删除项,不得把调试参数固化成接口合同。
`state` 参数目前只用于直接加载页面时的本地状态审查,不代表后端请求字段导航网关不注册也不会生成这个展示钩子。R 系列的 `count/saveResult/personName/giftId/ritualId` 已全部退役,人物名称和实体资料只能由受校验的复合身份从唯一只读 owner 取得。G03 的 `step/genealogyId`、G05 的 `mode/role/genealogyName`、G08 的 `previous/genealogyName` 以及 G12 的 `startGeneration/currentGeneration` 已从页面和注册表删除:页内步骤留在页面状态,名称按词法 `genealogyId`唯一 fixture 或后续领域数据取得,来源只由真实栈与受验证 `sourceKey` 表达。T03 初始 `personId` 是不可变宿主页路由身份,亲属浏览只改变页内活动成员和轨迹;因此当前 T05 本地预览必须以 `goBack()` 回到原实例,不得用活动成员重写 T03 URL。其余参数仍须在对应业务阶段判断为真实输入、页内状态、领域数据或删除项,不得把调试参数固化成接口合同。
T01/T03—T08 当前共用 `data/mock.js` 的唯一成员夹具 owner:列表查询必须传 `genealogyId`,单成员查询必须同时传 `genealogyId/personId`,返回值与嵌套亲属均为快照。错误家谱下的已知成员、未知成员或缺失必填身份不得回退到 1001、首位成员或“待核实成员”;T04 只有 `mode=first``personId` 为空时可以建立首位成员草稿。该夹具只支撑当前本地设计流程,不代表后端字段已经完整;任务 18 接入真实接口时必须删除临时 owner 与选择器,而不是并存第二份成员合同。
### 2.7 全局非功能门槛
@@ -147,66 +149,135 @@ M01 我的
- 同一详情连续进入和退出 `20` 次,并快速切换根页面、重复开关弹层;不得出现白屏、串状态、重复堆栈、残留遮罩或逐次变慢。
- Android 性能以约 `4GB` 内存的中低端设备为底线,验证启动、键盘、长列表、图片解码、页面切换和系统返回手势。
- 页面离开时清理本页创建的定时器、监听器、上传任务和动画状态;连续使用不得积累重复请求或实例。
- 当前尚未实施的五个独立阶段依次为:导航栈语义统一、T01 大规模世系树、短信验证码完整状态机、跨页面领域数据持久化、全局文字层级和无障碍第二轮不得一次混合实施。
- 当前导航阶段已完成任务 1—10 的共享基础、组件、退役入口、认证、G、T、F、R、N/M 系列静态迁移和零债务门禁;A01/A04/A05 的 TAC 客户端、领域上下文与 M07 反馈客户端也已完成,MuMu 原生矩阵尚未执行。T01、认证与家谱工作区后端门禁并行等待外部合同关闭;跨页面领域数据持久化以工作区门禁为前置,本地先按无依赖业务域、全局文字层级和无障碍第二轮逐批推进,不得一次混合实施。
### 2.8 G 系列第一轮接口差距账本
本轮已逐页核对 G01、G03、G05、G06、G08—G12 与受保护双导出,并对照新线上 OpenAPI 做了第一轮差异检查;随后任务 26 又对 G01/G05 做了三人反向质询、部署探测与失败门禁,但没有在 schema owner 未定时把页面接到 `appApi`。所有 G 页面仍是本地交互预览,页面显示角色也只是 fixture 的最小权限投影,不代表服务端授权。以下问题在真实接入前必须由接口适配合同或后端同版本新导出关闭:
- 公共边界:受保护旧双导出的家谱详情、列表和申请列表多为通用 `Object/ListResult`;新线上虽改为 `RListAppGenealogyVo/RAppGenealogyVo/RListGenealogyJoinApplyVo` 等类型化响应,但三个工作区模型均无 `required``AppGenealogyVo.genealogyId` 仍是 JSON `integer/int64`,合法最大值在 JavaScript 中不可逆失真;`roleType/status/memberStatus` 无 enum,且没有可直接用于 current context 的 `canView`。首批工作区只要求 `genealogyId/genealogyName/canView/canManage/canEditContent/roleType` 的最小闭包,不要求 22 个字段全部必填。`GET /genealogy/app/genealogies/quota` 虽已返回 `GenealogyQuotaVo`,它属于后续创建/加入写流程,不混入 G01/G05 只读批次。申请、用户、字辈等其他 int64 只在各自实际消费批次逐项关闭,不能用解析后 `String()` 冒充无损。
- G03:任务 35 已完成三人专项审查。受保护旧双导出的 `GenealogyCreateBody` 与线上 `AppGenealogyCreateBody` 都只建谱,页面又缺可信 `regionCode`,通用人物 POST 不能保证唯一始祖或两写原子性。生产目标固定为最终按钮一次 `AppGenealogyBootstrapBody` 创建谱+OWNER+一世始祖+READY,使用 `/genealogy/app/region/search``GenealogyRegionCode``RegionSelectVo.selectable`、统一 `GenealogyAccessPreset`、词法 ID、Idempotency-Key 与无 PII operation-status;当前后端 `G03-BOOTSTRAP-OPENAPI-CONTRACT BLOCKED` 和客户端 `G03-BOOTSTRAP-CLIENT-RELEASE BLOCKED` 均为独立发布红灯,见 5.12。
- G01/G05 只读工作区:`/mine` 是唯一可访问集合 owner`/{genealogyId}/overview` 是 G05 唯一读取 owner,不同时调用语义重复的 `/{genealogyId}`。G01 必须在 `onShow` 或失效事件中取消旧请求并成功取得严格列表后才 reconcile;网络/5xx 不写撤权 tombstone。G05 在新请求前清旧数据并取消迟到响应,远端失败不回退 fixture。线上没有当前首屏用于确认来源和可信度的 `source/manager/certification/ancestorName/parentName/branchName/updatedAt/activeCount`;首批可以诚实隐藏或降级这些可选展示,若产品坚持保留则另补后端合同,不能让 fixture 成为真实详情。
- G06:新线上公开搜索已经返回类型化家谱对象,但仍没有显式 `canApply`、六类关系字典、邀请码校验、邀请码目标解析或直接加入端点;未来必须由服务端返回可信的 `canJoinByInvite` 或等价结果,搜索申请资格不能代替邀请码资格,也不能信任 `source=invite` 查询参数。
- G08`GenealogyJoinApplyBody` 提供 `applicantName/phone/relationDesc/applyReason/inviterUserId`,当前页面的 `realName/relation/message` 仍需显式映射、手机号来源和必填规则确认;接口没有邀请码票据字段。搜索来源本地完成仅进入 G09 预览,邀请码来源本地完成仅回 G01,二者都不建立成员关系。
- G09/G10:新线上我的申请和待审核列表已返回类型化申请行,但申请状态仍缺正式 enum/字典;真实撤回和审核必须携带服务端词法 `applyId`。线上审核体为 `{status,auditRemark}``status` 必填且匹配 `[12]`1 通过、2 拒绝),`auditRemark` 最长 500`utils/api.js` 已同步严格校验,旧 `{approved}` 路径已删除。当前本地 `LOCAL_WITHDRAWN` 和审核预览仍不得当成服务端状态。
- G11:受保护旧双导出的 `GenealogyUpdateBody` 与线上 `AppGenealogyUpdateBody` 都有 `genealogyName/intro/visibility/joinMode`,页面已删除不存在的 `accessNote``utils/genealogy-contracts.js` 当前只为 fixture 暂时映射 `2/0``1/1`;任务 35 已把远端 owner 收紧为闭合 `AppGenealogySettingsUpdateBody``genealogyName/intro/accessPreset`,并要求 `AppGenealogyVo` 同用枚举。新合同落地时原子删除旧 DTO、pair、映射和对应旧测试,不保留邀请码 mode 的暗中兼容,见 5.12。
- G12:旧双导出的批量体为 `{poemText,disableMissing}`;输入总长上限 26000 字符、单代最多 50 字符、单批最多 500 代,停用遗漏后续记录时不得删除历史。新线上 `GenerationPoemBatchBody` 还暴露 `genealogyId`,说明为“由路径参数写入,客户端不得自行指定”,并丢失了旧导出中的单代/单批说明,必须由后端同版本导出确认哪组约束仍有效。客户端解析、状态 `0/1`、词法 `poemId` 保留、重复世代失败关闭、完整 ACTIVE 序列检查和 50 条分批渲染已由共享 owner 与 Node 冒烟锁定;页面运行时合同还覆盖 `disableMissing` 保留/停用/取消恢复及 500×50 个补充平面字符的最大合法包络。旧导出文字列“空格”等分隔符但示例含换行,当前解析器把 Unicode whitespace 视作分隔符;Tab/NBSP 是否属于正式合同仍须后端澄清。普通列表只应给可查看者返回正常状态,维护列表只给内容编辑者返回正常与停用记录。接口仍没有 `startGeneration`,且未明确批次首项对应哪一世;真实接入必须以服务端 preview items 为差异真相,在后端澄清批次起点前不得发送本地合并结果。
### 2.9 新线上 OpenAPI 差异与运行边界
- 新运行基址为 `https://backend-api.ddxcjp.cn`,已经由 `utils/config.js` 唯一持有且无尾斜杠;当前仍保持 `mode: 'mock'`,不会让尚未接完的页面误打真实服务。线上文档的 `servers` 却仍生成 `http://backend-api.ddxcjp.cn`;客户端配置只能使用 HTTPS,后端需修正文档声明,不能让 H5 产生混合内容风险。
- 本地 112 条路径中 109 条仍在线;旧 `/genealogy/app/files/reference``/genealogy/app/files/upload``/genealogy/pc/files/upload` 三条当前不在线,线上另有 613 条路径。任何上传与文件引用实现都必须先按新线上合同重新审查。
- 线上把本地若干 `Genealogy*Body/View` 改为 `AppGenealogy*Body/Vo`,部分字段说明、响应包装和 operationId 也已漂移;现有离线测试只能证明受保护双导出内部的 G 系列快照,没有证明线上与旧快照一致。
- 行为验证服务已能返回 `validToken`,短信发送体也强制接收它;但密码登录体没有票据字段。A01 密码登录、注册、忘记密码三条流程共用 TAC 是产品硬要求,后端必须明确各自 `sceneCode`、provider/captchaType、票据一次性消费与过期/重放/限流规则,以及密码登录如何强制校验。
- 新线上文档的 `722` 条路径中没有任何 `/genealogy/app/v2/``507` 个 schema 中没有 `LineageGraphWindow/LineageOverview/LineageLocator``schemaVersion/treeVersion/familyUnits/edges/rootVisibility/ancestorPathSegments/affected*Ids` 等辨识字段,`LINEAGE_QUERY_INVALID/LINEAGE_FOCUS_NOT_AVAILABLE/TREE_VERSION_CHANGED/RELATIONSHIP_PATCH_EMPTY` 也全部不存在。`tests/lineage-openapi-contract.ps1` 已对受保护 JSON/YAML 建立聚合红灯并证明四条目标操作和三个固定根模型同时缺失,因此不能解除 `API-T01-001` 门禁,也不能开始任务 12。
- 已验证 `http://localhost:5173``/captcha/challenge` 的预检允许 `POST``content-type``clientid` 和 credentials;正式 H5 域名、App 原生请求、错误码与限流仍须分别验证,不能用本次预检替代上线验收。
### 2.10 认证与 TAC 后端缺口账本
认证客户端批次已经完成,但 `runtimeConfig.mode` 继续固定为 `mock`;下列问题关闭、后端提供同版本双导出并完成真实联调前,客户端不得切换远端或宣称登录注册可上线:
- `API-AUTH-TAC-001`:密码登录体尚无票据字段。后端必须让 `POST /genealogy/app/auth/login` 强制消费与短信发送相同安全语义、绑定 `APP_PASSWORD_LOGIN + tenant + client + canonical phone` 的短时单次票据;在此之前 A01 密码登录入口保持不可用,不能仅由客户端先展示滑块。
- `API-AUTH-TAC-002`2026-07-22 对真实 `APP_REGISTER` 请求只读联调时,`POST /captcha/challenge` 返回 HTTP 500 且响应体为空。后端必须修复并提供成功、无效场景、过期、限流和服务不可用的稳定错误 envelope;不得用客户端重试掩盖空 500。
- `API-AUTH-TAC-003`:当前 `VerificationCheckBody` 未将 `providerCode/captchaType/payload` 全部声明为必填,根对象与 TianAi/SystemImage payload 也未关闭额外字段,且缺少以 evidence/provider 为 discriminator 的 `oneOf`。后端必须建立关闭额外字段的严格分支;客户端提交的 provider/type 不能替代 challenge 的服务端所有权。`tests/auth-tac-openapi-contract.ps1` 当前聚合六项结构缺口并输出 `AUTH-TAC-OPENAPI-CONTRACT BLOCKED`
- `API-AUTH-TAC-004`:验证码中心必须是唯一 owner。`/captcha/require` 返回服务端绑定 `tenant/client/scene/canonical subject/riskPolicyVersion``verificationSessionId`、允许方法和短时有效期;`required=false` 也必须直接返回可供短信端点原子消费的一次性 `validToken`。同一 session 只允许一个活动 challenge,刷新或切换方法立即作废旧题但不清零失败计数;`/captcha/verify` 只在服务端验证 evidence 并结合本地风险策略通过后签发票据,票据继续绑定 method/assurance/audience。`/sms/code` 必须在同一事务中完成 `ISSUED → CONSUMED` 与唯一短信 outbox 创建:相同幂等键返回原结果,并发或不同键重放不能创建第二个任务;跨手机号、场景、租户或客户端全部失败。
- 无障碍不得成为降风控布尔开关:禁止 `accessibility=true``skipCaptcha`、检测 TalkBack 后放行、供应商故障时直接发短信,以及由客服绕过验证中心触发短信。P0 先落 provider-neutral 验证中心和支持屏幕阅读器、文字聊天/中继的可审计人工兜底;文字渠道只是通信媒介,各 `sceneCode` 仍须定义独立身份或号码控制证据。案件继承且不得改写原 session 的 subject/scene,具有去重、RBAC、主体/IP/设备/审核员限额、审计、服务时段、容量与 SLA,高风险找回或换号双人复核;坐席只提交决定,验证中心才可签票。异步案件和批准授权可在合理期限内恢复,用户重新进入原流程时才激活短时 `validToken`,避免通知前过期;不得要求用户证明残障。中国大陆非交互风控供应商只进入限时 POC,真实 UniApp Android WebView 必须证明 TalkBack、外接键盘、Switch Access、弱网、错误票据、误杀和攻击拦截门槛,达标后才可成为默认自动路径,不能预先宣称无障碍合规。只有此前在同一 subject 的已认证会话绑定私钥、服务端 nonce、RP/App 绑定、`userVerification=required`、短时单次且检查撤销的设备断言才可独立放行;普通设备指纹、完整性检测或仅 user-presence 只能加权,注册和未绑定设备不能使用。音频验证码必须另经可懂度、听障覆盖和 ASR 对抗 POC,不能单独上线或充当唯一替代。
- 客户端当前只完成浮层壳层的对话语义、焦点进入/圈定/恢复、Escape/Android 返回、原生刷新/关闭、48px 目标与小视口滚动;第三方 TianAi 仍以指针拖动为主,不能据此宣称 TalkBack 可完成。`tests/auth-android-accessibility-release-gate.ps1` 在缺少非拖动等价路径与三人 MuMu 证据时固定输出 `ANDROID-AUTH-ACCESSIBILITY-RELEASE BLOCKED`
### 2.11 F 系列线上写合同与上传阻塞
本节只记录 2026-07-22 从 `https://backend-api.ddxcjp.cn/v3/api-docs` 只读核对到的线上事实,不改写受保护的 `APP.openapi.yaml/json`,也不代表 F 页面已经接入写接口:
- 动态:`AppFamilyFeedBody.feedContent` 必填且 `minLength=1`,其余字段为 `feedType``mediaOssIds``sortOrder int64``status``AppFamilyFeedCommentBody.commentContent` 必填,但文档边界为 `minLength=0/maxLength=1000`,另有可选 `parentCommentId int64`;空字符串虽然被模型允许,产品页仍可采用更严格的非空校验,但适配器不能把页面规则误写成服务端约束。
- 谱文与相册:`AppArticleBody.articleTitle/articleContent` 必填且均为 `minLength=1``categoryId/coverOssId/sortOrder` 为 int64`AppAlbumBody.albumName` 必填且 `minLength=1``coverOssId/sortOrder` 为 int64。所有 int64 标识在客户端边界继续以词法字符串保存,只有合同已经消除歧义的请求适配器才可编码。
- 上传初始化:`SysOssResumableInitBo``uploadId/fileName/fileMd5/totalSize/totalChunks/chunkSize` 六项必填;`fileMd5` 匹配 `^[a-fA-F0-9]{32}$`,三个大小或分片数均要求正整数。初始化响应的即时命中分支 `SysOssResumableInitVo.ossId` 是 int64。
- 分片与完成:chunk 要求 query `uploadId/chunkIndex/chunkMd5` 和 multipart `file`complete 的 `SysOssResumableCompleteBo` 要求 `uploadId/fileName/fileMd5/totalSize/totalChunks`MD5 与正整数边界同初始化。
- 硬阻塞:complete 返回的 `SysOssUploadVo.ossId` 被声明为 string,而创建照片的 `AppAlbumPhotoBody.ossId` 必填且声明为 int64;两条成功路径对同一对象存储标识给出冲突类型。后端统一类型或明确无损转换责任并重新导出同版本文档前,客户端不得自行 `Number()`、不得提交照片创建,也不得显示上传成功。F09 因此只能保留明确的本地预览。
### 2.12 R 系列线上接口与静态迁移边界
三位评审者已经同时从接口字段、业务闭环、异常交互和视觉风险审查 R01—R11。以下是 2026-07-22 线上 OpenAPI 证据与 Task8 静态批次边界,不表示页面已经调用真实接口:
- 人物:R01/R02 对应 `/genealogy/app/genealogies/{genealogyId}/lineage/persons` 与详情路径;搜索分页另有 `/page`,接收 `keyword/generation/personStatus` 和必填 `pageQuery`,返回 `TableDataInfoAppLineagePersonVo``AppLineagePersonBody` 只要求 `name`,页面旧 `role/legacy` 不是可靠请求字段;人物状态与写权限也没有正式字典或能力位。Task8 只复用树成员只读 owner,真实人物写入留到独立接口批次与 T01 v2 原子变更一并治理。
- 人情往来:R03/R04 对应 `relative-records`,不是强制依赖 `ceremonyId` 的 ceremony gifts。请求只要求 `relativeName`,另有 `relationName/eventName/eventTime/giftAmount/recordContent/mediaOssIds`;模型没有收礼/送礼方向及金额币种语义,后端补齐或产品明确单向定义前不能声称完整礼账闭环。
- 礼仪:R05—R07 对应 `ceremonies`,请求要求 `ceremonyTitle/ceremonyType``ceremonyType/status` 无正式枚举。邀请列表只有 `inviteeUserId/inviteStatus` 等字段,页面若展示姓名必须与同谱成员选项按用户 ID 受控联接,且“受邀人”不能直接写成“已参与者”。
- 成长:R08 对应 `growth-records`,请求要求 `recordTitle`;页面必须额外强制 `lineagePersonId`,因为家谱级列表没有人物筛选参数。`recordType/status` 无枚举,不能据此在客户端发明分类。
- 人生事:R09 没有独立线上端点,且 `growth-records.recordType` 没有枚举或人生事件值说明。后端提供正式合同前页面硬关闭,不读取、不写入、不展示 fixture 时间轴。
- 备忘:R10 对应 `memos`,请求要求 `memoTitle``completed/status` 是无枚举字符串,也没有独立幂等切换端点或版本字段,Task8 禁止点击卡片本地翻转官方状态。
- 功德:R11 对应 `merit-records`,请求要求 `donorName/meritTitle``meritType/status` 无枚举,`amount` 也没有币种、精度或非负边界。当前汇总只能来自只读列表,新增预览不得改变正式次数或金额。
- 公共边界:上述接口都只说明“需要登录”,响应没有统一 `canCreate/canEdit/canDelete`;任何页面角色、创建人或 fixture 权限都不能冒充服务端授权。所有 int64 ID 保持词法字符串;未知实体、缺参、跨谱必须失败关闭。真实写接口未接入前,R 页只允许独立且明确未提交的本地预览,生产路由没有结果能力。
### 2.13 N/M 系列线上接口与静态迁移边界
三位评审者已同时核对页面流程、2026-07-22 线上 OpenAPI、异常交互和视觉风险。Task9 完成 N/M 安全导航与诚实静态边界;其后只有 M07 在独立 Task25 接入已核对的真实反馈 owner,其余页面仍未提前接入远端:
- 消息:Task29 把 `GET /genealogy/app/notifications` 与 unread-count 固定为独立读取批次:无筛选列表完整返回当前账号最多 200 条活动通知、最新优先,计数精确覆盖同一集合;首版 adapter 只公开 `snapshotKey/title/content/publishedAt/unread`N02 由当前内存 generationordinal key 读取完整正文。Task30 单独约束两个已读 POST 的字符串 ID、幂等与 read-all 截止点。当前受保护双导出缺 unread-count 和专用模型,线上又无 required/enum/容量、ID 为 int64 且匿名行为与文档冲突,因此两项门禁均为红灯,见 5.6/5.7。首批删除所有通用目标 CTA;后端没有闭合 `bizType` 目标字典前,客户端不猜路由且永不执行服务端 URL。
- 个人资料:Task28 固定 `GET /genealogy/app/auth/profile` 为 M01/M02/M03 唯一读取 owner。首批 wire 只 required canonical `phone``nickName/realName/email` 未设置时省略,出现时分别满足 1—30、1—30、email 且 1—100。adapter 立即掩码手机号并丢弃 `userId/avatar/status` 等未消费字段,当前 `PROFILE-OPENAPI-CONTRACT BLOCKED`,见 5.5。Task31 保留 PUT 为唯一 dirty-only merge owner,只允许脏的三项资料;省略保持,realName/email 精确空串清空,`profileVersionIf-Match409` 防并发覆盖,当前 `PROFILE-UPDATE-OPENAPI-CONTRACT BLOCKED`,见 5.8。头像与 M05 换绑继续各自独立。
- 密码与手机:Task33 已判定 `PUT /genealogy/app/auth/password` 和登录/注册/找回共用的 32 位十六进制 MD5 不可上线;四条入口须原子迁移到 raw writeOnly、15—64 Unicode/NFC、blocklist/限速/慢哈希。M04 200 前撤销包括当前设备在内的 ALL access/refresh sessionunknown 也清本机回 A01,崩溃窗口由无秘密的 sessionEpoch marker 关闭,当前 `PASSWORD-CHANGE-OPENAPI-CONTRACT BLOCKED`,见 5.10。Task34 又固定 M05 为 currentPassword 再认证+新号 `APP_PHONE_CHANGE` TAC/6 位 OTP;换绑发码必须走专用 SaToken operation,最终 200 前换号、消费 OTP、提升 epoch、撤销 ALL session并持久化旧号通知,当前 `PHONE-CHANGE-OPENAPI-CONTRACT BLOCKED`,见 5.11。M04/M05 都不伪提交。
- 家谱创建:Task35 否决空谱+通用人物两写,固定 G03 最终按钮一次 atomic bootstrap;访问规则同版统一为 accessPreset,地区只提交 selectable 项的词法 code,结果未知按 operationKey 精确查询且本地不存始祖 PII。当前 `G03-BOOTSTRAP-OPENAPI-CONTRACT BLOCKED`,见 5.12;通过前不接宽松 create API。
- 帮助与反馈:M06 首批固定 `GET /genealogy/app/help-articles` 为完整列表唯一 owner,不调用详情、不消费 `helpId`;adapter 只允许投影分类、标题和纯文本正文,分类由当前列表动态派生。受保护双导出仍是通用 `ListResult/RList`,线上专用模型又缺 required、正文格式、仅发布和顺序语义,匿名行为也与文档 401 冲突,因此 `HELP-CENTER-OPENAPI-CONTRACT BLOCKED` 保持红灯,详见 5.4。`AppFeedbackBody.feedbackContent` 必填,`feedbackType/contactInfo` 可选且无 enumM07 已由 `appApi.submitFeedback` 精确 POST `/genealogy/app/feedback`,调用方不能关闭认证头,只接受 HTTP 200 与整数成功 `code`。mock 模式不伪提交;成功、确定失败、结果未知和迟到输入已分离。两页真实服务与 MuMu 验收都等待认证远端门禁关闭。
- 邀请:`GET /genealogy/app/promotions` 只返回推广内容与通用 `targetUrl`,没有家谱邀请码签发、校验、失效或直接加入端点,不能支撑产品邀请闭环。M08 已删除硬编码码值、剪贴板和海报伪能力,并显示不可用;未来只能接入“校验成功直接加入且不生成审核记录”的单一路径。
- VIP 与订单:线上存在套餐和订单的查询/创建端点,但当前文档未闭合支付方式、价格精度、订单状态、重复下单、支付回调、退款与续费语义。M09 不读取查询参数、不生成演示订单并保持不可用,待独立支付合规审查后再开放。
- 退出:Task32 固定 `DELETE /genealogy/app/auth/logout` 只撤销当前 bearer credential family,其他设备保持有效;同 client 的 active/revoked/expired 凭证重复调用都收敛为同一 200,非法/client 不匹配为 typed 401。客户端未来由唯一 logoutCoordinator 在同一同步段捕获 A、清本地并 bump epoch、用显式 A 启动不随 M10 卸载取消的请求,然后立即进入 A01;迟到结果不再 clear。当前本地/线上合同都缺 required、范围/幂等/no-store 与复用反例,`LOGOUT-OPENAPI-CONTRACT BLOCKED`,见 5.9。
## 三、52 个活动页面映射
表中“返回或完成目标”描述业务意图,不表示现有导航 API 已经正确;导航栈阶段需要用源码扫描、测试和 MuMu 完整流程逐项验证。A04 和 T01 已形成专项证据外,其余接口列继续标记“待对应业务阶段 OpenAPI 审查”,避免把旧思维导图、页面 mock 或 PC 接口误当成 App 合同。
表中“返回或完成目标”描述业务意图,不表示现有导航 API 已经正确;导航栈阶段需要用源码扫描、测试和 MuMu 完整流程逐项验证。A04、G 系列第一轮、F 系列当前写边界、T01 和新线上差异已形成专项证据其余接口列继续标记“待对应业务阶段 OpenAPI 审查”,避免把旧思维导图、页面 mock、旧离线快照或 PC 接口误当成当前 App 合同。
| 编号 | 页面 | 路由 | 当前业务目标 | 主要进入方式 | 返回或完成目标 | 必测状态 | 接口业务域 | 当前接口核对状态 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| A01 | 登录 | `pages/auth/a01-entry` | 完成密码、短信或微信认证并处理协议 | APP 启动、凭证失效、主动退出 | 成功进入 G01;取消或失败留在本页 | 密码、短信、协议错误、发送中、倒计时、授权取消、登录失败、凭证过期 | 认证与账户 | 待对应业务阶段 OpenAPI 审查 |
| A04 | 注册账号 | `pages/auth/a04-register` | 建立新账号并确认协议 | A01 注册入口 | 成功建立登录态并进入 G01;取消返回 A01 | 本地校验、行为验证、注册中、手机号占用、成功、失败、取消 | 认证与账户 | 已核对注册成功响应为 `LoginResult`;行为验证与短信流程仍待审 |
| A05 | 重设密码 | `pages/auth/a05-reset-password` | 验证手机号并设置新密码 | A01 忘记密码 | 成功返回 A01 的密码登录态;取消返回 A01 | 验证码、行为验证、密码策略、不一致、提交中、成功、失败、取消 | 认证与账户 | 待对应业务阶段 OpenAPI 审查 |
| G01 | 我的家谱 | `pages/genealogy/g01-my-genealogies` | 选择全局家谱并完成加入或创建分流 | 登录成功、根 Tab、业务完成回流 | 进入 G03、G05、G06、G09、G10、G12、T01 或 N01 | 正常、空、加载、失败、审核中、被拒绝、退出或移除、待录入始祖、切换弹层 | 家谱成员关系 | 待对应业务阶段 OpenAPI 审查 |
| G03 | 创建家谱 | `pages/genealogy/g03-create-genealogy` | 创建独立家谱并录入始祖 | G01 创建入口或待完善记录 | 创建后续接始祖步骤;始祖完成进入 G05;取消回来源 | 创建、重复提醒、创建失败、待完善、始祖校验、保存中、成功、中断恢复 | 家谱与成员关系 | 待对应业务阶段 OpenAPI 审查 |
| G05 | 家谱总览 | `pages/genealogy/g05-genealogy-overview` | 浏览家谱身份、来源和可信度并提供管理入口 | G01、G06 公开预览、G09 通过结果、G03 完成 | 返回 G01进入 T01、G08、G10、G11、G12 或 F01 | 公开预览、成员视图、所有者、加载、空、失败、无权限、新建引导 | 家谱与权限 | 待对应业务阶段 OpenAPI 审查 |
| G06 | 加入家谱 | `pages/genealogy/g06-search-genealogies` | 通过搜索或邀请码准确定位目标家谱或支系 | G01 空态或添加家谱弹层 | 进入 G05 公开预览、G08、G09;已加入或我创建时回 G01 并选中 | 初始、搜索中、结果、无结果、邀请码无效或过期、失败、六种用户关系 | 家谱搜索与邀请 | 待对应业务阶段 OpenAPI 审查 |
| G08 | 关系确认与入谱 | `pages/genealogy/g08-join-application` | 填写真实姓名、关系和说明并提交申请或直接加入 | G06 选定目标、G05 公开预览、G09 重新提交 | 搜索来源成进入 G09;邀请码成功回 G01 并选中新家谱 | 双来源、字段校验、提交中、成功、失败、重复提交、放弃填写 | 加入申请与邀请 | 待对应业务阶段 OpenAPI 审查 |
| G09 | 我的申请 | `pages/genealogy/g09-my-applications` | 查看、撤回或修改加入申请 | G01 申请分组、G08 搜索申请成功、G06 审核中或被拒绝状态 | 已通过进入 G05修改进入 G08撤回后保留明确结果 | 列表、空、失败、待审、通过、拒绝、撤回、重新提交 | 加入申请 | 待对应业务阶段 OpenAPI 审查 |
| G10 | 入谱审核 | `pages/genealogy/g10-application-review` | 所有者审核加入申请 | G01、G05 或 N01 审核消息 | 完成后刷新审核列表及来源计数;返回来源 | 列表、空、失败、通过确认、拒绝原因、提交中、无权限;拒绝字段使`aria-invalid``aria-describedby`、错误 `role="alert"` 并在空提交后聚焦 | 加入审核与权限 | 待对应业务阶段 OpenAPI 审查 |
| G11 | 家谱设置 | `pages/genealogy/g11-genealogy-settings` | 维护家谱名称、公开范围和访问说明 | G05 所有者管理入口 | 保存后刷新 G05;取消恢复原值并返回 | 加载、字段校验、保存中、成功、失败、无权限、未保存返回 | 家谱设置与权限 | 待对应业务阶段 OpenAPI 审查 |
| G12 | 字辈诗 | `pages/genealogy/g12-generation-poems` | 浏览与维护字辈序列 | G01 快捷入口或 G05 | 保存后刷新列表;取消返回来源 | 列表、空、编辑、校验、保存中、失败、无权限、长列表 | 字辈与权限 | 待对应业务阶段 OpenAPI 审查 |
| A01 | 登录 | `pages/auth/a01-entry` | 完成信认证并处理协议;密码与微信待合同关闭 | APP 启动、凭证失效、主动退出 | 成功进入 G01;取消或失败留在本页 | 短信、协议错误、TAC、发送中、倒计时、请求取消、登录失败、凭证过期 | 认证与账户 | `APP_SMS_LOGIN` 客户端链已落地;密码登录因 `API-AUTH-TAC-001` 硬关闭,后端与 MuMu 门禁见 2.10 |
| A04 | 注册账号 | `pages/auth/a04-register` | 建立新账号并确认协议 | A01 注册入口 | 成功建立登录态并进入 G01;取消返回 A01 | 本地校验、TAC、短信、注册中、手机号占用、成功、失败、取消 | 认证与账户 | `APP_REGISTER`、4 位码、`RAppLoginVo → AppLoginVo.access_token` 客户端链已落地;真实 challenge 与 OpenAPI 仍红灯,见 2.10 |
| A05 | 重设密码 | `pages/auth/a05-reset-password` | 验证手机号并设置新密码 | A01 忘记密码 | 成功返回 A01 的密码登录态;取消返回 A01 | 4 位码、TAC、密码策略、不一致、提交中、成功、失败、取消 | 认证与账户 | `APP_FORGOT_PASSWORD` 客户端链已落地;真实后端、Android 可访问替代与 MuMu 仍红灯,见 2.10 |
| G01 | 我的家谱 | `pages/genealogy/g01-my-genealogies` | 选择全局家谱并完成加入或创建分流 | 登录成功、根 Tab、业务完成回流 | 进入 G03、G05、G06、G09、G10、G12、T01 或 N01 | 正常、空、加载、失败、审核中、被拒绝、退出或移除、切换弹层、未读消息 | 家谱成员关系与通知计数 | Task26 工作区红灯已建立;`/mine` 尚未接远端,见 2.8/5.3Task29 unread-count 红灯要求与 M01 共用唯一未读数 owner,见 2.13/5.6 |
| G03 | 创建家谱 | `pages/genealogy/g03-create-genealogy` | 在同页收集家谱与始祖并最终原子创建 | G01 创建入口 | 门禁前进入 G05 本地预览;生产成功按 receipt→mine cache→context→G05 唯一次序收口,放弃零写 | 地区加载/失败、重复建议、始祖校验、提交中、PENDING、结果未知、fatal/quarantined、已提交待进入、放弃确认 | 家谱与成员关系 | Task35 已建立 atomic bootstrap、无 PII operation-status、统一 accessPreset、APP 可信地区与词法 ID 的后端/客户端双红灯;开放还依赖 Task26 workspace 与 MuMu,见 2.8/5.12 |
| G05 | 家谱总览 | `pages/genealogy/g05-genealogy-overview` | 按公开预览、成员、所有者或本地预览浏览身份、来源和可信度 | G01、G06、G09、G03 本地预览 | 返回实际来源;按权限进入 T01、G08、G10、G11、G12 或 F01 | 公开预览、成员视图、所有者、本地预览、加载、空、失败、无权限 | 家谱与权限 | Task26 选定 `/overview` 为唯一 owner;最小 schema、对象级授权和错误语义未关闭,丰富首屏字段另待取舍,见 2.8/5.3 |
| G06 | 加入家谱 | `pages/genealogy/g06-search-genealogies` | 通过搜索或邀请码本地校验定位目标家谱或支系 | G01 空态或添加家谱弹层 | 进入 G05、G08、G09;已加入或我创建时回 G01 | 初始、搜索中、结果、无结果、邀请码无效或过期、失败、六种用户关系 | 家谱搜索与邀请 | 第一轮已核对;邀请码验证与直入端点缺失,见 2.8 |
| G08 | 关系确认与入谱 | `pages/genealogy/g08-join-application` | 校验真实姓名、关系和说明并预览两种加入流程 | G06、G05 或 G09 的共享资格入口 | 搜索来源本地完成进入 G09;邀请码来源本地完成回 G01;均不建立成员关系 | 双来源、不可申请、字段校验、提交中、本地成功、失败、重复提交、放弃填写 | 加入申请与邀请 | 第一轮已核对;申请字段适配与邀请码票据缺失,见 2.8 |
| G09 | 我的申请 | `pages/genealogy/g09-my-applications` | 查看申请并预览撤回或重新申请 | G01、G08 本地流程、G06 审核中 | 已通过进入 G05;可重申记录进入 G08本地撤回不改变服务器状态 | 列表、空、失败、待审、通过、拒绝、本地撤回、重新提交 | 加入申请 | 第一轮已核对;类型化申请行已存在,正式状态字典与词法 `applyId` 适配待补,见 2.8 |
| G10 | 入谱审核 | `pages/genealogy/g10-application-review` | 所有者预览通过或拒绝申请 | G01、G05 或 N01 审核消息 | 本页只更新本地预览;取消或返回不产生导航结果 | 列表、空、失败、通过确认、拒绝原因、提交中、无权限;拒绝字段用 `aria-describedby` 保留错误关联和失败聚焦 | 加入审核与权限 | 第一轮已核对;类型化申请行与审核体已存在,正式状态字典和词法 int64 适配待补,见 2.8 |
| G11 | 家谱设置 | `pages/genealogy/g11-genealogy-settings` | 本地维护名称、访问预设和家谱简介 | G05 所有者管理入口 | 保存只更新本页预览;取消恢复原值并返回 | 加载、字段校验、本地成功、失败、无权限、未保存返回 | 家谱设置与权限 | 第一轮已核对;Task35 只统一 accessPreset 字段,真实写入仍须独立 If-Match、版本/CAS、权限刷新与结果未知门禁,见 2.8/5.12 |
| G12 | 字辈诗 | `pages/genealogy/g12-generation-poems` | 分批浏览并本地维护完整字辈序列 | G01 快捷入口或 G05 | 保存只更新本地列表;取消恢复编辑快照并返回来源 | 列表、空、编辑、校验、无权限、500 代分批渲染、停用但保留历史 | 字辈与权限 | 第一轮已核对;batch 首项世代未定义,真实保存须以服务端 preview 为准,见 2.8 |
| T01 | 世系树 | `pages/tree/t01-tree-overview` | 以当前成员为焦点阅读可扩展世系窗口,并在图、概览和线性列表间定位成员 | G01 快捷入口或 G05 | 返回来源;进入单实例 T03、T04、T06、T07 | 上二代/下二代初始窗口、搜索、四级 LOD、多配偶联合点、宽支系聚合、代际缺口、四类边界、图/列表、空、失败、版本冲突、500 节点性能;节点与线由同一 Canvas/矩阵/帧绘制 | 世系与成员 | 专项已核对:现有递归 `LineagePersonTreeView` 不满足;待后端按规范图窗口问题单更新 Apifox |
| T03 | 成员档案 | `pages/tree/t03-member-profile` | 在单个原生页面实例内查看成员资料、亲属与受控状态 | T01、T07、R02 的成员关联 | 页内成员轨迹优先返回;轨迹结束后回实际来源;进入 T05、T08 | A→B→C→B→A 页内轨迹、可编辑、隐私、无权限、成员缺失、加载失败、离世状态;读取成功后才推进轨迹 | 成员档案与权限 | 待对应业务阶段 OpenAPI 审查 |
| T04 | 新增亲属 | `pages/tree/t04-add-relative` | 录入首位成员或为目标成员新增亲属 | T01 指定节点或空树入口 | 保存后回 T01 并精确定位新成员;取消回实际来源 | 首位成员、普通亲属、关系选择、必填、长摘要、保存中、成功、失败、放弃确认 | 成员与亲属关系 | 待对应业务阶段 OpenAPI 审查 |
| T05 | 编辑成员 | `pages/tree/t05-edit-member` | 修改指定成员身份和生平资料 | T03 编辑入口 | 保存后返回 T03 并刷新;取消回 T03 | 加载、字段校验、长简介、保存中、成功、失败、无权限、放弃确认 | 成员档案与权限 | 待对应业务阶段 OpenAPI 审查 |
| T06 | 编辑关系 | `pages/tree/t06-edit-relationship` | 校正两个现有成员之间的关系 | T01 关系操作 | 保存后返回 T01 并刷新关系;取消回来源 | 成员选择、校验、冲突、循环关系、冲突规则弹窗、保存中、失败、无权限 | 亲属关系与权限 | 待对应业务阶段 OpenAPI 审查 |
| T04 | 新增亲属 | `pages/tree/t04-add-relative` | 录入首位成员或为目标成员新增亲属 | T01 指定节点或空树入口 | 当前只生成“尚未提交服务器”的本地预览,确认放弃后无结果回 T01;真实写成功后才定位新成员 | 首位成员、普通亲属、关系选择、必填、长摘要、保存中、本地预览、失败、放弃确认 | 成员与亲属关系 | 待对应业务阶段 OpenAPI 审查 |
| T05 | 编辑成员 | `pages/tree/t05-edit-member` | 修改指定成员身份和生平资料 | T03 编辑入口 | 当前本地预览确认放弃后用 `goBack()` 回原 T03 实例且不产生结果;真实写成功后才刷新当前活动成员 | 加载、字段校验、长简介、保存中、本地预览、失败、无权限、放弃确认 | 成员档案与权限 | 待对应业务阶段 OpenAPI 审查 |
| T06 | 编辑关系 | `pages/tree/t06-edit-relationship` | 校正两个现有成员之间的关系 | T01 关系操作 | 当前只生成“尚未提交服务器”的本地预览,确认放弃后无结果回 T01;真实写成功后才刷新关系 | 成员选择、校验、冲突、循环关系、冲突规则弹窗、保存中、本地预览、失败、无权限 | 亲属关系与权限 | 待对应业务阶段 OpenAPI 审查 |
| T07 | 成员目录 | `pages/tree/t07-member-directory` | 搜索、筛选并选择家谱成员 | T01 成员目录入口 | 进入 T03;返回 T01 并恢复目录现场 | 完整列表、筛选、搜索无结果、明确空态、失败重试、加载、长列表、成员选择 | 成员查询 | 待对应业务阶段 OpenAPI 审查 |
| T08 | 成员状态 | `pages/tree/t08-member-states` | 解释成员隐私、纪念或无权限状态 | T03 人物状态入口 | 返回 T03;家谱不可用时回 G01 | 隐私隐藏、离世纪念、无权限、无效成员、权限变化 | 成员状态与权限 | 待对应业务阶段 OpenAPI 审查 |
| F01 | 家族动态 | `pages/family/f01-family-feed` | 展示家族动态并承载内容和档案入口 | 根 Tab 或 G05 | 进入 F02—F04、F07、F10、R01、R03、R05、R10、R11 | 加载、列表、空、失败、刷新、分页、无可用家谱 | 家族内容聚合 | 待对应业务阶段 OpenAPI 审查 |
| F02 | 发布动态 | `pages/family/f02-publish-feed` | 发布家族文字或媒体动态 | F01 发布入口 | 成功回 F01 并刷新;取消保留或确认放弃 | 表单、空内容校验、长内容、媒体权限、提交中、成功、失败、重复提交、取消 | 动态发布与上传 | 待对应业务阶段 OpenAPI 审查 |
| F03 | 动态详情 | `pages/family/f03-feed-detail` | 阅读动态并查看或提交评论 | F01 动态卡 | 返回 F01 并恢复现场 | 加载、正常、内容失效、失败、评论校验、提交失败、插入成功、无权限 | 动态与评论 | 待对应业务阶段 OpenAPI 审查 |
| F04 | 谱文列表 | `pages/family/f04-article-list` | 分类、搜索和浏览谱文 | F01 谱文入口 | 进入 F05 或 F06;返回 F01 | 加载、列表、分类、搜索无结果并重置、空、失败、长列表、新建 | 谱文 | 待对应业务阶段 OpenAPI 审查 |
| F05 | 谱文详情 | `pages/family/f05-article-detail` | 阅读、收藏和按权限编辑谱文 | F04 谱文卡 | 返回 F04;有权限进入 F06 | 加载、正常、收藏切换、编辑、失效、隐私、失败、无权限 | 谱文与权限 | 待对应业务阶段 OpenAPI 审查 |
| F06 | 编辑谱文 | `pages/family/f06-article-editor` | 新建或编辑谱文草稿 | F04 新建或 F05 编辑 | 保存或发布后回 F04/F05 并刷新;取消确认放弃 | 新建、编辑、校验、加载、草稿、保存中、失败保留并重试、成功回流、长正文 | 谱文编辑 | 待对应业务阶段 OpenAPI 审查 |
| F07 | 相册列表 | `pages/family/f07-album-list` | 浏览和创建家族相册 | F01 相册入口 | 进入 F08返回 F01 | 加载、列表、长列表、空、失败、相册导航、创建弹窗、校验、插入和轻提示、权限 | 相册 | 待对应业务阶段 OpenAPI 审查 |
| F08 | 相册详情 | `pages/family/f08-album-detail` | 浏览照片墙和相册信息 | F07 相册卡 | 返回 F07;进入 F09 | 加载、照片墙、末张预览、Android 返回先关预览、空相册、相册失效、失败、权限 | 相册与媒体 | 待对应业务阶段 OpenAPI 审查 |
| F09 | 上传照片 | `pages/family/f09-media-upload` | 选择照片填写逐张说明并上传 | F08 添加照片入口 | 成功回 F08 并刷新;取消确认放弃 | 初始、权限、最多九张、增删、当前照片独立说明、必填、上传锁定与进度、取消、失败重试、成功 | 媒体上传 | 待对应业务阶段 OpenAPI 审查 |
| F10 | 家族视频 | `pages/family/f10-video-list` | 说明当前视频服务尚未开放 | F01 视频入口 | 当前只返回 F01 | 待开放、返回 F01;未来列表、上传和接口状态只登记为对应业务阶段依赖,不冒充当前功能 | 视频服务 | 待对应业务阶段 OpenAPI 审查 |
| R01 | 人物录 | `pages/records/r01-people-list` | 搜索和浏览家族人物记录 | F01 人物录入口 | 进入 R02;返回 F01 | 加载、列表、搜索、无结果、空、失败、分页、新建权限 | 人物记录 | 待对应业务阶段 OpenAPI 审查 |
| R02 | 人物详情 | `pages/records/r02-person-detail` | 查看新建编辑人物记录 | R01 人物卡或新建入口 | 保存后回 R01 并刷新;进入 R08/R09;取消回来源 | 查看、新建、编辑、校验、保存中、成功、失败、隐私、失效 | 人物记录与权限 | 待对应业务阶段 OpenAPI 审查 |
| R03 | 贺礼簿 | `pages/records/r03-gift-list` | 浏览、筛选和新增贺礼记录 | F01 贺礼簿入口 | 进入 R04;返回 F01 | 加载、列表、空、失败、筛选、分页、新增权限 | 贺礼记录 | 待对应业务阶段 OpenAPI 审查 |
| R04 | 贺礼编辑 | `pages/records/r04-gift-editor` | 查看、新增、编辑或删除贺礼 | R03 记录或新增入口 | 保存或删除后回 R03 并刷新;取消回来源 | 查看、新、编辑、校验、保存中、成功、失败、删除确认、无权限 | 贺礼记录与权限 | 待对应业务阶段 OpenAPI 审查 |
| R05 | 礼仪列表 | `pages/records/r05-ritual-list` | 浏览和创建家族礼仪活动 | F01 礼仪入口 | 进入 R06 或 R07;返回 F01 | 加载、列表、空、失败、活动状态、分页、新建权限 | 礼仪活动 | 待对应业务阶段 OpenAPI 审查 |
| R06 | 礼仪详情 | `pages/records/r06-ritual-detail` | 查看礼仪信息、参与者和状态 | R05 活动卡 | 返回 R05有权限进入 R07 | 加载、详情、参与者、失败、失效、无权限 | 礼仪活动与参与 | 待对应业务阶段 OpenAPI 审查 |
| R07 | 礼仪编辑 | `pages/records/r07-ritual-editor` | 新建或编辑礼仪活动 | R05 新建或 R06 编辑 | 保存或删除后回 R05 并刷新;取消回来源 | 新建、编辑、校验、保存中、成功、失败、删除确认、无权限 | 礼仪活动与权限 | 待对应业务阶段 OpenAPI 审查 |
| R08 | 成长日志 | `pages/records/r08-growth-journal` | 展示人物成长时间轴并新增记录 | R02 或 T03 人物入口 | 保存后插入时间轴并给出轻提示;返回人物来源 | 加载、时间轴、空、失败、新增弹窗、必填、长文内部滚动、保存、权限 | 人物成长记录 | 待对应业务阶段 OpenAPI 审查 |
| R09 | 人生事 | `pages/records/r09-life-events` | 展示人物人生事件时间轴并新增记录 | R02 或 T03 人物入口 | 保存后插入时间轴并给出轻提示;返回人物来源 | 加载、时间轴、空、失败、新增、校验、保存、权限 | 人生事件 | 待对应业务阶段 OpenAPI 审查 |
| R10 | 家族备忘 | `pages/records/r10-memo-list` | 管理家族备忘和完成状态 | F01 备忘入口 | 新增或切换完成后刷新本页;返回 F01 | 加载、列表、空、失败、新增校验、完成、重新打开、重复操作、权限 | 家族备忘 | 待对应业务阶段 OpenAPI 审查 |
| R11 | 功德记录 | `pages/records/r11-merit-records` | 记录贡献并展示汇总 | F01 功德录入口 | 新增后实时刷新汇总列表并给出轻提示;返回 F01 | 加载、汇总、列表、空、失败、新增、校验、保存中、权限 | 功德与贡献 | 待对应业务阶段 OpenAPI 审查 |
| N01 | 消息中心 | `pages/notification/n01-message-center` | 汇总消息、维护已读状态并分流业务 | G01 或 M01 消息入口 | 进入 N02 或对应 G10 等业务页面;返回来源 | 加载、未读、已读、全部已读、空、失败、审核消息、分页 | 消息与通知 | 待对应业务阶段 OpenAPI 审查 |
| N02 | 消息详情 | `pages/notification/n02-message-detail` | 展示消息正文并安全跳转到业务目标 | N01 消息卡 | 返回 N01;有效目标进入对应业务页 | 加载、详情、已读、失效消息、无目标、业务目标过期、失败 | 消息与业务分流 | 待对应业务阶段 OpenAPI 审查 |
| M01 | 我的 | `pages/profile/m01-profile-home` | 展示个人资料、提醒和服务导航 | 根 Tab | 进入 M02、M03、M06、M08、M09、M10 或 N01 | 加载、正常、失败、提醒、资料不完整、服务可用性 | 个人中心聚合 | 待对应业务阶段 OpenAPI 审查 |
| M02 | 个人资料 | `pages/profile/m02-edit-profile` | 查看并编辑头像和基础资料 | M01 资料入口 | 保存后回 M01 并刷新;取消回来源 | 加载、头像权限、字段校验、保存中、成功、失败、未保存返回 | 用户资料与上传 | 待对应业务阶段 OpenAPI 审查 |
| M03 | 账号与安全 | `pages/profile/m03-security-settings` | 汇总密码、手机号和设备安全入口 | M01 安全入口 | 进入 M04 或 M05;返回 M01 | 加载、正常、异常提醒、失败、设备状态 | 账号安全 | 待对应业务阶段 OpenAPI 审查 |
| M04 | 修改密码 | `pages/profile/m04-change-password` | 验证旧密码并设置新密码 | M03 密码入口 | 成功回 M03 或按安全合同重新登录;取消回 M03 | 旧密码错误、统一密码策略、新旧相同、不一致、提交中、成功、失败、重复提交 | 账号安全 | 待对应业务阶段 OpenAPI 审查 |
| M05 | 修改手机号 | `pages/profile/m05-change-phone` | 验证并更换绑定手机号 | M03 手机号入口 | 成功回 M03 并刷新;取消回 M03 | 当前身份校验、新号码、验证码、倒计时、号码占用、成功、失败 | 账号安全短信 | 待对应业务阶段 OpenAPI 审查 |
| M06 | 帮助中心 | `pages/profile/m06-help-center` | 搜索和浏览帮助内容 | M01 帮助入口 | 返回 M01;无法解决时进入 M07 | 加载、分类、搜索无结果、失败、内容失效 | 帮助内容 | 待对应业务阶段 OpenAPI 审查 |
| M07 | 意见反馈 | `pages/profile/m07-feedback` | 提交问题说明和联系信息 | M06 联系入口 | 成功给出明确结果后返回 M06或 M01;取消回来源 | 校验、附件权限、提交中、成功、失败、重复提交、取消 | 用户反馈与上传 | 待对应业务阶段 OpenAPI 审查 |
| M08 | 应用推广 | `pages/profile/m08-promotion` | 生成并分享家谱邀请信息 | M01 推广入口 | 分享成功、取消或失败均留有明确结果;返回 M01 | 邀请码、海报生成、系统分享权限、取消、失败、过期 | 邀请与系统分享 | 待对应业务阶段 OpenAPI 审查 |
| M09 | VIP 与订单 | `pages/profile/m09-vip-orders` | 展示服务权益和订单;当前明确未开放付费 | M01 服务入口 | 当前关闭说明返回 M01;未来进入合规订单流程 | 待开放、无订单、订单列表、加载失败、支付取消、退款边界 | 服务权益、订单与支付 | 待对应业务阶段 OpenAPI 审查 |
| M10 | 关于家谱 | `pages/profile/m10-about-settings` | 展示版本协议、隐私并处理退出登录 | M01 设置入口 | 协议关闭留在本页;退出成功清凭证并回 A01;取消留在本页 | 版本、协议、隐私、退出确认、取消、退出失败 | 配置、协议与认证 | 待对应业务阶段 OpenAPI 审查 |
| F01 | 家族动态 | `pages/family/f01-family-feed` | 按当前成员家谱展示动态并承载内容和档案入口 | 根 Tab 或 G05 | URL 已规范化后进入 F02—F04、F07、F10、R01、R03、R05、R10、R11 | 加载、列表、空、失败、无有效家谱、跨谱失败关闭 | 家族内容聚合 | 任务 7 已核对;线上有动态列表/写入能力,当前静态批次只读且按家谱隔离 |
| F02 | 发布动态 | `pages/family/f02-publish-feed` | 编辑文字或媒体动态的本地预览 | F01 发布入口 | 预览不发布、不产出结果;取消保留或确认放弃后回同一 F01 | 表单、空内容校验、长内容、媒体权限、本地预览、无权限、放弃确认 | 动态发布与上传 | 线上写请求要求 `feedContent` 且 minLength=1,另有 `feedType/mediaOssIds/sortOrder/status`;真实调用与媒体上传未启用,mock 以 `WRITE_UNAVAILABLE` 失败关闭,详见 2.11 |
| F03 | 动态详情 | `pages/family/f03-feed-detail` | `genealogyId + feedId` 阅读动态并编辑评论草稿 | F01 动态卡 | 评论只在本页预览,不插入、不计数、不清空;返回同一 F01 | 加载、正常、内容失效、失败、评论校验、本地预览、无权限 | 动态与评论 | 线上评论写请求要求 `commentContent`,文档边界为 minLength=0/maxLength=1000;当前未调用写接口,不宣称发送成功,详见 2.11 |
| F04 | 谱文列表 | `pages/family/f04-article-list` | 按家谱分类、搜索和浏览谱文 | F01 谱文入口 | 进入精确 F05 或 create 模式 F06;返回同一 F01 | 加载、列表、分类、搜索无结果并重置、空、失败、长列表、新建权限 | 谱文 | 任务 7 已核对线上列表及写接口;当前列表由唯一只读 owner 提供深拷贝 |
| F05 | 谱文详情 | `pages/family/f05-article-detail` | `genealogyId + articleId` 阅读并按权限进入编辑 | F04 谱文卡 | 返回同一 F04;有权限进入 edit 模式 F06 | 加载、正常、收藏暂未开放、编辑、失效、隐私、失败、无权限 | 谱文与权限 | 线上未证明收藏合同,当前禁用收藏;文章写请求要求 `articleTitle/articleContent` 且均为 minLength=1,详见 2.11 |
| F06 | 编辑谱文 | `pages/family/f06-article-editor` | 新建或编辑谱文的本地预览 | F04 新建或 F05 编辑 | create 回 F04edit 回精确 F05;预览不保存、不产出结果 | 新建、编辑、校验、加载、本地预览、失败保留、长正文、放弃确认 | 谱文编辑 | 线上 POST/PUT 已存在,`categoryId/coverOssId` 为 int64;真实调用未在导航批次启用,详见 2.11 |
| F07 | 相册列表 | `pages/family/f07-album-list` | 按家谱浏览相册并制作独立的新相册预览 | F01 相册入口 | 正式相册进入 F08本地预览不插入列表;返回同一 F01 | 加载、列表、长列表、空、失败、创建弹窗、本地预览、校验、权限、放弃确认 | 相册 | 线上创建要求 `albumName`;当前不调用写接口、不伪增列表或计数 |
| F08 | 相册详情 | `pages/family/f08-album-detail` |`genealogyId + albumId` 浏览照片墙和相册信息 | F07 相册卡 | 先关闭照片预览,再返回 F07;进入同一相册的 F09 | 加载、照片墙、末张预览、Android 返回先关预览、空相册、相册失效、失败、权限 | 相册与媒体 | 任务 7 已核对;当前严格按复合身份读快照,未知或跨谱相册不回退首条 |
| F09 | 上传照片 | `pages/family/f09-media-upload` | 选择照片填写批量及逐张说明的本地预览 | F08 添加照片入口 | 预览不上传、不生成成功态;取消确认放弃后回同一 F08 | 初始、权限、最多九张、增删、独立说明、必填、本地预览、放弃确认、无效相册 | 媒体上传 | 旧 `/files/upload` 已下线;resumable init/chunk/complete 的 complete 返回 `ossId` 为 string,而照片创建要求 int64;后端消除类型冲突前不得转换或提交,详见 2.11 |
| F10 | 家族视频 | `pages/family/f10-video-list` | 按有效家谱说明当前视频服务尚未开放 | F01 视频入口 | 当前只返回同一 F01 | 待开放、无效家谱、返回 F01;未来能力不冒充当前功能 | 视频服务 | 任务 7 未发现可支撑当前页面闭环的已启用视频产品合同,保持关闭 |
| R01 | 人物录 | `pages/records/r01-people-list` | 按当前家谱搜索和浏览人物只读快照 | F01 人物录入口 | 进入带精确家谱与模式的 R02;返回 F01 | 加载、列表、搜索、无结果、空、失败、分页、跨谱失败 | 人物记录 | 任务 8 已核对 `lineage/persons/page`;ID 必须保持词法字符串,真实分页尚未接入 |
| R02 | 人物详情 | `pages/records/r02-person-detail` | 查看人物或制作不写库的新建/编辑预览 | R01 人物卡或预览入口 | 预览不产出结果;进入 R08 或硬关闭的 R09;取消回来源 | 查看、新建、编辑、校验、预览、隐私、失效、跨谱 | 人物记录与权限 | 任务 8 已核对 `AppLineagePersonBody``name` 必填;真实写入未启用,权限字典待补 |
| R03 | 贺礼簿 | `pages/records/r03-gift-list` | 浏览同谱人情往来只读快照 | F01 贺礼簿入口 | 进入携带 `relativeId` R04;返回 F01 | 加载、列表、空、失败、跨谱 | 人情往来 | 任务 8 已核对 `relative-records`,不是 ceremony gifts;收礼/送礼方向语义仍缺 |
| R04 | 贺礼编辑 | `pages/records/r04-gift-editor` | 查看往来记录或制作不写库的本地预览 | R03 记录或预览入口 | 预览不插入列表、不删除记录;取消回来源 | 查看、新、编辑、校验、本地预览、无效实体、跨谱 | 人情往来与权限 | 任务 8 已核对 `relativeId``relativeName` 必填;真实写入未启用,只允许本地预览 |
| R05 | 礼仪列表 | `pages/records/r05-ritual-list` | 浏览同谱礼仪活动只读快照 | F01 礼仪入口 | 进入 R06 或 R07 预览;返回 F01 | 加载、列表、空、失败、活动展示、跨谱 | 礼仪活动 | 任务 8 已核对 ceremonies`ceremonyTitle/ceremonyType` 必填且类型、状态无正式枚举 |
| R06 | 礼仪详情 | `pages/records/r06-ritual-detail` | 查看精确礼仪与受邀人快照 | R05 活动卡 | 返回 R05;进入同一礼仪 R07 | 加载、详情、受邀人、失败、失效、跨谱 | 礼仪活动与邀请 | 任务 8 已核对 invitations;姓名需与成员选项受控联接,不能把受邀者冒充参与者 |
| R07 | 礼仪编辑 | `pages/records/r07-ritual-editor` | 制作新建或编辑礼仪的本地预览 | R05 预览入口或 R06 编辑入口 | create 预览回 R05edit 预览回原 R06;不产出结果 | 新建、编辑、校验、本地预览、无效实体、跨谱 | 礼仪活动与权限 | 任务 8 已核对 `ceremonyId`;必填与枚举见 R05,真实写入未启用 |
| R08 | 成长日志 | `pages/records/r08-growth-journal` | 按同谱人物展示成长快照并制作独立预览 | R02 或 T03 人物入口 | 预览不插入正式时间轴;返回实际人物来源 | 加载、时间轴、空、失败、预览弹窗、必填、跨谱 | 人物成长记录 | 任务 8 已核对 growth-records;客户端必须强制 `lineagePersonId``recordType` 无枚举 |
| R09 | 人生事 | `pages/records/r09-life-events` | 明确说明人生事件服务当前不可用 | R02 或 T03 人物入口 | 不读取或写入成长记录;安全返回人物来源 | 接口缺失、无效人物、返回来源 | 人生事件 | 任务 8 已核对:没有独立人生事件接口,后端补端点或正式类型字典前硬关闭 |
| R10 | 家族备忘 | `pages/records/r10-memo-list` | 浏览同谱备忘快照并制作独立预览 | F01 备忘入口 | 预览不插入列表、不切换正式完成状态;返回 F01 | 加载、列表、空、失败、预览、跨谱 | 家族备忘 | 任务 8 已核对 memos,`memoTitle` 必填而 `completed` 无枚举,真实切换未启用 |
| R11 | 功德记录 | `pages/records/r11-merit-records` | 浏览只读汇总并制作独立贡献预览 | F01 功德录入口 | 预览不改变正式汇总列表;返回 F01 | 加载、汇总、列表、空、失败、预览、跨谱 | 功德与贡献 | 任务 8 已核对 merit-records`donorName/meritTitle` 必填,类型、状态与金额边界无枚举 |
| N01 | 消息中心 | `pages/notification/n01-message-center` | 展示当前账号完整活动通知快照与服务端读状态,不猜业务目标 | G01 或 M01 消息入口 | 以当前内存 `snapshotKey` 进入 N02;返回来源 | 加载、未读、已读、空、失败重试、认证失效、长内容、并发刷新 | 消息与通知 | Task29 读取红灯已建立;完整活动集合、专用 required、纯文本、时区、二值状态和计数同域待关闭,见 2.13/5.6;Task30 前不得本地伪写 |
| N02 | 消息详情 | `pages/notification/n02-message-detail` | 从当前 generation 的内存快照展示完整纯文本正文,不持有服务端 ID | N01 消息卡 | 返回 N01;无快照时提示从消息中心重新打开,不跳业务页 | 加载、详情、无快照、认证失效、长正文、读状态写入待开放 | 消息与通知状态 | Task29 选定 list-owned snapshot 且删除目标 CTATask30 独立约束私有字符串 ID 与幂等写入,见 2.13/5.6/5.7 |
| M01 | 我的 | `pages/profile/m01-profile-home` | 展示脱敏账号身份并保持通知、服务与设置入口可达 | 根 Tab | 进入 M02、M03、M06、M08、M09、M10 或 N01 | 身份与通知局部加载、正常、失败重试、认证失效、未读数不可用、服务可用性 | 个人中心聚合 | Task28 profile GET 红灯保证身份失败不锁菜单,见 2.13/5.5Task29 unread-count 红灯删除 fixture 伪数并统一“未读消息”,见 2.13/5.6 |
| M02 | 个人资料 | `pages/profile/m02-edit-profile` | 从唯一 profile owner 初始化并以版本化 dirty-only merge 保存昵称、真实姓名和邮箱 | M01 资料入口 | 成功应用权威响应并留在本页;放弃确认后回 M01 | 加载、失败重试、认证失效、异步 baseline、字段校验、保存、结果未知、版本冲突、账号切换、头像未接入 | 用户资料 | Task28 读取红灯仍是前置;Task31 已建立 PUT merge、清空、If-Match、typed response 和 409 红灯,头像不混入,见 2.13/5.5/5.8 |
| M03 | 账号与安全 | `pages/profile/m03-security-settings` | 展示密码入口与脱敏绑定手机号,不伪造设备安全结论 | M01 安全入口 | 进入 M04 或 M05;返回 M01 | 手机号局部加载、正常、失败重试、认证失效、功能受限 | 账号安全 | Task28 已建立 profile GET 红灯;普通读取失败不得阻断密码入口,设备状态仍无合同,见 2.13/5.5 |
| M04 | 修改密码 | `pages/profile/m04-change-password` | 以当前密码重新认证并安全更新统一密码凭证;门禁前保持本地预览 | M03 密码入口 | 确定错误留页;200/401/409/结果未知清本机并回 A01;放弃确认回 M03 | 空字段、15/64 边界、Unicode/NFC、blocklist、当前错误、并发、限流、提交中、结果未知、进程终止 | 账号安全与会话 | Task33 已建立 raw writeOnly、ALL 会话撤销、typed 错误与 session marker 红灯;四条密码 wire 必须同批迁移,见 2.13/5.10 |
| M05 | 修改手机号 | `pages/profile/m05-change-phone` | 以当前密码重新认证,并通过受保护 TAC/6 位 OTP 验证新号码;门禁前保持本地预览 | M03 手机号入口 | 确定错误留页;最终 200/401/409/结果未知清本机回 A01;放弃确认回 M03 | 当前密码、新号、TAC、发送与倒计时、6 位码、占用、限流、提交中、并发、结果未知、进程终止 | 账号安全短信与会话 | Task34 已建立专用 SaToken 发码、全活动六位码、ALL 会话撤销、outbox 与 credential marker 红灯;依赖 M04 raw wire,见 2.13/5.11 |
| M06 | 帮助中心 | `pages/profile/m06-help-center` | 从完整帮助列表搜索、分类并展开纯文本正文,无法解决时进入反馈 | M01 帮助入口 | 返回 M01;无法解决时进入 M07 | 加载、服务端空、分类、搜索无结果、展开、失败重试、认证失效、取消 | 帮助内容 | Task27 选定列表唯一 owner 并建立红灯;专用 required、纯文本、仅发布、顺序和认证语义待后端关闭,见 2.13/5.4 |
| M07 | 意见反馈 | `pages/profile/m07-feedback` | 通过唯一真实 owner 提交必填内容及可选类型、联系方式 | M06 联系入口 | 成功留页保留提交快照;编辑后可再提交;未提交修改放弃确认回 M06 | 必填、提交中、成功防重、失败、结果未知、mock 不可提交、未保存返回 | 用户反馈 | Task25 已接 `POST /genealogy/app/feedback` 严格客户端;remote 实测与 MuMu 待认证门禁关闭,见 2.13 |
| M08 | 应用推广 | `pages/profile/m08-promotion` | 明确说明邀请码服务当前不可用 | M01 推广入口 | 查看不可用说明;返回 M01 | 无可用邀请码、服务未接入、说明弹层 | 邀请与系统分享 | 线上无邀请码签发/校验/直入合同,已删除码值、复制和海报伪能力,见 2.13 |
| M09 | VIP 与订单 | `pages/profile/m09-vip-orders` | 展示基础说明并明确订单服务当前不可用 | M01 服务入口 | 查看关闭说明返回 M01 | 服务未开放、无订单数据、说明弹层 | 服务权益、订单与支付 | 套餐/订单端点存在但支付闭环未定义,已删除查询参数演示订单,见 2.13 |
| M10 | 关于家谱 | `pages/profile/m10-about-settings` | 从 manifest 展示版本协议说明,并安全退出当前设备凭证族 | M01 设置入口 | 协议/退出取消留在本页;确认后立即清本机并回 A01,远端结果只更新一次性提示 | 版本、协议、隐私、退出确认、双击、pending、撤销确认/未确认/拒绝、账号竞态、根导航失败 | 配置、协议与认证 | Task9 已完成本机清理基线;Task32 已建立当前凭证族、幂等 200、logoutCoordinator、required RVoid 与部署复用红灯,见 2.13/5.9 |
## 四、封存与已移除页面
@@ -236,7 +307,8 @@ M01 我的
- 页面与动作:A04 提交注册并建立会话。
- 当前接口:`POST /genealogy/app/auth/register`
- 已确认响应:HTTP `200` 复用 `LoginResult``data` 引用 `LoginVo`可返回 `token/accessToken/tokenValue`
- 已确认响应:受保护旧快照的响应形状已经过期;2026-07-22 新线上注册成功响应为 `RAppLoginVo``data` 引用 `AppLoginVo`唯一会话字段为 `access_token`。密码登录与短信登录使用同一响应链
- 客户端合同:`utils/api.js` 只消费 `AppLoginVo.access_token`;旧字段读取已经删除。必须等同版本双导出落地后再把页面接到远端,不能把线上证据手工写回受保护源文件。
- 产品结论:取得并保存有效令牌后直接清理认证流程并进入 G01;不保留“注册成功后再登录”的并行终点。
- 尚未关闭范围:短信发送、行为验证、限流和验证码状态机不由本结论代替,按后续短信阶段单独审查。
@@ -274,9 +346,187 @@ PATCH /genealogy/app/v2/genealogies/{genealogyId}/lineage/relationships/{relatio
- overview 只接受必填 `treeVersion`,版本变化返回 `409 TREE_VERSION_CHANGED`;响应以 `state=EMPTY/POPULATED` 使用 `oneOf`。EMPTY 精确为 `genealogyPersonCount=0、genealogyRootPersonIds=[]、redactedGenealogyRootCount=0、generationRange=null、buckets=[]`;POPULATED 要求正数总量、非空范围和 buckets,并满足可见根数加隐私根数至少为 1、全部 bucket 三类计数之和等于总量。可见根与 bucket `focusPersonId` 只能使用 VISIBLE 稳定 ID,隐私根只计数不返回 opaque ID。locator 将 `rootVisibility=VISIBLE/REDACTED``pathCompleteness=COMPLETE/REDACTED_GAPS` 独立建模;`ancestorPathSegments` 用 VISIBLE 人物 ID 段与不含 ID 的 REDACTED gap 段表达任意中间隐私,支持可见根但中间祖先隐藏,任何路径都不得包含 opaque ID。
- 世系写接口携带 `If-Match`,成功返回新 `treeVersion` 以及受影响人员、家庭和关系 ID;关系 PATCH 以不可变 `relationshipKind` 为 discriminator 使用 `oneOf`PARTNER 只更新 `relationType/status`PARENT_CHILD 只更新 `relationType/parentRole`。每个分支至少提交一个可修改字段,省略字段保持原值;只有 `relationshipKind` 的空更新返回 `422 RELATIONSHIP_PATCH_EMPTY`,不得偷换参与人。
- 客户端 Scene 根固定为 `{ sceneVersion, treeVersion, focusPersonId, bounds, items }``utils/lineage/scene.js` 唯一生成 `sceneVersion`,缺失版本或相同版本对应不同 payload 均拒绝原子替换。瞬时 `selectedId` 不进入 Scene 或版本摘要,renderjs 只用它在同一 Canvas 动态重绘光晕。
- OpenAPI 必须列出 `400/401/403/404/422/429/5xx`、409、字符串 ID、nullable 头像和 `additionalProperties: false`
- 四条操作统一声明 `200/400/401/403/404/422/429/5XX`tree、overview、relationship PATCH 另声明 `409`。错误响应根层唯一业务码字段为必填字符串 `businessCode`,稳定码必须在对应响应 `oneOf` 分支中用单值 enumOpenAPI 3.1 可用 `const`)表达;关键词、description、example 和无关 metadata 都不算证明。非空 `generationRange` 固定为关闭额外字段的 `{ minGeneration, maxGeneration }`,两项均为大于等于 1 的整数,大小顺序交给运行时 validator
- 旧 v1 树路径保持原合同;App 只实现上述四条固定 `/genealogy/app/v2/...` 路径,不双读、不运行时探测版本。
**关闭条件:** 用户从更新后的 Apifox 重新导出 JSON/YAML;两份文件同时通过 `tests/lineage-openapi-contract.ps1`;三人逐字段复核后,客户端才能开始规范化、布局和 Canvas 实施。
### 5.3 后端问题单 API-GENEALOGY-WORKSPACE-001—003
**优先级:** P1;阻塞 G01/G05 切到 remote 和正式上线,不阻塞继续审查无依赖业务域。
**唯一 owner** `GET /genealogy/app/genealogies/mine` 持有当前账号可访问集合;`GET /genealogy/app/genealogies/{genealogyId}/overview` 持有 G05 只读展示。首批不接语义重复的 `GET /{genealogyId}`,不让两个详情响应互相补字段。
**当前线上证据:** `RListAppGenealogyVo/RAppGenealogyVo/AppGenealogyVo` 均无 `required``AppGenealogyVo.genealogyId``integer/int64``roleType/status/memberStatus` 无 enum,且没有 `canView`。最大合法 int64 经 JavaScript JSON 解析会失真,解析后再转字符串无法恢复。无令牌调用 `/mine``/1``/1/overview` 均实测返回 HTTP 200、`application/json;charset=UTF-8``{code:401,msg,data:null}`;线上文档却只列 200/401401 schema 为 `*/* string`,也没有有效 security 声明。无令牌行为已经拒绝访问,因此不能仅凭注解缺失断言已发生公开泄漏;对象级授权仍没有有效账号反例证据。
**API-GENEALOGY-WORKSPACE-001:无损身份与最小 schema 闭包。** `/mine` 的 200 响应固定为 `RListAppGenealogyVo``/overview` 固定为 `RAppGenealogyVo`;两层 envelope 的 `code/data` 必填,列表 `data``AppGenealogyVo[]`,详情 `data` 为单个 `AppGenealogyVo`。首批实体必填字段固定为 `genealogyId/genealogyName/canView/canManage/canEditContent/roleType`ID、名称为 `minLength >= 1` 的字符串,三项 capability 为 boolean,角色为至少两个稳定非空值的正式 enum。地点、堂号、人数、简介等展示字段可选,响应不强制 `additionalProperties:false`。URL path 本身以文本传输,不因 JSON 响应问题机械强制改类型;真正必须改的是响应身份。
**API-GENEALOGY-WORKSPACE-002:可访问集合与能力投影。** `/mine` 中只有 `canView=true` 的行能进入 current context;也接受后端明确并由集成测试证明“只返回当前账号仍可查看 ACTIVE 家谱”的等价合同。G01 不能从未声明的 status 或 role 猜可访问性。`canManage/canEditContent` 是管理与内容入口的授权 UI 投影;真正写接口仍须后端逐次鉴权,capability 不能替代服务端授权。`roleType` 只拥有 G01 分组和角色标签,不替代 capability。
**API-GENEALOGY-WORKSPACE-003:错误语义与对象级授权。** 认证失效、对象无权/撤权、家谱不存在和服务故障必须在同版本文档、runtime validator 与部署行为中稳定一致。后端可使用规范 HTTP 401/403/404/5xx,也可继续 HTTP 200+稳定业务码;不能出现文档写 HTTP 错误、部署只回无字典业务码的双合同。至少用两个账号执行无凭证、跨账号、撤权、删除、服务异常和正常访问反例。G01 只在成功列表中确认 ID 消失或明确撤权时写 tombstone,网络/5xx 保留现场;G05 不把错误回退为 fixture 权限。
**展示取舍:** 当前 G05 fixture 还显示 `source/manager/certification/ancestorName/parentName/branchName/updatedAt/activeCount`,线上没有等价字段。首批允许把这些区域隐藏或使用明确“待补充/待同步”的非业务降级;若产品要求继续把它们作为可信首屏信息,后端需另补字段或明确组合接口。不能为了复刻 mock 把 22 个字段全部列为当前硬门禁,也不能把 mock 值带进 remote。
**关闭条件:** 后端从同一版本重新导出 JSON/YAML,`tests/genealogy-workspace-openapi-contract.ps1` 通过;三人复核 enum 与页面消费后,才实现专属 adapter、G01 `onShow` 刷新和 G05 `/overview` 接线。随后完成有效账号行为矩阵和 MuMu 原生状态矩阵;缺少任一层证据都不能把工作区称为可上线。
### 5.4 后端问题单 API-M06-001—003
**优先级:** P1;阻塞 M06 切到 remote 和帮助内容上线,不阻塞继续审查其他无依赖页面。
**唯一 owner** 当前 M06 只使用 `GET /genealogy/app/help-articles`。线上 `HelpArticleVo` 已携带完整 `helpContent`,所以手风琴展开直接使用同一列表快照;不调用 `GET /{helpId}`,不建立文章深链、详情缓存或第二正文 owner,也不让 `helpId` 进入页面模型。
**当前线上证据:** 列表返回 `RListHelpArticleVo`,列表项含 `helpId/helpCategory/helpTitle/helpContent/coverOssId/sortOrder/viewCount/status/remark`,但 wrapper 与 VO 都无 `required`,正文无格式语义,分类 query 无正式值域。受保护双导出更旧,只引用通用 `ListResult/RList`,没有专用 Help schema。匿名调用列表、带任意分类列表和详情均为 HTTP 200、`application/json;charset=UTF-8``{code:401,msg,data:null}`;线上文档则声明 HTTP 401 string 且 operation 无有效 security。
**API-M06-001:专用响应与最小 schema 闭包。** 列表 200 固定引用 `RListHelpArticleVo`envelope 的 `code/data` required`code` 为整数,`data` 为允许空数组的 `HelpArticleVo[]`。每行只把 `helpCategory/helpTitle/helpContent` 设为 required、`minLength >= 1` 的字符串;不要求当前页面不消费的 ID、封面、浏览量、状态和排序字段。后端必须从同一版本重新导出 JSON/YAML,不允许客户端手工补 schema。
**API-M06-002:展示标签、正文格式与发布范围。** `helpCategory` 是去边界空白后可直接展示的标签,不是需要客户端猜字典的内部代码;“全部”只由客户端拥有。`helpContent` 首版明确为 plain text,客户端只按字面显示,不解释 HTML、Markdown、图片或外链。用户侧列表只返回当前可展示的已发布文章,响应数组顺序就是页面展示顺序。若未来需要富文本、文章深链或详情,则另立内容安全和词法字符串 `helpId` 合同,不能偷偷扩张当前批次。
**API-M06-003:认证和错误承载一致性。** 后端可选择规范 HTTP 401,也可继续 HTTP 200+稳定业务 `code=401`,但 SaToken/security、JSON 媒体、OpenAPI 响应、部署行为和客户端 validator 必须一致。有效/失效令牌、空列表、畸形列表、5xx、超时和取消都要有集成反例;失败不得被解释成服务端空列表,也不得回退本地 FAQ 冒充线上成功。
**客户端关闭后的唯一形状:** adapter allowlist 输出 `{renderKey,category,title,content}`,其中 key 只由当前 response generation 与映射前 ordinal 组成;输入即使含 unsafe 或重复 `helpId` 也必须完全丢弃。筛选作用于已映射数组,搜索/分类/刷新前清空展开,旧 generation 迟到响应不得替换新列表。页面必须区分加载、服务端空、搜索无结果、错误重试和认证失效,并用原生按钮、`aria-pressed/aria-expanded/aria-controls`、状态播报及至少 44dp 目标完成无障碍闭环。
**关闭条件:** 后端同版本 JSON/YAML 通过 `tests/help-center-openapi-contract.ps1`;三人复核后才写专属 adapter 和页面异步状态。任务 23 关闭认证门禁后,完成有效账号部署矩阵及 MuMu 的系统字号、TalkBack、焦点、长正文、Android 返回和 M06→M07 验收。详情端点不属于本关闭条件。
### 5.5 后端问题单 API-PROFILE-READ-001—003
**优先级:** P1;阻塞 M01/M02/M03 使用真实资料和正式 remote 发布,不阻塞继续审查通知等其他只读域。
**唯一 owner** `GET /genealogy/app/auth/profile` 持有当前登录账号资料。M01 身份卡、M02 表单初值和 M03 绑定手机号行都调用同一个窄 adapter,但不建立跨账号缓存、不通过路由传 PII。M05 当前手机号在 remote 发布前也必须消费同一脱敏结果或隐藏;这不等于提前接入换绑写接口。
**当前线上证据:** 200 已返回 `RAppProfileVo → AppProfileVo`,实体含 `userId/tenantId/userNo/phone/nickName/realName/avatar/sex/birthday/email/registerSource/loginIp/loginDate/status/clientKey/deviceType`,但 wrapper 与 VO 无 requiredphone 无 pattern,姓名/邮箱无 length/format。受保护双导出仍为通用 `ObjectResult/RObject`。匿名 GET 实测 HTTP 200、`application/json;charset=UTF-8``{code:401,msg,data:null}`;线上文档则声明 HTTP 401 stringoperation 只有“需要登录”文字而无有效 security/clientid。
**API-PROFILE-READ-001:专用响应与最小字段闭包。** 200 固定引用 `RAppProfileVo`envelope 的 `code/data` required`data` 引用 `AppProfileVo`。实体只 required `phone`,其值必须匹配 canonical `^1[3-9]\d{9}$``nickName/realName/email` 都是声明过的可选属性;出现时必须为非空且去边界空白的字符串,姓名长度 1—30,邮箱长度 1—100 且 `format: email`。不要求当前页面不消费的 ID、头像、状态、设备和登录审计字段。
**API-PROFILE-READ-002:可选值与隐私投影。** 三项可选字段唯一未设置形态是属性省略,不再并行接受 null、空串和缺失。adapter 固定输出 `{maskedPhone,phoneAccessibleLabel,nickName,realName,email}`,真正缺席的可选值规范为内部空串;出现但非法则整份失败。明文手机号只在函数局部校验后立即变为掩码和“绑定手机号,尾号 xxxx”读屏标签,不得进入页面模型、缓存、路由、日志或错误。`userId/avatar` 即使是 unsafe int64 也通过 allowlist 完全丢弃,不做 `String(number)`
**API-PROFILE-READ-003:认证、配置与错误一致性。** 后端可选择规范 HTTP 401 或 HTTP 200+稳定业务 401,但 required clientid、SaToken/security、JSON 媒体、OpenAPI 与部署必须一致。客户端运行模式经 `resolveRuntimeMode()` 校验,错误 remote 配置不得静默回 fixture;读取使用严格 envelope、15 秒超时、取消和 generation 防迟到。账号失效交给 session ownernetwork/timeout/5xx/畸形数据是可重试读取失败,不存在写请求 uncertain。
**页面与后续写边界:** M01 资料失败只替换身份卡,菜单和底栏保持;查询参数假错误、fixture“创建者”和 remote 下伪通知数删除。M02 异步填表后才建立 baseline,GET 不证明 PUT;未来写批次必须验证省略字段保持、dirty-only payload、清空语义和并发。M03 仅手机号行局部失败,密码入口保持。头像、M04/M05 写入和设备管理不混入本批。
**关闭条件:** 后端从同一版本重新导出 JSON/YAML 并通过 `tests/profile-openapi-contract.ps1`;三人复核后才实现唯一 normalizer、三页局部状态与 M05 脱敏展示迁移。随后以不同资料完整度账号验证掩码、401、畸形响应、5xx、超时、账号切换和取消,并在 MuMu 完成系统字号、TalkBack、焦点、键盘、长昵称和返回流程。
### 5.6 后端问题单 API-NOTIFICATION-READ-001—003
**优先级:** P1;阻塞 N01/N02、M01/G01 未读数使用真实通知和正式 remote 发布,不阻塞继续审查其他业务域。
**唯一 owner** `GET /genealogy/app/notifications` 不带 `readStatus` 时持有当前账号完整活动通知集合;`GET /genealogy/app/notifications/unread-count` 持有同一集合的未读数量。当前没有详情端点,N02 只消费列表成功响应形成的不可变内存快照,不建立第二正文 owner。
**当前线上证据:** 线上列表为 `RListNotificationVo → NotificationVo[]`,未读数为 `RLong`;两者和实体都无 required。`NotificationVo``notificationId/genealogyId/senderUserId/bizId` 是 int64`readStatus` 无 enum,标题/正文无长度与格式,列表无分页、容量、完整性和排序。受保护双导出列表仍引用通用 `ListResult/RList` 且完全没有 unread-count。匿名 list/count 均实测 HTTP 200、`application/json;charset=UTF-8``{code:401,msg,data:null}`,而线上文档声明 HTTP 401 stringoperation 无有效 security/clientid。
**API-NOTIFICATION-READ-001:专用响应与最小字段闭包。** 列表 200 固定 `RListNotificationVo`,未读数 200 固定 `RNotificationUnreadCount`;两层 `code/data` required`code` 为 integer。列表 data 是允许为空且 `maxItems` 不超过 200 的 `NotificationVo[]`;实体 required `noticeTitle/noticeContent/publishTime/readStatus`。标题为 1—50 字符;正文为 1—1000 字符、完整未截断 plain text;时间是带 `Z` 或显式 offset 的 RFC3339 date-time;状态只允许 `READ/UNREAD`。计数是 0—200 的 int32。
**API-NOTIFICATION-READ-002:完整活动集合与快照。** 服务端活动集合本身最多 200 条;列表无筛选时完整返回该集合并按最新优先,未读数精确等于同一集合中 `readStatus=UNREAD` 的数量。两个请求之间并发变化允许瞬时差异,不要求客户端强行相等。adapter 公开 `{snapshotKey,title,content,publishedAt,unread}`key 为成功响应 generation+映射前 ordinal;筛选不重编号。成功刷新原子替换快照,退出/账号切换清空且不落盘;N02 无 key 时提示“请返回消息中心重新打开”。
**API-NOTIFICATION-READ-003:认证、错误与内容安全。** 后端统一 required clientid、SaToken/security、JSON 媒体、HTTP 401 或业务 401 的文档与部署行为。客户端拒绝无时区时间、未知状态、空/超长标题正文和畸形 envelope;失败不得回退 fixture。首批丢弃所有 ID、sender、`noticeType/bizType/bizId`,不解释 HTML/Markdown/URL,不执行目标跳转;未知业务通知仍完整显示内容。
**客户端关闭后的唯一行为:** N01 摘要最多 160 个 Unicode 字素并可换行,N02 显示同一快照完整正文;M01/G01 共同调用 count owner,文案为“未读消息”,可见 `99+` 但读屏播报真实数。读取批次原子删除 fixture 未读数、本地已读 mutation、通用 G10/审核 CTA、N02 目标按钮和假重试;写能力等待 5.7。
**关闭条件:** 后端同版本 JSON/YAML 通过 `tests/notification-read-openapi-contract.ps1`;三人复核后才实现读取 adapter 和四页局部状态。认证门禁关闭后完成 0/1/99/100/200、并发、畸形响应和账号切换反例,再在 MuMu 验证系统字号、TalkBack、键盘/焦点、长文本、刷新、N01→N02 和 Android 返回。
### 5.7 后端问题单 API-NOTIFICATION-STATE-001—003
**优先级:** P1;阻塞真实单条/全部已读和四页状态收敛。必须在 5.6 读取批次之后独立实施,不能与读取代码混成一个不可验证批次。
**唯一 owner** `POST /genealogy/app/notifications/{notificationId}/read` 持有单条已读,`POST /genealogy/app/notifications/read-all` 持有全部已读。两者无 request body,成功精确返回 `RVoid`;页面只把 `snapshotKey` 交给 notification controller,由 controller 私有解析服务端 ID。
**当前线上证据:** 两条 POST 已存在且返回 `RVoid`,但 path 和 `NotificationVo.notificationId` 都是 int64;最大值进入 JavaScript 会失真。`RVoid.code` 未 required,操作没有正式幂等、重试、超时未知、当前账号作用域、跨账号/不存在、read-all 截止点、并发新消息或刷新收敛语义。
**API-NOTIFICATION-STATE-001:无损身份和响应闭包。** `NotificationVo.notificationId` 与 path 参数必须同为 required 的 1—128 位 URL-safe opaque stringpattern 固定 `^[A-Za-z0-9][A-Za-z0-9._~-]{0,127}$`;禁止 int64 双读或解析后转字符串。`RVoid.code` 为 required integer,两个 POST 都要求 SaToken 和 required string clientid。
**API-NOTIFICATION-STATE-002:幂等与并发截止点。** 两个操作均对当前账号幂等,重复调用成功且没有重复副作用。read-all 以服务端接收请求时当前账号已存在的活动通知为截止集合,之后并发到达的通知保持未读;成功后客户端重取列表和 count。超时、断网、408/5xx 或畸形响应属于结果未知,允许依靠服务端幂等安全重试或先读取状态收敛,不能本地递减计数猜结果。
**API-NOTIFICATION-STATE-003:对象隔离和错误一致性。** 无效会话使用稳定 401;单条 ID 不存在或属于其他账号时统一返回 404 `NOTIFICATION_NOT_AVAILABLE`,避免暴露存在性。文档、部署、错误 envelope 与客户端 validator 必须一致,并以两个账号、删除消息、多端并发和迟到响应做反例。
**客户端迁移与关闭条件:** 写合同通过后,controller 才能私有保留 server ID,并原子删除读取首版“内部也完全丢弃 ID”的实现以及 N01/N02 的 clone mutation;公开页面模型、路由、日志和持久存储仍不得出现 ID。后端同版本 JSON/YAML 必须通过 `tests/notification-read-state-openapi-contract.ps1`,随后完成真实账号与 MuMu 的重复点击、提交中、失败/未知播报及 N01/N02/M01/G01 收敛矩阵。
### 5.8 后端问题单 API-PROFILE-UPDATE-001—004
**优先级:** P1;阻塞 M02 真实保存和 profile 正式 remote 发布。Task28 的 GET 是前置依赖;头像、相册权限、OSS、性别、生日、密码和手机号均不属于本问题单。
**唯一 owner** 继续使用 `PUT /genealogy/app/auth/profile`,不再增加 PATCH。operation 必须把自身定义为字段级原子 merge update:出现的可编辑属性更新,省略的可编辑属性保持不变;重复相同字段集只设置同一状态,不产生重复通知等额外业务副作用。请求专用 owner 命名为 `AppProfileMergeUpdateBody`,避免旧 `ProfileUpdateBody/AppProfileUpdateBody` 被误当资源替换。
**当前双版本证据:** 受保护双导出的 PUT 使用 `ProfileUpdateBody`,只有 nickName、avatarOssId、sex、birthday 和省市区,没有 realName/email;示例又含 schema 外 `regionCode/addressDetail`,成功返回 generic `RObject`。线上变为 `AppProfileUpdateBody`,含 nickName/realName/avatar/sex/birthday/email,但无 required、`minProperties`、关闭额外字段、merge/clear/version200 为 `*/* → RAppProfileVo`,实体与 envelope 无 requiredoperation 无 security/clientid,只列 200/401。两者都不能证明安全写入;未发送真实 PUT。
**API-PROFILE-UPDATE-001:最小 dirty command。** `AppProfileMergeUpdateBody``additionalProperties:false``minProperties:1/maxProperties:3` 的对象,属性集合精确为 nickName/realName/email 且均非 required。nickName 出现时为无边界空白的 1—30 字符,空串/null 非法;realName/email 分别以 `oneOf` 区分精确 `""` clear 命令与非空规范值,非空 realName 1—30email 1—100 且 format=email。省略保持;纯空白和边界空白拒绝,服务端清库后响应省略该属性。
**API-PROFILE-UPDATE-002:单一版本并发。** `AppProfileVo.profileVersion` required,固定为 1—128 位 URL-safe opaque stringPUT required `If-Match` 采用同形状,body 不重复 version。服务端以当前账号和租户做原子 CAS;成功返回新版本,旧版本固定 HTTP 409 与 `RProfileVersionChanged.businessCode=PROFILE_VERSION_CHANGED`,不得 last-write-wins。H5 正式 origin 的 CORS 必须允许 `If-Match`
**API-PROFILE-UPDATE-003typed 响应、认证、错误与隐私。** 200 精确 `application/json → RAppProfileVo`envelope `code/data` requireddata 是完整 canonical profile400/401/409/422/429/500 均进入同版本文档。operation required SaToken 和 string clientidGET/PUT 资料响应声明并实测 `Cache-Control: private, no-store`。422 只返回 nickName/realName/email 的结构化字段错误。客户端及服务端日志、路由、持久缓存、遥测和异常不得含真实姓名、邮箱或请求/响应 payload。
**API-PROFILE-UPDATE-004:结果未知与账号隔离。** timeout、network、408/5xx、取消和畸形 200 均视为 outcome unknown;客户端先 GET 对账本次脏字段,全匹配确认成功、仍为旧 baseline 才允许重试、第三值或无法归因版本进入 conflict。session generation 变化时清草稿并拒绝迟到响应;RequestTask 取消不表示服务端未写。
**页面迁移与关闭条件:** 首次 GET 后才建立 baselineclean 不发请求,saving 冻结三输入和返回;成功应用响应并重置 baseline,失败/unknown/conflict 保留草稿。原子删除 `currentUser.name` 同时冒充昵称/实名、500ms 假保存、API 禁用旧测试断言、假头像按钮和“邮箱用于接收通知”无依据承诺。后端同版本双导出通过 `tests/profile-update-openapi-contract.ps1` 后,才依次实现 normalizer、API、M02 状态机;再用两个账号/多端并发、超时对账和正式 H5 CORS 验证,最终在 MuMu 检查键盘、TalkBack、错误聚焦、长文本、冲突与返回。
### 5.9 后端问题单 API-LOGOUT-001—003
**优先级:** P1;阻塞 M10 服务端撤销和正式 remote 退出闭环。现有本机 `session.clear()` 仍保留为任何网络状态下的安全底线,但不能冒充服务端成功。
**唯一 owner 与当前证据:** `DELETE /genealogy/app/auth/logout` 无 body。受保护双导出有 required clientid、SaToken 和 200 `RVoid`,但只列 200、RVoid 无 required,未定义 scope/幂等/撤销传播。线上只有 200 RVoid 与 401 string,媒体为 `*/*`operation 无 security/clientid;同样没有 scope、复用和其他设备反例。页面当前只执行一次本地清理并根跳转,相关测试没有远端请求、迟到 A/B 账号竞态或离线状态。
**API-LOGOUT-001:当前凭证族范围与撤销传播。** DELETE 只撤销 bearer 所属当前设备 credential family,包括同一登录会话的 refresh 能力;同账号其他设备 token 保持有效。200 必须表示撤销已传播至所有鉴权节点:旧 access 不能访问任一受保护接口,旧 refresh 不能换新 access。已经鉴权通过的并发业务请求不属于可回滚范围;全设备退出必须另接口。
**API-LOGOUT-002:唯一幂等成功和拒绝。** 能验证为该 client 历史签发的 active、revoked、expired credential 重复 DELETE 都返回相同 200 RVoid且无额外副作用。伪造、格式非法或 client 不匹配才返回 HTTP 401 `RLogoutRejected`required `code/businessCode`businessCode 只允许 `TOKEN_INVALID/TOKEN_CLIENT_MISMATCH`;这些拒绝不算远端撤销成功。不得长期并存 200 业务 401、HTTP 401 string 和 typed JSON 三种合同。
**API-LOGOUT-003:安全、媒体、缓存和反例。** operation required SaToken 与非空 string clientid,并验证 clientid 与 token client 绑定;200/401 为 application/json`Cache-Control: private, no-store`RVoid required integer code,另声明 400/429/500。以同账号两设备 token A/B 验证:A 删除后全受保护接口拒绝 A,重复 A 仍 200,B 保持有效;再验证 expired、伪造、client mismatch、跨鉴权节点传播、弱网/超时和正式 H5 Authorization/clientid CORS。服务端日志不得记录 bearer。
**客户端关闭后的唯一流程:** `logoutCoordinator` 同步捕获 A token/clientid/epoch,立即经 session owner bump epoch 并清全部账号态,再用显式 A 创建后台 RequestTask且立即 `goRoot(A01)`;M10 不持 token,请求不绑定页面 controller。coordinator 仅保存 attemptId/logoutEpoch/status,绝不在异步 finally 再 clearA01 只在 session 为空且 epoch 未变时消费一次状态,B 登录后丢弃 A 迟到结果。所有分支都承诺“已从本机退出”,再区分 confirmed/unconfirmed/not-revoked;不持久 token、不跨重启重试、不阻塞重新登录。
**关闭条件:** 后端同版本 JSON/YAML 通过 `tests/logout-openapi-contract.ps1`;三人复核后才实现 session epoch、coordinator、严格 API 和 A01 提示,并原子替换 M10/导航/NM 旧静态断言。随后完成两设备部署矩阵和 MuMu 的确认、双击、系统返回、网络异常、状态播报、快速重新登录与根导航失败验收。
### 5.10 后端问题单 API-PASSWORD-001—005
**优先级:** P0;同时阻塞 A01 密码登录、A04 注册、A05 找回后的新密码验证、M04 登录态改密与正式 remote 模式。当前 M04 本地预览不得冒充修改成功。
**当前三方证据:** 受保护双导出的 `PasswordLoginBody/PasswordRegisterBody/PasswordResetBody/PasswordChangeBody` 都把密码写成静态 32 个十六进制字符 MD5;改密虽有 SaToken/clientid,却只有 200 RVoidRVoid 无 required。线上相应 `AppPassword*Body` 仍接受大小写 MD5,M04 只有 200 `*/* → RVoid` 与 401 stringoperation 无 security/clientidlive server 还发布 HTTP URL。现有 M04 只有 500ms 本地定时器,旧测试正确禁止提前导入 API;未发送 PUT。
**API-PASSWORD-001:唯一 raw wire 与策略 owner。** 新增 `CurrentPasswordSecret``NewPasswordSecret` 两个共享 schema。登录 password 与改密 oldPassword 只能引用前者,1—64 Unicode code point、原样不 trim;注册、找回和改密 newPassword 只能引用后者,NFC 后 15—64 code point,允许空格/Unicode/粘贴/密码管理器且无组成规则。四条入口在同一版本删除 MD5 与任何 raw/hash oneOf fallback;服务端执行常见/泄露密码 blocklist、账号限速、新旧不同与带独立盐的 Argon2id,无法使用时才选合规 scrypt/PBKDF2。confirm 永不出端。
**API-PASSWORD-002:重新认证、ALL session 与原子 CAS。** M04 以当前密码重新认证,TAC 不能替代;严格 200 前在同一安全事务中写入新 verifier、递增账号 credentialEpoch,并跨节点撤销所有设备/所有 client 的既有 access、refresh 与 renewal session,包括调用者。两个同旧密码并发请求至多一个 200,另一个 typed 409 `CREDENTIAL_VERSION_CONFLICT`。不返回新 token,不保留旧 bearer。
**API-PASSWORD-003typed 错误与确定未写边界。** PUT 声明 200/400/401/409/422/429/500409/422 的 `RPasswordChangeRejected.businessCode` 精确为 `CREDENTIAL_VERSION_CONFLICT/CURRENT_PASSWORD_INCORRECT/NEW_PASSWORD_SAME_AS_CURRENT/PASSWORD_POLICY_VIOLATION`。400/422/429 明确保证未修改;401/409 进入重新登录;network/timeout/取消/畸形 2xx/5xx 均为结果未知,客户端不得自动重试或解析 msg。
**API-PASSWORD-004:鉴权、媒体、缓存与秘密卫生。** required SaToken、与 token client 绑定的非空 clientid、关闭额外字段的 JSON body;所有响应 application/json 且 `Cache-Control: private, no-store`429 required `Retry-After`RVoid integer code required。OpenAPI server 和实际重定向全程 HTTPS。反向代理、应用日志、APM、分析、崩溃报告与错误 body 不记录 old/new/confirm、MD5、Authorization 或完整请求。
**API-PASSWORD-005:账号能力和客户端崩溃边界。** 后端明确所有 App 账号是否都已配置密码;若不是,profile 返回稳定 `passwordConfigured` 并让无密码账号进入独立 step-up 设置流程,M04 不猜。客户端 session owner 在 dispatch 前只持久化 `{sessionEpoch,startedAt}``credentialChangeInFlight`;确定未写清 marker200/401/409/unknown 清同 epoch 账号态并回 A01。冷启动同 epoch marker 在任何缓存渲染前 fail closed,新登录 bump epoch,迟到旧响应不得清新账号。禁止持久 token、密码、摘要、body、operation 状态或自动重试。
**关闭条件:** 后端同版本 JSON/YAML 通过 `tests/password-change-openapi-contract.ps1`,并先关闭密码登录 TAC 门禁;三人复核后按共享策略→四条 API wire→session epoch/marker→M04 状态机顺序原子实施,删除 `calcMD5` 生产消费者、8—32 旧规则和 NM preview 断言。最后以两设备全部 access/refresh 撤销、并发/fault injection、秘密日志扫描、正式 CORS/HTTPS 和 MuMu 的密码管理器、系统字号、TalkBack、44dp、错误聚焦、Android 返回与跨根提示验收。
### 5.11 后端问题单 API-PHONE-001—005
**优先级:** P0;阻塞 M05、全活动短信码生产强度及正式 remote 模式,并依赖 M04 raw-password 和认证/TAC 门禁先关闭。当前 M05 只做本地 4 位码校验,不得冒充换绑。
**当前三方证据:** 本地 `PhoneChangeBody` 要求 `clientId/phone/smsCode`,线上 `AppPhoneChangeBody` 只要求 `phone/smsCode`;两边都是 4 位码,都没有 currentPassword、号码占用、并发、会话撤销、outbox 或结果未知语义。线上 PUT 无有效 security/clientid且返回完整 `RAppProfileVo`,错误只有 401 string;共享发码 operation 在线上明确忽略权限,当前客户端方法也固定不携 bearer。页面使用脱敏 fixture、70rpx `view role=button` 和 500ms 定时器,未调用 API/TAC;未发送 POST/PUT、短信,未操作 MuMu。
**API-PHONE-001:专用受保护发码 operation。** 新增 `POST /genealogy/app/auth/phone/sms/code`required SaToken 与非空 clientid,闭合 `PhoneChangeSmsCodeBody` 只含 `phone/validToken`;服务端固定 scene=`APP_PHONE_CHANGE`,不接受 sceneCode/clientId/tenantId/grantType。公共 `/auth/sms/code` 删除该 scene。两个 operation 复用同一 OTP 服务 owner;匿名专用调用必须 401,公开登录/注册/找回发码仍可匿名。validToken 必须绑定当前账号/session、tenant、client、scene 与规范化新号并单次消费。
**API-PHONE-002:唯一六位 OTP wire 与生命周期。** 新增 `SmsCodeSecret`CSPRNG 生成恰好 6 位 ASCII 数字、保留前导零、writeOnly、无示例;5 分钟 TTL、60 秒重发、最多 5 次失败、单次消费,重发废止旧 generation且不重置累计失败次数。同一复合键只有一条 active generation。A01/A04/A05/M05、`AccountDeactivateBody` 及同源生成器、短信模板、双导出、validator、页面和测试同版删除全部 4 位规则,不保留 4/6 fallback。
**API-PHONE-003existing-factor 与闭合最终 PUT。** `PUT /genealogy/app/auth/phone` required SaToken/clientid`PhoneChangeBody` 只含 required `currentPassword/phone/smsCode` 且关闭额外字段;密码引用 `CurrentPasswordSecret`,新号引用 11 位 `NewBoundPhone`,短信引用 `SmsCodeSecret`。当前密码是既有因子再认证,TAC 不能代替;无密码账号返回 `STEP_UP_UNAVAILABLE` 进入独立恢复,不能降级为 bearer+新号 OTP。不要求旧号 OTP,成功后改用旧号安全通知。
**API-PHONE-004:原子换绑、唯一约束与会话。** 在一个事务中验证 currentPassword/active OTP、执行 `(tenantId,canonicalPhone)` 唯一约束、消费 OTP、CAS 更新号码、递增 credentialEpoch、撤销包括当前在内的全部 access/refresh/renewal session,并持久化旧号通知 outbox;严格 200 只返回 `RVoid`。并发至多一笔成功;通知投递失败不回滚换绑,但 outbox 必须重试并告警。不得在证明新号控制权前泄露号码是否已绑定。
**API-PHONE-005typed 错误、传输与客户端恢复。** POST/PUT 都声明 200/400/401/409/422/429/500 JSON、`private, no-store`429 有 `Retry-After`409/422/429 使用 required `RPhoneChangeRejected.code/businessCode`,稳定覆盖 current password、同号/占用、验证码错误/过期/尝试耗尽、credential 冲突、step-up 不可用、验证重做与限流,客户端不解析 msg。最终 PUT dispatch 前复用无秘密 `{sessionEpoch,startedAt}` marker200/401/409/unknown 清同 epoch 账号态回 A01,不自动重试。HTTPS、Authorization/clientid CORS 和密码/手机号/OTP/TAC/token 全链路日志脱敏必须实测。
**关闭条件:** 同版本 JSON/YAML 通过 `tests/phone-change-openapi-contract.ps1`,且认证、密码和 profile 读取前置门禁全部通过;三人复核后按全活动六位码→专用发码 API→共享 credential marker→M05 状态机原子实施,替换旧四位/preview 断言。最后完成匿名/错场景/TAC 重放、前导零、重发/过期/限流、号码唯一与枚举、两设备并发、全部 session 撤销、fault injection、旧号 outbox 和 MuMu 的输入法、TalkBack、44dp、系统返回与结果未知矩阵。
### 5.12 后端问题单 API-G03-001—005
**优先级:** P0;阻塞 G03 真实创建、创建后 G01/G05/context 闭环及 APP 家谱访问规则唯一化。当前同页两步是明确本地预览,不得把 `local-created-*` 或 fixture mutation 当作后端成功。
**当前三方证据与方案结论:** 本地 `GenealogyCreateBody` 和线上 `AppGenealogyCreateBody` 都只创建家谱,通用人物 POST 另写始祖;创建响应未形成 required 词法 ID/OWNER/READY 回执。页面缺可信 regionCode,默认男性、硬限 1800 年、把“一世”混入 generationName;成功不安装真实 context。三人先设计 `ROOT_REQUIRED` 两写及恢复,再确认没有跨库或保存空谱需求,最终否决这类客户端 saga:它只会新增半成品配额、可见性、删除/过期、版本、G01 恢复卡和第二次未知结果。唯一最小生产方案是最终按钮一次原子 bootstrap,第一步零网络写。
**API-G03-001:闭合 bootstrap 与领域事务。** `POST /genealogy/app/genealogies` 唯一 body 改为 additionalProperties=false 的 `AppGenealogyBootstrapBody`,字段精确为 `genealogyName/surname/ancestralHall/regionCode/accessPreset/rootPerson`,除堂号外全部 requiredrootPerson 只含 `name/sex/birthDate/biography` 且前两项 required。sex=`MALE/FEMALE/UNKNOWN`,生日 format=date,服务端固定 generation=1、唯一首根且不接收账号/编号/父母/字辈/状态。严格 200 前一个事务完成 quota、谱、OWNER、根、READY 和幂等回执,失败全回滚;通用人物 POST 仅用于 READY 后普通人物。同名不是冲突,重复提醒只做建议。数据库 bootstrap-root marker 是身份权威:根 PUT 可编辑白名单精确只有 `name/sex/birthDate/biography`status/personStatus、账号绑定、世代、父母、根标记及任何白名单外字段一律 422;collection POST、人物 DELETE 和 parents mutation 也不能创建第二根、删除根或给根重挂父母。
**API-G03-002:幂等键、控制事务、结果和稳定错误。** required `Idempotency-Key` 引用 `GenealogyBootstrapOperationKey`,精确格式为 `gcb.{13位 issuedAt 毫秒}.{22—43位 base64url CSPRNG}`,随机量至少 128 位;固定 `acceptUntil=issuedAt+10 分钟`,以 server time 判定,未来超过 5 分钟返回 400 `OPERATION_KEY_INVALID`,并以 600/300 秒 extension 锁定。窗口内首次 POST 用短控制事务按 account/tenant/client/path/key 唯一 CAS 认领 PENDING、canonical digest、fencing lease 与 `resolveBy<=claimedAt+2 分钟`,以 120 秒 extension 锁定;相同作用域/key/body 的已存在操作在截止后仍返回同一结果,不同 digest 返回 409 `IDEMPOTENCY_KEY_REUSED`,过期且不存在的 key 返回 409 `OPERATION_KEY_EXPIRED`。业务事务才原子处理 quota、谱、OWNER、唯一根、READY 和 SUCCEEDED;失败回滚后 CAS FAILED_NO_COMMITwatchdog 同样用 fencing CAS,旧 worker 不能迟交。`GenealogyBootstrapResult` required 词法字符串 genealogyId/rootPersonId、setupState=READY、roleType=OWNER、canView=true;成功防重记录至少覆盖实体生命周期。POST 声明状态专属、`code` 与 HTTP 状态单值一致的 400/401/403/409/422/429/500 typed JSON、private/no-store429 有 Retry-After。
**API-G03-003:无 PII operation-status 与迟到竞态。** 新增 required SaToken/clientid 的 `GET /genealogy/app/genealogy-bootstrap-operations/{operationKey}`,有效参数只有 operationKey/clientid且没有 request body,响应集精确为 200/400/401/404/429/500,禁止泄漏性 403/default。响应以带显式 mapping 的 discriminator `oneOf` 关闭为 `PENDING{resolveBy,retryAfterSeconds}``SUCCEEDED{result}``FAILED_NO_COMMIT`,三个 status 均为单值 string`x-state-transitions` 精确登记 `ABSENT→PENDING→SUCCEEDED/FAILED_NO_COMMIT`,两个终态无出边且 `x-terminal-immutable=true`FAILED 同时固定 `x-domain-effects=NONE/x-quota-consumed=false`。PENDING 的 retryAfterSeconds 为 1—30200 不强制 Retry-After。GET 必须纯读且始终无副作用:acceptUntil 前无记录返回 typed 404 `BOOTSTRAP_OPERATION_NOT_AVAILABLE`、服务端 acceptUntil 和 Retry-After,客户端保持 unknown;截止后无记录按 key 可计算地返回 FAILED_NO_COMMIT,不写 tombstone,迟到 POST 永久拒绝。PENDING 最迟 claimedAt 后 2 分钟终结;SUCCEEDED 记录至少保留实体生命周期,FAILED 至少 30 天;跨 account/tenant/client 统一不泄漏 404。响应不含原请求或人物 PII,operation 不进 `/mine`、不占业务 quotaGET 零写与 FAILED 零领域提交仍必须另以 DB 观测测试证明。
**API-G03-004APP 访问预设单一 owner。**`GenealogyAccessPreset` 只允许 MEMBER_ONLY/PUBLIC_APPLY,并在同一版本成为 `AppGenealogyBootstrapBody`、实际 `/mine`/overview 读取所用 `AppGenealogyVo` 和闭合 `AppGenealogySettingsUpdateBody` 的唯一访问字段。删除 `GenealogyCreateBody/AppGenealogyCreateBody/GenealogyUpdateBody/AppGenealogyUpdateBody` 旧入口以及 visibility/joinMode;不保留 oneOf fallback、数字 pair 或邀请码 mode 的暗中映射。validator、runtime、双导出、fixture 迁移、G03/G05/G11 测试和文档同批更新。这里只关闭共享字段迁移;G11 写入仍须另行完成 If-Match、版本/CAS、权限刷新和结果未知门禁。
**API-G03-005:可信地区、始祖不变量、认证与部署反例。** `GenealogyRegionCode` 是 1—32 位 URL-safe 词法标识;唯一地区 owner 改为 required SaToken/clientid 的 `GET /genealogy/app/region/search`,同版删除旧公共 `/genealogy/region/search`。keyword required 且 minLength=1/maxLength≤50`RListRegionSelectVo.code/data``RegionSelectVo.regionCode/label/selectable` requiredleaf 不等于 selectable,不强制层级;页面只展示 label、提交 code,POST 在业务事务中复验仍可选。通用人物写入以 typed 409 `GENEALOGY_NOT_READY` 和 422 `BOOTSTRAP_ROOT_IMMUTABLE` 覆盖 collection/PUT/DELETE/parentsPUT operation 以 `x-bootstrap-root-editable-fields=[name,sex,birthDate,biography]``x-bootstrap-root-noneditable-policy=REJECT_422_BOOTSTRAP_ROOT_IMMUTABLE` 精确锁定仅四项可编辑,其余字段一律 422。create/status/settings/region及相关人物私有响应必须是 JSONprivate/no-store;同一后端模型重导后先由 `openapi-yaml-json-parity-runtime-smoke.js` 以无损任意精度数字和严格 YAML mapping 语法深比较完整 JSON/YAML,再递归检查组合 schema 字段。以匿名、错 client、跨账号 status、unsafe 数字 ID 差一、地区失效、quota race、同 key 并发、control/business/terminal 各写点 fault injection、GET 零写、根 PUT 白名单及其他绕过、超时/5xx/畸形响应和正式 HTTPS/CORS 验证文档与部署一致。
**客户端关闭后的唯一流程:** 第一步只校验并进入页内始祖步骤;最终校验后冻结 canonical snapshot,先持久 `{sessionEpoch,operationKey,startedAt}` 再 POST。本地校验或可证明零发出的 request-build 失败不留 marker;服务端在 claim 前返回的 400/401/403 清 marker401 同时清会话;`IDEMPOTENCY_KEY_REUSED` 进入 fatal/quarantined,不查装 status、不自动换 key,只有用户看到警告并显式放弃才清;确定未提交的 limit/expired/422 可清。429 保持同 key/body并先查 status500/network/timeout/408/发出后取消/意外 2xx/3xx/畸形 200 都保持 marker按 unknown 查询。status 截止前 404 保持,400 清损坏 marker401 走会话失效,429/500/network/cancel/unexpected/malformed 保持退避,FAILED_NO_COMMIT 才允许新 key。冷启动只查 status,不保存姓名/生日/生平、完整 body或可逆日志。SUCCEEDED 唯一次序为 committed receipt → 失效或定点更新 `/mine` → 安装 context → G05context/导航失败不重发创建。落地时删除 local preview/mock create 与旧禁止 API 断言,不能长期并存两个创建 owner。
**页面与关闭条件:** 地区搜索、PENDING、unknown、fatal/quarantined、committed、context/导航失败必须可见;默认 UNKNOWN,删除 1800/UTC 日期错误;label、radio、aria-invalid/describedby、首错聚焦、至少 44dp 原生按钮、AppDialog 焦点与状态播报同批实现。后端同版本 JSON/YAML 必须通过 `tests/g03-bootstrap-openapi-contract.ps1`,客户端实现必须另行通过会实际执行状态机套件的 `tests/g03-bootstrap-client-release-gate.ps1`;它们只是 G03 自身两门禁,真实开放还要求 Task26 workspace 读取门禁、聚焦/全量回归和 MuMu 原生字号、TalkBack、键盘、慢网、双击、杀进程及 Android 返回矩阵全部通过。
当前其余已知但尚未核实的重点依赖包括:微信登录、公共行为验证、完整短信状态机、邀请码验证与直接加入、结构化亲属关系、上级家谱与支系权限、管理员授权与功能开关、上传与系统权限、消息业务目标、系统分享、订单支付与退款。它们只表示审查重点,不预判后端一定缺失。
+4 -1
View File
@@ -13,6 +13,8 @@
schema v3 注册入口是 `design-pipeline/manifests/runtime-assets.json`。任何新增的 `runtime-asset-inventory``asset-build-manifest` 都必须进入该注册表的导入闭包;未注册 owner、重复资产 `id` 与重复正式输出都会被拒绝。当前 `static/assets` 中的每个文件都必须恰好属于一个正式 owner,并至少存在一个真实运行时消费者。
导航任务 3 删除了无活动消费者的通用页面旧入口,并同步删除两张仅靠该入口人工补数的 notification frame。当前注册表闭合 `77` 个正式 `static/assets` 输出;family/profile/records 的同名 frame 仍有真实专项 mixin 消费,`ModulePageBackground` 仍有活动页面消费者,均继续保留。`tests/retired-module-page-contract.ps1` 是这次退役边界的防回归所有者。
认证直接资产由 `design-pipeline/manifests/auth-runtime-assets.json` 管理,其余无法重建但仍被产品消费的直接二进制由 `design-pipeline/manifests/application-runtime-assets.json` 管理。四张共享卷轴、六张长页面背景和 G01 空态边框的生成事实依次只属于 `design-pipeline/manifests/shared-scroll-skins-v3.json``design-pipeline/manifests/page-backgrounds-v3.json``design-pipeline/manifests/g01-state-frame-v3.json`
页面、组件、样式、数据映射和工具代码本身是消费者关系的唯一事实源。生成清单不得保存槽位、Vue 组件、选择器、`uni-app mode`、消费者列表或其他运行时渲染语义;这些规则只能由实际消费者源码及对应合同拥有。
@@ -62,6 +64,7 @@ npm.cmd run verify:shared-scroll-skins
```powershell
powershell -ExecutionPolicy Bypass -File tests/runtime-assets-contract.ps1
powershell -ExecutionPolicy Bypass -File tests/retired-asset-removal-contract.ps1
powershell -ExecutionPolicy Bypass -File tests/retired-module-page-contract.ps1
powershell -ExecutionPolicy Bypass -File tests/a01-retired-pipeline-removal-contract.ps1
powershell -ExecutionPolicy Bypass -File tests/a01-no-photoshop-pipeline-contract.ps1
powershell -ExecutionPolicy Bypass -File tests/mumu-visual-acceptance-boundary-contract.ps1
@@ -94,4 +97,4 @@ powershell -ExecutionPolicy Bypass -File tests/compile-audit.ps1
- `docs/design/assets/a01-vnext/A01-shared-scroll-skins-with-dialog-approved.png`
- `docs/design/assets/a01-vnext/A01-shared-skin-family-option-2-selected.png`
G01 的 A/B/C 方向候选、无确定变换的 add-sheet/close 色键源、重复的旗舰 ImageGen 源、旧 `static/icons` 和未接入业务的 TAC 文件已经退役。正式 add-sheet 与 close 位图作为 `committed-binary``application-runtime-assets.json` 锁定;六张长背景及 G01 空态边框则保留可执行母版和 schema v3 构建链。不得重新引入候选入口、虚构可重建关系或在文档复制正式输出哈希
G01 的 A/B/C 方向候选、无确定变换的 add-sheet/close 色键源、重复的旗舰 ImageGen 源、旧 `static/icons`阶段 0 当时存在的未接入 TAC 旧批次已经退役。`static/tac/` 当前共 5 个文件:4 个后端提供的供应商文件保持原字节,项目只新增 `static/tac/js/jiapu-tac-adapter.js` 作为唯一协议适配层。A01/A04/A05 已通过 `components/TacVerification.vue` 形成真实运行时消费者;这组供应商资产不是视觉构建管线的可再生输出,不进入 `runtime-assets.json`,其存在性、精确文件集合、消费者和哈希由 `tests/auth-tac-integration-contract.ps1` 唯一拥有。受保护哈希分别为 `tac.css=181694518971a9f991d551b6a6e6dab2bf750f940bfc1673a158213f92eedbe0``tac.min.js=505f73c051908d7b805db458990790be3e91f792c4001cec0ea9377d7d302b55``icon.png=53e37ffc5bb81c46e6306b7d61d2eaa3de57e47ca6cdb8d5210022ae815c21c2``dun.jpeg=d9178a8c4cca36e3df6c3acd7e895ce9d34dd60ef3f1cf4a70c94d4324ed96e7`;不得修改、格式化、覆盖或以重新下载文件替换。正式 add-sheet 与 close 位图作为 `committed-binary``application-runtime-assets.json` 锁定;六张长背景及 G01 空态边框则保留可执行母版和 schema v3 构建链。不得重新引入候选入口、虚构可重建关系或复制第二套 TAC 资产所有权
+173 -32
View File
@@ -1,13 +1,52 @@
# 项目当前总览
> 当前阶段:阶段 1——导航栈与 T01 大规模世系树书面设计已收口
> 当前状态:三位审查者已完成导航与 T01 的独立审查、交叉补漏和终审;业务代码尚未实施,下一步从导航失败测试开始
> 当前提交:`eced3d1 完成全项目响应式审核与换机交接`
> 更新日期:2026-07-22
> 当前阶段:导航任务 1—10、TAC 认证客户端、领域上下文基础与 M07 反馈客户端已经完成;T01、认证、家谱工作区、G03 原子创建、M06 帮助、个人资料读写、通知读写、M10 服务端退出、M04 登录态改密和 M05 手机号换绑后端接口门禁均为红灯,继续逐域关闭真实接口
> 当前状态:A01/A04/A05 已接入统一 TAC、真实短信和认证请求代码,M07 已接真实反馈提交 ownerG01/G05、G03、M06、M01/M02/M03 个人资料读写、N01/N02/M01/G01 通知域、M10 退出域、M04 密码凭证域与 M05 换绑域已完成三人接口审查和失败门禁,均未猜测接线;`runtimeConfig.mode` 仍为 `mock`MuMu 原生矩阵和真实环境联调待执行
> 当前基准 HEAD`9b0ad62df467f4e2c58b7689087683c77755e07b``main`,工作区有本轮未提交变更)
> 更新日期:2026-07-23
## 2026-07-23 换机续作断点
### 总目标与完成定义
本项目的总目标不可缩减为“只写规划”或“只让静态测试通过”:必须在 `main` 工作区内持续推进整个 UniApp 家谱项目,按测试先行和三人交叉评审完成导航、T01 长世代世系树、TAC/认证、家谱领域数据、G/T/F/R/N/M 全量页面与接口、异常恢复、无障碍、构建及上线验证,最终交付能够正常上线使用的项目。若本地可完成的工作全部完成后只剩后端合同重导、有效测试账号、应用签名、发布凭证或 MuMu 人工操作等外部状态,才允许停在明确硬阻塞;每项阻塞必须有失败门禁、复现证据、唯一所有者、解除条件和继续步骤,不能用 mock、fixture、定时器或宽松兼容伪装完成。
协作固定为当前主代理加两位评审者,共三人。三人都必须独立检查接口/字段、页面/业务闭环、交互/异常/视觉,再交叉质询并统一结论;主代理是唯一写入者,不再创建旧专家身份或增加并发评审者。普通技术取舍由三人自行收敛,不反复交给用户。系统保存的目标记录仍存在,但在 2026-07-23 读取时状态为 `paused`;换机后的执行者不得据此把任务视为取消,应以上述总目标和本节断点继续。只有项目真实达到完成定义时才能标记完成。
### 仓库与保护基线
- 当前分支为 `main`HEAD 为 `9b0ad62df467f4e2c58b7689087683c77755e07b`,上游显示 `main...origin/main`。工作区含大量本轮未提交的修改、删除和新增文件,均属于当前连续治理成果;换机后先运行 `git status -sb``git rev-parse HEAD` 核对,禁止用 `restore/checkout/reset` 清理,也禁止自行改分支或 worktree。
- 本节仅记录断点,没有执行 `git add/commit/push`。由用户自行上传;换机后必须保留当前完整工作区,而不能只依赖旧远端基线。
- 后端唯一目标地址是 `https://backend-api.ddxcjp.cn/`。受保护 `APP.openapi.yaml` 的 SHA-256 为 `8964CD583CE172425B63BBFD802F7EB587EB3641EADFD6F9D3B264FAA8090C6C``APP.openapi.json``87DB1DC148C5E6E877815AFF7B3A7FC7C7ECA95A2CEC50A88B42F3908961F31A`;两文件相对 HEAD 无差异。不得修改、格式化、覆盖或删除,只接受后端同一版本重新导出的双文件。
- 不得启动、关闭或调整 MuMu。浏览器截图和源码检查不能冒充 Android 原生视觉、TalkBack、系统字号、软键盘或返回键验收。
- 当前物理测试库存仍是 PowerShell `140`、Node `47`。最近一次完整记录为 PowerShell `126/140`,14 项均是预期发布红灯;Node 语法 `47/47`、纯 Node `19/19`、活动 Vue 脚本 `64/64` 通过。G03 最后一次布尔类型加固后又单独通过聚焦合同;换机后应先重跑完整套件,不能把这些历史数字冒充新机器证据。
### 已完成到哪里
导航任务 1—10、统一 TAC 客户端、领域上下文基础和 M07 真实反馈客户端已经完成本地可完成部分。T01、认证/TAC、家谱工作区、M06、个人资料读写、通知读写、退出、密码、手机号换绑均已经三人审查并建立明确 OpenAPI 红灯。任务 35 已完成 G03 原子创建合同:否决空谱加通用人物的两写方案,固定一次 atomic bootstrap、无 PII operation-status、统一 accessPreset、可信地区、词法 ID、始祖不变量及客户端激活门禁;`openapi-yaml-json-parity-runtime-smoke.js` 已升级为严格 YAML mapping 和任意精度数字的完整双源深比较。尚未批量把这些红灯域接到宽松线上接口,`runtimeConfig.mode` 仍诚实保持 `mock`
### 当前精确断点:任务 36 普通加入申请闭环
三人已经完成 G06/G08/G09/G10 与 2026-07-22 线上 OpenAPI 的只读核对,范围只包括“鉴权搜索公开可申请家谱 → 普通申请 → 我的申请/撤回 → 待审列表/单条审核”。邀请码校验和直接加入仍是后续独立任务,产品结论保持“邀请码成功后直接加入且不生成审核记录”,不得混入普通审核合同。
已统一的最小正确方案如下:
- 搜索、我的申请和待审列表使用各自专用最小投影与稳定 cursor 分页,不返回 `total`,所有 `genealogyId/applyId` 都是有界词法字符串。搜索项只暴露识别家谱所需字段和当前查看者状态;我的申请完整表达 `PENDING/APPROVED/REJECTED/WITHDRAWN`;待审项只含 `applyId/applicantName/relationDesc/applyReason?/submittedAt`,不得泄漏手机号、用户 ID、邀请人或审核人内部字段。
- 申请 body 闭合为 `applicantName/relationDesc/applyReason?`,前两项必填;删除 `phone/inviterUserId`。同账号、租户、家谱最多一个活动 `PENDING`,由数据库唯一约束而非先查后插保证。
- 申请 POST 必须带无 PII 的 `Idempotency-Key`。同 key、同 canonical body 重放同一结果;同 key、不同 body 返回 409。客户端只持久 `{sessionEpoch,requestKey,startedAt}`,不持久姓名、关系和理由。
- 冷启动恢复不复用 `mine` 查询,也不持久表单 PII;新增唯一只读 owner `GET /genealogy/app/genealogies/join-apply-requests/{requestKey}`,以显式 discriminator 返回 `PENDING {resolveBy,retryAfterSeconds}``SUCCEEDED {applyId/genealogyId/...无 PII 回执}``FAILED_NO_COMMIT`。只允许 `ABSENT→PENDING→SUCCEEDED/FAILED_NO_COMMIT`,两个终态不可变;GET 纯读,跨账号/租户/client 统一非泄漏 404,PENDING 必须有收敛期限,从未到达的 key 也必须在可计算时间边界后成为零写 `FAILED_NO_COMMIT`
- 不引入 `applicationVersion``If-Match` 或审核详情端点。申请在 PENDING 时不可编辑,撤回、通过和拒绝都以 `WHERE status=PENDING` 的数据库 CAS 决定唯一赢家。重复相同撤回返回同一 200;重复相同审核决定返回原 200,拒绝时只有规范化后理由相同才算相同动作;相反决定、不同拒绝理由或撤回/审核竞态败方返回 typed 409 和当前最小状态。终态不可改,重新申请创建新 `applyId`
- 审核 body 只允许 `APPROVE`,或 `REJECT+必填申请人可见 rejectionReason`。批准必须在同一事务完成唯一成员关系和申请终态;G05 的 `canReviewJoinApplications` 只是入口 capability,服务端在事务/CAS 时仍重新验证权限、家谱状态和 `PUBLIC_APPLY`
- 所有操作 required SaToken 和非空 `clientid`,仅使用 `application/json``Cache-Control: private, no-store`429 带 `Retry-After`。线上三个匿名 GET 当前实测为 HTTP 200 加业务 `code=401`,却与文档 HTTP 401 string 冲突;发布合同必须统一为真实 HTTP 状态与 typed JSON,禁止 `*/*`、200 包装认证错误、`default` 响应和 int64 JSON 身份。
- 客户端结果未知时禁止乐观改列表:申请查专用 operation;撤回刷新 mine 并可安全重放同一 DELETE;审核刷新 pending,行消失只能说“状态已变化/已被处理”,不能冒充本次审核成功。首版不承诺消息中心通知;G09 的 `onShow` 与手动刷新是当前业务真相。
**尚未实施的边界必须原样保留:** `tests/join-application-openapi-contract.ps1` 还没有创建,任务 36 尚未写入实施计划和接口映射,测试计数仍为 140/47G06/G08/G09/G10 业务代码也没有在本任务中修改。换机后的第一项写操作应是用 `apply_patch` 新增该 OpenAPI 失败门禁,先运行并取得精确 `JOIN-APPLICATION-OPENAPI-CONTRACT BLOCKED`,再把 `API-JOIN-001``006`、七个 operation、状态机、隐私投影、竞态和部署反例同步写入现有四份中文权威文档及文档合同。后端门禁通过前页面继续保持诚实本地预览,不写只适配当前宽松线上模型的临时代码。
完成任务 36 的本地门禁、全量回归和三人终审后,继续按独立批次推进邀请码直入、G11 设置写入、G12 字辈真实保存,以及其余 G/T/F/R/N/M 业务域;不得一次混合导航、验证码、领域持久化和无障碍多个阶段。最终仍须完成真实后端联调、构建、签名/隐私配置、MuMu 全流程矩阵和发布终审。
## 当前目标
阶段 0 的清理和验证基线已经完成。当前主代理与两位固定评审者已把下一轮工作收敛为两个严格串行阶段:先统一导航栈语义,再在后端新图合同通过后重建 T01 大规模世系树。当前只完成中文设计和实施计划,没有接入新接口、迁移导航业务代码或改动 T01 运行时
阶段 0 的清理和验证基线已经完成。当前主代理与两位固定评审者已完成导航任务 1—10,建立路由注册表、导航网关和零债务门禁,并迁移共享组件与认证、G、T、F、R、N/M 全部活动页面。T01、认证/TAC、G01/G05 家谱工作区、G03 原子创建、M06 帮助、M01/M02/M03 个人资料读取、M02 个人资料写入、N01/N02/M01/G01 通知读写、M10 当前设备退出、M04/全认证密码凭证及 M05 手机号换绑的规范 OpenAPI 合同都已测试先行落地;TAC 客户端批次已经完成,A01 短信登录、A04 注册和 A05 忘记密码当前共用严格验证组件、服务端 `validToken`、4 位短信码与可取消请求,但生产 OTP 目标已收紧为统一 6 位,须等待后端同版原子迁移后再替换客户端,禁止 4/6 双接受。领域基础已把会话与当前家谱 ID 收紧为词法字符串:账号切换和损坏存储清理上下文;给定新列表发现历史 ID 消失或显式目标无权时写入持久失效标记,跨重载也禁止静默切谱;T01 也会在写入路由家谱前拒绝已有失效标记和无访问权限的夹具。M07 已按 `POST /genealogy/app/feedback` 接入严格真实提交,mock 模式固定返回 `WRITE_UNAVAILABLE`,不再伪造成功。后端认证门禁未关闭前保持 `mock`;其余尚未接真实写接口的页面仍是明确本地预览或硬关闭
## 当前权威资料
@@ -18,7 +57,7 @@
- 接口导出:`APP.openapi.json``APP.openapi.yaml`
- schema v3 视觉资产注册表:`design-pipeline/manifests/runtime-assets.json`
- 九宫格所有者:`styles/adaptive-frame-profiles.scss`
- 密码策略所有者:`utils/validation.js`
- 当前预览密码策略所有者:`utils/validation.js`;生产目标 wire/policy owner 等待 `API-PASSWORD-001``005` 关闭后原子替换,禁止单页双轨。
- 响应式覆盖:`tests/responsive-layout-coverage.json`
- 固定尺寸例外:`tests/responsive-layout-allowlist.json`
- 活动路由:`pages.json`;项目固定使用 Vue 3`uni.scss` 是 Sass 设计令牌唯一入口。
@@ -27,18 +66,41 @@
## 接口文档所有权
Apifox 是接口合同的唯一源`APP.openapi.json` 用于自动扫描和测试,`APP.openapi.yaml` 用于人工阅读与跨工具导入两份文件都由用户从 Apifox 导出;后续目标合同要求它们来自同一版本并保持语义一致,不得分别手工维护。阶段 0 只保护文件,尚未把“当前两份导出语义完全一致”当作已验证结论
后端维护的 Apifox 项目是接口合同的唯一编辑源。`APP.openapi.json` 用于离线自动扫描和测试,`APP.openapi.yaml` 用于人工阅读与跨工具导入两份文件都只接受来自同一后端版本的重新导出,不得分别手工维护。部署地址的 `/v3/api-docs` 只作为当前线上实现证据,发现差异时必须推动同版本双导出更新,不能反向覆盖受保护文件。
当前 JSON 文档为 OpenAPI `3.0.1`,包含 `112` 条路径、`153` 个操作和 `72` 个模型。完整 JSON/YAML 语义一致性合同将在阶段 1 建立
当前 JSON 文档为 OpenAPI `3.0.1`,包含 `112` 条路径、`153` 个操作和 `72` 个模型。`tests/openapi-yaml-json-parity-runtime-smoke.js` 已使用无第三方依赖、无损任意精度数字且严格校验 mapping 分隔符的结构化解析器深比较完整 JSON/YAML;相邻不安全大整数差一反例已先红后绿,当前两份受保护快照语义一致。后端今后必须同版本双导出,任何单边漂移都会在领域合同前失败
阶段 0 结束时,JSON 的 SHA-256 为 `2b5b9a0ffdcd901c361fb7500bfd354d5fd6d038639fb6350c7d1ef7c0d43ab9`YAML 的 SHA-256 为 `ce6553577d441fee8c5023a87c30f9b411469cc1e7ce2d3c237314df0272ad77`。Git 只读状态仍为 YAML 已修改、JSON 未跟踪,与接管时一致;阶段 0 没有改写两份导出
后端在 2026-07-22 新提供 `https://backend-api.ddxcjp.cn/`。同日 21:52Asia/Shanghai)只读获取其 `/v3/api-docs`,线上为 OpenAPI `3.1.0``722` 条路径、`858` 个操作和 `507` 个模型;本地 112 条路径中有 109 条仍在线,`/genealogy/app/files/reference``/genealogy/app/files/upload``/genealogy/pc/files/upload` 三条不在当前线上文档,线上另有 613 条路径。线上模型已把部分 `Genealogy*Body` 重命名为 `AppGenealogy*Body``GenerationPoemBatchBody` 也新增了由路径写入的 `genealogyId` 字段,因此本地双导出是明确的旧快照,不能再代表当前部署的完整合同。`utils/config.js` 的唯一 `baseUrl` 已更新为无尾斜杠的 HTTPS 地址;`mode` 仍保持 `mock`,在页面接口和安全合同逐批闭合前不得提前切换远端
## 必须保护的用户改动
线上文档已经提供 `/captcha/require``/captcha/challenge``/captcha/verify`:挑战与校验绑定 `tenantId/clientId/sceneCode/subject`,校验成功响应可返回 `validToken`,而发送短信的 `AppSmsCodeBody` 已把 `validToken` 列为必填。客户端已按 `APP_SMS_LOGIN/APP_REGISTER/APP_FORGOT_PASSWORD` 三个精确场景实现“查询要求→取得挑战→供应商完成→服务端校验→携票发送短信”,注册和找回提交不重复执行 TAC;认证请求只接受 HTTP 200 的严格 JSON envelope,统一 15 秒超时,离页或返回会中止当前 RequestTask。密码登录体尚无 `validToken`,因此 A01 以短信登录为默认且密码登录入口保持不可用,绝不以客户端先滑动冒充服务端强制校验。
- `APP.openapi.yaml`:用户当前修改
- `APP.openapi.json`:用户新导出的未跟踪文件。
- `docs/家谱项目全量治理设计.md`:已确认中文设计
- `docs/家谱项目全量治理实施计划.md`:已改写为导航栈与 T01 的当前中文实施计划。
认证后端门禁仍有四组问题:`API-AUTH-TAC-001` 要求密码登录加入服务端可消费的同语义票据;`API-AUTH-TAC-002` 记录线上 `/captcha/challenge``APP_REGISTER` 实测返回 HTTP 500 且空响应;`API-AUTH-TAC-003` 要求验证请求以 provider discriminator/`oneOf` 严格关闭根对象和各 payload 的额外字段,并补齐必填 `providerCode/captchaType/payload``API-AUTH-TAC-004` 要求同一验证中心返回服务端绑定的 verification session、可验证方法和同一类短时单次 `validToken``required=false` 也必须直接签发可供短信接口消费的票据,不得形成无障碍绕过。`tests/auth-tac-openapi-contract.ps1` 当前输出 `AUTH-TAC-OPENAPI-CONTRACT BLOCKED`。密码登录、短信登录和注册的线上成功响应已统一为 `RAppLoginVo → AppLoginVo.access_token`,客户端旧令牌字段读取已删除。线上文档自身仍发布 `http://backend-api.ddxcjp.cn` server URL,与已验证可用的 HTTPS 地址不一致;客户端只能使用显式 HTTPS,后端还需修正文档 server 声明。对 `http://localhost:5173` 的预检已返回允许 `content-type/clientid`,这不能替代正式 H5 域名的 CORS 验证
家谱工作区只读审查已固定 `/genealogy/app/genealogies/mine` 为可访问集合 owner、`/genealogy/app/genealogies/{genealogyId}/overview` 为 G05 唯一详情 owner;首批不同时请求语义重复的 `/{genealogyId}`。线上 `AppGenealogyVo.genealogyId` 仍是 JSON `integer/int64`,最大合法值进入 JavaScript 后会不可逆失真;三个相关模型均无 `required`,也没有必填 `canView``roleType` 无枚举。无令牌实测三条读取均返回 HTTP 200、`application/json;charset=UTF-8``{code:401,msg,data:null}`,但文档只列 200/401 且 401 为字符串,尚不能稳定区分登录失效、对象无权、已删除和服务故障。问题单 `API-GENEALOGY-WORKSPACE-001``003``tests/genealogy-workspace-openapi-contract.ps1` 已建立;同版本双导出通过前不写 G01/G05 专属 adapter,不用本地字段猜测替代服务端 owner
M06 三人审查选择 `GET /genealogy/app/help-articles` 的完整列表作为唯一远端 owner;线上列表模型已经包含 `helpContent`,因此页面不调用详情端点、不消费 `helpId`,也不让 JSON `int64` 进入页面模型。每次响应只允许显式投影 `helpCategory/helpTitle/helpContent`,分类从当前列表动态派生,展开键只在当前响应生命周期内使用并在搜索、分类、刷新前清空。当前受保护双导出仍返回通用 `ListResult/RList`,线上 `RListHelpArticleVo/HelpArticleVo` 又没有 `required`,正文格式、仅发布内容、展示顺序和认证失败承载也未形成一致合同;匿名实测列表与详情均为 HTTP 200+业务 `code=401`,而线上文档声明 HTTP 401 string。问题单 `API-M06-001``003``tests/help-center-openapi-contract.ps1` 已建立;门禁通过前保留明确本地 FAQ,不写 live-only adapter。
个人资料读取三人审查固定 `GET /genealogy/app/auth/profile` 为 M01/M02/M03 共用的唯一接口 owner。首批只要求 canonical 11 位 `phone` 必填;`nickName/realName/email` 未设置时唯一省略,出现时必须是非空规范字符串,姓名最多 30、邮箱格式有效且最多 100。adapter 立即把明文手机号变为掩码和读屏标签,只输出固定页面模型;`userId/avatar/status` 等字段全部丢弃,因此它们的 int64/枚举不阻塞本批。受保护双导出仍是通用 `ObjectResult/RObject`,线上 `RAppProfileVo/AppProfileVo` 则无 required 和字段边界;匿名实测仍是 HTTP 200+业务 401,与文档 401 string 冲突。问题单 `API-PROFILE-READ-001``003``tests/profile-openapi-contract.ps1` 已建立;门禁通过前不把 live-only 字段接进页面。
通知三人审查把读取与写入拆成两个原子批次。读取唯一使用 `GET /genealogy/app/notifications``GET /genealogy/app/notifications/unread-count`:列表必须完整返回当前账号最多 200 条活动通知并按最新优先,未读数精确统计同一集合;页面只消费完整纯文本标题/正文、带时区时间和 `READ/UNREAD`,所有服务端 ID、发送者与业务目标都不进入公开页面模型。N02 没有详情接口,首批只能以当前内存 `generationordinal``snapshotKey` 打开完整快照,重启、账号切换或成功刷新后的旧 key 均提示返回消息中心重新打开。已读写入另由两个 POST 持有,要求无损字符串 `notificationId`、当前账号幂等、read-all 截止点和并发新消息语义;通过前删除伪本地已读而不发请求。当前受保护双导出的列表仍是通用模型且没有未读数路径,线上模型无 required/枚举/容量,所有 ID 仍为 int64,匿名实测又是 HTTP 200+业务 401。问题单 `API-NOTIFICATION-READ-001``003``API-NOTIFICATION-STATE-001``003` 以及两项失败合同已经建立,均不以猜测代码绕过。
M02 资料写入三人审查保留现有 `PUT /genealogy/app/auth/profile` 作为唯一 App owner,但要求后端把它正式定义为原子 dirty-only merge,而非全资源替换或依赖 DTO 惯例猜测。请求只允许脏的 `nickName/realName/email`:省略保持,昵称出现时必须非空,真实姓名/邮箱的精确空串表示清空,null、纯空白和边界空白非法;成功返回完整 canonical `RAppProfileVo`,清空后的可选字段仍省略。并发沿用 T01 的单一版本模型:`AppProfileVo.profileVersion` 是 opaque stringPUT 必带同形状 `If-Match`,旧版本返回 409 `PROFILE_VERSION_CHANGED`H5 CORS 同步允许该 header。受保护双导出还是旧 `ProfileUpdateBody → RObject`,线上则是无 required/merge/version/security 的 `AppProfileUpdateBody → RAppProfileVo`;当前页面还把同一 fixture 名称同时填入昵称和真实姓名,并用 500ms 定时器伪造本地校验。问题单 `API-PROFILE-UPDATE-001``004``tests/profile-update-openapi-contract.ps1` 已建立;GET 门禁和本门禁通过前不接写入。
M10 退出三人审查固定 `DELETE /genealogy/app/auth/logout` 只撤销请求中 bearer 所属的当前设备凭证族;同账号其他设备保持登录,“全部设备退出”必须另立接口。活动、已撤销和已过期但仍可验证为本 client 签发的历史凭证重复 DELETE 都返回同一个 200 `RVoid`,且成功后旧 token 对任何受保护接口均不可用;伪造、格式非法或 client 不匹配才返回 typed 401 拒绝。客户端唯一 `logoutCoordinator` 在同一同步临界段捕获 A 的 token/clientid、清本地 token/家谱上下文并 bump epoch、用显式快照创建不绑定 M10 生命周期的请求,然后立即 `goRoot(A01)`;异步回调永不再次 clear,避免误删随后登录的 B。线上 endpoint 虽存在,却无 security/clientid、required RVoid、范围/幂等/复用反例和 JSON/no-store;问题单 `API-LOGOUT-001``003``tests/logout-openapi-contract.ps1` 已建立。任何远端失败都不恢复本地 token,只区分“已从本机退出;服务器撤销已确认/未确认/未能撤销”。
M04 改密三人审查否决当前登录/注册/找回/改密共用的静态 32 个十六进制字符 MD5 wire:它是可直接重放的密码等价物,也使服务端无法执行真实新密码策略。唯一生产目标是四条入口原子迁移到 HTTPS 中的 raw `writeOnly` 密码;当前密码与登录兼容 1—64 Unicode code point,新密码统一 15—64 code point、NFC、允许空格与 Unicode、无组成规则,并由服务端执行常见/泄露密码 blocklist、账号限速和带独立盐的自适应慢哈希。M04 当前密码就是重新认证,TAC 不替代身份;用户明确要求的 A01/A04/A05 TAC 仍由原认证门禁持有。严格 200 前服务端必须原子落密、提升 `credentialEpoch` 并撤销包括调用者在内的所有 access/refresh session,客户端清本机回 A01;网络、超时、畸形响应或 5xx 也是结果未知,同样清本机且不自动重试。问题单 `API-PASSWORD-001``005``tests/password-change-openapi-contract.ps1` 已建立;门禁通过前 M04 保持诚实本地预览。
M05 换绑三人审查否决“活动 bearer+新号验证码”直接改号:这只能证明控制新号码,不能证明当前账号本人。唯一生产流程是活动 session、最终 PUT 内 raw `currentPassword` 重新认证、`APP_PHONE_CHANGE` TAC 和新号严格 6 位 OTP;不强制旧号 OTP,避免用户丢失旧号时永久锁死,但成功事务必须持久写入旧号安全通知 outbox。标准 OpenAPI 无法按公共发码 body 的 `sceneCode` 条件化鉴权,因此采用独立且强制 SaToken 的 `POST /genealogy/app/auth/phone/sms/code`scene 由路径固定;公共 `/auth/sms/code` 删除 `APP_PHONE_CHANGE`,两个 operation 仍复用同一 OTP 生成、限速和存储 owner。最终 `PUT /auth/phone` body 只含 `currentPassword/phone/smsCode`,在同一事务内消费 OTP、执行号码唯一约束、更新号码、提升 `credentialEpoch`、撤销包括当前在内的全部 access/refresh session并写通知 outbox,严格 200 返回 `RVoid`。无密码账号返回 `STEP_UP_UNAVAILABLE`,不能降级;最终 PUT 的超时、5xx、畸形响应或进程终止均按结果未知清本机回 A01且不自动重试。问题单 `API-PHONE-001``005``tests/phone-change-openapi-contract.ps1` 已建立;M04 raw-password 门禁、认证/TAC 门禁和本门禁通过前,M05 保持诚实本地预览。
G03 创建链路三人反向质询后否决“先建空谱、再写始祖”的 `ROOT_REQUIRED` 两写方案:当前产品没有跨会话保存空谱的需求,而两写会凭空增加半成品配额、可见性、恢复、取消、过期和第二次未知结果。唯一生产目标是第一步只在本页收集资料,最终按钮以 `AppGenealogyBootstrapBody` 一次原子创建家谱、OWNER 成员关系、带数据库权威标记的唯一一世始祖、READY 状态和幂等回执;通用人物 collection、人物 DELETE 与 parents mutation 必须阻断第二根、删除根和重挂父母,人物 PUT 对根的可编辑白名单精确只有 `name/sex/birthDate/biography`,其他字段全部 typed 422。首次 POST 先以短控制事务认领 PENDING/digest/fencing,再由业务事务完成全部写入,任一步失败全回滚并 CAS 终态;结构化转换只允许 `ABSENT→PENDING→SUCCEEDED/FAILED_NO_COMMIT` 且终态不可变,FAILED 机器保证零领域写与零 quotaPENDING 的 `resolveBy<=claimedAt+2 分钟``GenealogyBootstrapOperationKey` 由 13 位服务端判定的 issuedAt 毫秒与至少 128 位 CSPRNG 组成,`acceptUntil=issuedAt+10 分钟`、最大未来偏差 5 分钟,并由 600/300 秒扩展锁定;operation-status GET 无 body、纯读且只返回显式 discriminator 的三个状态,截止前 404 保持同 key,截止后无记录按 key 计算 FAILED 而不写墓碑。请求使用受鉴权 `/genealogy/app/region/search`、词法 `GenealogyRegionCode`、服务端 `selectable` 和统一 `GenealogyAccessPreset=MEMBER_ONLY/PUBLIC_APPLY`,同版删除公共地区旧路由,并递归清除组合 schema 中的 `visibility/joinMode` 及旧 create/update DTOG11 在本批只取得共享字段形状,其 If-Match、版本/CAS、权限刷新与结果未知仍是独立门禁。客户端仅持久 `{sessionEpoch,operationKey,startedAt}``IDEMPOTENCY_KEY_REUSED` 必须进入 fatal/quarantined,禁止查询或安装 status、自动换 key,只有用户明确放弃才能清理;其他分支按可证明未提交与 unknown 分离。成功固定按 receipt→`/mine` cache→context→G05 收口,context/导航失败只重试本地闭环。问题单 `API-G03-001``005`、完整双源深比较、后端 `tests/g03-bootstrap-openapi-contract.ps1` 和实际执行状态机套件的客户端 `tests/g03-bootstrap-client-release-gate.ps1` 已建立;G03 两门禁转绿仍不能绕过家谱工作区读取门禁、聚焦/全量回归与 MuMu 原生验收,全部通过前保留诚实本地预览,不接 `appApi.createGenealogy`
当前 JSON 的 SHA-256 为 `87db1dc148c5e6e877815aff7b3a7fc7c7eca95a2cec50a88b42f3908961f31a`YAML 的 SHA-256 为 `8964cd583ce172425b63bbfd802f7eb587eb3641eadfd6f9d3b264faa8090c6c`。两份文件均已被 Git 跟踪,当前相对 HEAD 无差异;本轮没有改写、格式化或覆盖接口导出。
## 必须保护的用户文件
- `APP.openapi.yaml``APP.openapi.json`:后端接口离线源快照,只接受同一后端版本的双导出替换,不得手工修改。
- `static/tac/`:当前共 5 个文件,其中 4 个是后端提供且不可改写的供应商文件,第 5 个是项目适配器 `static/tac/js/jiapu-tac-adapter.js`A01/A04/A05 已形成真实运行时消费者,文件集合与供应商哈希由 `tests/auth-tac-integration-contract.ps1` 唯一保护。
- 当前五份中文治理文档:长期唯一入口,随已验证进度同步更新,不另建平行计划。
任何清理批次都不得覆盖、恢复或删除以上文件。
@@ -59,41 +121,111 @@ Apifox 是接口合同的唯一源头。`APP.openapi.json` 用于自动扫描和
- 旧 A01 固定画布、PSD、Photoshop、v2 按钮和旧卷轴入口已经三人一致退役;没有通过重建旧预览制造假绿。
- schema v3 注册表已经完整覆盖当前 `static/assets`:认证直接资产、其余应用直接资产、共享卷轴、六张长页面背景和 G01 空态边框各有唯一 owner;旧 G01 候选与模块背景清单及注册例外已经删除。
- `design-pipeline/manifests/shared-scroll-skins-v3.json` 只拥有母版、处理、物理输出和质量规则,不再拥有页面槽位或 `uni-app mode`
- `tests/runtime-assets-contract.ps1` 精确闭合 `79` 个正式输出、物理文件和源码消费者;`tests/retired-asset-removal-contract.ps1` 防止旧候选、旧图标、TAC 残件与旧构建入口回归。
- 阶段 0 验收时,`tests/runtime-assets-contract.ps1` 精确闭合 `79` 个正式输出、物理文件和源码消费者;导航任务 3 又删除了退役通用页面唯一虚构消费的两张 notification frame,当前正式输出为 `77` 个,并由 `tests/retired-module-page-contract.ps1` 防止旧入口与孤立资产回归。
- 设计管线当前为 Node `25/25 PASS`、Python `19/19 PASS`;四张共享卷轴、六张长背景和 G01 空态边框均可真实重建并通过质量审计。
- 质量报告只含工作区相对路径;确定性测试证明相同输入连续两次得到相同字节哈希与报告。
- 六张长背景与 G01 空态边框迁移后的可见像素哈希逐张等于迁移前正式图;连续两次构建的文件 SHA-256 也完全一致。旧 Sharp 单用途依赖和专用构建器已删除。
- 已删除 `28` 个无运行时消费者的 `static/assets``3` 个旧 `static/icons``4` 个未接入业务的 TAC 文件和 `8` 个候选或伪母版;两张用户批准的 A01 选型图作为 `reference-only / non-runtime` 视觉锚点保留。
- 阶段 0 验收时的 MuMu 证据:`emulator-5554` 当时在线,ADB 设备字段为 `model:SDY_AN00`,系统型号为 `SDY-AN00`,物理尺寸 `720×1280`density `320 dpi`。本轮原生截图逐张打开复核了 A01、G01、T01 和 F01,未见缺图、透明错误、异常裁切或样式回退;复核结束后已回到 A01 页面,未启动、关闭或调整模拟器。
- `docs/接口与页面映射总表.md` 已按 `pages.json` 建立 `52/52` 活动页面映射;A04 与 T01 专项结论,其余具体接口明确标记为“待对应业务阶段 OpenAPI 审查”。
- 第一轮六项产品优化已经完成:G01/G03/G06 统一读取 `onLoad(query)`;AppDialog 统一安全区与高度预算;AppTabbar/GenealogyCard 补齐可访问点击语义;G10 拒绝原因建立错误关联与失败聚焦;A04/A05/M04 统一消费唯一密码策略;T01 可在视图漂移后精确回到当前成员。
- `docs/接口与页面映射总表.md` 已按 `pages.json` 建立 `52/52` 活动页面映射;A04、G 系列第一轮、T01 和新线上 OpenAPI 差异已有专项结论,其余具体接口标记为“待对应业务阶段 OpenAPI 审查”。
- 第一轮六项产品优化已经完成:G01/G06 统一读取受控查询参数,G03 在本轮进一步删除了无业务参数的 `onLoad`;AppDialog 统一安全区与高度预算;AppTabbar/GenealogyCard 补齐可访问点击语义;G10 拒绝原因建立错误关联与失败聚焦;A04/A05/M04 统一消费唯一密码策略;T01 可在视图漂移后精确回到当前成员。
- 后续产品阶段按顺序为导航栈语义统一、T01 大规模世系树、短信验证码完整状态机、跨页面领域数据持久化、全局文字层级和无障碍第二轮;不得混合实施。
- 文档权威迁移已删除 `198` 个旧 Markdown、`35` 张旧 H5/静态设计图、`4` 个只保护旧资料的测试和 `.superpowers/sdd``12` 个过程文件;阶段 0 临时清单随后也已删除,当前 `docs/` 只保留 `5` 个长期中文 Markdown 入口。
- 浏览器截图链已把 G03、G06、G08—G12、T06、F02、N01 的有效状态断言迁回各自现有运行时合同;G01、T03—T08、T07 三个有价值的浏览器测试只剥离截图写盘,继续验证状态、滚动、溢出与交互。
- 已删除固定 Chrome 截图助手、联系表、8 个只保护截图助手的合同,以及迁移后重复的 N01/A02 合同;`tests/mumu-visual-acceptance-boundary-contract.ps1` 现在唯一约束“仓库不维护自动截图证据链、最终视觉通过只来自 MuMu”。
当前全量 PowerShell 合同为 `119/119 PASS`;五个核心验证、密码策略 Node 冒烟、设计管线 Node `25/25`、Python `19/19`、四份资产清单验证和共享卷轴质量验证均通过。根 `tests/` 现有 `29` 个 Node 文件,其中唯一不依赖 H5/CDP 服务的密码策略冒烟已实际执行;其余运行时文件只在具备 `127.0.0.1:9222` 调试页时执行,不能用语法检查冒充运行通过。
当前物理库存为 `140` 个 PowerShell 合同、`47` 个 Node 文件和 `4` 个 JSON 合同数据文件。最新 fresh 结果为 PowerShell `126/140` 通过;其余 14 项不是可删除的普通回归,而是保留真实外部或发布阻塞的 `tests/lineage-openapi-contract.ps1``tests/auth-tac-openapi-contract.ps1``tests/genealogy-workspace-openapi-contract.ps1``tests/g03-bootstrap-openapi-contract.ps1``tests/g03-bootstrap-client-release-gate.ps1``tests/help-center-openapi-contract.ps1``tests/profile-openapi-contract.ps1``tests/profile-update-openapi-contract.ps1``tests/notification-read-openapi-contract.ps1``tests/notification-read-state-openapi-contract.ps1``tests/logout-openapi-contract.ps1``tests/password-change-openapi-contract.ps1``tests/phone-change-openapi-contract.ps1` 和缺少 MuMu 人工证据时必须失败的 `tests/auth-android-accessibility-release-gate.ps1`。十四个输出分别为 `LINEAGE-OPENAPI-CONTRACT BLOCKED``AUTH-TAC-OPENAPI-CONTRACT BLOCKED``GENEALOGY-WORKSPACE-OPENAPI-CONTRACT BLOCKED``G03-BOOTSTRAP-OPENAPI-CONTRACT BLOCKED``G03-BOOTSTRAP-CLIENT-RELEASE BLOCKED``HELP-CENTER-OPENAPI-CONTRACT BLOCKED``PROFILE-OPENAPI-CONTRACT BLOCKED``PROFILE-UPDATE-OPENAPI-CONTRACT BLOCKED``NOTIFICATION-READ-OPENAPI-CONTRACT BLOCKED``NOTIFICATION-READ-STATE-OPENAPI-CONTRACT BLOCKED``LOGOUT-OPENAPI-CONTRACT BLOCKED``PASSWORD-CHANGE-OPENAPI-CONTRACT BLOCKED``PHONE-CHANGE-OPENAPI-CONTRACT BLOCKED``ANDROID-AUTH-ACCESSIBILITY-RELEASE BLOCKED`。Node 语法 `47/47` 通过,纯 Node 冒烟 `19/19` 通过,活动 Vue 脚本模块语法 `64/64` 通过;导航源码扫描保持 `MIGRATION-DEBT=0`。依赖 `127.0.0.1:9222` 调试页的浏览器运行时文件本轮只做语法检查,没有执行;这不能冒充浏览器行为或 MuMu 原生视觉通过。
清理结束`static/` 精确保留 `79`正式文件、共 `70,414,397` 字节`tmp/``unpackage/``design-pipeline/generated/` 均不存在。三位审查者确认删除的三类临时输出分别为 `94``188``3` 个文件;正式生成资产仍由清单和构建器恢复,质量报告不作为长期资料保留。
阶段 0 清理结束`static/` 的正式基线为 `79` 个文件、共 `70,414,397` 字节。任务 3 退役两张孤立通知 frame 后,正式 `static/assets``77` 个文件、共 `69,093,742` 字节;`static/tac/` 当前 5 个文件、共 `68,190` 字节,因而当前 `static/` 物理库存为 `82` 个文件、共 `69,161,932` 字节。4 个供应商文件保持原字节并由哈希合同保护,新增适配器是唯一项目映射层;TAC 已进入 A01/A04/A05 业务运行时,但不属于可重建视觉资产注册表。`tmp/``unpackage/``design-pipeline/generated/` 均不存在;正式生成资产仍由清单和构建器恢复,质量报告不作为长期资料保留。
## 当前规划结论
### 导航栈
- 52 个活动页面只读统计为 `navigateTo 59``navigateBack 11``redirectTo 14``reLaunch 7`,活动页面合计 91 次;活动组件另有 4 次,封存 A06 另有 2 次;没有 `switchTab`
- 迁移前 52 个活动页面只读统计为 `navigateTo 59``navigateBack 11``redirectTo 14``reLaunch 7`,活动页面合计 91 次;活动组件另有 4 次,封存 A06 另有 2 次。任务 3—9 已依次迁移共享组件、认证、G、T、F、R、N/M,任务 10 删除最后一个无消费者旧表单组件并关闭门禁。当前 pages/components 中 `navigateTo``navigateBack``redirectTo``reLaunch``getCurrentPages` 和业务页面路径字面量均为 `0``switchTab` 全项目为零;五种 Uni 导航调用和页面栈读取只允许由 `utils/navigation.js` 持有,业务路径只允许由 `utils/navigation-routes.js` 持有
- MuMu 已复现 F01→F03 返回后残留两个 F01、A01→A04→登录后残留两个 A01、T03 同路由连续叠页,以及栈深为 1 时 F03 错回 G01。
- 三人终选两个唯一所有者:`utils/navigation-routes.js` 持有 52 条路由、父页参数映射和结果操作枚举,`utils/navigation.js` 持有五种 Uni 导航 API、个公开语义方法、一次性结果与统一返回优先级。
- G01、F01、M01 保持自定义 Tab 根页;A01 是认证根页。T03 只保留一个原生页面实例,亲属浏览使用页内成员轨迹
- 当前尚未新建这两个模块,也没有迁移任何页面;实施从 `tests/navigation-routes-contract.ps1` 的预期红灯开始
- 三人终选并已实现两个唯一所有者:`utils/navigation-routes.js` 持有 52 条路由、父页参数映射和结果操作枚举,`utils/navigation.js` 持有五种 Uni 导航 API、个公开导航语义方法、一次性结果与统一返回优先级;没有真实替换边,因此不公开替换方法
- G01、F01、M01 保持自定义 Tab 根页;A01 是认证根页。T03 只保留一个原生页面实例,初始路由 `personId` 是不可变宿主页身份,亲属浏览使用页内成员轨迹和可变活动成员;T05 本地预览离开使用 `goBack()`,不会把活动成员误写成宿主页路由身份
- 任务 1—10 已完成测试先行和静态实现;一次性结果绑定真实目标路由与业务参数上下文,只能由当前真实栈顶目标页消费。52 个活动路由、共享组件、四个根语义以及认证、G、T、F、R、N/M 系列均已迁移;通知目标只能由本地类型白名单映射,未知或越权目标失败关闭。未接真实写接口的页面只能形成明确的本地预览或硬关闭,不再展示伪保存、伪邀请码、伪订单或伪安全结论。任务 4—10 的 MuMu 原生流程复核仍因本轮禁止触碰模拟器而待执行,静态零债务不能替代该验收
### T01 大规模世系树
- 前默认 6 人数据已存在 103→106 断线;普通节点实际半高与全局常量相差约 4rpx10×12 压力数据约 45/54 个父分组会断线,而旧测试只检查线段数量。
- 当前布局最坏为 `O(G×N)`,单人一代时接近 `O(N²)`;页面mock 和 OpenAPI 分别使用 `parentId`、无关系字段和递归 `children/spouses`,无法直接对接。
- 前默认 6 人数据中的 103→106 断线已通过唯一成员 owner 与字符串 `parentId` 修复;普通节点实际半高与全局常量相差约 4rpx10×12 压力数据约 45/54 个父分组会断线,而旧测试只检查线段数量。
- 当前布局最坏为 `O(G×N)`,单人一代时接近 `O(N²)`;页面mock 已统一当前阶段的 `id/parentId` 夹具,但 OpenAPI 仍使用递归 `children/spouses`,无法直接对接未来规范图窗口
- 产品终选“焦点成员渐进窗口+独立全谱概览”,初始上二代/下二代;主世系为骨架,配偶并排,每段家庭关系有独立联合点,子女从对应联合点向下。
- 技术终选视口大小的单 Canvas 同画节点和边;纯 JavaScript 按“规范化→严格校验→可见投影→确定性布局→Scene/空间索引→相机”处理,DOM 只保留页头、工具条、两档抽屉、搜索、概览和无障碍线性列表。
- 当前 OpenAPI v1 `/lineage/tree` 仍是递归 `LineagePersonTreeView[]`,并缺少 overview、locator、稳定关系寻址和树版本并发合同。后端问题单 `API-T01-001` 已固定四条 `/genealogy/app/v2/...` 路径、FOCUS/BOUNDARY 查询、`schemaVersion/treeVersion`、EMPTY/POPULATED 空谱判别、窗口入口与全谱根分离、严格匿名节点、以 `relationshipKind` 判别的可寻址伴侣/父子关系、空 PATCH 错误码和 Scene 原子版本;在用户重新导出通过新合同前,T01 客户端不得开始实施
- 当前规划轮没有改写 OpenAPI 文件,没有启动、关闭或调整 MuMu,也没有修改页面与业务代码
- 本地旧导出和 2026-07-22 线上 OpenAPI 都只有 v1 `/lineage/tree`仍是递归模型,并缺少 overview、locator、稳定关系寻址和树版本并发合同。最新线上文档的 `722` 条路径中没有任何 `/genealogy/app/v2/``507` 个模型中也没有新图辨识字段,四个稳定业务码同样缺失。后端问题单 `API-T01-001` 已固定四条 v2 路径、FOCUS/BOUNDARY 查询、`schemaVersion/treeVersion`、EMPTY/POPULATED 空谱判别、窗口入口与全谱根分离、严格匿名节点、以 `relationshipKind` 判别的可寻址伴侣/父子关系、空 PATCH 错误码和 Scene 原子版本;`tests/lineage-openapi-contract.ps1` 已建立严格红灯,在同版本线上文档与双导出通过前,T01 客户端不得开始任务 12
- 当前实施轮没有改写 OpenAPI 文件,没有启动、关闭或调整 MuMu;已完成导航共享所有者、共享组件/根页头部语义、退役死入口、认证、G 系列、T 系列和 F 系列导航合同,以及树成员与家族内容夹具统一。认证请求代码已对准真实端点,但运行模式仍失败关闭;G/T/F 系列真实写接口与 T01 新图尚未接入
### TAC 认证与无障碍安全边界
- `utils/auth-verification.js` 是当前认证场景、4 位短信码和服务端票据形状的唯一客户端 owner;生产目标由后端 `SmsCodeSecret``tests/phone-change-openapi-contract.ps1` 锁定为严格 6 位,门禁通过时必须一次替换所有活动消费者并删除旧 owner 的四位规则。`components/TacVerification.vue` 是验证浮层与 renderjs 生命周期 owner`static/tac/js/jiapu-tac-adapter.js` 是 TianAi challenge/proof/verify 映射 owner`utils/api.js` 是严格 HTTP 200 envelope、15 秒超时、离页中止、认证会话写入和反馈 wire payload 的唯一 owner。旧认证专用请求控制器入口、占位验证、伪验证码、宽松令牌兼容和 M07 假提交均已删除。
- A01 默认短信登录;密码登录因 `API-AUTH-TAC-001` 保持可见但不可用。A04/A05 都只在发送短信前验证一次,并在手机号改变后使旧验证码上下文失效;成功、失败、取消、重复回调、空响应、非 JSON、超时、离页和返回键均有静态或纯运行时合同。短信发送与重设密码的 `RVoid` 没有声明 `data` 必填,客户端因此只要求合法 HTTP 200 与整数成功 `code`,并把“省略 data”或 `data:null` 都精确归一为 `null`;登录、注册和 challenge 等有实体响应仍强制 `data`
- 当前客户端浮层已补齐对话框命名、说明关联、初始聚焦、Tab 圈定、Escape/Android 返回、焦点恢复、原生刷新与关闭按钮、48px 目标及小视口内部滚动;这只是客户端壳层预检,不代表第三方滑块本身可由 TalkBack 或键盘完成。`tests/auth-android-accessibility-release-gate.ps1` 要求 MuMu 原生证据与非拖动等价验证方式,证据缺失时固定输出 `ANDROID-AUTH-ACCESSIBILITY-RELEASE BLOCKED`
- 三人交叉质询后的唯一方向是“同一验证中心、同一短时单次 `validToken`、供应商无关的服务端决策”,永久禁止 `accessibility=true`、跳过 TAC 或无票据发短信。中国大陆非交互风控供应商只进入限时 POC,必须在真实 UniApp Android WebView 中证明 TalkBack、外接键盘和 Switch Access 无焦点陷阱且误杀、防刷、弱网与故障指标达标,不能预先写成无障碍完成。已安全绑定设备只能作为加权信号;供应商不确定或不可用时进入支持文字/中继的可审计人工兜底或稍后重试,绝不 fail-open;音频验证码仅为后续独立 POC 候选,不能作为 P0 或唯一替代。
### 领域上下文与 M07 反馈
- `utils/genealogy-context.js` 只接受无边界空白的非空词法字符串 ID,并持有独立失效标记;`utils/session.js` 在损坏令牌、退出和账号令牌变化时同步清理 ID 与标记。首次且没有历史选择或标记时可确定选择首个可用家谱;针对调用方提供的新列表,历史选择消失或显式目标不可用时写入标记并由 G01 要求用户明确重选,跨重载也禁止静默串谱。真实后台撤权能否被及时发现仍取决于后续 workspace 的 onShow/事件刷新。
- `appApi.submitFeedback` 是反馈提交唯一 owner:只接受 `feedbackContent` 必填、`feedbackType/contactInfo` 可选的三个字符串字段,trim 后删除空选填值;调用方不能关闭认证头。remote 精确 POST `/genealogy/app/feedback`,只认 HTTP 200 且 `code` 为整数成功码的 envelope;反馈响应没有声明 `data` 必填,页面也不消费返回实体。mock 固定失败关闭且不调用网络。
- M07 提交中禁用输入并使用提交前快照;成功后保留回执内容并禁止原样重复提交,请求期若仍有迟到输入则明确区分“上一份已提交”和“当前修改未提交”。超时、断网、意外 2xx/3xx、HTTP 408/5xx 或响应无效进入 `uncertain`,同一快照禁止重提;unknown 回流也会重新比较当前表单,迟到输入保持可提交而不冒充旧快照。只有确定拒绝才允许重试。`tests/m07-feedback-state-runtime-smoke.js` 已直接执行这些页面状态;真实服务联调仍受认证远端门禁约束。
### 家谱工作区远端门禁
- 三人反向质询后没有要求后端把 `AppGenealogyVo` 全部字段设为必填,也不把缺少 `security` 注解或文档媒体类型 `*/*` 单独宣称为数据泄漏。首批只消费 `genealogyId/genealogyName/canView/canManage/canEditContent/roleType`;前五项需明确类型并必填,`roleType` 还需非空正式枚举。地点、堂号、人数和简介可选并由页面诚实降级,未知额外响应字段允许忽略。
- JSON 响应身份必须使用非空词法字符串。仅在客户端拒绝 unsafe number 虽可避免串谱,却会让 OpenAPI 合法的 int64 用户永久不可用,不能作为普遍上线方案;URL path 在 wire 上本就是文本,不机械要求为了同一问题改类型。
- `/mine` 必须以必填 `canView` 或等价、可自动验证的投影保证只把当前账号仍可查看的家谱送入 context;G01 只有成功取得新列表才 reconcile。网络、超时和 5xx 保留旧现场并显示错误,明确撤权/无权/不存在才写 tombstone。G05 使用 `/overview`,取消迟到请求并在新身份加载前清掉旧数据,远端失败绝不回退 fixture 角色。
- OpenAPI 注解修复后仍须用有效账号执行无凭证、跨账号、撤权、删除、5xx、畸形 JSON 和取消反例;当前无令牌 HTTP 200+业务 `code=401` 的承载方式可以保留,也可改规范 HTTP 状态,但文档、运行时 validator 与部署行为必须一致。
### M06 帮助内容远端门禁
- 首批只使用 `/genealogy/app/help-articles` 一次取得完整正文;详情接口、文章深链、封面、浏览量和业务 ID 均不属于 M06。adapter 只准输出 `{category,title,content}` 与当前响应生命周期的展示键,必须显式丢弃 `helpId/status/sortOrder/viewCount/coverOssId/remark`
- 响应 envelope 的 `code/data` 和每行 `helpCategory/helpTitle/helpContent` 必须 required;三项均为非空字符串,分类是可直接展示标签,正文首版固定为纯文本。用户侧列表只返回已发布内容,数组顺序就是展示顺序;客户端不猜分类码、不解释 HTML/Markdown。
- 搜索与筛选只作用于已投影数组;筛选后不得重新编号。搜索、分类和刷新先收起正文,新请求以 controllergeneration 拒绝迟到响应,离页取消请求;空列表、搜索无结果、加载失败和认证失效必须分别表达。
- M06 现有分类和问题标题使用 `<view role="button">` 且触控高度不足;真正接线时改为原生按钮语义,补 `aria-pressed/aria-expanded/aria-controls`、状态播报、重试和至少 44dp 目标。源码审查不能替代 MuMu 的系统字号、TalkBack、焦点与视觉验收。
### 个人资料读取远端门禁
- 唯一 profile adapter 在 mock/remote 两种模式都产出同一窄模型;运行模式必须经 `resolveRuntimeMode()` 校验,错误配置不得静默回 fixture。remote 使用严格 envelope、15 秒超时、请求取消和 generation 防迟到,不建立跨账号缓存或经路由传递个人资料。
- 原始手机号只在 adapter 局部验证 canonical 格式,输出仅含 `maskedPhone` 与“绑定手机号,尾号 xxxx”读屏标签;页面、日志、错误、缓存和路由都不得接触明文。可选昵称、实名、邮箱只有真正省略时规范为内部空串;出现 null、空白、超长或非法邮箱时整份失败关闭。
- M01 的加载/失败只替换身份卡,服务菜单与底栏保持可用,并删除查询参数制造的假错误和“重试即成功”;通知 fixture 不得与真实身份混装为线上数量。M02 完成异步填表后才建立 dirty baselineGET 不冒充 PUT 保存;M03 只让手机号行局部加载/失败,密码入口不受普通读取失败影响,并删除不属于账号资料的“创建者”角色。
- 真正实施时原子替换禁止页面调用 API 的旧静态断言,使用 `AppLoading` 和原生按钮,补 M02 的 `aria-invalid/aria-describedby`、失败聚焦、状态播报、44dp 目标、长昵称换行和装饰图隐藏;MuMu 仍须验证系统字号、TalkBack、焦点与真实纹理对比。
### 通知读取与已读状态远端门禁
- 读取批次以无筛选列表作为当前账号完整活动集合 owner,`RListNotificationVo.data` 允许空但最多 200 条并按 `publishTime` 最新优先;`RNotificationUnreadCount.data` 为 0—200,精确等于同一活动集合中 `readStatus=UNREAD` 的数量。两个请求之间发生并发新消息时允许瞬时差异,客户端不得据此判错。
- `NotificationVo` 的首批 required 字段为 `noticeTitle/noticeContent/publishTime/readStatus`:标题 1—50、完整正文 1—1000 且为纯文本,时间必须是带时区 RFC3339,状态只允许 `READ/UNREAD`。N01 摘要最多显示 160 个字素,N02 展示同一快照的完整正文;长文本必须换行,不解释 HTML、Markdown、URL 或服务端跳转字段。
- 读取 adapter 只公开 `{snapshotKey,title,content,publishedAt,unread}`key 由成功响应 generation 与映射前 ordinal 组成;不持久化、不使用裸序号,也不把 `notificationId/genealogyId/bizId/bizType/senderPhone` 暴露给页面。成功刷新原子替换 generation,退出和账号切换立即清空;N02 不能解析 key 时只提示“请返回消息中心重新打开”。
- 首批删除通用“前往入谱审核”、详情目标按钮和从消息字段猜路由;后端将来只有提供闭合的 `bizType → route key+必填词法参数+权限/失效语义` 字典后才可独立恢复 CTA。M01/G01 共同消费未读数 owner,文案统一为“未读消息”,可见角标封顶 `99+`,读屏仍播报真实数量。
- 写批次通过前,打开 N01/N02、点击“标记已读”或“全部已读”都不得只改本地 clone。写合同通过后,唯一通知 controller 才能私有保留 1—128 位 URL-safe opaque `notificationId`;页面仍只持有 `snapshotKey`。单条和全部已读必须对当前账号幂等;read-all 只覆盖服务端接收时已存在的活动通知,并发新消息保持未读;超时或结果未知时重新读取列表和计数收敛。
- 两个失败门禁分别是 `tests/notification-read-openapi-contract.ps1``tests/notification-read-state-openapi-contract.ps1`。当前分别输出 `NOTIFICATION-READ-OPENAPI-CONTRACT BLOCKED``NOTIFICATION-READ-STATE-OPENAPI-CONTRACT BLOCKED`;后端同版本双导出、有效账号反例和 MuMu 状态矩阵完成前不能宣称通知闭环上线。
### M02 个人资料写入远端门禁
- PUT 请求体唯一 owner 固定为关闭额外字段的 `AppProfileMergeUpdateBody`,只能包含 1—3 个真正脏的 `nickName/realName/email`。昵称出现时为去边界空白的 1—30 字符;真实姓名和邮箱的精确 `""` 是唯一清空命令,非空真实姓名 1—30、邮箱 1—100 且格式有效。省略表示保持,null、纯空白、边界空白、空 body、头像/性别/生日或任意额外字段全部早失败。
- `AppProfileVo` 新增 required `profileVersion`,形状为 1—128 位 URL-safe opaque string;写请求只在 required `If-Match` header 携带,不在 body 建第二版本字段。服务端按当前账号和租户原子 CAS,成功返回含新版本的完整 canonical profile,旧版本固定 409 `PROFILE_VERSION_CHANGED`;相同字段集重复执行不产生通知、审计之外的额外业务副作用。
- M02 首次 GET 完成后才建立 baseline;保存时冻结三个输入和提交快照,成功用响应回填并重置 baseline。确定失败保留草稿;超时、断网、408/5xx 或畸形成功响应属于结果未知,先 GET 逐项核对本次脏字段,匹配则确认成功、仍为旧值才允许重试、第三值进入冲突,不盲目重复 PUT。
- session generation 是账号隔离边界:账号切换、退出和页面卸载中止等待、清空未持久草稿并拒绝旧账号迟到响应;取消 RequestTask 不等于服务端未写。真实姓名、邮箱、提交 payload 和版本不得进入日志、路由、持久缓存或遥测。
- 当前假定昵称必填,所以旧账号昵称省略时可以只改其他字段,但不能把已有昵称清空。头像选择、相册权限、OSS ID、性别和生日全部留到独立批次;当前 `<view role="button">` 假头像动作在写入实施时删除。邮箱没有验证与送达合同,页面不得继续承诺“用于接收通知”。
- `tests/profile-update-openapi-contract.ps1` 当前输出 `PROFILE-UPDATE-OPENAPI-CONTRACT BLOCKED`。后端关闭 `API-PROFILE-UPDATE-001``004`、同版本双导出通过、读取 owner 可用、有效账号/CORS 反例和 MuMu 表单矩阵完成前,M02 保持诚实本地校验而不发写请求。
### M10 当前设备退出远端门禁
- 后端 DELETE 只撤销当前请求 bearer 及同一可续签凭证族;其他设备 token 保持有效。合法签发给同一 client 的 active/revoked/expired token 重复调用统一返回 200 RVoid,操作幂等且无额外副作用;成功后用旧 token 调 profile 等受保护接口必须失败。非法或 client 不匹配返回 `RLogoutRejected`,业务码只允许 `TOKEN_INVALID/TOKEN_CLIENT_MISMATCH`,不能冒充远端已撤销。
- operation 必须 required SaToken 与非空 clientid、禁止 request body、200/401 使用 application/json 并带 `Cache-Control: private, no-store`RVoid 的整数 code required,另声明 400/429/500。线上仅有文字“需要登录”和 `*/*`,本地虽有 security/clientid 但 RVoid 无 required、只列 200,均未达到发布合同。
- `logoutCoordinator` 是唯一跨页 owner:同步捕获 token/clientid 与 logoutEpoch,立即调用 session owner 清 token、家谱上下文和账号缓存并 bump epoch,再以显式 A 快照创建 RequestTask;整个同步段不 awaitM10 页面拿不到 token。创建失败也不恢复;请求不绑定页面 controllerreLaunch/A01/M10 卸载不 abort。
- coordinator 的公开内存态只含 `{attemptId,logoutEpoch,status}`,状态为 pending/confirmed/unconfirmed/not-revoked,不保存 token、请求头或错误 payload。A01 仅在 session 仍为空且 epoch 未变化时原子消费一次提示;B 登录后 A 的迟到结果直接丢弃。进程被杀允许丢提示,但旧 token 不落盘、不排队、不跨重启重试。
- 唯一用户承诺始终是“已从本机退出”。200 显示服务器撤销已确认;network/timeout/408/429/5xx/畸形响应与 generic 401 显示未确认;typed 401/400/403 显示未能撤销。所有分支都留在 A01,不恢复 token、不返回 M10、不重新开放登录后页面;异步 callback/finally 绝不能再次 `session.clear()`
- `tests/logout-openapi-contract.ps1` 当前输出 `LOGOUT-OPENAPI-CONTRACT BLOCKED`。同版本双导出、两设备 token 隔离/复用反例、真实网络异常和 MuMu 退出提示完成前,只能称现有行为为本机退出,不能宣称服务端注销完成。
### M04 登录态修改密码远端门禁
- 密码 wire 是跨 A01 登录、A04 注册、A05 找回和 M04 登录态改密的单一合同。`PasswordLoginBody.password``PasswordChangeBody.oldPassword` 只引用 `CurrentPasswordSecret`;注册、找回和改密的新密码只引用 `NewPasswordSecret`。生产入口不再接受 MD5、十六进制摘要或两套兼容分支;确认密码只留客户端。
- `CurrentPasswordSecret` 是原样、不 trim 的 1—64 Unicode code point`NewPasswordSecret` 是 NFC 后 15—64 code point,允许空格、Unicode 和密码管理器粘贴,不强制字母/数字组成。服务端才是策略权威,必须执行常见/泄露密码 blocklist、当前密码验证、新旧不同、账号级限速和带盐慢哈希;页面校验只是即时提示。
- PUT required SaToken、非空 clientid 与关闭额外字段的 JSON body200/400/401/409/422/429/500 均为 typed JSON、`private, no-store`429 带 `Retry-After`。409/422 用 `RPasswordChangeRejected` 区分 `CREDENTIAL_VERSION_CONFLICT/CURRENT_PASSWORD_INCORRECT/NEW_PASSWORD_SAME_AS_CURRENT/PASSWORD_POLICY_VIOLATION`,不解析 `msg`
- 唯一会话方案是 ALL:严格 200 前原子写入新 verifier、提升 credential epoch,并让所有设备/所有 client 的旧 access/refresh session 跨节点失效;不返回新 token,也不让当前 bearer 继续存活。200、401、409 和传输结果未知都清秘密与对应本机会话并回 A01;只有明确未写的 400/422/429 可清 `credentialChangeInFlight` 后留页。
- 为关闭 PUT 已发出后进程被杀的窗口,session owner 在发送前只持久化 `{sessionEpoch,startedAt}` marker,禁止保存 token、密码、摘要或 body。冷启动发现同 epoch marker 时必须在任何账号缓存渲染前清会话并进 A01;新登录 bump epoch,使旧 marker 和迟到响应失效。客户端不自动重试、不建 operation-status;重新登录就是最小对账路径。
- `tests/password-change-openapi-contract.ps1` 当前输出 `PASSWORD-CHANGE-OPENAPI-CONTRACT BLOCKED`。后端关闭 `API-PASSWORD-001``005`、原子重导双文件、密码登录 TAC 可用、两设备/并发/故障注入与 MuMu 无障碍矩阵完成前,M04 继续显示“不提交服务器”。
## 三人规则
@@ -107,15 +239,24 @@ Apifox 是接口合同的唯一源头。`APP.openapi.json` 用于自动扫描和
- 不执行 Git add、commit、push、restore、checkout 或 reset。
- 不启动、关闭或调整 MuMu。
- 不删除源码、接口导出、当前权威设计或用户改动。
- 不删除活动业务源码、接口导出、当前权威设计或用户改动;只有三人以消费者、合同和资产清单共同证明已经退役的旧入口才可同轮删除
- 不因测试失败而删除测试。
- 不因静态搜索无匹配而直接删除资产。
- 不归档确认失效的旧内容,不保留兼容入口。
## 下一步
1. `docs/家谱项目全量治理实施计划.md` 的任务 1 先写路由注册表失败合同,再实现两个导航唯一所有者
2. 认证、G、T、F、R、N/M 每批独立运行聚焦合同、全局响应式合同、编译审计和 MuMu 进入/返回/取消/完成/重复进入矩阵
3. 导航门禁完全通过后,运行当前 OpenAPI 上预期失败的 T01 图合同,把 `API-T01-001` 交给后端;只接受用户从更新后的 Apifox 重新导出的 JSON/YAML
1. T01 后端接口门禁已经建立并运行出预期红灯;等待后端按 `API-T01-001` 发布四条 v2 操作并提供同一版本重新导出的 JSON/YAML,不手改当前快照,也不提前实施任务 12
2. TAC 客户端批次已经完成。认证后端仍须关闭 `API-AUTH-TAC-001``004`、提供同版本双导出并修复 challenge 500;随后才允许把 `runtimeConfig.mode``mock` 切为 `remote`,执行正式 H5 CORS、真实票据重放/限流和 MuMu Android 流程
3. 并行推进非交互风控的限时 POC 与文字/中继人工兜底合同;只有 POC、服务端原子消费和 `ANDROID-AUTH-ACCESSIBILITY-RELEASE` 全部通过,才可宣称认证达到上线门槛
4. 新图合同通过后,按规范化与校验、布局、Scene 与空间索引、单 Canvas、页面交互、接口回流的顺序实施 T01。
5. T01 完成后,再依次规划短信验证码、跨页面领域数据持久化、全局文字层级与无障碍第二轮,不混合阶段
5. 家谱工作区三人审查和失败合同已经完成;等待后端关闭 `API-GENEALOGY-WORKSPACE-001``003` 并提供同版本双导出。门禁通过后再测试先行实现唯一 adapter、G01 `onShow` 列表现场和 G05 `/overview` 读取,不提前固化字段或枚举
6. G03 原子创建三人审查和失败合同已经完成;等待后端关闭 `API-G03-001``005`、以同版本双导出交付 bootstrap POST、状态查询、地区选择与统一 accessPreset。通过前不接当前宽松 `createGenealogy`;通过后先实现严格 coordinator、无 PII 恢复 marker、地区选择器、context/G05/G01 闭环,再独立完成 MuMu 表单与无障碍矩阵。
7. M06 三人审查和失败合同已经完成;等待后端关闭 `API-M06-001``003` 并提供同版本双导出。通过后测试先行实现 list-only adapter、加载/空/失败/重试、动态分类、纯文本手风琴和无障碍语义,不接详情或文章 ID。
8. 个人资料读取三人审查和失败合同已经完成;等待后端关闭 `API-PROFILE-READ-001``003` 并提供同版本双导出。通过后测试先行实现唯一掩码 adapter 与 M01/M02/M03 局部状态,M05 当前手机号展示随同一只读 owner 原子迁移但不接换绑写接口。
9. 通知读取与已读写入已分别完成三人审查和失败合同;等待后端关闭 `API-NOTIFICATION-READ-001``003``API-NOTIFICATION-STATE-001``003`。读取通过后先实现无 ID 的内存快照和 M01/G01 未读数;写入另批迁移私有 ID、删除伪本地写并验证并发收敛,不恢复不可信目标 CTA。
10. M02 个人资料 PUT 已完成三人审查和失败合同;等待后端关闭 `API-PROFILE-UPDATE-001``004`。读取与写入门禁都通过后,按 normalizer、严格 API、M02 状态机和 MuMu 表单矩阵独立实施,不混头像或账号安全。
11. M10 服务端退出已完成三人审查和失败合同;等待后端关闭 `API-LOGOUT-001``003` 后,再测试先行实现 session epoch、唯一 logoutCoordinator、A01 一次性提示和两设备撤销矩阵。
12. M04 登录态改密与四条密码 wire 已完成三人审查和失败合同;等待后端关闭 `API-PASSWORD-001``005` 后,才原子迁移共享密码策略、MD5 调用、session marker、M04 状态机和全设备撤销矩阵。
13. M05 手机号换绑三人审查和失败合同已经完成;等待后端关闭 `API-PHONE-001``005`,且 M04 raw-password 与认证/TAC 前置门禁同时通过后,再原子迁移全活动 OTP、实现专用受保护发码、共享 credential marker 与 M05 状态机。
14. 继续审查下一个不依赖现有红灯的业务域;按 G/F/R 逐域推进。随后逐批完成文字层级与无障碍,不混合验证码、账号写入、领域数据或支付。
+295 -214
View File
@@ -11,20 +11,24 @@
/>
</view>
<view class="login-tabs">
<view
class="login-tab"
:class="{ active: activeLoginMethod === 'password' }"
<view class="login-tabs" role="tablist" aria-label="登录方式">
<button
class="auth-plain-button login-tab login-tab--unavailable"
role="tab"
:aria-selected="activeLoginMethod === 'password'"
aria-disabled="true"
hover-class="tap-fade"
@click="switchLoginMethod('password')"
>密码登录</view
>密码登录</button
>
<view
class="login-tab"
<button
class="auth-plain-button login-tab"
role="tab"
:aria-selected="activeLoginMethod === 'sms'"
:class="{ active: activeLoginMethod === 'sms' }"
hover-class="tap-fade"
@click="switchLoginMethod('sms')"
>验证码登录</view
>验证码登录</button
>
</view>
@@ -40,7 +44,9 @@
class="auth-input"
type="number"
maxlength="11"
:disabled="sendingCode || cooldownSeconds > 0 || submitting"
placeholder="手机号"
aria-label="手机号"
placeholder-class="input-placeholder"
confirm-type="next"
/>
@@ -57,13 +63,17 @@
class="auth-input"
:password="!passwordVisible"
maxlength="32"
:disabled="submitting"
placeholder="密码"
aria-label="登录密码"
placeholder-class="input-placeholder"
confirm-type="done"
@confirm="submitLogin"
/>
<view
class="password-toggle"
<button
class="auth-plain-button password-toggle"
:aria-label="passwordVisible ? '隐藏密码' : '显示密码'"
:aria-pressed="passwordVisible"
hover-class="tap-fade"
@click="togglePasswordVisibility"
>
@@ -75,8 +85,9 @@
: '/static/assets/modules/auth/transparent/a01-icon-eye-closed-pupil-v2.png'
"
mode="aspectFit"
aria-hidden="true"
/>
</view>
</button>
</view>
<view v-else class="input-row">
@@ -89,33 +100,38 @@
v-model.trim="verificationCode"
class="auth-input"
type="number"
maxlength="6"
maxlength="4"
:disabled="submitting"
placeholder="短信验证码"
aria-label="短信验证码"
placeholder-class="input-placeholder"
confirm-type="done"
@confirm="submitLogin"
/>
<view
class="get-code"
<button
class="auth-plain-button get-code"
:class="{ 'get-code--disabled': sendingCode || cooldownSeconds > 0 }"
:disabled="sendingCode || submitting || cooldownSeconds > 0"
hover-class="tap-fade"
@click="prepareGetCode"
>获取验证码</view
>{{ sendingCode ? "请求中…" : cooldownSeconds > 0 ? `${cooldownSeconds}s 后重发` : "获取验证码" }}</button
>
</view>
<view class="form-secondary-row">
<view
v-if="activeLoginMethod === 'password'"
class="forgot-password"
<button
class="auth-plain-button forgot-password"
hover-class="tap-fade"
@click="prepareForgotPassword"
>忘记密码</view
>忘记密码</button
>
</view>
</view>
<view
class="login-submit"
<button
class="auth-plain-button login-submit"
:disabled="submitting || sendingCode || tacVisible"
:aria-busy="submitting"
hover-class="button-pressed"
@click="submitLogin"
>
@@ -124,8 +140,8 @@
src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png"
mode="aspectFit"
/>
<text class="login-submit__copy">登录</text>
</view>
<text class="login-submit__copy">{{ submitting ? "登录中…" : "登录" }}</text>
</button>
<view class="other-login-divider">
<view class="divider-line" />
@@ -143,8 +159,9 @@
<view class="divider-line" />
</view>
<view
class="wechat-login"
<button
class="auth-plain-button wechat-login"
:disabled="submitting || sendingCode || tacVisible"
hover-class="button-pressed"
@click="prepareWechatLogin"
>
@@ -161,15 +178,16 @@
/>
<text>微信登录</text>
</view>
</view>
</button>
<view class="register-entry">
<text>还没有账号</text>
<view
class="register-link"
<button
class="auth-plain-button register-link"
:disabled="submitting || sendingCode || tacVisible"
hover-class="tap-fade"
@click="prepareRegister"
>注册账号</view
>注册账号</button
>
</view>
@@ -177,103 +195,110 @@
class="agreement-area"
:class="{ 'agreement-area--error': agreementError }"
>
<view class="agreement-row" @click="toggleAgreement">
<image
class="agreement-icon"
:src="
agreed
? '/static/assets/modules/auth/transparent/a02-agreement-checked.png'
: '/static/assets/modules/auth/transparent/a02-agreement-unchecked.png'
"
mode="aspectFit"
/>
<view class="agreement-row">
<button
class="auth-plain-button agreement-toggle"
role="checkbox"
:aria-checked="agreed"
:aria-label="agreed ? '取消同意用户协议与隐私政策' : '同意用户协议与隐私政策'"
:disabled="submitting || sendingCode || tacVisible"
@click="toggleAgreement"
>
<image
class="agreement-icon"
:src="
agreed
? '/static/assets/modules/auth/transparent/a02-agreement-checked.png'
: '/static/assets/modules/auth/transparent/a02-agreement-unchecked.png'
"
mode="aspectFit"
aria-hidden="true"
/>
</button>
<view class="agreement-copy">
<text>我已阅读并同意</text>
<text class="agreement-link" @click.stop="prepareAgreement"
>用户协议</text
<button class="auth-plain-button agreement-link" @click="prepareAgreement"
>用户协议</button
>
<text></text>
<text class="agreement-link" @click.stop="prepareAgreement"
>隐私政策</text
<button class="auth-plain-button agreement-link" @click="prepareAgreement"
>隐私政策</button
>
</view>
</view>
<text v-if="agreementError" class="agreement-error"
<text v-if="agreementError" class="agreement-error" role="alert"
>请先阅读并同意用户协议与隐私政策</text
>
</view>
</view>
<template #overlay>
<!-- 当前只验收自定义容器外观真实行为验证数据留到接口阶段接入 -->
<view
v-if="verificationVisible"
class="verification-layer"
@click="closeVerification"
>
<view class="verification-dialog" @click.stop>
<image
class="verification-dialog__skin"
src="/static/assets/modules/auth/transparent/a01-scroll-dialog-v3.png"
mode="aspectFit"
/>
<view class="verification-dialog__content">
<text class="verification-title">安全验证</text>
<text class="verification-copy"
>{{ verificationPurpose }}前需要完成行为验证</text
>
<text class="verification-note">验证数据将在接口接入后启用</text>
<view class="verification-actions">
<view
class="verification-action"
hover-class="tap-fade"
@click="closeVerification"
>取消</view
>
<view
class="verification-action verification-action--primary"
hover-class="tap-fade"
@click="confirmVerification"
>知道了</view
>
</view>
</view>
</view>
</view>
<TacVerification
:visible="tacVisible"
:context="tacContext"
@success="completeTac"
@failure="handleTacFailure"
@error="handleTacError"
@cancel="closeTac"
/>
<view v-if="feedbackVisible" class="feedback-toast">
<text class="feedback-toast__copy">{{ feedbackMessage }}</text>
</view>
<AppToast :visible="feedbackVisible" :message="feedbackMessage" />
</template>
</AuthPageShell>
</template>
<script setup>
import { ref } from "vue";
import { onLoad, onUnload } from "@dcloudio/uni-app";
import { onBackPress, onUnload } from "@dcloudio/uni-app";
import AuthPageShell from "@/components/AuthPageShell.vue";
import AppToast from "@/components/AppToast.vue";
import TacVerification from "@/components/TacVerification.vue";
import {
appApi,
createRequestController,
isRequestCancelled,
} from "@/utils/api.js";
import {
AUTH_TAC_SCENE,
PASSWORD_TAC_BLOCKED_MESSAGE,
createTacRenderContext,
isAuthPhone,
normalizeCaptchaRequirement,
normalizeTacSuccess,
} from "@/utils/auth-verification.js";
import { runtimeConfig } from "@/utils/config.js";
import {
goRoot,
handleBackPress,
openPage,
runBackGuard,
} from "@/utils/navigation.js";
const LOGIN_METHOD_STORAGE_KEY = "a01:last-login-method";
const activeLoginMethod = ref("password");
const activeLoginMethod = ref("sms");
const passwordVisible = ref(false);
const phone = ref("");
const password = ref("");
const verificationCode = ref("");
const agreed = ref(false);
const agreementError = ref(false);
const verificationVisible = ref(false);
const verificationPurpose = ref("登录");
const tacVisible = ref(false);
const tacContext = ref(null);
const sendingCode = ref(false);
const submitting = ref(false);
const cooldownSeconds = ref(0);
const feedbackVisible = ref(false);
const feedbackMessage = ref("");
let feedbackTimer = null;
onLoad(() => {
const storedMethod = uni.getStorageSync(LOGIN_METHOD_STORAGE_KEY);
if (storedMethod === "sms") activeLoginMethod.value = "sms";
});
let cooldownTimer = null;
let tacSequence = 0;
let pageActive = true;
const authRequestController = createRequestController();
onUnload(() => {
pageActive = false;
authRequestController.abort();
if (feedbackTimer) clearTimeout(feedbackTimer);
if (cooldownTimer) clearInterval(cooldownTimer);
});
const showFeedback = (message) => {
@@ -286,10 +311,19 @@ const showFeedback = (message) => {
}, 2200);
};
const blockBusyAction = () => {
if (!sendingCode.value && !submitting.value) return false;
showFeedback("请求处理中,请稍候");
return true;
};
const switchLoginMethod = (method) => {
if (method !== "password" && method !== "sms") return;
activeLoginMethod.value = method;
uni.setStorageSync(LOGIN_METHOD_STORAGE_KEY, method);
if (blockBusyAction()) return;
if (method === "password") {
showFeedback(PASSWORD_TAC_BLOCKED_MESSAGE);
return;
}
if (method === "sms") activeLoginMethod.value = method;
};
const togglePasswordVisibility = () => {
@@ -302,7 +336,7 @@ const toggleAgreement = () => {
};
const validatePhone = () => {
if (/^1\d{10}$/.test(phone.value)) return true;
if (isAuthPhone(phone.value)) return true;
showFeedback("请输入正确的手机号");
return false;
};
@@ -313,26 +347,124 @@ const requireAgreement = () => {
return false;
};
const openVerification = (purpose) => {
verificationPurpose.value = purpose;
verificationVisible.value = true;
const closeTac = () => {
tacVisible.value = false;
tacContext.value = null;
};
const closeVerification = () => {
verificationVisible.value = false;
const cancelPendingRequest = () => {
authRequestController.abort();
sendingCode.value = false;
submitting.value = false;
};
const confirmVerification = () => {
closeVerification();
showFeedback("行为验证接口待接入");
const requestBack = () =>
runBackGuard({
transientOpen: tacVisible.value,
submitting: submitting.value || sendingCode.value,
"close-transient": closeTac,
"block-submitting": () => {
cancelPendingRequest();
return true;
},
});
// A01 是认证根页:没有浮层时必须把系统返回交还 Android,只在行为验证浮层
// 可见时消费返回键,避免根页被守卫误拦而无法正常退出应用。
onBackPress((event) => {
if (!tacVisible.value && (submitting.value || sendingCode.value)) {
cancelPendingRequest();
return false;
}
if (!tacVisible.value) return false;
return handleBackPress(event, requestBack);
});
const startCooldown = () => {
cooldownSeconds.value = 60;
if (cooldownTimer) clearInterval(cooldownTimer);
cooldownTimer = setInterval(() => {
cooldownSeconds.value -= 1;
if (cooldownSeconds.value <= 0) {
clearInterval(cooldownTimer);
cooldownTimer = null;
}
}, 1000);
};
const prepareGetCode = () => {
const prepareGetCode = async () => {
if (sendingCode.value || cooldownSeconds.value > 0) return;
if (!validatePhone() || !requireAgreement()) return;
openVerification("发送验证码");
sendingCode.value = true;
try {
const sceneCode = AUTH_TAC_SCENE.SMS_LOGIN;
const requestedPhone = phone.value;
const response = await appApi.getCaptchaRequirement(
{ sceneCode, subject: requestedPhone },
{ requestController: authRequestController },
);
if (!pageActive) return;
if (phone.value !== requestedPhone) throw new Error("手机号已变化,请重新获取验证码");
const requirement = normalizeCaptchaRequirement(response, sceneCode);
tacSequence += 1;
tacContext.value = createTacRenderContext({
requestId: `a01-sms-${tacSequence}`,
baseUrl: runtimeConfig.baseUrl,
clientId: runtimeConfig.clientId,
tenantId: runtimeConfig.tenantId,
sceneCode,
subject: requestedPhone,
requirement,
});
tacVisible.value = true;
} catch (error) {
if (pageActive && !isRequestCancelled(error)) {
showFeedback(error.message || "安全验证暂不可用");
}
} finally {
if (pageActive) sendingCode.value = false;
}
};
const submitLogin = () => {
const completeTac = async (result) => {
const expectedContext = tacContext.value;
if (!expectedContext) return;
try {
const ticket = normalizeTacSuccess(result, expectedContext.requestId);
if (phone.value !== expectedContext.subject) throw new Error("手机号已变化,请重新验证");
closeTac();
sendingCode.value = true;
await appApi.sendSmsCode(
{
sceneCode: AUTH_TAC_SCENE.SMS_LOGIN,
phone: expectedContext.subject,
validToken: ticket.validToken,
},
{ requestController: authRequestController },
);
if (!pageActive) return;
startCooldown();
showFeedback("验证码已发送");
} catch (error) {
closeTac();
if (pageActive && !isRequestCancelled(error)) {
showFeedback(error.message || "验证码发送失败");
}
} finally {
if (pageActive) sendingCode.value = false;
}
};
const handleTacFailure = ({ message } = {}) =>
showFeedback(message || "行为验证未通过,请重试");
const handleTacError = ({ message } = {}) => {
closeTac();
showFeedback(message || "安全验证暂不可用");
};
const submitLogin = async () => {
if (submitting.value) return;
if (!validatePhone()) return;
if (activeLoginMethod.value === "password" && !password.value) {
showFeedback("请输入密码");
@@ -340,19 +472,46 @@ const submitLogin = () => {
}
if (
activeLoginMethod.value === "sms" &&
!/^\d{6}$/.test(verificationCode.value)
!/^\d{4}$/.test(verificationCode.value)
) {
showFeedback("请输入 6 位验证码");
showFeedback("请输入 4 位验证码");
return;
}
if (!requireAgreement()) return;
openVerification("登录");
if (activeLoginMethod.value === "password") {
// 受保护源合同明确禁止密码登录携带 TAC 票据。仅在客户端先滑动仍可被
// 绕过,因此此入口必须失败关闭;短信登录已经具备 TAC→短信票据闭环。
showFeedback(PASSWORD_TAC_BLOCKED_MESSAGE);
return;
}
submitting.value = true;
try {
await appApi.loginWithSms(
{
phone: phone.value,
smsCode: verificationCode.value,
},
{ requestController: authRequestController },
);
if (!pageActive) return;
await goRoot("G01");
} catch (error) {
if (pageActive && !isRequestCancelled(error)) {
showFeedback(error.message || "登录失败,请稍后重试");
}
} finally {
if (pageActive) submitting.value = false;
}
};
const prepareForgotPassword = () =>
uni.navigateTo({ url: "/pages/auth/a05-reset-password" });
const prepareRegister = () =>
uni.navigateTo({ url: "/pages/auth/a04-register" });
const prepareForgotPassword = () => {
if (blockBusyAction()) return;
return openPage("A05", {}, "A01");
};
const prepareRegister = () => {
if (blockBusyAction()) return;
return openPage("A04", {}, "A01");
};
const prepareWechatLogin = () => {
if (!requireAgreement()) return;
@@ -363,7 +522,6 @@ const prepareAgreement = () => showFeedback("协议页面准备中");
</script>
<style scoped lang="scss">
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
.login-content {
display: flex;
@@ -498,6 +656,14 @@ const prepareAgreement = () => showFeedback("协议页面准备中");
font-size: 28rpx;
}
.login-tab--unavailable {
color: #9f968d;
}
.get-code--disabled {
color: #9f968d;
}
.form-secondary-row {
display: flex;
align-items: center;
@@ -623,7 +789,17 @@ const prepareAgreement = () => showFeedback("协议页面准备中");
flex: 0 0 auto;
width: 34rpx;
height: 34rpx;
margin-right: 10rpx;
}
.agreement-toggle {
display: inline-flex;
flex: 0 0 auto;
align-items: center;
justify-content: center;
width: var(--app-touch-min);
min-width: var(--app-touch-min);
min-height: var(--app-touch-min);
margin-right: 2rpx;
}
.agreement-copy {
@@ -634,6 +810,9 @@ const prepareAgreement = () => showFeedback("协议页面准备中");
}
.agreement-link {
display: inline-flex;
align-items: center;
min-height: var(--app-touch-min);
color: #a9160d;
}
@@ -669,102 +848,4 @@ const prepareAgreement = () => showFeedback("协议页面准备中");
opacity: 0.82;
}
.feedback-toast {
position: fixed;
z-index: 30;
top: calc(var(--status-bar-height, 0px) + 24rpx);
left: 50%;
display: flex;
align-items: center;
justify-content: center;
@include adaptive.adaptive-feedback-toast;
width: 590rpx;
min-height: 82rpx;
background: transparent;
transform: translateX(-50%);
}
.feedback-toast__copy {
z-index: 1;
padding: 16rpx 36rpx;
color: #5c4330;
font-size: 25rpx;
text-align: center;
}
.verification-layer {
position: fixed;
z-index: 40;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
padding: 40rpx;
background: rgba(31, 20, 13, 0.56);
}
.verification-dialog {
display: grid;
width: 620rpx;
min-height: 520rpx;
max-height: calc(100vh - 80rpx);
}
.verification-dialog__skin {
grid-area: 1 / 1;
width: 100%;
height: 100%;
}
.verification-dialog__content {
z-index: 1;
display: flex;
grid-area: 1 / 1;
flex-direction: column;
align-items: center;
box-sizing: border-box;
min-height: 100%;
overflow-y: auto;
padding: 90rpx 64rpx 54rpx;
}
.verification-title {
color: #6f140f;
font-size: 42rpx;
font-weight: 700;
}
.verification-copy {
margin-top: 42rpx;
color: #493323;
font-size: 28rpx;
text-align: center;
}
.verification-note {
margin-top: 20rpx;
color: #8d7a68;
font-size: 23rpx;
}
.verification-actions {
display: flex;
width: 100%;
margin-top: auto;
}
.verification-action {
display: flex;
flex: 1;
align-items: center;
justify-content: center;
min-height: 88rpx;
color: #745b46;
font-size: 28rpx;
}
.verification-action--primary {
color: #a9160d;
font-weight: 700;
}
</style>
+342 -72
View File
@@ -3,13 +3,19 @@
<AuthPageShell class="auth-page register-page">
<view class="register-content">
<view class="page-heading">
<view class="back-button" hover-class="tap-fade" @click="goBack">
<button
class="auth-plain-button back-button"
aria-label="返回登录"
hover-class="tap-fade"
@click="requestBack"
>
<image
class="back-button__icon"
src="/static/assets/foundation/transparent/chevron-right.png"
mode="aspectFit"
aria-hidden="true"
/>
</view>
</button>
<text class="page-title">注册账号</text>
<text class="page-subtitle">创建属于你的家谱账号</text>
<image
@@ -25,39 +31,80 @@
:class="{ 'field-block--error': fieldErrors.phone }"
>
<view class="input-row">
<text class="input-label">手机号</text>
<label class="input-label" for="a04-phone">手机号</label>
<input
id="a04-phone"
v-model.trim="phone"
class="auth-input"
type="number"
maxlength="11"
:disabled="sendingCode || cooldownSeconds > 0 || submitting"
placeholder="请输入手机号"
placeholder-class="placeholder"
:aria-invalid="Boolean(fieldErrors.phone)"
:aria-describedby="fieldErrors.phone ? 'a04-phone-error' : undefined"
@input="clearFieldError('phone')"
/>
</view>
<text v-if="fieldErrors.phone" class="field-error">{{
<text v-if="fieldErrors.phone" id="a04-phone-error" class="field-error" role="alert">{{
fieldErrors.phone
}}</text>
</view>
<view
class="field-block"
:class="{ 'field-block--error': fieldErrors.verificationCode }"
>
<view class="input-row code-row">
<label class="input-label" for="a04-verification-code">验证码</label>
<input
id="a04-verification-code"
v-model.trim="verificationCode"
class="auth-input"
type="number"
maxlength="4"
:disabled="submitting"
placeholder="请输入验证码"
placeholder-class="placeholder"
:aria-invalid="Boolean(fieldErrors.verificationCode)"
:aria-describedby="fieldErrors.verificationCode ? 'a04-verification-code-error' : undefined"
@input="clearFieldError('verificationCode')"
/>
<button
class="auth-plain-button get-code"
:class="{ 'get-code--disabled': sendingCode || cooldownSeconds > 0 }"
:disabled="sendingCode || submitting || cooldownSeconds > 0"
hover-class="tap-fade"
@click="prepareGetCode"
>{{ sendingCode ? "请求中…" : cooldownSeconds > 0 ? `${cooldownSeconds}s 后重发` : "获取验证码" }}</button
>
</view>
<text v-if="fieldErrors.verificationCode" id="a04-verification-code-error" class="field-error" role="alert">{{
fieldErrors.verificationCode
}}</text>
</view>
<view
class="field-block"
:class="{ 'field-block--error': fieldErrors.password }"
>
<view class="input-row">
<text class="input-label">设置密码</text>
<label class="input-label" for="a04-password">设置密码</label>
<input
id="a04-password"
v-model="password"
class="auth-input"
password
maxlength="32"
:disabled="submitting"
placeholder="请设置登录密码"
placeholder-class="placeholder"
:aria-invalid="Boolean(fieldErrors.password)"
:aria-describedby="fieldErrors.password ? 'a04-password-error' : undefined"
@input="clearFieldError('password')"
/>
</view>
<text v-if="fieldErrors.password" class="field-error">{{
<text v-if="fieldErrors.password" id="a04-password-error" class="field-error" role="alert">{{
fieldErrors.password
}}</text>
</view>
@@ -67,25 +114,31 @@
:class="{ 'field-block--error': fieldErrors.confirmPassword }"
>
<view class="input-row">
<text class="input-label">确认密码</text>
<label class="input-label" for="a04-confirm-password">确认密码</label>
<input
id="a04-confirm-password"
v-model="confirmPassword"
class="auth-input"
password
maxlength="32"
:disabled="submitting"
placeholder="请再次输入密码"
placeholder-class="placeholder"
:aria-invalid="Boolean(fieldErrors.confirmPassword)"
:aria-describedby="fieldErrors.confirmPassword ? 'a04-confirm-password-error' : undefined"
@input="clearFieldError('confirmPassword')"
/>
</view>
<text v-if="fieldErrors.confirmPassword" class="field-error">{{
<text v-if="fieldErrors.confirmPassword" id="a04-confirm-password-error" class="field-error" role="alert">{{
fieldErrors.confirmPassword
}}</text>
</view>
</view>
<view
class="register-submit"
<button
class="auth-plain-button register-submit"
:disabled="submitting || sendingCode || tacVisible"
:aria-busy="submitting"
hover-class="button-hover"
@click="submitRegister"
>
@@ -94,91 +147,189 @@
src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png"
mode="aspectFit"
/>
<text class="register-submit__content">注册账号</text>
</view>
<text class="register-submit__content">{{ submitting ? "注册中…" : "注册账号" }}</text>
</button>
<view
class="agreement-area"
:class="{ 'agreement-area--error': agreementError }"
>
<view class="agreement-row" @click="toggleAgreement">
<image
class="agreement-icon"
:src="
agreed
? '/static/assets/modules/auth/transparent/a02-agreement-checked.png'
: '/static/assets/modules/auth/transparent/a02-agreement-unchecked.png'
"
mode="aspectFit"
/>
<view class="agreement-row">
<button
class="auth-plain-button agreement-toggle"
role="checkbox"
:aria-checked="agreed"
:aria-label="agreed ? '取消同意用户协议与隐私政策' : '同意用户协议与隐私政策'"
:disabled="sendingCode || submitting || tacVisible"
@click="toggleAgreement"
>
<image
class="agreement-icon"
:src="
agreed
? '/static/assets/modules/auth/transparent/a02-agreement-checked.png'
: '/static/assets/modules/auth/transparent/a02-agreement-unchecked.png'
"
mode="aspectFit"
aria-hidden="true"
/>
</button>
<view class="agreement-copy">
<text>我已阅读并同意</text>
<text class="agreement-link" @click.stop="prepareAgreement"
>用户协议</text
<button class="auth-plain-button agreement-link" @click="prepareAgreement"
>用户协议</button
>
<text></text>
<text class="agreement-link" @click.stop="prepareAgreement"
>隐私政策</text
<button class="auth-plain-button agreement-link" @click="prepareAgreement"
>隐私政策</button
>
</view>
</view>
<text v-if="agreementError" class="agreement-error"
<text v-if="agreementError" class="agreement-error" role="alert"
>请先阅读并同意用户协议与隐私政策</text
>
</view>
<view class="login-entry">
<text>已有账号</text>
<view
class="login-entry__link"
<button
class="auth-plain-button login-entry__link"
:disabled="submitting || sendingCode || tacVisible"
hover-class="tap-fade"
@click="prepareLogin"
>登录</view
@click="requestBack"
>登录</button
>
</view>
</view>
<template #overlay>
<view v-if="feedbackVisible" class="feedback-toast">
<text class="feedback-toast__copy">{{ feedbackMessage }}</text>
</view>
<TacVerification
:visible="tacVisible"
:context="tacContext"
@success="completeTac"
@failure="handleTacFailure"
@error="handleTacError"
@cancel="closeTac"
/>
<AppDialog
:visible="discardVisible"
title="放弃注册?"
message="当前填写内容尚未保存,确认返回后将清空。"
confirm-text="放弃并返回"
cancel-text="继续填写"
show-cancel
compact-actions
:close-on-mask="false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
<AppToast :visible="feedbackVisible" :message="feedbackMessage" />
</template>
</AuthPageShell>
</template>
<script setup>
import { ref } from "vue";
import { onUnload } from "@dcloudio/uni-app";
import { computed, ref } from "vue";
import { onBackPress, onUnload } from "@dcloudio/uni-app";
import AppDialog from "@/components/AppDialog.vue";
import AppToast from "@/components/AppToast.vue";
import AuthPageShell from "@/components/AuthPageShell.vue";
import TacVerification from "@/components/TacVerification.vue";
import {
appApi,
createRequestController,
isRequestCancelled,
} from "@/utils/api.js";
import {
AUTH_TAC_SCENE,
createTacRenderContext,
isAuthPhone,
normalizeCaptchaRequirement,
normalizeTacSuccess,
} from "@/utils/auth-verification.js";
import { runtimeConfig } from "@/utils/config.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import { calcMD5 } from "@/utils/md5.js";
import { goRoot, handleBackPress, runBackGuard } from "@/utils/navigation.js";
import {
PASSWORD_POLICY_MESSAGE,
validatePassword,
} from "@/utils/validation.js";
const phone = ref("");
const verificationCode = ref("");
const password = ref("");
const confirmPassword = ref("");
const agreed = ref(false);
const agreementError = ref(false);
const fieldErrors = ref({
phone: "",
verificationCode: "",
password: "",
confirmPassword: "",
});
const feedbackVisible = ref(false);
const feedbackMessage = ref("");
const discardVisible = ref(false);
const tacVisible = ref(false);
const tacContext = ref(null);
const sendingCode = ref(false);
const submitting = ref(false);
const cooldownSeconds = ref(0);
const isDirty = computed(() =>
Boolean(
phone.value ||
verificationCode.value ||
password.value ||
confirmPassword.value ||
agreed.value,
),
);
let feedbackTimer = null;
onUnload(() => {
if (feedbackTimer) clearTimeout(feedbackTimer);
let cooldownTimer = null;
let tacSequence = 0;
let pageActive = true;
const authRequestController = createRequestController();
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const goBack = () => {
uni.navigateBack();
const closeTac = () => {
tacVisible.value = false;
tacContext.value = null;
};
// “已有账号”用于退出注册流程,替换当前页可避免登录/注册页面反复叠加。
const prepareLogin = () => uni.redirectTo({ url: "/pages/auth/a01-entry" });
const cancelPendingRequest = () => {
authRequestController.abort();
sendingCode.value = false;
submitting.value = false;
};
const requestBack = () =>
runBackGuard({
transientOpen: tacVisible.value || discardVisible.value,
submitting: submitting.value || sendingCode.value,
dirty: isDirty.value,
"close-transient": tacVisible.value ? closeTac : cancelDiscard,
"block-submitting": () => {
cancelPendingRequest();
return requestBack();
},
"confirm-discard": requestDiscardConfirmation,
});
onBackPress((event) => handleBackPress(event, requestBack));
onUnload(() => {
pageActive = false;
authRequestController.abort();
if (feedbackTimer) clearTimeout(feedbackTimer);
if (cooldownTimer) clearInterval(cooldownTimer);
discardConfirmation.dispose();
});
const showFeedback = (message) => {
feedbackMessage.value = message;
@@ -193,6 +344,7 @@ const showFeedback = (message) => {
const prepareAgreement = () => showFeedback("协议页面准备中");
const toggleAgreement = () => {
if (sendingCode.value || submitting.value) return;
agreed.value = !agreed.value;
if (agreed.value) agreementError.value = false;
};
@@ -201,9 +353,107 @@ const clearFieldError = (field) => {
fieldErrors.value[field] = "";
};
const startCooldown = () => {
cooldownSeconds.value = 60;
if (cooldownTimer) clearInterval(cooldownTimer);
cooldownTimer = setInterval(() => {
cooldownSeconds.value -= 1;
if (cooldownSeconds.value <= 0) {
clearInterval(cooldownTimer);
cooldownTimer = null;
}
}, 1000);
};
const prepareGetCode = async () => {
if (sendingCode.value || submitting.value || cooldownSeconds.value > 0) return;
if (!isAuthPhone(phone.value)) {
fieldErrors.value.phone = "请输入正确手机号";
return;
}
fieldErrors.value.phone = "";
if (!agreed.value) {
agreementError.value = true;
return;
}
sendingCode.value = true;
try {
const sceneCode = AUTH_TAC_SCENE.REGISTER;
const requestedPhone = phone.value;
const response = await appApi.getCaptchaRequirement(
{ sceneCode, subject: requestedPhone },
{ requestController: authRequestController },
);
if (!pageActive) return;
if (phone.value !== requestedPhone) throw new Error("手机号已变化,请重新获取验证码");
const requirement = normalizeCaptchaRequirement(response, sceneCode);
tacSequence += 1;
tacContext.value = createTacRenderContext({
requestId: `a04-register-${tacSequence}`,
baseUrl: runtimeConfig.baseUrl,
clientId: runtimeConfig.clientId,
tenantId: runtimeConfig.tenantId,
sceneCode,
subject: requestedPhone,
requirement,
});
tacVisible.value = true;
} catch (error) {
if (pageActive && !isRequestCancelled(error)) {
showFeedback(error.message || "安全验证暂不可用");
}
} finally {
if (pageActive) sendingCode.value = false;
}
};
const completeTac = async (result) => {
const expectedContext = tacContext.value;
if (!expectedContext) return;
try {
const ticket = normalizeTacSuccess(result, expectedContext.requestId);
if (phone.value !== expectedContext.subject) throw new Error("手机号已变化,请重新验证");
closeTac();
sendingCode.value = true;
await appApi.sendSmsCode(
{
sceneCode: AUTH_TAC_SCENE.REGISTER,
phone: expectedContext.subject,
validToken: ticket.validToken,
},
{ requestController: authRequestController },
);
if (!pageActive) return;
startCooldown();
showFeedback("验证码已发送");
} catch (error) {
closeTac();
if (pageActive && !isRequestCancelled(error)) {
showFeedback(error.message || "验证码发送失败");
}
} finally {
if (pageActive) sendingCode.value = false;
}
};
const handleTacFailure = ({ message } = {}) =>
showFeedback(message || "行为验证未通过,请重试");
const handleTacError = ({ message } = {}) => {
closeTac();
showFeedback(message || "安全验证暂不可用");
};
const validateForm = () => {
const nextErrors = { phone: "", password: "", confirmPassword: "" };
if (!/^1\d{10}$/.test(phone.value)) nextErrors.phone = "请输入正确手机号";
const nextErrors = {
phone: "",
verificationCode: "",
password: "",
confirmPassword: "",
};
if (!isAuthPhone(phone.value)) nextErrors.phone = "请输入正确手机号";
if (!/^\d{4}$/.test(verificationCode.value))
nextErrors.verificationCode = "请输入 4 位验证码";
const passwordResult = validatePassword(password.value);
if (!passwordResult.valid) nextErrors.password = PASSWORD_POLICY_MESSAGE;
if (!confirmPassword.value) nextErrors.confirmPassword = "请再次输入密码";
@@ -213,17 +463,34 @@ const validateForm = () => {
return !Object.values(nextErrors).some(Boolean);
};
const submitRegister = () => {
const submitRegister = async () => {
if (submitting.value || sendingCode.value) return;
const formValid = validateForm();
if (!agreed.value) agreementError.value = true;
if (!formValid || !agreed.value) return;
// 真实滑动验证由接口阶段的组件自带样式接管,本页不保留自定义假面板。
showFeedback("滑动验证待接口接入");
submitting.value = true;
try {
await appApi.registerWithPassword(
{
phone: phone.value,
passwordHash: calcMD5(password.value),
smsCode: verificationCode.value,
},
{ requestController: authRequestController },
);
if (!pageActive) return;
await goRoot("G01");
} catch (error) {
if (pageActive && !isRequestCancelled(error)) {
showFeedback(error.message || "注册失败,请稍后重试");
}
} finally {
if (pageActive) submitting.value = false;
}
};
</script>
<style scoped lang="scss">
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
.register-content {
display: flex;
@@ -320,6 +587,18 @@ const submitRegister = () => {
font-size: 30rpx;
}
.get-code {
flex: 0 0 auto;
padding-left: 14rpx;
border-left: 1rpx solid #d7bd94;
color: #a7160c;
font-size: 26rpx;
}
.get-code--disabled {
color: #9f968d;
}
.placeholder {
color: #9f968d;
}
@@ -380,7 +659,17 @@ const submitRegister = () => {
flex: 0 0 auto;
width: 34rpx;
height: 34rpx;
margin-right: 10rpx;
}
.agreement-toggle {
display: inline-flex;
flex: 0 0 auto;
align-items: center;
justify-content: center;
width: var(--app-touch-min);
min-width: var(--app-touch-min);
min-height: var(--app-touch-min);
margin-right: 2rpx;
}
.agreement-copy {
@@ -389,6 +678,9 @@ const submitRegister = () => {
}
.agreement-link {
display: inline-flex;
align-items: center;
min-height: var(--app-touch-min);
color: #a7160c;
}
.agreement-error {
@@ -437,26 +729,4 @@ const submitRegister = () => {
opacity: 0.84;
}
.feedback-toast {
position: fixed;
z-index: 30;
top: calc(var(--status-bar-height, 0px) + 24rpx);
left: 50%;
display: flex;
align-items: center;
justify-content: center;
@include adaptive.adaptive-feedback-toast;
width: 590rpx;
min-height: 82rpx;
background: transparent;
transform: translateX(-50%);
}
.feedback-toast__copy {
z-index: 1;
padding: 16rpx 36rpx;
color: #5c4330;
font-size: 25rpx;
text-align: center;
}
</style>
+281 -157
View File
@@ -3,13 +3,19 @@
<AuthPageShell class="auth-page reset-page">
<view class="reset-content">
<view class="page-heading">
<view class="back-button" hover-class="tap-fade" @click="goBack">
<button
class="auth-plain-button back-button"
aria-label="返回登录"
hover-class="tap-fade"
@click="requestBack"
>
<image
class="back-button__icon"
src="/static/assets/foundation/transparent/chevron-right.png"
mode="aspectFit"
aria-hidden="true"
/>
</view>
</button>
<text class="page-title">重设密码</text>
<text class="page-subtitle">验证手机号后设置新的登录密码</text>
<image
@@ -25,18 +31,22 @@
:class="{ 'field-block--error': fieldErrors.phone }"
>
<view class="input-row">
<text class="input-label">手机号</text>
<label class="input-label" for="a05-phone">手机号</label>
<input
id="a05-phone"
v-model.trim="phone"
class="auth-input"
type="number"
maxlength="11"
:disabled="sendingCode || cooldownSeconds > 0 || submitting"
placeholder="请输入手机号"
placeholder-class="placeholder"
:aria-invalid="Boolean(fieldErrors.phone)"
:aria-describedby="fieldErrors.phone ? 'a05-phone-error' : undefined"
@input="clearFieldError('phone')"
/>
</view>
<text v-if="fieldErrors.phone" class="field-error">{{
<text v-if="fieldErrors.phone" id="a05-phone-error" class="field-error" role="alert">{{
fieldErrors.phone
}}</text>
</view>
@@ -46,24 +56,30 @@
:class="{ 'field-block--error': fieldErrors.verificationCode }"
>
<view class="input-row code-row">
<text class="input-label">验证码</text>
<label class="input-label" for="a05-verification-code">验证码</label>
<input
id="a05-verification-code"
v-model.trim="verificationCode"
class="auth-input"
type="number"
maxlength="6"
maxlength="4"
:disabled="submitting"
placeholder="请输入验证码"
placeholder-class="placeholder"
:aria-invalid="Boolean(fieldErrors.verificationCode)"
:aria-describedby="fieldErrors.verificationCode ? 'a05-verification-code-error' : undefined"
@input="clearFieldError('verificationCode')"
/>
<view
class="get-code"
<button
class="auth-plain-button get-code"
:class="{ 'get-code--disabled': sendingCode || cooldownSeconds > 0 }"
:disabled="sendingCode || submitting || cooldownSeconds > 0"
hover-class="tap-fade"
@click="prepareGetCode"
>获取验证码</view
>{{ sendingCode ? "请求中…" : cooldownSeconds > 0 ? `${cooldownSeconds}s 后重发` : "获取验证码" }}</button
>
</view>
<text v-if="fieldErrors.verificationCode" class="field-error">{{
<text v-if="fieldErrors.verificationCode" id="a05-verification-code-error" class="field-error" role="alert">{{
fieldErrors.verificationCode
}}</text>
</view>
@@ -73,18 +89,22 @@
:class="{ 'field-block--error': fieldErrors.password }"
>
<view class="input-row">
<text class="input-label">新密码</text>
<label class="input-label" for="a05-password">新密码</label>
<input
id="a05-password"
v-model="password"
class="auth-input"
password
maxlength="32"
:disabled="submitting"
placeholder="请设置新密码"
placeholder-class="placeholder"
:aria-invalid="Boolean(fieldErrors.password)"
:aria-describedby="fieldErrors.password ? 'a05-password-error' : undefined"
@input="clearFieldError('password')"
/>
</view>
<text v-if="fieldErrors.password" class="field-error">{{
<text v-if="fieldErrors.password" id="a05-password-error" class="field-error" role="alert">{{
fieldErrors.password
}}</text>
</view>
@@ -94,25 +114,31 @@
:class="{ 'field-block--error': fieldErrors.confirmPassword }"
>
<view class="input-row">
<text class="input-label">确认新密码</text>
<label class="input-label" for="a05-confirm-password">确认新密码</label>
<input
id="a05-confirm-password"
v-model="confirmPassword"
class="auth-input"
password
maxlength="32"
:disabled="submitting"
placeholder="请再次输入新密码"
placeholder-class="placeholder"
:aria-invalid="Boolean(fieldErrors.confirmPassword)"
:aria-describedby="fieldErrors.confirmPassword ? 'a05-confirm-password-error' : undefined"
@input="clearFieldError('confirmPassword')"
/>
</view>
<text v-if="fieldErrors.confirmPassword" class="field-error">{{
<text v-if="fieldErrors.confirmPassword" id="a05-confirm-password-error" class="field-error" role="alert">{{
fieldErrors.confirmPassword
}}</text>
</view>
</view>
<view
class="reset-submit"
<button
class="auth-plain-button reset-submit"
:disabled="submitting || sendingCode || tacVisible"
:aria-busy="submitting"
hover-class="button-hover"
@click="submitReset"
>
@@ -121,64 +147,92 @@
src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png"
mode="aspectFit"
/>
<text class="reset-submit__content">确认重设</text>
</view>
<text class="reset-submit__content">{{ submitting ? "提交中…" : "确认重设" }}</text>
</button>
<text class="reset-tip">重设成功后请使用新密码登录</text>
<view class="login-entry">
<text>想起密码了</text>
<view
class="login-entry__link"
<button
class="auth-plain-button login-entry__link"
:disabled="submitting || sendingCode || tacVisible"
hover-class="tap-fade"
@click="prepareLogin"
>返回登录</view
@click="requestBack"
>返回登录</button
>
</view>
</view>
<template #overlay>
<view v-if="successVisible" class="success-layer">
<view class="success-dialog">
<image
class="success-dialog__skin"
src="/static/assets/modules/auth/transparent/a01-scroll-dialog-v3.png"
mode="aspectFit"
/>
<view class="success-dialog__content">
<image
class="success-mark"
src="/static/assets/foundation/transparent/brand-seal.png"
mode="aspectFit"
/>
<text class="success-title">密码已重设</text>
<text class="success-copy">请返回登录页使用新密码登录</text>
<view
class="success-action"
hover-class="button-hover"
@click="prepareLogin"
>
<image
class="success-action__skin"
src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png"
mode="aspectFit"
/>
<text class="success-action__copy">返回登录</text>
</view>
</view>
</view>
</view>
<TacVerification
:visible="tacVisible"
:context="tacContext"
@success="completeTac"
@failure="handleTacFailure"
@error="handleTacError"
@cancel="closeTac"
/>
<AppDialog
:visible="discardVisible"
title="放弃重设密码?"
message="当前填写内容尚未保存,确认返回后将清空。"
confirm-text="放弃并返回"
cancel-text="继续填写"
show-cancel
compact-actions
:close-on-mask="false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
<view v-if="feedbackVisible" class="feedback-toast">
<text class="feedback-toast__copy">{{ feedbackMessage }}</text>
</view>
<AppDialog
:visible="successVisible"
title="密码已重设"
message="请返回登录页,使用新密码登录"
confirm-text="返回登录"
:close-on-mask="false"
@confirm="leaveResetSuccess"
>
<image
class="success-mark"
src="/static/assets/foundation/transparent/brand-seal.png"
mode="aspectFit"
aria-hidden="true"
/>
</AppDialog>
<AppToast :visible="feedbackVisible" :message="feedbackMessage" />
</template>
</AuthPageShell>
</template>
<script setup>
import { ref } from "vue";
import { onUnload } from "@dcloudio/uni-app";
import { computed, ref } from "vue";
import { onBackPress, onUnload } from "@dcloudio/uni-app";
import AppDialog from "@/components/AppDialog.vue";
import AppToast from "@/components/AppToast.vue";
import AuthPageShell from "@/components/AuthPageShell.vue";
import TacVerification from "@/components/TacVerification.vue";
import {
appApi,
createRequestController,
isRequestCancelled,
} from "@/utils/api.js";
import {
AUTH_TAC_SCENE,
createTacRenderContext,
isAuthPhone,
normalizeCaptchaRequirement,
normalizeTacSuccess,
} from "@/utils/auth-verification.js";
import { runtimeConfig } from "@/utils/config.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import { calcMD5 } from "@/utils/md5.js";
import {
handleBackPress,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
import {
PASSWORD_POLICY_MESSAGE,
validatePassword,
@@ -191,23 +245,78 @@ const confirmPassword = ref("");
const successVisible = ref(false);
const feedbackVisible = ref(false);
const feedbackMessage = ref("");
const discardVisible = ref(false);
const tacVisible = ref(false);
const tacContext = ref(null);
const sendingCode = ref(false);
const submitting = ref(false);
const cooldownSeconds = ref(0);
const fieldErrors = ref({
phone: "",
verificationCode: "",
password: "",
confirmPassword: "",
});
const isDirty = computed(() =>
!successVisible.value &&
Boolean(
phone.value ||
verificationCode.value ||
password.value ||
confirmPassword.value,
),
);
let feedbackTimer = null;
let cooldownTimer = null;
let tacSequence = 0;
let pageActive = true;
const authRequestController = createRequestController();
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
// 重设成功不产生可跨页消费的数据;只有远端 PUT 已成功后才显示该终态。
const leaveResetSuccess = () => returnTo("A01", {});
const closeTac = () => {
tacVisible.value = false;
tacContext.value = null;
};
const cancelPendingRequest = () => {
authRequestController.abort();
sendingCode.value = false;
submitting.value = false;
};
const requestBack = () => {
if (successVisible.value) return leaveResetSuccess();
return runBackGuard({
transientOpen: tacVisible.value || discardVisible.value,
submitting: submitting.value || sendingCode.value,
dirty: isDirty.value,
"close-transient": tacVisible.value ? closeTac : cancelDiscard,
"block-submitting": () => {
cancelPendingRequest();
return requestBack();
},
"confirm-discard": requestDiscardConfirmation,
});
};
onBackPress((event) => handleBackPress(event, requestBack));
onUnload(() => {
pageActive = false;
authRequestController.abort();
if (feedbackTimer) clearTimeout(feedbackTimer);
if (cooldownTimer) clearInterval(cooldownTimer);
discardConfirmation.dispose();
});
const goBack = () => uni.navigateBack();
// 返回登录时替换当前认证页,避免登录与重设页反复叠加。
const prepareLogin = () => uni.redirectTo({ url: "/pages/auth/a01-entry" });
const showFeedback = (message) => {
feedbackMessage.value = message;
feedbackVisible.value = true;
@@ -222,13 +331,91 @@ const clearFieldError = (field) => {
fieldErrors.value[field] = "";
};
const prepareGetCode = () => {
if (!/^1\d{10}$/.test(phone.value)) {
const startCooldown = () => {
cooldownSeconds.value = 60;
if (cooldownTimer) clearInterval(cooldownTimer);
cooldownTimer = setInterval(() => {
cooldownSeconds.value -= 1;
if (cooldownSeconds.value <= 0) {
clearInterval(cooldownTimer);
cooldownTimer = null;
}
}, 1000);
};
const prepareGetCode = async () => {
if (sendingCode.value || submitting.value || cooldownSeconds.value > 0) return;
if (!isAuthPhone(phone.value)) {
fieldErrors.value.phone = "请输入正确手机号";
return;
}
fieldErrors.value.phone = "";
showFeedback("滑动验证待接口接入");
sendingCode.value = true;
try {
const sceneCode = AUTH_TAC_SCENE.FORGOT_PASSWORD;
const requestedPhone = phone.value;
const response = await appApi.getCaptchaRequirement(
{ sceneCode, subject: requestedPhone },
{ requestController: authRequestController },
);
if (!pageActive) return;
if (phone.value !== requestedPhone) throw new Error("手机号已变化,请重新获取验证码");
const requirement = normalizeCaptchaRequirement(response, sceneCode);
tacSequence += 1;
tacContext.value = createTacRenderContext({
requestId: `a05-forgot-${tacSequence}`,
baseUrl: runtimeConfig.baseUrl,
clientId: runtimeConfig.clientId,
tenantId: runtimeConfig.tenantId,
sceneCode,
subject: requestedPhone,
requirement,
});
tacVisible.value = true;
} catch (error) {
if (pageActive && !isRequestCancelled(error)) {
showFeedback(error.message || "安全验证暂不可用");
}
} finally {
if (pageActive) sendingCode.value = false;
}
};
const completeTac = async (result) => {
const expectedContext = tacContext.value;
if (!expectedContext) return;
try {
const ticket = normalizeTacSuccess(result, expectedContext.requestId);
if (phone.value !== expectedContext.subject) throw new Error("手机号已变化,请重新验证");
closeTac();
sendingCode.value = true;
await appApi.sendSmsCode(
{
sceneCode: AUTH_TAC_SCENE.FORGOT_PASSWORD,
phone: expectedContext.subject,
validToken: ticket.validToken,
},
{ requestController: authRequestController },
);
if (!pageActive) return;
startCooldown();
showFeedback("验证码已发送");
} catch (error) {
closeTac();
if (pageActive && !isRequestCancelled(error)) {
showFeedback(error.message || "验证码发送失败");
}
} finally {
if (pageActive) sendingCode.value = false;
}
};
const handleTacFailure = ({ message } = {}) =>
showFeedback(message || "行为验证未通过,请重试");
const handleTacError = ({ message } = {}) => {
closeTac();
showFeedback(message || "安全验证暂不可用");
};
const validateForm = () => {
@@ -238,9 +425,9 @@ const validateForm = () => {
password: "",
confirmPassword: "",
};
if (!/^1\d{10}$/.test(phone.value)) nextErrors.phone = "请输入正确手机号";
if (!/^\d{6}$/.test(verificationCode.value))
nextErrors.verificationCode = "请输入 6 位验证码";
if (!isAuthPhone(phone.value)) nextErrors.phone = "请输入正确手机号";
if (!/^\d{4}$/.test(verificationCode.value))
nextErrors.verificationCode = "请输入 4 位验证码";
const passwordResult = validatePassword(password.value);
if (!passwordResult.valid) nextErrors.password = PASSWORD_POLICY_MESSAGE;
if (!confirmPassword.value) nextErrors.confirmPassword = "请再次输入新密码";
@@ -250,14 +437,32 @@ const validateForm = () => {
return !Object.values(nextErrors).some(Boolean);
};
const submitReset = () => {
const submitReset = async () => {
if (submitting.value || sendingCode.value) return;
if (!validateForm()) return;
successVisible.value = true;
submitting.value = true;
try {
await appApi.resetPassword(
{
phone: phone.value,
passwordHash: calcMD5(password.value),
smsCode: verificationCode.value,
},
{ requestController: authRequestController },
);
if (!pageActive) return;
successVisible.value = true;
} catch (error) {
if (pageActive && !isRequestCancelled(error)) {
showFeedback(error.message || "密码重设失败,请稍后重试");
}
} finally {
if (pageActive) submitting.value = false;
}
};
</script>
<style scoped lang="scss">
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
.reset-content {
display: flex;
@@ -358,6 +563,9 @@ const submitReset = () => {
color: #a7160c;
font-size: 26rpx;
}
.get-code--disabled {
color: #9f968d;
}
.field-error {
display: block;
padding-top: 4rpx;
@@ -377,8 +585,7 @@ const submitReset = () => {
margin-top: 26rpx;
}
.reset-submit__skin,
.success-action__skin {
.reset-submit__skin {
grid-area: 1 / 1;
width: 100%;
height: 100%;
@@ -414,93 +621,10 @@ const submitReset = () => {
color: #a7160c;
}
.success-layer {
position: fixed;
z-index: 20;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 42rpx;
background: rgba(35, 18, 10, 0.62);
}
.success-dialog {
display: grid;
width: 620rpx;
min-height: 520rpx;
max-height: calc(var(--app-viewport-height) - 40px);
}
.success-dialog__skin {
grid-area: 1 / 1;
width: 100%;
height: 100%;
}
.success-dialog__content {
z-index: 1;
display: flex;
grid-area: 1 / 1;
flex-direction: column;
align-items: center;
box-sizing: border-box;
min-height: 100%;
overflow-y: auto;
padding: 64rpx 64rpx 42rpx;
text-align: center;
}
.success-title {
color: #8f160f;
font-size: 43rpx;
font-weight: 700;
letter-spacing: 4rpx;
}
.success-copy {
margin-top: 18rpx;
color: #513a28;
font-size: 26rpx;
line-height: 40rpx;
}
.success-mark {
width: 82rpx;
height: 82rpx;
margin-bottom: 20rpx;
}
.success-action {
display: grid;
place-items: center;
width: 100%;
min-height: 82rpx;
margin-top: 24rpx;
}
.success-action__copy {
z-index: 1;
grid-area: 1 / 1;
color: #fffaf0;
font-size: 30rpx;
letter-spacing: 4rpx;
}
.feedback-toast {
position: fixed;
z-index: 30;
top: calc(var(--status-bar-height, 0px) + 24rpx);
left: 50%;
display: flex;
align-items: center;
justify-content: center;
@include adaptive.adaptive-feedback-toast;
width: 590rpx;
min-height: 82rpx;
background: transparent;
transform: translateX(-50%);
}
.feedback-toast__copy {
z-index: 1;
padding: 16rpx 36rpx;
color: #5c4330;
font-size: 25rpx;
text-align: center;
margin: 8rpx auto 12rpx;
}
.tap-fade,
.button-hover {
+17 -15
View File
@@ -3,7 +3,7 @@
<AuthPageShell class="auth-page status-page">
<view class="status-content">
<view class="page-heading">
<view class="back-button" hover-class="tap-fade" @click="goBack">
<view class="back-button" hover-class="tap-fade" @click="requestBack">
<image
class="back-button__icon"
src="/static/assets/foundation/transparent/chevron-right.png"
@@ -69,7 +69,7 @@
/>
<text class="status-primary__copy">查看恢复方式</text>
</view>
<view class="status-secondary" hover-class="tap-fade" @click="goLogin"
<view class="status-secondary" hover-class="tap-fade" @click="requestBack"
>返回登录</view
>
</view>
@@ -113,8 +113,9 @@
<script setup>
import { computed, ref } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AuthPageShell from "@/components/AuthPageShell.vue";
import { goRoot, handleBackPress, runBackGuard } from "@/utils/navigation.js";
const status = ref("risk");
const recoveryVisible = ref(false);
@@ -165,15 +166,8 @@ const statusConfig = {
const currentState = computed(() => statusConfig[status.value]);
const resolveStatus = () => {
let requestedStatus = "risk";
if (typeof location !== "undefined") {
const query = new URLSearchParams(location.hash.split("?")[1] || "");
requestedStatus = query.get("status") || "risk";
} else {
const pages = getCurrentPages();
requestedStatus = pages[pages.length - 1]?.options?.status || "risk";
}
const resolveStatus = (options = {}) => {
const requestedStatus = options.status || "risk";
status.value = Object.prototype.hasOwnProperty.call(
statusConfig,
requestedStatus,
@@ -184,16 +178,24 @@ const resolveStatus = () => {
};
onLoad(resolveStatus);
onShow(resolveStatus);
const goLogin = () => uni.redirectTo({ url: "/pages/auth/a01-entry" });
const openRecovery = () => {
recoveryVisible.value = true;
};
const closeRecovery = () => {
recoveryVisible.value = false;
};
const goBack = () => uni.navigateBack();
const requestBack = () => {
if (recoveryVisible.value) {
return runBackGuard({
transientOpen: true,
"close-transient": closeRecovery,
});
}
return goRoot("A01");
};
onBackPress((event) => handleBackPress(event, requestBack));
</script>
<style scoped lang="scss">
+100 -54
View File
@@ -9,9 +9,9 @@
}"
>
<ModulePageBackground module="family" />
<view class="family-page__header"
><PageHeader title="家族动态" action="发布" @action="toPublish"
/></view>
<view class="family-page__header">
<PageHeader root title="家族动态" :action="hasValidContext ? '发布' : ''" @action="toPublish" />
</view>
<view class="feed-content">
<AppLoading
v-if="feedState === 'loading'"
@@ -19,9 +19,9 @@
description="请稍候,正在读取家宴、通知与共同记忆。"
/>
<view v-if="feedState !== 'loading'" class="feed-heading"
><text>汤氏家族圈</text><text>家宴通知与共同记忆</text></view
><text>{{ familyTitle }}</text><text>家宴通知与共同记忆</text></view
>
<view v-if="feedState !== 'loading'" class="feed-shortcuts">
<view v-if="feedState !== 'loading' && hasValidContext" class="feed-shortcuts">
<view
v-for="item in shortcuts"
:key="item.key"
@@ -49,56 +49,67 @@
</template>
<view v-else-if="feedState !== 'loading'" class="feed-state-card">
<view class="feed-state-card__copy"
><text>{{
feedState === "empty" ? "还没有家族动态" : "家族动态暂不可用"
}}</text
><text>{{
feedState === "empty"
? "发布第一条通知、家宴记录或家族故事。"
: "请稍后重新进入,已有内容不会受到影响。"
}}</text></view
><text>{{ stateCopy.title }}</text
><text>{{ stateCopy.copy }}</text></view
>
</view>
<view
v-if="feedState !== 'loading'"
class="feed-action"
@click="feedState === 'error' ? (feedState = 'list') : toPublish()"
><text>{{
feedState === "error" ? "重新查看" : "发布家族动态"
}}</text></view
@click="handlePrimaryAction"
><text>{{ stateCopy.action }}</text></view
>
</view>
<AppTabbar active="family" />
</view>
</template>
<script setup>
import { ref } from "vue";
import { computed, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import AppLoading from "@/components/AppLoading.vue";
import PageHeader from "@/components/PageHeader.vue";
import AppTabbar from "@/components/AppTabbar.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import {
findGenealogyFixture,
getGenealogyFixtureAccess,
listFamilyFeedFixtures,
} from "@/data/mock.js";
import { genealogyContext } from "@/utils/genealogy-context.js";
import { goRoot, openPage } from "@/utils/navigation.js";
const genealogyId = ref("");
const genealogy = ref(null);
const hasValidContext = ref(false);
const feedState = ref("loading");
const feeds = [
{
id: 1,
tag: "团圆记忆",
time: "今天 10:24",
title: "端午家宴",
content: "今年端午全家相聚,留下了许多温暖照片。",
author: "汤正国",
},
{
id: 2,
tag: "家族通知",
time: "昨天 18:02",
title: "修谱资料征集",
content: "请家人补充老照片中的人物姓名与拍摄时间。",
author: "谱主",
},
];
const feeds = ref([]);
const familyTitle = computed(() =>
genealogy.value ? `${genealogy.value.name}家族圈` : "家族圈",
);
const stateCopy = computed(() => {
if (!hasValidContext.value) {
return {
title: "请先选择可访问的家谱",
copy: "家族动态必须归属明确家谱,页面不会展示其他家谱的内容。",
action: "返回我的家谱",
};
}
if (feedState.value === "empty") {
return {
title: "还没有家族动态",
copy: "可先查看其他家族内容;发布接口接入后才能新增动态。",
action: "填写动态预览",
};
}
if (feedState.value === "error") {
return {
title: "家族动态暂不可用",
copy: "请稍后重新查看,已有内容不会受到影响。",
action: "重新查看",
};
}
return { title: "", copy: "", action: "发布家族动态" };
});
const shortcuts = [
{ key: "articles", label: "谱文" },
{ key: "albums", label: "相册" },
@@ -110,8 +121,30 @@ const shortcuts = [
{ key: "videos", label: "家族视频" },
];
onLoad((query) => {
genealogyId.value =
query.genealogyId || genealogyContext.getCurrentGenealogyId() || "";
const hasRouteIdentity = Object.prototype.hasOwnProperty.call(query, "genealogyId");
const resolvedGenealogyId = hasRouteIdentity
? String(query.genealogyId || "")
: String(genealogyContext.getCurrentGenealogyId() || "");
genealogyId.value = resolvedGenealogyId;
genealogy.value = findGenealogyFixture(resolvedGenealogyId);
const access = getGenealogyFixtureAccess(resolvedGenealogyId);
const isAccessible = Boolean(
genealogy.value && ["owner", "member"].includes(access.accessRole),
);
if (!isAccessible) {
feeds.value = [];
feedState.value = "error";
return;
}
if (!hasRouteIdentity) {
goRoot("F01", { genealogyId: resolvedGenealogyId }).catch(() => {
hasValidContext.value = false;
feedState.value = "error";
});
return;
}
hasValidContext.value = isAccessible;
feeds.value = listFamilyFeedFixtures(resolvedGenealogyId);
feedState.value =
query.state === "loading"
? "loading"
@@ -119,28 +152,41 @@ onLoad((query) => {
? "empty"
: query.state === "error"
? "error"
: "list";
: feeds.value.length
? "list"
: "empty";
});
const toPublish = () =>
uni.navigateTo({
url: `/pages/family/f02-publish-feed?genealogyId=${genealogyId.value}`,
});
hasValidContext.value
? openPage("F02", { genealogyId: genealogyId.value }, "F01")
: goRoot("G01");
const openDetail = (item) =>
uni.navigateTo({ url: `/pages/family/f03-feed-detail?feedId=${item.id}` });
openPage(
"F03",
{ genealogyId: genealogyId.value, feedId: String(item.id) },
"F01",
);
const openSection = (key) => {
const routes = {
articles: "/pages/family/f04-article-list",
albums: "/pages/family/f07-album-list",
rituals: "/pages/records/r05-ritual-list",
memos: "/pages/records/r10-memo-list",
people: "/pages/records/r01-people-list",
gifts: "/pages/records/r03-gift-list",
merits: "/pages/records/r11-merit-records",
videos: "/pages/family/f10-video-list",
articles: "F04",
albums: "F07",
rituals: "R05",
memos: "R10",
people: "R01",
gifts: "R03",
merits: "R11",
videos: "F10",
};
uni.navigateTo({
url: `${routes[key]}?genealogyId=${genealogyId.value}`,
});
return openPage(routes[key], { genealogyId: genealogyId.value }, "F01");
};
const handlePrimaryAction = () => {
if (!hasValidContext.value) return goRoot("G01");
if (feedState.value === "error") {
feeds.value = listFamilyFeedFixtures(genealogyId.value);
feedState.value = feeds.value.length ? "list" : "empty";
return;
}
return toPublish();
};
</script>
<style scoped lang="scss">
+115 -23
View File
@@ -4,11 +4,12 @@
class="publish-page"
:class="{
'publish-state--form': publishState === 'form',
'publish-state--success': publishState === 'success',
'publish-state--preview': publishState === 'preview',
'publish-state--error': publishState === 'error',
'publish-state--invalid': publishState === 'invalid',
}"
><ModulePageBackground module="family" /><view class="publish-page__header"
><PageHeader title="发布动态" /></view
><PageHeader title="发布动态" custom-back @back="requestBack" /></view
><view class="publish-panel"
><view
v-if="publishState === 'form'"
@@ -23,42 +24,99 @@
placeholder="写下想对家人说的话"
placeholder-class="publish-placeholder"
/></view
><AppButton block label="发布动态" @click="submit" /></view
><view v-else class="publish-result"
><text>{{
publishState === "success" ? "动态已发布" : "动态未发布"
}}</text
><text>{{
publishState === "success"
? "家人现在可以在家族圈看到这条记录。"
: "请检查内容后重新发布,当前文字仍保留在页面中。"
}}</text
><AppButton
block
:label="publishState === 'success' ? '继续发布' : '重新填写'"
@click="publishState = 'form'" /></view></view
:label="isSubmitting ? '正在校验' : '生成本地预览'"
:disabled="isSubmitting"
@click="submit"
/></view
><view v-else class="publish-result"
><text>{{ resultCopy.title }}</text
><text>{{ resultCopy.copy }}</text
><AppButton
block
:label="resultCopy.action"
@click="handleResultAction" /></view></view
><AppDialog
:visible="discardVisible"
title="放弃动态草稿?"
message="当前内容尚未提交服务器,确认返回后不会保留。"
confirm-text="放弃并返回"
cancel-text="继续填写"
show-cancel
:close-on-mask="false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
><AppToast :visible="toastVisible" :message="toastMessage"
/></view>
</template>
<script setup>
import { onUnmounted, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { computed, onUnmounted, ref } from "vue";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { getGenealogyFixtureAccess } from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
handleBackPress,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
const genealogyId = ref("");
const content = ref("");
const publishState = ref("form");
const isSubmitting = ref(false);
const discardVisible = ref(false);
const toastVisible = ref(false);
const toastMessage = ref("");
let toastTimer = null;
let submitTimer = null;
const isDirty = computed(() => Boolean(content.value.trim()));
const hasValidContext = computed(() =>
["owner", "member"].includes(
getGenealogyFixtureAccess(genealogyId.value).accessRole,
),
);
const resultCopy = computed(() => ({
preview: {
title: "动态内容已完成本地预览",
copy: "当前尚未提交服务器,返回家族圈后不会出现这条动态。",
action: "返回家族圈(不发布)",
},
error: {
title: "动态未提交",
copy: "当前文字仍保留在页面中,可返回表单继续核对。",
action: "返回填写",
},
invalid: {
title: "动态入口无效",
copy: "没有找到可发布内容的成员家谱,页面不会创建无归属动态。",
action: "返回上一页",
},
}[publishState.value]));
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
onLoad((query) => {
publishState.value =
query.state === "success"
? "success"
: query.state === "error"
? "error"
: "form";
genealogyId.value = String(query.genealogyId || "");
if (!genealogyId.value || !hasValidContext.value) {
publishState.value = "invalid";
return;
}
if (["preview", "error"].includes(query.state)) {
content.value = "这是一段尚未提交服务器的家族动态预览。";
publishState.value = query.state;
}
});
const showToast = (message) => {
toastMessage.value = message;
@@ -70,14 +128,48 @@ const showToast = (message) => {
}, 1800);
};
const submit = () => {
if (isSubmitting.value || !hasValidContext.value) return;
if (!content.value.trim()) {
showToast("请先写下动态内容");
return;
}
publishState.value = "success";
isSubmitting.value = true;
const submittedContent = content.value.trim();
const timer = setTimeout(() => {
if (submitTimer !== timer) return;
submitTimer = null;
isSubmitting.value = false;
publishState.value = submittedContent ? "preview" : "error";
}, 280);
submitTimer = timer;
};
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
submitting: isSubmitting.value,
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
const returnToFamily = async () => {
const confirmed = isDirty.value ? await requestDiscardConfirmation() : true;
if (!confirmed) return false;
return returnTo("F01", { genealogyId: genealogyId.value });
};
const handleResultAction = () => {
if (publishState.value === "preview") return returnToFamily();
if (publishState.value === "error") {
publishState.value = "form";
return;
}
return goBack();
};
onBackPress((event) => handleBackPress(event, requestBack));
onUnmounted(() => {
if (toastTimer) clearTimeout(toastTimer);
if (submitTimer) clearTimeout(submitTimer);
discardConfirmation.dispose();
});
</script>
<style scoped lang="scss">
+91 -38
View File
@@ -2,7 +2,7 @@
<template>
<view class="feed-detail-page" :class="{ 'feed-state--expired': feedState === 'expired', 'feed-state--error': feedState === 'error', 'feed-state--ready': feedState === 'ready' }">
<ModulePageBackground module="family" />
<view class="feed-detail-header"><PageHeader title="动态详情" /></view>
<view class="feed-detail-header"><PageHeader title="动态详情" custom-back @back="requestBack" /></view>
<view v-if="feedState === 'loading'" class="feed-detail-loading">
<AppLoading text="正在读取家族动态" description="请稍候,正在整理正文与家人评论。" />
@@ -30,93 +30,146 @@
</view>
</view>
<view class="feed-comment-form" :class="{ 'comment-state--saving': commentState === 'saving', 'comment-state--error': commentState === 'error' }">
<view class="feed-comment-form" :class="{ 'comment-state--validating': commentState === 'validating', 'comment-state--preview': commentState === 'preview', 'comment-state--error': commentState === 'error' }">
<text>写下评论</text>
<textarea v-model="commentDraft" auto-height maxlength="240" placeholder="对家人说点什么" />
<text v-if="commentError" class="feed-comment-error">{{ commentError }}</text>
<AppButton block :disabled="commentState === 'saving'" :label="commentState === 'saving' ? '正在发送' : '发送评论'" @click="submitComment" />
<AppButton block :disabled="commentState === 'validating'" :label="commentState === 'validating' ? '正在校验' : '生成评论预览'" @click="submitComment" />
</view>
</template>
<view v-else class="feed-state-card">
<text>{{ feedState === 'expired' ? '动态已失效' : '动态暂不可用' }}</text>
<text>{{ feedState === 'expired' ? '这条动态可能已被发布人删除,请返回家族圈查看其他内容。' : '请稍后重新查看,已有家族记录不会受到影响。' }}</text>
<AppButton :type="feedState === 'error' ? 'secondary' : 'primary'" block :label="feedState === 'error' ? '重新查看' : '返回家族圈'" @click="feedState === 'error' ? restoreFeed() : backToFamily()" />
<text>{{ stateCopy.title }}</text>
<text>{{ stateCopy.copy }}</text>
<AppButton :type="feedState === 'error' ? 'secondary' : 'primary'" block :label="stateCopy.action" @click="handleStateAction" />
</view>
</view>
<AppToast :visible="toastVisible" message="评论已发送" />
<AppDialog
:visible="discardVisible"
title="放弃评论草稿?"
message="当前评论尚未提交服务器,确认返回后不会保留。"
confirm-text="放弃并返回"
cancel-text="继续填写"
show-cancel
:close-on-mask="false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
<AppToast :visible="toastVisible" message="评论尚未提交服务器,草稿已保留" />
</view>
</template>
<script setup>
import { onUnmounted, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { computed, onUnmounted, ref } from "vue";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { findFamilyFeedFixture } from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
handleBackPress,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
const feedRecords = [
{ id: "1", tag: "团圆记忆", time: "今天 10:24", title: "端午家宴", content: "今年端午全家相聚,长辈讲起祖居旧事,孩子们也为大家拍下了新的全家福。饭后我们把照片和口述片段整理进家族档案,让这份热闹成为往后仍能翻看的共同记忆。", author: "汤正国" },
{ id: "2", tag: "家族通知", time: "昨天 18:02", title: "修谱资料征集", content: "请家人补充老照片中的人物姓名、拍摄时间和地点。无法确认的信息也可以先写下线索,由熟悉往事的长辈共同核对。", author: "谱主" },
];
const feedId = ref("1");
const currentFeed = ref(feedRecords[0]);
const genealogyId = ref("");
const feedId = ref("");
const currentFeed = ref(null);
const feedState = ref("loading");
const commentState = ref("idle");
const commentDraft = ref("");
const commentError = ref("");
const toastVisible = ref(false);
const forceCommentFailure = ref(false);
const feedComments = ref([
{ id: 1, author: "汤淑华", time: "今天 10:42", content: "一家人能常常相聚,就是最珍贵的福气。" },
{ id: 2, author: "汤文清", time: "今天 11:08", content: "照片已经整理好了,晚些时候放进春节团圆相册。" },
]);
const discardVisible = ref(false);
const feedComments = ref([]);
let submitTimer = null;
let toastTimer = null;
const isDirty = computed(() => Boolean(commentDraft.value.trim()));
const stateCopy = computed(() => {
if (feedState.value === "error" && currentFeed.value) {
return {
title: "动态暂不可用",
copy: "请稍后重新查看,已有家族记录不会受到影响。",
action: "重新查看",
};
}
return {
title: "动态已失效或入口无效",
copy: "没有找到当前家谱中的这条动态,页面不会回退到其他记录。",
action: genealogyId.value ? "返回家族圈" : "返回上一页",
};
});
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
onLoad((query) => {
feedId.value = String(query.feedId || "1");
const selected = feedRecords.find((item) => item.id === feedId.value);
currentFeed.value = selected || feedRecords[0];
forceCommentFailure.value = query.commentResult === "error";
genealogyId.value = String(query.genealogyId || "");
feedId.value = String(query.feedId || "");
const selected = findFamilyFeedFixture(genealogyId.value, feedId.value);
currentFeed.value = selected;
feedComments.value = selected?.comments || [];
feedState.value = ["loading", "error", "expired"].includes(query.state)
? query.state
? selected
? query.state
: "expired"
: selected
? "ready"
: "expired";
});
const submitComment = () => {
if (commentState.value === "saving") return;
if (commentState.value === "validating" || !currentFeed.value) return;
const content = commentDraft.value.trim();
if (!content) {
commentError.value = "请先写下评论内容";
return;
}
commentError.value = "";
commentState.value = "saving";
submitTimer = setTimeout(() => {
if (forceCommentFailure.value) {
commentState.value = "error";
commentError.value = "评论发送失败,请保留文字后重试";
forceCommentFailure.value = false;
return;
}
feedComments.value.push({ id: Date.now(), author: "我", time: "刚刚", content });
commentDraft.value = "";
commentState.value = "idle";
commentState.value = "validating";
const timer = setTimeout(() => {
if (submitTimer !== timer) return;
submitTimer = null;
commentState.value = "preview";
toastVisible.value = true;
toastTimer = setTimeout(() => { toastVisible.value = false; }, 1800);
}, 320);
submitTimer = timer;
};
const restoreFeed = () => { feedState.value = "ready"; };
const backToFamily = () => uni.redirectTo({ url: "/pages/family/f01-family-feed" });
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
submitting: commentState.value === "validating",
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
const backToFamily = async () => {
if (!genealogyId.value) return goBack();
const confirmed = isDirty.value ? await requestDiscardConfirmation() : true;
if (!confirmed) return false;
return returnTo("F01", { genealogyId: genealogyId.value });
};
const handleStateAction = () => {
if (feedState.value === "error" && currentFeed.value) return restoreFeed();
return backToFamily();
};
onBackPress((event) => handleBackPress(event, requestBack));
onUnmounted(() => {
if (submitTimer) clearTimeout(submitTimer);
if (toastTimer) clearTimeout(toastTimer);
discardConfirmation.dispose();
});
</script>
+66 -20
View File
@@ -2,7 +2,7 @@
<template>
<view class="article-list-page" :class="{ 'article-list-state--loading': listState === 'loading', 'article-list-state--empty': listState === 'empty', 'article-list-state--error': listState === 'error' }">
<ModulePageBackground module="family" />
<view class="article-list-header"><PageHeader title="谱文" action="新建" @action="createArticle" /></view>
<view class="article-list-header"><PageHeader title="谱文" :action="hasValidContext ? '新建' : ''" @action="createArticle" /></view>
<view v-if="listState === 'loading'" class="article-list-loading">
<AppLoading text="正在整理家族谱文" description="请稍候,正在读取家训、往事与序言。" />
@@ -37,9 +37,9 @@
</template>
<view v-else class="article-list-state-card">
<text>{{ listState === 'empty' ? '还没有谱文' : '谱文列表暂不可用' }}</text>
<text>{{ listState === 'empty' ? '记录第一篇家风家训或家族往事。' : '请稍后重新查看,已有谱文不会受到影响。' }}</text>
<AppButton :type="listState === 'error' ? 'secondary' : 'primary'" block :label="listState === 'error' ? '重新查看' : '新建谱文'" @click="listState === 'error' ? restoreArticles() : createArticle()" />
<text>{{ stateCopy.title }}</text>
<text>{{ stateCopy.copy }}</text>
<AppButton :type="listState === 'error' ? 'secondary' : 'primary'" block :label="stateCopy.action" @click="handleStateAction" />
</view>
</view>
</view>
@@ -52,14 +52,16 @@ 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 {
getGenealogyFixtureAccess,
listFamilyArticleFixtures,
} from "@/data/mock.js";
import { goBack, openPage } from "@/utils/navigation.js";
const articleCategories = ["全部", "家风家训", "家族往事", "族谱序言"];
const baseArticles = [
{ id: "101", category: "家风家训", title: "孝友传家的日常", summary: "从敬老、睦亲与守信的小事里,看见家风如何代代相传。", author: "汤文正", updatedAt: "今天更新" },
{ id: "102", category: "家族往事", title: "祖居门前的那棵桂花树", summary: "长辈口述的旧居记忆,以及每年中秋一家人相聚的故事。", author: "汤淑华", updatedAt: "昨天更新" },
{ id: "103", category: "族谱序言", title: "续修族谱序", summary: "说明本次续修的缘起、资料来源与共同参与的家人。", author: "谱主", updatedAt: "5 月 12 日" },
];
const articles = ref([...baseArticles]);
const genealogyId = ref("");
const hasValidContext = ref(false);
const articles = ref([]);
const activeCategory = ref("全部");
const keyword = ref("");
const listState = ref("loading");
@@ -71,20 +73,64 @@ const filteredArticles = computed(() => {
return categoryMatched && keywordMatched;
});
});
const stateCopy = computed(() => ({
empty: {
title: "还没有谱文",
copy: "当前家谱尚无可读取谱文,真实写接口接入后才能新增。",
action: "填写谱文预览",
},
error: {
title: "谱文列表暂不可用",
copy: "请稍后重新查看,已有谱文不会受到影响。",
action: "重新查看",
},
invalid: {
title: "谱文入口无效",
copy: "没有找到可访问的成员家谱,页面不会展示其他家谱内容。",
action: "返回上一页",
},
}[listState.value]));
onLoad((query) => {
const count = Math.max(1, Math.min(Number(query.count) || baseArticles.length, 50));
articles.value = Array.from({ length: count }, (_, index) => ({
...baseArticles[index % baseArticles.length],
id: String(101 + index),
title: count > baseArticles.length ? `${baseArticles[index % baseArticles.length].title}(第 ${index + 1} 篇)` : baseArticles[index].title,
}));
listState.value = ["loading", "empty", "error"].includes(query.state) ? query.state : "ready";
genealogyId.value = String(query.genealogyId || "");
hasValidContext.value = ["owner", "member"].includes(
getGenealogyFixtureAccess(genealogyId.value).accessRole,
);
if (!genealogyId.value || !hasValidContext.value) {
listState.value = "invalid";
return;
}
articles.value = listFamilyArticleFixtures(genealogyId.value);
listState.value = ["loading", "empty", "error"].includes(query.state)
? query.state
: articles.value.length
? "ready"
: "empty";
});
const openArticle = (article) => uni.navigateTo({ url: `/pages/family/f05-article-detail?articleId=${article.id}` });
const createArticle = () => uni.navigateTo({ url: "/pages/family/f06-article-editor?mode=create" });
const restoreArticles = () => { listState.value = "ready"; };
const openArticle = (article) =>
openPage(
"F05",
{ genealogyId: genealogyId.value, articleId: String(article.id) },
"F04",
);
const createArticle = () =>
hasValidContext.value
? openPage(
"F06",
{ genealogyId: genealogyId.value, mode: "create" },
"F04",
)
: Promise.resolve(false);
const restoreArticles = () => {
articles.value = listFamilyArticleFixtures(genealogyId.value);
listState.value = articles.value.length ? "ready" : "empty";
};
const handleStateAction = () => {
if (listState.value === "invalid") return goBack();
if (listState.value === "error") return restoreArticles();
return createArticle();
};
const resetFilters = () => { keyword.value = ""; activeCategory.value = "全部"; };
</script>
+36 -29
View File
@@ -19,7 +19,7 @@
</view>
</view>
<view class="article-actions">
<AppButton block :label="favorite ? '已收藏谱文' : '收藏谱文'" @click="toggleFavorite" />
<AppButton block disabled label="收藏暂未开放" />
<AppButton type="secondary" block label="编辑谱文" @click="editArticle" />
</view>
</template>
@@ -30,31 +30,24 @@
<AppButton :type="articleState === 'error' ? 'secondary' : 'primary'" block :label="stateCopy.action" @click="handleStateAction" />
</view>
</view>
<AppToast :visible="toastVisible" :message="favorite ? '已收藏谱文' : '已取消收藏'" />
</view>
</template>
<script setup>
import { computed, onUnmounted, reactive, ref } from "vue";
import { computed, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppLoading from "@/components/AppLoading.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { findFamilyArticleFixture } from "@/data/mock.js";
import { goBack, openPage, returnTo } from "@/utils/navigation.js";
const articleRecords = [
{ id: "101", category: "家风家训", title: "孝友传家的日常", author: "汤文正", updatedAt: "2024 年 5 月 12 日", paragraphs: ["孝友传家,不只在族谱序言里,也在一家人每日的言行中。长辈以宽厚待晚辈,晚辈以耐心照料长辈,亲友之间守信互助,便是最朴素也最长久的家风。", "勤俭并非一味节省,而是珍惜所得、量入为出,也愿意在家人需要时伸出援手。家中每一代人都可以用自己的方式,把这份分寸与担当继续传下去。", "敬祖睦宗,最终是为了让今天的家人彼此认识、彼此关心。记录姓名与世代之外,也应留下真实的生活、共同经历和温暖记忆。"] },
{ id: "102", category: "家族往事", title: "祖居门前的那棵桂花树", author: "汤淑华", updatedAt: "2024 年 5 月 10 日", paragraphs: ["祖居门前曾有一棵桂花树。每到中秋,院里都是清甜的香气,远道回来的家人也总能循着那股味道找到家门。", "后来房屋几经修缮,桂花树仍被大家小心保留下来。它见过孩子长大,也见过长辈把往事一遍遍讲给后来人。"] },
{ id: "103", category: "族谱序言", title: "续修族谱序", author: "谱主", updatedAt: "2024 年 5 月 8 日", paragraphs: ["本次续修以旧谱、碑记、户籍资料和长辈口述为基础,由家人共同核对补充。凡暂不能确认之处,均保留来源和疑问,留待后续查证。", "愿这份记录不仅理清世系,也能保存家风、人物与共同记忆。"] },
];
const articleId = ref("101");
const article = reactive({ ...articleRecords[0] });
const genealogyId = ref("");
const articleId = ref("");
const article = ref(null);
const articleState = ref("loading");
const favorite = ref(false);
const toastVisible = ref(false);
let toastTimer = null;
const articleParagraphs = computed(() => article.paragraphs || []);
const articleParagraphs = computed(() => article.value?.paragraphs || []);
const articleStateClasses = computed(() => ({
[`article-state--${articleState.value}`]: true,
"article-state--expired": articleState.value === "expired",
@@ -62,32 +55,46 @@ const articleStateClasses = computed(() => ({
"article-state--error": articleState.value === "error",
}));
const stateCopy = computed(() => ({
expired: { title: "这篇谱文已无法查看", copy: "内容可能已被作者删除或取消公开,请返回谱文列表查看其他内容。", action: "返回谱文列表" },
expired: { title: "这篇谱文已无法查看", copy: "当前家谱中不存在这篇谱文,页面不会回退到其他文章。", action: genealogyId.value ? "返回谱文列表" : "返回上一页" },
privacy: { title: "这篇谱文暂未公开", copy: "作者仅向有权限的家人开放正文,请返回谱文列表查看其他内容。", action: "返回谱文列表" },
error: { title: "谱文暂不可用", copy: "请稍后重新查看,已有谱文不会受到影响。", action: "重新查看" },
}[articleState.value] || {}));
onLoad((query) => {
articleId.value = String(query.articleId || "101");
const selected = articleRecords.find((item) => item.id === articleId.value);
if (selected) Object.assign(article, selected);
genealogyId.value = String(query.genealogyId || "");
articleId.value = String(query.articleId || "");
const selected = findFamilyArticleFixture(genealogyId.value, articleId.value);
article.value = selected;
articleState.value = ["loading", "error", "expired", "privacy"].includes(query.state)
? query.state
? selected
? query.state
: "expired"
: selected
? "ready"
: "expired";
});
const toggleFavorite = () => {
favorite.value = !favorite.value;
toastVisible.value = true;
if (toastTimer) clearTimeout(toastTimer);
toastTimer = setTimeout(() => { toastVisible.value = false; }, 1800);
const editArticle = () =>
openPage(
"F06",
{
genealogyId: genealogyId.value,
mode: "edit",
articleId: articleId.value,
},
"F05",
);
const backToArticles = () =>
genealogyId.value
? returnTo("F04", { genealogyId: genealogyId.value })
: goBack();
const handleStateAction = () => {
if (articleState.value === "error" && article.value) {
articleState.value = "ready";
return;
}
return backToArticles();
};
const editArticle = () => uni.navigateTo({ url: `/pages/family/f06-article-editor?mode=edit&articleId=${articleId.value}` });
const backToArticles = () => uni.redirectTo({ url: "/pages/family/f04-article-list" });
const handleStateAction = () => { if (articleState.value === "error") articleState.value = "ready"; else backToArticles(); };
onUnmounted(() => { if (toastTimer) clearTimeout(toastTimer); });
</script>
<style scoped lang="scss">
+135 -36
View File
@@ -6,7 +6,7 @@
>
<ModulePageBackground module="family" />
<view class="article-editor-page__header">
<PageHeader title="编辑谱文" />
<PageHeader title="编辑谱文" custom-back @back="requestBack" />
</view>
<view v-if="editorState === 'loading'" class="article-editor-loading">
@@ -17,17 +17,15 @@
</view>
<view
v-else-if="editorState === 'success'"
v-else-if="editorState === 'preview' || editorState === 'invalid'"
class="article-editor-content"
>
<view class="editor-result-card">
<view class="editor-result-card__body">
<text class="editor-eyebrow">保存结果</text>
<text class="editor-result-card__title">谱文已保存</text>
<text class="editor-result-card__copy"
>这篇谱文已收录可返回谱文列表继续查看</text
>
<AppButton block label="返回谱文列表" @click="returnToList" />
<text class="editor-eyebrow">{{ resultCopy.eyebrow }}</text>
<text class="editor-result-card__title">{{ resultCopy.title }}</text>
<text class="editor-result-card__copy">{{ resultCopy.copy }}</text>
<AppButton block :label="resultCopy.action" @click="handleResultAction" />
</view>
</view>
</view>
@@ -38,7 +36,7 @@
<text class="editor-eyebrow">草稿 · 未发布</text>
<text class="editor-title">把值得传承的故事写下来</text>
<text class="editor-intro"
>补充标题分类和正文保存后可返回谱文列表继续查看</text
>补充标题分类和正文当前只校验并生成本地预览</text
>
<view class="editor-field">
@@ -108,22 +106,45 @@
<AppButton
block
:label="actionLabel"
:disabled="editorState === 'saving'"
:disabled="isSubmitting"
@click="submit"
/>
</view>
</view>
</view>
</view>
<AppDialog
:visible="discardVisible"
title="放弃谱文草稿?"
message="当前内容尚未提交服务器,确认返回后不会保留。"
confirm-text="放弃并返回"
cancel-text="继续编辑"
show-cancel
:close-on-mask="false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</template>
<script setup>
import { computed, reactive, ref } from "vue";
import { onLoad, onUnload } from "@dcloudio/uni-app";
import { onBackPress, onLoad, onUnload } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import {
findFamilyArticleFixture,
getGenealogyFixtureAccess,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
handleBackPress,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
const draftFixture = {
title: "汤氏家训辑录",
@@ -132,28 +153,68 @@ const draftFixture = {
"孝友传家,勤俭立业;敬祖睦宗,诚实待人。愿后人常怀感恩,彼此扶持。",
};
const editorState = ref("form");
const genealogyId = ref("");
const articleId = ref("");
const editorMode = ref("create");
const simulateSaveFailure = ref(false);
const isSubmitting = ref(false);
const discardVisible = ref(false);
const allowedStates = new Set([
"draft",
"loading",
"validation",
"saving",
"error",
"success",
"preview",
]);
const form = reactive({ title: "", category: "", content: "" });
const fieldErrors = reactive({ title: "", category: "", content: "" });
const baseline = ref("");
let saveTimer = null;
const actionLabel = computed(() =>
editorState.value === "saving"
? "正在保存…"
isSubmitting.value
? "正在校验…"
: editorState.value === "error"
? "重新保存"
: "保存谱文",
? "重新校验"
: "生成本地预览",
);
const formSnapshot = computed(() => JSON.stringify(form));
const isDirty = computed(() =>
Boolean(baseline.value) && formSnapshot.value !== baseline.value,
);
const hasValidContext = computed(() =>
Boolean(
genealogyId.value &&
["owner", "member"].includes(
getGenealogyFixtureAccess(genealogyId.value).accessRole,
) &&
(editorMode.value === "create" ||
(editorMode.value === "edit" && articleId.value)),
),
);
const resultCopy = computed(() =>
editorState.value === "preview"
? {
eyebrow: "本地流程预览",
title: "谱文内容已通过本地校验",
copy: "当前尚未提交服务器,返回后不会新增或修改谱文。",
action:
editorMode.value === "edit"
? "返回原谱文(不保存)"
: "返回谱文列表(不保存)",
}
: {
eyebrow: "谱文入口无效",
title: "没有找到要编辑的谱文上下文",
copy: "请从当前家谱的谱文列表重新进入,页面不会创建无归属内容。",
action: "返回上一页",
},
);
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const fillDraft = () => {
Object.assign(form, draftFixture);
@@ -165,16 +226,34 @@ const showAllFieldErrors = () => {
};
onLoad((query) => {
articleId.value = query.articleId || "";
editorMode.value = articleId.value || query.mode === "edit" ? "edit" : "create";
genealogyId.value = String(query.genealogyId || "");
articleId.value = String(query.articleId || "");
editorMode.value = String(query.mode || "");
const article =
editorMode.value === "edit"
? findFamilyArticleFixture(genealogyId.value, articleId.value)
: null;
const modeIsValid =
(editorMode.value === "create" && !articleId.value) ||
(editorMode.value === "edit" && Boolean(article));
if (!modeIsValid || !hasValidContext.value) {
editorState.value = "invalid";
return;
}
const requestedState = allowedStates.has(query.state) ? query.state : "form";
simulateSaveFailure.value = requestedState === "error";
if (
editorMode.value === "edit" ||
["draft", "saving", "error"].includes(requestedState)
) {
if (article) {
Object.assign(form, {
title: article.title,
category: article.category,
content: article.paragraphs.join("\n\n"),
});
} else if (["draft", "error", "preview"].includes(requestedState)) {
fillDraft();
}
baseline.value = formSnapshot.value;
if (editorMode.value === "create" && requestedState === "draft") {
baseline.value = JSON.stringify({ title: "", category: "", content: "" });
}
if (requestedState === "validation") showAllFieldErrors();
editorState.value = requestedState;
});
@@ -195,28 +274,48 @@ const validate = () => {
return !fieldErrors.title && !fieldErrors.category && !fieldErrors.content;
};
const submit = () => {
if (editorState.value === "saving") return;
if (isSubmitting.value || !hasValidContext.value) return;
if (!validate()) {
editorState.value = "validation";
return;
}
editorState.value = "saving";
saveTimer = setTimeout(() => {
editorState.value = simulateSaveFailure.value ? "error" : "success";
simulateSaveFailure.value = false;
isSubmitting.value = true;
const submitSnapshot = formSnapshot.value;
const timer = setTimeout(() => {
if (saveTimer !== timer) return;
editorState.value = submitSnapshot ? "preview" : "error";
isSubmitting.value = false;
saveTimer = null;
}, 320);
saveTimer = timer;
};
const returnToList = () =>
uni.redirectTo({
url:
editorMode.value === "edit" && articleId.value
? `/pages/family/f05-article-detail?articleId=${articleId.value}`
: "/pages/family/f04-article-list",
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
submitting: isSubmitting.value,
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
const returnToTarget = async () => {
const confirmed = isDirty.value ? await requestDiscardConfirmation() : true;
if (!confirmed) return false;
return editorMode.value === "edit"
? returnTo("F05", {
genealogyId: genealogyId.value,
articleId: articleId.value,
})
: returnTo("F04", { genealogyId: genealogyId.value });
};
const handleResultAction = () =>
editorState.value === "preview" ? returnToTarget() : goBack();
onBackPress((event) => handleBackPress(event, requestBack));
onUnload(() => {
if (saveTimer) clearTimeout(saveTimer);
discardConfirmation.dispose();
});
</script>
+131 -30
View File
@@ -2,7 +2,7 @@
<template>
<view class="album-list-page" :class="albumStateClasses">
<ModulePageBackground module="family" />
<view class="album-list-header"><PageHeader title="家族相册" action="新建" @action="createAlbum" /></view>
<view class="album-list-header"><PageHeader title="家族相册" :action="hasValidContext ? '新建' : ''" custom-back @back="requestBack" @action="createAlbum" /></view>
<view v-if="albumState === 'loading'" class="album-list-loading">
<AppLoading text="正在整理家族相册" description="请稍候,正在读取照片与更新时间。" />
@@ -11,6 +11,11 @@
<view v-else class="album-list-content">
<template v-if="albumState === 'ready'">
<view class="album-list-lead"><text>让每一张照片都回到家人身边</text><text> {{ albums.length }} 本相册</text></view>
<view v-if="localAlbumPreview" class="album-local-preview">
<text>本地预览 · 尚未提交服务器</text>
<text>{{ localAlbumPreview.name }}</text>
<text>这本相册不会加入正式列表离开页面后不保存</text>
</view>
<view v-if="albums.length" class="album-list">
<view v-for="album in albums" :key="album.id" class="album-card" role="button" :aria-label="`打开相册${album.name}`" @click="openAlbum(album)">
<view class="album-card__media"><image class="album-card__cover" :src="album.cover" mode="aspectFill" :alt="album.name" /></view>
@@ -29,76 +34,168 @@
</template>
<view v-else class="album-state-card">
<text>{{ albumState === 'empty' ? '还没有相册' : '相册暂不可用' }}</text>
<text>{{ albumState === 'empty' ? '从第一本团圆相册开始收集家族影像。' : '请稍后重新查看,已有照片不会受到影响。' }}</text>
<AppButton :type="albumState === 'error' ? 'secondary' : 'primary'" block :label="albumState === 'error' ? '重新查看' : '新建相册'" @click="albumState === 'error' ? restoreAlbums() : createAlbum()" />
<text>{{ stateCopy.title }}</text>
<text>{{ stateCopy.copy }}</text>
<AppButton :type="albumState === 'error' ? 'secondary' : 'primary'" block :label="stateCopy.action" @click="handleStateAction" />
</view>
</view>
<AppDialog :visible="dialogVisible" eyebrow="新建相册" title="为家人整理一段影像" message="相册创建后可继续添加照片和说明。" confirm-text="创建相册" cancel-text="取消" show-cancel @confirm="confirmCreateAlbum" @cancel="closeCreateDialog">
<AppDialog :visible="dialogVisible" eyebrow="新建相册预览" title="为家人整理一段影像" message="当前只生成本地预览,不会创建服务器相册。" confirm-text="生成本地预览" cancel-text="取消" show-cancel :close-on-mask="false" @confirm="confirmCreateAlbum" @cancel="requestCloseCreateDialog">
<view class="album-dialog-field">
<text>相册名称</text>
<input v-model="albumNameDraft" maxlength="30" placeholder="例如:春节团圆" />
<text v-if="albumNameError">{{ albumNameError }}</text>
</view>
</AppDialog>
<AppToast :visible="toastVisible" message="相册已创建" />
<AppDialog
:visible="discardVisible"
title="放弃相册草稿?"
message="当前相册尚未提交服务器,确认后不会保留。"
confirm-text="放弃"
cancel-text="继续整理"
show-cancel
:close-on-mask="false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</view>
</template>
<script setup>
import { computed, onUnmounted, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import {
getGenealogyFixtureAccess,
listFamilyAlbumFixtures,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
handleBackPress,
openPage,
runBackGuard,
} from "@/utils/navigation.js";
const baseAlbums = [
{ id: "201", name: "2024 春节团圆", photoCount: 18, updatedAt: "今天更新", description: "三代家人的团圆饭与院前合影", cover: "/static/assets/modules/family/f08/f08-reunion-hero.png" },
{ id: "202", name: "祖居旧影", photoCount: 32, updatedAt: "5 月 10 日更新", description: "祖居、旧物与长辈珍藏的老照片", cover: "/static/assets/modules/family/f08/f08-ancestral-home.png" },
{ id: "203", name: "儿童成长", photoCount: 46, updatedAt: "持续更新", description: "记录孩子们每一个值得珍藏的瞬间", cover: "/static/assets/modules/family/f08/f08-family-portrait.png" },
];
const albums = ref([...baseAlbums]);
const genealogyId = ref("");
const hasValidContext = ref(false);
const albums = ref([]);
const albumState = ref("loading");
const dialogVisible = ref(false);
const albumNameDraft = ref("");
const albumNameError = ref("");
const toastVisible = ref(false);
let toastTimer = null;
const localAlbumPreview = ref(null);
const discardVisible = ref(false);
const albumStateClasses = computed(() => ({
[`album-list-state--${albumState.value}`]: true,
"album-state--empty": albumState.value === "empty",
"album-list-state--loading": albumState.value === "loading",
"album-list-state--error": albumState.value === "error",
}));
const isDirty = computed(() =>
Boolean(albumNameDraft.value.trim() || localAlbumPreview.value),
);
const stateCopy = computed(() => ({
empty: {
title: "还没有相册",
copy: "当前家谱尚无可读取相册,可先生成不会保存的本地预览。",
action: "填写相册预览",
},
error: {
title: "相册暂不可用",
copy: "请稍后重新查看,已有照片不会受到影响。",
action: "重新查看",
},
invalid: {
title: "相册入口无效",
copy: "没有找到可访问的成员家谱,页面不会展示其他家谱相册。",
action: "返回上一页",
},
}[albumState.value]));
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
onLoad((query) => {
const count = Math.max(1, Math.min(Number(query.count) || baseAlbums.length, 30));
albums.value = Array.from({ length: count }, (_, index) => ({
...baseAlbums[index % baseAlbums.length],
id: String(201 + index),
name: count > baseAlbums.length ? `${baseAlbums[index % baseAlbums.length].name}${index + 1}` : baseAlbums[index].name,
}));
albumState.value = ["loading", "empty", "error"].includes(query.state) ? query.state : "ready";
genealogyId.value = String(query.genealogyId || "");
hasValidContext.value = ["owner", "member"].includes(
getGenealogyFixtureAccess(genealogyId.value).accessRole,
);
if (!genealogyId.value || !hasValidContext.value) {
albumState.value = "invalid";
return;
}
albums.value = listFamilyAlbumFixtures(genealogyId.value);
albumState.value = ["loading", "empty", "error"].includes(query.state)
? query.state
: albums.value.length
? "ready"
: "empty";
});
const openAlbum = (album) => uni.navigateTo({ url: `/pages/family/f08-album-detail?albumId=${album.id}` });
const openAlbum = (album) =>
openPage(
"F08",
{ genealogyId: genealogyId.value, albumId: String(album.id) },
"F07",
);
const createAlbum = () => { albumNameDraft.value = ""; albumNameError.value = ""; dialogVisible.value = true; };
const closeCreateDialog = () => { dialogVisible.value = false; };
const requestCloseCreateDialog = async () => {
if (!albumNameDraft.value.trim()) {
closeCreateDialog();
return true;
}
const confirmed = await requestDiscardConfirmation();
if (!confirmed) return false;
albumNameDraft.value = "";
albumNameError.value = "";
closeCreateDialog();
return true;
};
const confirmCreateAlbum = () => {
const name = albumNameDraft.value.trim();
if (!name) { albumNameError.value = "请填写相册名称"; return; }
albums.value.unshift({ id: String(Date.now()), name, photoCount: 0, updatedAt: "刚刚创建", description: "等待添加第一张照片", cover: "/static/assets/modules/family/f08/f08-reunion-hero.png" });
albumState.value = "ready";
localAlbumPreview.value = Object.freeze({ name });
albumNameDraft.value = "";
dialogVisible.value = false;
toastVisible.value = true;
toastTimer = setTimeout(() => { toastVisible.value = false; }, 1800);
};
const restoreAlbums = () => { albumState.value = "ready"; };
onUnmounted(() => { if (toastTimer) clearTimeout(toastTimer); });
const restoreAlbums = () => {
albums.value = listFamilyAlbumFixtures(genealogyId.value);
albumState.value = albums.value.length ? "ready" : "empty";
};
const handleStateAction = () => {
if (albumState.value === "invalid") return goBack();
if (albumState.value === "error") return restoreAlbums();
return createAlbum();
};
const requestBack = () => {
if (discardVisible.value) {
return runBackGuard({
transientOpen: true,
"close-transient": cancelDiscard,
});
}
if (dialogVisible.value) {
return runBackGuard({
transientOpen: true,
"close-transient": requestCloseCreateDialog,
});
}
return runBackGuard({
dirty: isDirty.value,
"confirm-discard": requestDiscardConfirmation,
});
};
onBackPress((event) => handleBackPress(event, requestBack));
onUnmounted(() => { discardConfirmation.dispose(); });
</script>
<style scoped lang="scss">
@@ -110,6 +207,10 @@ onUnmounted(() => { if (toastTimer) clearTimeout(toastTimer); });
.album-list-content { padding: 18rpx 24rpx 72rpx; }
.album-list-lead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8rpx 18rpx; min-height: 62rpx; padding: 0 20rpx; color: $ink-muted; font-size: 22rpx; background: url("/static/assets/modules/genealogy/transparent/section-divider.png") center / 100% auto no-repeat; }
.album-list { display: flex; flex-direction: column; gap: 16rpx; margin-top: 16rpx; }
.album-local-preview { @include adaptive.adaptive-family-field; margin-top: 16rpx; padding: 22rpx 24rpx; }
.album-local-preview text { display: block; color: $ink-muted; font-size: 22rpx; line-height: 1.5; }
.album-local-preview text:first-child { color: $brand-red; font-weight: 700; }
.album-local-preview text:nth-child(2) { margin-top: 6rpx; color: $ink; font-family: STKaiti, KaiTi, serif; font-size: 29rpx; font-weight: 700; }
.album-card, .album-state-card { @include adaptive.adaptive-family-content; width: 100%; }
.album-card { display: grid; grid-template-columns: minmax(150rpx, 0.7fr) minmax(0, 1.3fr); min-height: 210rpx; gap: 22rpx; padding: 30rpx 38rpx; }
.album-card__media { width: 100%; aspect-ratio: 4 / 3; align-self: center; }
+44 -30
View File
@@ -2,27 +2,25 @@
<template>
<view class="album-detail-page" :class="`album-state--${albumState}`">
<ModulePageBackground module="family" />
<view class="album-detail-header"><PageHeader title="相册详情" /></view>
<view class="album-detail-header"><PageHeader title="相册详情" custom-back @back="requestBack" /></view>
<view class="album-detail-content">
<view v-if="albumState === 'expired'" class="album-expired-state">
<view class="album-state-card__body">
<text class="album-state-card__eyebrow">相册状态</text>
<text class="album-state-card__title">相册已失效</text>
<text class="album-state-card__copy">这个相册已无法查看</text>
<AppButton block label="返回相册列表" @click="returnToAlbums" />
<text class="album-state-card__title">相册已失效或入口无效</text>
<text class="album-state-card__copy">当前家谱中没有找到这本相册页面不会回退到其他相册</text>
<AppButton block :label="genealogyId ? '返回相册列表' : '返回上一页'" @click="returnToAlbums" />
</view>
</view>
<template v-else>
<view class="album-heading">
<text class="album-heading__eyebrow">家族影像 · 2024</text>
<text class="album-heading__title">2024 春节团圆</text>
<text class="album-heading__copy"
>一家人围坐团圆让今朝欢聚与祖居旧影留在同一本相册里</text
>
<text class="album-heading__eyebrow">家族影像</text>
<text class="album-heading__title">{{ album.name }}</text>
<text class="album-heading__copy">{{ album.description }}</text>
<text class="album-heading__count"
>{{ albumState === "empty" ? "0 张照片" : "5 张照片" }}</text
>{{ albumState === "empty" ? "0 张照片" : `${photos.length} 张照片` }}</text
>
</view>
@@ -102,20 +100,23 @@ import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { findFamilyAlbumFixture } from "@/data/mock.js";
import {
goBack,
handleBackPress,
openPage,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
const albumState = ref("normal");
const genealogyId = ref("");
const albumId = ref("");
const album = ref(null);
const photos = ref([]);
const previewVisible = ref(false);
const previewIndex = ref(0);
const photos = [
{ src: "/static/assets/modules/family/f08/f08-reunion-hero.png", alt: "春节团圆时三代家人的合影", caption: "除夕团圆 · 2024" },
{ src: "/static/assets/modules/family/f08/f08-family-portrait.png", alt: "家人在院落前的春节合影", caption: "院前合影 · 2024" },
{ src: "/static/assets/modules/family/f08/f08-reunion-table.png", alt: "家人围坐吃年夜饭", caption: "围桌守岁 · 2024" },
{ src: "/static/assets/modules/family/f08/f08-ancestral-home.png", alt: "祖居院落的复古旧照", caption: "祖居旧影 · 1968" },
{ src: "/static/assets/modules/family/f08/f08-ancestral-portrait.png", alt: "老一辈家人在祖居门前的合影", caption: "门前合影 · 1972" },
];
const openPreview = (index) => {
previewIndex.value = index;
previewVisible.value = true;
@@ -128,16 +129,27 @@ const closePreview = () => {
};
const toUpload = () =>
uni.navigateTo({
url: `/pages/family/f09-media-upload?albumId=${albumId.value}`,
});
openPage(
"F09",
{ genealogyId: genealogyId.value, albumId: albumId.value },
"F08",
);
const returnToAlbums = () => {
uni.redirectTo({ url: "/pages/family/f07-album-list" });
};
const returnToAlbums = () =>
genealogyId.value
? returnTo("F07", { genealogyId: genealogyId.value })
: goBack();
onLoad((query) => {
albumId.value = query.albumId || "reunion";
genealogyId.value = String(query.genealogyId || "");
albumId.value = String(query.albumId || "");
album.value = findFamilyAlbumFixture(genealogyId.value, albumId.value);
photos.value = album.value?.photos || [];
if (!album.value) {
albumState.value = "expired";
previewVisible.value = false;
return;
}
albumState.value =
query.state === "empty"
? "empty"
@@ -149,11 +161,13 @@ onLoad((query) => {
previewVisible.value = albumState.value === "preview";
});
onBackPress(() => {
if (!previewVisible.value) return false;
closePreview();
return true;
});
const requestBack = () =>
runBackGuard({
transientOpen: previewVisible.value,
"close-transient": closePreview,
});
onBackPress((event) => handleBackPress(event, requestBack));
</script>
+131 -158
View File
@@ -5,46 +5,55 @@
:class="`media-upload-state--${uploadState}`"
>
<ModulePageBackground module="family" />
<view class="media-upload-header"><PageHeader title="上传照片" /></view>
<view class="media-upload-header"><PageHeader title="添加照片" custom-back @back="requestBack" /></view>
<view class="media-upload-content">
<view class="media-album-card">
<view v-if="uploadState === 'invalid'" class="media-invalid-card">
<text class="media-state-card__eyebrow">相册入口无效</text>
<text class="media-state-card__title">没有找到当前相册</text>
<text class="media-state-card__copy">页面不会把照片归入其他家谱或其他相册</text>
<view class="media-preview-action" @click="returnFromInvalid">
<AppButton block :label="genealogyId ? '返回相册列表' : '返回上一页'" />
</view>
</view>
<view v-else class="media-album-card">
<image
class="media-album-card__cover"
:src="mockLibrary[0].src"
:alt="mockLibrary[0].alt"
:src="album.cover"
:alt="album.name"
mode="aspectFill"
/>
<view class="media-album-card__copy">
<text class="media-album-card__eyebrow">当前相册</text>
<text class="media-album-card__title">2024 春节团圆</text>
<text class="media-album-card__title">{{ album.name }}</text>
<text class="media-album-card__limit">最多可选择 9 </text>
</view>
</view>
<view v-if="uploadState === 'permission'" class="media-permission-card">
<view v-if="uploadState === 'permission' && album" class="media-permission-card">
<text class="media-state-card__eyebrow">照片访问权限</text>
<text class="media-state-card__title">需要照片访问权限</text>
<text class="media-state-card__copy"
>授权后才能选择要加入当前相册的照片当前仅展示 H5 审核状态</text
>授权后才能选择照片当前只验证选择与说明流程不会上传</text
>
<view class="media-permission-action" @click="selectMockPhotos">
<AppButton block label="重新授权" />
</view>
</view>
<view v-else-if="uploadState === 'success'" class="media-success-card">
<text class="media-state-card__eyebrow">上传结果</text>
<text class="media-success-title">4 张照片已上传</text>
<view v-else-if="uploadState === 'preview'" class="media-preview-card">
<text class="media-state-card__eyebrow">本地流程预览</text>
<text class="media-preview-title">{{ selectedPhotos.length }} 张照片已完成本地校验</text>
<text class="media-state-card__copy"
>照片已加入2024 春节团圆可以返回相册继续查看</text
>照片尚未上传也没有加入{{ album.name }}返回后不会保存</text
>
<view class="media-success-action" @click="returnToAlbum">
<AppButton block label="返回当前相册" />
<view class="media-preview-action" @click="returnToAlbum">
<AppButton block label="返回当前相册(不上传)" />
</view>
</view>
<template v-else>
<template v-else-if="album">
<view class="media-section-heading">
<text>选择照片</text>
<text>{{ selectedPhotos.length }} / {{ MAX_PHOTOS }}</text>
@@ -57,7 +66,6 @@
class="media-photo-tile"
:class="{
'media-photo-tile--active': index === activePhotoIndex,
'media-photo-tile--failed': photo.status === 'error',
}"
@click="selectPhoto(index)"
>
@@ -80,21 +88,6 @@
>
<text>删除</text>
</view>
<text
v-if="photo.status === 'error'"
class="media-photo-status media-photo-status--error"
>上传失败</text
>
<text
v-else-if="photo.status === 'uploading'"
class="media-photo-status media-photo-status--uploading"
>{{ photo.progress }}%</text
>
<text
v-else-if="photo.status === 'uploaded'"
class="media-photo-status media-photo-status--uploaded"
>已上传</text
>
</view>
<view
@@ -162,104 +155,95 @@
</view>
</view>
<template v-if="uploadState === 'uploading'">
<text class="media-progress-copy"
>正在上传 2/{{ selectedPhotos.length }}</text
>
<view class="media-progress-action">
<AppButton block label="正在上传" />
</view>
</template>
<view
v-else-if="uploadState === 'error'"
class="media-retry-action"
@click="retryFailed"
>
<AppButton block label="重试 2 张失败照片" />
</view>
<view v-else class="media-primary-action" @click="startUpload">
<view class="media-primary-action" @click="generatePreview">
<AppButton
block
:disabled="isSubmitting"
:label="
selectedPhotos.length
? `上传 ${selectedPhotos.length} 张照片`
isSubmitting
? '正在校验'
: selectedPhotos.length
? `生成 ${selectedPhotos.length} 张照片预览`
: '选择照片'
"
/>
</view>
</template>
</view>
<AppDialog
:visible="discardVisible"
title="放弃照片草稿?"
message="已选择的照片和说明尚未上传,确认返回后不会保留。"
confirm-text="放弃并返回"
cancel-text="继续整理"
show-cancel
:close-on-mask="false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</view>
</template>
<script setup>
import { computed, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad, onUnload } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { findFamilyAlbumFixture } from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
handleBackPress,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
const MAX_PHOTOS = 9;
const genealogyId = ref("");
const albumId = ref("");
const album = ref(null);
const uploadState = ref("initial");
const activePhotoIndex = ref(0);
const batchDescription = ref("");
const validationMessage = ref("");
const selectedPhotos = ref([]);
const isSubmitting = ref(false);
const discardVisible = ref(false);
let previewTimer = null;
const mockLibrary = [
{
id: "reunion",
src: "/static/assets/modules/family/f08/f08-reunion-hero.png",
alt: "春节团圆时三代家人的合影",
note: "",
},
{
id: "portrait",
src: "/static/assets/modules/family/f08/f08-family-portrait.png",
alt: "家人在院落前的春节合影",
note: "",
},
{
id: "table",
src: "/static/assets/modules/family/f08/f08-reunion-table.png",
alt: "家人围坐吃年夜饭",
note: "",
},
{
id: "home",
src: "/static/assets/modules/family/f08/f08-ancestral-home.png",
alt: "祖居院落的复古旧照",
note: "",
},
{
id: "ancestor",
src: "/static/assets/modules/family/f08/f08-ancestral-portrait.png",
alt: "老一辈家人在祖居门前的合影",
note: "",
},
{ id: "reunion", src: "/static/assets/modules/family/f08/f08-reunion-hero.png", alt: "春节团圆时三代家人的合影", note: "" },
{ id: "portrait", src: "/static/assets/modules/family/f08/f08-family-portrait.png", alt: "家人在院落前的春节合影", note: "" },
{ id: "table", src: "/static/assets/modules/family/f08/f08-reunion-table.png", alt: "家人围坐吃年夜饭", note: "" },
{ id: "home", src: "/static/assets/modules/family/f08/f08-ancestral-home.png", alt: "祖居院落的复古旧照", note: "" },
{ id: "ancestor", src: "/static/assets/modules/family/f08/f08-ancestral-portrait.png", alt: "老一辈家人在祖居门前的合影", note: "" },
];
const selectedPhotos = ref([]);
const albumId = ref("");
const activePhoto = computed(
() => selectedPhotos.value[activePhotoIndex.value] || null,
);
const isLocked = computed(() => uploadState.value === "uploading");
const isLocked = computed(() => isSubmitting.value);
const isDirty = computed(() =>
Boolean(
selectedPhotos.value.length ||
batchDescription.value.trim() ||
selectedPhotos.value.some((photo) => photo.note.trim()),
),
);
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const makeSelectedPhotos = (state) =>
mockLibrary.slice(0, 4).map((photo, index) => ({
...photo,
note: "",
progress: state === "uploading" ? [100, 62, 35, 0][index] : 0,
status:
state === "error"
? index < 2
? "error"
: "uploaded"
: state,
}));
const makeSelectedPhotos = () =>
mockLibrary.slice(0, 4).map((photo) => ({ ...photo, note: "" }));
const selectMockPhotos = () => {
selectedPhotos.value = makeSelectedPhotos("selected");
selectedPhotos.value = makeSelectedPhotos();
activePhotoIndex.value = 0;
validationMessage.value = "";
uploadState.value = "selected";
@@ -286,8 +270,6 @@ const addMockPhoto = () => {
...next,
id: `${next.id}-${nextIndex + 1}`,
note: "",
progress: 0,
status: "selected",
});
};
@@ -297,7 +279,8 @@ const updateActiveNote = (event) => {
}
};
const startUpload = () => {
const generatePreview = () => {
if (isSubmitting.value || !album.value) return;
if (!selectedPhotos.value.length) {
selectMockPhotos();
return;
@@ -307,40 +290,59 @@ const startUpload = () => {
return;
}
validationMessage.value = "";
selectedPhotos.value = selectedPhotos.value.map((photo, index) => ({
...photo,
progress: [100, 62, 35, 0][index] || 0,
status: "uploading",
}));
uploadState.value = "uploading";
isSubmitting.value = true;
const selectedCount = selectedPhotos.value.length;
const timer = setTimeout(() => {
if (previewTimer !== timer) return;
previewTimer = null;
isSubmitting.value = false;
uploadState.value = selectedCount > 0 ? "preview" : "selected";
}, 280);
previewTimer = timer;
};
const retryFailed = () => {
selectedPhotos.value = selectedPhotos.value.map((photo, index) => ({
...photo,
progress: [100, 62, 35, 0][index] || 0,
status: "uploading",
}));
uploadState.value = "uploading";
};
const returnToAlbum = () => {
uni.redirectTo({
url: `/pages/family/f08-album-detail?albumId=${albumId.value}`,
const returnToAlbum = () =>
returnTo("F08", {
genealogyId: genealogyId.value,
albumId: albumId.value,
});
const returnFromInvalid = () =>
genealogyId.value
? returnTo("F07", { genealogyId: genealogyId.value })
: goBack();
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
submitting: isSubmitting.value,
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
};
onLoad((query) => {
albumId.value = query.albumId || "reunion";
uploadState.value = ["permission", "selected", "uploading", "error", "success"].includes(query.state)
genealogyId.value = String(query.genealogyId || "");
albumId.value = String(query.albumId || "");
album.value = findFamilyAlbumFixture(genealogyId.value, albumId.value);
if (!album.value) {
uploadState.value = "invalid";
return;
}
uploadState.value = ["permission", "selected", "preview"].includes(query.state)
? query.state
: "initial";
if (!["initial", "permission"].includes(uploadState.value)) {
selectedPhotos.value = makeSelectedPhotos(uploadState.value);
if (["selected", "preview"].includes(uploadState.value)) {
selectedPhotos.value = makeSelectedPhotos();
batchDescription.value = "春节团圆照片整理";
}
});
onBackPress((event) => handleBackPress(event, requestBack));
onUnload(() => {
if (previewTimer) clearTimeout(previewTimer);
discardConfirmation.dispose();
});
</script>
<style scoped lang="scss">
@@ -379,9 +381,7 @@ onLoad((query) => {
.media-state-card__eyebrow,
.media-state-card__title,
.media-state-card__copy,
.media-success-title,
.media-photo-status,
.media-progress-copy {
.media-preview-title {
display: block;
}
.media-album-card__eyebrow {
@@ -437,17 +437,12 @@ onLoad((query) => {
outline: 4rpx solid rgba(159, 44, 35, 0.78);
outline-offset: -4rpx;
}
.media-photo-tile--failed {
border-style: dashed;
border-color: #9f2c23;
}
.media-photo-tile__image {
width: 100%;
height: 100%;
}
.media-photo-order,
.media-photo-current,
.media-photo-status {
.media-photo-current {
position: absolute;
z-index: 2;
color: #fffaf0;
@@ -485,21 +480,6 @@ onLoad((query) => {
padding: 7rpx 8rpx;
background: rgba(145, 36, 29, 0.88);
}
.media-photo-status {
right: 0;
bottom: 0;
left: 0;
padding: 7rpx 8rpx;
background: rgba(58, 43, 32, 0.82);
text-align: center;
}
.media-photo-status--error {
background: rgba(132, 35, 29, 0.92);
font-weight: 700;
}
.media-photo-status--uploaded {
background: rgba(55, 82, 51, 0.88);
}
.media-add-tile {
display: flex;
min-height: 44px;
@@ -591,19 +571,12 @@ onLoad((query) => {
font-size: 21rpx;
line-height: 1.45;
}
.media-primary-action,
.media-retry-action,
.media-progress-action {
.media-primary-action {
margin-top: 24rpx;
}
.media-progress-copy {
margin-top: 22rpx;
color: $ink;
font-size: 23rpx;
text-align: center;
}
.media-permission-card,
.media-success-card {
.media-preview-card,
.media-invalid-card {
@include adaptive.adaptive-family-panel;
min-height: 410rpx;
margin-top: 24rpx;
@@ -617,7 +590,7 @@ onLoad((query) => {
letter-spacing: 2rpx;
}
.media-state-card__title,
.media-success-title {
.media-preview-title {
margin-top: 12rpx;
color: $ink;
font-family: STKaiti, KaiTi, serif;
@@ -631,7 +604,7 @@ onLoad((query) => {
line-height: 1.65;
}
.media-permission-action,
.media-success-action {
.media-preview-action {
margin-top: 30rpx;
}
@media (max-width: 340px) {
+27 -10
View File
@@ -1,6 +1,6 @@
<!-- 页面编号F-10用途家族视频待开放状态 -->
<template>
<view class="video-status-page">
<view class="video-status-page" :class="{ 'video-status-state--invalid': !hasValidContext }">
<ModulePageBackground module="family" />
<view class="video-status-header"><PageHeader title="家族视频" /></view>
@@ -15,13 +15,11 @@
<view class="video-status-card">
<view class="video-status-card__body">
<text class="video-status-card__eyebrow">视频 · 服务说明</text>
<text class="video-status-card__title">视频服务暂未开放</text>
<text class="video-status-card__copy"
>开放后可在这里浏览家族影像与纪念视频</text
>
<text class="video-status-card__eyebrow">{{ hasValidContext ? '视频 · 服务说明' : '页面入口' }}</text>
<text class="video-status-card__title">{{ hasValidContext ? '视频服务暂未开放' : '家谱身份无效' }}</text>
<text class="video-status-card__copy">{{ hasValidContext ? '开放后可在这里浏览当前家谱的影像与纪念视频。' : '请从一个可访问的成员家谱重新进入,页面不会展示其他家谱内容。' }}</text>
<view class="video-return-action" @click="returnToFamily">
<AppButton block label="返回家族首页" />
<AppButton block :label="hasValidContext ? '返回家族首页' : '返回上一页'" />
</view>
</view>
</view>
@@ -30,13 +28,32 @@
</template>
<script setup>
import { computed, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { getGenealogyFixtureAccess } from "@/data/mock.js";
import { goBack, returnTo } from "@/utils/navigation.js";
const returnToFamily = () => {
uni.reLaunch({ url: "/pages/family/f01-family-feed" });
};
const genealogyId = ref("");
const hasValidContext = computed(() =>
Boolean(
genealogyId.value &&
["owner", "member"].includes(
getGenealogyFixtureAccess(genealogyId.value).accessRole,
),
),
);
onLoad((query) => {
genealogyId.value = String(query.genealogyId || "");
});
const returnToFamily = () =>
hasValidContext.value
? returnTo("F01", { genealogyId: genealogyId.value })
: goBack();
</script>
<style scoped lang="scss">
+153 -66
View File
@@ -7,6 +7,7 @@
<GenealogyPageBackground />
<PageHeader
root
notice
title="我的家谱"
:unread-count="unreadCount"
@notice="toNotifications"
@@ -44,6 +45,12 @@
</view>
</view>
<view v-else-if="contextInvalidated" class="state-panel state-panel--context">
<text class="state-title">当前家谱已不可用</text>
<text class="state-copy">权限或家谱列表可能已经变化请明确选择仍可访问的家谱</text>
<AppButton block label="选择可用家谱" @click="openSwitcher" />
</view>
<template v-else-if="hasGenealogies">
<view class="genealogy-fixed-zone">
<view class="current-slip" @click="openSwitcher">
@@ -132,6 +139,7 @@
:key="item.id"
:genealogy="item"
role="成员"
:selected="item.id === currentGenealogy.id"
@select="openGenealogy"
/>
</view>
@@ -310,13 +318,15 @@
/>
</view>
<scroll-view class="genealogy-switcher__list" scroll-y>
<view
<button
v-for="item in availableGenealogies"
:key="item.id"
class="switcher-item"
:class="{
'switcher-item--active': item.id === selectedGenealogyId,
}"
:aria-pressed="item.id === selectedGenealogyId"
:aria-label="`${item.name}${item.location}${item.memberCount} 位成员`"
@click="selectGenealogy(item)"
>
<view>
@@ -328,7 +338,7 @@
<text class="switcher-item__state">{{
item.id === selectedGenealogyId ? "当前" : "选择"
}}</text>
</view>
</button>
</scroll-view>
</view>
</view>
@@ -347,21 +357,25 @@ import AppButton from "@/components/AppButton.vue";
import GenealogyCard from "@/components/GenealogyCard.vue";
import GenealogyPageBackground from "@/components/GenealogyPageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { genealogies, notifications } from "@/data/mock.js";
import {
findGenealogyFixture,
genealogies,
getGenealogyFixtureAccess,
listNotificationFixtures,
} from "@/data/mock.js";
import { genealogyContext } from "@/utils/genealogy-context.js";
import { handleBackPress, openPage, runBackGuard } from "@/utils/navigation.js";
const isLoading = ref(false);
const hasError = ref(false);
const list = ref(genealogies);
const forceEmptyState = ref(false);
const contextInvalidated = ref(false);
const contextReconcileFailed = ref(false);
const requestedGenealogyId = ref("");
const addDialogVisible = ref(false);
const switcherVisible = ref(false);
const storedGenealogyId = Number(genealogyContext.getCurrentGenealogyId());
const selectedGenealogyId = ref(
genealogies.some((item) => item.id === storedGenealogyId)
? storedGenealogyId
: genealogies[0]?.id || null,
);
const selectedGenealogyId = ref(null);
const listScrollCommand = ref(0);
const currentListScrollTop = ref(0);
@@ -376,41 +390,75 @@ const syncEmptyStateFromRoute = (query = {}) => {
hasError.value = presentationState === "error";
};
onLoad((query) => {
const requestedId = Number(query?.genealogyId);
if (genealogies.some((item) => item.id === requestedId)) {
selectedGenealogyId.value = requestedId;
genealogyContext.setCurrentGenealogyId(requestedId);
} else if (selectedGenealogyId.value) {
genealogyContext.setCurrentGenealogyId(selectedGenealogyId.value);
const reconcilePageGenealogyContext = () => {
try {
const availableIds = list.value.map((item) => String(item.id));
const previousId = genealogyContext.getCurrentGenealogyId();
selectedGenealogyId.value =
genealogyContext.reconcileCurrentGenealogyId(
availableIds,
requestedGenealogyId.value,
) ||
null;
contextReconcileFailed.value = false;
contextInvalidated.value = Boolean(
availableIds.length &&
!selectedGenealogyId.value &&
(requestedGenealogyId.value ||
previousId ||
genealogyContext.isCurrentGenealogyInvalidated()),
);
return true;
} catch {
genealogyContext.invalidateCurrentGenealogyId();
selectedGenealogyId.value = null;
contextReconcileFailed.value = true;
contextInvalidated.value = false;
hasError.value = true;
return false;
}
};
onLoad((query) => {
syncEmptyStateFromRoute(query);
requestedGenealogyId.value = String(query?.genealogyId || "");
reconcilePageGenealogyContext();
});
const unreadCount = computed(
() => notifications.filter((item) => item.unread).length,
() => listNotificationFixtures().filter((item) => item.unread).length,
);
const hasGenealogies = computed(
() => !forceEmptyState.value && list.value.length > 0,
);
const isListLayout = computed(
() => !isLoading.value && !hasError.value && hasGenealogies.value,
() =>
!isLoading.value &&
!hasError.value &&
!contextInvalidated.value &&
hasGenealogies.value,
);
const createdGenealogies = computed(() =>
list.value.filter((item) => item.membership === "created"),
list.value.filter(
(item) => getGenealogyFixtureAccess(item.id).accessRole === "owner",
),
);
const joinedGenealogies = computed(() =>
list.value.filter((item) => item.membership === "joined"),
list.value.filter(
(item) => getGenealogyFixtureAccess(item.id).accessRole === "member",
),
);
const availableGenealogies = computed(() => list.value);
const currentGenealogy = computed(
() =>
availableGenealogies.value.find(
(item) => item.id === selectedGenealogyId.value,
) || availableGenealogies.value[0],
) || null,
);
const isCurrentGenealogyOwner = computed(
() => currentGenealogy.value?.membership === "created",
() =>
getGenealogyFixtureAccess(currentGenealogy.value?.id).accessRole ===
"owner",
);
const currentRoleLabel = computed(() =>
isCurrentGenealogyOwner.value ? "管理员" : "成员",
@@ -420,26 +468,29 @@ const currentRoleLabel = computed(() =>
const applicationRecords = [
{
id: "pending",
name: "汤氏南阳宗谱",
genealogyId: "2003",
statusLabel: "审核中",
tone: "pending",
description: "申请已提交,等待管理员审核",
},
{
id: "rejected",
name: "汤氏清河家谱",
genealogyId: "2004",
statusLabel: "被拒绝",
tone: "rejected",
description: "可修改关系说明后重新申请",
},
{
id: "removed",
name: "汤氏汝南支谱",
genealogyId: "2005",
statusLabel: "已退出",
tone: "muted",
description: "如需恢复成员身份,可重新申请加入",
},
];
].map((record) => ({
...record,
name: findGenealogyFixture(record.genealogyId)?.name || "未知家谱",
}));
const shortcuts = [
{
@@ -469,22 +520,34 @@ const visibleShortcuts = computed(() =>
: shortcuts.filter((item) => item.key !== "applications"),
);
const openGenealogy = (genealogy) => {
genealogyContext.setCurrentGenealogyId(genealogy.id);
uni.navigateTo({
url: `/pages/genealogy/g05-genealogy-overview?genealogyId=${genealogy.id}`,
});
const openGenealogy = (genealogy) =>
openPage("G05", { genealogyId: String(genealogy.id) }, "G01").then(
(opened) => {
if (opened) {
selectedGenealogyId.value = String(genealogy.id);
genealogyContext.setCurrentGenealogyId(genealogy.id);
}
return opened;
},
);
const createGenealogy = () => {
closeAddDialog();
return openPage("G03", {}, "G01");
};
const applyToJoin = () => {
closeAddDialog();
return openPage("G06", {}, "G01");
};
const joinByInvite = () => {
closeAddDialog();
return openPage("G06", { mode: "invite" }, "G01");
};
const toNotifications = () => {
const notificationParams = currentGenealogy.value
? { genealogyId: String(currentGenealogy.value.id) }
: {};
return openPage("N01", notificationParams, "G01");
};
const createGenealogy = () =>
uni.navigateTo({ url: "/pages/genealogy/g03-create-genealogy" });
const applyToJoin = () =>
uni.navigateTo({ url: "/pages/genealogy/g06-search-genealogies" });
const joinByInvite = () =>
uni.navigateTo({
url: "/pages/genealogy/g06-search-genealogies?mode=invite",
});
const toNotifications = () =>
uni.navigateTo({ url: "/pages/notification/n01-message-center" });
const openAddDialog = () => {
addDialogVisible.value = true;
@@ -492,23 +555,25 @@ const openAddDialog = () => {
const closeAddDialog = () => {
addDialogVisible.value = false;
};
onBackPress(() => {
if (switcherVisible.value) {
closeSwitcher();
return true;
}
if (addDialogVisible.value) {
closeAddDialog();
return true;
}
return false;
});
const openSwitcher = () => {
switcherVisible.value = true;
};
const closeSwitcher = () => {
switcherVisible.value = false;
};
const closeActiveOverlay = () => {
if (switcherVisible.value) closeSwitcher();
else closeAddDialog();
};
const requestBack = () =>
runBackGuard({
transientOpen: switcherVisible.value || addDialogVisible.value,
"close-transient": closeActiveOverlay,
});
onBackPress((event) => {
if (!switcherVisible.value && !addDialogVisible.value) return false;
return handleBackPress(event, requestBack);
});
const handleListScroll = (event) => {
currentListScrollTop.value = Number(event?.detail?.scrollTop || 0);
};
@@ -519,33 +584,44 @@ const resetListScroll = async () => {
currentListScrollTop.value = 0;
};
const selectGenealogy = async (genealogy) => {
selectedGenealogyId.value = genealogy.id;
genealogyContext.setCurrentGenealogyId(genealogy.id);
selectedGenealogyId.value = String(genealogy.id);
genealogyContext.setCurrentGenealogyId(String(genealogy.id));
contextInvalidated.value = false;
closeSwitcher();
await resetListScroll();
};
const openApplication = (record) => {
const statusQuery = record.id === "pending" ? "pending" : record.id;
uni.navigateTo({
url: `/pages/genealogy/g09-my-applications?status=${statusQuery}`,
});
if (record.id === "pending")
return openPage("G09", { status: "pending" }, "G01");
return openPage(
"G08",
{
genealogyId: String(record.genealogyId),
source: "search",
},
"G01",
);
};
const retryLoad = () => {
if (contextReconcileFailed.value) {
hasError.value = false;
reconcilePageGenealogyContext();
return;
}
hasError.value = false;
isLoading.value = false;
};
const openShortcut = (key) => {
if (!currentGenealogy.value) return;
const genealogyId = currentGenealogy.value.id;
genealogyContext.setCurrentGenealogyId(genealogyId);
const paths = {
tree: `/pages/tree/t01-tree-overview?genealogyId=${currentGenealogy.value.id}`,
members: `/pages/genealogy/g05-genealogy-overview?genealogyId=${currentGenealogy.value.id}`,
poem: `/pages/genealogy/g12-generation-poems?genealogyId=${currentGenealogy.value.id}`,
applications: `/pages/genealogy/g10-application-review?genealogyId=${currentGenealogy.value.id}`,
const genealogyId = String(currentGenealogy.value.id);
const actions = {
tree: () => openPage("T01", { genealogyId }, "G01"),
members: () => openPage("G05", { genealogyId }, "G01"),
poem: () => openPage("G12", { genealogyId }, "G01"),
applications: () => openPage("G10", { genealogyId }, "G01"),
};
uni.navigateTo({ url: paths[key] });
return actions[key]?.();
};
</script>
@@ -869,6 +945,10 @@ const openShortcut = (key) => {
padding: 0;
}
.state-panel--context > .app-button {
margin-top: 30rpx;
}
.error-panel__content {
display: flex;
width: 100%;
@@ -1189,9 +1269,16 @@ const openShortcut = (key) => {
align-items: center;
justify-content: space-between;
box-sizing: border-box;
margin: 0;
padding: 18rpx 16rpx;
border: 1rpx solid transparent;
border-bottom-color: rgba(181, 138, 75, 0.42);
background: transparent;
line-height: normal;
text-align: left;
}
.switcher-item::after {
border: 0;
}
.switcher-item__name,
.switcher-item__meta {
+129 -53
View File
@@ -6,7 +6,7 @@
<PageHeader
:title="isAncestorStep ? '录入首代人物' : '创建家谱'"
custom-back
@back="goBack"
@back="requestBack"
/>
<view class="flow-content">
@@ -73,22 +73,15 @@
<text class="flow-rule__label">访问规则</text>
<view class="flow-rule__options">
<view
v-for="option in GENEALOGY_ACCESS_PRESET_OPTIONS"
:key="option.value"
class="flow-rule__option"
:class="{
'flow-rule__option--active':
createForm.visibility === 'MEMBER_ONLY',
createForm.accessPreset === option.value,
}"
@click="createForm.visibility = 'MEMBER_ONLY'"
>仅成员可见</view
>
<view
class="flow-rule__option"
:class="{
'flow-rule__option--active':
createForm.visibility === 'SEARCHABLE',
}"
@click="createForm.visibility = 'SEARCHABLE'"
>可搜索申请</view
@click="createForm.accessPreset = option.value"
>{{ option.label }}</view
>
</view>
</view>
@@ -223,7 +216,7 @@
<view class="flow-success-dialog__content">
<text class="flow-success-dialog__title">家谱创建完成</text>
<text class="flow-success-dialog__copy"
>首代人物已保存接下来进入家谱总览继续完善资料</text
>当前为本地流程预览资料尚未提交服务器可进入总览继续检查页面</text
>
<view class="flow-success-dialog__action" @click="enterOverview">
<text>进入家谱总览</text>
@@ -231,14 +224,40 @@
</view>
</view>
</view>
<AppDialog
:visible="discardVisible"
title="放弃创建?"
message="当前填写内容尚未保存,确认返回后将清空。"
confirm-text="放弃并返回"
cancel-text="继续填写"
show-cancel
compact-actions
:close-on-mask="false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</view>
</template>
<script setup>
import { computed, onUnmounted, reactive, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { computed, reactive, ref } from "vue";
import { onBackPress, onUnload } from "@dcloudio/uni-app";
import AppDialog from "@/components/AppDialog.vue";
import GenealogyPageBackground from "@/components/GenealogyPageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import {
createLocalGenealogyPreview,
removeLocalGenealogyPreview,
updateLocalGenealogyPreview,
updateLocalGenealogyPreviewAncestor,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
GENEALOGY_ACCESS_PRESET,
GENEALOGY_ACCESS_PRESET_OPTIONS,
} from "@/utils/genealogy-contracts.js";
import { handleBackPress, openPage, returnTo, runBackGuard } from "@/utils/navigation.js";
const currentStep = ref("create");
const genealogyId = ref("");
@@ -246,6 +265,7 @@ const isSubmitting = ref(false);
const createState = ref("form");
const ancestorState = ref("form");
const duplicateReminderVisible = ref(false);
const discardVisible = ref(false);
const fieldErrors = reactive({
surname: "",
name: "",
@@ -258,7 +278,7 @@ const createForm = reactive({
name: "",
hall: "",
location: "",
visibility: "MEMBER_ONLY",
accessPreset: GENEALOGY_ACCESS_PRESET.MEMBER_ONLY,
});
const ancestorForm = reactive({
personName: "",
@@ -286,31 +306,69 @@ const changeAncestorBirthDate = (event) => {
};
const isAncestorStep = computed(() => currentStep.value === "ancestor");
const isDirty = computed(() =>
isAncestorStep.value
? Boolean(
ancestorForm.personName ||
ancestorForm.birthDate ||
ancestorForm.introduction ||
ancestorForm.sex !== "0",
)
: Boolean(
createForm.surname ||
createForm.name ||
createForm.hall ||
createForm.location ||
createForm.accessPreset !== GENEALOGY_ACCESS_PRESET.MEMBER_ONLY,
),
);
const syncFlowFromRoute = (query = {}) => {
const isAncestorRoute = query?.step === "ancestor";
const routeGenealogyId = query?.genealogyId || "";
currentStep.value = isAncestorRoute ? "ancestor" : "create";
genealogyId.value =
routeGenealogyId || (isAncestorStep.value ? "local-created-genealogy" : "");
};
onLoad((query) => {
syncFlowFromRoute(query);
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
onUnmounted(() => {
if (submitTimer) clearTimeout(submitTimer);
});
const goBack = () => {
if (isAncestorStep.value) {
uni.redirectTo({ url: "/pages/genealogy/g03-create-genealogy" });
return;
const requestRawDiscardConfirmation = discardConfirmation.request;
const requestDiscardConfirmation = async () => {
const confirmed = await requestRawDiscardConfirmation();
if (confirmed && currentStep.value === "create" && genealogyId.value) {
removeLocalGenealogyPreview(genealogyId.value);
genealogyId.value = "";
}
uni.navigateBack();
return confirmed;
};
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
onUnload(() => {
const timer = submitTimer;
submitTimer = null;
if (timer) clearTimeout(timer);
discardConfirmation.dispose();
});
const closeActiveTransient = () => {
if (duplicateReminderVisible.value) closeDuplicateReminder();
else cancelDiscard();
};
const popInternalTrail = () => {
currentStep.value = "create";
ancestorState.value = "form";
return true;
};
const requestBack = () => {
if (ancestorState.value === "success") return enterOverview();
return runBackGuard({
transientOpen: duplicateReminderVisible.value || discardVisible.value,
internalTrail: isAncestorStep.value && !isSubmitting.value,
dirty: isDirty.value,
submitting: isSubmitting.value,
"close-transient": closeActiveTransient,
"pop-internal-trail": popInternalTrail,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
};
onBackPress((event) => handleBackPress(event, requestBack));
const clearFieldError = (field) => {
fieldErrors[field] = "";
@@ -333,23 +391,31 @@ const submitCreate = () => {
const closeDuplicateReminder = () => {
duplicateReminderVisible.value = false;
};
const searchExistingGenealogy = () =>
uni.navigateTo({ url: "/pages/genealogy/g06-search-genealogies" });
const confirmCreate = () => {
const searchExistingGenealogy = () => {
closeDuplicateReminder();
return openPage("G06", {}, "G03");
};
const confirmCreate = () => {
if (isSubmitting.value) return;
closeDuplicateReminder();
const createSnapshot = Object.freeze({ ...createForm });
isSubmitting.value = true;
createState.value = "submitting";
submitTimer = setTimeout(() => {
const timer = setTimeout(() => {
if (submitTimer !== timer) return;
submitTimer = null;
isSubmitting.value = false;
if (createForm.name.trim() === "失败") {
if (createSnapshot.name.trim() === "失败") {
createState.value = "error";
return;
}
const createdId = "local-created-genealogy";
uni.redirectTo({
url: `/pages/genealogy/g03-create-genealogy?step=ancestor&genealogyId=${createdId}`,
});
genealogyId.value =
updateLocalGenealogyPreview(genealogyId.value, createSnapshot) ||
createLocalGenealogyPreview(createSnapshot);
currentStep.value = "ancestor";
createState.value = "form";
}, 320);
submitTimer = timer;
};
const submitAncestor = () => {
@@ -363,19 +429,29 @@ const submitAncestor = () => {
return;
}
const ancestorSnapshot = Object.freeze({ ...ancestorForm });
isSubmitting.value = true;
ancestorState.value = "submitting";
submitTimer = setTimeout(() => {
const timer = setTimeout(() => {
if (submitTimer !== timer) return;
submitTimer = null;
isSubmitting.value = false;
ancestorState.value =
ancestorForm.personName.trim() === "失败" ? "error" : "success";
if (ancestorSnapshot.personName.trim() === "失败") {
ancestorState.value = "error";
return;
}
ancestorState.value = updateLocalGenealogyPreviewAncestor(
genealogyId.value,
ancestorSnapshot,
)
? "success"
: "error";
}, 320);
submitTimer = timer;
};
const enterOverview = () =>
uni.redirectTo({
url: `/pages/genealogy/g05-genealogy-overview?genealogyId=${genealogyId.value}`,
});
returnTo("G05", { genealogyId: genealogyId.value });
</script>
<style scoped lang="scss">
+127 -106
View File
@@ -4,15 +4,15 @@
<GenealogyPageBackground />
<view class="overview-page__header">
<PageHeader
:title="viewMode === 'public' ? '家谱公开预览' : '家谱总览'"
:action="
overviewState === 'ready' &&
viewMode === 'member' &&
accessRole === 'owner'
? '管理'
: ''
:title="
viewMode === 'public'
? '家谱公开预览'
: viewMode === 'preview'
? '创建流程预览'
: '家谱总览'
"
@action="toSettings"
custom-back
@back="requestBack"
/>
</view>
@@ -36,7 +36,7 @@
<view class="overview-hero__stats">
<text> {{ genealogy.memberCount || 0 }} </text>
<text>已激活 {{ genealogy.activeCount || 0 }} </text>
<text>{{ genealogy.visibility || "仅成员可见" }}</text>
<text>{{ getGenealogyAccessPresetLabel(genealogy.accessPreset) }}</text>
</view>
<view class="overview-hero__stats">
<text>始祖 {{ genealogy.ancestorName }}</text>
@@ -52,14 +52,6 @@
<text class="overview-action__title">世系树</text
><text>查看家脉关系</text>
</view>
<view
v-if="accessRole === 'owner'"
class="overview-action overview-action--ancestor"
@click="toFirstPerson"
>
<text class="overview-action__title">录入族人</text
><text>从首代开始完善</text>
</view>
<view
class="overview-action overview-action--poem"
@click="toGenerationPoems"
@@ -75,6 +67,24 @@
<text class="overview-action__title">入谱审核</text
><text>处理加入申请</text>
</view>
<view
v-if="accessRole === 'owner'"
class="overview-action overview-action--settings"
@click="toSettings"
>
<text class="overview-action__title">家谱设置</text
><text>维护公开范围与基础资料</text>
</view>
<template v-else>
<view class="overview-summary">
<text class="overview-action__title">成员身份</text
><text>已加入 · 普通成员</text>
</view>
<view class="overview-summary">
<text class="overview-action__title">访问范围</text
><text>{{ getGenealogyAccessPresetLabel(genealogy.accessPreset) }}</text>
</view>
</template>
</view>
<view class="overview-family" @click="toFamily">
@@ -82,8 +92,8 @@
><text>查看</text>
</view>
<view class="overview-note">
<text class="overview-note__title">家谱资料仅向家人开放</text>
<text>公开范围访问说明与管理权由家谱管理员在设置中维护</text>
<text class="overview-note__title">成员资料按家谱访问规则保护</text>
<text>名称公开范围与家谱简介由谱主在设置中维护</text>
</view>
</view>
</template>
@@ -93,34 +103,49 @@
class="overview-public"
>
<view class="overview-public__hero">
<text class="overview-public__eyebrow">公开家谱</text>
<text class="overview-public__eyebrow">{{
viewMode === "preview" ? "本地流程预览" : "公开家谱"
}}</text>
<text class="overview-public__title">{{ genealogy.name }}</text>
<text class="overview-public__source">{{ genealogy.source }}</text>
<text class="overview-public__source">{{ genealogy.source || "来源信息待同步" }}</text>
</view>
<view class="overview-public__details">
<view
><text>姓氏</text><text>{{ genealogy.surname }}</text></view
>
<view
><text>地区</text><text>{{ genealogy.location }}</text></view
><text>地区</text><text>{{ genealogy.location || "待补充" }}</text></view
>
<view
><text>堂号</text><text>{{ genealogy.hall }}</text></view
><text>堂号</text><text>{{ genealogy.hall || "待补充" }}</text></view
>
<view
><text>当前支系</text><text>{{ genealogy.branchName }}</text></view
><text>当前支系</text><text>{{ genealogy.branchName || "待补充" }}</text></view
>
<view
><text>所属上级谱</text
><text>{{ genealogy.parentName }}</text></view
><text>{{ viewMode === "preview" ? "首代人物" : "所属上级谱" }}</text
><text>{{ (viewMode === "preview" ? genealogy.ancestorName : genealogy.parentName) || "待补充" }}</text></view
>
</view>
<view
v-if="viewMode === 'public' && (genealogy.manager || genealogy.certification)"
class="overview-public__trust"
>
<text>{{ genealogy.manager || "管理者待确认" }}</text>
<text>{{ genealogy.certification || "认证信息待确认" }}</text>
<text>{{ genealogy.memberCount || 0 }} 位成员</text>
<text>更新于 {{ genealogy.updatedAt || "待同步" }}</text>
</view>
<view class="overview-public__notice">
<text>公开说明</text>
<text>{{ genealogy.publicDescription }}</text>
<text>{{ viewMode === "preview" ? "预览说明" : "公开说明" }}</text>
<text>{{ genealogy.publicDescription || "公开说明待补充" }}</text>
</view>
<view class="overview-public__action" @click="applyToJoin">
<text>申请加入这部家谱</text>
<view
v-if="viewMode === 'public' && publicActionLabel"
class="overview-public__action"
@click="applyToJoin"
>
<text>{{ publicActionLabel }}</text>
</view>
</view>
@@ -169,55 +194,39 @@
<script setup>
import { computed, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppLoading from "@/components/AppLoading.vue";
import GenealogyPageBackground from "@/components/GenealogyPageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { findGenealogyFixture, getGenealogyFixtureAccess } from "@/data/mock.js";
import { getGenealogyAccessPresetLabel } from "@/utils/genealogy-contracts.js";
import {
goBack,
goRoot,
handleBackPress,
openPage,
returnTo,
} from "@/utils/navigation.js";
const genealogy = ref(null);
const genealogyId = ref("");
const overviewState = ref("loading");
const loadError = ref("");
const viewMode = ref("member");
const accessRole = ref("owner");
const overviewFixture = {
id: "2001",
surname: "汤",
name: "汤氏南阳宗谱",
hall: "敦睦堂",
location: "河南·南阳",
parentName: "汤氏中华总谱",
branchName: "南阳主支",
source: "由南阳汤氏族人整理并维护",
publicDescription:
"公开展示家谱身份、地区、堂号与支系信息;成员资料和世系详情仅向已加入成员开放。",
motto: "敦亲睦族,敬祖传家。",
memberCount: 428,
activeCount: 316,
visibility: "仅成员可见",
ancestorName: "汤文远",
updatedAt: "2026-07-12",
};
const overviewFixtures = {
1001: {
...overviewFixture,
id: "1001",
name: "汤氏家谱",
location: "河南·洛阳",
memberCount: 158,
activeCount: 108,
},
1002: {
...overviewFixture,
id: "1002",
name: "汤氏宗谱",
hall: "承志堂",
location: "山东·济宁",
memberCount: 286,
activeCount: 215,
},
2001: overviewFixture,
};
const accessRole = ref("guest");
const publicRelation = ref("unknown");
const publicCanApply = ref(false);
const publicActionLabel = computed(() => {
if (publicRelation.value === "pending") return "查看申请进度";
if (!publicCanApply.value) return "";
return (
({
available: "申请加入这部家谱",
rejected: "修改后重新申请",
removed: "重新申请加入",
})[publicRelation.value] || ""
);
});
const stateTitle = computed(
() =>
@@ -244,9 +253,11 @@ const loadGenealogy = (query = {}) => {
overviewState.value = "loading";
loadError.value = "";
genealogy.value = null;
genealogyId.value = query.genealogyId || genealogyId.value || "";
viewMode.value = query.mode === "public" ? "public" : "member";
accessRole.value = query.role === "member" ? "member" : "owner";
genealogyId.value = String(query.genealogyId || genealogyId.value || "");
viewMode.value = "member";
accessRole.value = "guest";
publicRelation.value = "unknown";
publicCanApply.value = false;
if (query.state === "empty" || !genealogyId.value) {
overviewState.value = "empty";
@@ -262,45 +273,49 @@ const loadGenealogy = (query = {}) => {
}
if (query.state === "loading") return;
genealogy.value = {
...(overviewFixtures[genealogyId.value] || overviewFixture),
id: genealogyId.value,
};
if (query.genealogyName) {
genealogy.value.name = decodeURIComponent(query.genealogyName);
const fixture = findGenealogyFixture(genealogyId.value);
if (!fixture) {
overviewState.value = "no-permission";
return;
}
const access = getGenealogyFixtureAccess(genealogyId.value);
if (!access.canView) {
overviewState.value = "no-permission";
return;
}
genealogy.value = { ...fixture };
viewMode.value = access.viewMode;
accessRole.value = access.accessRole;
publicRelation.value = access.relation;
publicCanApply.value = access.canApply;
overviewState.value = "ready";
};
const requestBack = () => goBack();
onBackPress((event) => handleBackPress(event, requestBack));
onLoad(loadGenealogy);
const reloadOverview = () => loadGenealogy({ genealogyId: genealogyId.value });
const toGenealogies = () =>
uni.reLaunch({ url: "/pages/genealogy/g01-my-genealogies" });
const toGenealogies = () => returnTo("G01", {});
const toTree = () =>
uni.navigateTo({
url: `/pages/tree/t01-tree-overview?genealogyId=${genealogyId.value}`,
});
const toFirstPerson = () =>
uni.navigateTo({
url: `/pages/genealogy/g03-create-genealogy?step=ancestor&genealogyId=${genealogyId.value}`,
});
const toFamily = () => uni.reLaunch({ url: "/pages/family/f01-family-feed" });
openPage("T01", { genealogyId: genealogyId.value }, "G05");
const toFamily = () => goRoot("F01", { genealogyId: genealogyId.value });
const toApplications = () =>
uni.navigateTo({
url: `/pages/genealogy/g10-application-review?genealogyId=${genealogyId.value}`,
});
openPage("G10", { genealogyId: genealogyId.value }, "G05");
const toSettings = () =>
uni.navigateTo({
url: `/pages/genealogy/g11-genealogy-settings?genealogyId=${genealogyId.value}`,
});
openPage("G11", { genealogyId: genealogyId.value }, "G05");
const toGenerationPoems = () =>
uni.navigateTo({
url: `/pages/genealogy/g12-generation-poems?genealogyId=${genealogyId.value}`,
});
const applyToJoin = () =>
uni.navigateTo({
url: `/pages/genealogy/g08-join-application?source=search&genealogyId=${genealogyId.value}`,
});
openPage("G12", { genealogyId: genealogyId.value }, "G05");
const applyToJoin = () => {
if (publicRelation.value === "pending")
return openPage("G09", { status: "pending" }, "G05");
if (!publicCanApply.value) return false;
return openPage(
"G08",
{ genealogyId: genealogyId.value, source: "search" },
"G05",
);
};
</script>
<style scoped lang="scss">
@@ -380,7 +395,7 @@ const applyToJoin = () =>
min-height: 386rpx;
}
.overview-action,
.overview-action-lock {
.overview-summary {
display: flex;
flex-direction: column;
justify-content: center;
@@ -390,9 +405,6 @@ const applyToJoin = () =>
color: $ink-muted;
font-size: 22rpx;
}
.overview-action-lock {
opacity: 0.58;
}
.overview-action__title {
margin-bottom: 9rpx;
color: $ink;
@@ -562,6 +574,15 @@ const applyToJoin = () =>
font-family: "STKaiti", "KaiTi", serif;
font-size: 27rpx;
}
.overview-public__trust {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: 10rpx 24rpx;
margin: 28rpx 9% 0;
color: $ink-muted;
font-size: 21rpx;
line-height: 1.45;
}
.overview-public__notice {
display: flex;
margin: 54rpx 9% 0;
+92 -132
View File
@@ -97,7 +97,7 @@
<text
class="result-card__relation"
:class="`result-card__relation--${item.relation}`"
>{{ item.actionLabel }}</text
>{{ resultRelationLabel(item) }}</text
>
</view>
<view class="result-card__facts">
@@ -113,9 +113,10 @@
>
</view>
<view
v-if="resultActionLabel(item)"
class="result-card__action"
@click.stop="handleResultAction(item)"
>{{ item.actionLabel }}</view
>{{ resultActionLabel(item) }}</view
>
</view>
</view>
@@ -159,6 +160,7 @@
maxlength="12"
placeholder="请输入邀请码"
placeholder-class="search-input__placeholder"
@input="resetInvite"
/>
</view>
<view class="search-action" @click="verifyInvite">
@@ -179,7 +181,7 @@
>
<text class="search-status__lead">通过邀请码直接定位家谱</text>
<text class="search-status__copy"
>验证有效后显示目标家谱确认关系后可直接加入</text
>验证有效后显示目标家谱仍需填写身份关系本地验证不会变更成员身份</text
>
</view>
<view
@@ -209,11 +211,11 @@
>
</view>
<view class="result-card__action" @click="confirmInvite"
>确认关系并加入</view
>填写关系信息</view
>
</view>
</view>
<text class="invite-result__note">提交后直接加入无需等待审核</text>
<text class="invite-result__note">当前为样式验证不会变更成员身份</text>
</view>
</template>
</view>
@@ -226,6 +228,12 @@ import { onLoad, onUnload } from "@dcloudio/uni-app";
import AppLoading from "@/components/AppLoading.vue";
import GenealogyPageBackground from "@/components/GenealogyPageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import {
getGenealogyFixtureAccess,
isGenealogySearchVisible,
publicGenealogies,
} from "@/data/mock.js";
import { goRoot, openPage } from "@/utils/navigation.js";
const mode = ref("search");
const keyword = ref("");
@@ -235,102 +243,14 @@ const inviteCode = ref("");
const inviteState = ref("initial");
const results = ref([]);
let searchTimer = null;
const invalidateSearch = () => {
const timer = searchTimer;
searchTimer = null;
if (timer) clearTimeout(timer);
};
const areas = ["全部", "河南", "山东"];
const resultFixtures = [
{
id: 2001,
surname: "汤",
name: "汤氏南阳宗谱",
hall: "敦睦堂",
location: "河南·南阳",
parentName: "汤氏中华总谱",
branchName: "南阳主支",
manager: "管理员 汤文礼",
certification: "资料已认证",
memberCount: 428,
updatedAt: "2026-07-12",
relation: "available",
actionLabel: "申请加入",
},
{
id: 2002,
surname: "汤",
name: "汤氏洛阳家谱",
hall: "承志堂",
location: "河南·洛阳",
parentName: "汤氏中华总谱",
branchName: "洛阳二支",
manager: "管理员 汤文远",
certification: "资料已认证",
memberCount: 158,
updatedAt: "2026-07-10",
relation: "joined",
actionLabel: "已加入",
},
{
id: 2003,
surname: "汤",
name: "汤氏济宁宗谱",
hall: "敬宗堂",
location: "山东·济宁",
parentName: "汤氏鲁西总谱",
branchName: "济宁主支",
manager: "管理员 汤正明",
certification: "管理员已实名",
memberCount: 286,
updatedAt: "2026-07-08",
relation: "pending",
actionLabel: "审核中",
},
{
id: 2004,
surname: "汤",
name: "汤氏清河家谱",
hall: "思源堂",
location: "山东·临清",
parentName: "汤氏鲁西总谱",
branchName: "清河支系",
manager: "管理员 汤志成",
certification: "资料已认证",
memberCount: 96,
updatedAt: "2026-07-05",
relation: "rejected",
actionLabel: "修改后重新申请",
},
{
id: 2005,
surname: "汤",
name: "汤氏汝南支谱",
hall: "崇本堂",
location: "河南·驻马店",
parentName: "汤氏中原总谱",
branchName: "汝南三支",
manager: "管理员 汤国安",
certification: "管理员已实名",
memberCount: 72,
updatedAt: "2026-07-02",
relation: "removed",
actionLabel: "重新申请",
},
{
id: 2006,
surname: "汤",
name: "汤氏新安家谱",
hall: "继善堂",
location: "河南·三门峡",
parentName: "无上级谱",
branchName: "新安主支",
manager: "创建者 当前用户",
certification: "资料待完善",
memberCount: 34,
updatedAt: "2026-06-28",
relation: "owned",
actionLabel: "我创建的",
},
];
const inviteTarget = computed(() => resultFixtures[0]);
const inviteTarget = computed(() => publicGenealogies[0]);
const syncModeFromRoute = (query = {}) => {
mode.value = query?.mode === "invite" ? "invite" : "search";
@@ -339,81 +259,121 @@ const syncModeFromRoute = (query = {}) => {
};
onLoad((query) => syncModeFromRoute(query));
onUnload(() => {
if (searchTimer) clearTimeout(searchTimer);
});
onUnload(invalidateSearch);
const switchMode = (nextMode) => {
invalidateSearch();
mode.value = nextMode;
results.value = [];
searchState.value = "initial";
inviteState.value = "initial";
};
const search = () => {
if (searchTimer) clearTimeout(searchTimer);
invalidateSearch();
searchState.value = "loading";
searchTimer = setTimeout(() => {
const value = keyword.value.trim();
const value = keyword.value.trim();
const area = selectedArea.value;
const timer = setTimeout(() => {
if (searchTimer !== timer || mode.value !== "search") return;
searchTimer = null;
if (value === "失败") {
searchState.value = "error";
return;
}
results.value = resultFixtures.filter((item) => {
results.value = publicGenealogies.filter((item) => {
const matchesKeyword =
!value ||
`${item.name}${item.surname}${item.location}${item.hall}`.includes(
value,
);
const matchesArea =
selectedArea.value === "全部" ||
item.location.includes(selectedArea.value);
return matchesKeyword && matchesArea;
area === "全部" || item.location.includes(area);
return isGenealogySearchVisible(String(item.id)) && matchesKeyword && matchesArea;
});
searchState.value = results.value.length ? "results" : "empty";
searchTimer = null;
}, 260);
searchTimer = timer;
};
const clearSearch = () => {
invalidateSearch();
keyword.value = "";
results.value = [];
searchState.value = "initial";
};
const openPreview = (item) => {
if (item.relation === "available") {
uni.navigateTo({
url: `/pages/genealogy/g05-genealogy-overview?mode=public&genealogyId=${item.id}&genealogyName=${encodeURIComponent(item.name)}`,
});
if (
item.relation === "available" &&
getGenealogyFixtureAccess(String(item.id)).canApply
) {
return openPage(
"G05",
{ genealogyId: String(item.id) },
"G06",
);
}
return false;
};
const resultActionLabel = (item) => {
if (item.relation === "pending") return "查看申请进度";
if (item.relation === "joined") return "切换到该家谱";
if (item.relation === "owned") return "进入我的家谱";
if (!getGenealogyFixtureAccess(String(item.id)).canApply) return "";
return {
available: "申请加入",
rejected: "修改后重新申请",
removed: "重新申请",
}[item.relation] || "";
};
const resultRelationLabel = (item) =>
({
available: "可申请",
joined: "已加入",
pending: "审核中",
rejected: "已拒绝",
removed: "已退出",
owned: "我创建的",
})[item.relation] || "关系待确认";
const handleResultAction = (item) => {
if (item.relation === "available")
return uni.navigateTo({
url: `/pages/genealogy/g08-join-application?source=search&genealogyId=${item.id}&genealogyName=${encodeURIComponent(item.name)}`,
});
if (item.relation === "pending")
return uni.navigateTo({
url: "/pages/genealogy/g09-my-applications?status=pending",
});
if (item.relation === "rejected" || item.relation === "removed")
return uni.navigateTo({
url: `/pages/genealogy/g08-join-application?source=search&previous=${item.relation}&genealogyId=${item.id}&genealogyName=${encodeURIComponent(item.name)}`,
});
return uni.reLaunch({
url: `/pages/genealogy/g01-my-genealogies?genealogyId=${item.id}`,
});
return openPage("G09", { status: "pending" }, "G06");
if (
["available", "rejected", "removed"].includes(item.relation) &&
getGenealogyFixtureAccess(String(item.id)).canApply
)
return openPage(
"G08",
{ genealogyId: String(item.id), source: "search" },
"G06",
);
if (item.relation === "joined" || item.relation === "owned")
return goRoot("G01", { genealogyId: String(item.id) });
return false;
};
const verifyInvite = () => {
inviteState.value =
inviteCode.value.toUpperCase() === "JP2026" ? "valid" : "invalid";
};
const confirmInvite = () =>
uni.navigateTo({
url: `/pages/genealogy/g08-join-application?source=invite&genealogyId=${inviteTarget.value.id}&genealogyName=${encodeURIComponent(inviteTarget.value.name)}`,
});
const resetInvite = () => {
inviteState.value = "initial";
};
const confirmInvite = () => {
if (inviteState.value !== "valid") return false;
if (inviteCode.value.trim().toUpperCase() !== "JP2026") return false;
return openPage(
"G08",
{
genealogyId: String(inviteTarget.value.id),
source: "invite",
},
"G06",
);
};
</script>
<style scoped lang="scss">
+148 -64
View File
@@ -2,9 +2,9 @@
<template>
<view class="join-page">
<GenealogyPageBackground />
<view class="join-page__header"
><PageHeader :title="sourceContract.headerTitle"
/></view>
<view class="join-page__header">
<PageHeader :title="sourceContract.headerTitle" custom-back @back="requestBack" />
</view>
<view
class="join-panel"
@@ -12,6 +12,7 @@
'join-state--form': joinState === 'form',
'join-state--success': joinState === 'success',
'join-state--error': joinState === 'error',
'join-state--ineligible': joinState === 'ineligible',
}"
>
<view v-if="joinState === 'form'" class="join-form">
@@ -20,10 +21,6 @@
>{{ sourceContract.formTitle }} {{ genealogyName }}</text
>
<text class="join-form__copy">{{ sourceContract.formCopy }}</text>
<text v-if="previousNotice" class="join-form__previous">{{
previousNotice
}}</text>
<view class="join-field">
<text>真实姓名</text
><input
@@ -76,74 +73,113 @@
<text class="join-result__eyebrow">{{
joinState === "success"
? sourceContract.successEyebrow
: joinState === "ineligible"
? "当前不可申请"
: sourceContract.errorEyebrow
}}</text>
<text class="join-result__title">{{
joinState === "success"
? sourceContract.successTitle
: joinState === "ineligible"
? ineligibleTitle
: sourceContract.errorTitle
}}</text>
<text class="join-result__copy">{{ resultCopy }}</text>
<view
class="join-action"
@click="joinState === 'success' ? completeFlow() : retryForm()"
@click="
joinState === 'success'
? completeFlow()
: joinState === 'ineligible'
? handleIneligibleAction()
: retryForm()
"
>
<text>{{
joinState === "success" ? sourceContract.nextLabel : "重新填写"
joinState === "success"
? sourceContract.nextLabel
: joinState === "ineligible"
? ineligibleActionLabel
: "重新填写"
}}</text>
</view>
</view>
</view>
<AppDialog
:visible="discardVisible"
title="放弃填写?"
message="当前身份关系尚未保存,确认返回后将清空。"
confirm-text="放弃并返回"
cancel-text="继续填写"
show-cancel
compact-actions
:close-on-mask="false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</view>
</template>
<script setup>
import { computed, reactive, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad, onUnload } from "@dcloudio/uni-app";
import AppDialog from "@/components/AppDialog.vue";
import GenealogyPageBackground from "@/components/GenealogyPageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import {
findGenealogyFixture,
getGenealogyFixtureAccess,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
goRoot,
handleBackPress,
openPage,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
const genealogyId = ref("");
const source = ref("search");
const previousRelation = ref("");
const genealogyName = ref("这部家谱");
const genealogyPreview = {
1001: "汤氏家谱",
1002: "汝南汤氏家谱",
};
const joinState = ref("form");
const isSubmitting = ref(false);
const errorMessage = ref("");
const ineligibleRelation = ref("unknown");
const discardVisible = ref(false);
const form = reactive({ realName: "", relation: "", message: "" });
const fieldErrors = reactive({ realName: "", relation: "" });
const previousNotice = computed(() =>
previousRelation.value === "rejected"
? "上次申请未通过,请补充更准确的长辈姓名、祖居地或支系信息。"
: previousRelation.value === "removed"
? "你曾退出或被移出这部家谱,请重新确认身份关系后申请。"
: previousRelation.value === "withdrawn"
? "上次申请已撤回;如仍希望加入,请重新确认关系并提交。"
: "",
let submitTimer = null;
const isDirty = computed(() =>
Boolean(form.realName || form.relation || form.message),
);
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const sourceContract = computed(() =>
source.value === "invite"
? {
headerTitle: "确认关系并加入",
eyebrow: "邀请码直接加入",
formTitle: "确认加入",
headerTitle: "确认身份关系",
eyebrow: "邀请码定位预览",
formTitle: "核对家谱",
formCopy:
"请填写真实身份和亲属关系;提交后直接加入,无需等待管理员审核。",
"请填写真实身份和亲属关系;当前仅验证页面流程,不会变更成员身份。",
thirdFieldLabel: "补充信息",
thirdFieldPlaceholder: "选填:补充祖居地、长辈姓名等信息",
note: "邀请码来源提交后直接加入,无需等待审核。",
submitLabel: "确认加入",
submittingLabel: "正在加入…",
successEyebrow: "已加入家谱",
successTitle: "关系信息已提交",
errorEyebrow: "加入未完成",
errorTitle: "暂时无法加入家谱",
note: "后端尚未提供邀请码验证与直接入谱接口。",
submitLabel: "完成本地校验",
submittingLabel: "正在校验…",
successEyebrow: "本地校验完成",
successTitle: "信息尚未提交服务器",
errorEyebrow: "校验未完成",
errorTitle: "暂时无法完成校验",
nextLabel: "返回我的家谱",
successCopy: `已直接加入${genealogyName.value},无需等待审核;返回后将刷新并选中这部家谱。`,
successCopy: `本地流程预览已完成${genealogyName.value}的身份填写;返回后不会选中或加入这部家谱。`,
}
: {
headerTitle: "申请加入家谱",
@@ -152,42 +188,84 @@ const sourceContract = computed(() =>
formCopy: "请填写真实身份和亲属关系,管理员审核后会通过消息告知结果。",
thirdFieldLabel: "申请说明",
thirdFieldPlaceholder: "补充祖居地、长辈姓名等核验信息",
note: "提交后可在“我的申请”中查看审核进度。",
submitLabel: "提交申请",
submittingLabel: "正在提交…",
successEyebrow: "申请已送达",
successTitle: "等待管理员核实亲属关系",
note: "当前仅验证页面流程,后端申请接口接入后才能正式提交。",
submitLabel: "完成本地校验",
submittingLabel: "正在校验…",
successEyebrow: "本地校验完成",
successTitle: "申请尚未提交服务器",
errorEyebrow: "申请未提交",
errorTitle: "暂时无法提交申请",
errorTitle: "暂时无法完成校验",
nextLabel: "查看我的申请",
successCopy: `${genealogyName.value}”的管理员会在核实后给出结果,请留意消息中心`,
successCopy: `本地流程预览已完成${genealogyName.value}”的申请填写,当前不会新增审核记录`,
},
);
const resultCopy = computed(() =>
joinState.value === "success"
? sourceContract.value.successCopy
: joinState.value === "ineligible"
? ({
owned: "这是你创建的家谱,无需重复提交加入申请。",
joined: "你已经是这部家谱的成员,无需重复申请。",
pending: "这部家谱已有待审核申请,请先查看申请进度。",
})[ineligibleRelation.value] ||
"当前家谱不存在、未公开或不可申请,请返回后重新选择。"
: errorMessage.value ||
"请检查网络后重新填写;未成功提交的内容不会进入审核列表。",
);
const ineligibleTitle = computed(
() =>
({
owned: "你已拥有这部家谱",
joined: "你已加入这部家谱",
pending: "申请正在审核中",
})[ineligibleRelation.value] || "无法打开申请表",
);
const ineligibleActionLabel = computed(
() =>
ineligibleRelation.value === "pending"
? "查看申请进度"
: ["owned", "joined"].includes(ineligibleRelation.value)
? "返回我的家谱"
: "返回上一页",
);
onLoad((query) => {
genealogyId.value = query.genealogyId || "";
genealogyId.value = String(query.genealogyId || "");
source.value = query.source === "invite" ? "invite" : "search";
previousRelation.value = ["rejected", "removed", "withdrawn"].includes(query.previous)
? query.previous
: "";
if (query.state === "success") {
joinState.value = "success";
return;
}
if (!genealogyId.value) {
errorMessage.value = "没有找到要申请加入的家谱,请先返回公开家谱检索。";
joinState.value = "error";
ineligibleRelation.value = "unknown";
joinState.value = "ineligible";
return;
}
genealogyName.value = query.genealogyName
? decodeURIComponent(query.genealogyName)
: genealogyPreview[genealogyId.value] || "这部家谱";
const fixture = findGenealogyFixture(genealogyId.value);
genealogyName.value = fixture?.name || "这部家谱";
const access = getGenealogyFixtureAccess(genealogyId.value);
if (!fixture || !access.canApply) {
ineligibleRelation.value = access.relation;
joinState.value = "ineligible";
return;
}
if (query.state === "success") joinState.value = "success";
});
const requestBack = () => {
if (joinState.value === "success") return completeFlow();
return runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
submitting: isSubmitting.value,
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
};
onBackPress((event) => handleBackPress(event, requestBack));
onUnload(() => {
const timer = submitTimer;
submitTimer = null;
if (timer) clearTimeout(timer);
discardConfirmation.dispose();
});
const submitJoin = () => {
@@ -195,9 +273,13 @@ const submitJoin = () => {
fieldErrors.realName = form.realName.trim() ? "" : "请填写真实姓名";
fieldErrors.relation = form.relation.trim() ? "" : "请填写与家谱的关系";
if (fieldErrors.realName || fieldErrors.relation) return;
const submitSnapshot = Object.freeze({ ...form });
isSubmitting.value = true;
setTimeout(() => {
joinState.value = form.realName.trim() === "失败" ? "error" : "success";
const timer = setTimeout(() => {
if (submitTimer !== timer) return;
submitTimer = null;
joinState.value =
submitSnapshot.realName.trim() === "失败" ? "error" : "success";
if (joinState.value === "error")
errorMessage.value =
source.value === "invite"
@@ -205,6 +287,7 @@ const submitJoin = () => {
: "申请暂未提交,请稍后重试。";
isSubmitting.value = false;
}, 280);
submitTimer = timer;
};
const clearFieldError = (field) => {
fieldErrors[field] = "";
@@ -213,14 +296,15 @@ const retryForm = () => {
joinState.value = "form";
errorMessage.value = "";
};
const toMyApplications = () =>
uni.redirectTo({ url: "/pages/genealogy/g09-my-applications" });
const toMyGenealogies = () =>
uni.reLaunch({
url: `/pages/genealogy/g01-my-genealogies?genealogyId=${genealogyId.value}`,
});
const handleIneligibleAction = () => {
if (ineligibleRelation.value === "pending")
return openPage("G09", { status: "pending" }, "G08");
if (["owned", "joined"].includes(ineligibleRelation.value))
return goRoot("G01", { genealogyId: genealogyId.value });
return goBack();
};
const completeFlow = () =>
source.value === "invite" ? toMyGenealogies() : toMyApplications();
source.value === "invite" ? returnTo("G01", {}) : returnTo("G09", {});
</script>
<style scoped lang="scss">
+45 -34
View File
@@ -2,9 +2,9 @@
<template>
<view class="application-page">
<GenealogyPageBackground />
<view class="application-page__header"
><PageHeader title="我的申请"
/></view>
<view class="application-page__header">
<PageHeader title="我的申请" custom-back @back="requestBack" />
</view>
<view
class="application-content"
@@ -71,55 +71,59 @@
<AppDialog
:visible="!!withdrawTarget"
title="撤回加入申请"
title="预览撤回效果"
:message="
withdrawTarget
? `确认撤回对“${withdrawTarget.genealogyName}”的申请?撤回后如需加入,可重新提交。`
? `当前只更新本页对“${withdrawTarget.genealogyName}”的撤回预览,不会向服务器提交;真实申请仍可能处于审核中。`
: ''
"
confirm-text="确认撤回"
confirm-text="查看本地效果"
cancel-text="暂不撤回"
show-cancel
:close-on-mask="false"
@confirm="confirmWithdraw"
@cancel="cancelWithdraw"
@close="cancelWithdraw"
/>
</view>
</template>
<script setup>
import { computed, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import GenealogyPageBackground from "@/components/GenealogyPageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { findGenealogyFixture } from "@/data/mock.js";
import { handleBackPress, openPage, runBackGuard } from "@/utils/navigation.js";
const applications = ref([]);
const applicationState = ref("loading");
const errorMessage = ref("");
const withdrawTarget = ref(null);
const genealogyNameFor = (genealogyId) =>
findGenealogyFixture(genealogyId)?.name || "未知家谱";
const applicationSamples = [
{
id: 1,
genealogyId: 1001,
genealogyName: "汤氏家谱",
id: "pending-2003",
genealogyId: "2003",
genealogyName: genealogyNameFor("2003"),
relation: "自述为汤正华堂侄",
appliedAt: "今天 10:24",
status: "PENDING",
},
{
id: 2,
genealogyId: 1002,
genealogyName: "汝南汤氏家谱",
id: "approved-1002",
genealogyId: "1002",
genealogyName: genealogyNameFor("1002"),
relation: "祖居河南汝南",
appliedAt: "昨天 18:02",
status: "APPROVED",
},
{
id: 3,
genealogyId: 1003,
genealogyName: "清河汤氏家谱",
id: "rejected-2004",
genealogyId: "2004",
genealogyName: genealogyNameFor("2004"),
relation: "补充材料不足",
appliedAt: "7月12日 09:18",
status: "REJECTED",
@@ -131,7 +135,7 @@ const statusLabel = (status) =>
PENDING: "审核中",
APPROVED: "已通过",
REJECTED: "未通过",
WITHDRAWN: "已撤回",
LOCAL_WITHDRAWN: "本地撤回预览",
})[status] || "状态未知";
const statusHint = (status) =>
@@ -139,11 +143,11 @@ const statusHint = (status) =>
PENDING: "管理员尚未处理,可在审核前撤回",
APPROVED: "申请已通过,可进入这部家谱",
REJECTED: "请修改关系说明后重新提交",
WITHDRAWN: "申请已撤回,不再进入管理员审核",
LOCAL_WITHDRAWN: "尚未提交服务器,真实申请仍可能处于审核",
})[status] || "";
const actionFor = (item) =>
({ PENDING: "撤回申请", APPROVED: "进入家谱", REJECTED: "修改后重新提交", WITHDRAWN: "重新申请" })[
({ PENDING: "预览撤回效果", APPROVED: "进入家谱", REJECTED: "修改后重新提交" })[
item.status
] || "";
const stateTitle = computed(() =>
@@ -155,7 +159,7 @@ const stateTitle = computed(() =>
);
const stateCopy = computed(() =>
applicationState.value === "empty"
? "从家谱搜索提交的申请会显示在这里;邀请码直接加入不进入本页。"
? "从家谱搜索提交的申请会显示在这里;邀请码本地校验不会生成申请记录。"
: applicationState.value === "loading"
? "请稍候,正在同步审核状态。"
: errorMessage.value || "请检查网络后重新查看。",
@@ -188,19 +192,27 @@ const loadApplications = (query = {}) => {
};
onLoad(loadApplications);
const requestBack = () =>
runBackGuard({
transientOpen: Boolean(withdrawTarget.value),
"close-transient": cancelWithdraw,
});
onBackPress((event) => handleBackPress(event, requestBack));
const handleApplicationAction = (item) => {
if (item.status === "APPROVED")
return uni.navigateTo({
url: `/pages/genealogy/g05-genealogy-overview?genealogyId=${item.genealogyId}`,
});
return openPage(
"G05",
{ genealogyId: String(item.genealogyId) },
"G09",
);
if (item.status === "REJECTED")
return uni.navigateTo({
url: `/pages/genealogy/g08-join-application?source=search&previous=rejected&genealogyId=${item.genealogyId}&genealogyName=${encodeURIComponent(item.genealogyName)}`,
});
if (item.status === "WITHDRAWN")
return uni.navigateTo({
url: `/pages/genealogy/g08-join-application?source=search&previous=withdrawn&genealogyId=${item.genealogyId}&genealogyName=${encodeURIComponent(item.genealogyName)}`,
});
return openPage(
"G08",
{ genealogyId: String(item.genealogyId), source: "search" },
"G09",
);
if (item.status === "PENDING") withdrawTarget.value = item;
};
const cancelWithdraw = () => {
@@ -210,11 +222,10 @@ const confirmWithdraw = () => {
const target = applications.value.find(
(item) => item.id === withdrawTarget.value?.id,
);
if (target) target.status = "WITHDRAWN";
if (target) target.status = "LOCAL_WITHDRAWN";
cancelWithdraw();
};
const toSearch = () =>
uni.navigateTo({ url: "/pages/genealogy/g06-search-genealogies" });
const toSearch = () => openPage("G06", {}, "G09");
</script>
<style scoped lang="scss">
+53 -31
View File
@@ -2,9 +2,15 @@
<template>
<view class="review-page">
<GenealogyPageBackground />
<view class="review-page__header"
><PageHeader title="入谱审核" action="说明" @action="showHelp"
/></view>
<view class="review-page__header">
<PageHeader
title="入谱审核"
action="说明"
custom-back
@action="showHelp"
@back="requestBack"
/>
</view>
<view
class="review-content"
@@ -17,7 +23,7 @@
>
<view v-if="reviewState !== 'loading'" class="review-intro">
<text>核实亲属关系后再决定</text>
<text>审核结果会通过消息告知申请人</text>
<text>当前只预览审核交互不会提交服务器</text>
</view>
<template v-if="reviewState === 'list'">
@@ -35,12 +41,12 @@
<AppButton
compact
type="secondary"
label="拒绝申请"
label="预览拒绝"
@click="confirmAudit(item, false)"
/>
<AppButton
compact
label="通过申请"
label="预览通过"
@click="confirmAudit(item, true)"
/>
</view>
@@ -86,28 +92,28 @@
helpVisible
? '审核说明'
: confirmation?.approved
? '确认通过申请'
: '确认拒绝申请'
? '预览通过效果'
: '预览拒绝效果'
"
:message="
helpVisible
? '请核对申请人的姓名、亲属关系和补充说明,仅确认与本家谱存在真实关系的申请。'
: confirmation?.approved
? '通过后,申请人成为本家谱成员。'
: '拒绝后,申请人会收到审核结果,并可修改后重新申请。'
? '当前只更新本页本地预览,不会让申请人成为成员,也不会提交服务器。'
: '当前只更新本页本地预览,不会通知申请人,也不会提交服务器。'
"
:confirm-text="
helpVisible
? '我知道了'
: confirmation?.approved
? '确认通过'
: '确认拒绝'
? '查看通过效果'
: '查看拒绝效果'
"
:show-cancel="!!confirmation"
compact-actions
:close-on-mask="false"
@confirm="helpVisible ? closeDialog() : applyAudit()"
@cancel="closeDialog"
@close="closeDialog"
>
<view v-if="confirmation && !confirmation.approved" class="rejection-field">
<text>拒绝原因</text>
@@ -140,18 +146,19 @@
<script setup>
import { computed, nextTick, ref } from "vue";
import { onLoad, onUnload } from "@dcloudio/uni-app";
import { onBackPress, onLoad, onUnload } from "@dcloudio/uni-app";
import AppDialog from "@/components/AppDialog.vue";
import AppButton from "@/components/AppButton.vue";
import AppLoading from "@/components/AppLoading.vue";
import GenealogyPageBackground from "@/components/GenealogyPageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { genealogyContext } from "@/utils/genealogy-context.js";
import { getGenealogyFixtureAccess } from "@/data/mock.js";
import { handleBackPress, runBackGuard } from "@/utils/navigation.js";
const applications = ref([]);
const reviewSamples = [
{
id: 1,
id: "review-1",
name: "汤志成",
phone: "139****6421",
relation: "自述为汤正华堂侄 · 祖居洛阳",
@@ -159,7 +166,7 @@ const reviewSamples = [
status: "PENDING",
},
{
id: 2,
id: "review-2",
name: "汤雨薇",
phone: "136****2798",
relation: "自述为汤正国之女 · 已补充长辈姓名",
@@ -179,7 +186,9 @@ const feedbackVisible = ref(false);
const feedbackMessage = ref("");
let feedbackTimer = null;
onUnload(() => {
if (feedbackTimer) clearTimeout(feedbackTimer);
const timer = feedbackTimer;
feedbackTimer = null;
if (timer) clearTimeout(timer);
});
const stateTitle = computed(() =>
reviewState.value === "empty"
@@ -199,11 +208,18 @@ const stateCopy = computed(() =>
const loadApplications = (query = {}) => {
reviewState.value = "loading";
errorMessage.value = "";
genealogyId.value =
query.genealogyId?.value ||
query.genealogyId ||
genealogyId.value ||
genealogyContext.getCurrentGenealogyId();
genealogyId.value = String(query.genealogyId || "");
if (!genealogyId.value) {
errorMessage.value = "没有找到当前家谱,请从家谱总览进入。";
reviewState.value = "error";
return;
}
if (
getGenealogyFixtureAccess(genealogyId.value).accessRole !== "owner"
) {
reviewState.value = "no-permission";
return;
}
if (query.state === "loading") {
reviewState.value = "loading";
return;
@@ -220,12 +236,6 @@ const loadApplications = (query = {}) => {
reviewState.value = "no-permission";
return;
}
if (!genealogyId.value) {
errorMessage.value = "没有找到当前家谱,请从家谱总览进入。";
reviewState.value = "error";
return;
}
genealogyContext.setCurrentGenealogyId(genealogyId.value);
applications.value = reviewSamples.map((item) => ({ ...item }));
reviewState.value = "list";
};
@@ -244,14 +254,24 @@ const closeDialog = () => {
rejectionFocused.value = false;
helpVisible.value = false;
};
const requestBack = () =>
runBackGuard({
transientOpen: Boolean(confirmation.value) || helpVisible.value,
"close-transient": closeDialog,
});
onBackPress((event) => handleBackPress(event, requestBack));
const showFeedback = (message) => {
feedbackMessage.value = message;
feedbackVisible.value = true;
if (feedbackTimer) clearTimeout(feedbackTimer);
feedbackTimer = setTimeout(() => {
const timer = setTimeout(() => {
if (feedbackTimer !== timer) return;
feedbackVisible.value = false;
feedbackTimer = null;
}, 1800);
feedbackTimer = timer;
};
const clearRejectionError = () => {
rejectionError.value = "";
@@ -269,7 +289,9 @@ const applyAudit = async () => {
current.item.status = current.approved ? "APPROVED" : "REJECTED";
if (!current.approved) current.item.rejectionReason = rejectionReason.value.trim();
closeDialog();
showFeedback(current.approved ? "已通过申请" : "已拒绝申请");
showFeedback(
`本地审核预览已更新,尚未提交服务器 · ${current.approved ? "已通过" : "已拒绝"}`,
);
};
const showHelp = () => {
helpVisible.value = true;
+124 -52
View File
@@ -1,8 +1,10 @@
<!-- 页面编号G-11用途家谱设置公开范围与访问说明页面设计阶段使用本地模拟交互 -->
<!-- 页面编号G-11用途家谱设置访问预设与家谱简介页面设计阶段使用本地模拟交互 -->
<template>
<view class="settings-page">
<GenealogyPageBackground />
<view class="settings-page__header"><PageHeader title="家谱设置" /></view>
<view class="settings-page__header">
<PageHeader title="家谱设置" custom-back @back="requestBack" />
</view>
<view
class="settings-panel"
@@ -22,7 +24,7 @@
<text class="settings-form__eyebrow">谱主可见 · 基础设置</text>
<text class="settings-form__title">完善家谱访问规则</text>
<text class="settings-form__copy"
>这里仅安排接口支持的名称公开范围与访问说明管理权转让在成员选择场景中单独处理</text
>这里维护名称访问规则与家谱简介访问规则会同时决定公开范围和加入方式管理权转让在成员场景中单独处理</text
>
<view class="settings-field">
@@ -40,17 +42,17 @@
}}</text>
<view class="visibility-block">
<text class="visibility-block__label">公开范围</text>
<text class="visibility-block__label">访问规则</text>
<view class="visibility-options">
<view
v-for="option in visibilityOptions"
v-for="option in accessPresetOptions"
:key="option.value"
class="visibility-option"
@click="genealogyDraft.visibility = option.value"
@click="genealogyDraft.accessPreset = option.value"
>
<image
:src="
genealogyDraft.visibility === option.value
genealogyDraft.accessPreset === option.value
? '/static/assets/foundation/transparent/a01-scroll-primary-v3.png'
: '/static/assets/foundation/transparent/a01-scroll-secondary-v3.png'
"
@@ -59,7 +61,7 @@
<text
:class="{
'visibility-option__text--active':
genealogyDraft.visibility === option.value,
genealogyDraft.accessPreset === option.value,
}"
>{{ option.label }}</text
>
@@ -69,12 +71,12 @@
</view>
<view class="settings-field settings-field--note">
<text>访问说明</text>
<text>家谱简介</text>
<textarea
v-model="genealogyDraft.accessNote"
v-model="genealogyDraft.intro"
auto-height
maxlength="80"
placeholder="向访问者说明家谱用途"
placeholder="简要介绍家谱来源与支系"
placeholder-class="settings-placeholder"
/>
</view>
@@ -94,85 +96,123 @@
}}</text>
<text class="settings-result__title">{{
settingsState === "success"
? "新的访问规则已经生效"
? "本页设置草稿已更新"
: settingsState === "no-permission"
? "当前账号不能修改家谱"
: "暂时无法打开家谱设置"
}}</text>
<text class="settings-result__copy">{{
settingsState === "success"
? `${genealogyDraft.name} · ${visibilityLabel}`
? `本地预览已更新,尚未提交服务器;当前只保留在本页,返回总览不会改变原资料 · ${genealogyDraft.name} · ${accessPresetLabel}`
: settingsState === "no-permission"
? "只有家谱所有者可以修改名称、公开范围和访问说明。"
? "只有家谱所有者可以修改名称、访问规则和家谱简介。"
: "请从家谱总览重新进入,当前修改不会被保留。"
}}</text>
<view class="settings-action" @click="settingsState = 'form'">
<view class="settings-action" @click="handleResultAction">
<text>{{
settingsState === "success" ? "继续调整" : "重新查看"
}}</text>
</view>
</view>
</view>
<AppDialog
:visible="discardVisible"
title="放弃设置修改?"
message="当前修改尚未保存,确认返回后将清空。"
confirm-text="放弃并返回"
cancel-text="继续修改"
show-cancel
compact-actions
:close-on-mask="false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
<view v-if="feedbackVisible" class="settings-feedback">
<text>设置已保存</text>
<text>本页草稿已更新</text>
</view>
</view>
</template>
<script setup>
import { computed, reactive, ref } from "vue";
import { onLoad, onUnload } from "@dcloudio/uni-app";
import { onBackPress, onLoad, onUnload } from "@dcloudio/uni-app";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import GenealogyPageBackground from "@/components/GenealogyPageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import {
findGenealogyFixture,
getGenealogyFixtureAccess,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
GENEALOGY_ACCESS_PRESET,
GENEALOGY_ACCESS_PRESET_OPTIONS,
isGenealogyAccessPreset,
} from "@/utils/genealogy-contracts.js";
import { goBack, handleBackPress, runBackGuard } from "@/utils/navigation.js";
const genealogyId = ref("");
const settingsState = ref("loading");
const nameError = ref("");
const feedbackVisible = ref(false);
const discardVisible = ref(false);
let feedbackTimer = null;
const settingsFixtures = {
1001: {
name: "汤氏家谱",
visibility: "MEMBER_ONLY",
accessNote: "家族资料,请妥善保存",
},
1002: {
name: "汤氏宗谱",
visibility: "PUBLIC_APPLY",
accessNote: "公开家谱身份,成员资料需审核后查看",
},
};
const genealogyDraft = reactive({
name: "汤氏家谱",
visibility: "MEMBER_ONLY",
accessNote: "家族资料,请妥善保存",
name: "",
accessPreset: GENEALOGY_ACCESS_PRESET.MEMBER_ONLY,
intro: "",
});
const originalDraft = ref("");
const isDirty = computed(
() => JSON.stringify(genealogyDraft) !== originalDraft.value,
);
const visibilityOptions = [
{ value: "MEMBER_ONLY", label: "仅成员可见" },
{ value: "PUBLIC_APPLY", label: "公开可申请" },
];
const visibilityLabel = computed(
() =>
visibilityOptions.find((item) => item.value === genealogyDraft.visibility)
settingsState.value === "form" &&
JSON.stringify(genealogyDraft) !== originalDraft.value,
);
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const accessPresetOptions = GENEALOGY_ACCESS_PRESET_OPTIONS;
const accessPresetLabel = computed(
() =>
accessPresetOptions.find((item) => item.value === genealogyDraft.accessPreset)
?.label || "",
);
const visibilityHint = computed(() =>
genealogyDraft.visibility === "MEMBER_ONLY"
genealogyDraft.accessPreset === GENEALOGY_ACCESS_PRESET.MEMBER_ONLY
? "只有已加入本家谱的成员可以查看谱系和家族资料。"
: "访客可检索到家谱并提交入谱申请,资料仍需审核后查看。",
);
onLoad((query) => {
genealogyId.value = query.genealogyId || "";
Object.assign(
genealogyDraft,
settingsFixtures[genealogyId.value] || settingsFixtures[1001],
);
const loadSettings = (query = {}) => {
genealogyId.value = String(query.genealogyId || "");
if (!genealogyId.value) {
settingsState.value = "error";
return;
}
if (
getGenealogyFixtureAccess(genealogyId.value).accessRole !== "owner"
) {
settingsState.value = "no-permission";
return;
}
const fixture = findGenealogyFixture(genealogyId.value);
if (!fixture) {
settingsState.value = "error";
return;
}
if (!isGenealogyAccessPreset(fixture.accessPreset)) {
settingsState.value = "error";
return;
}
Object.assign(genealogyDraft, {
name: fixture.name,
accessPreset: fixture.accessPreset,
intro: fixture.publicDescription || "家族资料,请妥善保存",
});
originalDraft.value = JSON.stringify(genealogyDraft);
settingsState.value =
query.state === "loading"
@@ -184,27 +224,59 @@ onLoad((query) => {
: query.state === "error" || !genealogyId.value
? "error"
: "form";
});
};
onLoad(loadSettings);
onUnload(() => {
if (feedbackTimer) clearTimeout(feedbackTimer);
const timer = feedbackTimer;
feedbackTimer = null;
if (timer) clearTimeout(timer);
discardConfirmation.dispose();
});
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
"close-transient": cancelDiscard,
"confirm-discard": requestDiscardConfirmation,
});
onBackPress((event) => handleBackPress(event, requestBack));
const continueEditing = () => {
if (
getGenealogyFixtureAccess(genealogyId.value).accessRole === "owner"
) {
settingsState.value = "form";
}
};
const handleResultAction = () => {
if (settingsState.value === "success") return continueEditing();
if (settingsState.value === "error")
return loadSettings({ genealogyId: genealogyId.value });
return goBack();
};
const saveSettings = () => {
if (!genealogyDraft.name.trim()) {
nameError.value = "请填写家谱名称";
return;
}
if (genealogyDraft.name.trim().length > 30) {
nameError.value = "家谱名称不能超过 30 个字";
if (genealogyDraft.name.trim().length > 20) {
nameError.value = "家谱名称不能超过 20 个字";
return;
}
originalDraft.value = JSON.stringify(genealogyDraft);
settingsState.value = "success";
feedbackVisible.value = true;
feedbackTimer = setTimeout(() => {
if (feedbackTimer) clearTimeout(feedbackTimer);
const timer = setTimeout(() => {
if (feedbackTimer !== timer) return;
feedbackVisible.value = false;
feedbackTimer = null;
}, 1800);
feedbackTimer = timer;
};
</script>
+302 -71
View File
@@ -4,9 +4,11 @@
<GenealogyPageBackground />
<view class="poem-page__header"
><PageHeader
title="字辈诗"
:action="poemState === 'list' ? '维护' : ''"
:title="pageTitle"
:action="canManage && poemState === 'list' ? '维护' : ''"
custom-back
@action="openEditor"
@back="requestBack"
/></view>
<view
@@ -25,26 +27,38 @@
description="请稍候,正在读取家谱字序。"
/>
<view v-else-if="poemState === 'list'" class="poem-list">
<text class="poem-list__eyebrow">汤氏家谱 · 传承字序</text>
<text class="poem-list__title">启宗敦本继世传芳</text>
<text class="poem-list__copy"
>按世代查看字辈当前家谱使用到字辈</text
>
<text class="poem-list__eyebrow">{{ genealogyName }} · 传承字序</text>
<text class="poem-list__title">{{ generationRangeTitle }}</text>
<text class="poem-list__copy">{{ currentGenerationCopy }}</text>
<view class="poem-rows">
<view
v-for="item in poemRows"
v-for="item in visiblePoemRows"
:key="item.generationNo"
class="poem-row"
:class="{ 'poem-row--current': item.current }"
:class="{
'poem-row--current': item.current,
'poem-row--disabled': item.status === GENERATION_POEM_STATUS.DISABLED,
}"
>
<text class="poem-row__number"> {{ item.generationNo }} </text>
<text class="poem-row__character">{{ item.character }}</text>
<text class="poem-row__character">{{ item.generationText }}</text>
<text class="poem-row__status">{{
item.current ? "当前字辈" : "传承字序"
item.current
? "当前字辈"
: item.status === GENERATION_POEM_STATUS.DISABLED
? "已停用·记录保留"
: "传承字序"
}}</text>
</view>
</view>
<view class="poem-action" @click="openEditor">
<view
v-if="remainingPoemCount > 0"
class="poem-load-more"
@click="loadMorePoems"
>
<text>继续加载后续字辈剩余 {{ remainingPoemCount }} </text>
</view>
<view v-if="canManage" class="poem-action" @click="openEditor">
<image
src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png"
mode="aspectFit"
@@ -54,31 +68,33 @@
<view v-else-if="poemState === 'edit'" class="poem-editor">
<text class="poem-list__eyebrow">批量维护</text>
<text class="poem-list__title">录入连续字辈</text>
<text class="poem-list__title">录入完整字辈序列</text>
<text class="poem-list__copy"
>按照接口支持的连续文本录入每个汉字对应一代保存前可预览新字序</text
>无分隔符时每个字符对应一代也可用空格逗号分号顿号斜杠或竖线分隔多字字辈一次最多
{{ MAX_GENERATION_COUNT }} 每代最多
{{ MAX_GENERATION_TEXT_LENGTH }} 个字符本页只更新本地预览尚未提交服务器</text
>
<view class="poem-field">
<text>字辈内容</text>
<textarea
v-model="poemDraft"
auto-height
maxlength="50"
placeholder="例如:启宗敦本继世传芳"
:maxlength="MAX_GENERATION_POEM_INPUT_LENGTH * 2"
placeholder="例如:启宗敦本,或 克勤 克俭 承先 启后"
placeholder-class="poem-placeholder"
@input="poemError = ''"
/>
</view>
<text v-if="poemError" class="poem-field-error">{{ poemError }}</text>
<view class="poem-policy">
<text>缺失旧世代</text>
<text>未被新文本覆盖的后续世代</text>
<view
class="poem-policy__option"
@click="stopMissingOldGeneration = !stopMissingOldGeneration"
@click="disableMissing = !disableMissing"
>
<image
:src="
stopMissingOldGeneration
disableMissing
? '/static/assets/foundation/transparent/a01-scroll-primary-v3.png'
: '/static/assets/foundation/transparent/a01-scroll-secondary-v3.png'
"
@@ -86,17 +102,17 @@
/>
<text
:class="{
'poem-policy__option-text--active': stopMissingOldGeneration,
'poem-policy__option-text--active': disableMissing,
}"
>{{ stopMissingOldGeneration ? "停止并提醒" : "继续补录" }}</text
>{{ disableMissing ? "停用并保留记录" : "保持原状态" }}</text
>
</view>
</view>
<text class="poem-preview"
>预览{{ previewCharacters || "尚未录入字辈" }}</text
>预览{{ previewSummary }}</text
>
<view class="poem-editor__actions">
<view class="poem-action" @click="poemState = 'list'">
<view class="poem-action" @click="requestLeaveEditor">
<image
src="/static/assets/foundation/transparent/a01-scroll-secondary-v3.png"
mode="aspectFit"
@@ -134,56 +150,171 @@
: "请从家谱总览重新进入,或稍后再试。"
}}</text>
<view
v-if="poemState !== 'empty' || canManage"
class="poem-action"
@click="poemState === 'empty' ? openEditor() : (poemState = 'list')"
@click="handleStateAction"
>
<image
src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png"
mode="aspectFit"
/><text>{{ poemState === "empty" ? "开始录入" : "重新查看" }}</text>
/><text>{{
poemState === "empty"
? "开始录入"
: poemState === "no-permission"
? "返回家谱总览"
: "重新查看"
}}</text>
</view>
</view>
</view>
<AppDialog
:visible="discardVisible"
title="放弃字辈修改?"
message="当前字辈草稿尚未保存,确认后将恢复进入编辑器前的内容。"
confirm-text="放弃修改"
cancel-text="继续编辑"
show-cancel
compact-actions
:close-on-mask="false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
<view v-if="feedbackVisible" class="poem-feedback">
<text>字辈预览已更新</text>
<text>本地字辈预览已更新</text>
</view>
</view>
</template>
<script setup>
import { computed, ref } from "vue";
import { onLoad, onUnload } from "@dcloudio/uni-app";
import { onBackPress, onLoad, onUnload } from "@dcloudio/uni-app";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import GenealogyPageBackground from "@/components/GenealogyPageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import {
findGenealogyFixture,
getGenealogyFixtureAccess,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
MAX_GENERATION_COUNT,
MAX_GENERATION_POEM_INPUT_LENGTH,
MAX_GENERATION_TEXT_LENGTH,
GENERATION_POEM_STATUS,
findFirstGenerationGap,
mergeGenerationPoemRows,
validateGenerationPoemText,
} from "@/utils/generation-poem.js";
import { handleBackPress, runBackGuard } from "@/utils/navigation.js";
const INITIAL_POEM_TEXT = "启宗敦本";
const POEM_RENDER_BATCH_SIZE = 50;
const PREVIEW_GENERATION_LIMIT = 12;
const LOCAL_PREVIEW_START_GENERATION = 1;
const LOCAL_CURRENT_GENERATION = 3;
const genealogyId = ref("");
const genealogyName = ref("家谱");
const poemState = ref("loading");
const poemError = ref("");
const feedbackVisible = ref(false);
const discardVisible = ref(false);
const canManage = ref(false);
let feedbackTimer = null;
const poemDraft = ref("启宗敦本继世传芳");
const stopMissingOldGeneration = ref(true);
const startGeneration = ref(12);
const currentGeneration = ref(14);
const poemRows = ref([
{ generationNo: 12, character: "启", current: false },
{ generationNo: 13, character: "宗", current: false },
{ generationNo: 14, character: "敦", current: true },
{ generationNo: 15, character: "本", current: false },
]);
const previewCharacters = computed(() =>
poemDraft.value.trim().split("").join(" · "),
const poemDraft = ref(INITIAL_POEM_TEXT);
// OpenAPI 的 disableMissing 示例为 false;本地同样采用安全默认 false。停用后续世代是高影响动作,
// 必须由谱主主动选择,不能把缩短一次本地草稿解释为默认停用历史记录。
const disableMissing = ref(false);
const editorOrigin = ref("list");
const editorSnapshot = ref(null);
const poemRows = ref([]);
const visiblePoemCount = ref(POEM_RENDER_BATCH_SIZE);
const visiblePoemRows = computed(() =>
poemRows.value.slice(0, visiblePoemCount.value),
);
const remainingPoemCount = computed(() =>
poemRows.value.length > visiblePoemCount.value
? poemRows.value.length - visiblePoemCount.value
: 0,
);
const pageTitle = computed(() =>
poemState.value === "edit" ? "维护字辈诗" : "字辈诗",
);
const generationRangeTitle = computed(() => {
if (!poemRows.value.length) return "尚未建立字辈";
const first = poemRows.value[0].generationNo;
const last = poemRows.value[poemRows.value.length - 1].generationNo;
return first === last ? `${first} 世字辈` : `${first}${last} 世字辈`;
});
const currentGenerationCopy = computed(() => {
const current = poemRows.value.find((item) => item.current);
return current
? `当前为第 ${current.generationNo} 世“${current.generationText}”字辈。`
: `当前第 ${LOCAL_CURRENT_GENERATION} 世尚未被有效字辈覆盖。`;
});
const previewSummary = computed(() => {
const validation = validateGenerationPoemText(poemDraft.value);
if (!validation.valid) {
return poemDraft.value.trim() ? validation.message : "尚未录入字辈";
}
const visible = validation.generations
.slice(0, PREVIEW_GENERATION_LIMIT)
.join(" · ");
const remaining = validation.generations.length - PREVIEW_GENERATION_LIMIT;
return remaining > 0 ? `${visible} · …另 ${remaining}` : visible;
});
const isDirty = computed(() =>
Boolean(
poemState.value === "edit" &&
editorSnapshot.value &&
(poemDraft.value !== editorSnapshot.value.poemDraft ||
disableMissing.value !== editorSnapshot.value.disableMissing),
),
);
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
onLoad((query) => {
genealogyId.value = query.genealogyId || "";
startGeneration.value = Math.max(1, Number(query.startGeneration) || 12);
currentGeneration.value = Math.max(
startGeneration.value,
Number(query.currentGeneration) || 14,
const resetPoemRows = () => {
const seed = validateGenerationPoemText(INITIAL_POEM_TEXT).generations;
poemDraft.value = INITIAL_POEM_TEXT;
poemRows.value = mergeGenerationPoemRows({
existingRows: [],
generationTexts: seed,
startGeneration: LOCAL_PREVIEW_START_GENERATION,
currentGeneration: LOCAL_CURRENT_GENERATION,
disableMissing: false,
});
visiblePoemCount.value = POEM_RENDER_BATCH_SIZE;
};
const loadMorePoems = () => {
visiblePoemCount.value = Math.min(
poemRows.value.length,
visiblePoemCount.value + POEM_RENDER_BATCH_SIZE,
);
poemState.value =
};
const loadPoems = (query = {}) => {
genealogyId.value = String(query.genealogyId || "");
const fixture = findGenealogyFixture(genealogyId.value);
if (!fixture) {
canManage.value = false;
poemState.value = "error";
return;
}
genealogyName.value = fixture.name || "家谱";
const accessRole = getGenealogyFixtureAccess(genealogyId.value).accessRole;
canManage.value = accessRole === "owner";
if (accessRole === "guest") {
poemState.value = "no-permission";
return;
}
resetPoemRows();
const requestedState =
query.state === "loading"
? "loading"
: query.state === "empty"
@@ -192,47 +323,123 @@ onLoad((query) => {
? "edit"
: query.state === "no-permission"
? "no-permission"
: query.state === "error" || !genealogyId.value
: query.state === "error"
? "error"
: "list";
});
if (requestedState === "empty") {
poemDraft.value = "";
poemRows.value = [];
}
if (requestedState === "edit") {
if (!canManage.value) {
poemState.value = "no-permission";
return;
}
poemState.value = "list";
openEditor("list");
return;
}
poemState.value = requestedState;
};
onLoad(loadPoems);
onUnload(() => {
if (feedbackTimer) clearTimeout(feedbackTimer);
const timer = feedbackTimer;
feedbackTimer = null;
if (timer) clearTimeout(timer);
discardConfirmation.dispose();
});
const openEditor = () => {
const openEditor = (origin = poemState.value) => {
if (!canManage.value) return false;
editorOrigin.value = origin === "empty" ? "empty" : "list";
editorSnapshot.value = Object.freeze({
poemDraft: poemDraft.value,
disableMissing: disableMissing.value,
});
poemState.value = "edit";
return true;
};
const restoreEditorSnapshot = () => {
if (!editorSnapshot.value) return;
poemDraft.value = editorSnapshot.value.poemDraft;
disableMissing.value = editorSnapshot.value.disableMissing;
};
const requestLeaveEditor = async () => {
if (isDirty.value) {
const confirmed = await requestDiscardConfirmation();
if (!confirmed) return false;
}
restoreEditorSnapshot();
poemState.value = editorOrigin.value;
editorSnapshot.value = null;
poemError.value = "";
return true;
};
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
internalTrail: poemState.value === "edit",
"close-transient": cancelDiscard,
"pop-internal-trail": requestLeaveEditor,
});
onBackPress((event) => handleBackPress(event, requestBack));
const handleStateAction = () => {
if (poemState.value === "empty") return openEditor("empty");
if (poemState.value === "error")
return loadPoems({ genealogyId: genealogyId.value });
return requestBack();
};
const savePoems = () => {
const characters = poemDraft.value.trim().split("").filter(Boolean);
if (!characters.length) {
poemError.value = "请录入字辈内容";
const validation = validateGenerationPoemText(poemDraft.value);
if (!validation.valid) {
poemError.value = validation.message;
return;
}
if (poemDraft.value.trim() === "失败") {
poemError.value = "字辈保存失败,请稍后重试";
const lastGeneration =
LOCAL_PREVIEW_START_GENERATION + validation.generations.length - 1;
if (LOCAL_CURRENT_GENERATION > lastGeneration) {
poemError.value = `请至少录入到当前第 ${LOCAL_CURRENT_GENERATION}`;
return;
}
const preservedRows = stopMissingOldGeneration.value
? []
: poemRows.value.filter(
(item) => item.generationNo < startGeneration.value,
);
const nextRows = characters.map((character, index) => {
const generationNo = startGeneration.value + index;
return {
generationNo,
character,
current: generationNo === currentGeneration.value,
};
const nextRows = mergeGenerationPoemRows({
existingRows: poemRows.value,
generationTexts: validation.generations,
startGeneration: LOCAL_PREVIEW_START_GENERATION,
currentGeneration: LOCAL_CURRENT_GENERATION,
disableMissing: disableMissing.value,
});
poemRows.value = [...preservedRows, ...nextRows];
const activeRows = nextRows.filter(
(item) => item.status === GENERATION_POEM_STATUS.ACTIVE,
);
const lastActiveGeneration = activeRows.length
? activeRows[activeRows.length - 1].generationNo
: null;
const firstGap = lastActiveGeneration === null
? null
: findFirstGenerationGap(
nextRows,
lastActiveGeneration + 1,
LOCAL_PREVIEW_START_GENERATION,
);
if (firstGap !== null) {
poemError.value = `${firstGap} 世字辈缺失;请补齐完整序列,或选择停用未覆盖的后续记录`;
return;
}
poemRows.value = nextRows;
visiblePoemCount.value = POEM_RENDER_BATCH_SIZE;
editorSnapshot.value = null;
poemState.value = "list";
feedbackVisible.value = true;
feedbackTimer = setTimeout(() => {
if (feedbackTimer) clearTimeout(feedbackTimer);
const timer = setTimeout(() => {
if (feedbackTimer !== timer) return;
feedbackVisible.value = false;
feedbackTimer = null;
}, 1800);
feedbackTimer = timer;
};
</script>
@@ -287,12 +494,26 @@ const savePoems = () => {
.poem-rows {
margin-top: 18rpx;
}
.poem-load-more {
display: flex;
min-height: 64rpx;
align-items: center;
justify-content: center;
margin-top: 14rpx;
background: url("/static/assets/foundation/transparent/a01-scroll-secondary-v3.png")
center / contain no-repeat;
}
.poem-load-more text {
color: $ink;
font-size: 23rpx;
font-weight: 700;
}
.poem-row {
@include adaptive.adaptive-genealogy-form-field;
display: grid;
min-height: 72rpx;
margin-top: 10rpx;
grid-template-columns: 48% auto 1fr auto;
grid-template-columns: minmax(116rpx, 38%) minmax(0, 1fr) auto;
align-items: center;
}
.poem-row__number {
@@ -305,14 +526,19 @@ const savePoems = () => {
.poem-row__character {
z-index: 1;
grid-column: 2;
min-width: 0;
padding: 12rpx 16rpx 12rpx 0;
color: $ink;
font-family: "STKaiti", "KaiTi", serif;
font-size: 32rpx;
font-weight: 700;
line-height: 1.4;
overflow-wrap: anywhere;
word-break: break-word;
}
.poem-row__status {
z-index: 1;
grid-column: 4;
grid-column: 3;
margin-right: 22rpx;
color: $ink-muted;
font-size: 22rpx;
@@ -321,6 +547,11 @@ const savePoems = () => {
.poem-row--current .poem-row__status {
color: $brand-red;
}
.poem-row--disabled .poem-row__character,
.poem-row--disabled .poem-row__status {
color: $ink-muted;
opacity: 0.62;
}
.poem-action {
display: grid;
width: 100%;
+17 -26
View File
@@ -87,7 +87,9 @@ import AppLoading from "@/components/AppLoading.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { listNotificationFixtures } from "@/data/mock.js";
import { genealogyContext } from "@/utils/genealogy-context.js";
import { openPage } from "@/utils/navigation.js";
const genealogyId = ref("");
const noticeState = ref("loading");
@@ -95,24 +97,7 @@ const toastVisible = ref(false);
const toastMessage = ref("");
let toastTimer = null;
const notices = ref([
{
id: 1,
title: "申请待审核",
content: "汤志成申请加入汤氏家谱,请核实亲属关系。",
time: "今天 10:28",
unread: true,
detailId: "review-1",
},
{
id: 2,
title: "入谱申请已通过",
content: "你申请加入汝南汤氏家谱的请求已通过。",
time: "昨天 18:10",
unread: false,
detailId: "approved",
},
]);
const notices = ref(listNotificationFixtures());
onLoad((query) => {
genealogyId.value =
@@ -130,11 +115,13 @@ onLoad((query) => {
const unreadCount = computed(
() => notices.value.filter((item) => item.unread).length,
);
const openNotice = (item) => {
item.unread = false;
uni.navigateTo({
url: `/pages/notification/n02-message-detail?id=${item.detailId}&genealogyId=${genealogyId.value}`,
});
const openNotice = async (item) => {
const opened = await openPage(
"N02",
{ id: String(item.id) },
"N01",
);
if (opened) item.unread = false;
};
const restoreList = () => {
noticeState.value = "list";
@@ -155,9 +142,13 @@ const markAllRead = () => {
showToast("已全部标记为已读");
};
const toReview = () =>
uni.navigateTo({
url: `/pages/genealogy/g10-application-review?genealogyId=${genealogyId.value}`,
});
genealogyId.value
? openPage(
"G10",
{ genealogyId: genealogyId.value },
"N01",
)
: showToast("请先选择可管理的家谱");
onUnmounted(() => {
if (toastTimer) clearTimeout(toastTimer);
+59 -31
View File
@@ -2,7 +2,7 @@
<template>
<view class="notice-detail-page" :class="{ 'notice-state--ready': noticeState === 'ready', 'notice-state--loading': noticeState === 'loading', 'notice-state--expired': noticeState === 'expired' }">
<ModulePageBackground module="notification" />
<view class="page-layer"><PageHeader title="消息详情" /></view>
<view class="page-layer"><PageHeader title="消息详情" custom-back @back="backToMessages" /></view>
<view class="notice-content page-layer">
<AppLoading v-if="noticeState === 'loading'" text="正在读取消息" description="请稍候,正在整理消息详情。" />
@@ -16,7 +16,7 @@
<template v-else>
<view class="paper-panel notice-card">
<view class="notice-meta">
<text :class="{ 'is-unread': !noticeDetail.read }">{{ noticeDetail.read ? "已读" : "未读提醒" }}</text>
<text :class="{ 'is-unread': noticeDetail.unread }">{{ noticeDetail.unread ? "未读提醒" : "已读" }}</text>
<text>{{ noticeDetail.time }}</text>
</view>
<text class="notice-title">{{ noticeDetail.title }}</text>
@@ -24,8 +24,9 @@
<text class="notice-source">来自{{ noticeDetail.source }}</text>
</view>
<view class="action-stack">
<AppButton v-if="!noticeDetail.read" block label="标记已读" @click="markAsRead" />
<AppButton v-if="noticeDetail.target" block type="secondary" :label="noticeDetail.targetLabel" @click="openNoticeTarget" />
<AppButton v-if="noticeDetail.unread" block label="标记已读" @click="markAsRead" />
<AppButton v-if="noticeDetail.targetType" block type="secondary" :label="noticeDetail.targetLabel" @click="openNoticeTarget" />
<text v-if="targetError" class="target-error" role="alert">{{ targetError }}</text>
</view>
</template>
</view>
@@ -35,45 +36,43 @@
<script setup>
import { onUnmounted, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppLoading from "@/components/AppLoading.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import {
findNotificationFixture,
getGenealogyFixtureAccess,
} from "@/data/mock.js";
import {
handleBackPress,
openNoticeTarget as navigateNoticeTarget,
returnTo,
} from "@/utils/navigation.js";
const noticeState = ref("loading");
const toastVisible = ref(false);
const toastMessage = ref("");
const targetError = ref("");
let toastTimer = null;
const noticeDetail = ref({
id: "review-1",
title: "申请待审核",
body: "汤志成申请加入汤氏家谱,请核实申请人的亲属关系与世代信息后完成审核。",
time: "今天 10:28",
source: "汝南汤氏家谱",
read: false,
target: "/pages/genealogy/g10-application-review",
targetLabel: "前往入谱审核",
});
const noticeId = ref("");
const noticeDetail = ref(null);
onLoad((query) => {
if (query.state === "expired") {
noticeId.value = String(query.id || "");
if (query.state === "loading") return;
const selectedNotice = findNotificationFixture(noticeId.value);
if (
query.state === "expired" ||
!noticeId.value ||
!selectedNotice
) {
noticeState.value = "expired";
return;
}
if (query.id === "approved") {
noticeDetail.value = {
id: "approved",
title: "入谱申请已通过",
body: "你申请加入汝南汤氏家谱的请求已通过,现在可以查看家谱与家族动态。",
time: "昨天 18:10",
source: "汝南汤氏家谱",
read: true,
target: "/pages/genealogy/g01-my-genealogies",
targetLabel: "查看我的家谱",
};
}
noticeDetail.value = selectedNotice;
noticeState.value = "ready";
});
@@ -84,11 +83,39 @@ const showToast = (message) => {
toastTimer = setTimeout(() => (toastVisible.value = false), 1800);
};
const markAsRead = () => {
noticeDetail.value.read = true;
if (!noticeDetail.value) return;
noticeDetail.value.unread = false;
showToast("已标记为已读");
};
const openNoticeTarget = () => uni.navigateTo({ url: noticeDetail.value.target });
const backToMessages = () => uni.navigateBack();
const getTargetAccessError = (detail) => {
const genealogyId = detail?.targetParams?.genealogyId;
const accessRole = getGenealogyFixtureAccess(genealogyId).accessRole;
if (detail?.targetType === "GENEALOGY_REVIEW" && accessRole !== "owner") {
return "当前账号没有处理这条审核消息的权限。";
}
if (
detail?.targetType === "GENEALOGY_HOME" &&
!["owner", "member"].includes(accessRole)
) {
return "这条消息关联的家谱已不可访问。";
}
return "";
};
const openNoticeTarget = async () => {
targetError.value = getTargetAccessError(noticeDetail.value);
if (targetError.value) return false;
try {
return await navigateNoticeTarget(
noticeDetail.value.targetType,
noticeDetail.value.targetParams,
);
} catch (_error) {
targetError.value = "这条消息的业务入口已失效,请返回消息中心。";
return false;
}
};
const backToMessages = () => returnTo("N01", {});
onBackPress((event) => handleBackPress(event, backToMessages));
onUnmounted(() => toastTimer && clearTimeout(toastTimer));
</script>
@@ -106,6 +133,7 @@ onUnmounted(() => toastTimer && clearTimeout(toastTimer));
.notice-body { display: block; margin-top: 22rpx; color: #5f4a38; font-size: 25rpx; line-height: 1.75; overflow-wrap: anywhere; }
.notice-source { display: block; margin-top: 28rpx; color: $ink-muted; font-size: 22rpx; overflow-wrap: anywhere; }
.action-stack { display: flex; flex-direction: column; gap: 18rpx; margin-top: 28rpx; }
.target-error { display: block; color: #b42318; font-size: 22rpx; line-height: 1.5; text-align: center; }
.state-card { min-height: 340rpx; padding: 72rpx 50rpx 48rpx; box-sizing: border-box; text-align: center; }
.state-title { display: block; color: $ink; font-size: 34rpx; font-weight: 700; }
.state-copy { display: block; margin: 18rpx 0 28rpx; color: $ink-muted; font-size: 24rpx; line-height: 1.65; }
+25 -17
View File
@@ -10,6 +10,7 @@
<ModulePageBackground module="profile" />
<view class="profile-page__header">
<PageHeader
root
title="我的"
:action="profileState === 'ready' ? '资料' : ''"
@action="toProfile"
@@ -40,9 +41,9 @@
mode="aspectFit"
/>
<view class="profile-identity__copy">
<text class="profile-identity__name">汤文清</text>
<text class="profile-identity__role">汤氏家谱 · 家谱成员</text>
<text class="profile-identity__phone">139****6421</text>
<text class="profile-identity__name">{{ currentUser.name }}</text>
<text class="profile-identity__role">{{ currentUser.role }}</text>
<text class="profile-identity__phone">{{ currentUser.phone }}</text>
</view>
</view>
</view>
@@ -56,7 +57,7 @@
>
<view class="profile-scroll-notice__copy">
<text>待你处理</text>
<text>2 条家谱提醒与审核通知</text>
<text>{{ unreadCount }} 条家谱提醒与审核通知</text>
</view>
</view>
@@ -121,44 +122,52 @@
</template>
<script setup>
import { ref } from "vue";
import { computed, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppTabbar from "@/components/AppTabbar.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import {
currentUser,
listNotificationFixtures,
} from "@/data/mock.js";
import { openPage } from "@/utils/navigation.js";
const profileState = ref("ready");
const unreadCount = computed(
() => listNotificationFixtures().filter((notice) => notice.unread).length,
);
const menuItems = [
{
label: "账号与安全",
note: "密码手机与设备",
note: "密码手机",
icon: "/static/assets/modules/auth/transparent/a01-icon-lock-v1.png",
url: "/pages/profile/m03-security-settings",
routeKey: "M03",
},
{
label: "帮助与反馈",
note: "使用说明与问题反馈",
icon: "/static/assets/foundation/transparent/notice.png",
url: "/pages/profile/m06-help-center",
routeKey: "M06",
},
{
label: "关于家谱",
note: "协议、隐私与版本",
icon: "/static/assets/foundation/transparent/brand-seal.png",
url: "/pages/profile/m10-about-settings",
routeKey: "M10",
},
{
label: "邀请家人",
note: "邀请码与家谱推广",
note: "邀请规则与接入状态",
icon: "/static/assets/foundation/transparent/brand-seal.png",
url: "/pages/profile/m08-promotion",
routeKey: "M08",
},
{
label: "服务与订单",
note: "权益说明与订单记录",
icon: "/static/assets/foundation/transparent/notice.png",
url: "/pages/profile/m09-vip-orders",
routeKey: "M09",
},
];
@@ -169,11 +178,10 @@ onLoad((query) => {
const restoreProfile = () => {
profileState.value = "ready";
};
const toProfile = () =>
uni.navigateTo({ url: "/pages/profile/m02-edit-profile" });
const toNotifications = () =>
uni.navigateTo({ url: "/pages/notification/n01-message-center" });
const openItem = (item) => uni.navigateTo({ url: item.url });
const toProfile = () => openPage("M02", {}, "M01");
const toNotifications = () => openPage("N01", {}, "M01");
const openItem = (item) =>
item.routeKey ? openPage(item.routeKey, {}, "M01") : Promise.resolve(false);
</script>
<style scoped lang="scss">
+65 -22
View File
@@ -2,56 +2,102 @@
<template>
<view class="profile-edit-page" :class="{ 'profile-state--ready': profileState === 'ready', 'profile-state--saving': profileState === 'saving' }">
<ModulePageBackground module="profile" />
<view class="page-layer"><PageHeader title="个人资料" /></view>
<view class="page-layer"><PageHeader title="个人资料" custom-back @back="requestBack" /></view>
<view class="page-content page-layer">
<view class="profile-avatar-card">
<image class="avatar-seal" src="/static/assets/foundation/transparent/brand-seal.png" mode="aspectFit" />
<view class="avatar-copy"><text>{{ profileForm.nickname || "未填写昵称" }}</text><text>头像将在相册权限接入后支持上传</text></view>
<view class="avatar-copy"><text>{{ profileForm.nickName || "未填写昵称" }}</text><text>头像将在上传接口批次接入</text></view>
<view class="text-action" role="button" aria-label="选择头像" @click="chooseAvatar">选择头像</view>
</view>
<view class="form-panel">
<view class="form-row"><text>昵称</text><input v-model.trim="profileForm.nickname" maxlength="20" aria-label="昵称" placeholder="请输入昵称" /></view>
<text v-if="errors.nickname" class="field-error">{{ errors.nickname }}</text>
<view class="form-row"><text>真实姓名</text><input v-model.trim="profileForm.realName" maxlength="20" aria-label="真实姓名" placeholder="请输入真实姓名" /></view>
<view class="form-row"><text>常住地区</text><input v-model.trim="profileForm.region" maxlength="40" aria-label="常住地区" placeholder="省 / 市 / 区县" /></view>
<view class="textarea-row"><text>个人简介</text><textarea v-model.trim="profileForm.bio" auto-height maxlength="300" aria-label="个人简介" placeholder="介绍你的家族身份或经历" /></view>
<text class="counter">{{ profileForm.bio.length }}/300</text>
<text v-if="errors.bio" class="field-error">{{ errors.bio }}</text>
<view class="form-row"><text>昵称</text><input v-model.trim="profileForm.nickName" maxlength="30" aria-label="昵称" placeholder="请输入昵称" @input="errors.nickName = ''" /></view>
<text v-if="errors.nickName" class="field-error">{{ errors.nickName }}</text>
<view class="form-row"><text>真实姓名</text><input v-model.trim="profileForm.realName" maxlength="30" aria-label="真实姓名" placeholder="请输入真实姓名" /></view>
<view class="form-row"><text>邮箱</text><input v-model.trim="profileForm.email" maxlength="100" aria-label="邮箱" placeholder="选填,用于接收通知" @input="errors.email = ''" /></view>
<text v-if="errors.email" class="field-error">{{ errors.email }}</text>
</view>
<AppButton block :disabled="profileState === 'saving'" :label="profileState === 'saving' ? '正在保存' : '保存资料'" @click="saveProfile" />
<AppButton block :disabled="profileState === 'saving'" :label="profileState === 'saving' ? '正在校验' : '生成本地校验预览'" @click="saveProfile" />
</view>
<AppToast :visible="toastVisible" :message="toastMessage" />
<AppDialog
:visible="discardVisible"
:close-on-mask="false"
eyebrow="放弃确认"
title="放弃当前填写?"
message="尚未提交服务器的资料将从当前页面清除。"
confirm-text="确认放弃"
cancel-text="继续填写"
show-cancel
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</view>
</template>
<script setup>
import { onUnmounted, reactive, ref } from "vue";
import { computed, reactive, ref } from "vue";
import { onBackPress, onUnload } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { currentUser } from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
handleBackPress,
runBackGuard,
} from "@/utils/navigation.js";
const profileForm = reactive({ nickname: "汤文清", realName: "汤文清", region: "河南省 周口市", bio: "热心参与家谱资料整理。" });
const errors = reactive({ nickname: "", bio: "" });
const profileForm = reactive({ nickName: currentUser.name, realName: currentUser.name, email: "" });
const errors = reactive({ nickName: "", email: "" });
const profileState = ref("ready");
const toastVisible = ref(false);
const toastMessage = ref("");
const discardVisible = ref(false);
let timer = null;
const formSnapshot = computed(() => JSON.stringify(profileForm));
const baseline = ref(formSnapshot.value);
const isDirty = computed(() => formSnapshot.value !== baseline.value);
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const showToast = (message) => { toastMessage.value = message; toastVisible.value = true; clearTimeout(timer); timer = setTimeout(() => (toastVisible.value = false), 1800); };
const chooseAvatar = () => showToast("头像选择将在相册权限接入后开放");
const validateProfile = () => {
errors.nickname = profileForm.nickname ? "" : "请填写昵称";
errors.bio = profileForm.bio.length > 300 ? "个人简介不能超过 300 字" : "";
return !errors.nickname && !errors.bio;
errors.nickName = profileForm.nickName ? "" : "请填写昵称";
errors.email = !profileForm.email || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(profileForm.email)
? ""
: "请输入正确的邮箱地址";
return !errors.nickName && !errors.email;
};
const saveProfile = () => {
if (!validateProfile() || profileState.value === "saving") return;
profileState.value = "saving";
clearTimeout(timer);
timer = setTimeout(() => { profileState.value = "ready"; showToast("个人资料已保存"); }, 500);
timer = setTimeout(() => {
profileState.value = "ready";
showToast("本地校验通过,尚未提交服务器");
}, 500);
};
onUnmounted(() => clearTimeout(timer));
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
submitting: profileState.value === "saving",
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
onBackPress((event) => handleBackPress(event, requestBack));
onUnload(() => {
clearTimeout(timer);
discardConfirmation.dispose();
});
</script>
<style scoped lang="scss">
@@ -70,11 +116,8 @@ onUnmounted(() => clearTimeout(timer));
.text-action { min-height: 72rpx; display: flex; align-items: center; color: $brand-red; font-size: 22rpx; }
.form-panel { margin-top: 22rpx; padding: 20rpx 34rpx 30rpx; box-sizing: border-box; }
.form-row { display: grid; grid-template-columns: 150rpx minmax(0,1fr); min-height: 92rpx; align-items: center; border-bottom: 1px solid rgba(181,137,63,.42); gap: 18rpx; }
.form-row > text, .textarea-row > text { color: $ink; font-size: 24rpx; font-weight: 700; }
.form-row > text { color: $ink; font-size: 24rpx; font-weight: 700; }
.form-row input { width: auto; min-width: 0; min-height: 70rpx; color: $ink; font-size: 24rpx; text-align: right; }
.textarea-row { padding-top: 24rpx; }
.textarea-row textarea { display: block; width: auto; min-width: 0; min-height: 150rpx; margin-top: 14rpx; color: $ink; font-size: 24rpx; line-height: 1.6; }
.counter { display: block; color: $ink-muted; font-size: 20rpx; text-align: right; }
.field-error { display: block; padding-top: 7rpx; color: #b42318; font-size: 21rpx; text-align: right; }
.page-content > .app-button { margin-top: 26rpx; }
@media(max-width:340px){.page-content{padding-right:22rpx;padding-left:22rpx}.profile-avatar-card{grid-template-columns:72rpx minmax(0,1fr);padding-right:26rpx;padding-left:26rpx}.text-action{grid-column:2}.avatar-seal{width:68rpx;max-height:78rpx}.form-row{grid-template-columns:126rpx minmax(0,1fr)}}
+10 -9
View File
@@ -1,12 +1,12 @@
<!-- 页面编号M-03用途账号安全总览与安全功能入口 -->
<template>
<view class="security-page device-state--safe">
<view class="security-page device-state--limited">
<ModulePageBackground module="profile" />
<view class="page-layer"><PageHeader title="账号与安全" /></view>
<view class="page-content page-layer">
<view class="security-summary">
<text>账号状态安全</text>
<text>手机号已绑定最近登录设备未发现异常</text>
<text>账号安全操作</text>
<text>修改密码和换绑手机号目前只提供本地校验预览不会变更服务器账号信息</text>
</view>
<view class="security-list">
<view v-for="item in securityItems" :key="item.key" class="security-row" role="button" :aria-label="item.label" @click="openSecurityItem(item)">
@@ -15,7 +15,7 @@
<image class="chevron" src="/static/assets/foundation/transparent/chevron-right.png" mode="aspectFit" />
</view>
</view>
<AppButton block type="secondary" label="检查账号安全" @click="checkSecurity" />
<AppButton block type="secondary" label="查看接入状态" @click="checkSecurity" />
</view>
<AppToast :visible="toastVisible" :message="toastMessage" />
</view>
@@ -27,18 +27,19 @@ import AppButton from "@/components/AppButton.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { currentUser } from "@/data/mock.js";
import { openPage } from "@/utils/navigation.js";
const securityItems = [
{ key: "password", label: "登录密码", note: "建议定期更新密码", icon: "/static/assets/modules/auth/transparent/a01-icon-lock-v1.png", url: "/pages/profile/m04-change-password" },
{ key: "phone", label: "绑定手机号", note: "139****6421", icon: "/static/assets/modules/auth/transparent/a01-icon-phone-v1.png", url: "/pages/profile/m05-change-phone" },
{ key: "device", label: "登录设备", note: "当前设备 · 今天登录", icon: "/static/assets/foundation/transparent/auth-login-outline.png" },
{ key: "password", label: "登录密码", note: "建议定期更新密码", icon: "/static/assets/modules/auth/transparent/a01-icon-lock-v1.png", routeKey: "M04" },
{ key: "phone", label: "绑定手机号", note: currentUser.phone, icon: "/static/assets/modules/auth/transparent/a01-icon-phone-v1.png", routeKey: "M05" },
];
const toastVisible = ref(false);
const toastMessage = ref("");
let timer = null;
const showToast = (message) => { toastMessage.value = message; toastVisible.value = true; clearTimeout(timer); timer = setTimeout(() => (toastVisible.value = false), 1800); };
const openSecurityItem = (item) => item.url ? uni.navigateTo({ url: item.url }) : showToast("当前设备登录正常,未发现异常记录");
const checkSecurity = () => showToast("安全检查完成,当前账号状态正常");
const openSecurityItem = (item) => openPage(item.routeKey, {}, "M03");
const checkSecurity = () => showToast("账号安全接口将在后续独立批次接入");
onUnmounted(() => clearTimeout(timer));
</script>
+47 -5
View File
@@ -2,7 +2,7 @@
<template>
<view class="password-page" :class="{ 'password-state--ready': passwordState === 'ready', 'password-state--saving': passwordState === 'saving' }">
<ModulePageBackground module="profile" />
<view class="page-layer"><PageHeader title="修改密码" /></view>
<view class="page-layer"><PageHeader title="修改密码" custom-back @back="requestBack" /></view>
<view class="page-content page-layer">
<view class="security-tip"><text>设置安全密码</text><text>建议使用 832 位字母与数字组合不要与其他应用共用</text></view>
<view class="form-panel">
@@ -15,18 +15,34 @@
<text v-if="errors[field.key]" class="field-error">{{ errors[field.key] }}</text>
</view>
</view>
<AppButton block :disabled="passwordState === 'saving'" :label="passwordState === 'saving' ? '正在修改' : '确认修改'" @click="savePassword" />
<AppButton block :disabled="passwordState === 'saving'" :label="passwordState === 'saving' ? '正在校验' : '校验新密码(不提交)'" @click="savePassword" />
</view>
<AppToast :visible="toastVisible" :message="toastMessage" />
<AppDialog
:visible="discardVisible"
:close-on-mask="false"
eyebrow="放弃确认"
title="放弃密码填写?"
message="当前密码和新密码尚未提交服务器。"
confirm-text="确认放弃"
cancel-text="继续填写"
show-cancel
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</view>
</template>
<script setup>
import { onUnmounted, reactive, ref } from "vue";
import { computed, reactive, ref } from "vue";
import { onBackPress, onUnload } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import { handleBackPress, runBackGuard } from "@/utils/navigation.js";
import {
PASSWORD_POLICY_MESSAGE,
validatePassword,
@@ -36,12 +52,22 @@ const passwordForm = reactive({ current: "", next: "", confirm: "" });
const passwordVisible = reactive({ current: false, next: false, confirm: false });
const errors = reactive({ current: "", next: "", confirm: "" });
const passwordState = ref("ready");
const discardVisible = ref(false);
const passwordFields = [
{ key: "current", label: "当前密码", placeholder: "请输入当前密码" },
{ key: "next", label: "新密码", placeholder: "832 位字母与数字" },
{ key: "confirm", label: "确认新密码", placeholder: "请再次输入新密码" },
];
const toastVisible = ref(false); const toastMessage = ref(""); let timer = null;
const formSnapshot = computed(() => JSON.stringify(passwordForm));
const baseline = ref(formSnapshot.value);
const isDirty = computed(() => formSnapshot.value !== baseline.value);
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const showToast = (message) => { toastMessage.value = message; toastVisible.value = true; clearTimeout(timer); timer = setTimeout(() => (toastVisible.value = false), 1800); };
const togglePassword = (key) => { passwordVisible[key] = !passwordVisible[key]; };
const validateForm = () => {
@@ -56,9 +82,25 @@ const validateForm = () => {
const savePassword = () => {
if (!validateForm() || passwordState.value === "saving") return;
passwordState.value = "saving";
timer = setTimeout(() => { passwordState.value = "ready"; passwordForm.current = ""; passwordForm.next = ""; passwordForm.confirm = ""; showToast("密码已修改,请妥善保管新密码"); }, 500);
timer = setTimeout(() => {
passwordState.value = "ready";
showToast("本地校验通过,尚未提交服务器");
}, 500);
};
onUnmounted(() => clearTimeout(timer));
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
submitting: passwordState.value === "saving",
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
onBackPress((event) => handleBackPress(event, requestBack));
onUnload(() => {
clearTimeout(timer);
discardConfirmation.dispose();
});
</script>
<style scoped lang="scss">
+55 -13
View File
@@ -2,52 +2,94 @@
<template>
<view class="phone-page" :class="{ 'phone-state--ready': phoneState === 'ready', 'phone-state--saving': phoneState === 'saving' }">
<ModulePageBackground module="profile" />
<view class="page-layer"><PageHeader title="修改手机号" /></view>
<view class="page-layer"><PageHeader title="修改手机号" custom-back @back="requestBack" /></view>
<view class="page-content page-layer">
<view class="current-phone"><text>当前绑定手机号</text><text>{{ phoneForm.currentPhone }}</text><text>更换后新手机号将用于登录与安全验证</text></view>
<view class="form-panel">
<view class="form-row"><text>新手机号</text><input v-model.trim="phoneForm.newPhone" type="number" maxlength="11" aria-label="新手机号" placeholder="请输入新手机号" @input="errors.newPhone = ''" /></view>
<text v-if="errors.newPhone" class="field-error">{{ errors.newPhone }}</text>
<view class="form-row code-row"><text>验证码</text><input v-model.trim="phoneForm.code" type="number" maxlength="6" aria-label="短信验证码" placeholder="6 位验证码" @input="errors.code = ''" /><view class="code-action" role="button" :aria-label="codeCountdown ? `${codeCountdown}秒后可重新发送` : '发送验证码'" @click="sendCode">{{ codeCountdown ? `${codeCountdown}s` : "发送验证码" }}</view></view>
<view class="form-row code-row"><text>验证码</text><input v-model.trim="phoneForm.code" type="number" maxlength="4" aria-label="短信验证码" placeholder="4 位验证码" @input="errors.code = ''" /><view class="code-action" role="button" aria-label="检查验证码发送条件" @click="sendCode">发送条件</view></view>
<text v-if="errors.code" class="field-error">{{ errors.code }}</text>
</view>
<AppButton block :disabled="phoneState === 'saving'" :label="phoneState === 'saving' ? '正在更换' : '确认更换'" @click="savePhone" />
<AppButton block :disabled="phoneState === 'saving'" :label="phoneState === 'saving' ? '正在校验' : '校验换绑信息(不提交)'" @click="savePhone" />
</view>
<AppToast :visible="toastVisible" :message="toastMessage" />
<AppDialog
:visible="discardVisible"
:close-on-mask="false"
eyebrow="放弃确认"
title="放弃换绑填写?"
message="新手机号和验证码尚未提交服务器。"
confirm-text="确认放弃"
cancel-text="继续填写"
show-cancel
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</view>
</template>
<script setup>
import { onUnmounted, reactive, ref } from "vue";
import { computed, reactive, ref } from "vue";
import { onBackPress, onUnload } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { currentUser } from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import { handleBackPress, runBackGuard } from "@/utils/navigation.js";
const phoneForm = reactive({ currentPhone: "139****6421", newPhone: "", code: "" });
const phoneForm = reactive({ currentPhone: currentUser.phone, newPhone: "", code: "" });
const errors = reactive({ newPhone: "", code: "" });
const phoneState = ref("ready");
const codeCountdown = ref(0);
const discardVisible = ref(false);
const toastVisible = ref(false); const toastMessage = ref("");
let countdownTimer = null; let stateTimer = null; let toastTimer = null;
let stateTimer = null; let toastTimer = null;
const formSnapshot = computed(() => JSON.stringify({ newPhone: phoneForm.newPhone, code: phoneForm.code }));
const baseline = ref(formSnapshot.value);
const isDirty = computed(() => formSnapshot.value !== baseline.value);
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const showToast = (message) => { toastMessage.value = message; toastVisible.value = true; clearTimeout(toastTimer); toastTimer = setTimeout(() => (toastVisible.value = false), 1800); };
const sendCode = () => {
if (codeCountdown.value) return;
if (!/^1\d{10}$/.test(phoneForm.newPhone)) { errors.newPhone = "请输入正确的新手机号"; return; }
errors.newPhone = ""; codeCountdown.value = 60; showToast("演示验证码已发送,请输入任意 6 位数字");
countdownTimer = setInterval(() => { codeCountdown.value -= 1; if (!codeCountdown.value) { clearInterval(countdownTimer); countdownTimer = null; } }, 1000);
errors.newPhone = "";
showToast("需先完成滑动行为验证;当前未发送验证码");
};
const validatePhone = () => {
errors.newPhone = /^1\d{10}$/.test(phoneForm.newPhone) ? "" : "请输入正确的新手机号";
errors.code = /^\d{6}$/.test(phoneForm.code) ? "" : "请输入 6 位验证码";
errors.code = /^\d{4}$/.test(phoneForm.code) ? "" : "请输入 4 位验证码";
return !errors.newPhone && !errors.code;
};
const savePhone = () => {
if (!validatePhone() || phoneState.value === "saving") return;
phoneState.value = "saving";
stateTimer = setTimeout(() => { phoneState.value = "ready"; phoneForm.currentPhone = `${phoneForm.newPhone.slice(0,3)}****${phoneForm.newPhone.slice(-4)}`; phoneForm.newPhone = ""; phoneForm.code = ""; showToast("绑定手机号已更新"); }, 500);
stateTimer = setTimeout(() => {
phoneState.value = "ready";
showToast("本地校验通过,尚未提交服务器");
}, 500);
};
onUnmounted(() => { clearInterval(countdownTimer); clearTimeout(stateTimer); clearTimeout(toastTimer); });
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
submitting: phoneState.value === "saving",
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
onBackPress((event) => handleBackPress(event, requestBack));
onUnload(() => {
clearTimeout(stateTimer);
clearTimeout(toastTimer);
discardConfirmation.dispose();
});
</script>
<style scoped lang="scss">
+3 -2
View File
@@ -23,6 +23,7 @@ import { computed, ref } from "vue";
import AppButton from "@/components/AppButton.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { openPage } from "@/utils/navigation.js";
const helpCategories = ["全部", "家谱", "成员", "隐私", "账号"];
const activeCategory = ref("全部");
@@ -30,7 +31,7 @@ const keyword = ref("");
const expandedIds = ref([]);
const questions = [
{ id: 1, category: "家谱", question: "如何创建一部新家谱?", answer: "进入“我的家谱”,选择新建家谱,按步骤填写姓氏、堂号和地区等基础资料。" },
{ id: 2, category: "成员", question: "如何邀请家人共同完善家谱?", answer: "家人可搜索家谱后提交加入申请,管理员核实亲属关系后完成审核。" },
{ id: 2, category: "成员", question: "如何邀请家人共同完善家谱?", answer: "家人可搜索家谱后提交加入申请,管理员核实关系;邀请码尚未接入,未来校验成功后将直接加入,不产生审核记录。" },
{ id: 3, category: "隐私", question: "哪些个人资料会展示给其他成员?", answer: "资料按家谱角色与权限展示;敏感联系方式默认脱敏,后续可在家谱设置中管理权限。" },
{ id: 4, category: "账号", question: "忘记密码后怎样恢复账号?", answer: "在登录页选择“忘记密码”,通过绑定手机号验证后设置新密码。" },
{ id: 5, category: "家谱", question: "家谱资料填写错了怎么办?", answer: "有编辑权限的成员可以进入对应资料页修改;关键世系关系建议核对后再保存。" },
@@ -40,7 +41,7 @@ const filteredQuestions = computed(() => {
return questions.filter((item) => (activeCategory.value === "全部" || item.category === activeCategory.value) && (!query || `${item.question}${item.answer}`.toLowerCase().includes(query)));
});
const toggleQuestion = (id) => { expandedIds.value = expandedIds.value.includes(id) ? expandedIds.value.filter((item) => item !== id) : [...expandedIds.value, id]; };
const contactSupport = () => uni.navigateTo({ url: "/pages/profile/m07-feedback" });
const contactSupport = () => openPage("M07", {}, "M06");
</script>
<style scoped lang="scss">
+234 -24
View File
@@ -1,53 +1,263 @@
<!-- 页面编号M-07用途提交意见反馈 -->
<template>
<view class="feedback-page" :class="{ 'feedback-state--ready': feedbackState === 'ready', 'feedback-state--submitting': feedbackState === 'submitting' }">
<view
class="feedback-page"
:class="{
'feedback-state--ready': feedbackState === 'ready',
'feedback-state--submitting': feedbackState === 'submitting',
'feedback-state--success': feedbackState === 'success',
'feedback-state--error': feedbackState === 'error',
'feedback-state--uncertain': feedbackState === 'uncertain',
}"
>
<ModulePageBackground module="profile" />
<view class="page-layer"><PageHeader title="意见反馈" /></view>
<view class="page-layer"><PageHeader title="意见反馈" custom-back @back="requestBack" /></view>
<view class="page-content page-layer">
<text class="lead">你的建议会帮助我们把家谱做得更好</text>
<view class="type-grid">
<view v-for="type in feedbackTypes" :key="type" class="type-chip" :class="{ active: feedbackForm.type === type }" role="button" @click="feedbackForm.type = type; errors.type = ''">{{ type }}</view>
<view class="type-field" role="group" aria-label="反馈类型选填" aria-describedby="feedback-type-note">
<text id="feedback-type-note" class="field-note">反馈类型为选填可再次点击取消选择</text>
<view class="type-grid">
<button
v-for="type in feedbackTypes"
:key="type"
class="type-chip"
:class="{ active: feedbackForm.feedbackType === type }"
:aria-pressed="feedbackForm.feedbackType === type"
:disabled="feedbackState === 'submitting'"
@click="selectFeedbackType(type)"
>{{ type }}</button>
</view>
</view>
<text v-if="errors.type" class="field-error">{{ errors.type }}</text>
<view class="form-panel">
<textarea v-model.trim="feedbackForm.description" auto-height maxlength="500" aria-label="问题描述" placeholder="请说明遇到的问题、操作步骤或建议" @input="errors.description = ''" />
<text class="counter">{{ feedbackForm.description.length }}/500</text>
<text v-if="errors.description" class="field-error">{{ errors.description }}</text>
<view class="contact-row"><text>联系方式</text><input v-model.trim="feedbackForm.contact" maxlength="50" aria-label="联系方式" placeholder="手机号或邮箱(选填)" /></view>
<textarea
v-model.trim="feedbackForm.feedbackContent"
auto-height
maxlength="500"
aria-label="问题描述"
aria-required="true"
:aria-describedby="errors.feedbackContent ? 'feedback-content-help feedback-content-error' : 'feedback-content-help'"
:aria-invalid="Boolean(errors.feedbackContent)"
:disabled="feedbackState === 'submitting'"
:focus="feedbackContentFocused"
placeholder="请说明遇到的问题、操作步骤或建议"
@input="errors.feedbackContent = ''"
@blur="feedbackContentFocused = false"
/>
<text class="counter">{{ feedbackForm.feedbackContent.length }}/500</text>
<text id="feedback-content-help" class="field-note">请勿填写密码验证码等敏感信息</text>
<text v-if="errors.feedbackContent" id="feedback-content-error" class="field-error">{{ errors.feedbackContent }}</text>
<view class="contact-row">
<text>联系方式</text>
<input
v-model.trim="feedbackForm.contactInfo"
maxlength="50"
aria-label="联系方式(选填)"
:disabled="feedbackState === 'submitting'"
placeholder="手机号或邮箱(选填)"
/>
</view>
</view>
<text class="privacy-note">仅用于跟进本次反馈不会在家谱中公开</text>
<AppButton block :disabled="feedbackState === 'submitting'" :label="feedbackState === 'submitting' ? '正在提交' : '提交反馈'" @click="submitFeedback" />
<text class="privacy-note">联系方式选填便于需要时核实本次反馈</text>
<view
v-if="feedbackResult"
class="feedback-result"
:class="{
'feedback-result--success': feedbackResultTone === 'success',
'feedback-result--error': feedbackResultTone === 'error',
'feedback-result--uncertain': feedbackResultTone === 'uncertain',
}"
:role="feedbackResultTone === 'error' ? 'alert' : 'status'"
:aria-live="feedbackResultTone === 'error' ? 'assertive' : 'polite'"
>{{ feedbackResult }}</view>
<AppButton block :disabled="submitDisabled" :label="submitLabel" @click="submitFeedback" />
</view>
<AppToast :visible="toastVisible" :message="toastMessage" />
<AppDialog
:visible="discardVisible"
:close-on-mask="false"
eyebrow="放弃确认"
title="放弃当前反馈?"
message="当前修改尚未提交,离开后将清除这些修改。"
confirm-text="确认放弃"
cancel-text="继续填写"
show-cancel
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</view>
</template>
<script setup>
import { onUnmounted, reactive, ref } from "vue";
import { computed, nextTick, reactive, ref, watch } from "vue";
import { onBackPress, onUnload } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppToast from "@/components/AppToast.vue";
import AppDialog from "@/components/AppDialog.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { appApi, createRequestController, isRequestCancelled } from "@/utils/api.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import { handleBackPress, runBackGuard } from "@/utils/navigation.js";
const feedbackTypes = ["功能问题", "使用建议", "内容纠错", "其他"];
const feedbackForm = reactive({ type: "", description: "", contact: "" });
const errors = reactive({ type: "", description: "" });
const feedbackForm = reactive({ feedbackType: "", feedbackContent: "", contactInfo: "" });
const errors = reactive({ feedbackContent: "" });
const feedbackState = ref("ready");
const toastVisible = ref(false); const toastMessage = ref(""); let timer = null;
const feedbackResult = ref("");
const feedbackResultTone = ref("");
const feedbackContentFocused = ref(false);
const discardVisible = ref(false);
const lastSubmittedSnapshot = ref("");
const lastUncertainSnapshot = ref("");
let pageActive = true;
const requestController = createRequestController();
const normalizedForm = computed(() => ({
feedbackType: feedbackForm.feedbackType.trim(),
feedbackContent: feedbackForm.feedbackContent.trim(),
contactInfo: feedbackForm.contactInfo.trim(),
}));
const formSnapshot = computed(() => JSON.stringify(normalizedForm.value));
const baseline = ref(formSnapshot.value);
const isDirty = computed(() => formSnapshot.value !== baseline.value);
const submitDisabled = computed(() =>
feedbackState.value === "submitting" ||
(Boolean(lastSubmittedSnapshot.value) && formSnapshot.value === lastSubmittedSnapshot.value) ||
(Boolean(lastUncertainSnapshot.value) && formSnapshot.value === lastUncertainSnapshot.value),
);
const submitLabel = computed(() => {
if (feedbackState.value === "submitting") return "正在提交";
if (feedbackState.value === "success") return "反馈已提交";
if (feedbackState.value === "uncertain") return "提交结果待确认";
if (feedbackState.value === "error") return "重新提交";
return "提交反馈";
});
const discardConfirmation = createDiscardConfirmation((visible) => {
discardVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const validateFeedback = () => {
errors.type = feedbackForm.type ? "" : "请选择反馈类型";
errors.description = feedbackForm.description.length < 5 ? "请至少填写 5 个字的问题描述" : "";
return !errors.type && !errors.description;
errors.feedbackContent = feedbackForm.feedbackContent.trim() ? "" : "请填写问题描述";
if (errors.feedbackContent) {
feedbackContentFocused.value = false;
nextTick(() => {
if (pageActive) feedbackContentFocused.value = true;
});
}
return !errors.feedbackContent;
};
const submitFeedback = () => {
const selectFeedbackType = (type) => {
if (feedbackState.value === "submitting") return;
feedbackForm.feedbackType = feedbackForm.feedbackType === type ? "" : type;
};
const feedbackErrorMessage = (error) => {
if (error?.code === "WRITE_UNAVAILABLE") {
return "当前为本地预览模式,反馈未提交服务器。";
}
if (error?.httpStatus === 401) {
return "登录状态已失效,服务器未确认提交成功。请重新登录后再处理。";
}
return error?.message ? `服务器未确认提交成功:${error.message}` : "服务器未确认提交成功,请稍后再试。";
};
const submittedFeedbackMessage = "反馈已提交。以下内容为本次提交记录;修改任一项后可提交新反馈。";
const submittedWithPendingEditsMessage = "上一份反馈已提交,当前修改尚未提交。";
const uncertainFeedbackMessage = "提交结果可能未知。为避免重复记录,当前内容不能直接重提;请稍后确认或修改后提交新反馈。";
const uncertainWithPendingEditsMessage = "上一份反馈的提交结果仍待确认,当前修改尚未提交。";
const isFeedbackResultUncertain = (error) => {
if (["REQUEST_TIMEOUT", "NETWORK_ERROR", "RESPONSE_INVALID"].includes(error?.code)) {
return true;
}
if (error?.code !== "HTTP_ERROR") return false;
const status = error.httpStatus;
return (status >= 200 && status < 400) || status === 408 || status >= 500;
};
const submitFeedback = async () => {
if (!validateFeedback() || feedbackState.value === "submitting") return;
if (
(lastSubmittedSnapshot.value && formSnapshot.value === lastSubmittedSnapshot.value) ||
(lastUncertainSnapshot.value && formSnapshot.value === lastUncertainSnapshot.value)
) return;
const submittedSnapshot = formSnapshot.value;
const submittedPayload = JSON.parse(submittedSnapshot);
feedbackState.value = "submitting";
timer = setTimeout(() => { feedbackState.value = "ready"; feedbackForm.type = ""; feedbackForm.description = ""; feedbackForm.contact = ""; toastMessage.value = "反馈已保存,服务接入后将提交给家谱助手"; toastVisible.value = true; timer = setTimeout(() => (toastVisible.value = false), 2200); }, 500);
feedbackResult.value = "";
feedbackResultTone.value = "";
try {
await appApi.submitFeedback(submittedPayload, { requestController });
if (!pageActive) return;
baseline.value = submittedSnapshot;
lastSubmittedSnapshot.value = submittedSnapshot;
feedbackResultTone.value = "success";
if (formSnapshot.value === submittedSnapshot) {
feedbackState.value = "success";
feedbackResult.value = submittedFeedbackMessage;
} else {
feedbackState.value = "ready";
feedbackResult.value = submittedWithPendingEditsMessage;
}
} catch (error) {
if (!pageActive || isRequestCancelled(error)) return;
if (isFeedbackResultUncertain(error)) {
lastUncertainSnapshot.value = submittedSnapshot;
feedbackResultTone.value = "uncertain";
if (formSnapshot.value === submittedSnapshot) {
feedbackState.value = "uncertain";
feedbackResult.value = uncertainFeedbackMessage;
} else {
feedbackState.value = "ready";
feedbackResult.value = uncertainWithPendingEditsMessage;
}
return;
}
feedbackState.value = "error";
feedbackResult.value = feedbackErrorMessage(error);
feedbackResultTone.value = "error";
}
};
onUnmounted(() => clearTimeout(timer));
watch(formSnapshot, (snapshot) => {
if (feedbackState.value === "submitting") return;
errors.feedbackContent = "";
if (lastSubmittedSnapshot.value && snapshot === lastSubmittedSnapshot.value) {
feedbackState.value = "success";
feedbackResult.value = submittedFeedbackMessage;
feedbackResultTone.value = "success";
return;
}
if (lastUncertainSnapshot.value && snapshot === lastUncertainSnapshot.value) {
feedbackState.value = "uncertain";
feedbackResult.value = uncertainFeedbackMessage;
feedbackResultTone.value = "uncertain";
return;
}
feedbackState.value = "ready";
if (lastUncertainSnapshot.value) {
feedbackResult.value = uncertainWithPendingEditsMessage;
feedbackResultTone.value = "uncertain";
} else if (lastSubmittedSnapshot.value) {
feedbackResult.value = submittedWithPendingEditsMessage;
feedbackResultTone.value = "success";
} else {
feedbackResult.value = "";
feedbackResultTone.value = "";
}
});
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
submitting: feedbackState.value === "submitting",
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
onBackPress((event) => handleBackPress(event, requestBack));
onUnload(() => {
pageActive = false;
requestController.abort();
discardConfirmation.dispose();
});
</script>
<style scoped lang="scss">
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
.feedback-page{display:flex;min-height:100vh;flex-direction:column;background:$paper}.page-layer{z-index:1}.page-content{flex:1;padding:26rpx 30rpx 72rpx}.lead{display:block;color:$ink-muted;font-size:23rpx;line-height:1.5;text-align:center}.type-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14rpx;margin-top:20rpx}.type-chip{@include adaptive.adaptive-profile-field;display:flex;min-height:76rpx;align-items:center;justify-content:center;padding:10rpx 16rpx;color:$ink-muted;font-size:22rpx;text-align:center}.type-chip.active{color:$brand-red;font-weight:700;filter:saturate(1.2)}.form-panel{@include adaptive.adaptive-profile-content;margin-top:20rpx;padding:30rpx 34rpx}.form-panel textarea{display:block;width:auto;min-width:0;min-height:210rpx;color:$ink;font-size:24rpx;line-height:1.65}.counter{display:block;color:$ink-muted;font-size:20rpx;text-align:right}.contact-row{display:grid;grid-template-columns:130rpx minmax(0,1fr);min-height:88rpx;align-items:center;gap:16rpx;margin-top:16rpx;border-top:1px solid rgba(181,137,63,.38)}.contact-row text{color:$ink;font-size:23rpx;font-weight:700}.contact-row input{width:auto;min-width:0;min-height:68rpx;color:$ink;font-size:22rpx;text-align:right}.field-error{display:block;margin-top:7rpx;color:#b42318;font-size:20rpx;line-height:1.4;text-align:right}.privacy-note{display:block;margin-top:15rpx;color:$ink-muted;font-size:20rpx;line-height:1.5;text-align:center}.page-content>.app-button{margin-top:24rpx}@media(max-width:340px){.page-content{padding-right:22rpx;padding-left:22rpx}.form-panel{padding-right:26rpx;padding-left:26rpx}}
.feedback-page{display:flex;min-height:100vh;flex-direction:column;background:$paper}.page-layer{z-index:1}.page-content{flex:1;padding:26rpx 30rpx 72rpx}.lead{display:block;color:$ink-muted;font-size:23rpx;line-height:1.5;text-align:center}.type-field{margin-top:20rpx}.field-note{display:block;color:$ink-muted;font-size:20rpx;line-height:1.5}.type-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14rpx;margin-top:10rpx}.type-chip{margin:0;padding:0;border:0;background:transparent;line-height:normal;@include adaptive.adaptive-profile-field;display:flex;min-height:88rpx;align-items:center;justify-content:center;color:$ink-muted;font-size:22rpx;text-align:center}.type-chip::after{border:0}.type-chip.active{color:$brand-red;font-weight:700;filter:saturate(1.2)}.type-chip[disabled]{opacity:.55}.form-panel{@include adaptive.adaptive-profile-content;margin-top:20rpx;padding:30rpx 34rpx}.form-panel textarea{display:block;width:auto;min-width:0;min-height:210rpx;color:$ink;font-size:24rpx;line-height:1.65}.form-panel textarea[disabled],.contact-row input[disabled]{opacity:.65}.counter{display:block;color:$ink-muted;font-size:20rpx;text-align:right}.contact-row{display:grid;grid-template-columns:130rpx minmax(0,1fr);min-height:88rpx;align-items:center;gap:16rpx;margin-top:16rpx;border-top:1px solid rgba(181,137,63,.38)}.contact-row text{color:$ink;font-size:23rpx;font-weight:700}.contact-row input{width:auto;min-width:0;min-height:68rpx;color:$ink;font-size:22rpx;text-align:right}.field-error{display:block;margin-top:7rpx;color:#b42318;font-size:20rpx;line-height:1.4;text-align:right}.privacy-note{display:block;margin-top:15rpx;color:$ink-muted;font-size:20rpx;line-height:1.5;text-align:center}.feedback-result{margin-top:18rpx;padding:18rpx 20rpx;border:1px solid rgba(122,91,46,.24);border-radius:12rpx;font-size:21rpx;line-height:1.55}.feedback-result--success{border-color:rgba(41,112,66,.34);background:rgba(234,246,237,.88);color:#245f39}.feedback-result--error{border-color:rgba(180,35,24,.3);background:rgba(255,241,239,.9);color:#8f241c}.feedback-result--uncertain{border-color:rgba(155,101,22,.34);background:rgba(255,248,229,.92);color:#76500f}.page-content>.app-button{margin-top:24rpx}@media(max-width:340px){.page-content{padding-right:22rpx;padding-left:22rpx}.form-panel{padding-right:26rpx;padding-left:26rpx}}
</style>
+22 -23
View File
@@ -1,47 +1,46 @@
<!-- 页面编号M-08用途邀请家人共建家谱 -->
<template>
<view class="promotion-page share-state--ready">
<view class="promotion-page share-state--unavailable">
<ModulePageBackground module="profile" />
<view class="page-layer"><PageHeader title="邀请家人" /></view>
<view class="page-layer"><PageHeader title="邀请家人" custom-back @back="requestBack" /></view>
<view class="page-content page-layer">
<view class="invite-hero">
<image src="/static/assets/foundation/transparent/brand-seal.png" mode="aspectFit" />
<text>邀请亲友共建家族记忆</text>
<text>家人搜索家谱或使用邀请码后仍需管理员审核才能加入</text>
<text>邀请码校验成功后直接加入不会生成入谱审核记录</text>
</view>
<view class="invite-code-card">
<text>汝南汤氏家谱邀请码</text>
<text class="invite-code">{{ inviteCode }}</text>
<view class="copy-action" role="button" aria-label="复制邀请码" @click="copyInviteCode">复制邀请码</view>
<view v-if="inviteState === 'unavailable'" class="unavailable-card">
<text>当前没有可用邀请码</text>
<text>当前尚未接入邀请码校验与签发接口页面不会生成复制或展示虚假邀请码</text>
</view>
<view class="steps-card"><text>邀请步骤</text><text>1. 生成邀请信息</text><text>2. 发送给家人</text><text>3. 家人提交加入申请</text><text>4. 管理员核实并审核</text></view>
<AppButton block label="生成邀请海报" @click="generatePoster" />
<view class="steps-card"><text>开放条件</text><text>1. 后端提供邀请码签发接口</text><text>2. 明确有效期使用次数和失效规则</text><text>3. 校验家谱权限与直接加入结果</text></view>
<AppButton block type="secondary" label="查看邀请说明" @click="openInviteExplanation" />
</view>
<AppDialog :visible="posterVisible" eyebrow="家谱邀请" title="汝南汤氏家谱" :message="`邀请码 ${inviteCode}。长按或复制邀请码发送给家人。`" confirm-text="完成" @confirm="posterVisible = false" @close="posterVisible = false">
<image class="poster-seal" src="/static/assets/foundation/transparent/brand-seal.png" mode="aspectFit" />
</AppDialog>
<AppToast :visible="toastVisible" :message="toastMessage" />
<AppDialog :visible="explanationVisible" :close-on-mask="false" eyebrow="邀请说明" title="功能尚未接入" message="当前后端接口文档没有邀请码签发与校验合同。完成接口接入前,本页保持不可用,避免家人拿到无法验证的邀请码。" confirm-text="我知道了" @confirm="explanationVisible = false" @close="explanationVisible = false" />
</view>
</template>
<script setup>
import { onUnmounted, ref } from "vue";
import { ref } from "vue";
import { onBackPress } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { handleBackPress, runBackGuard } from "@/utils/navigation.js";
const inviteCode = ref("TN20260720");
const posterVisible = ref(false);
const toastVisible = ref(false); const toastMessage = ref(""); let timer = null;
const showToast = (message) => { toastMessage.value = message; toastVisible.value = true; clearTimeout(timer); timer = setTimeout(() => (toastVisible.value = false), 1800); };
const copyInviteCode = () => uni.setClipboardData({ data: inviteCode.value, showToast: false, success: () => showToast("邀请码已复制"), fail: () => showToast("复制失败,请长按邀请码复制") });
const generatePoster = () => { posterVisible.value = true; };
onUnmounted(() => clearTimeout(timer));
const inviteState = ref("unavailable");
const explanationVisible = ref(false);
const openInviteExplanation = () => { explanationVisible.value = true; };
const requestBack = () =>
runBackGuard({
transientOpen: explanationVisible.value,
"close-transient": () => { explanationVisible.value = false; },
});
onBackPress((event) => handleBackPress(event, requestBack));
</script>
<style scoped lang="scss">
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
.promotion-page{display:flex;min-height:100vh;flex-direction:column;background:$paper}.page-layer{z-index:1}.page-content{flex:1;padding:28rpx 30rpx 72rpx}.invite-hero,.invite-code-card,.steps-card{@include adaptive.adaptive-profile-content}.invite-hero{display:flex;min-height:300rpx;flex-direction:column;align-items:center;justify-content:center;padding:38rpx 48rpx;text-align:center}.invite-hero image{width:90rpx;height:auto;max-height:102rpx;aspect-ratio:90/102}.invite-hero text{display:block}.invite-hero text:nth-child(2){margin-top:12rpx;color:$ink;font-family:STKaiti,KaiTi,serif;font-size:34rpx;font-weight:700}.invite-hero text:last-child{margin-top:12rpx;color:$ink-muted;font-size:22rpx;line-height:1.55}.invite-code-card{min-height:220rpx;margin-top:20rpx;padding:38rpx 44rpx;text-align:center}.invite-code-card>text:first-child{display:block;color:$ink-muted;font-size:21rpx}.invite-code{display:block;margin-top:10rpx;color:$brand-red;font-size:42rpx;font-weight:700;letter-spacing:5rpx;overflow-wrap:anywhere}.copy-action{display:flex;min-height:62rpx;align-items:center;justify-content:center;color:$brand-red;font-size:22rpx}.steps-card{display:flex;min-height:260rpx;flex-direction:column;gap:10rpx;margin-top:20rpx;padding:34rpx 44rpx;color:$ink-muted;font-size:22rpx}.steps-card text:first-child{margin-bottom:4rpx;color:$ink;font-size:27rpx;font-weight:700}.page-content>.app-button{margin-top:26rpx}.poster-seal{width:96rpx;height:auto;max-height:110rpx;aspect-ratio:96/110;margin:18rpx auto 24rpx}@media(max-width:340px){.page-content{padding-right:22rpx;padding-left:22rpx}.invite-code{font-size:35rpx;letter-spacing:3rpx}}
.promotion-page{display:flex;min-height:100vh;flex-direction:column;background:$paper}.page-layer{z-index:1}.page-content{flex:1;padding:28rpx 30rpx 72rpx}.invite-hero,.unavailable-card,.steps-card{@include adaptive.adaptive-profile-content}.invite-hero{display:flex;min-height:300rpx;flex-direction:column;align-items:center;justify-content:center;padding:38rpx 48rpx;text-align:center}.invite-hero image{width:90rpx;height:auto;max-height:102rpx;aspect-ratio:90/102}.invite-hero text{display:block}.invite-hero text:nth-child(2){margin-top:12rpx;color:$ink;font-family:STKaiti,KaiTi,serif;font-size:34rpx;font-weight:700}.invite-hero text:last-child{margin-top:12rpx;color:$ink-muted;font-size:22rpx;line-height:1.55}.unavailable-card{min-height:190rpx;margin-top:20rpx;padding:40rpx 44rpx;text-align:center}.unavailable-card text{display:block}.unavailable-card text:first-child{color:$brand-red;font-size:28rpx;font-weight:700}.unavailable-card text:last-child{margin-top:12rpx;color:$ink-muted;font-size:21rpx;line-height:1.55}.steps-card{display:flex;min-height:220rpx;flex-direction:column;gap:10rpx;margin-top:20rpx;padding:34rpx 44rpx;color:$ink-muted;font-size:22rpx}.steps-card text:first-child{margin-bottom:4rpx;color:$ink;font-size:27rpx;font-weight:700}.page-content>.app-button{margin-top:26rpx}@media(max-width:340px){.page-content{padding-right:22rpx;padding-left:22rpx}}
</style>
+15 -10
View File
@@ -1,40 +1,45 @@
<!-- 页面编号M-09用途服务权益与订单记录 -->
<template>
<view class="orders-page" :class="orders.length ? 'order-state--ready' : 'order-state--empty'">
<view class="orders-page order-state--unavailable">
<ModulePageBackground module="profile" />
<view class="page-layer"><PageHeader title="VIP 与订单" /></view>
<view class="page-layer"><PageHeader title="VIP 与订单" custom-back @back="requestBack" /></view>
<view class="page-content page-layer">
<view class="service-card"><text>家谱基础服务</text><text>当前未开通付费服务</text><text>基础家谱浏览成员资料与家族记录可正常使用</text></view>
<view class="benefit-grid"><view v-for="benefit in serviceBenefits" :key="benefit.title" class="benefit-card"><text>{{ benefit.title }}</text><text>{{ benefit.copy }}</text></view></view>
<view class="section-heading"><text>订单记录</text><text>{{ orders.length }} </text></view>
<view v-if="orders.length" class="order-list"><view v-for="order in orders" :key="order.id" class="order-card"><view><text>{{ order.name }}</text><text>{{ order.createdAt }}</text></view><view><text>{{ order.amount }}</text><text>{{ order.status }}</text></view></view></view>
<view v-else class="empty-card"><text>暂无订单记录</text><text>服务开放并完成购买后订单状态会在这里展示</text></view>
<view class="section-heading"><text>订单记录</text><text>暂不可用</text></view>
<view v-if="orderState === 'unavailable'" class="empty-card"><text>订单接口尚未接入</text><text>当前页面不读取查询参数也不会虚构订单完成套餐支付和订单状态合同核对后再开放</text></view>
<AppButton block type="secondary" label="查看服务说明" @click="openServiceNotice" />
</view>
<AppDialog :visible="serviceNoticeVisible" eyebrow="服务说明" title="付费服务尚未开放" message="当前版本不会产生扣费或订单。未来开放前会明确展示价格、权益、续费与退款规则。" confirm-text="我知道了" @confirm="serviceNoticeVisible = false" @close="serviceNoticeVisible = false" />
<AppDialog :visible="serviceNoticeVisible" :close-on-mask="false" eyebrow="服务说明" title="付费服务尚未开放" message="当前版本不会产生扣费或订单。未来开放前会明确展示价格、权益、续费与退款规则。" confirm-text="我知道了" @confirm="serviceNoticeVisible = false" @close="serviceNoticeVisible = false" />
</view>
</template>
<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { handleBackPress, runBackGuard } from "@/utils/navigation.js";
const serviceBenefits = [
{ title: "更大存储", copy: "为家族影像和资料提供更多空间" },
{ title: "资料导出", copy: "按规则整理并导出家谱资料" },
{ title: "专属服务", copy: "获得家谱整理与使用支持" },
];
const orders = ref([]);
const orderState = ref("unavailable");
const serviceNoticeVisible = ref(false);
onLoad((query) => { if (query.state === "ready") orders.value = [{ id: "O20260720001", name: "家谱服务演示订单", createdAt: "2026-07-20 08:30", amount: "¥0.00", status: "演示记录" }]; });
const openServiceNotice = () => { serviceNoticeVisible.value = true; };
const requestBack = () =>
runBackGuard({
transientOpen: serviceNoticeVisible.value,
"close-transient": () => { serviceNoticeVisible.value = false; },
});
onBackPress((event) => handleBackPress(event, requestBack));
</script>
<style scoped lang="scss">
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
.orders-page{display:flex;min-height:100vh;flex-direction:column;background:$paper}.page-layer{z-index:1}.page-content{flex:1;padding:28rpx 30rpx 72rpx}.service-card,.benefit-card,.order-card,.empty-card{@include adaptive.adaptive-profile-content}.service-card{min-height:220rpx;padding:42rpx 48rpx;text-align:center}.service-card text{display:block}.service-card text:first-child{color:$ink;font-family:STKaiti,KaiTi,serif;font-size:34rpx;font-weight:700}.service-card text:nth-child(2){margin-top:10rpx;color:$brand-red;font-size:23rpx;font-weight:700}.service-card text:last-child{margin-top:12rpx;color:$ink-muted;font-size:21rpx;line-height:1.55}.benefit-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12rpx;margin-top:18rpx}.benefit-card{min-height:150rpx;padding:28rpx 18rpx;text-align:center}.benefit-card text{display:block;overflow-wrap:anywhere}.benefit-card text:first-child{color:$ink;font-size:23rpx;font-weight:700}.benefit-card text:last-child{margin-top:8rpx;color:$ink-muted;font-size:19rpx;line-height:1.45}.section-heading{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8rpx 20rpx;margin:28rpx 6rpx 14rpx}.section-heading text:first-child{color:$ink;font-size:27rpx;font-weight:700}.section-heading text:last-child{color:$ink-muted;font-size:21rpx}.order-list{display:flex;flex-direction:column;gap:14rpx;margin-top:18rpx}.order-card{display:grid;grid-template-columns:minmax(0,1fr) auto;min-height:130rpx;align-items:center;gap:20rpx;padding:26rpx 34rpx}.order-card text{display:block;overflow-wrap:anywhere}.order-card view:first-child text:first-child{color:$ink;font-size:23rpx;font-weight:700}.order-card text:last-child{margin-top:6rpx;color:$ink-muted;font-size:20rpx}.order-card view:last-child{text-align:right}.order-card view:last-child text:first-child{color:$brand-red;font-size:23rpx;font-weight:700}.empty-card{min-height:190rpx;padding:48rpx 42rpx;text-align:center}.empty-card text{display:block}.empty-card text:first-child{color:$ink;font-size:28rpx;font-weight:700}.empty-card text:last-child{margin-top:12rpx;color:$ink-muted;font-size:21rpx;line-height:1.55}.page-content>.app-button{margin-top:26rpx}@media(max-width:340px){.page-content{padding-right:22rpx;padding-left:22rpx}.benefit-grid{grid-template-columns:1fr}.benefit-card{min-height:100rpx}.order-card{grid-template-columns:1fr}.order-card view:last-child{text-align:left}}
.orders-page{display:flex;min-height:100vh;flex-direction:column;background:$paper}.page-layer{z-index:1}.page-content{flex:1;padding:28rpx 30rpx 72rpx}.service-card,.benefit-card,.empty-card{@include adaptive.adaptive-profile-content}.service-card{min-height:220rpx;padding:42rpx 48rpx;text-align:center}.service-card text{display:block}.service-card text:first-child{color:$ink;font-family:STKaiti,KaiTi,serif;font-size:34rpx;font-weight:700}.service-card text:nth-child(2){margin-top:10rpx;color:$brand-red;font-size:23rpx;font-weight:700}.service-card text:last-child{margin-top:12rpx;color:$ink-muted;font-size:21rpx;line-height:1.55}.benefit-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12rpx;margin-top:18rpx}.benefit-card{min-height:150rpx;padding:28rpx 18rpx;text-align:center}.benefit-card text{display:block;overflow-wrap:anywhere}.benefit-card text:first-child{color:$ink;font-size:23rpx;font-weight:700}.benefit-card text:last-child{margin-top:8rpx;color:$ink-muted;font-size:19rpx;line-height:1.45}.section-heading{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8rpx 20rpx;margin:28rpx 6rpx 14rpx}.section-heading text:first-child{color:$ink;font-size:27rpx;font-weight:700}.section-heading text:last-child{color:$ink-muted;font-size:21rpx}.empty-card{min-height:190rpx;padding:48rpx 42rpx;text-align:center}.empty-card text{display:block}.empty-card text:first-child{color:$ink;font-size:28rpx;font-weight:700}.empty-card text:last-child{margin-top:12rpx;color:$ink-muted;font-size:21rpx;line-height:1.55}.page-content>.app-button{margin-top:26rpx}@media(max-width:340px){.page-content{padding-right:22rpx;padding-left:22rpx}.benefit-grid{grid-template-columns:1fr}.benefit-card{min-height:100rpx}}
</style>
+26 -10
View File
@@ -2,39 +2,55 @@
<template>
<view class="about-page">
<ModulePageBackground module="profile" />
<view class="page-layer"><PageHeader title="关于家谱" /></view>
<view class="page-layer"><PageHeader title="关于家谱" custom-back @back="requestBack" /></view>
<view class="page-content page-layer">
<view class="brand-card"><image src="/static/assets/foundation/transparent/brand-seal.png" mode="aspectFit" /><text>家谱</text><text>传承每一段值得珍藏的家族记忆</text><text>版本 {{ appVersion }}</text></view>
<view class="settings-list">
<view v-for="item in agreementItems" :key="item.key" class="settings-row" role="button" :aria-label="item.label" @click="openAgreement(item)"><view><text>{{ item.label }}</text><text>{{ item.note }}</text></view><image src="/static/assets/foundation/transparent/chevron-right.png" mode="aspectFit" /></view>
</view>
<AppButton block type="secondary" :label="loggedOut ? '已退出登录' : '退出登录'" :disabled="loggedOut" @click="logoutVisible = true" />
<AppButton block type="secondary" label="退出登录" @click="logoutVisible = true" />
</view>
<AppDialog :visible="agreementVisible" eyebrow="协议与说明" :title="activeAgreement.label" :message="activeAgreement.copy" confirm-text="关闭" @confirm="agreementVisible = false" @close="agreementVisible = false" />
<AppDialog :visible="agreementVisible" :close-on-mask="false" eyebrow="协议与说明" :title="activeAgreement.label" :message="activeAgreement.copy" confirm-text="关闭" @confirm="agreementVisible = false" @close="agreementVisible = false" />
<AppDialog :visible="logoutVisible" eyebrow="账号操作" title="确认退出登录?" message="退出后需要重新验证账号;本机保存的密码不会被保留。" confirm-text="确认退出" cancel-text="取消" show-cancel :close-on-mask="false" @confirm="confirmLogout" @cancel="logoutVisible = false" @close="logoutVisible = false" />
<AppToast :visible="toastVisible" message="已退出当前账号" />
</view>
</template>
<script setup>
import { onUnmounted, reactive, ref } from "vue";
import { reactive, ref } from "vue";
import { onBackPress } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import manifest from "@/manifest.json";
import { goRoot, handleBackPress, runBackGuard } from "@/utils/navigation.js";
import { session } from "@/utils/session.js";
const appVersion = "1.0.0";
const appVersion = manifest.versionName;
const agreementItems = [
{ key: "terms", label: "用户协议", note: "了解账号与服务使用规则", copy: "用户协议正文将在正式协议服务接入后展示。当前页面不代表最终法律文本。" },
{ key: "privacy", label: "隐私政策", note: "了解个人资料如何使用与保护", copy: "隐私政策正文将在正式协议服务接入后展示。敏感资料默认按权限与脱敏规则展示。" },
{ key: "version", label: "版本说明", note: `当前版本 ${appVersion}`, copy: `当前安装版本为 ${appVersion}。基础版本采用浅色国风主题。` },
];
const activeAgreement = reactive({ label: "", copy: "" });
const agreementVisible = ref(false); const logoutVisible = ref(false); const toastVisible = ref(false); const loggedOut = ref(false); let timer = null;
const agreementVisible = ref(false);
const logoutVisible = ref(false);
const openAgreement = (item) => { activeAgreement.label = item.label; activeAgreement.copy = item.copy; agreementVisible.value = true; };
const confirmLogout = () => { logoutVisible.value = false; loggedOut.value = true; toastVisible.value = true; timer = setTimeout(() => (toastVisible.value = false), 1800); };
onUnmounted(() => clearTimeout(timer));
const confirmLogout = () => {
session.clear();
logoutVisible.value = false;
return goRoot("A01");
};
const closeActiveDialog = () => {
if (logoutVisible.value) logoutVisible.value = false;
else agreementVisible.value = false;
};
const requestBack = () =>
runBackGuard({
transientOpen: agreementVisible.value || logoutVisible.value,
"close-transient": closeActiveDialog,
});
onBackPress((event) => handleBackPress(event, requestBack));
</script>
<style scoped lang="scss">
+61 -33
View File
@@ -40,7 +40,7 @@
<view class="person-card__copy">
<text class="person-card__name">{{ person.name }}</text>
<text class="person-card__meta"
>{{ person.role }} · {{ person.generation }} </text
>{{ person.relation }} · {{ person.generation }} </text
>
<text class="person-card__hint">查看人物档案</text>
</view>
@@ -48,8 +48,8 @@
<AppButton
class="people-primary-action"
block
label="新建人物"
@click="showCreateNotice"
label="填写人物预览"
@click="createPersonPreview"
/>
</view>
@@ -70,52 +70,55 @@
<view v-else class="people-state-card">
<view class="people-state-card__copy">
<text>{{
peopleState === "empty" ? "还没有人物记录" : "人物录暂不可用"
peopleState === "empty"
? "还没有人物记录"
: peopleState === "invalid"
? "人物录入口无效"
: "人物录暂不可用"
}}</text>
<text>{{
peopleState === "empty"
? "从第一位值得铭记的家人开始建立人物录。"
: peopleState === "invalid"
? "没有找到可访问的成员家谱,页面不会展示其他家谱人物。"
: "请稍后重新进入,已有档案不会受到影响。"
}}</text>
</view>
<AppButton
:type="peopleState === 'error' ? 'secondary' : 'primary'"
:type="peopleState === 'empty' ? 'primary' : 'secondary'"
block
:label="peopleState === 'error' ? '重新查看' : '新建人物'"
@click="peopleState === 'error' ? restoreList() : showCreateNotice()"
:label="peopleState === 'error' ? '重新查看' : peopleState === 'invalid' ? '返回上一页' : '填写人物预览'"
@click="handleStateAction"
/>
</view>
</view>
<AppToast :visible="toastVisible" message="新建人物将在后续功能阶段开放" />
</view>
</template>
<script setup>
import { onLoad } from "@dcloudio/uni-app";
import { computed, onUnmounted, ref } from "vue";
import { computed, ref } from "vue";
import AppButton from "@/components/AppButton.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import {
getGenealogyFixtureAccess,
listTreeMemberPresentationFixtures,
} from "@/data/mock.js";
import { goBack, openPage } from "@/utils/navigation.js";
const people = [
{ id: 1, name: "汤文正", role: "家谱管理员", generation: 18 },
{ id: 2, name: "汤淑华", role: "家族长辈", generation: 17 },
{ id: 3, name: "汤文清", role: "青年代表", generation: 19 },
];
const genealogyId = ref("");
const people = ref([]);
const peopleState = ref("ready");
const keywordInput = ref("");
const keyword = ref("");
const toastVisible = ref(false);
let toastTimer = null;
const hasValidContext = computed(() => peopleState.value !== "invalid");
const filteredPeople = computed(() => {
const value = keyword.value.trim().toLowerCase();
if (!value) return people;
return people.filter((person) =>
`${person.name} ${person.role}${person.generation}${person.generation}`
if (!value) return people.value;
return people.value.filter((person) =>
`${person.name} ${person.relation} ${person.branch || ""} ${person.generationName || ""}${person.generation}${person.generation}`
.toLowerCase()
.includes(value),
);
@@ -133,24 +136,49 @@ const clearSearch = () => {
keyword.value = "";
};
const restoreList = () => {
peopleState.value = "ready";
people.value = listTreeMemberPresentationFixtures(genealogyId.value);
peopleState.value = people.value.length ? "ready" : "empty";
};
const openPerson = (person) =>
uni.navigateTo({
url: `/pages/records/r02-person-detail?personId=${person.id}`,
});
const showCreateNotice = () => {
uni.navigateTo({ url: "/pages/records/r02-person-detail?mode=create" });
hasValidContext.value
? openPage(
"R02",
{
genealogyId: genealogyId.value,
mode: "view",
personId: String(person.id),
},
"R01",
)
: Promise.resolve(false);
const createPersonPreview = () =>
hasValidContext.value
? openPage(
"R02",
{ genealogyId: genealogyId.value, mode: "create" },
"R01",
)
: Promise.resolve(false);
const handleStateAction = () => {
if (peopleState.value === "invalid") return goBack();
if (peopleState.value === "error") return restoreList();
return createPersonPreview();
};
onLoad((query) => {
genealogyId.value = String(query.genealogyId || "");
const access = getGenealogyFixtureAccess(genealogyId.value);
if (!["owner", "member"].includes(access.accessRole)) {
people.value = [];
peopleState.value = "invalid";
return;
}
people.value = listTreeMemberPresentationFixtures(genealogyId.value);
peopleState.value = ["empty", "error"].includes(query.state)
? query.state
: "ready";
});
onUnmounted(() => {
if (toastTimer) clearTimeout(toastTimer);
: people.value.length
? "ready"
: "empty";
});
</script>
+251 -61
View File
@@ -1,33 +1,39 @@
<!-- 页面编号R-02用途人物录详情同页编辑与受控状态 -->
<!-- 页面编号R-02用途人物录详情与不写库的人物资料预览 -->
<template>
<view class="person-detail-page" :class="`person-detail-state--${personState}`">
<ModulePageBackground module="records" />
<view class="person-detail-header"><PageHeader :title="personState === 'edit' ? (isCreateMode ? '新建人物' : '编辑人物') : '人物详情'" /></view>
<view class="person-detail-header">
<PageHeader
:title="personState === 'edit' ? (isCreateMode ? '人物预览' : '编辑预览') : '人物详情'"
custom-back
@back="requestBack"
/>
</view>
<view v-if="personState === 'loading'" class="person-detail-loading">
<AppLoading text="正在读取人物档案" description="请稍候,正在整理人物资料。" />
</view>
<view v-else class="person-detail-content">
<template v-if="['detail', 'edit', 'privacy'].includes(personState)">
<template v-if="['detail', 'edit', 'privacy', 'preview'].includes(personState)">
<view class="person-identity-card">
<view class="person-identity-card__copy">
<text class="person-identity-card__name">{{ person.name }}</text>
<text class="person-identity-card__meta">{{ person.role }} · {{ person.generation }} </text>
<text class="person-identity-card__hint">人物录档案</text>
<text class="person-identity-card__name">{{ person.name || "待填写姓名" }}</text>
<text class="person-identity-card__meta">{{ person.relation || "人物预览" }} · {{ person.generation || "—" }} </text>
<text class="person-identity-card__hint">{{ personState === "preview" ? "本地预览 · 未提交" : "人物录档案" }}</text>
</view>
</view>
</template>
<template v-if="personState === 'detail'">
<view v-for="item in detailSections" :key="item.title" class="person-archive-card">
<view><text>{{ item.title }}</text><text>{{ item.copy }}</text></view>
<view><text>{{ item.title }}</text><text>{{ item.copy || "未填写" }}</text></view>
</view>
<view class="person-related-actions">
<AppButton type="secondary" block label="成长日志" @click="toGrowthJournal" />
<AppButton type="secondary" block label="人生事" @click="toLifeEvents" />
<AppButton type="secondary" block label="人生事(待开放)" @click="toLifeEvents" />
</view>
<view class="person-edit-action" @click="enterEdit"><AppButton block label="编辑人物" /></view>
<view class="person-edit-action" @click="enterEdit"><AppButton block label="制作编辑预览" /></view>
</template>
<template v-else-if="personState === 'edit'">
@@ -41,103 +47,287 @@
<textarea v-model="draft[field.key]" auto-height :placeholder="`请输入${field.label}`" />
</view>
<view class="person-edit-actions">
<view class="person-save-action" @click="savePerson"><AppButton block label="保存人物" /></view>
<view class="person-cancel-action" @click="cancelEdit"><AppButton type="secondary" block label="取消编辑" /></view>
<view class="person-save-action" @click="savePerson"><AppButton block label="生成本地预览" /></view>
<view class="person-cancel-action" @click="cancelEdit"><AppButton type="secondary" block label="取消填写" /></view>
</view>
</template>
<view v-else-if="personState === 'preview'" class="person-state-card">
<view><text>本地预览尚未提交服务器</text><text>这份人物资料只存在于当前页面不会新增覆盖或刷新人物录</text></view>
<view class="person-state-action"><AppButton block label="返回人物录" @click="returnToPeople" /></view>
</view>
<view v-else-if="personState === 'privacy'" class="person-state-card">
<view><text>部分资料未公开</text><text>人物小传与家族印记受隐私设置保护当前只展示公开身份</text></view>
<view class="person-state-action" @click="returnToPeople"><AppButton block label="返回人物录" /></view>
<view><text>部分资料未公开</text><text>人物小传与档案备注受隐私设置保护当前只展示公开身份</text></view>
<view class="person-state-action"><AppButton block label="返回人物录" @click="returnToPeople" /></view>
</view>
<view v-else class="person-state-card">
<view>
<text>{{ personState === 'expired' ? '人物档案已失效' : '人物档案暂不可用' }}</text>
<text>{{ personState === 'expired' ? '这份人物资料已无法查看,请返回人物录选择其他档案。' : '请稍后重新查看,已有资料不会受到影响。' }}</text>
</view>
<view class="person-state-action" @click="personState === 'expired' ? returnToPeople() : restoreDetail()">
<AppButton :type="personState === 'error' ? 'secondary' : 'primary'" block :label="personState === 'expired' ? '返回人物录' : '重新查看'" />
<text>{{ personState === 'expired' ? '这份人物资料不存在或不属于当前家谱。' : '请返回人物录重新选择,页面不会回退到其他人物。' }}</text>
</view>
<view class="person-state-action"><AppButton type="secondary" block label="返回人物录" @click="returnToPeople" /></view>
</view>
</view>
<AppToast :visible="toastVisible" message="人物资料已保存" />
<AppToast :visible="toastVisible" message="已生成本地预览,尚未保存" />
<AppDialog
:visible="discardVisible"
:close-on-mask="false"
eyebrow="放弃确认"
title="放弃当前填写?"
message="尚未提交的内容将从当前页面清除。"
confirm-text="确认放弃"
cancel-text="继续填写"
show-cancel
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</view>
</template>
<script setup>
import { computed, onUnmounted, reactive, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import {
findTreeMemberPresentationFixture,
getGenealogyFixtureAccess,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
handleBackPress,
openPage,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
const people = [
{ id: "1", name: "汤文正", role: "家谱管理员", generation: "18", biography: "勤于修谱,常年整理族中旧照片与口述资料。", legacy: "参与维护汤氏家谱与家风家训。" },
{ id: "2", name: "汤淑华", role: "家族长辈", generation: "17", biography: "熟悉家族往事,愿意为后辈讲述旧时记忆。", legacy: "长期参与家族节庆与敬老活动。" },
{ id: "3", name: "汤文清", role: "青年代表", generation: "19", biography: "协助整理电子家谱和家族影像资料。", legacy: "推动年轻成员共同参与家谱维护。" },
];
const person = reactive({ ...people[0] });
const draft = reactive({ name: "", role: "", generation: "", biography: "", legacy: "" });
const errors = reactive({ name: "", role: "", generation: "" });
const genealogyId = ref("");
const personId = ref("");
const routeMode = ref("");
const personState = ref("loading");
const isCreateMode = ref(false);
const person = reactive({
id: "",
name: "",
relation: "",
generationName: "",
generation: "",
biography: "",
remark: "",
status: "",
});
const draft = reactive({
name: "",
generationName: "",
generation: "",
biography: "",
remark: "",
});
const errors = reactive({ name: "", generation: "" });
const baseline = ref("");
const toastVisible = ref(false);
const discardVisible = ref(false);
let toastTimer = null;
const shortFields = [{ key: "name", label: "姓名" }, { key: "role", label: "身份" }, { key: "generation", label: "世代" }];
const longFields = [{ key: "biography", label: "人物小传" }, { key: "legacy", label: "家族印记" }];
const detailSections = computed(() => [{ title: "人物小传", copy: person.biography }, { title: "家族印记", copy: person.legacy }]);
const copyToDraft = () => Object.assign(draft, { name: person.name, role: person.role, generation: person.generation, biography: person.biography, legacy: person.legacy });
const clearErrors = () => Object.assign(errors, { name: "", role: "", generation: "" });
const enterEdit = () => { copyToDraft(); clearErrors(); personState.value = "edit"; };
const cancelEdit = () => { copyToDraft(); clearErrors(); personState.value = "detail"; };
const savePerson = () => {
const isCreateMode = computed(() => routeMode.value === "create");
const formSnapshot = computed(() => JSON.stringify({ ...draft }));
const isDirty = computed(() =>
personState.value === "preview" ||
(personState.value === "edit" && formSnapshot.value !== baseline.value),
);
const shortFields = [
{ key: "name", label: "姓名" },
{ key: "generationName", label: "字辈" },
{ key: "generation", label: "世代" },
];
const longFields = [
{ key: "biography", label: "人物小传" },
{ key: "remark", label: "档案备注" },
];
const detailSections = computed(() => [
{ title: "字辈", copy: person.generationName },
{ title: "人物小传", copy: person.biography },
{ title: "档案备注", copy: person.remark },
]);
const copyToDraft = () => {
Object.assign(draft, {
name: person.name,
generationName: person.generationName,
generation: String(person.generation || ""),
biography: person.biography,
remark: person.remark,
});
baseline.value = formSnapshot.value;
};
const clearErrors = () => Object.assign(errors, { name: "", generation: "" });
const enterEdit = () => {
if (personState.value !== "detail" || !person.id) return false;
copyToDraft();
clearErrors();
if (!String(draft.name).trim()) errors.name = "请填写姓名";
if (!String(draft.role).trim()) errors.role = "请填写身份";
if (!String(draft.generation).trim()) errors.generation = "请填写世代";
if (errors.name || errors.role || errors.generation) return;
Object.assign(person, { id: person.id || "new", ...draft, name: draft.name.trim(), role: draft.role.trim(), generation: String(draft.generation).trim() });
isCreateMode.value = false;
personState.value = "detail";
personState.value = "edit";
return true;
};
const showPreviewToast = () => {
toastVisible.value = true;
if (toastTimer) clearTimeout(toastTimer);
toastTimer = setTimeout(() => { toastVisible.value = false; toastTimer = null; }, 1800);
toastTimer = setTimeout(() => {
toastVisible.value = false;
toastTimer = null;
}, 1800);
};
const returnToPeople = () => uni.reLaunch({ url: "/pages/records/r01-people-list" });
const restoreDetail = () => { personState.value = "detail"; };
const validatePerson = () => {
errors.name = draft.name.trim() ? "" : "请填写姓名";
const generationInput = draft.generation.trim();
const generation = Number(generationInput);
errors.generation = !generationInput
? ""
: Number.isInteger(generation) && generation > 0
? ""
: "世代必须是正整数";
return !errors.name && !errors.generation;
};
const savePerson = () => {
clearErrors();
if (!validatePerson()) return false;
const localPersonPreview = {
name: draft.name.trim(),
generationName: draft.generationName.trim(),
generation: draft.generation.trim()
? String(Number(draft.generation))
: "",
biography: draft.biography.trim(),
remark: draft.remark.trim(),
};
Object.assign(person, localPersonPreview);
personState.value = "preview";
showPreviewToast();
return true;
};
const discardConfirmation = createDiscardConfirmation(
(visible) => { discardVisible.value = visible; },
);
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const requestDiscardConfirmation = discardConfirmation.request;
const cancelEdit = async () => {
const confirmed = isDirty.value ? await requestDiscardConfirmation() : true;
if (!confirmed) return false;
if (isCreateMode.value) return goBack();
copyToDraft();
clearErrors();
personState.value = "detail";
return true;
};
const requestBack = () => {
if (discardVisible.value) {
cancelDiscard();
return Promise.resolve(true);
}
if (personState.value === "edit" && !isCreateMode.value) return cancelEdit();
return runBackGuard({
dirty: isDirty.value,
"confirm-discard": requestDiscardConfirmation,
});
};
const returnToPeople = () =>
genealogyId.value
? returnTo("R01", { genealogyId: genealogyId.value })
: goBack();
const toGrowthJournal = () =>
uni.navigateTo({
url: `/pages/records/r08-growth-journal?personId=${person.id}`,
});
person.id
? openPage(
"R08",
{ genealogyId: genealogyId.value, personId: personId.value },
"R02",
)
: Promise.resolve(false);
const toLifeEvents = () =>
uni.navigateTo({
url: `/pages/records/r09-life-events?personId=${person.id}`,
});
person.id
? openPage(
"R09",
{ genealogyId: genealogyId.value, personId: personId.value },
"R02",
)
: Promise.resolve(false);
onLoad((query) => {
isCreateMode.value = query.mode === "create";
if (isCreateMode.value) {
genealogyId.value = String(query.genealogyId || "");
personId.value = String(query.personId || "");
routeMode.value = String(query.mode || "");
if (query.state === "loading") return;
const access = getGenealogyFixtureAccess(genealogyId.value);
const hasValidGenealogy = ["owner", "member"].includes(access.accessRole);
const isCreateContract = routeMode.value === "create" && !personId.value;
const isViewContract = routeMode.value === "view" && Boolean(personId.value);
if (!hasValidGenealogy || (!isCreateContract && !isViewContract)) {
personState.value = "error";
return;
}
if (isCreateContract) {
Object.assign(person, {
id: "",
name: "",
role: "",
relation: "人物预览",
generationName: "",
generation: "",
biography: "",
legacy: "",
remark: "",
status: "",
});
copyToDraft();
personState.value = "edit";
return;
}
const selected = people.find((item) => item.id === String(query.personId || ""));
if (selected) Object.assign(person, selected);
const selected = findTreeMemberPresentationFixture(genealogyId.value, personId.value);
if (!selected) {
personState.value = "expired";
return;
}
Object.assign(person, {
id: selected.id,
name: selected.name,
relation: selected.relation,
generation: String(selected.generation),
status: selected.status,
});
if (["privacy", "forbidden"].includes(selected.status)) {
Object.assign(person, {
generationName: "",
biography: "",
remark: "",
});
personState.value = "privacy";
return;
}
Object.assign(person, {
generationName: selected.generationName || "",
biography: selected.summary || "",
remark: selected.note || "",
});
copyToDraft();
const requested = ["loading", "privacy", "expired", "error", "edit"].includes(query.state) ? query.state : "detail";
personState.value = selected ? requested : "error";
personState.value = ["expired", "error"].includes(query.state)
? query.state
: "detail";
});
onBackPress((event) => handleBackPress(event, requestBack));
onUnmounted(() => {
if (toastTimer) clearTimeout(toastTimer);
discardConfirmation.dispose();
});
onUnmounted(() => { if (toastTimer) clearTimeout(toastTimer); });
</script>
<style scoped lang="scss">
+67 -61
View File
@@ -3,7 +3,7 @@
<view class="gift-page" :class="stateClasses">
<ModulePageBackground module="records" />
<view class="page-header">
<PageHeader title="贺礼簿" action="新增" @action="createGift" />
<PageHeader title="贺礼簿" :action="hasValidContext ? '填写预览' : ''" @action="createRelativePreview" />
</view>
<view v-if="giftState === 'loading'" class="page-loading">
<AppLoading
@@ -12,40 +12,42 @@
/>
</view>
<view v-else class="page-content">
<template v-if="giftState === 'ready' && giftBooks.length">
<template v-if="giftState === 'ready' && relativeRecords.length">
<view
v-for="gift in giftBooks"
:key="gift.id"
v-for="record in relativeRecords"
:key="record.relativeId"
class="record-card"
role="button"
:aria-label="`查看${gift.title}`"
@click="openGiftBook(gift)"
:aria-label="`查看${record.eventName}`"
@click="openRelative(record)"
>
<text class="record-card__tag">{{ gift.occasion }}</text>
<text class="record-card__title">{{ gift.title }}</text>
<text class="record-card__tag">{{ record.relationName }}</text>
<text class="record-card__title">{{ record.eventName }}</text>
<text class="record-card__copy">
{{ gift.from }} · {{ gift.date }}
{{ record.relativeName }} · {{ record.eventTime }} · 金额记录{{ record.giftAmount }}
</text>
<text class="record-card__hint">查看并编辑贺礼</text>
<text class="record-card__hint">查看往来记录</text>
</view>
<AppButton block label="新增贺礼" @click="createGift" />
<AppButton block label="填写往来预览" @click="createRelativePreview" />
</template>
<view v-else class="state-card">
<text>
{{ giftState === "error" ? "贺礼簿暂不可用" : "还没有贺礼记录" }}
{{ giftState === "error" ? "贺礼簿暂不可用" : giftState === "invalid" ? "贺礼簿入口无效" : "还没有往来记录" }}
</text>
<text>
{{
giftState === "error"
? "请稍后重新查看,已有记录不会受到影响。"
: giftState === "invalid"
? "没有找到可访问的成员家谱,页面不会展示其他家谱记录。"
: "从第一份家人之间的心意开始记录。"
}}
</text>
<AppButton
:type="giftState === 'error' ? 'secondary' : 'primary'"
:type="giftState === 'empty' ? 'primary' : 'secondary'"
block
:label="giftState === 'error' ? '重新查看' : '新增贺礼'"
@click="giftState === 'error' ? restoreGifts() : createGift()"
:label="giftState === 'error' ? '重新查看' : giftState === 'invalid' ? '返回上一页' : '填写往来预览'"
@click="handleStateAction"
/>
</view>
</view>
@@ -58,59 +60,63 @@ import AppButton from "@/components/AppButton.vue";
import AppLoading from "@/components/AppLoading.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
const baseGifts = [
{
id: "301",
title: "新春贺礼",
occasion: "春节",
from: "汤文正一家",
date: "2024 年 2 月 10 日",
},
{
id: "302",
title: "寿宴礼单",
occasion: "寿辰",
from: "汤淑华",
date: "2024 年 4 月 18 日",
},
{
id: "303",
title: "添丁祝福",
occasion: "新生",
from: "汤文清一家",
date: "2024 年 6 月 2 日",
},
];
const giftBooks = ref([...baseGifts]);
import {
getGenealogyFixtureAccess,
listRelativeRecordFixtures,
} from "@/data/mock.js";
import { goBack, openPage } from "@/utils/navigation.js";
const genealogyId = ref("");
const relativeRecords = ref([]);
const giftState = ref("loading");
const hasValidContext = computed(() => ["ready", "empty"].includes(giftState.value));
const stateClasses = computed(() => ({
"gift-state--loading": giftState.value === "loading",
"gift-state--empty": giftState.value === "empty",
"gift-state--error": giftState.value === "error",
"relative-state--loading": giftState.value === "loading",
"relative-state--empty": giftState.value === "empty",
"relative-state--error": giftState.value === "error",
"relative-state--invalid": giftState.value === "invalid",
}));
onLoad((query) => {
const count = Math.max(
1,
Math.min(Number(query.count) || baseGifts.length, 50),
);
giftBooks.value = Array.from({ length: count }, (_, i) => ({
...baseGifts[i % baseGifts.length],
id: String(301 + i),
title:
count > 3 ? `${baseGifts[i % 3].title}${i + 1}` : baseGifts[i].title,
}));
genealogyId.value = String(query.genealogyId || "");
const access = getGenealogyFixtureAccess(genealogyId.value);
if (!["owner", "member"].includes(access.accessRole)) {
relativeRecords.value = [];
giftState.value = "invalid";
return;
}
relativeRecords.value = listRelativeRecordFixtures(genealogyId.value);
giftState.value = ["loading", "empty", "error"].includes(query.state)
? query.state
: "ready";
: relativeRecords.value.length
? "ready"
: "empty";
});
const openGiftBook = (gift) =>
uni.navigateTo({
url: `/pages/records/r04-gift-editor?mode=view&giftId=${gift.id}`,
});
const createGift = () =>
uni.navigateTo({ url: "/pages/records/r04-gift-editor?mode=create" });
const restoreGifts = () => {
giftState.value = "ready";
const openRelative = (record) =>
openPage(
"R04",
{
genealogyId: genealogyId.value,
mode: "view",
relativeId: String(record.relativeId),
},
"R03",
);
const createRelativePreview = () =>
hasValidContext.value
? openPage(
"R04",
{ genealogyId: genealogyId.value, mode: "create" },
"R03",
)
: Promise.resolve(false);
const restoreRelatives = () => {
relativeRecords.value = listRelativeRecordFixtures(genealogyId.value);
giftState.value = relativeRecords.value.length ? "ready" : "empty";
};
const handleStateAction = () => {
if (giftState.value === "invalid") return goBack();
if (giftState.value === "error") return restoreRelatives();
return createRelativePreview();
};
</script>
<style scoped lang="scss">
+199 -106
View File
@@ -1,4 +1,4 @@
<!-- 页面编号R-04用途贺礼查看新增编辑保存与删除确认 -->
<!-- 页面编号R-04用途人情往来详情与不写库的新增编辑预览 -->
<template>
<view class="gift-editor-page" :class="editorClasses">
<ModulePageBackground module="records" />
@@ -6,165 +6,258 @@
<PageHeader
:title="
mode === 'create'
? '新增贺礼'
? '往来预览'
: mode === 'view'
? '贺礼详情'
: '编辑贺礼'
? '往来详情'
: '编辑预览'
"
:action="mode === 'view' ? '编辑' : ''"
@action="mode = 'edit'"
:action="mode === 'view' && editorState === 'ready' ? '制作预览' : ''"
custom-back
@back="requestBack"
@action="enterEdit"
/>
</view>
<view v-if="editorState === 'loading'" class="page-loading">
<AppLoading
text="正在读取贺礼"
description="请稍候,正在整理这份礼仪记录。"
text="正在读取往来记录"
description="请稍候,正在核对当前家谱与记录身份。"
/>
</view>
<view v-else class="page-content">
<view v-if="editorState === 'success'" class="state-card">
<text>贺礼已保存</text>
<text>这份心意已加入家族贺礼簿</text>
<AppButton block label="返回贺礼簿" @click="backToGifts" />
<view v-if="editorState === 'preview'" class="state-card">
<text>本地预览尚未提交服务器</text>
<text>这份往来内容只存在于当前页面不会插入修改或删除正式记录</text>
<view v-for="item in previewRows" :key="item.label">
<text>{{ item.label }}</text><text>{{ item.value }}</text>
</view>
<AppButton block label="返回贺礼簿" @click="returnToRelatives" />
</view>
<view v-else-if="mode === 'view'" class="detail-card">
<text>{{ giftForm.title }}</text>
<view v-else-if="mode === 'view' && editorState === 'ready'" class="detail-card">
<text>{{ relativeForm.eventName }}</text>
<view v-for="item in detailRows" :key="item.label">
<text>{{ item.label }}</text>
<text>{{ item.value }}</text>
</view>
<AppButton block label="编辑贺礼" @click="mode = 'edit'" />
<AppButton
type="secondary"
block
label="删除记录"
@click="confirmDelete"
/>
<AppButton block label="制作编辑预览" @click="enterEdit" />
<AppButton type="secondary" block disabled label="删除暂未开放" />
</view>
<view v-else class="form-card">
<view v-else-if="editorState === 'ready'" class="form-card">
<text>
{{ mode === "create" ? "记录一份家人心意" : "修改贺礼信息" }}
{{ mode === "create" ? "填写一份人情往来预览" : "调整往来记录预览" }}
</text>
<view v-for="field in fields" :key="field.key" class="field-row">
<text>{{ field.label }}</text>
<input
v-model="giftForm[field.key]"
v-model="relativeForm[field.key]"
:type="field.key === 'giftAmount' ? 'digit' : 'text'"
:placeholder="`请输入${field.label}`"
/>
<text v-if="giftErrors[field.key]">{{ giftErrors[field.key] }}</text>
<text v-if="relativeErrors[field.key]">{{ relativeErrors[field.key] }}</text>
</view>
<text v-if="editorState === 'error'" class="save-error">
保存失败请检查内容后重试
</text>
<AppButton
block
:disabled="editorState === 'saving'"
:label="editorState === 'saving' ? '正在保存' : '保存贺礼'"
@click="saveGift"
/>
<AppButton
v-if="mode === 'edit'"
type="secondary"
block
label="删除记录"
@click="confirmDelete"
:disabled="isSubmitting"
:label="isSubmitting ? '正在生成预览' : '生成本地预览'"
@click="saveRelative"
/>
<AppButton type="secondary" block label="取消填写" @click="requestBack" />
</view>
<view v-else class="state-card">
<text>往来记录不可用</text>
<text>记录不存在缺少身份或不属于当前家谱页面不会回退到其他记录</text>
<AppButton type="secondary" block label="返回贺礼簿" @click="returnToRelatives" />
</view>
</view>
<AppDialog
:visible="deleteVisible"
eyebrow="删除确认"
title="删除这份贺礼?"
message="删除后将返回贺礼簿,本地演示记录不会继续显示。"
confirm-text="确认删除"
cancel-text="保留记录"
:visible="discardVisible"
:close-on-mask="false"
eyebrow="放弃确认"
title="放弃当前填写?"
message="尚未提交的预览内容将从当前页面清除。"
confirm-text="确认放弃"
cancel-text="继续填写"
show-cancel
@confirm="deleteGift"
@cancel="deleteVisible = false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</view>
</template>
<script setup>
import { computed, onUnmounted, reactive, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
const records = [
{
id: "301",
title: "新春贺礼",
from: "汤文正一家",
date: "2024-02-10",
note: "新春团拜时赠予长辈的心意",
},
{
id: "302",
title: "寿宴礼单",
from: "汤淑华",
date: "2024-04-18",
note: "汤老先生八十寿辰",
},
];
const giftId = ref("");
const mode = ref("create");
const editorState = ref("ready");
const deleteVisible = ref(false);
const forceSaveFailure = ref(false);
const giftForm = reactive({ title: "", from: "", date: "", note: "" });
const giftErrors = reactive({ title: "", from: "", date: "" });
import {
findRelativeRecordFixture,
getGenealogyFixtureAccess,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
handleBackPress,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
const genealogyId = ref("");
const relativeId = ref("");
const mode = ref("");
const editorState = ref("loading");
const isSubmitting = ref(false);
const discardVisible = ref(false);
const localRelativePreview = ref(null);
const relativeForm = reactive({
relativeName: "",
relationName: "",
eventName: "",
eventTime: "",
giftAmount: "",
recordContent: "",
});
const relativeErrors = reactive({
relativeName: "",
relationName: "",
eventName: "",
eventTime: "",
giftAmount: "",
recordContent: "",
});
const fields = [
{ key: "title", label: "贺礼名称" },
{ key: "from", label: "赠送人" },
{ key: "date", label: "日期" },
{ key: "note", label: "备注" },
{ key: "relativeName", label: "亲友姓名" },
{ key: "relationName", label: "关系称谓" },
{ key: "eventName", label: "礼仪事项" },
{ key: "eventTime", label: "事项日期" },
{ key: "giftAmount", label: "礼金金额" },
{ key: "recordContent", label: "往来备注" },
];
let saveTimer = null;
const baseline = ref("");
let submitTimer = null;
const editorClasses = computed(() => ({
"gift-editor-state--saving": editorState.value === "saving",
"gift-editor-state--error": editorState.value === "error",
"relative-editor-state--preview": editorState.value === "preview",
"relative-editor-state--invalid": editorState.value === "invalid",
}));
const formSnapshot = computed(() => JSON.stringify({ ...relativeForm }));
const isDirty = computed(() =>
editorState.value === "preview" ||
(["create", "edit"].includes(mode.value) && formSnapshot.value !== baseline.value),
);
const displayValue = (value) =>
value === "" || value === null || value === undefined ? "未填写" : String(value);
const detailRows = computed(() =>
fields
.slice(1)
.map((f) => ({ label: f.label, value: giftForm[f.key] || "未填写" })),
.map((field) => ({ label: field.label, value: displayValue(relativeForm[field.key]) })),
);
const previewRows = computed(() =>
fields.map((field) => ({
label: field.label,
value: displayValue(localRelativePreview.value?.[field.key]),
})),
);
const copyRecordToForm = (record) => {
Object.assign(relativeForm, {
relativeName: record.relativeName,
relationName: record.relationName,
eventName: record.eventName,
eventTime: record.eventTime,
giftAmount: String(record.giftAmount ?? ""),
recordContent: record.recordContent,
});
baseline.value = formSnapshot.value;
};
onLoad((query) => {
giftId.value = String(query.giftId || "");
mode.value = ["view", "edit"].includes(query.mode) ? query.mode : "create";
forceSaveFailure.value = query.saveResult === "error";
const selected = records.find((x) => x.id === giftId.value);
if (selected) Object.assign(giftForm, selected);
else if (mode.value !== "create") editorState.value = "error";
if (query.state === "loading") editorState.value = "loading";
genealogyId.value = String(query.genealogyId || "");
relativeId.value = String(query.relativeId || "");
mode.value = String(query.mode || "");
if (query.state === "loading") return;
const access = getGenealogyFixtureAccess(genealogyId.value);
const hasValidGenealogy = ["owner", "member"].includes(access.accessRole);
const isCreateContract = mode.value === "create" && !relativeId.value;
const isEntityContract = ["view", "edit"].includes(mode.value) && Boolean(relativeId.value);
if (!hasValidGenealogy || (!isCreateContract && !isEntityContract)) {
editorState.value = "invalid";
return;
}
if (isCreateContract) {
baseline.value = formSnapshot.value;
editorState.value = "ready";
return;
}
const selected = findRelativeRecordFixture(genealogyId.value, relativeId.value);
if (!selected) {
editorState.value = "invalid";
return;
}
copyRecordToForm(selected);
editorState.value = "ready";
});
const validateGift = () => {
giftErrors.title = giftForm.title.trim() ? "" : "请填写贺礼名称";
giftErrors.from = giftForm.from.trim() ? "" : "请填写赠送人";
giftErrors.date = giftForm.date.trim() ? "" : "请填写日期";
return !giftErrors.title && !giftErrors.from && !giftErrors.date;
const enterEdit = () => {
if (mode.value !== "view" || editorState.value !== "ready") return false;
mode.value = "edit";
baseline.value = formSnapshot.value;
return true;
};
const saveGift = () => {
if (editorState.value === "saving" || !validateGift()) return;
editorState.value = "saving";
saveTimer = setTimeout(() => {
editorState.value = forceSaveFailure.value ? "error" : "success";
forceSaveFailure.value = false;
}, 320);
const validateRelative = () => {
relativeErrors.relativeName = relativeForm.relativeName.trim() ? "" : "请填写亲友姓名";
relativeErrors.relationName = "";
relativeErrors.eventName = "";
relativeErrors.eventTime = "";
relativeErrors.recordContent = "";
const amountInput = relativeForm.giftAmount.trim();
relativeErrors.giftAmount =
!amountInput || Number.isFinite(Number(amountInput))
? ""
: "礼金金额必须是数字";
return !relativeErrors.relativeName && !relativeErrors.giftAmount;
};
const confirmDelete = () => {
deleteVisible.value = true;
const saveRelative = () => {
if (isSubmitting.value || !validateRelative()) return false;
isSubmitting.value = true;
const snapshot = Object.freeze({
relativeName: relativeForm.relativeName.trim(),
relationName: relativeForm.relationName.trim(),
eventName: relativeForm.eventName.trim(),
eventTime: relativeForm.eventTime.trim(),
giftAmount: relativeForm.giftAmount.trim()
? Number(relativeForm.giftAmount)
: null,
recordContent: relativeForm.recordContent.trim(),
});
const timer = setTimeout(() => {
if (submitTimer !== timer) return;
localRelativePreview.value = snapshot;
editorState.value = "preview";
isSubmitting.value = false;
submitTimer = null;
}, 240);
submitTimer = timer;
return true;
};
const deleteGift = () => {
deleteVisible.value = false;
backToGifts();
};
const backToGifts = () =>
uni.redirectTo({ url: "/pages/records/r03-gift-list" });
const discardConfirmation = createDiscardConfirmation(
(visible) => { discardVisible.value = visible; },
);
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
submitting: isSubmitting.value,
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": discardConfirmation.request,
});
const returnToRelatives = () =>
genealogyId.value
? returnTo("R03", { genealogyId: genealogyId.value })
: goBack();
onBackPress((event) => handleBackPress(event, requestBack));
onUnmounted(() => {
if (saveTimer) clearTimeout(saveTimer);
if (submitTimer) clearTimeout(submitTimer);
discardConfirmation.dispose();
});
</script>
<style scoped lang="scss">
+104 -70
View File
@@ -1,47 +1,48 @@
<!-- 页面编号R-05用途礼仪活动列表状态与创建入口 -->
<!-- 页面编号R-05用途当前家谱的礼仪活动列表与本地创建预览入口 -->
<template>
<view class="ritual-page" :class="stateClasses">
<ModulePageBackground module="records" />
<view class="page-header">
<PageHeader title="礼仪活动" action="新建" @action="createRitual" />
<PageHeader
title="礼仪活动"
:action="hasValidContext ? '填写预览' : ''"
@action="createCeremonyPreview"
/>
</view>
<view v-if="ritualState === 'loading'" class="page-loading">
<view v-if="ceremonyState === 'loading'" class="page-loading">
<AppLoading
text="正在整理礼仪活动"
description="请稍候,正在读取时间与地点。"
description="请稍候,正在核对当前家谱的活动记录。"
/>
</view>
<view v-else class="page-content">
<template v-if="ritualState === 'ready' && rituals.length">
<template v-if="ceremonyState === 'ready' && ceremonies.length">
<view
v-for="ritual in rituals"
:key="ritual.id"
v-for="ceremony in ceremonies"
:key="ceremony.ceremonyId"
class="record-card"
@click="openRitual(ritual)"
role="button"
:aria-label="`查看${ceremony.ceremonyTitle}`"
@click="openCeremony(ceremony)"
>
<text>{{ ritual.status }}</text>
<text>{{ ritual.name }}</text>
<text>{{ ritual.date }} · {{ ritual.place }}</text>
<text>查看活动详情</text>
<text>{{ ceremony.ceremonyType }}</text>
<text>{{ ceremony.ceremonyTitle }}</text>
<text>
{{ ceremony.ceremonyTime }} ·
{{ ceremony.location || "地点待定" }}
</text>
<text>查看活动与受邀信息</text>
</view>
<AppButton block label="新建礼仪" @click="createRitual" />
<AppButton block label="填写礼仪预览" @click="createCeremonyPreview" />
</template>
<view v-else class="state-card">
<text>
{{ ritualState === "error" ? "礼仪活动暂不可用" : "还没有礼仪活动" }}
</text>
<text>
{{
ritualState === "error"
? "请稍后重新查看,已有活动不会受到影响。"
: "从一次祭祖、家宴或团拜开始安排。"
}}
</text>
<text>{{ stateCopy.title }}</text>
<text>{{ stateCopy.copy }}</text>
<AppButton
:type="ritualState === 'error' ? 'secondary' : 'primary'"
:type="ceremonyState === 'empty' ? 'primary' : 'secondary'"
block
:label="ritualState === 'error' ? '重新查看' : '新建礼仪'"
@click="ritualState === 'error' ? restoreRituals() : createRitual()"
:label="stateCopy.action"
@click="handleStateAction"
/>
</view>
</view>
@@ -54,53 +55,86 @@ import AppButton from "@/components/AppButton.vue";
import AppLoading from "@/components/AppLoading.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
const base = [
{
id: "501",
name: "清明祭祖",
status: "报名中",
date: "2025 年 4 月 4 日",
place: "汤氏宗祠",
},
{
id: "502",
name: "中秋家宴",
status: "筹备中",
date: "2025 年 9 月 17 日",
place: "祖居院落",
},
{
id: "503",
name: "新春团拜",
status: "已结束",
date: "2025 年 1 月 29 日",
place: "家族礼堂",
},
];
const rituals = ref([...base]);
const ritualState = ref("loading");
import {
getGenealogyFixtureAccess,
listCeremonyFixtures,
} from "@/data/mock.js";
import { goBack, openPage } from "@/utils/navigation.js";
const genealogyId = ref("");
const ceremonies = ref([]);
const ceremonyState = ref("loading");
const hasValidContext = computed(() =>
["ready", "empty"].includes(ceremonyState.value),
);
const stateClasses = computed(() => ({
"ritual-state--loading": ritualState.value === "loading",
"ritual-state--empty": ritualState.value === "empty",
"ritual-state--error": ritualState.value === "error",
"ceremony-state--loading": ceremonyState.value === "loading",
"ceremony-state--empty": ceremonyState.value === "empty",
"ceremony-state--error": ceremonyState.value === "error",
"ceremony-state--invalid": ceremonyState.value === "invalid",
}));
onLoad((q) => {
const n = Math.max(1, Math.min(Number(q.count) || base.length, 50));
rituals.value = Array.from({ length: n }, (_, i) => ({
...base[i % 3],
id: String(501 + i),
name: n > 3 ? `${base[i % 3].name}${i + 1}` : base[i].name,
}));
ritualState.value = ["loading", "empty", "error"].includes(q.state)
? q.state
: "ready";
const stateCopy = computed(() => ({
error: {
title: "礼仪活动暂不可用",
copy: "请稍后重新查看,已有活动不会受到影响。",
action: "重新查看",
},
invalid: {
title: "礼仪活动入口无效",
copy: "没有找到可访问的成员家谱,页面不会展示其他家谱活动。",
action: "返回上一页",
},
empty: {
title: "还没有礼仪活动",
copy: "可以先填写一份本地预览;正式创建仍需等待线上写接口启用。",
action: "填写礼仪预览",
},
})[ceremonyState.value] || {
title: "礼仪活动暂不可用",
copy: "请返回上一页重新进入。",
action: "返回上一页",
});
const openRitual = (r) =>
uni.navigateTo({ url: `/pages/records/r06-ritual-detail?ritualId=${r.id}` });
const createRitual = () =>
uni.navigateTo({ url: "/pages/records/r07-ritual-editor?mode=create" });
const restoreRituals = () => {
ritualState.value = "ready";
onLoad((query) => {
genealogyId.value = String(query.genealogyId || "");
const access = getGenealogyFixtureAccess(genealogyId.value);
if (!["owner", "member"].includes(access.accessRole)) {
ceremonies.value = [];
ceremonyState.value = "invalid";
return;
}
ceremonies.value = listCeremonyFixtures(genealogyId.value);
ceremonyState.value = ["loading", "empty", "error"].includes(query.state)
? query.state
: ceremonies.value.length
? "ready"
: "empty";
});
const openCeremony = (ceremony) =>
openPage(
"R06",
{
genealogyId: genealogyId.value,
ceremonyId: String(ceremony.ceremonyId),
},
"R05",
);
const createCeremonyPreview = () =>
hasValidContext.value
? openPage(
"R07",
{ genealogyId: genealogyId.value, mode: "create" },
"R05",
)
: Promise.resolve(false);
const restoreCeremonies = () => {
ceremonies.value = listCeremonyFixtures(genealogyId.value);
ceremonyState.value = ceremonies.value.length ? "ready" : "empty";
};
const handleStateAction = () => {
if (ceremonyState.value === "invalid") return goBack();
if (ceremonyState.value === "error") return restoreCeremonies();
return createCeremonyPreview();
};
</script>
<style scoped lang="scss">
+103 -74
View File
@@ -1,129 +1,158 @@
<!-- 页面编号R-06用途礼仪详情参与者与受控状态 -->
<!-- 页面编号R-06用途当前家谱礼仪详情受邀信息与受控状态 -->
<template>
<view class="ritual-detail-page" :class="stateClasses">
<ModulePageBackground module="records" />
<view class="page-header">
<PageHeader
title="礼仪详情"
:action="ritualState === 'ready' ? '编辑' : ''"
@action="editRitual"
:action="ceremonyState === 'ready' ? '制作预览' : ''"
custom-back
@back="requestBack"
@action="editCeremony"
/>
</view>
<view v-if="ritualState === 'loading'" class="page-loading">
<view v-if="ceremonyState === 'loading'" class="page-loading">
<AppLoading
text="正在读取礼仪详情"
description="请稍候,正在整理活动与参与信息。"
description="请稍候,正在核对活动身份与受邀信息。"
/>
</view>
<view v-else class="page-content">
<template v-if="ritualState === 'ready'">
<template v-if="ceremonyState === 'ready' && ceremonyDetail">
<view class="detail-card">
<text>{{ ritualDetail.status }}</text>
<text>{{ ritualDetail.name }}</text>
<text>{{ ritualDetail.date }} · {{ ritualDetail.place }}</text>
<text>{{ ritualDetail.description }}</text>
<text>{{ ceremonyDetail.ceremonyType }}</text>
<text>{{ ceremonyDetail.ceremonyTitle }}</text>
<text>
{{ ceremonyDetail.ceremonyTime }} ·
{{ ceremonyDetail.location || "地点待定" }}
</text>
<text>{{ ceremonyDetail.ceremonyDesc || "暂无活动说明" }}</text>
</view>
<view class="participant-card">
<view>
<text>参与家人</text>
<text>{{ participants.length }} </text>
<text>受邀家人</text>
<text>{{ invitees.length }} </text>
</view>
<view v-for="person in participants" :key="person.id">
<text>{{ person.name }}</text>
<text>{{ person.role }}</text>
<view v-for="invitee in invitees" :key="invitee.inviteeUserId">
<text>{{ invitee.displayName }} · {{ invitee.relationName }}</text>
<text>{{ invitee.statusText }}</text>
</view>
<view v-if="!invitees.length"><text>尚无受邀记录</text><text></text></view>
</view>
<AppButton block label="编辑活动" @click="editRitual" />
<AppButton block label="制作编辑预览" @click="editCeremony" />
</template>
<view v-else class="state-card">
<text>{{ stateCopy.title }}</text>
<text>{{ stateCopy.copy }}</text>
<AppButton
:type="ritualState === 'error' ? 'secondary' : 'primary'"
type="secondary"
block
:label="ritualState === 'error' ? '重新查看' : '返回礼仪列表'"
@click="ritualState === 'error' ? restoreRitual() : backToRituals()"
:label="ceremonyState === 'error' ? '重新查看' : '返回礼仪列表'"
@click="ceremonyState === 'error' ? restoreCeremony() : returnToCeremonies()"
/>
</view>
</view>
</view>
</template>
<script setup>
import { computed, reactive, ref } from "vue";
import { computed, ref } from "vue";
import { 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";
const records = [
{
id: "501",
name: "清明祭祖",
status: "报名中",
date: "2025 年 4 月 4 日",
place: "汤氏宗祠",
description: "缅怀先祖,整理祭扫礼序,并由长辈讲述家族往事。",
},
{
id: "502",
name: "中秋家宴",
status: "筹备中",
date: "2025 年 9 月 17 日",
place: "祖居院落",
description: "家人团聚,共叙近况并整理年度家族影像。",
},
];
const ritualDetail = reactive({ ...records[0] });
const ritualId = ref("501");
const ritualState = ref("loading");
const participants = ref([
{ id: 1, name: "汤文正", role: "主理人" },
{ id: 2, name: "汤淑华", role: "家族长辈" },
{ id: 3, name: "汤文清", role: "影像记录" },
]);
import {
findCeremonyFixture,
getGenealogyFixtureAccess,
listTreeMemberPresentationFixtures,
} from "@/data/mock.js";
import { goBack, openPage, returnTo } from "@/utils/navigation.js";
const genealogyId = ref("");
const ceremonyId = ref("");
const ceremonyDetail = ref(null);
const memberOptions = ref([]);
const ceremonyState = ref("loading");
const invitees = computed(() => {
const memberByAppUserId = new Map(
memberOptions.value.map((member) => [String(member.appUserId), member]),
);
return (ceremonyDetail.value?.invitees || []).map((invitation) => {
const member = memberByAppUserId.get(String(invitation.inviteeUserId));
return {
inviteeUserId: String(invitation.inviteeUserId),
displayName: member?.name || "受邀成员信息不可用",
relationName: member?.relation || "未完成同谱成员联接",
statusText: invitation.inviteStatus
? "受邀状态字典待后端确认"
: "受邀状态未提供",
};
});
});
const stateClasses = computed(() => ({
"ritual-state--expired": ritualState.value === "expired",
"ritual-state--privacy": ritualState.value === "privacy",
"ritual-state--error": ritualState.value === "error",
"ceremony-state--expired": ceremonyState.value === "expired",
"ceremony-state--error": ceremonyState.value === "error",
}));
const stateCopy = computed(
() =>
({
expired: {
title: "活动已失效",
copy: "这项礼仪活动已取消或结束归档,请返回列表查看其他活动。",
},
privacy: {
title: "活动信息未公开",
copy: "当前活动只向受邀家人展示,请返回礼仪列表。",
copy: "活动不存在或不属于当前家谱,页面不会回退到其他活动。",
},
error: {
title: "礼仪详情暂不可用",
copy: "请稍后重新查看,已有活动不会受到影响。",
},
})[ritualState.value] || {},
})[ceremonyState.value] || {
title: "礼仪详情暂不可用",
copy: "缺少家谱或活动身份,请返回列表重新选择。",
},
);
onLoad((q) => {
ritualId.value = String(q.ritualId || "501");
const selected = records.find((x) => x.id === ritualId.value);
if (selected) Object.assign(ritualDetail, selected);
ritualState.value = ["loading", "expired", "privacy", "error"].includes(
q.state,
)
? q.state
: selected
? "ready"
: "expired";
onLoad((query) => {
genealogyId.value = String(query.genealogyId || "");
ceremonyId.value = String(query.ceremonyId || "");
if (query.state === "loading") return;
const access = getGenealogyFixtureAccess(genealogyId.value);
if (!["owner", "member"].includes(access.accessRole) || !ceremonyId.value) {
ceremonyState.value = "expired";
return;
}
memberOptions.value = listTreeMemberPresentationFixtures(genealogyId.value);
ceremonyDetail.value = findCeremonyFixture(
genealogyId.value,
ceremonyId.value,
);
if (!ceremonyDetail.value) {
ceremonyState.value = "expired";
return;
}
ceremonyState.value = query.state === "error" ? "error" : "ready";
});
const editRitual = () =>
uni.navigateTo({
url: `/pages/records/r07-ritual-editor?mode=edit&ritualId=${ritualId.value}`,
});
const restoreRitual = () => {
ritualState.value = "ready";
const editCeremony = () =>
ceremonyState.value === "ready" && ceremonyDetail.value
? openPage(
"R07",
{
genealogyId: genealogyId.value,
mode: "edit",
ceremonyId: ceremonyId.value,
},
"R06",
)
: Promise.resolve(false);
const restoreCeremony = () => {
ceremonyDetail.value = findCeremonyFixture(
genealogyId.value,
ceremonyId.value,
);
ceremonyState.value = ceremonyDetail.value ? "ready" : "expired";
};
const backToRituals = () =>
uni.redirectTo({ url: "/pages/records/r05-ritual-list" });
const requestBack = () => goBack();
const returnToCeremonies = () =>
genealogyId.value
? returnTo("R05", { genealogyId: genealogyId.value })
: goBack();
</script>
<style scoped lang="scss">
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
+176 -82
View File
@@ -1,19 +1,33 @@
<!-- 页面编号R-07用途礼仪创建编辑校验保存与删除确认 -->
<!-- 页面编号R-07用途礼仪创建编辑校验与不写库的本地预览 -->
<template>
<view class="ritual-editor-page" :class="editorClasses">
<ModulePageBackground module="records" />
<view class="page-header">
<PageHeader :title="mode === 'create' ? '新建礼仪' : '编辑礼仪'" />
<PageHeader
:title="mode === 'create' ? '礼仪预览' : '编辑预览'"
custom-back
@back="requestBack"
/>
</view>
<view class="page-content">
<view v-if="editorState === 'success'" class="state-card">
<text>礼仪活动已保存</text>
<text>时间地点与活动说明已整理完成</text>
<AppButton block label="返回礼仪列表" @click="backToRituals" />
<view v-if="editorState === 'loading'" class="page-loading">
<AppLoading
text="正在读取礼仪资料"
description="请稍候,正在核对当前家谱与活动身份。"
/>
</view>
<view v-else class="page-content">
<view v-if="editorState === 'preview'" class="state-card preview-card">
<text>本地预览尚未提交服务器</text>
<text>这份礼仪内容只存在于当前页面不会新增覆盖或删除正式活动</text>
<view v-for="item in previewRows" :key="item.label" class="preview-row">
<text>{{ item.label }}</text>
<text>{{ item.value }}</text>
</view>
<AppButton block :label="returnLabel" @click="returnAfterPreview" />
</view>
<view v-else class="form-card">
<view v-else-if="editorState === 'ready'" class="form-card">
<text>
{{ mode === "create" ? "安排一次家族礼仪" : "修改活动信息" }}
{{ mode === "create" ? "填写一份家族礼仪预览" : "调整活动预览" }}
</text>
<view v-for="field in fields" :key="field.key" class="field-row">
<text>{{ field.label }}</text>
@@ -32,110 +46,190 @@
{{ ritualErrors[field.key] }}
</text>
</view>
<text v-if="editorState === 'error'" class="save-error">
保存失败请保留内容后重试
</text>
<AppButton
block
:disabled="editorState === 'saving'"
:label="editorState === 'saving' ? '正在保存' : '保存活动'"
@click="saveRitual"
label="生成本地预览"
@click="createCeremonyPreview"
/>
<AppButton
v-if="mode === 'edit'"
type="secondary"
block
label="删除活动"
@click="confirmDelete"
label="取消填写"
@click="requestBack"
/>
<AppButton v-if="mode === 'edit'" type="secondary" block disabled label="删除暂未开放" />
</view>
<view v-else class="state-card">
<text>礼仪活动不可用</text>
<text>活动不存在缺少身份或不属于当前家谱页面不会回退到其他活动</text>
<AppButton type="secondary" block label="返回礼仪列表" @click="returnToCeremonies" />
</view>
</view>
<AppDialog
:visible="deleteVisible"
eyebrow="删除确认"
title="删除这项礼仪活动?"
message="删除后将返回礼仪列表。"
confirm-text="确认删除"
cancel-text="保留活动"
:visible="discardVisible"
:close-on-mask="false"
eyebrow="放弃确认"
title="放弃当前填写?"
message="尚未提交的预览内容将从当前页面清除。"
confirm-text="确认放弃"
cancel-text="继续填写"
show-cancel
@confirm="deleteRitual"
@cancel="deleteVisible = false"
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
</view>
</template>
<script setup>
import { computed, onUnmounted, reactive, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
const records = [
{
id: "501",
name: "清明祭祖",
date: "2025-04-04",
place: "汤氏宗祠",
description: "缅怀先祖,凝聚家人,共叙家风传承。",
},
];
const ritualId = ref("");
const mode = ref("create");
const editorState = ref("ready");
const deleteVisible = ref(false);
const forceSaveFailure = ref(false);
const ritualForm = reactive({ name: "", date: "", place: "", description: "" });
import {
findCeremonyFixture,
getGenealogyFixtureAccess,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
handleBackPress,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
const genealogyId = ref("");
const ceremonyId = ref("");
const mode = ref("");
const editorState = ref("loading");
const discardVisible = ref(false);
const localCeremonyPreview = ref(null);
const ceremonyForm = reactive({
ceremonyType: "",
ceremonyTitle: "",
ceremonyTime: "",
location: "",
ceremonyDesc: "",
});
const ritualErrors = reactive({
name: "",
date: "",
place: "",
description: "",
ceremonyType: "",
ceremonyTitle: "",
ceremonyTime: "",
location: "",
ceremonyDesc: "",
});
const fields = [
{ key: "name", label: "活动名称" },
{ key: "date", label: "活动日期" },
{ key: "place", label: "举办地点" },
{ key: "description", label: "活动说明", long: true },
{ key: "ceremonyType", label: "礼仪类型" },
{ key: "ceremonyTitle", label: "活动标题" },
{ key: "ceremonyTime", label: "活动时间" },
{ key: "location", label: "举办地点" },
{ key: "ceremonyDesc", label: "活动说明", long: true },
];
let saveTimer = null;
const baseline = ref("");
const editorClasses = computed(() => ({
"ritual-editor-state--saving": editorState.value === "saving",
"ritual-editor-state--error": editorState.value === "error",
"ceremony-editor-state--preview": editorState.value === "preview",
"ceremony-editor-state--invalid": editorState.value === "invalid",
}));
onLoad((q) => {
ritualId.value = String(q.ritualId || "");
mode.value = q.mode === "edit" ? "edit" : "create";
forceSaveFailure.value = q.saveResult === "error";
const selected = records.find((x) => x.id === ritualId.value);
if (selected) Object.assign(ritualForm, selected);
const formSnapshot = computed(() => JSON.stringify({ ...ceremonyForm }));
const isDirty = computed(() =>
editorState.value === "preview" ||
(["create", "edit"].includes(mode.value) && formSnapshot.value !== baseline.value),
);
const previewRows = computed(() =>
fields.map((field) => ({
label: field.label,
value: localCeremonyPreview.value?.[field.key] || "未填写",
})),
);
const returnLabel = computed(() =>
mode.value === "edit" ? "返回礼仪详情" : "返回礼仪列表",
);
const copyCeremonyToForm = (record) => {
Object.assign(ceremonyForm, {
ceremonyType: record.ceremonyType,
ceremonyTitle: record.ceremonyTitle,
ceremonyTime: record.ceremonyTime,
location: record.location,
ceremonyDesc: record.ceremonyDesc,
});
baseline.value = formSnapshot.value;
};
onLoad((query) => {
genealogyId.value = String(query.genealogyId || "");
ceremonyId.value = String(query.ceremonyId || "");
mode.value = String(query.mode || "");
if (query.state === "loading") return;
const access = getGenealogyFixtureAccess(genealogyId.value);
const hasValidGenealogy = ["owner", "member"].includes(access.accessRole);
const isCreateContract = mode.value === "create" && !ceremonyId.value;
const isEditContract = mode.value === "edit" && Boolean(ceremonyId.value);
if (!hasValidGenealogy || (!isCreateContract && !isEditContract)) {
editorState.value = "invalid";
return;
}
if (isCreateContract) {
baseline.value = formSnapshot.value;
editorState.value = "ready";
return;
}
const selected = findCeremonyFixture(genealogyId.value, ceremonyId.value);
if (!selected) {
editorState.value = "invalid";
return;
}
copyCeremonyToForm(selected);
editorState.value = "ready";
});
const validateRitual = () => {
for (const f of fields)
ritualErrors[f.key] = String(ritualForm[f.key]).trim()
? ""
: `请填写${f.label}`;
return fields.every((f) => !ritualErrors[f.key]);
const validateCeremony = () => {
ritualErrors.ceremonyType = ceremonyForm.ceremonyType.trim()
? ""
: "请填写礼仪类型";
ritualErrors.ceremonyTitle = ceremonyForm.ceremonyTitle.trim()
? ""
: "请填写活动标题";
return fields.every((field) => !ritualErrors[field.key]);
};
const saveRitual = () => {
if (editorState.value === "saving" || !validateRitual()) return;
editorState.value = "saving";
saveTimer = setTimeout(() => {
editorState.value = forceSaveFailure.value ? "error" : "success";
forceSaveFailure.value = false;
}, 320);
const createCeremonyPreview = () => {
if (!validateCeremony()) return false;
// 线
//
localCeremonyPreview.value = Object.freeze({
ceremonyType: ceremonyForm.ceremonyType.trim(),
ceremonyTitle: ceremonyForm.ceremonyTitle.trim(),
ceremonyTime: ceremonyForm.ceremonyTime.trim(),
location: ceremonyForm.location.trim(),
ceremonyDesc: ceremonyForm.ceremonyDesc.trim(),
});
editorState.value = "preview";
return true;
};
const confirmDelete = () => {
deleteVisible.value = true;
};
const deleteRitual = () => {
deleteVisible.value = false;
backToRituals();
};
const backToRituals = () =>
uni.redirectTo({ url: "/pages/records/r05-ritual-list" });
const discardConfirmation = createDiscardConfirmation(
(visible) => { discardVisible.value = visible; },
);
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const requestBack = () =>
runBackGuard({
transientOpen: discardVisible.value,
dirty: isDirty.value,
"close-transient": cancelDiscard,
"confirm-discard": discardConfirmation.request,
});
const returnToCeremonies = () =>
genealogyId.value
? returnTo("R05", { genealogyId: genealogyId.value })
: goBack();
const returnAfterPreview = () =>
mode.value === "edit" && ceremonyId.value
? returnTo("R06", {
genealogyId: genealogyId.value,
ceremonyId: ceremonyId.value,
})
: returnToCeremonies();
onBackPress((event) => handleBackPress(event, requestBack));
onUnmounted(() => {
if (saveTimer) clearTimeout(saveTimer);
discardConfirmation.dispose();
});
</script>
<style scoped lang="scss">
+225 -71
View File
@@ -1,142 +1,277 @@
<!-- 页面编号R-08用途人物成长日志时间轴与同页新增 -->
<!-- 页面编号R-08用途当前家谱人物成长日志与不写库的本地预览 -->
<template>
<view class="timeline-page" :class="stateClasses">
<ModulePageBackground module="records" />
<view class="page-header">
<PageHeader title="成长日志" action="记录" @action="recordGrowth" />
<PageHeader
title="成长日志"
:action="hasValidContext ? '记录预览' : ''"
custom-back
@back="requestBack"
@action="recordGrowth"
/>
</view>
<view v-if="timelineState === 'loading'" class="page-loading">
<AppLoading
text="正在读取成长日志"
:description="`请稍候,正在整理${personName}的成长记录。`"
description="请稍候,正在核对当前家谱与人物身份。"
/>
</view>
<view v-else class="page-content">
<view class="person-lead">
<text>{{ personName }}</text>
<view v-if="memberRecord" class="person-lead">
<text>{{ memberRecord.name }}</text>
<text>成长中的每一个瞬间</text>
</view>
<view v-if="localGrowthPreview" class="preview-card">
<text>本地预览 · 尚未提交</text>
<text>{{ localGrowthPreview.recordTitle }}</text>
<text>{{ localGrowthPreview.recordDate || "日期未填写" }}</text>
<text>{{ localGrowthPreview.recordContent || "内容未填写" }}</text>
</view>
<template v-if="timelineState === 'ready' && growthRecords.length">
<view
v-for="(record, index) in growthRecords"
:key="record.id"
:key="record.recordId"
class="timeline-card"
>
<text> {{ growthRecords.length - index }} </text>
<text>{{ record.title }}</text>
<text>{{ record.date }}</text>
<text>{{ record.description }}</text>
<text>{{ record.recordTitle }}</text>
<text>{{ record.recordDate || "日期未填写" }}</text>
<text>{{ record.recordContent || "内容未填写" }}</text>
</view>
<AppButton block label="记录成长" @click="recordGrowth" />
<AppButton block label="记录成长预览" @click="recordGrowth" />
</template>
<view v-else class="state-card">
<text>
{{
timelineState === "error" ? "成长日志暂不可用" : "还没有成长记录"
}}
</text>
<text>
{{
timelineState === "error"
? "请稍后重新查看,已有记录不会受到影响。"
: "从第一次微笑、入园或毕业开始记录。"
}}
</text>
<text>{{ stateCopy.title }}</text>
<text>{{ stateCopy.copy }}</text>
<AppButton
:type="timelineState === 'error' ? 'secondary' : 'primary'"
:type="timelineState === 'empty' ? 'primary' : 'secondary'"
block
:label="timelineState === 'error' ? '重新查看' : '记录成长'"
@click="
timelineState === 'error'
? (timelineState = 'ready')
: recordGrowth()
"
:label="stateCopy.action"
@click="handleStateAction"
/>
</view>
</view>
<AppDialog
:visible="dialogVisible"
:close-on-mask="false"
eyebrow="成长日志"
title="记录一个成长瞬间"
confirm-text="保存记录"
title="填写一份成长预览"
confirm-text="生成预览"
cancel-text="取消"
show-cancel
@confirm="saveGrowth"
@cancel="dialogVisible = false"
@confirm="createGrowthPreview"
@cancel="requestCloseEditor"
>
<view class="dialog-form">
<input v-model="growthForm.title" placeholder="事件名称" />
<input v-model="growthForm.date" placeholder="日期" />
<input v-model="growthForm.recordTitle" placeholder="记录标题" />
<input v-model="growthForm.recordDate" placeholder="日期(选填)" />
<textarea
v-model="growthForm.description"
v-model="growthForm.recordContent"
auto-height
placeholder="写下当时的故事"
placeholder="写下当时的故事(选填)"
/>
<text v-if="formError">{{ formError }}</text>
</view>
</AppDialog>
<AppToast :visible="toastVisible" message="成长记录已保存" />
<AppDialog
:visible="discardVisible"
:close-on-mask="false"
eyebrow="放弃确认"
title="放弃当前填写?"
message="尚未提交的预览内容将从当前页面清除。"
confirm-text="确认放弃"
cancel-text="继续填写"
show-cancel
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
<AppToast :visible="toastVisible" message="已生成本地预览,尚未保存" />
</view>
</template>
<script setup>
import { computed, onUnmounted, reactive, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
const personName = ref("汤小满");
const growthRecords = ref([
{
id: 1,
title: "第一次叫爸爸",
date: "2024 年 3 月",
description: "家人共同听见了这声清晰的呼唤。",
},
{
id: 2,
title: "入园第一天",
date: "2024 年 9 月",
description: "背着小书包,勇敢地向家人挥手。",
},
]);
import {
findTreeMemberPresentationFixture,
getGenealogyFixtureAccess,
listGrowthRecordFixtures,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import { goBack, handleBackPress, runBackGuard } from "@/utils/navigation.js";
const genealogyId = ref("");
const personId = ref("");
const memberRecord = ref(null);
const growthRecords = ref([]);
const timelineState = ref("loading");
const dialogVisible = ref(false);
const discardVisible = ref(false);
const toastVisible = ref(false);
const formError = ref("");
const growthForm = reactive({ title: "", date: "", description: "" });
const localGrowthPreview = ref(null);
const growthForm = reactive({
recordTitle: "",
recordDate: "",
recordContent: "",
});
const editorBaseline = ref("");
let timer = null;
const stateClasses = computed(() => ({
"timeline-state--loading": timelineState.value === "loading",
"timeline-state--empty": timelineState.value === "empty",
"timeline-state--error": timelineState.value === "error",
"timeline-state--privacy": timelineState.value === "privacy",
"timeline-state--invalid": timelineState.value === "invalid",
}));
onLoad((q) => {
personName.value = String(q.personName || "汤小满");
timelineState.value = ["loading", "empty", "error"].includes(q.state)
? q.state
: "ready";
const hasValidContext = computed(() =>
["ready", "empty"].includes(timelineState.value),
);
const formSnapshot = computed(() => JSON.stringify({ ...growthForm }));
const growthDraftDirty = computed(() =>
dialogVisible.value && formSnapshot.value !== editorBaseline.value,
);
const stateCopy = computed(() => ({
error: {
title: "成长日志暂不可用",
copy: "请稍后重新查看,已有记录不会受到影响。",
action: "重新查看",
},
privacy: {
title: "成长日志未公开",
copy: "当前人物资料受隐私设置保护,页面不会展示或填写成长记录。",
action: "返回上一页",
},
invalid: {
title: "成长日志入口无效",
copy: "人物不存在、缺少身份或不属于当前家谱。",
action: "返回上一页",
},
empty: {
title: "还没有成长记录",
copy: "可以先生成一份本地预览;正式创建仍需等待线上写接口启用。",
action: "记录成长预览",
},
})[timelineState.value] || {
title: "成长日志暂不可用",
copy: "请返回上一页重新进入。",
action: "返回上一页",
});
const recordGrowth = () => {
Object.assign(growthForm, { title: "", date: "", description: "" });
formError.value = "";
dialogVisible.value = true;
};
const saveGrowth = () => {
if (!growthForm.title.trim() || !growthForm.date.trim()) {
formError.value = "请填写事件名称和日期";
onLoad((query) => {
genealogyId.value = String(query.genealogyId || "");
personId.value = String(query.personId || "");
if (query.state === "loading") return;
const access = getGenealogyFixtureAccess(genealogyId.value);
memberRecord.value = findTreeMemberPresentationFixture(
genealogyId.value,
personId.value,
);
if (
!["owner", "member"].includes(access.accessRole) ||
!memberRecord.value
) {
timelineState.value = "invalid";
return;
}
growthRecords.value.unshift({ id: Date.now(), ...growthForm });
timelineState.value = "ready";
if (["privacy", "forbidden"].includes(memberRecord.value.status)) {
timelineState.value = "privacy";
return;
}
growthRecords.value = listGrowthRecordFixtures(
genealogyId.value,
personId.value,
);
timelineState.value = ["empty", "error"].includes(query.state)
? query.state
: growthRecords.value.length
? "ready"
: "empty";
});
const recordGrowth = () => {
if (!hasValidContext.value) return false;
Object.assign(growthForm, {
recordTitle: "",
recordDate: "",
recordContent: "",
});
formError.value = "";
editorBaseline.value = formSnapshot.value;
dialogVisible.value = true;
return true;
};
const createGrowthPreview = () => {
formError.value = growthForm.recordTitle.trim() ? "" : "请填写记录标题";
if (formError.value) return false;
// ID
localGrowthPreview.value = Object.freeze({
recordTitle: growthForm.recordTitle.trim(),
recordDate: growthForm.recordDate.trim(),
recordContent: growthForm.recordContent.trim(),
});
dialogVisible.value = false;
toastVisible.value = true;
timer = setTimeout(() => (toastVisible.value = false), 1800);
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
toastVisible.value = false;
timer = null;
}, 1800);
return true;
};
const closeEditor = () => {
dialogVisible.value = false;
formError.value = "";
};
const discardConfirmation = createDiscardConfirmation(
(visible) => { discardVisible.value = visible; },
);
const confirmDiscard = () => {
discardConfirmation.confirm();
closeEditor();
};
const cancelDiscard = discardConfirmation.cancel;
const requestCloseEditor = async () => {
if (!growthDraftDirty.value) {
closeEditor();
return true;
}
const confirmed = await discardConfirmation.request();
if (confirmed) closeEditor();
return confirmed;
};
const restoreGrowthRecords = () => {
growthRecords.value = listGrowthRecordFixtures(
genealogyId.value,
personId.value,
);
timelineState.value = growthRecords.value.length ? "ready" : "empty";
};
const handleStateAction = () => {
if (["invalid", "privacy"].includes(timelineState.value)) return goBack();
if (timelineState.value === "error") return restoreGrowthRecords();
return recordGrowth();
};
const requestBack = () => {
if (discardVisible.value) {
cancelDiscard();
return Promise.resolve(true);
}
if (dialogVisible.value) return requestCloseEditor();
return runBackGuard({
dirty: Boolean(localGrowthPreview.value),
"confirm-discard": discardConfirmation.request,
});
};
onBackPress((event) => handleBackPress(event, requestBack));
onUnmounted(() => {
if (timer) clearTimeout(timer);
discardConfirmation.dispose();
});
</script>
<style scoped lang="scss">
@@ -180,12 +315,14 @@ onUnmounted(() => {
font-weight: 700;
}
.timeline-card,
.preview-card,
.state-card {
box-sizing: border-box;
padding: 34rpx 46rpx;
@include adaptive.adaptive-records-content;
}
.timeline-card > text,
.preview-card > text,
.state-card > text {
display: block;
}
@@ -210,6 +347,23 @@ onUnmounted(() => {
font-size: 23rpx;
line-height: 1.55;
}
.preview-card > text:first-child {
color: $brand-red;
font-size: 21rpx;
font-weight: 700;
}
.preview-card > text:nth-child(2) {
margin-top: 8rpx;
color: $ink;
font-size: 30rpx;
font-weight: 700;
}
.preview-card > text:nth-child(n + 3) {
margin-top: 8rpx;
color: $ink-muted;
font-size: 22rpx;
line-height: 1.55;
}
.state-card {
min-height: 340rpx;
padding-top: 78rpx;
+54 -202
View File
@@ -1,155 +1,72 @@
<!-- 页面编号R-09用途人物人生事时间轴与同页新增 -->
<!-- 页面编号R-09用途校验人物身份并明确关闭缺失的线上服务 -->
<template>
<view class="timeline-page" :class="stateClasses">
<view class="service-page" :class="`service-state--${serviceState}`">
<ModulePageBackground module="records" />
<view class="page-header">
<PageHeader title="人生事" action="新增" @action="createLifeEvent" />
<PageHeader title="人生事" custom-back @back="requestBack" />
</view>
<view v-if="timelineState === 'loading'" class="page-loading">
<view v-if="serviceState === 'loading'" class="page-loading">
<AppLoading
text="正在读取人生事"
:description="`请稍候,正在整理${personName}的重要节点。`"
text="正在核对人物身份"
description="请稍候,页面正在确认当前家谱与人物。"
/>
</view>
<view v-else class="page-content">
<view class="person-lead">
<text>{{ personName }}</text>
<text>值得回望的人生节点</text>
</view>
<template v-if="timelineState === 'ready' && lifeEvents.length">
<view v-for="event in lifeEvents" :key="event.id" class="timeline-card">
<text>{{ event.year }}</text>
<text>{{ event.title }}</text>
<text>{{ event.place }}</text>
<text>{{ event.description }}</text>
</view>
<AppButton block label="新增人生事" @click="createLifeEvent" />
</template>
<view v-else class="state-card">
<text>
{{ timelineState === "error" ? "人生事暂不可用" : "还没有人生事" }}
<view class="state-card">
<text>{{ stateCopy.title }}</text>
<text v-if="personRecord && serviceState === 'unavailable'" class="person-name">
当前人物{{ personRecord.name }}
</text>
<text>
{{
timelineState === "error"
? "请稍后重新查看,已有记录不会受到影响。"
: "从毕业、成家或重要迁居开始记录。"
}}
</text>
<AppButton
:type="timelineState === 'error' ? 'secondary' : 'primary'"
block
:label="timelineState === 'error' ? '重新查看' : '新增人生事'"
@click="
timelineState === 'error'
? (timelineState = 'ready')
: createLifeEvent()
"
/>
<text>{{ stateCopy.copy }}</text>
<AppButton type="secondary" block label="返回上一页" @click="requestBack" />
</view>
</view>
<AppDialog
:visible="dialogVisible"
eyebrow="人生事"
title="记录一个人生节点"
confirm-text="保存记录"
cancel-text="取消"
show-cancel
@confirm="saveLifeEvent"
@cancel="dialogVisible = false"
>
<view class="dialog-form">
<input v-model="lifeEventForm.title" placeholder="事件名称" />
<input v-model="lifeEventForm.year" placeholder="年份或日期" />
<input v-model="lifeEventForm.place" placeholder="地点(选填)" />
<textarea
v-model="lifeEventForm.description"
auto-height
placeholder="写下这段经历"
/>
<text v-if="formError">{{ formError }}</text>
</view>
</AppDialog>
<AppToast :visible="toastVisible" message="人生事已保存" />
</view>
</template>
<script setup>
import { computed, onUnmounted, reactive, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { computed, ref } from "vue";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
const personName = ref("汤文清");
const lifeEvents = ref([
{
id: 1,
title: "大学毕业",
year: "2018 年 6 月",
place: "杭州",
description: "完成学业,带着家人的祝福走向新的生活。",
},
{
id: 2,
title: "结为连理",
year: "2022 年 10 月",
place: "汤氏祖居",
description: "在家人见证下组成新的家庭。",
},
]);
const timelineState = ref("loading");
const dialogVisible = ref(false);
const toastVisible = ref(false);
const formError = ref("");
const lifeEventForm = reactive({
title: "",
year: "",
place: "",
description: "",
});
let timer = null;
const stateClasses = computed(() => ({
"timeline-state--loading": timelineState.value === "loading",
"timeline-state--empty": timelineState.value === "empty",
"timeline-state--error": timelineState.value === "error",
}));
onLoad((q) => {
personName.value = String(q.personName || "汤文清");
timelineState.value = ["loading", "empty", "error"].includes(q.state)
? q.state
: "ready";
});
const createLifeEvent = () => {
Object.assign(lifeEventForm, {
title: "",
year: "",
place: "",
description: "",
});
formError.value = "";
dialogVisible.value = true;
};
const saveLifeEvent = () => {
if (!lifeEventForm.title.trim() || !lifeEventForm.year.trim()) {
formError.value = "请填写事件名称和年份";
return;
}
lifeEvents.value.unshift({ id: Date.now(), ...lifeEventForm });
timelineState.value = "ready";
dialogVisible.value = false;
toastVisible.value = true;
timer = setTimeout(() => (toastVisible.value = false), 1800);
};
onUnmounted(() => {
if (timer) clearTimeout(timer);
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;
.timeline-page {
.service-page {
display: flex;
min-height: 100vh;
flex-direction: column;
@@ -164,97 +81,32 @@ onUnmounted(() => {
min-height: calc(100vh - 100rpx);
}
.page-content {
display: flex;
flex-direction: column;
gap: 16rpx;
padding: 18rpx 24rpx 72rpx;
}
.person-lead {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 8rpx 18rpx;
min-height: 62rpx;
align-items: center;
padding: 0 20rpx;
color: $ink-muted;
font-size: 22rpx;
background: url("/static/assets/modules/genealogy/transparent/section-divider.png")
center/100% auto no-repeat;
}
.person-lead text:first-child {
color: $brand-red;
font-weight: 700;
}
.timeline-card,
.state-card {
box-sizing: border-box;
padding: 34rpx 46rpx;
min-height: 380rpx;
padding: 78rpx 52rpx 50rpx;
@include adaptive.adaptive-records-content;
}
.timeline-card > text,
.state-card > text {
display: block;
}
.timeline-card > text:first-child {
color: $brand-red;
font-size: 20rpx;
}
.timeline-card > text:nth-child(2) {
margin-top: 6rpx;
color: $ink;
font-size: 31rpx;
font-weight: 700;
}
.timeline-card > text:nth-child(3) {
margin-top: 8rpx;
color: $ink-muted;
font-size: 21rpx;
}
.timeline-card > text:last-child {
margin-top: 10rpx;
color: $ink;
font-size: 23rpx;
line-height: 1.55;
}
.state-card {
min-height: 340rpx;
padding-top: 78rpx;
text-align: center;
}
.state-card > text { display: block; }
.state-card > text:first-child {
color: $ink;
font-size: 35rpx;
font-weight: 700;
}
.state-card > text:nth-child(2) {
.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;
}
.dialog-form {
width: 100%;
margin: 18rpx 0;
}
.dialog-form input,
.dialog-form textarea {
width: 100%;
min-height: 66rpx;
margin-top: 8rpx;
padding: 12rpx 20rpx;
box-sizing: border-box;
color: $ink;
font-size: 22rpx;
@include adaptive.adaptive-records-field;
}
.dialog-form text {
display: block;
margin-top: 8rpx;
color: $brand-red;
font-size: 20rpx;
}
</style>
+191 -186
View File
@@ -1,246 +1,251 @@
<!-- 页面编号R-10用途家族备忘列表完成状态与同页新增 -->
<!-- 页面编号R-10用途当前家谱备忘列表与不写库的本地预览 -->
<template>
<view class="memo-page" :class="stateClasses">
<ModulePageBackground module="records" />
<view class="page-header">
<PageHeader title="家族备忘" action="新增" @action="createMemo" />
</view>
<view v-if="memoState === 'loading'" class="page-loading">
<AppLoading
text="正在读取家族备忘"
description="请稍候,正在整理待办事项。"
<PageHeader
title="家族备忘"
:action="hasValidContext ? '填写预览' : ''"
custom-back
@back="requestBack"
@action="startMemoPreview"
/>
</view>
<view v-if="memoState === 'loading'" class="page-loading">
<AppLoading text="正在读取家族备忘" description="请稍候,正在核对当前家谱的备忘记录。" />
</view>
<view v-else class="page-content">
<view v-if="localMemoPreview" class="preview-card">
<text>本地预览 · 尚未提交</text>
<text>{{ localMemoPreview.memoTitle }}</text>
<text>{{ localMemoPreview.remindTime || "提醒时间未填写" }}</text>
<text>{{ localMemoPreview.memoContent || "内容未填写" }}</text>
</view>
<template v-if="memoState === 'ready' && memos.length">
<view
v-for="memo in memos"
:key="memo.id"
class="memo-card"
:class="{ 'memo-card--done': memo.done }"
@click="toggleMemo(memo)"
>
<view v-for="memo in memos" :key="memo.memoId" class="memo-card">
<view>
<text>{{ memo.done ? "已完成" : "待办理" }}</text>
<text>{{ memo.due }}</text>
<text>{{ memo.completedLabel }}</text>
<text>{{ memo.remindTime || "未设置提醒" }}</text>
</view>
<text>{{ memo.title }}</text>
<text>{{ memo.description }}</text>
<text>{{ memo.done ? "点击恢复待办" : "点击标记完成" }}</text>
<text>{{ memo.memoTitle }}</text>
<text>{{ memo.memoContent || "暂无备忘内容" }}</text>
<text>状态仅展示线上切换接口尚未确认</text>
</view>
<AppButton block label="新增备忘" @click="createMemo" />
<AppButton block label="填写备忘预览" @click="startMemoPreview" />
</template>
<view v-else class="state-card">
<text>
{{ memoState === "error" ? "家族备忘暂不可用" : "还没有备忘" }}
</text>
<text>
{{
memoState === "error"
? "请稍后重新查看,已有备忘不会受到影响。"
: "把需要家人共同记住的事情写在这里。"
}}
</text>
<text>{{ stateCopy.title }}</text>
<text>{{ stateCopy.copy }}</text>
<AppButton
:type="memoState === 'error' ? 'secondary' : 'primary'"
:type="memoState === 'empty' ? 'primary' : 'secondary'"
block
:label="memoState === 'error' ? '重新查看' : '新增备忘'"
@click="memoState === 'error' ? (memoState = 'ready') : createMemo()"
:label="stateCopy.action"
@click="handleStateAction"
/>
</view>
</view>
<AppDialog
:visible="dialogVisible"
:close-on-mask="false"
eyebrow="家族备忘"
title="新增一项备忘"
confirm-text="保存备忘"
title="填写一份备忘预览"
confirm-text="生成预览"
cancel-text="取消"
show-cancel
@confirm="saveMemo"
@cancel="dialogVisible = false"
@confirm="createMemoPreview"
@cancel="requestCloseEditor"
>
<view class="dialog-form">
<input v-model="memoForm.title" placeholder="备忘标题" />
<input v-model="memoForm.due" placeholder="截止日期或时间" />
<textarea
v-model="memoForm.description"
auto-height
placeholder="补充具体事项"
/>
<input v-model="memoForm.memoTitle" placeholder="备忘标题" />
<input v-model="memoForm.remindTime" placeholder="提醒时间(选填)" />
<textarea v-model="memoForm.memoContent" auto-height placeholder="补充具体事项(选填)" />
<text v-if="formError">{{ formError }}</text>
</view>
</AppDialog>
<AppToast :visible="toastVisible" message="备忘已更新" />
<AppDialog
:visible="discardVisible"
:close-on-mask="false"
eyebrow="放弃确认"
title="放弃当前填写?"
message="尚未提交的预览内容将从当前页面清除。"
confirm-text="确认放弃"
cancel-text="继续填写"
show-cancel
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
<AppToast :visible="toastVisible" message="已生成本地预览,尚未保存" />
</view>
</template>
<script setup>
import { computed, onUnmounted, reactive, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
const memos = ref([
{
id: 1,
title: "修谱资料整理",
due: "本月底前",
description: "补充老照片中的人物姓名和拍摄时间。",
done: false,
},
{
id: 2,
title: "重阳敬老活动",
due: "10 月 11 日上午",
description: "在祠堂集合,并确认接送长辈的车辆。",
done: true,
},
]);
import {
getGenealogyFixtureAccess,
listMemoFixtures,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import { goBack, handleBackPress, runBackGuard } from "@/utils/navigation.js";
const genealogyId = ref("");
const memos = ref([]);
const memoState = ref("loading");
const dialogVisible = ref(false);
const discardVisible = ref(false);
const toastVisible = ref(false);
const formError = ref("");
const memoForm = reactive({ title: "", due: "", description: "" });
const localMemoPreview = ref(null);
const memoForm = reactive({ memoTitle: "", remindTime: "", memoContent: "" });
const editorBaseline = ref("");
let timer = null;
const stateClasses = computed(() => ({
"memo-state--loading": memoState.value === "loading",
"memo-state--empty": memoState.value === "empty",
"memo-state--error": memoState.value === "error",
"memo-state--invalid": memoState.value === "invalid",
}));
onLoad((q) => {
memoState.value = ["loading", "empty", "error"].includes(q.state)
? q.state
: "ready";
const hasValidContext = computed(() => ["ready", "empty"].includes(memoState.value));
const formSnapshot = computed(() => JSON.stringify({ ...memoForm }));
const memoDraftDirty = computed(() =>
dialogVisible.value && formSnapshot.value !== editorBaseline.value,
);
const stateCopy = computed(() => ({
error: {
title: "家族备忘暂不可用",
copy: "请稍后重新查看,已有备忘不会受到影响。",
action: "重新查看",
},
invalid: {
title: "家族备忘入口无效",
copy: "没有找到可访问的成员家谱,页面不会展示其他家谱备忘。",
action: "返回上一页",
},
empty: {
title: "还没有备忘",
copy: "可以先生成一份本地预览;正式创建仍需等待线上写接口启用。",
action: "填写备忘预览",
},
})[memoState.value] || {
title: "家族备忘暂不可用",
copy: "请返回上一页重新进入。",
action: "返回上一页",
});
const showToast = () => {
toastVisible.value = true;
if (timer) clearTimeout(timer);
timer = setTimeout(() => (toastVisible.value = false), 1800);
};
const toggleMemo = (memo) => {
memo.done = !memo.done;
showToast();
};
const createMemo = () => {
Object.assign(memoForm, { title: "", due: "", description: "" });
formError.value = "";
dialogVisible.value = true;
};
const saveMemo = () => {
if (!memoForm.title.trim()) {
formError.value = "请填写备忘标题";
onLoad((query) => {
genealogyId.value = String(query.genealogyId || "");
const access = getGenealogyFixtureAccess(genealogyId.value);
if (!["owner", "member"].includes(access.accessRole)) {
memoState.value = "invalid";
return;
}
memos.value.unshift({ id: Date.now(), ...memoForm, done: false });
memoState.value = "ready";
dialogVisible.value = false;
showToast();
memos.value = listMemoFixtures(genealogyId.value);
memoState.value = ["loading", "empty", "error"].includes(query.state)
? query.state
: memos.value.length
? "ready"
: "empty";
});
const startMemoPreview = () => {
if (!hasValidContext.value) return false;
Object.assign(memoForm, { memoTitle: "", remindTime: "", memoContent: "" });
formError.value = "";
editorBaseline.value = formSnapshot.value;
dialogVisible.value = true;
return true;
};
const createMemoPreview = () => {
formError.value = memoForm.memoTitle.trim() ? "" : "请填写备忘标题";
if (formError.value) return false;
// ID
localMemoPreview.value = Object.freeze({
memoTitle: memoForm.memoTitle.trim(),
remindTime: memoForm.remindTime.trim(),
memoContent: memoForm.memoContent.trim(),
});
dialogVisible.value = false;
toastVisible.value = true;
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
toastVisible.value = false;
timer = null;
}, 1800);
return true;
};
const closeEditor = () => {
dialogVisible.value = false;
formError.value = "";
};
const discardConfirmation = createDiscardConfirmation(
(visible) => { discardVisible.value = visible; },
);
const confirmDiscard = () => {
discardConfirmation.confirm();
closeEditor();
};
const cancelDiscard = discardConfirmation.cancel;
const requestCloseEditor = async () => {
if (!memoDraftDirty.value) {
closeEditor();
return true;
}
const confirmed = await discardConfirmation.request();
if (confirmed) closeEditor();
return confirmed;
};
const restoreMemos = () => {
memos.value = listMemoFixtures(genealogyId.value);
memoState.value = memos.value.length ? "ready" : "empty";
};
const handleStateAction = () => {
if (memoState.value === "invalid") return goBack();
if (memoState.value === "error") return restoreMemos();
return startMemoPreview();
};
const requestBack = () => {
if (discardVisible.value) {
cancelDiscard();
return Promise.resolve(true);
}
if (dialogVisible.value) return requestCloseEditor();
return runBackGuard({
dirty: Boolean(localMemoPreview.value),
"confirm-discard": discardConfirmation.request,
});
};
onBackPress((event) => handleBackPress(event, requestBack));
onUnmounted(() => {
if (timer) clearTimeout(timer);
discardConfirmation.dispose();
});
</script>
<style scoped lang="scss">
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
.memo-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 {
display: flex;
flex-direction: column;
gap: 16rpx;
padding: 18rpx 24rpx 72rpx;
}
.memo-card,
.state-card {
box-sizing: border-box;
padding: 34rpx 46rpx;
@include adaptive.adaptive-records-content;
}
.memo-card > view {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 6rpx 18rpx;
color: $brand-red;
font-size: 20rpx;
}
.memo-card > text,
.state-card > text {
display: block;
}
.memo-card > text:nth-child(2) {
margin-top: 8rpx;
color: $ink;
font-size: 31rpx;
font-weight: 700;
}
.memo-card > text:nth-child(3) {
margin-top: 9rpx;
color: $ink-muted;
font-size: 23rpx;
line-height: 1.55;
}
.memo-card > text:last-child {
margin-top: 10rpx;
color: $brand-red;
font-size: 20rpx;
}
.memo-card--done {
opacity: 0.68;
}
.state-card {
min-height: 340rpx;
padding-top: 78rpx;
text-align: center;
}
.state-card > text:first-child {
color: $ink;
font-size: 35rpx;
font-weight: 700;
}
.state-card > text:nth-child(2) {
margin-top: 18rpx;
color: $ink-muted;
font-size: 24rpx;
line-height: 1.65;
}
.state-card .app-button {
margin-top: 28rpx;
}
.dialog-form {
width: 100%;
margin: 18rpx 0;
}
.dialog-form input,
.dialog-form textarea {
width: 100%;
min-height: 68rpx;
margin-top: 9rpx;
padding: 13rpx 20rpx;
box-sizing: border-box;
color: $ink;
font-size: 23rpx;
@include adaptive.adaptive-records-field;
}
.dialog-form text {
display: block;
margin-top: 8rpx;
color: $brand-red;
font-size: 20rpx;
}
.memo-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 { display: flex; flex-direction: column; gap: 16rpx; padding: 18rpx 24rpx 72rpx; }
.memo-card,.preview-card,.state-card { box-sizing: border-box; padding: 34rpx 46rpx; @include adaptive.adaptive-records-content; }
.memo-card > view { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6rpx 18rpx; color: $brand-red; font-size: 20rpx; }
.memo-card > text,.preview-card > text,.state-card > text { display: block; }
.memo-card > text:nth-child(2),.preview-card > text:nth-child(2) { margin-top: 8rpx; color: $ink; font-size: 31rpx; font-weight: 700; }
.memo-card > text:nth-child(3),.preview-card > text:nth-child(n + 3) { margin-top: 9rpx; color: $ink-muted; font-size: 23rpx; line-height: 1.55; }
.memo-card > text:last-child,.preview-card > text:first-child { margin-top: 10rpx; color: $brand-red; font-size: 20rpx; }
.state-card { min-height: 340rpx; padding-top: 78rpx; text-align: center; }
.state-card > text:first-child { color: $ink; font-size: 35rpx; font-weight: 700; }
.state-card > text:nth-child(2) { margin-top: 18rpx; color: $ink-muted; font-size: 24rpx; line-height: 1.65; }
.state-card .app-button { margin-top: 28rpx; }
.dialog-form { width: 100%; margin: 18rpx 0; }
.dialog-form input,.dialog-form textarea { width: 100%; min-height: 68rpx; margin-top: 9rpx; padding: 13rpx 20rpx; box-sizing: border-box; color: $ink; font-size: 23rpx; @include adaptive.adaptive-records-field; }
.dialog-form text { display: block; margin-top: 8rpx; color: $brand-red; font-size: 20rpx; }
</style>
+225 -203
View File
@@ -1,266 +1,288 @@
<!-- 页面编号R-11用途功德记录贡献汇总与同页新增 -->
<!-- 页面编号R-11用途当前家谱功德记录与不写库的本地预览 -->
<template>
<view class="merit-page" :class="stateClasses">
<ModulePageBackground module="records" />
<view class="page-header">
<PageHeader title="功德记录" action="新增" @action="createMerit" />
</view>
<view v-if="meritState === 'loading'" class="page-loading">
<AppLoading
text="正在整理功德记录"
description="请稍候,正在读取家人对家族事务的支持。"
<PageHeader
title="功德记录"
:action="hasValidContext ? '填写预览' : ''"
custom-back
@back="requestBack"
@action="startMeritPreview"
/>
</view>
<view v-if="meritState === 'loading'" class="page-loading">
<AppLoading text="正在整理功德记录" description="请稍候,正在核对当前家谱的正式记录。" />
</view>
<view v-else class="page-content">
<view v-if="meritState === 'ready'" class="merit-summary">
<text>共同贡献</text>
<text>{{ totalContribution }} </text>
<text>每一次时间物资与心力的付出都值得被记住</text>
<view v-if="hasValidContext" class="merit-summary">
<text>正式记录</text>
<text>{{ totalContribution }} </text>
<text>本地预览不计入正式记录数量</text>
</view>
<view v-if="localMeritPreview" class="preview-card">
<text>本地预览 · 尚未提交</text>
<text>{{ localMeritPreview.meritTitle }}</text>
<text>{{ localMeritPreview.donorName }} · {{ localMeritPreview.meritTime || "时间未填写" }}</text>
<text>{{ localMeritPreview.meritType || "类型未填写" }}</text>
<text>金额数值单位待确认{{ formatMeritAmount(localMeritPreview.amount) }}</text>
<text>{{ localMeritPreview.meritContent || "内容未填写" }}</text>
</view>
<template v-if="meritState === 'ready' && meritRecords.length">
<view v-for="merit in meritRecords" :key="merit.id" class="merit-card">
<text>{{ merit.category }}</text>
<text>{{ merit.title }}</text>
<text>{{ merit.contributor }} · {{ merit.date }}</text>
<text>{{ merit.description }}</text>
<view v-for="merit in meritRecords" :key="merit.meritId" class="merit-card">
<text>{{ merit.meritTypeLabel || "类型未标注" }}</text>
<text>{{ merit.meritTitle }}</text>
<text>{{ merit.donorName }} · {{ merit.meritTime || "时间未填写" }}</text>
<text>{{ merit.meritContent || "暂无记录内容" }}</text>
</view>
<AppButton block label="新增功德记录" @click="createMerit" />
<AppButton block label="填写功德预览" @click="startMeritPreview" />
</template>
<view v-else class="state-card">
<text>
{{ meritState === "error" ? "功德记录暂不可用" : "还没有功德记录" }}
</text>
<text>
{{
meritState === "error"
? "请稍后重新查看,已有记录不会受到影响。"
: "记录第一份对家族事务的时间、物资或心力支持。"
}}
</text>
<text>{{ stateCopy.title }}</text>
<text>{{ stateCopy.copy }}</text>
<AppButton
:type="meritState === 'error' ? 'secondary' : 'primary'"
:type="meritState === 'empty' ? 'primary' : 'secondary'"
block
:label="meritState === 'error' ? '重新查看' : '新增记录'"
@click="
meritState === 'error' ? (meritState = 'ready') : createMerit()
"
:label="stateCopy.action"
@click="handleStateAction"
/>
</view>
</view>
<AppDialog
:visible="dialogVisible"
:close-on-mask="false"
eyebrow="功德记录"
title="记下一份家族贡献"
confirm-text="保存记录"
title="填写一份功德预览"
confirm-text="生成预览"
cancel-text="取消"
show-cancel
@confirm="saveMerit"
@cancel="dialogVisible = false"
@confirm="createMeritPreview"
@cancel="requestCloseEditor"
>
<view class="dialog-form">
<input v-model="meritForm.title" placeholder="贡献事项" />
<input v-model="meritForm.contributor" placeholder="贡献人" />
<input v-model="meritForm.date" placeholder="日期" />
<textarea
v-model="meritForm.description"
auto-height
placeholder="说明时间、物资或具体帮助"
/>
<input v-model="meritForm.meritTitle" placeholder="贡献事项" />
<input v-model="meritForm.donorName" placeholder="贡献人" />
<input v-model="meritForm.meritType" placeholder="贡献类型(选填)" />
<input v-model="meritForm.meritTime" placeholder="时间(选填)" />
<input v-model="meritForm.amount" type="digit" placeholder="金额数值(单位未明确,可不填)" />
<textarea v-model="meritForm.meritContent" auto-height placeholder="说明时间、物资或具体帮助(选填)" />
<text v-if="formError">{{ formError }}</text>
</view>
</AppDialog>
<AppToast :visible="toastVisible" message="功德记录已保存" />
<AppDialog
:visible="discardVisible"
:close-on-mask="false"
eyebrow="放弃确认"
title="放弃当前填写?"
message="尚未提交的预览内容将从当前页面清除。"
confirm-text="确认放弃"
cancel-text="继续填写"
show-cancel
@confirm="confirmDiscard"
@cancel="cancelDiscard"
/>
<AppToast :visible="toastVisible" message="已生成本地预览,尚未保存" />
</view>
</template>
<script setup>
import { computed, onUnmounted, reactive, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { onBackPress, onLoad } from "@dcloudio/uni-app";
import AppButton from "@/components/AppButton.vue";
import AppDialog from "@/components/AppDialog.vue";
import AppLoading from "@/components/AppLoading.vue";
import AppToast from "@/components/AppToast.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
const meritRecords = ref([
{
id: 1,
category: "共同修缮",
title: "修缮祠堂",
contributor: "汤氏家人共同参与",
date: "2024 年春",
description: "协助整理院落、修补门窗并登记旧物。",
},
{
id: 2,
category: "奖学助学",
title: "支持后辈勤学",
contributor: "家族教育小组",
date: "2024 年夏",
description: "为家族中努力求学的孩子提供书籍与经验分享。",
},
]);
const totalContribution = computed(() => meritRecords.value.length);
import {
getGenealogyFixtureAccess,
listMeritRecordFixtures,
} from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import { goBack, handleBackPress, runBackGuard } from "@/utils/navigation.js";
const genealogyId = ref("");
const meritRecords = ref([]);
const meritState = ref("loading");
const dialogVisible = ref(false);
const discardVisible = ref(false);
const toastVisible = ref(false);
const formError = ref("");
const localMeritPreview = ref(null);
const meritForm = reactive({
title: "",
contributor: "",
date: "",
description: "",
category: "家族贡献",
meritTitle: "",
donorName: "",
meritType: "",
meritTime: "",
amount: "",
meritContent: "",
});
const editorBaseline = ref("");
let timer = null;
const totalContribution = computed(() => meritRecords.value.length);
const stateClasses = computed(() => ({
"merit-state--loading": meritState.value === "loading",
"merit-state--empty": meritState.value === "empty",
"merit-state--error": meritState.value === "error",
"merit-state--invalid": meritState.value === "invalid",
}));
onLoad((q) => {
meritState.value = ["loading", "empty", "error"].includes(q.state)
? q.state
: "ready";
const hasValidContext = computed(() => ["ready", "empty"].includes(meritState.value));
const formSnapshot = computed(() => JSON.stringify({ ...meritForm }));
const meritDraftDirty = computed(() =>
dialogVisible.value && formSnapshot.value !== editorBaseline.value,
);
const stateCopy = computed(() => ({
error: {
title: "功德记录暂不可用",
copy: "请稍后重新查看,已有记录不会受到影响。",
action: "重新查看",
},
invalid: {
title: "功德记录入口无效",
copy: "没有找到可访问的成员家谱,页面不会展示其他家谱记录。",
action: "返回上一页",
},
empty: {
title: "还没有功德记录",
copy: "可以先生成一份本地预览;正式创建仍需等待线上写接口启用。",
action: "填写功德预览",
},
})[meritState.value] || {
title: "功德记录暂不可用",
copy: "请返回上一页重新进入。",
action: "返回上一页",
});
const createMerit = () => {
Object.assign(meritForm, {
title: "",
contributor: "",
date: "",
description: "",
category: "家族贡献",
});
formError.value = "";
dialogVisible.value = true;
};
const saveMerit = () => {
if (!meritForm.title.trim() || !meritForm.contributor.trim()) {
formError.value = "请填写贡献事项和贡献人";
onLoad((query) => {
genealogyId.value = String(query.genealogyId || "");
const access = getGenealogyFixtureAccess(genealogyId.value);
if (!["owner", "member"].includes(access.accessRole)) {
meritState.value = "invalid";
return;
}
meritRecords.value.unshift({ id: Date.now(), ...meritForm });
meritState.value = "ready";
meritRecords.value = listMeritRecordFixtures(genealogyId.value);
meritState.value = ["loading", "empty", "error"].includes(query.state)
? query.state
: meritRecords.value.length
? "ready"
: "empty";
});
const startMeritPreview = () => {
if (!hasValidContext.value) return false;
Object.assign(meritForm, {
meritTitle: "",
donorName: "",
meritType: "",
meritTime: "",
amount: "",
meritContent: "",
});
formError.value = "";
editorBaseline.value = formSnapshot.value;
dialogVisible.value = true;
return true;
};
const formatMeritAmount = (amount) =>
amount === null || amount === "" ? "未填写" : String(amount);
const createMeritPreview = () => {
const missing = [];
if (!meritForm.meritTitle.trim()) missing.push("贡献事项");
if (!meritForm.donorName.trim()) missing.push("贡献人");
formError.value = missing.length ? `请填写${missing.join("和")}` : "";
const amountInput = meritForm.amount.trim();
if (!formError.value && amountInput && !Number.isFinite(Number(amountInput))) {
formError.value = "金额必须是数字,单位仍待后端确认";
}
if (formError.value) return false;
//
localMeritPreview.value = Object.freeze({
meritTitle: meritForm.meritTitle.trim(),
donorName: meritForm.donorName.trim(),
meritType: meritForm.meritType.trim(),
meritTime: meritForm.meritTime.trim(),
amount: amountInput ? Number(amountInput) : null,
meritContent: meritForm.meritContent.trim(),
});
dialogVisible.value = false;
toastVisible.value = true;
timer = setTimeout(() => (toastVisible.value = false), 1800);
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
toastVisible.value = false;
timer = null;
}, 1800);
return true;
};
const closeEditor = () => {
dialogVisible.value = false;
formError.value = "";
};
const discardConfirmation = createDiscardConfirmation(
(visible) => { discardVisible.value = visible; },
);
const confirmDiscard = () => {
discardConfirmation.confirm();
closeEditor();
};
const cancelDiscard = discardConfirmation.cancel;
const requestCloseEditor = async () => {
if (!meritDraftDirty.value) {
closeEditor();
return true;
}
const confirmed = await discardConfirmation.request();
if (confirmed) closeEditor();
return confirmed;
};
const restoreMeritRecords = () => {
meritRecords.value = listMeritRecordFixtures(genealogyId.value);
meritState.value = meritRecords.value.length ? "ready" : "empty";
};
const handleStateAction = () => {
if (meritState.value === "invalid") return goBack();
if (meritState.value === "error") return restoreMeritRecords();
return startMeritPreview();
};
const requestBack = () => {
if (discardVisible.value) {
cancelDiscard();
return Promise.resolve(true);
}
if (dialogVisible.value) return requestCloseEditor();
return runBackGuard({
dirty: Boolean(localMeritPreview.value),
"confirm-discard": discardConfirmation.request,
});
};
onBackPress((event) => handleBackPress(event, requestBack));
onUnmounted(() => {
if (timer) clearTimeout(timer);
discardConfirmation.dispose();
});
</script>
<style scoped lang="scss">
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
.merit-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 {
display: flex;
flex-direction: column;
gap: 16rpx;
padding: 18rpx 24rpx 72rpx;
}
.merit-summary,
.merit-card,
.state-card {
box-sizing: border-box;
padding: 34rpx 46rpx;
@include adaptive.adaptive-records-content;
}
.merit-summary {
text-align: center;
}
.merit-summary > text,
.merit-card > text,
.state-card > text {
display: block;
}
.merit-summary > text:first-child {
color: $brand-red;
font-size: 21rpx;
}
.merit-summary > text:nth-child(2) {
margin-top: 5rpx;
color: $ink;
font-size: 38rpx;
font-weight: 700;
}
.merit-summary > text:last-child {
margin-top: 9rpx;
color: $ink-muted;
font-size: 22rpx;
line-height: 1.5;
}
.merit-card > text:first-child {
color: $brand-red;
font-size: 20rpx;
}
.merit-card > text:nth-child(2) {
margin-top: 6rpx;
color: $ink;
font-size: 31rpx;
font-weight: 700;
}
.merit-card > text:nth-child(3) {
margin-top: 8rpx;
color: $ink-muted;
font-size: 21rpx;
}
.merit-card > text:last-child {
margin-top: 9rpx;
color: $ink;
font-size: 23rpx;
line-height: 1.55;
}
.state-card {
min-height: 340rpx;
padding-top: 78rpx;
text-align: center;
}
.state-card > text:first-child {
color: $ink;
font-size: 35rpx;
font-weight: 700;
}
.state-card > text:nth-child(2) {
margin-top: 18rpx;
color: $ink-muted;
font-size: 24rpx;
line-height: 1.65;
}
.state-card .app-button {
margin-top: 28rpx;
}
.dialog-form {
width: 100%;
margin: 14rpx 0;
}
.dialog-form input,
.dialog-form textarea {
width: 100%;
min-height: 62rpx;
margin-top: 7rpx;
padding: 11rpx 18rpx;
box-sizing: border-box;
color: $ink;
font-size: 22rpx;
@include adaptive.adaptive-records-field;
}
.dialog-form text {
display: block;
margin-top: 7rpx;
color: $brand-red;
font-size: 20rpx;
}
.merit-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 { display: flex; flex-direction: column; gap: 16rpx; padding: 18rpx 24rpx 72rpx; }
.merit-summary,.merit-card,.preview-card,.state-card { box-sizing: border-box; padding: 34rpx 46rpx; @include adaptive.adaptive-records-content; }
.merit-summary { text-align: center; }
.merit-summary > text,.merit-card > text,.preview-card > text,.state-card > text { display: block; }
.merit-summary > text:first-child,.merit-card > text:first-child,.preview-card > text:first-child { color: $brand-red; font-size: 21rpx; }
.merit-summary > text:nth-child(2) { margin-top: 5rpx; color: $ink; font-size: 38rpx; font-weight: 700; }
.merit-summary > text:last-child { margin-top: 9rpx; color: $ink-muted; font-size: 22rpx; line-height: 1.5; }
.merit-card > text:nth-child(2),.preview-card > text:nth-child(2) { margin-top: 6rpx; color: $ink; font-size: 31rpx; font-weight: 700; }
.merit-card > text:nth-child(3),.preview-card > text:nth-child(3) { margin-top: 8rpx; color: $ink-muted; font-size: 21rpx; }
.merit-card > text:last-child,.preview-card > text:last-child { margin-top: 9rpx; color: $ink; font-size: 23rpx; line-height: 1.55; }
.state-card { min-height: 340rpx; padding-top: 78rpx; text-align: center; }
.state-card > text:first-child { color: $ink; font-size: 35rpx; font-weight: 700; }
.state-card > text:nth-child(2) { margin-top: 18rpx; color: $ink-muted; font-size: 24rpx; line-height: 1.65; }
.state-card .app-button { margin-top: 28rpx; }
.dialog-form { width: 100%; margin: 14rpx 0; }
.dialog-form input,.dialog-form textarea { width: 100%; min-height: 62rpx; margin-top: 7rpx; padding: 11rpx 18rpx; box-sizing: border-box; color: $ink; font-size: 22rpx; @include adaptive.adaptive-records-field; }
.dialog-form text { display: block; margin-top: 7rpx; color: $brand-red; font-size: 20rpx; }
</style>
+43 -78
View File
@@ -182,7 +182,9 @@ 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 { getGenealogyFixtureAccess, listTreeMemberFixtures } from "@/data/mock.js";
import { genealogyContext } from "@/utils/genealogy-context.js";
import { openPage } from "@/utils/navigation.js";
const genealogyId = ref("");
const treeState = ref("loading");
@@ -202,61 +204,7 @@ const generationMeta = {
13: { label: "第十三世", summary: "两房" },
14: { label: "第十四世", summary: "三支" },
};
const members = ref([
{
id: 101,
name: "汤文远",
relation: "始祖",
years: "1940—2012",
generation: 12,
branch: "主支",
},
{
id: 102,
name: "汤正国",
relation: "长子",
years: "1965—",
generation: 13,
parentId: 101,
branch: "长房",
},
{
id: 103,
name: "汤正华",
relation: "次子",
years: "1968—",
generation: 13,
parentId: 101,
branch: "二房",
},
{
id: 104,
name: "汤凯",
relation: "长孙",
years: "1992—",
generation: 14,
parentId: 102,
branch: "长房",
},
{
id: 105,
name: "汤悦",
relation: "长孙女",
years: "1995—",
generation: 14,
parentId: 102,
branch: "长房",
},
{
id: 106,
name: "汤晨",
relation: "次孙",
years: "1998—",
generation: 14,
parentId: 103,
branch: "二房",
},
]);
const members = ref([]);
const snapToGrid = (value) => Math.ceil(value / GRID_UNIT) * GRID_UNIT;
const layoutMembers = computed(() => {
@@ -404,8 +352,29 @@ const stateCopy = computed(
);
onLoad((query) => {
genealogyId.value =
query.genealogyId || genealogyContext.getCurrentGenealogyId() || "";
if (genealogyContext.isCurrentGenealogyInvalidated()) {
genealogyId.value = "";
members.value = [];
treeState.value = "error";
return;
}
genealogyId.value = String(
query.genealogyId || genealogyContext.getCurrentGenealogyId() || "",
);
if (!genealogyId.value) {
members.value = [];
treeState.value = "empty";
return;
}
const access = getGenealogyFixtureAccess(genealogyId.value);
if (!["owner", "member"].includes(access.accessRole)) {
genealogyContext.invalidateCurrentGenealogyId();
genealogyId.value = "";
members.value = [];
treeState.value = "error";
return;
}
members.value = listTreeMemberFixtures(genealogyId.value);
if (
query.state === "loading" ||
["landscape", "empty", "error"].includes(query.state)
@@ -413,16 +382,12 @@ onLoad((query) => {
treeState.value = query.state;
return;
}
if (!genealogyId.value) {
treeState.value = "empty";
return;
}
genealogyContext.setCurrentGenealogyId(genealogyId.value);
selected.value =
layoutMembers.value.find(
(item) => String(item.id) === String(query.selectedId),
) || layoutMembers.value[0];
treeState.value = "tree";
treeState.value = members.value.length ? "tree" : "empty";
});
onUnload(() => {
@@ -471,30 +436,30 @@ const nodeGridStyle = (member) => ({
});
const handleStateAction = () => {
if (treeState.value === "empty") {
uni.navigateTo({
url: `/pages/tree/t04-add-relative?genealogyId=${genealogyId.value || 1001}&mode=first`,
});
return;
if (!genealogyId.value) return Promise.resolve(false);
return openPage(
"T04",
{ genealogyId: genealogyId.value, mode: "first" },
"T01",
);
}
selected.value = layoutMembers.value[0];
treeState.value = "tree";
};
const toMember = () =>
uni.navigateTo({
url: `/pages/tree/t03-member-profile?genealogyId=${genealogyId.value}&personId=${selected.value.id}`,
});
selected.value
? openPage("T03", { genealogyId: genealogyId.value, personId: String(selected.value.id) }, "T01")
: Promise.resolve(false);
const toDirectory = () =>
uni.navigateTo({
url: `/pages/tree/t07-member-directory?genealogyId=${genealogyId.value}`,
});
openPage("T07", { genealogyId: genealogyId.value }, "T01");
const toRelationship = () =>
uni.navigateTo({
url: `/pages/tree/t06-edit-relationship?genealogyId=${genealogyId.value}`,
});
selected.value
? openPage("T06", { genealogyId: genealogyId.value, personId: String(selected.value.id) }, "T01")
: Promise.resolve(false);
const toAddRelative = () =>
uni.navigateTo({
url: `/pages/tree/t04-add-relative?genealogyId=${genealogyId.value}&personId=${selected.value.id}`,
});
selected.value
? openPage("T04", { genealogyId: genealogyId.value, personId: String(selected.value.id) }, "T01")
: Promise.resolve(false);
</script>
<style scoped lang="scss">
+183 -43
View File
@@ -2,18 +2,27 @@
<template>
<view
class="member-page"
:data-current-person-id="personId"
:data-trail-length="memberTrail.length"
:data-trail-index="trailIndex"
:class="{
'member-state--detail': memberState === 'detail',
'member-state--restricted': memberState === 'restricted',
'member-state--error': memberState === 'error',
}"
>
<ModulePageBackground module="tree" />
<view class="member-page__header">
<PageHeader title="成员档案" :action="memberState === 'detail' && canEdit ? '编辑' : ''" @action="toEdit" />
<PageHeader title="成员档案"
:action="canPreviewEdit ? '编辑预览' : ''"
custom-back
@back="requestBack"
@action="toEdit"
/>
</view>
<view class="member-context">
<text>{{ genealogyName }}</text>
<text>{{ memberState === "detail" ? "成员身份与亲属关系" : "请重新选择成员" }}</text>
<text>{{ memberContextDescription }}</text>
</view>
<view class="member-panel">
@@ -28,7 +37,7 @@
</view>
</view>
<view class="member-status-entry" @click="openMemberState(member.status)">
<view class="member-status-entry" @click="openMemberState">
<text>{{ statusLabel }}</text>
<text>{{ statusDescription }}</text>
<text>查看</text>
@@ -41,13 +50,36 @@
<text class="member-section-title member-section-title--relation">亲属关系</text>
<view class="member-relatives">
<view v-for="relative in member.relatives" :key="relative.id" @click="openRelative(relative)">
<view
v-for="relative in member.relatives"
:key="relative.id"
:data-person-id="relative.id"
@click="openRelative(relative.id)"
>
<text>{{ relative.relation }}</text><text>{{ relative.name }}</text>
</view>
<text v-if="!member.relatives.length">尚未记录可查看的亲属</text>
</view>
<view v-if="canEdit" class="member-profile-action" @click="toEdit"><text>完善成员档案</text></view>
<view class="member-record-actions">
<view role="button" aria-label="查看成长日志" @click="toGrowthJournal"><text>成长日志</text></view>
<view role="button" aria-label="查看人生事服务状态" @click="toLifeEvents"><text>人生事待开放</text></view>
</view>
<view v-if="canPreviewEdit" class="member-profile-action" @click="toEdit"><text>制作成员编辑预览</text></view>
</view>
<view v-else-if="memberState === 'restricted' && member" class="member-restricted">
<view class="member-heading">
<view class="member-heading__seal"><text>{{ member.name.slice(0, 1) }}</text></view>
<view>
<text>{{ member.name }}</text>
<text> {{ member.generation }} · {{ member.relation }}</text>
</view>
</view>
<text>{{ restrictedCopy.title }}</text>
<text>{{ restrictedCopy.copy }}</text>
<view class="member-restricted-action" @click="toTree"><text>返回上一位成员</text></view>
</view>
<view v-else class="member-error">
@@ -60,12 +92,18 @@
</template>
<script setup>
import { computed, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { computed, reactive, ref } from "vue";
import { onBackPress, onLoad, onShow } from "@dcloudio/uni-app";
import AppLoading from "@/components/AppLoading.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { genealogyContext } from "@/utils/genealogy-context.js";
import { findTreeMemberPresentationFixture } from "@/data/mock.js";
import {
consumeNavigationResult,
handleBackPress,
openPage,
runBackGuard,
} from "@/utils/navigation.js";
const genealogyId = ref("");
const personId = ref("");
@@ -73,24 +111,9 @@ const memberState = ref("loading");
const member = ref(null);
const errorMessage = ref("");
const genealogyName = ref("汤氏家谱");
const memberTrail = reactive([]);
const trailIndex = ref(-1);
const memberFixtures = {
101: {
id: 101, name: "汤文远", generation: 12, relation: "始祖", branch: "主支", generationName: "文字辈",
birthDate: "1940年3月", years: "1940—2012", birthplace: "河南南阳", status: "deceased", canEdit: true,
relatives: [{ id: 102, name: "汤正国", relation: "长子" }, { id: 103, name: "汤正华", relation: "次子" }],
},
102: {
id: 102, name: "汤正国", generation: 13, relation: "长子", branch: "长房", generationName: "正字辈",
birthDate: "1965年5月", years: "1965—", birthplace: "河南洛阳", status: "privacy", canEdit: true,
relatives: [{ id: 101, name: "汤文远", relation: "父亲" }, { id: 104, name: "汤凯", relation: "长子" }],
},
103: {
id: 103, name: "汤正华", generation: 13, relation: "次子", branch: "二房", generationName: "正字辈",
birthDate: "", years: "资料受限", birthplace: "", status: "forbidden", canEdit: false,
relatives: [{ id: 101, name: "汤文远", relation: "父亲" }],
},
};
const details = computed(() => member.value ? [
{ label: "字辈", value: member.value.generationName },
{ label: "出生日期", value: member.value.status === "forbidden" ? "按权限隐藏" : member.value.birthDate },
@@ -98,39 +121,147 @@ const details = computed(() => member.value ? [
{ label: "祖居地", value: member.value.status === "forbidden" ? "按权限隐藏" : member.value.birthplace },
{ label: "所属支系", value: member.value.branch },
] : []);
const canEdit = computed(() => Boolean(member.value?.canEdit));
const canPreviewEdit = computed(() => memberState.value === "detail");
const restrictedCopy = computed(() =>
member.value?.status === "forbidden"
? {
title: "当前成员档案访问受限",
copy: "页面只保留基础身份,不展示生平、居住地、支系、亲属或编辑入口。",
}
: {
title: "部分成员资料未公开",
copy: "页面只保留姓名、关系与世代,不展示其他资料或操作入口。",
},
);
const statusLabel = computed(() => ({ privacy: "隐私资料", deceased: "离世纪念", forbidden: "访问受限" })[member.value?.status] || "成员状态");
const statusDescription = computed(() => ({
privacy: "部分资料仅向授权成员展示",
deceased: "查看生平保留与纪念资料说明",
forbidden: "当前账号只能查看有限身份信息",
})[member.value?.status] || "查看成员状态说明");
const memberContextDescription = computed(() => ({
loading: "正在读取成员资料",
detail: "成员身份与亲属关系",
restricted: "隐私成员仅展示基础身份",
error: "请重新选择成员",
}[memberState.value] || "请重新选择成员"));
const loadMember = async (nextPersonId) => {
const normalizedPersonId = String(nextPersonId || "");
const fixture = findTreeMemberPresentationFixture(genealogyId.value, normalizedPersonId);
if (!fixture) {
errorMessage.value = "这位成员不存在或已不属于当前家谱。";
return false;
}
const restricted = ["privacy", "forbidden"].includes(fixture.status);
const relatives = restricted ? [] : fixture.relatives
.map((relative) => {
const relativeMember = findTreeMemberPresentationFixture(
genealogyId.value,
relative.personId,
);
return relativeMember
? { id: relativeMember.id, name: relativeMember.name, relation: relative.relation }
: null;
})
.filter(Boolean);
personId.value = normalizedPersonId;
member.value = {
...fixture,
relatives,
};
errorMessage.value = "";
memberState.value = restricted ? "restricted" : "detail";
return true;
};
const initializeMemberTrail = async (initialPersonId) => {
memberTrail.splice(0, memberTrail.length);
trailIndex.value = -1;
const normalizedPersonId = String(initialPersonId || "");
const loaded = await loadMember(normalizedPersonId);
if (!loaded) return false;
memberTrail.splice(0, memberTrail.length, normalizedPersonId);
trailIndex.value = 0;
return true;
};
const openRelative = async (nextPersonId) => {
const normalizedPersonId = String(nextPersonId || "");
if (!normalizedPersonId || normalizedPersonId === personId.value) return false;
//
//
const loaded = await loadMember(normalizedPersonId);
if (!loaded) return false;
memberTrail.splice(trailIndex.value + 1);
memberTrail.push(normalizedPersonId);
trailIndex.value = memberTrail.length - 1;
return true;
};
const popMemberTrail = async () => {
while (trailIndex.value > 0) {
const targetIndex = trailIndex.value - 1;
const historicalPersonId = memberTrail[targetIndex];
const loaded = await loadMember(historicalPersonId);
if (loaded) {
trailIndex.value = targetIndex;
return true;
}
//
// T03
memberTrail.splice(targetIndex, 1);
trailIndex.value -= 1;
}
return false;
};
const requestBack = () =>
runBackGuard({
internalTrail: trailIndex.value > 0,
"pop-internal-trail": popMemberTrail,
});
onLoad((query) => {
genealogyId.value = query.genealogyId || genealogyContext.getCurrentGenealogyId() || "";
personId.value = query.personId || "";
if (genealogyId.value) genealogyContext.setCurrentGenealogyId(genealogyId.value);
if (query.state === "loading") { memberState.value = "loading"; return; }
if (query.state === "error" || !personId.value || !memberFixtures[personId.value]) {
genealogyId.value = String(query.genealogyId || "");
const initialPersonId = String(query.personId || "");
if (query.state === "loading") return;
if (query.state === "error" || !genealogyId.value || !initialPersonId) {
memberState.value = "error";
errorMessage.value = !personId.value ? "没有指定成员,请从世系树重新选择。" : "这位成员不存在或已不属于当前家谱。";
errorMessage.value = !initialPersonId
? "没有指定成员,请从世系树重新选择。"
: "当前家谱上下文无效,请重新进入。";
return;
}
member.value = { ...memberFixtures[personId.value] };
memberState.value = "detail";
void initializeMemberTrail(initialPersonId).then((loaded) => {
if (loaded) return;
member.value = null;
memberState.value = "error";
});
});
onShow(() => {
const result = consumeNavigationResult("T03");
if (result?.operation === "member-open-requested" && result.entityId) {
void openRelative(result.entityId);
}
});
onBackPress((event) => handleBackPress(event, requestBack));
const toEdit = () => {
if (!canEdit.value) { openMemberState("forbidden"); return; }
uni.navigateTo({ url: `/pages/tree/t05-edit-member?genealogyId=${genealogyId.value}&personId=${personId.value}` });
if (!canPreviewEdit.value) return false;
return openPage("T05", { genealogyId: genealogyId.value, personId: personId.value }, "T03");
};
const openMemberState = (state) =>
uni.navigateTo({
url: `/pages/tree/t08-member-states?genealogyId=${genealogyId.value}&personId=${personId.value}&state=${state}`,
});
const openRelative = (relative) =>
uni.navigateTo({ url: `/pages/tree/t03-member-profile?genealogyId=${genealogyId.value}&personId=${relative.id}` });
const toTree = () => uni.navigateBack();
const openMemberState = () =>
openPage("T08", { genealogyId: genealogyId.value, personId: personId.value }, "T03");
const toGrowthJournal = () =>
openPage("R08", { genealogyId: genealogyId.value, personId: personId.value }, "T03");
const toLifeEvents = () =>
openPage("R09", { genealogyId: genealogyId.value, personId: personId.value }, "T03");
const toTree = requestBack;
</script>
<style scoped lang="scss">
@@ -160,8 +291,17 @@ const toTree = () => uni.navigateBack();
.member-relatives > view { display: flex; justify-content: space-between; gap: 20rpx; padding: 12rpx 18rpx; color: $ink; font-size: 23rpx; }
.member-relatives > view text:last-child { color: $brand-red; }
.member-relatives > text { display: block; color: $ink-muted; font-size: 23rpx; line-height: 1.5; }
.member-record-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12rpx; margin-top: 20rpx; }
.member-record-actions > view { @include adaptive.adaptive-scroll-button(secondary); display: flex; min-height: 72rpx; align-items: center; justify-content: center; padding: 8rpx 14rpx; text-align: center; }
.member-record-actions text { color: $brand-red; font-size: 22rpx; font-weight: 700; line-height: 1.35; }
.member-profile-action { @include adaptive.adaptive-scroll-button(primary); display: flex; min-height: 76rpx; align-items: center; justify-content: center; margin-top: 22rpx; }
.member-profile-action text { color: #fff9ed; font-size: 24rpx; font-weight: 700; }
.member-restricted { padding-top: 14rpx; }
.member-restricted > text { display: block; color: $ink-muted; font-size: 23rpx; line-height: 1.6; text-align: center; }
.member-restricted > text:first-of-type { margin-top: 28rpx; color: $ink; font-family: "STKaiti", "KaiTi", serif; font-size: 31rpx; font-weight: 700; }
.member-restricted > text + text { margin-top: 12rpx; }
.member-restricted-action { @include adaptive.adaptive-scroll-button(secondary); display: flex; min-height: 76rpx; align-items: center; justify-content: center; margin-top: 22rpx; }
.member-restricted-action text { color: $brand-red; font-size: 24rpx; font-weight: 700; }
.member-error { margin-top: 30%; text-align: center; }
.member-error > text { display: block; color: $ink-muted; font-size: 24rpx; line-height: 1.55; }
.member-error > text:nth-child(2) { font-size: 24rpx; }
+78 -52
View File
@@ -4,13 +4,13 @@
class="add-relative-page"
:class="{
'add-state--form': addState === 'form',
'add-state--success': addState === 'success',
'add-state--preview': addState === 'preview',
'add-state--error': addState === 'error',
}"
>
<ModulePageBackground module="tree" />
<view class="add-relative-page__header">
<PageHeader :title="isFirstMember ? '录入首位成员' : '新增亲属'" />
<PageHeader :title="isFirstMember ? '录入首位成员' : '新增亲属'" custom-back @back="requestBack" />
</view>
<view class="add-relative-panel">
@@ -75,17 +75,17 @@
<text class="form-note">{{ formNote }}</text>
<view class="form-action" @click="submitAdd">
<image src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png" mode="scaleToFill" />
<text>{{ isSubmitting ? "正在保存…" : isFirstMember ? "保存首位成员" : "保存亲属" }}</text>
<text>{{ isSubmitting ? "正在校验…" : "生成本地预览" }}</text>
</view>
</view>
<view v-else class="add-result">
<text class="form-eyebrow">{{ addState === "success" ? "世系资料已更新" : "成员未保存" }}</text>
<text class="form-title">{{ addState === "success" ? successTitle : "暂时无法保存成员" }}</text>
<text class="form-copy">{{ addState === "success" ? successCopy : "当前填写内容仍保留,可返回修改后重试。" }}</text>
<view class="form-action" @click="addState === 'success' ? returnToTree() : retryForm()">
<text class="form-eyebrow">{{ addState === "preview" ? "本地流程预览" : hasValidContext ? "成员未保存" : "成员入口无效" }}</text>
<text class="form-title">{{ addState === "preview" ? previewTitle : hasValidContext ? "暂时无法校验成员" : "没有找到要关联的成员" }}</text>
<text class="form-copy">{{ addState === "preview" ? previewCopy : hasValidContext ? "当前填写内容仍保留,可返回修改后重试。" : "请从世系树重新进入,页面不会创建临时成员身份。" }}</text>
<view class="form-action" @click="addState === 'preview' ? returnToTree() : retryForm()">
<image src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png" mode="scaleToFill" />
<text>{{ addState === "success" ? "返回世系树" : "返回修改" }}</text>
<text>{{ addState === "preview" ? "返回世系树(不保存)" : hasValidContext ? "返回修改" : "返回上一页" }}</text>
</view>
</view>
</view>
@@ -98,9 +98,9 @@
cancel-text="继续填写"
confirm-text="放弃并返回"
show-cancel
@close="discardDialogVisible = false"
@cancel="discardDialogVisible = false"
@confirm="discardAndBack"
:close-on-mask="false"
@cancel="cancelDiscard"
@confirm="confirmDiscard"
/>
</view>
</template>
@@ -111,7 +111,14 @@ import { onBackPress, onLoad, onUnload } from "@dcloudio/uni-app";
import AppDialog from "@/components/AppDialog.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { genealogyContext } from "@/utils/genealogy-context.js";
import { findTreeMemberFixture } from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
handleBackPress,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
const addState = ref("form");
const genealogyId = ref("");
@@ -121,21 +128,21 @@ const isSubmitting = ref(false);
const discardDialogVisible = ref(false);
let submitTimer = null;
const memberFixtures = {
101: { id: 101, name: "汤文远", generation: 12 },
102: { id: 102, name: "汤正国", generation: 13 },
103: { id: 103, name: "汤正华", generation: 13 },
};
const relationOptions = ["长子", "次子", "女儿", "配偶", "兄弟", "姐妹"];
const genderOptions = ["男", "女", "未说明"];
const addForm = reactive({ name: "", relation: "", gender: "", birthDate: "", summary: "" });
const fieldErrors = reactive({ name: "", relation: "", gender: "" });
const isFirstMember = computed(
() => mode.value === "first" || (!personId.value && mode.value !== "relative"),
const isFirstMember = computed(() => mode.value === "first");
const currentMember = computed(() =>
isFirstMember.value
? null
: findTreeMemberFixture(genealogyId.value, personId.value),
);
const currentMember = computed(
() => memberFixtures[personId.value] || { id: personId.value, name: "当前成员", generation: "待确认" },
const hasValidContext = computed(
() =>
Boolean(genealogyId.value) &&
(isFirstMember.value ? !personId.value : Boolean(currentMember.value)),
);
const relationIndex = computed(() => Math.max(0, relationOptions.indexOf(addForm.relation)));
const genderIndex = computed(() => Math.max(0, genderOptions.indexOf(addForm.gender)));
@@ -149,43 +156,54 @@ const formCopy = computed(() =>
);
const formNote = computed(() =>
isFirstMember.value
? "保存后进入世系树,并可继续为首位成员添加亲属。"
: "保存后成员会出现在相应世代;详细生平可在成员档案中继续完善。",
? "当前阶段只校验首位成员资料,不会修改世系树。"
: "当前阶段只校验亲属资料,不会新增成员或改变世系关系。",
);
const successTitle = computed(() =>
isFirstMember.value ? `${addForm.name}已成为世系起点` : `${addForm.name}已加入世系`,
const previewTitle = computed(() =>
isFirstMember.value ? `${addForm.name}可作为世系起点` : `${addForm.name}的亲属资料已通过本地校验`,
);
const successCopy = computed(() =>
isFirstMember.value
? "首位成员已保存,世系树现在可以继续向下补充。"
: `${addForm.relation}关系已记录,返回后可查看新的成员节点。`,
const previewCopy = computed(() =>
`本地预览尚未提交服务器,返回后不会保存${isFirstMember.value ? "首位成员" : `${addForm.relation}关系`},世系树也不会变化。`,
);
const hasDraft = computed(() =>
Object.values(addForm).some((value) => String(value).trim()),
);
const discardConfirmation = createDiscardConfirmation((visible) => {
discardDialogVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
onLoad((query) => {
genealogyId.value = query.genealogyId || genealogyContext.getCurrentGenealogyId() || "";
personId.value = query.personId || "";
genealogyId.value = String(query.genealogyId || "");
personId.value = String(query.personId || "");
mode.value = query.mode === "first" ? "first" : "relative";
if (genealogyId.value) genealogyContext.setCurrentGenealogyId(genealogyId.value);
addState.value = query.state === "success" ? "success" : query.state === "error" ? "error" : "form";
addState.value = !hasValidContext.value || query.state === "error"
? "error"
: query.state === "preview"
? "preview"
: "form";
});
onUnload(() => {
if (submitTimer) clearTimeout(submitTimer);
});
onBackPress(() => {
if (discardDialogVisible.value) {
discardDialogVisible.value = false;
return true;
}
if (addState.value === "form" && hasDraft.value) {
discardDialogVisible.value = true;
return true;
}
return false;
const timer = submitTimer;
submitTimer = null;
if (timer) clearTimeout(timer);
discardConfirmation.dispose();
});
const requestBack = () =>
runBackGuard({
transientOpen: discardDialogVisible.value,
dirty: (addState.value === "form" || addState.value === "preview") && hasDraft.value,
submitting: isSubmitting.value,
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
onBackPress((event) => handleBackPress(event, requestBack));
const clearError = (field) => { fieldErrors[field] = ""; };
const selectRelation = (event) => {
addForm.relation = relationOptions[Number(event.detail.value)] || "";
@@ -204,18 +222,26 @@ const validateAddForm = () => {
};
const submitAdd = () => {
if (isSubmitting.value || !validateAddForm()) return;
const submitSnapshot = Object.freeze({ ...addForm });
isSubmitting.value = true;
submitTimer = setTimeout(() => {
addState.value = addForm.name.trim() === "失败" ? "error" : "success";
const timer = setTimeout(() => {
if (submitTimer !== timer) return;
addState.value = submitSnapshot.name.trim() === "失败" ? "error" : "preview";
isSubmitting.value = false;
submitTimer = null;
}, 280);
submitTimer = timer;
};
const retryForm = () => { addState.value = "form"; };
const returnToTree = () => uni.navigateBack();
const discardAndBack = () => {
discardDialogVisible.value = false;
uni.navigateBack();
const retryForm = () => {
if (!hasValidContext.value) return goBack();
addState.value = "form";
};
const returnToTree = async () => {
const confirmed = hasDraft.value
? await requestDiscardConfirmation()
: true;
if (!confirmed) return false;
return returnTo("T01", { genealogyId: genealogyId.value });
};
</script>
+97 -44
View File
@@ -4,13 +4,13 @@
class="edit-member-page"
:class="{
'edit-state--form': editState === 'form',
'edit-state--success': editState === 'success',
'edit-state--preview': editState === 'preview',
'edit-state--error': editState === 'error',
'edit-state--no-permission': editState === 'no-permission',
}"
>
<ModulePageBackground module="tree" />
<view class="edit-member-page__header"><PageHeader title="编辑成员" /></view>
<view class="edit-member-page__header"><PageHeader title="编辑成员" custom-back @back="requestBack" /></view>
<view class="edit-member-panel">
<view v-if="editState === 'form'" class="edit-member-form">
<text class="form-eyebrow">成员档案维护</text>
@@ -45,7 +45,7 @@
<text class="form-note">隐私字段只向本人和具备维护权限的家谱管理员展示</text>
<view class="form-action" @click="saveMember">
<image src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png" mode="scaleToFill" />
<text>{{ isSubmitting ? "正在保存…" : "保存资料" }}</text>
<text>{{ isSubmitting ? "正在校验…" : "生成本地预览" }}</text>
</view>
</view>
@@ -68,9 +68,9 @@
cancel-text="继续编辑"
confirm-text="放弃修改"
show-cancel
@close="discardDialogVisible = false"
@cancel="discardDialogVisible = false"
@confirm="discardAndBack"
:close-on-mask="false"
@cancel="cancelDiscard"
@confirm="confirmDiscard"
/>
</view>
</template>
@@ -81,7 +81,13 @@ import { onBackPress, onLoad, onUnload } from "@dcloudio/uni-app";
import AppDialog from "@/components/AppDialog.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { genealogyContext } from "@/utils/genealogy-context.js";
import { findTreeMemberPresentationFixture } from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
handleBackPress,
runBackGuard,
} from "@/utils/navigation.js";
const editState = ref("form");
const genealogyId = ref("");
@@ -90,54 +96,93 @@ const isSubmitting = ref(false);
const discardDialogVisible = ref(false);
let submitTimer = null;
const memberFixtures = {
101: { id: 101, name: "汤文远", generation: 12, generationName: "文字辈", branch: "主支", birthDate: "1940-03-01", deathDate: "2012-08-16", summary: "一生敦亲睦族,参与整理家族旧谱。" },
102: { id: 102, name: "汤正国", generation: 13, generationName: "正字辈", branch: "长房", birthDate: "1965-05-12", deathDate: "", summary: "负责长房资料核对。" },
103: { id: 103, name: "汤正华", generation: 13, generationName: "正字辈", branch: "二房", birthDate: "1968-09-03", deathDate: "", summary: "资料仍在补充。" },
};
const fallbackMember = { id: "", name: "当前成员", generation: "待确认", generationName: "", branch: "待确认", birthDate: "", deathDate: "", summary: "" };
const originalMember = ref({ ...fallbackMember });
const originalMember = ref(null);
const baseline = ref("");
const editForm = reactive({ name: "", generationName: "", birthDate: "", deathDate: "", summary: "" });
const fieldErrors = reactive({ name: "", dates: "" });
const formSnapshot = computed(() => JSON.stringify(editForm));
const hasValidContext = computed(() =>
Boolean(genealogyId.value && personId.value && originalMember.value),
);
const isDirty = computed(
() => editState.value === "form" && baseline.value && formSnapshot.value !== baseline.value,
() =>
(editState.value === "form" || editState.value === "preview") &&
Boolean(baseline.value) &&
formSnapshot.value !== baseline.value,
);
const resultCopy = computed(() => ({
success: { eyebrow: "成员资料已更新", title: `${editForm.name}档案已保存`, copy: "返回成员档案后可以查看本次修改。", action: "返回成员档案" },
error: { eyebrow: "资料未保存", title: "暂时无法保存成员档案", copy: "当前修改仍保留,可返回表单后重试。", action: "返回修改" },
preview: { eyebrow: "本地流程预览", title: `${editForm.name}资料已通过本地校验`, copy: "尚未提交服务器,返回成员档案后不会显示本次修改。", action: "返回成员档案(不保存)" },
error: hasValidContext.value
? { eyebrow: "资料未保存", title: "暂时无法保存成员档案", copy: "当前修改仍保留,可返回表单后重试。", action: "返回修改" }
: { eyebrow: "成员入口无效", title: "没有找到要编辑的成员", copy: "请从成员档案重新进入,页面不会创建临时成员身份。", action: "返回上一页" },
"no-permission": { eyebrow: "权限不足", title: "当前账号不能编辑这位成员", copy: "本人或具备成员维护权限的家谱管理员才能修改档案。", action: "返回成员档案" },
}[editState.value] || {}));
const discardConfirmation = createDiscardConfirmation((visible) => {
discardDialogVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
const loadMember = (id) => {
const member = memberFixtures[id] || { ...fallbackMember, id, name: "待核实成员" };
const member = findTreeMemberPresentationFixture(genealogyId.value, id);
if (!member) return false;
originalMember.value = { ...member };
Object.assign(editForm, {
name: member.name,
generationName: member.generationName,
birthDate: member.birthDate,
deathDate: member.deathDate,
summary: member.summary,
});
if (["privacy", "forbidden"].includes(member.status)) {
Object.assign(editForm, {
name: member.name,
generationName: "",
birthDate: "",
deathDate: "",
summary: "",
});
} else {
Object.assign(editForm, {
name: member.name,
generationName: member.generationName || "",
birthDate: member.birthDate || "",
deathDate: member.deathDate || "",
summary: member.summary || "",
});
}
baseline.value = formSnapshot.value;
return true;
};
onLoad((query) => {
genealogyId.value = query.genealogyId || genealogyContext.getCurrentGenealogyId() || "";
personId.value = query.personId || "";
if (genealogyId.value) genealogyContext.setCurrentGenealogyId(genealogyId.value);
loadMember(personId.value);
editState.value = query.state === "success" ? "success" : query.state === "error" ? "error" : query.state === "no-permission" ? "no-permission" : !personId.value ? "error" : "form";
genealogyId.value = String(query.genealogyId || "");
personId.value = String(query.personId || "");
const loaded = Boolean(genealogyId.value && personId.value) && loadMember(personId.value);
editState.value = !loaded
? "error"
: ["privacy", "forbidden"].includes(originalMember.value.status)
? "no-permission"
: query.state === "preview"
? "preview"
: query.state === "error"
? "error"
: "form";
});
onUnload(() => { if (submitTimer) clearTimeout(submitTimer); });
onBackPress(() => {
if (discardDialogVisible.value) { discardDialogVisible.value = false; return true; }
if (isDirty.value) { discardDialogVisible.value = true; return true; }
return false;
onUnload(() => {
const timer = submitTimer;
submitTimer = null;
if (timer) clearTimeout(timer);
discardConfirmation.dispose();
});
const requestBack = () =>
runBackGuard({
transientOpen: discardDialogVisible.value,
dirty: isDirty.value,
submitting: isSubmitting.value,
"close-transient": cancelDiscard,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
onBackPress((event) => handleBackPress(event, requestBack));
const clearError = (field) => { fieldErrors[field] = ""; };
const selectDate = (field, event) => {
editForm[field] = event.detail.value || "";
@@ -150,21 +195,29 @@ const validateEditForm = () => {
};
const saveMember = () => {
if (isSubmitting.value || !validateEditForm()) return;
const submitSnapshot = Object.freeze({ ...editForm });
isSubmitting.value = true;
submitTimer = setTimeout(() => {
editState.value = editForm.name.trim() === "失败" ? "error" : "success";
if (editState.value === "success") baseline.value = formSnapshot.value;
const timer = setTimeout(() => {
if (submitTimer !== timer) return;
editState.value = submitSnapshot.name.trim() === "失败" ? "error" : "preview";
isSubmitting.value = false;
submitTimer = null;
}, 280);
submitTimer = timer;
};
const returnToMember = async () => {
const confirmed = isDirty.value
? await requestDiscardConfirmation()
: true;
if (!confirmed) return false;
return goBack();
};
const handleResultAction = () => {
if (editState.value === "error") { editState.value = "form"; return; }
uni.navigateBack();
};
const discardAndBack = () => {
discardDialogVisible.value = false;
uni.navigateBack();
if (editState.value === "error" && hasValidContext.value) {
editState.value = "form";
return;
}
return returnToMember();
};
</script>
+105 -31
View File
@@ -4,13 +4,13 @@
class="relationship-page"
:class="{
'relationship-state--form': relationshipState === 'form',
'relationship-state--success': relationshipState === 'success',
'relationship-state--preview': relationshipState === 'preview',
'relationship-state--conflict': relationshipState === 'conflict',
'relationship-state--error': relationshipState === 'error',
}"
>
<ModulePageBackground module="tree" />
<view class="relationship-page__header"><PageHeader title="关系维护" /></view>
<view class="relationship-page__header"><PageHeader title="关系维护" custom-back @back="requestBack" /></view>
<view class="relationship-panel">
<view v-if="relationshipState === 'form'" class="relationship-form">
<text class="form-eyebrow">亲属关系校正</text>
@@ -40,7 +40,7 @@
<text class="form-note">父母子女关系会改变世系位置配偶和兄弟姐妹关系不会自动改写现有父母</text>
<view class="form-action" @click="saveRelationship">
<image src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png" mode="scaleToFill" />
<text>{{ isSubmitting ? "正在校验…" : "校验并保存关系" }}</text>
<text>{{ isSubmitting ? "正在校验…" : "生成本地预览" }}</text>
</view>
</view>
@@ -58,7 +58,7 @@
</view>
<view v-else class="form-action" @click="handleResultAction">
<image src="/static/assets/foundation/transparent/a01-scroll-primary-v3.png" mode="scaleToFill" />
<text>{{ relationshipState === "success" ? "返回世系树" : "重新选择" }}</text>
<text>{{ relationshipState === "preview" ? "返回世系树(不保存)" : hasValidContext ? "重新选择" : "返回上一页" }}</text>
</view>
</view>
</view>
@@ -68,42 +68,60 @@
eyebrow="关系校验规则"
title="为什么不能保存这段关系"
:message="conflictReason || '同一成员不能成为自己的亲属,也不能形成上下代循环或重复父母关系。'"
:close-on-mask="false"
@confirm="conflictDialogVisible = false"
@close="conflictDialogVisible = false"
/>
<AppDialog
:visible="discardDialogVisible"
eyebrow="关系尚未保存"
title="要放弃本次关系调整吗"
message="当前关系只在本页预览,确认返回后不会修改世系。"
cancel-text="继续核对"
confirm-text="放弃并返回"
show-cancel
:close-on-mask="false"
@cancel="cancelDiscard"
@confirm="confirmDiscard"
/>
</view>
</template>
<script setup>
import { computed, reactive, ref } from "vue";
import { onLoad, onUnload } from "@dcloudio/uni-app";
import { onBackPress, onLoad, onUnload } from "@dcloudio/uni-app";
import AppDialog from "@/components/AppDialog.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { genealogyContext } from "@/utils/genealogy-context.js";
import { listTreeMemberFixtures } from "@/data/mock.js";
import { createDiscardConfirmation } from "@/utils/discard-confirmation.js";
import {
goBack,
handleBackPress,
returnTo,
runBackGuard,
} from "@/utils/navigation.js";
const relationshipState = ref("form");
const genealogyId = ref("");
const personId = ref("");
const isSubmitting = ref(false);
const conflictDialogVisible = ref(false);
const discardDialogVisible = ref(false);
const conflictReason = ref("");
let submitTimer = null;
const memberOptions = [
{ id: "101", name: "汤文远", generation: 12, parentId: "" },
{ id: "102", name: "汤正国", generation: 13, parentId: "101" },
{ id: "103", name: "汤正华", generation: 13, parentId: "101" },
{ id: "104", name: "汤凯", generation: 14, parentId: "102" },
{ id: "105", name: "汤悦", generation: 14, parentId: "102" },
];
const memberOptions = computed(() => listTreeMemberFixtures(genealogyId.value));
const relationshipOptions = ["父子(当前成员为父)", "父女(当前成员为父)", "母子(当前成员为母)", "母女(当前成员为母)", "配偶", "兄弟姐妹"];
const relationshipForm = reactive({ sourceId: "", targetId: "", relationship: "" });
const fieldErrors = reactive({ sourceId: "", targetId: "", relationship: "" });
const memberLabels = computed(() => memberOptions.map((item) => `${item.name} · 第 ${item.generation}`));
const memberById = computed(() => new Map(memberOptions.map((item) => [item.id, item])));
const sourceIndex = computed(() => Math.max(0, memberOptions.findIndex((item) => item.id === relationshipForm.sourceId)));
const targetIndex = computed(() => Math.max(0, memberOptions.findIndex((item) => item.id === relationshipForm.targetId)));
const baseline = ref("");
const memberLabels = computed(() => memberOptions.value.map((item) => `${item.name} · 第 ${item.generation}`));
const memberById = computed(() => new Map(memberOptions.value.map((item) => [item.id, item])));
const hasValidContext = computed(() =>
Boolean(genealogyId.value && memberById.value.has(personId.value)),
);
const sourceIndex = computed(() => Math.max(0, memberOptions.value.findIndex((item) => item.id === relationshipForm.sourceId)));
const targetIndex = computed(() => Math.max(0, memberOptions.value.findIndex((item) => item.id === relationshipForm.targetId)));
const relationshipIndex = computed(() => Math.max(0, relationshipOptions.indexOf(relationshipForm.relationship)));
const memberName = (id) => memberById.value.get(String(id))?.name || "";
const relationshipPreview = computed(
@@ -111,25 +129,67 @@ const relationshipPreview = computed(
? `${memberName(relationshipForm.sourceId)}将以“${relationshipForm.relationship}”关联${memberName(relationshipForm.targetId)}`
: "完成三项选择后,这里会说明世系位置将如何变化。",
);
const formSnapshot = computed(() => JSON.stringify(relationshipForm));
const isDirty = computed(() =>
Boolean(baseline.value) && formSnapshot.value !== baseline.value,
);
const resultCopy = computed(() => ({
success: { eyebrow: "关系已保存", title: "世系关系已经更新", copy: relationshipPreview.value },
preview: { eyebrow: "本地流程预览", title: "关系校验已经通过", copy: `${relationshipPreview.value} 尚未提交服务器,返回后世系不会变化。` },
conflict: { eyebrow: "发现关系冲突", title: "这段关系会造成世系矛盾", copy: conflictReason.value },
error: { eyebrow: "关系未保存", title: "暂时无法完成关系调整", copy: "当前选择仍然保留,可返回后重新校验。" },
error: hasValidContext.value
? { eyebrow: "关系未保存", title: "暂时无法完成关系调整", copy: "当前选择仍然保留,可返回后重新校验。" }
: { eyebrow: "成员入口无效", title: "没有找到要调整的成员", copy: "请从世系树重新进入,页面不会回退到其他成员。" },
}[relationshipState.value] || {}));
const discardConfirmation = createDiscardConfirmation((visible) => {
discardDialogVisible.value = visible;
});
const requestDiscardConfirmation = discardConfirmation.request;
const confirmDiscard = discardConfirmation.confirm;
const cancelDiscard = discardConfirmation.cancel;
onLoad((query) => {
genealogyId.value = query.genealogyId || genealogyContext.getCurrentGenealogyId() || "";
personId.value = query.personId || "";
relationshipForm.sourceId = personId.value && memberById.value.has(String(personId.value)) ? String(personId.value) : memberOptions[0].id;
if (genealogyId.value) genealogyContext.setCurrentGenealogyId(genealogyId.value);
relationshipState.value = query.state === "success" ? "success" : query.state === "conflict" ? "conflict" : query.state === "error" ? "error" : "form";
genealogyId.value = String(query.genealogyId || "");
personId.value = String(query.personId || "");
relationshipForm.sourceId = hasValidContext.value ? personId.value : "";
baseline.value = formSnapshot.value;
relationshipState.value = !hasValidContext.value || query.state === "error"
? "error"
: query.state === "preview"
? "preview"
: query.state === "conflict"
? "conflict"
: "form";
if (relationshipState.value === "conflict") conflictReason.value = "目标成员已经存在父级关系,请先核对原关系。";
});
onUnload(() => { if (submitTimer) clearTimeout(submitTimer); });
onUnload(() => {
const timer = submitTimer;
submitTimer = null;
if (timer) clearTimeout(timer);
discardConfirmation.dispose();
});
const closeTransient = () => {
if (conflictDialogVisible.value) {
conflictDialogVisible.value = false;
return;
}
cancelDiscard();
};
const requestBack = () =>
runBackGuard({
transientOpen: conflictDialogVisible.value || discardDialogVisible.value,
dirty: isDirty.value,
submitting: isSubmitting.value,
"close-transient": closeTransient,
"block-submitting": () => true,
"confirm-discard": requestDiscardConfirmation,
});
onBackPress((event) => handleBackPress(event, requestBack));
const clearFieldError = (field) => { fieldErrors[field] = ""; };
const selectMember = (field, event) => {
relationshipForm[field] = memberOptions[Number(event.detail.value)]?.id || "";
relationshipForm[field] = memberOptions.value[Number(event.detail.value)]?.id || "";
clearFieldError(field);
};
const selectRelationship = (event) => {
@@ -174,16 +234,30 @@ const saveRelationship = () => {
if (conflictReason.value) relationshipState.value = "conflict";
return;
}
const submitSnapshot = Object.freeze({ ...relationshipForm });
isSubmitting.value = true;
submitTimer = setTimeout(() => {
relationshipState.value = relationshipForm.relationship === "失败" ? "error" : "success";
const timer = setTimeout(() => {
if (submitTimer !== timer) return;
relationshipState.value = submitSnapshot.relationship === "失败" ? "error" : "preview";
isSubmitting.value = false;
submitTimer = null;
}, 280);
submitTimer = timer;
};
const returnToTree = async () => {
const confirmed = isDirty.value
? await requestDiscardConfirmation()
: true;
if (!confirmed) return false;
return returnTo("T01", { genealogyId: genealogyId.value });
};
const handleResultAction = () => {
if (relationshipState.value === "error") { relationshipState.value = "form"; return; }
uni.navigateBack();
if (relationshipState.value === "error") {
if (!hasValidContext.value) return goBack();
relationshipState.value = "form";
return;
}
return returnToTree();
};
</script>
+34 -44
View File
@@ -11,7 +11,7 @@
>
<ModulePageBackground module="tree" />
<view class="directory-page__header"><PageHeader title="成员目录" /></view>
<view class="directory-context">
<view v-if="hasValidContext" class="directory-context">
<text class="directory-context__name">汤氏家谱</text>
<text class="directory-context__meta"
>主支 · {{ members.length }} 位成员</text
@@ -24,7 +24,7 @@
<input
v-model="keyword"
aria-label="成员搜索关键词"
placeholder="按姓名、字辈或支系查找"
placeholder="按姓名、身份或世代查找"
placeholder-class="directory-placeholder"
@confirm="searchMembers"
/>
@@ -56,11 +56,8 @@
>
<view class="directory-card__copy">
<text class="directory-card__name">{{ item.name }}</text>
<text class="directory-card__meta"
> {{ item.generation }} · {{ item.generationName }} ·
{{ item.branch }}</text
>
<text class="directory-card__status">{{ item.note }}</text>
<text class="directory-card__meta">{{ memberMeta(item) }}</text>
<text class="directory-card__status">{{ memberStatus(item) }}</text>
</view>
</view>
</template>
@@ -71,7 +68,7 @@
}}</text
><text>{{
directoryState === "empty"
? "换一个姓名、字辈或支系关键词再试。"
? "换一个姓名、身份或世代关键词再试。"
: "请从当前家谱重新进入,成员资料不会受到影响。"
}}</text></view
>
@@ -80,7 +77,7 @@
v-if="directoryState === 'error'"
block
type="secondary"
label="重新查看"
:label="hasValidContext ? '重新查看' : '返回上一页'"
@click="retryDirectory"
/>
</view>
@@ -93,63 +90,56 @@ 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 { listTreeMemberPresentationFixtures } from "@/data/mock.js";
import { goBack, openPage } from "@/utils/navigation.js";
const genealogyId = ref("");
const keyword = ref("");
const directoryState = ref("loading");
const members = [
{
id: 101,
name: "汤文远",
generation: 12,
generationName: "文字辈",
branch: "主支",
note: "始祖 · 档案完整",
},
{
id: 102,
name: "汤正国",
generation: 13,
generationName: "正字辈",
branch: "长房",
note: "家谱管理员",
},
{
id: 103,
name: "汤正华",
generation: 13,
generationName: "正字辈",
branch: "二房",
note: "资料待补充",
},
];
const hasValidContext = computed(() => Boolean(genealogyId.value));
const members = computed(() => listTreeMemberPresentationFixtures(genealogyId.value));
const isRestrictedMember = (member) =>
["privacy", "forbidden"].includes(member.status);
const memberMeta = (member) =>
isRestrictedMember(member)
? `${member.generation} 世 · ${member.relation}`
: `${member.generation} 世 · ${member.generationName} · ${member.branch}`;
const memberStatus = (member) =>
isRestrictedMember(member)
? member.status === "forbidden"
? "访问受限"
: "隐私资料"
: member.note;
const filteredMembers = computed(() => {
const value = keyword.value.trim();
if (!value) return members;
return members.filter((item) =>
`${item.name}${item.generationName}${item.branch}`.includes(value),
if (!value) return members.value;
return members.value.filter((item) =>
`${item.name}${item.relation}${item.generation}${item.generationName || ""}${item.branch || ""}`.includes(value),
);
});
onLoad((query) => {
genealogyId.value = query.genealogyId || "";
genealogyId.value = String(query.genealogyId || "");
directoryState.value =
query.state === "loading"
!hasValidContext.value ? "error" : query.state === "loading"
? "loading"
: query.state === "empty"
? "empty"
: query.state === "error"
? "error"
: "list";
: members.value.length
? "list"
: "empty";
});
const searchMembers = () => {
directoryState.value = filteredMembers.value.length ? "list" : "empty";
};
const retryDirectory = () => {
if (!hasValidContext.value) return goBack();
directoryState.value = "list";
};
const openMember = (item) =>
uni.navigateTo({
url: `/pages/tree/t03-member-profile?genealogyId=${genealogyId.value}&personId=${item.id}`,
});
hasValidContext.value
? openPage("T03", { genealogyId: genealogyId.value, personId: String(item.id) }, "T07")
: Promise.resolve(false);
</script>
<style scoped lang="scss">
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
+24 -17
View File
@@ -12,9 +12,9 @@
<ModulePageBackground module="tree" />
<view class="member-status-page__header"><PageHeader :title="pageTitle" /></view>
<view class="member-status-context">
<view v-if="hasValidContext" class="member-status-context">
<text>{{ genealogyName }}</text>
<text v-if="member">{{ member.name }} · {{ member.generation }} · {{ member.branch }}</text>
<text v-if="member">{{ memberIdentityCopy }}</text>
<text v-else>未找到成员身份</text>
</view>
@@ -45,7 +45,8 @@ import { computed, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
import { genealogyContext } from "@/utils/genealogy-context.js";
import { findTreeMemberPresentationFixture } from "@/data/mock.js";
import { goBack, goRoot } from "@/utils/navigation.js";
const genealogyId = ref("");
const personId = ref("");
@@ -53,18 +54,13 @@ const statusState = ref("loading");
const genealogyName = ref("汤氏家谱");
const member = ref(null);
const memberFixtures = {
101: { id: 101, name: "汤文远", generation: 12, branch: "主支", allowedStates: ["deceased"] },
102: { id: 102, name: "汤正国", generation: 13, branch: "长房", allowedStates: ["privacy"] },
103: { id: 103, name: "汤正华", generation: 13, branch: "二房", allowedStates: ["forbidden"] },
};
const states = {
privacy: {
eyebrow: "隐私成员",
title: "敏感资料只向授权成员展示",
copy: "该成员姓名和世系位置仍然保留,出生信息、联系方式和生平内容按权限隐藏。",
guideTitle: "当前可见范围",
guides: ["姓名、世代与所属支系可见", "联系方式和详细生平已隐藏", "本人或谱主可维护授权范围"],
guides: ["姓名、世代与家族关系可见", "联系方式和详细生平已隐藏", "本人或谱主可维护授权范围"],
action: "返回成员档案",
},
deceased: {
@@ -94,22 +90,33 @@ const states = {
};
const activeStatus = computed(() => states[statusState.value] || states.error);
const pageTitle = computed(() => statusState.value === "deceased" ? "成员纪念" : statusState.value === "privacy" ? "隐私资料" : "成员状态");
const hasValidContext = computed(() => Boolean(genealogyId.value && personId.value));
const memberIdentityCopy = computed(() => {
if (!member.value) return "";
const identity = `${member.value.name} · 第 ${member.value.generation}`;
return ["privacy", "forbidden"].includes(member.value.status)
? `${identity} · ${member.value.relation}`
: `${identity} · ${member.value.branch}`;
});
onLoad((query) => {
genealogyId.value = query.genealogyId || genealogyContext.getCurrentGenealogyId() || "";
personId.value = query.personId || "";
if (genealogyId.value) genealogyContext.setCurrentGenealogyId(genealogyId.value);
member.value = memberFixtures[personId.value] || null;
genealogyId.value = String(query.genealogyId || "");
personId.value = String(query.personId || "");
member.value = hasValidContext.value
? findTreeMemberPresentationFixture(genealogyId.value, personId.value)
: null;
const requestedState = ["privacy", "deceased", "forbidden"].includes(query.state) ? query.state : "";
statusState.value = member.value?.allowedStates.includes(requestedState) ? requestedState : "error";
const derivedState = member.value?.status || "";
statusState.value = member.value && (!requestedState || requestedState === derivedState)
? requestedState || derivedState
: "error";
});
const handleAction = () => {
if (statusState.value === "forbidden") {
uni.reLaunch({ url: "/pages/genealogy/g01-my-genealogies" });
return;
return goRoot("G01");
}
uni.navigateBack();
return goBack();
};
</script>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

+7
View File
@@ -0,0 +1,7 @@
#tianai-captcha-parent{box-shadow:0 0 11px 0 #999;width:318px;height:318px;overflow:hidden;position:relative;z-index:997;box-sizing:border-box;border-radius:5px;padding:8px}#tianai-captcha-parent #tianai-captcha-box{height:260px;width:100%;position:relative;overflow:hidden}#tianai-captcha-parent #tianai-captcha-box .loading{width:120px;height:20px;-webkit-mask:linear-gradient(90deg, #000 70%, rgba(0, 0, 0, 0) 0) 0/20%;background:linear-gradient(#f7b645 0 0) 0/0% no-repeat rgba(221,221,221,.4196078431);animation:cartoon 1s infinite steps(6);margin:120px auto}@keyframes cartoon{100%{background-size:120%}}#tianai-captcha-parent #tianai-captcha-box #tianai-captcha{transform-style:preserve-3d;will-change:transform;transition-duration:.45s;transform:translateX(-300px)}#tianai-captcha-parent #tianai-captcha-bg-img{background-color:#fff;background-position:top;background-size:cover;z-index:-1;width:100%;height:100%;top:0;left:0;position:absolute;border-radius:6px}#tianai-captcha-parent .slider-bottom{height:19px;width:100%}#tianai-captcha-parent .slider-bottom .close-btn{width:20px;height:20px;background-image:url(../../tac/images/icon.png);background-repeat:no-repeat;background-position:0 -14px;float:right;margin-right:2px;cursor:pointer}#tianai-captcha-parent .slider-bottom .refresh-btn{width:20px;height:20px;background-image:url(../../tac/images/icon.png);background-position:0 -167px;background-repeat:no-repeat;float:right;margin-right:10px;cursor:pointer}#tianai-captcha-parent .slider-bottom .logo{height:30px;float:left}#tianai-captcha-parent .slider-move-shadow{animation:myanimation 2s infinite;height:100%;width:5px;background-color:#fff;position:absolute;top:0;left:0;filter:opacity(0.5);box-shadow:1px 1px 1px #fff;border-radius:50%}#tianai-captcha-parent #tianai-captcha-slider-move-track-mask{border-width:1px;border-style:solid;border-color:#00f4ab;width:0;height:32px;background-color:#a9ffe5;opacity:.5;position:absolute;top:-1px;left:-1px;border-radius:5px}
#tianai-captcha{text-align:left;box-sizing:content-box;width:300px;height:260px;z-index:999}#tianai-captcha .slider-bottom .logo{height:30px}#tianai-captcha .slider-bottom{height:19px;width:100%}#tianai-captcha .content .tianai-captcha-tips{height:25px;width:100%;position:absolute;bottom:-25px;left:0;z-index:999;font-size:15px;line-height:25px;color:#fff;text-align:center;transition:bottom .3s ease-in-out}#tianai-captcha .content .tianai-captcha-tips.tianai-captcha-tips-error{background-color:#ff5d39}#tianai-captcha .content .tianai-captcha-tips.tianai-captcha-tips-success{background-color:#39c522}#tianai-captcha .content .tianai-captcha-tips.tianai-captcha-tips-on{bottom:0}#tianai-captcha .content #tianai-captcha-loading{z-index:9999;background-color:#f5f5f5;text-align:center;height:100%;overflow:hidden;position:relative;display:flex;justify-content:center;align-items:center}#tianai-captcha .content #tianai-captcha-loading img{display:block;width:45px;height:45px}#tianai-captcha #tianai-captcha-slider-bg-canvas{position:absolute;left:0;top:0;width:100%;height:100%;border-radius:5px}#tianai-captcha #tianai-captcha-slider-bg-div{position:absolute;left:0;top:0;width:100%;height:100%;border-radius:5px}#tianai-captcha #tianai-captcha-slider-bg-div .tianai-captcha-slider-bg-div-slice{position:absolute}@keyframes myanimation{from{left:0}to{left:289px}}
#tianai-captcha.tianai-captcha-slider{z-index:999;position:absolute;left:0;top:0;user-select:none}#tianai-captcha.tianai-captcha-slider .content{width:100%;height:180px;position:relative;overflow:hidden}#tianai-captcha.tianai-captcha-slider .bg-img-div{width:100%;height:100%;position:absolute;transform:translate(0px, 0px)}#tianai-captcha.tianai-captcha-slider .bg-img-div img{height:100%;width:100%;border-radius:5px}#tianai-captcha.tianai-captcha-slider .slider-img-div{height:100%;position:absolute;left:0;transform:translate(0px, 0px)}#tianai-captcha.tianai-captcha-slider .slider-img-div #tianai-captcha-slider-move-img{height:100%}#tianai-captcha.tianai-captcha-slider .slider-move{height:34px;width:100%;margin:11px 0;position:relative}#tianai-captcha.tianai-captcha-slider .slider-move-track{position:relative;height:32px;line-height:32px;text-align:center;background:#f5f5f5;color:#999;transition:0s;font-size:14px;box-sizing:content-box;border:1px solid #f5f5f5;border-radius:4px}#tianai-captcha.tianai-captcha-slider .refresh-btn,#tianai-captcha.tianai-captcha-slider .close-btn{display:inline-block}#tianai-captcha.tianai-captcha-slider .slider-move{line-height:38px;font-size:14px;text-align:center;white-space:nowrap;color:#88949d;-moz-user-select:none;-webkit-user-select:none;user-select:none;filter:opacity(0.8)}#tianai-captcha.tianai-captcha-slider .slider-move .slider-move-btn{transform:translate(0px, 0px);position:absolute;top:-6px;left:0;width:63px;height:45px;background-color:#fff;background-repeat:no-repeat;background-size:contain;border-radius:5px}#tianai-captcha.tianai-captcha-slider .slider-tip{margin-bottom:5px;font-weight:bold;font-size:15px;line-height:normal;color:#000}#tianai-captcha.tianai-captcha-slider .slider-move-btn:hover{cursor:pointer}
#tianai-captcha.tianai-captcha-rotate .rotate-img-div{height:100%;text-align:center}#tianai-captcha.tianai-captcha-rotate .rotate-img-div img{height:100%;transform:rotate(0deg);display:inline-block}
#tianai-captcha.tianai-captcha-concat .tianai-captcha-slider-concat-img-div{background-size:100% 180px;position:absolute;transform:translate(0px, 0px);z-index:1;width:100%}#tianai-captcha.tianai-captcha-concat .tianai-captcha-slider-concat-bg-img{width:100%;height:100%;position:absolute;transform:translate(0px, 0px);background-size:100% 180px}
#tianai-captcha.tianai-captcha-disable{z-index:999;position:absolute;left:0;top:0}#tianai-captcha.tianai-captcha-disable .content{width:100%;height:180px;position:relative;overflow:hidden}#tianai-captcha.tianai-captcha-disable .content .bg-img-div{background-image:url(../../tac/images/dun.jpeg);width:100%;height:100%;overflow:hidden}#tianai-captcha.tianai-captcha-disable .content .bg-img-div #content-span{color:#fff;overflow:hidden;margin-top:132px;display:block;text-align:center}
#tianai-captcha.tianai-captcha-word-click{box-sizing:border-box}#tianai-captcha.tianai-captcha-word-click .click-tip{position:relative;height:40px;width:100%}#tianai-captcha.tianai-captcha-word-click .click-tip .tip-img{height:35px;position:absolute;right:15px}#tianai-captcha.tianai-captcha-word-click .click-tip #tianai-captcha-click-track-font{font-size:18px;display:inline-block;height:40px;line-height:40px;position:absolute}#tianai-captcha.tianai-captcha-word-click .slider-bottom{position:relative;top:6px}#tianai-captcha.tianai-captcha-word-click .content #bg-img-click-mask{width:100%;height:100%;position:absolute;left:0;top:0}#tianai-captcha.tianai-captcha-word-click .content #bg-img-click-mask .click-span{position:absolute;left:0;top:0;border-radius:50px;background-color:#409eff;width:20px;height:20px;text-align:center;line-height:20px;color:#fff;border:2px solid #fff;box-sizing:content-box}#tianai-captcha.tianai-captcha-word-click .click-confirm-btn{width:100%;height:35px;border-radius:4px;background-image:linear-gradient(173deg, hsl(38.09, 91%, 57.89%) 0%, hsl(38.09, 89.38%, 71.74%) 100%);font-size:15px;text-align:center;box-sizing:border-box;line-height:35px;color:#fff;margin-top:3px}#tianai-captcha.tianai-captcha-word-click .click-confirm-btn:hover{cursor:pointer}
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

+164
View File
@@ -0,0 +1,164 @@
(function attachJiapuTacAdapter(global) {
"use strict";
var SUPPORTED_TYPES = ["SLIDER", "ROTATE", "CONCAT", "WORD_IMAGE_CLICK"];
function fail(message, code) {
var error = new Error(message);
error.code = code || "TAC_PROTOCOL_INVALID";
throw error;
}
function text(value, label) {
if (typeof value !== "string" || !value.trim()) fail(label + "不能为空");
return value.trim();
}
function positiveInteger(value, label) {
var number = Number(value);
if (!Number.isInteger(number) || number < 1) fail(label + "必须是正整数");
return number;
}
function assertContext(context) {
if (!context || typeof context !== "object") fail("TAC 请求上下文无效");
return {
tenantId: text(context.tenantId, "租户标识"),
clientId: text(context.clientId, "客户端标识"),
sceneCode: text(context.sceneCode, "验证场景"),
subject: text(context.subject, "验证主体"),
providerCode: text(context.providerCode, "验证服务商").toUpperCase(),
captchaType: text(context.captchaType, "验证码类型").toUpperCase(),
};
}
function assertChallengePayload(type, payload) {
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
fail("行为验证挑战缺少渲染载荷");
}
if (type === "CONCAT") {
text(payload.backgroundImage, "拼图背景图片");
positiveInteger(payload.backgroundImageHeight, "拼图背景高度");
if (!payload.data || !Number.isFinite(Number(payload.data.randomY))) {
fail("拼图挑战缺少 randomY");
}
return;
}
text(payload.backgroundImage, "行为验证背景图片");
text(payload.templateImage, "行为验证模板图片");
}
function normalizeChallengeResponse(response, expectedContext) {
var context = assertContext(expectedContext);
if (!response || typeof response !== "object" || Number(response.code) !== 200) {
fail((response && response.msg) || "行为验证挑战请求失败", "TAC_CHALLENGE_FAILED");
}
var data = response.data;
if (!data || typeof data !== "object" || data.required !== true) {
fail("行为验证挑战未处于强制验证状态", "TAC_CHALLENGE_NOT_REQUIRED");
}
var providerCode = text(data.providerCode, "挑战服务商").toUpperCase();
var captchaType = text(data.captchaType, "挑战验证码类型").toUpperCase();
if (providerCode !== "TIANAI" || providerCode !== context.providerCode) {
fail("行为验证挑战服务商不匹配", "TAC_PROVIDER_MISMATCH");
}
if (SUPPORTED_TYPES.indexOf(captchaType) < 0 || captchaType !== context.captchaType) {
fail("行为验证挑战类型不匹配", "TAC_TYPE_MISMATCH");
}
var challengeId = text(data.challengeId, "行为验证挑战标识");
var expireSeconds = positiveInteger(data.expireSeconds, "行为验证挑战有效期");
assertChallengePayload(captchaType, data.payload);
return {
challenge: {
required: true,
providerCode: providerCode,
captchaType: captchaType,
challengeId: challengeId,
expireSeconds: expireSeconds,
},
sdkResponse: {
code: 200,
msg: typeof response.msg === "string" ? response.msg : "操作成功",
data: Object.assign({}, data.payload, {
type: captchaType,
id: challengeId,
}),
},
};
}
function assertTrack(track) {
if (!track || typeof track !== "object" || Array.isArray(track)) fail("行为验证轨迹无效");
positiveInteger(track.bgImageWidth, "轨迹背景宽度");
positiveInteger(track.bgImageHeight, "轨迹背景高度");
var startTime = Number(track.startTime);
var stopTime = Number(track.stopTime);
if (!Number.isFinite(startTime) || !Number.isFinite(stopTime) || stopTime < startTime) {
fail("行为验证轨迹时间无效");
}
if (!Array.isArray(track.trackList) || track.trackList.length < 1) {
fail("行为验证轨迹不能为空");
}
track.trackList.forEach(function validatePoint(point) {
if (!point || !Number.isFinite(Number(point.x)) || !Number.isFinite(Number(point.y)) ||
!Number.isFinite(Number(point.t)) || typeof point.type !== "string" || !point.type) {
fail("行为验证轨迹点无效");
}
});
return track;
}
function buildVerifyBody(libraryRequest, expectedContext, challenge) {
var context = assertContext(expectedContext);
if (!challenge || typeof challenge !== "object") fail("行为验证挑战上下文缺失");
var challengeId = text(challenge.challengeId, "行为验证挑战标识");
if (!libraryRequest || libraryRequest.id !== challengeId) {
fail("行为验证 challenge 标识与当前挑战不匹配", "TAC_CHALLENGE_MISMATCH");
}
if (challenge.providerCode !== context.providerCode || challenge.captchaType !== context.captchaType) {
fail("行为验证挑战上下文已变化", "TAC_CONTEXT_MISMATCH");
}
return {
tenantId: context.tenantId,
clientId: context.clientId,
sceneCode: context.sceneCode,
subject: context.subject,
challengeId: challengeId,
providerCode: challenge.providerCode,
captchaType: challenge.captchaType,
// 受保护 OpenAPI 的唯一合同是 payload.trackSDK 回调 id 已提升为 challengeId
// 不得再次混入 payload,也不得退回“直接传 track”的兼容分支。
payload: { track: assertTrack(libraryRequest.data) },
};
}
function normalizeVerifyResponse(response) {
if (!response || typeof response !== "object" || Number(response.code) !== 200) {
fail((response && response.msg) || "行为验证请求失败", "TAC_VERIFY_REQUEST_FAILED");
}
var data = response.data;
if (!data || data.passed !== true) {
fail((data && data.message) || "行为验证未通过", "TAC_VERIFY_REJECTED");
}
var validToken = text(data.validToken, "行为验证票据");
var expireSeconds = positiveInteger(data.expireSeconds, "行为验证票据有效期");
return {
code: 200,
data: { passed: true, validToken: validToken, expireSeconds: expireSeconds },
};
}
function toSdkFailure(error) {
return {
code: 4001,
msg: error && error.message ? error.message : "行为验证失败,请重试",
};
}
global.JiapuTacAdapter = Object.freeze({
normalizeChallengeResponse: normalizeChallengeResponse,
buildVerifyBody: buildVerifyBody,
normalizeVerifyResponse: normalizeVerifyResponse,
toSdkFailure: toSdkFailure,
});
})(typeof window !== "undefined" ? window : globalThis);
+1
View File
File diff suppressed because one or more lines are too long
-22
View File
@@ -25,28 +25,6 @@
}
}
@mixin adaptive-module-content {
box-sizing: border-box;
border-width: 1px;
border-style: solid;
border-color: transparent;
border-image-source: var(--module-content-asset);
border-image-slice: 105 150;
border-image-width: 18rpx 20rpx;
border-image-repeat: stretch;
}
@mixin adaptive-module-field {
box-sizing: border-box;
border-width: 1px;
border-style: solid;
border-color: transparent;
border-image-source: var(--module-field-asset);
border-image-slice: 70 100 fill;
border-image-width: 12rpx 16rpx;
border-image-repeat: stretch;
}
@mixin adaptive-feedback-toast {
box-sizing: border-box;
border-width: 16rpx 74rpx;
+28
View File
@@ -71,3 +71,31 @@ view:not(.page-header-slot):has(> .page-header-slot) {
font-size: 29rpx;
font-weight: 600;
}
// 认证页的视觉由现有卷轴与文字类负责这里是原生 button 的唯一重置 owner
// 保留可见焦点环 H5 键盘用户能确认当前位置同时不改动 App 触摸态
.auth-plain-button {
box-sizing: border-box;
margin: 0;
padding: 0;
border: 0;
border-radius: 0;
background: transparent;
color: inherit;
font: inherit;
line-height: normal;
}
.auth-plain-button::after {
border: 0;
}
.auth-plain-button:focus-visible {
outline: 2px solid #9f170f;
outline-offset: 2px;
}
.auth-page.auth-page .auth-plain-button {
min-width: 48px;
min-height: 48px;
}
+13 -16
View File
@@ -220,23 +220,25 @@ $smsCodeCopy = ConvertFrom-Utf8Base64 '55+t5L+h6aqM6K+B56CB'
Assert-Contains -Content $entry -Expected $smsCodeCopy -Message 'A01 SMS state must use the full SMS code field label.'
foreach ($contract in @(
'const activeLoginMethod = ref("password")',
'const activeLoginMethod = ref("sms")',
'const passwordVisible = ref(false)',
'const LOGIN_METHOD_STORAGE_KEY = "a01:last-login-method"',
'uni.getStorageSync(LOGIN_METHOD_STORAGE_KEY)',
'uni.setStorageSync(LOGIN_METHOD_STORAGE_KEY, method)',
'login-tab--unavailable',
'aria-disabled="true"',
'const switchLoginMethod = (method) =>',
'const togglePasswordVisibility = () =>',
'/pages/auth/a04-register',
'/pages/auth/a05-reset-password',
'class="feedback-toast"',
'class="verification-layer"',
'class="login-submit"',
'<AppToast :visible="feedbackVisible" :message="feedbackMessage" />',
'<TacVerification',
'AUTH_TAC_SCENE.SMS_LOGIN',
'normalizeTacSuccess',
'appApi.loginWithSms',
'PASSWORD_TAC_BLOCKED_MESSAGE',
'login-submit',
'class="agreement-error"',
'const agreementError = ref(false)'
)) {
Assert-Contains -Content $entry -Expected $contract -Message "A01 is missing state or interaction contract: $contract"
}
Assert-NotContains -Content $entry -Unexpected 'a01:last-login-method' -Message '密码登录后端未闭环前不得恢复为首屏或记忆入口。'
foreach ($nativeUi in @('uni.showToast', 'uni.showModal', 'uni.showLoading', 'uni.showActionSheet')) {
Assert-NotContains -Content $entry -Unexpected $nativeUi -Message "A01 must not use native UniApp feedback: $nativeUi"
@@ -251,11 +253,6 @@ Assert-NotContains -Content $entry -Unexpected 'a01-icon-eye-closed-v1.png' -Mes
Assert-NotContains -Content $entry -Unexpected 'a01-icon-verification-v1.png' -Message 'A01 SMS field must use a message-code icon instead of a success-state checkmark.'
Assert-NotContains -Content $entry -Unexpected 'a01-icon-sms-code-v1.svg' -Message 'A01 SMS field must use the custom generated icon instead of the temporary third-party SVG.'
Assert-NotContains -Content $entry -Unexpected '@media (max-height:' -Message 'A01 must scroll naturally on short screens instead of compressing the selected design with height breakpoints.'
Assert-NotContains -Content $entry -Unexpected 'feedback-toast__skin' -Message 'A01 feedback Toast must use the dedicated nine-slice border asset instead of an absolutely stretched image.'
$feedbackToastRule = [regex]::Match($entry, '(?ms)^\.feedback-toast\s*\{(?<Body>.*?)^\}')
if (-not $feedbackToastRule.Success) {
throw 'A01 is missing the custom feedback Toast style rule.'
}
Assert-Contains -Content $feedbackToastRule.Groups['Body'].Value -Expected '@include adaptive.adaptive-feedback-toast;' -Message 'A01 feedback Toast must consume the approved shared nine-slice profile.'
Assert-Contains -Content $entry -Expected 'import AppToast from "@/components/AppToast.vue";' -Message 'A01 feedback must consume the shared live-region Toast owner.'
Assert-NotContains -Content $entry -Unexpected 'class="feedback-toast"' -Message 'A01 must not duplicate the shared Toast implementation.'
Write-Output 'A01-LOGIN-MERGE-CONTRACT PASS'
+16 -25
View File
@@ -118,10 +118,10 @@ const run = async () => {
assert(metrics.paperTop >= metrics.headerBottom - 1, `A01 paper overlaps the header at ${size.width}x${size.height}`)
assert(metrics.contentTop >= metrics.paperTop, `A01 content escapes paper flow at ${size.width}x${size.height}`)
if (size.width >= 360 && size.height >= 640) {
assert(metrics.rootScrollHeight <= metrics.innerHeight + 1, `A01 password state must fit at ${size.width}x${size.height}`)
assert(metrics.agreementBottom <= metrics.innerHeight + 1, `A01 password agreement must remain visible at ${size.width}x${size.height}`)
assert(metrics.rootScrollHeight <= metrics.innerHeight + 1, `A01 SMS state must fit at ${size.width}x${size.height}`)
assert(metrics.agreementBottom <= metrics.innerHeight + 1, `A01 SMS agreement must remain visible at ${size.width}x${size.height}`)
} else {
assert(metrics.agreementBottom <= metrics.documentScrollHeight + 1, `A01 password agreement must remain reachable at ${size.width}x${size.height}`)
assert(metrics.agreementBottom <= metrics.documentScrollHeight + 1, `A01 SMS agreement must remain reachable at ${size.width}x${size.height}`)
}
const buttonAssets = await valueOf(send, `Array.from(document.querySelectorAll('.button-skin img')).map((image) => ({
@@ -151,12 +151,13 @@ const run = async () => {
assert(smsMetrics.agreementBottom <= smsMetrics.documentScrollHeight + 1, `A01 SMS agreement must remain reachable at ${size.width}x${size.height}`)
}
await valueOf(send, "document.querySelectorAll('.login-tab')[0].click()")
await waitFor(send, "document.querySelectorAll('.login-tab')[0].classList.contains('active')", `A01 password tab did not reactivate at ${size.width}x${size.height}`)
await waitFor(send, "document.querySelector('.app-toast__copy')?.textContent === '密码登录的服务端安全验证尚未开放,请先使用验证码登录'", `A01 password unavailable reason was not announced at ${size.width}x${size.height}`)
assert.strictEqual(await valueOf(send, "document.querySelectorAll('.login-tab')[0].classList.contains('active')"), false, `A01 exposed the unsafe password form at ${size.width}x${size.height}`)
}
await valueOf(send, "document.querySelector('.login-submit').click()")
await waitFor(send, "Boolean(document.querySelector('.feedback-toast'))", 'A01 invalid phone Toast did not render')
const toastBorderImage = await valueOf(send, "getComputedStyle(document.querySelector('.feedback-toast')).borderImageSource")
await waitFor(send, "Boolean(document.querySelector('.app-toast'))", 'A01 invalid phone Toast did not render')
const toastBorderImage = await valueOf(send, "getComputedStyle(document.querySelector('.app-toast')).borderImageSource")
assert(toastBorderImage.includes('a01-scroll-toast-v3.png'), `A01 Toast did not render the v3 nine-slice asset: ${toastBorderImage}`)
await valueOf(send, "document.querySelectorAll('.login-tab')[1].click()")
@@ -165,37 +166,27 @@ const run = async () => {
const smsIconSource = await valueOf(send, "document.querySelector('.input-icon--sms img')?.getAttribute('src')")
assert(smsIconSource?.includes('a01-icon-sms-code-v2.png'), `A01 SMS state did not use the approved message icon: ${smsIconSource}`)
assert.strictEqual(await valueOf(send, "Boolean(document.querySelector('.password-toggle'))"), false, 'A01 SMS state retained the password eye')
assert.strictEqual(await valueOf(send, "Boolean(document.querySelector('.forgot-password'))"), false, 'A01 SMS state retained forgot password')
await valueOf(send, "document.querySelectorAll('.login-tab')[0].click()")
await waitFor(send, "document.querySelectorAll('.login-tab')[0].classList.contains('active')", 'A01 password tab did not activate')
assert(await valueOf(send, "Boolean(document.querySelector('.password-toggle'))"), 'A01 password state is missing the eye control')
assert(await valueOf(send, "Boolean(document.querySelector('.forgot-password'))"), 'A01 password state is missing forgot password')
assert(await valueOf(send, "Boolean(document.querySelector('.forgot-password'))"), 'A01 SMS state must retain the password-recovery entry')
await valueOf(send, `(() => {
const inputs = document.querySelectorAll('.auth-input input')
inputs[0].value = '13800138000'
inputs[0].dispatchEvent(new Event('input', { bubbles: true }))
inputs[1].value = 'demo-password'
inputs[1].value = '1234'
inputs[1].dispatchEvent(new Event('input', { bubbles: true }))
document.querySelector('.login-submit').click()
})()`)
await waitFor(send, "Boolean(document.querySelector('.agreement-error'))", 'A01 did not show inline agreement validation')
await valueOf(send, "document.querySelector('.agreement-row').click()")
await valueOf(send, "document.querySelector('.agreement-toggle').click()")
await waitFor(send, "!document.querySelector('.agreement-error')", 'A01 agreement error did not clear after selection')
await valueOf(send, "document.querySelector('.login-submit').click()")
await waitFor(send, "Boolean(document.querySelector('.verification-layer'))", 'A01 did not open the custom verification layer after local validation')
await waitFor(send, "document.querySelector('.verification-dialog__skin img')?.naturalWidth === 1860", 'A01 verification dialog v3 asset did not finish loading')
const dialogAsset = await valueOf(send, `(() => {
const image = document.querySelector('.verification-dialog__skin img')
return image ? { src: image.currentSrc || image.src, naturalWidth: image.naturalWidth, naturalHeight: image.naturalHeight } : null
})()`)
assert(dialogAsset?.src.includes('a01-scroll-dialog-v3.png'), `A01 verification dialog did not load the v3 asset: ${dialogAsset?.src}`)
assert.deepStrictEqual(
[dialogAsset.naturalWidth, dialogAsset.naturalHeight],
[1860, 1560],
'A01 verification dialog loaded unexpected natural dimensions'
await waitFor(
send,
"document.querySelector('.app-toast__copy')?.textContent === '当前为本地预览模式,真实认证服务未启用'",
'A01 local preview did not reject a fake SMS login'
)
assert.strictEqual(await valueOf(send, "Boolean(document.querySelector('.verification-layer'))"), false, 'A01 retained the obsolete fake verification layer')
assert.strictEqual(await valueOf(send, "Boolean(document.querySelector('.tac-layer--visible'))"), false, 'A01 opened TAC without a server-bindable password-login ticket')
assert.deepStrictEqual(exceptions, [], `A01 raised browser exceptions: ${exceptions.join('; ')}`)
process.stdout.write('A01-RESPONSIVE-RUNTIME-SMOKE PASS\n')
-2
View File
@@ -2,12 +2,10 @@ $ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$pages = Get-Content -LiteralPath (Join-Path $root 'pages.json') -Raw -Encoding utf8 | ConvertFrom-Json
$catalog = Get-Content -LiteralPath (Join-Path $root 'data/page-catalog.js') -Raw -Encoding utf8
$a03File = Join-Path $root 'pages/auth/a03-mobile-verify.vue'
if ($pages.pages.path -contains 'pages/auth/a03-mobile-verify') { throw 'A-03 must not remain in pages.json' }
if (Test-Path -LiteralPath $a03File) { throw 'A-03 page file must be deleted' }
if ($catalog -match '(?m)^\s*a03\s*:') { throw 'A-03 catalog entry must be deleted' }
if ($pages.pages.Count -ne 52) { throw "Expected 52 active routes after the approved page-state merges and A06 archive, found $($pages.pages.Count)." }
Write-Output 'A03-ROUTE-REMOVAL-CONTRACT PASS'
+12 -12
View File
@@ -1,4 +1,4 @@
$ErrorActionPreference = 'Stop'
$ErrorActionPreference = 'Stop'
function ConvertFrom-Utf8Base64 {
param([string]$Value)
@@ -18,12 +18,10 @@ function Assert-NotContains {
$root = Split-Path -Parent $PSScriptRoot
$registerPath = Join-Path $root 'pages/auth/a04-register.vue'
$pages = Get-Content -LiteralPath (Join-Path $root 'pages.json') -Raw -Encoding utf8 | ConvertFrom-Json
$catalog = Get-Content -LiteralPath (Join-Path $root 'data/page-catalog.js') -Raw -Encoding utf8
$register = Get-Content -LiteralPath $registerPath -Raw -Encoding utf8
$globalStyles = Get-Content -LiteralPath (Join-Path $root 'styles/global.scss') -Raw -Encoding utf8
$registerCopy = ConvertFrom-Utf8Base64 '5rOo5YaM6LSm5Y+3'
$loginCopy = ConvertFrom-Utf8Base64 '55m75b2V'
$sliderPendingCopy = ConvertFrom-Utf8Base64 '5ruR5Yqo6aqM6K+B5b6F5o6l5Y+j5o6l5YWl'
if (-not ($pages.pages.path -contains 'pages/auth/a04-register')) { throw 'A-04 route must remain declared in pages.json' }
Assert-NotContains -Content $register -Unexpected 'ModulePage' -Message 'A-04 must not remain a ModulePage shell'
@@ -32,21 +30,24 @@ foreach ($required in @(
'import AuthPageShell from "@/components/AuthPageShell.vue";',
'a01-vnext-divider-v1.png',
'a01-scroll-primary-v3.png',
'adaptive.adaptive-feedback-toast',
'import AppToast from "@/components/AppToast.vue";',
'a02-agreement-unchecked.png',
'a02-agreement-checked.png',
'v-model.trim="phone"',
'v-model.trim="verificationCode"',
'v-model="password"',
'v-model="confirmPassword"',
'const agreed = ref(false)',
'const agreementError = ref(false)',
'const fieldErrors = ref({',
'const toggleAgreement = () =>',
'const submitRegister = () =>',
'class="feedback-toast"',
$sliderPendingCopy,
'const prepareLogin = () => uni.redirectTo({ url: "/pages/auth/a01-entry" });',
'if (!/^1\d{10}$/.test(phone.value))',
'const submitRegister = async () =>',
'<AppToast :visible="feedbackVisible" :message="feedbackMessage" />',
'<TacVerification',
'AUTH_TAC_SCENE.REGISTER',
'appApi.registerWithPassword',
'if (!/^\d{4}$/.test(verificationCode.value))',
'if (!isAuthPhone(phone.value))',
'validatePassword(password.value)',
'PASSWORD_POLICY_MESSAGE',
'if (!confirmPassword.value)',
@@ -56,7 +57,6 @@ foreach ($required in @(
}
Assert-Contains -Content $register -Expected $registerCopy -Message 'A-04 must visibly identify registration'
Assert-Contains -Content $register -Expected $loginCopy -Message 'A-04 must provide a login return path'
Assert-NotContains -Content $catalog -Unexpected 'a04:' -Message 'A-04 must not remain in the temporary page catalog'
Assert-NotContains -Content $register -Unexpected 'register-intro' -Message 'A-04 must not retain the redundant registration intro copy'
foreach ($forbidden in @('class="page-canvas"', 'class="page-backdrop"', 'mode="scaleToFill"', '1665rpx', 'a01-red-hall-ink-backdrop-v1.png')) {
Assert-NotContains -Content $register -Unexpected $forbidden -Message "A04 retains rejected page coordinates: $forbidden"
@@ -80,8 +80,8 @@ Assert-NotContains -Content $register -Unexpected '/pages/auth/a02-login' -Messa
foreach ($required in @(
'register-divider',
'mode="aspectFit"',
'adaptive.adaptive-feedback-toast;',
'top: calc(var(--status-bar-height, 0px) + 24rpx);'
'role="alert"',
'aria-describedby'
)) {
Assert-Contains -Content $register -Expected $required -Message "Missing A-04 visual balance contract: $required"
}
+11 -7
View File
@@ -107,23 +107,27 @@ const run = async () => {
}
await valueOf(send, "document.querySelector('.register-submit').click()")
await waitFor(send, "document.querySelectorAll('.field-error').length === 3", 'A04 empty submit did not show three field errors')
await waitFor(send, "document.querySelectorAll('.field-error').length === 4", 'A04 empty submit did not show four field errors')
assert(await valueOf(send, "Boolean(document.querySelector('.agreement-error'))"), 'A04 empty submit did not show agreement error')
await valueOf(send, `(() => {
const inputs = document.querySelectorAll('.auth-input input')
const values = ['13800138000', 'demo-password', 'demo-password']
const values = ['13800138000', '1234', 'demo-password', 'demo-password']
inputs.forEach((input, index) => {
input.value = values[index]
input.dispatchEvent(new Event('input', { bubbles: true }))
})
document.querySelector('.agreement-row').click()
document.querySelector('.agreement-toggle').click()
document.querySelector('.register-submit').click()
})()`)
await waitFor(send, "Boolean(document.querySelector('.feedback-toast'))", 'A04 valid submit did not show slider integration feedback')
assert.strictEqual(await valueOf(send, "document.querySelector('.feedback-toast__copy')?.textContent"), '滑动验证待接口接入', 'A04 valid submit showed unexpected feedback')
assert.strictEqual(await valueOf(send, "Boolean(document.querySelector('.verification-layer'))"), false, 'A04 must not retain the non-final custom verification placeholder')
const toastBorderImage = await valueOf(send, "getComputedStyle(document.querySelector('.feedback-toast')).borderImageSource")
await waitFor(
send,
"document.querySelector('.app-toast__copy')?.textContent === '当前为本地预览模式,真实认证服务未启用'",
'A04 local preview did not fail closed instead of faking registration success'
)
assert.strictEqual(await valueOf(send, "Boolean(document.querySelector('.verification-layer'))"), false, 'A04 retained the obsolete fake verification layer')
assert.strictEqual(await valueOf(send, "Boolean(document.querySelector('.tac-layer--visible'))"), false, 'A04 opened TAC during registration submission instead of the SMS request phase')
const toastBorderImage = await valueOf(send, "getComputedStyle(document.querySelector('.app-toast')).borderImageSource")
assert(toastBorderImage.includes('a01-scroll-toast-v3.png'), `A04 Toast did not render the v3 nine-slice asset: ${toastBorderImage}`)
await navigate(send, a04Url, '.login-entry__link')
+16 -18
View File
@@ -1,4 +1,4 @@
$ErrorActionPreference = 'Stop'
$ErrorActionPreference = 'Stop'
function ConvertFrom-Utf8Base64 {
param([string]$Value)
@@ -18,13 +18,11 @@ function Assert-NotContains {
$root = Split-Path -Parent $PSScriptRoot
$pagePath = Join-Path $root 'pages/auth/a05-reset-password.vue'
$pages = Get-Content -LiteralPath (Join-Path $root 'pages.json') -Raw -Encoding utf8 | ConvertFrom-Json
$catalog = Get-Content -LiteralPath (Join-Path $root 'data/page-catalog.js') -Raw -Encoding utf8
$page = Get-Content -LiteralPath $pagePath -Raw -Encoding utf8
$resetCopy = ConvertFrom-Utf8Base64 '6YeN6K6+5a+G56CB'
$confirmPasswordCopy = ConvertFrom-Utf8Base64 '56Gu6K6k5paw5a+G56CB'
$getCodeCopy = ConvertFrom-Utf8Base64 '6I635Y+W6aqM6K+B56CB'
$loginCopy = ConvertFrom-Utf8Base64 '6L+U5Zue55m75b2V'
$sliderPendingCopy = ConvertFrom-Utf8Base64 '5ruR5Yqo6aqM6K+B5b6F5o6l5Y+j5o6l5YWl'
if (-not ($pages.pages.path -contains 'pages/auth/a05-reset-password')) { throw 'A-05 route must remain declared in pages.json' }
Assert-NotContains -Content $page -Unexpected 'ModulePage' -Message 'A-05 must not remain a ModulePage shell'
@@ -33,28 +31,29 @@ foreach ($required in @(
'import AuthPageShell from "@/components/AuthPageShell.vue";',
'a01-vnext-divider-v1.png',
'a01-scroll-primary-v3.png',
'adaptive.adaptive-feedback-toast',
'a01-scroll-dialog-v3.png',
'import AppToast from "@/components/AppToast.vue";',
'chevron-right.png',
'v-model.trim="phone"',
'v-model.trim="verificationCode"',
'v-model="password"',
'v-model="confirmPassword"',
'const prepareGetCode = () =>',
'const submitReset = () =>',
'const prepareGetCode = async () =>',
'const submitReset = async () =>',
'const fieldErrors = ref({',
'const successVisible = ref(false)',
'class="feedback-toast"',
'class="success-layer"',
'const prepareLogin = () => uni.redirectTo({ url: "/pages/auth/a01-entry" });',
'if (!/^1\d{10}$/.test(phone.value))',
'if (!/^\d{6}$/.test(verificationCode.value))',
'<AppToast :visible="feedbackVisible" :message="feedbackMessage" />',
'title="密码已重设"',
'if (!isAuthPhone(phone.value))',
'if (!/^\d{4}$/.test(verificationCode.value))',
'<TacVerification',
'AUTH_TAC_SCENE.FORGOT_PASSWORD',
'await appApi.resetPassword',
'validatePassword(password.value)',
'PASSWORD_POLICY_MESSAGE',
'if (password.value !== confirmPassword.value)',
'adaptive.adaptive-feedback-toast;',
'top: calc(var(--status-bar-height, 0px) + 24rpx);',
'max-height: calc(var(--app-viewport-height) - 40px);'
'role="alert"',
'aria-describedby',
':visible="successVisible"'
)) {
Assert-Contains -Content $page -Expected $required -Message "Missing A-05 reset-password contract: $required"
}
@@ -62,8 +61,7 @@ Assert-Contains -Content $page -Expected $resetCopy -Message 'A-05 must visibly
Assert-Contains -Content $page -Expected $confirmPasswordCopy -Message 'A-05 must require password confirmation'
Assert-Contains -Content $page -Expected $getCodeCopy -Message 'A-05 must expose the verification-code action'
Assert-Contains -Content $page -Expected $loginCopy -Message 'A-05 must provide the A01 return path'
Assert-Contains -Content $page -Expected $sliderPendingCopy -Message 'A-05 must defer the real slider to the interface stage'
Assert-NotContains -Content $catalog -Unexpected 'a05:' -Message 'A-05 must not remain in the temporary page catalog'
Assert-NotContains -Content $page -Unexpected '滑动验证待接口接入' -Message 'A-05 must not retain the retired TAC placeholder'
foreach ($forbidden in @('class="page-canvas"', 'class="page-backdrop"', 'mode="scaleToFill"', '1665rpx', 'a01-red-hall-ink-backdrop-v1.png')) {
Assert-NotContains -Content $page -Unexpected $forbidden -Message "A05 retains rejected page coordinates: $forbidden"
}
@@ -84,7 +82,7 @@ foreach ($obsoleteVisual in @(
}
$primarySkinCount = ([regex]::Matches($page, 'a01-scroll-primary-v3\.png')).Count
if ($primarySkinCount -ne 2) { throw "A-05 must use the approved primary skin exactly twice, found $primarySkinCount" }
if ($primarySkinCount -ne 1) { throw "A-05 page-local submit action must use the approved primary skin exactly once, found $primarySkinCount" }
foreach ($nativeUi in @('uni.showToast', 'uni.showModal', 'uni.showLoading', 'uni.showActionSheet')) {
Assert-NotContains -Content $page -Unexpected $nativeUi -Message "A-05 must not use native UniApp feedback: $nativeUi"
}
+23 -11
View File
@@ -120,31 +120,43 @@ const run = async () => {
await waitFor(send, "Boolean(document.querySelector('.field-error'))", 'A05 invalid phone did not show inline error')
await setInputs(send, ['13800138000', '', '', ''])
await valueOf(send, "document.querySelector('.get-code').click()")
await waitFor(send, "Boolean(document.querySelector('.feedback-toast'))", 'A05 code request did not use custom pending feedback')
assert.strictEqual(await valueOf(send, "document.querySelector('.feedback-toast').textContent.trim()"), '滑动验证待接口接入', 'A05 code request showed the wrong pending feedback')
assert.strictEqual(await valueOf(send, "Boolean(document.querySelector('.verification-layer'))"), false, 'A05 must not retain the old verification panel')
assert.strictEqual(await valueOf(send, "document.querySelector('.auth-input input').value"), '13800138000', 'A05 pending slider feedback cleared the form')
assert.strictEqual(await valueOf(send, "document.querySelector('.get-code').textContent.trim()"), '获取验证码', 'A05 must not fake a requested-code state before the real slider and SMS interface')
await waitFor(
send,
"document.querySelector('.app-toast__copy')?.textContent === '当前为本地预览模式,真实认证服务未启用'",
'A05 local preview did not fail closed before requesting TAC'
)
assert.strictEqual(await valueOf(send, "Boolean(document.querySelector('.verification-layer'))"), false, 'A05 retained the obsolete fake verification layer')
assert.strictEqual(await valueOf(send, "Boolean(document.querySelector('.tac-layer--visible'))"), false, 'A05 opened TAC without a remote requirement response')
assert.strictEqual(await valueOf(send, "document.querySelector('.auth-input input').value"), '13800138000', 'A05 unavailable remote verification cleared the form')
assert.strictEqual(await valueOf(send, "document.querySelector('.get-code').textContent.trim()"), '获取验证码', 'A05 faked a requested-code state without TAC and the SMS service')
await valueOf(send, "document.querySelector('.reset-submit').click()")
await waitFor(send, "document.querySelectorAll('.field-error').length === 3", 'A05 incomplete submit did not show three remaining field errors')
await setInputs(send, ['13800138000', '123456', 'new-password', 'different-password'])
await setInputs(send, ['13800138000', '1234', 'new-password', 'different-password'])
await sleep(100)
await valueOf(send, "document.querySelector('.reset-submit').click()")
await sleep(100)
const mismatchState = await valueOf(send, `({
values: Array.from(document.querySelectorAll('.auth-input input')).map((item) => item.value),
errors: Array.from(document.querySelectorAll('.field-error')).map((item) => item.textContent),
success: Boolean(document.querySelector('.success-layer'))
success: document.querySelector('.app-dialog__title')?.textContent === '密码已重设'
})`)
assert(mismatchState.errors.some((message) => message.includes('不一致')), `A05 mismatched passwords did not show inline error: ${JSON.stringify(mismatchState)}`)
await setInputs(send, ['13800138000', '123456', 'new-password', 'new-password'])
await setInputs(send, ['13800138000', '1234', 'new-password', 'new-password'])
await sleep(100)
await valueOf(send, "document.querySelector('.reset-submit').click()")
await waitFor(send, "Boolean(document.querySelector('.success-layer'))", 'A05 valid submit did not show custom success result')
await valueOf(send, "document.querySelector('.success-action').click()")
await waitFor(send, "Boolean(document.querySelector('.login-tab')) && (location.hash === '#/' || location.href.includes('/pages/auth/a01-entry'))", 'A05 success action did not return to A01')
await waitFor(
send,
"document.querySelector('.app-toast__copy')?.textContent === '当前为本地预览模式,真实认证服务未启用'",
'A05 local preview did not reject a fake password reset'
)
assert.strictEqual(await valueOf(send, "document.querySelector('.app-dialog__title')?.textContent === '密码已重设'"), false, 'A05 showed reset success without a successful remote response')
assert.deepStrictEqual(
await valueOf(send, "Array.from(document.querySelectorAll('.auth-input input')).map((item) => item.value)"),
['13800138000', '1234', 'new-password', 'new-password'],
'A05 cleared the form after a rejected remote reset'
)
assert.deepStrictEqual(exceptions, [], `A05 raised browser exceptions: ${exceptions.join('; ')}`)
process.stdout.write('A05-RESET-PASSWORD-RUNTIME-SMOKE PASS\n')
+1 -5
View File
@@ -13,7 +13,6 @@ function Assert-NotContains {
$root = Split-Path -Parent $PSScriptRoot
$page = Get-Content -LiteralPath (Join-Path $root 'pages/auth/a06-auth-status.vue') -Raw -Encoding utf8
$pages = Get-Content -LiteralPath (Join-Path $root 'pages.json') -Raw -Encoding utf8 | ConvertFrom-Json
$catalog = Get-Content -LiteralPath (Join-Path $root 'data/page-catalog.js') -Raw -Encoding utf8
$runtime = Get-Content -LiteralPath (Join-Path $root 'tests/a06-auth-status-runtime-smoke.js') -Raw -Encoding utf8
if ($pages.pages.path -contains 'pages/auth/a06-auth-status') { throw 'A-06 is archived and must not remain declared in pages.json' }
@@ -22,7 +21,6 @@ if (-not ($pages.pages.path -contains 'pages/auth/a01-entry')) { throw 'A-06 mus
Assert-Contains -Content $runtime -Expected 'A06-AUTH-STATUS-RUNTIME-SMOKE SKIP archived route' -Message 'A-06 runtime smoke must explicitly skip while the route is archived'
Assert-NotContains -Content $page -Unexpected 'ModulePage' -Message 'A-06 must not remain a ModulePage shell'
Assert-NotContains -Content $catalog -Unexpected 'a06:' -Message 'A-06 must not remain in the temporary page catalog'
foreach ($required in @(
'const status = ref(',
@@ -34,11 +32,9 @@ foreach ($required in @(
'reasonLabel:',
'impactLabel:',
'recoveryLabel:',
'const resolveStatus = () =>',
'const goLogin = () => uni.redirectTo({ url: "/pages/auth/a01-entry" });',
'const resolveStatus = (options = {}) =>',
'const openRecovery = () =>',
'const closeRecovery = () =>',
'const goBack = () =>',
'<AuthPageShell',
'import AuthPageShell from "@/components/AuthPageShell.vue";',
'a01-vnext-divider-v1.png',
@@ -1,16 +1,28 @@
$ErrorActionPreference = 'Stop'
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$pages = Get-Content -LiteralPath (Join-Path $root 'pages.json') -Raw -Encoding UTF8 | ConvertFrom-Json
$activePaths = @($pages.pages | ForEach-Object { "$($_.path).vue" })
$moduleConsumers = @()
$remoteBusinessOwners = @(
'pages/auth/a01-entry.vue',
'pages/auth/a04-register.vue',
'pages/auth/a05-reset-password.vue',
'pages/profile/m07-feedback.vue'
)
foreach ($relativePath in $activePaths) {
$fullPath = Join-Path $root $relativePath
if (-not (Test-Path -LiteralPath $fullPath)) { throw "Missing active page: $relativePath" }
$source = Get-Content -LiteralPath $fullPath -Raw -Encoding UTF8
if ($source -match '<ModulePage(?:\s|/|>)|import\s+ModulePage\s+from') { $moduleConsumers += $relativePath }
if ($source -match '@/utils/api\.js|\bappApi\b') { throw "$relativePath must remain local-design only" }
$usesRemoteBusiness = $source -match '@/utils/api\.js|\bappApi\b'
if ($usesRemoteBusiness -and $relativePath -notin $remoteBusinessOwners) {
throw "$relativePath must remain local-design only until its own tested interface batch"
}
if (-not $usesRemoteBusiness -and $relativePath -in $remoteBusinessOwners) {
throw "$relativePath lost its owned authentication interface"
}
if ($source -match 'uni\.(showToast|showModal|showLoading|showActionSheet)') { throw "$relativePath must use project feedback components" }
}
@@ -21,26 +33,26 @@ if ($moduleConsumers.Count -gt 0) {
$contracts = [ordered]@{
'pages/family/f03-feed-detail.vue' = @('feedComments', 'commentDraft', 'submitComment', 'feed-state--expired')
'pages/family/f04-article-list.vue' = @('articleCategories', 'filteredArticles', 'openArticle', 'createArticle')
'pages/family/f05-article-detail.vue' = @('articleParagraphs', 'toggleFavorite', 'article-state--expired', 'backToArticles')
'pages/family/f05-article-detail.vue' = @('articleParagraphs', 'disabled label=', 'article-state--expired', 'backToArticles')
'pages/family/f07-album-list.vue' = @('albums', 'openAlbum', 'createAlbum', 'album-state--empty')
'pages/records/r03-gift-list.vue' = @('giftBooks', 'openGiftBook', 'createGift', 'gift-state--empty')
'pages/records/r04-gift-editor.vue' = @('giftForm', 'validateGift', 'saveGift', 'confirmDelete')
'pages/records/r05-ritual-list.vue' = @('rituals', 'openRitual', 'createRitual', 'ritual-state--empty')
'pages/records/r06-ritual-detail.vue' = @('ritualDetail', 'participants', 'editRitual', 'ritual-state--expired')
'pages/records/r07-ritual-editor.vue' = @('ritualForm', 'validateRitual', 'saveRitual', 'confirmDelete')
'pages/records/r08-growth-journal.vue' = @('growthRecords', 'recordGrowth', 'personName', 'timeline-state--empty')
'pages/records/r09-life-events.vue' = @('lifeEvents', 'createLifeEvent', 'personName', 'timeline-state--empty')
'pages/records/r10-memo-list.vue' = @('memos', 'toggleMemo', 'createMemo', 'memo-state--empty')
'pages/records/r11-merit-records.vue' = @('meritRecords', 'createMerit', 'totalContribution', 'merit-state--empty')
'pages/notification/n02-message-detail.vue' = @('noticeDetail', 'markAsRead', 'openNoticeTarget', 'notice-state--expired')
'pages/records/r03-gift-list.vue' = @('relativeRecords', 'openRelative', 'createRelativePreview', 'relative-state--empty')
'pages/records/r04-gift-editor.vue' = @('relativeForm', 'validateRelative', 'localRelativePreview', 'relativeId')
'pages/records/r05-ritual-list.vue' = @('ceremonies', 'openCeremony', 'createCeremonyPreview', 'ceremony-state--empty')
'pages/records/r06-ritual-detail.vue' = @('ceremonyDetail', 'invitees', 'editCeremony', 'ceremony-state--expired')
'pages/records/r07-ritual-editor.vue' = @('ceremonyForm', 'validateCeremony', 'localCeremonyPreview', 'ceremonyId')
'pages/records/r08-growth-journal.vue' = @('growthRecords', 'recordGrowth', 'localGrowthPreview', 'timeline-state--empty')
'pages/records/r09-life-events.vue' = @('人生事件接口尚未开放', 'serviceState', 'requestBack')
'pages/records/r10-memo-list.vue' = @('memos', 'createMemoPreview', 'localMemoPreview', 'memo-state--empty')
'pages/records/r11-merit-records.vue' = @('meritRecords', 'createMeritPreview', 'localMeritPreview', 'totalContribution')
'pages/notification/n02-message-detail.vue' = @('findNotificationFixture', 'noticeDetail.unread', 'markAsRead', 'openNoticeTarget', 'notice-state--expired')
'pages/profile/m02-edit-profile.vue' = @('profileForm', 'chooseAvatar', 'validateProfile', 'saveProfile')
'pages/profile/m03-security-settings.vue' = @('securityItems', 'openSecurityItem', 'device-state--safe', 'checkSecurity')
'pages/profile/m03-security-settings.vue' = @('securityItems', 'openSecurityItem', 'device-state--limited', 'currentUser.phone', 'checkSecurity')
'pages/profile/m04-change-password.vue' = @('passwordForm', 'validatePassword', 'togglePassword', 'savePassword')
'pages/profile/m05-change-phone.vue' = @('phoneForm', 'sendCode', 'codeCountdown', 'savePhone')
'pages/profile/m05-change-phone.vue' = @('phoneForm', 'sendCode', 'validatePhone', 'phone-state--saving', 'savePhone')
'pages/profile/m06-help-center.vue' = @('helpCategories', 'filteredQuestions', 'toggleQuestion', 'contactSupport')
'pages/profile/m07-feedback.vue' = @('feedbackForm', 'feedbackTypes', 'validateFeedback', 'submitFeedback')
'pages/profile/m08-promotion.vue' = @('inviteCode', 'copyInviteCode', 'generatePoster', 'share-state--ready')
'pages/profile/m09-vip-orders.vue' = @('serviceBenefits', 'orders', 'order-state--empty', 'openServiceNotice')
'pages/profile/m08-promotion.vue' = @('inviteState', 'openInviteExplanation', 'explanationVisible', 'share-state--unavailable')
'pages/profile/m09-vip-orders.vue' = @('serviceBenefits', 'orderState', 'order-state--unavailable', 'openServiceNotice')
'pages/profile/m10-about-settings.vue' = @('agreementItems', 'openAgreement', 'confirmLogout', 'appVersion')
}
@@ -10,8 +10,6 @@ $profile = Get-Content -LiteralPath $profilePath -Raw -Encoding UTF8
foreach ($token in @(
'@mixin adaptive-auth-dialog',
'@mixin adaptive-scroll-button($type)',
'@mixin adaptive-module-content',
'@mixin adaptive-module-field',
'@mixin adaptive-feedback-toast',
'@mixin adaptive-genealogy-current-slip',
'@mixin adaptive-genealogy-list-card',
@@ -38,7 +36,6 @@ foreach ($token in @(
'a01-scroll-dialog-v3.png',
'border-image-slice: 260 240 360 240 fill;',
'border-image-slice: 56 300 fill;',
'border-image-slice: 105 150;',
'border-image-slice: 70 100 fill;'
)) {
if (-not $profile.Contains($token)) {
@@ -7,9 +7,6 @@ function Read-Utf8([string]$path) {
$expected = @{
'components/AppToast.vue' = @('adaptive.adaptive-feedback-toast')
'pages/auth/a01-entry.vue' = @('adaptive.adaptive-feedback-toast')
'pages/auth/a04-register.vue' = @('adaptive.adaptive-feedback-toast')
'pages/auth/a05-reset-password.vue' = @('adaptive.adaptive-feedback-toast')
'pages/genealogy/g01-my-genealogies.vue' = @(
'adaptive.adaptive-genealogy-current-slip',
'adaptive.adaptive-genealogy-list-card',
@@ -0,0 +1,129 @@
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$attributePattern = '(?:"[^"]*"|''[^'']*''|[^>"'']+)*'
function Read-ProjectFile {
param([string]$Path)
return Get-Content -LiteralPath (Join-Path $root $Path) -Raw -Encoding UTF8
}
function Require-Match {
param([string]$Content, [string]$Pattern, [string]$Label)
if ($Content -notmatch $Pattern) { throw "$Label 未满足" }
}
function Require-ButtonClass {
param([string]$Content, [string]$Class, [string]$Label)
$button = [regex]::Matches($Content, "(?s)<button\b$script:attributePattern>") |
Where-Object { $_.Value -match "class=`"[^`"]*\b$([regex]::Escape($Class))\b" } |
Select-Object -First 1
if ($null -eq $button) { throw "$Label 必须由原生 button 承载:$Class" }
$view = [regex]::Matches($Content, "(?s)<view\b$script:attributePattern>") |
Where-Object { $_.Value -match "class=`"[^`"]*\b$([regex]::Escape($Class))\b" -and $_.Value.Contains('@click') } |
Select-Object -First 1
if ($null -ne $view) {
throw "$Label 不得继续用 view 模拟按钮:$Class"
}
}
function Get-ButtonByClass {
param([string]$Content, [string]$Class)
return [regex]::Matches($Content, "(?s)<button\b$script:attributePattern>") |
Where-Object { $_.Value -match "class=`"[^`"]*\b$([regex]::Escape($Class))\b" } |
Select-Object -First 1
}
function Require-FieldRelation {
param([string]$Content, [string]$Prefix, [string]$IdSuffix, [string]$ErrorKey, [string]$Label)
$inputId = "$Prefix-$IdSuffix"
$errorId = "$inputId-error"
Require-Match $Content "(?s)<label\b[^>]*for=`"$([regex]::Escape($inputId))`"[^>]*>" "$Label label/for"
$input = [regex]::Matches($Content, "(?s)<input\b$script:attributePattern>") |
Where-Object { $_.Value.Contains("id=`"$inputId`"") } |
Select-Object -First 1
if ($null -eq $input) { throw "$Label 缺少对应 input$inputId" }
foreach ($pattern in @(
":aria-invalid=`"Boolean\(fieldErrors\.$([regex]::Escape($ErrorKey))\)`"",
":aria-describedby=`"fieldErrors\.$([regex]::Escape($ErrorKey)) \? '$([regex]::Escape($errorId))' : undefined`""
)) {
if ($input.Value -notmatch $pattern) { throw "$Label 输入错误关联缺失:$inputId" }
}
Require-Match $Content "(?s)<text\b(?=[^>]*id=`"$([regex]::Escape($errorId))`")(?=[^>]*role=`"alert`")[^>]*>" "$Label 错误节点"
}
$a01 = Read-ProjectFile 'pages/auth/a01-entry.vue'
$a04 = Read-ProjectFile 'pages/auth/a04-register.vue'
$a05 = Read-ProjectFile 'pages/auth/a05-reset-password.vue'
$globalStyles = Read-ProjectFile 'styles/global.scss'
foreach ($page in @($a01, $a04, $a05)) {
Require-Match $page 'import\s+AppToast\s+from\s+["'']@/components/AppToast\.vue["'']' '认证状态播报 import'
Require-Match $page '(?s)<AppToast\b(?=[^>]*:visible="feedbackVisible")(?=[^>]*:message="feedbackMessage")[^>]*/>' '认证状态播报实例'
if ($page.Contains('class="feedback-toast"')) { throw '认证页不得重复实现缺少稳定 live region 的 Toast' }
}
Require-Match $a01 '<view\s+class="login-tabs"\s+role="tablist"' 'A01 登录方式容器'
$a01Buttons = [regex]::Matches($a01, "(?s)<button\b$attributePattern>")
$tabButtons = @($a01Buttons | Where-Object { $_.Value.Contains('role="tab"') })
if ($tabButtons.Count -ne 2) { throw 'A01 两个登录方式必须都是原生 tab 按钮' }
if (@($tabButtons | Where-Object { $_.Value.Contains(':aria-selected=') }).Count -ne 2) { throw 'A01 两个 tab 都必须声明选中状态' }
foreach ($class in @(
'login-tab', 'password-toggle', 'get-code', 'forgot-password', 'login-submit',
'wechat-login', 'register-link', 'agreement-toggle', 'agreement-link'
)) { Require-ButtonClass $a01 $class 'A01' }
if (@($a01Buttons | Where-Object { $_.Value -match 'class="[^"]*\bagreement-link\b' }).Count -ne 2) { throw 'A01 两份协议必须各自可聚焦' }
foreach ($name in @('手机号', '登录密码', '短信验证码')) {
$namedInput = [regex]::Matches($a01, "(?s)<input\b$attributePattern>") |
Where-Object { $_.Value.Contains("aria-label=`"$name`"") } |
Select-Object -First 1
if ($null -eq $namedInput) { throw "A01 输入缺少名称:$name" }
}
$passwordToggle = Get-ButtonByClass $a01 'password-toggle'
if ($passwordToggle.Value -notmatch ':aria-label="passwordVisible \? ''隐藏密码'' : ''显示密码''"' -or -not $passwordToggle.Value.Contains(':aria-pressed="passwordVisible"')) { throw 'A01 密码显隐状态未关联' }
$a01GetCode = Get-ButtonByClass $a01 'get-code'
if (-not $a01GetCode.Value.Contains(':disabled="sendingCode || submitting || cooldownSeconds > 0"')) { throw 'A01 短信按钮禁用态未关联' }
$a01Submit = Get-ButtonByClass $a01 'login-submit'
if (-not $a01Submit.Value.Contains(':disabled="submitting || sendingCode || tacVisible"') -or -not $a01Submit.Value.Contains(':aria-busy="submitting"')) { throw 'A01 提交忙碌态未关联' }
$a01Agreement = Get-ButtonByClass $a01 'agreement-toggle'
if (-not $a01Agreement.Value.Contains('role="checkbox"') -or -not $a01Agreement.Value.Contains(':aria-checked="agreed"')) { throw 'A01 协议复选语义未关联' }
Require-Match $a01 '(?s)<text\b[^>]*class="agreement-error"[^>]*role="alert"' 'A01 协议错误播报'
foreach ($class in @('back-button', 'get-code', 'register-submit', 'agreement-toggle', 'agreement-link', 'login-entry__link')) {
Require-ButtonClass $a04 $class 'A04'
}
$a04Buttons = [regex]::Matches($a04, "(?s)<button\b$attributePattern>")
if (@($a04Buttons | Where-Object { $_.Value -match 'class="[^"]*\bagreement-link\b' }).Count -ne 2) { throw 'A04 两份协议必须各自可聚焦' }
foreach ($class in @('back-button', 'get-code', 'reset-submit', 'login-entry__link')) {
Require-ButtonClass $a05 $class 'A05'
}
foreach ($entry in @(
@{ Key = 'A04'; Content = $a04; Prefix = 'a04'; SubmitClass = 'register-submit' },
@{ Key = 'A05'; Content = $a05; Prefix = 'a05'; SubmitClass = 'reset-submit' }
)) {
Require-FieldRelation $entry.Content $entry.Prefix 'phone' 'phone' "$($entry.Key) 手机号"
Require-FieldRelation $entry.Content $entry.Prefix 'verification-code' 'verificationCode' "$($entry.Key) 验证码"
Require-FieldRelation $entry.Content $entry.Prefix 'password' 'password' "$($entry.Key) 密码"
Require-FieldRelation $entry.Content $entry.Prefix 'confirm-password' 'confirmPassword' "$($entry.Key) 确认密码"
$getCode = Get-ButtonByClass $entry.Content 'get-code'
if (-not $getCode.Value.Contains(':disabled="sendingCode || submitting || cooldownSeconds > 0"')) { throw "$($entry.Key) 短信按钮禁用态未关联" }
$submit = Get-ButtonByClass $entry.Content $entry.SubmitClass
if (-not $submit.Value.Contains(':disabled="submitting || sendingCode || tacVisible"') -or -not $submit.Value.Contains(':aria-busy="submitting"')) { throw "$($entry.Key) 主提交忙碌态未关联" }
}
$a04Agreement = Get-ButtonByClass $a04 'agreement-toggle'
if (-not $a04Agreement.Value.Contains('role="checkbox"') -or -not $a04Agreement.Value.Contains(':aria-checked="agreed"')) { throw 'A04 协议复选语义未关联' }
Require-Match $a05 '(?s)<AppDialog\b(?=[^>]*:visible="successVisible")(?=[^>]*title="密码已重设")[^>]*>' 'A05 成功终态对话框'
if ($a05.Contains('class="success-layer"')) { throw 'A05 成功终态必须复用唯一 AppDialog owner' }
foreach ($token in @(
'.auth-plain-button {', 'margin: 0;', 'padding: 0;', 'border: 0;',
'background: transparent;', 'line-height: normal;', '.auth-plain-button::after {',
'.auth-plain-button:focus-visible {', '.auth-page.auth-page .auth-plain-button {',
'min-width: 48px;', 'min-height: 48px;'
)) {
if (-not $globalStyles.Contains($token)) { throw "认证原生按钮重置 owner 缺少:$token" }
}
Write-Output 'AUTH-ACCESSIBILITY-STATIC-CONTRACT PASS'
@@ -0,0 +1,28 @@
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$evidencePath = Join-Path $root 'tests/manual/tac-android-accessibility-evidence.json'
if (-not (Test-Path -LiteralPath $evidencePath)) {
throw @'
ANDROID-AUTH-ACCESSIBILITY-RELEASE BLOCKED
- 当前只能证明认证页与 TAC 外壳具备静态语义键盘焦点和 48px 操作目标不能证明天爱拖动挑战可由 TalkBack外接键盘或低精度操作完成
- 后端/provider 尚未提供与同一租户客户端场景手机号和 challengeId 原子绑定的非拖动等价验证路径
- 尚无 MuMu Android 上的 TalkBack外接键盘返回键动态播报焦点恢复和 48dp 触控目标三方实测证据
- 关闭条件先落地安全等价的非拖动验证方式再由三位评审在 MuMu Android 对同一候选包完成实测并提交 tests/manual/tac-android-accessibility-evidence.json
'@
}
$evidence = Get-Content -LiteralPath $evidencePath -Raw -Encoding UTF8 | ConvertFrom-Json
if ($evidence.schemaVersion -ne 1) { throw 'Android 无障碍证据 schemaVersion 必须为 1' }
if ($evidence.platform -ne 'MuMu Android') { throw 'Android 无障碍证据必须来自 MuMu Android' }
if ([string]$evidence.artifactSha256 -notmatch '^[a-fA-F0-9]{64}$') { throw 'Android 无障碍证据必须绑定候选包 SHA256' }
if ([string]$evidence.accessibleChallenge.type -match '^(?i:slider|drag)$') { throw '拖动挑战不能作为无障碍等价路径' }
if ($evidence.accessibleChallenge.serverBound -ne $true) { throw '无障碍等价挑战必须由服务端原子绑定并消费' }
foreach ($check in @('talkBackPass', 'externalKeyboardPass', 'androidBackPass', 'liveRegionPass', 'focusRestorePass', 'touchTarget48dpPass')) {
if ($evidence.checks.PSObject.Properties[$check].Value -ne $true) { throw "Android 无障碍证据未通过:$check" }
}
$reviewers = @($evidence.reviewers | Sort-Object -Unique)
if ($reviewers.Count -ne 3) { throw 'Android 无障碍证据必须由三位不同评审者共同签署' }
Write-Output 'ANDROID-AUTH-ACCESSIBILITY-RELEASE PASS'
+161
View File
@@ -0,0 +1,161 @@
"use strict";
const assert = require("assert");
const fs = require("fs");
const path = require("path");
const toDataModuleUrl = (source) =>
`data:text/javascript;base64,${Buffer.from(source).toString("base64")}`;
const run = async () => {
const rawSource = fs.readFileSync(path.join(__dirname, "../utils/api.js"), "utf8");
const moduleBody = rawSource.slice(rawSource.indexOf("const successCodes"));
const savedTokens = [];
const prelude = `
const currentUser = {};
const genealogies = [];
const publicGenealogies = [];
const treeMembers = [];
const notifications = [];
const joinApplications = [];
const listFamilyFeedFixtures = () => [];
const listFamilyArticleFixtures = () => [];
const listFamilyAlbumFixtures = () => [];
const listCeremonyFixtures = () => [];
const listGrowthRecordFixtures = () => [];
const listNotificationFixtures = () => [];
const runtimeConfig = {
mode: "remote",
baseUrl: "https://backend-api.ddxcjp.cn",
clientId: "client-1",
tenantId: "000000",
};
const hasRemoteConfig = () => true;
const resolveRuntimeMode = () => "remote";
const AUTH_TAC_SCENE = Object.freeze({
SMS_LOGIN: "APP_SMS_LOGIN",
REGISTER: "APP_REGISTER",
FORGOT_PASSWORD: "APP_FORGOT_PASSWORD",
});
const assertSmsCode = (value) => {
if (typeof value !== "string" || !/^\\d{4}$/.test(value)) throw new Error("请输入 4 位短信验证码");
return value;
};
const GENEALOGY_ACCESS_PRESET = Object.freeze({ MEMBER_ONLY: "MEMBER_ONLY" });
const session = {
getToken: () => "",
saveToken: (token) => globalThis.__savedTokens.push(token),
};
`;
globalThis.__savedTokens = savedTokens;
const requests = [];
let nextResponse = null;
let holdResponse = false;
globalThis.uni = {
request(options) {
requests.push(options);
const task = {
aborted: false,
abort() {
this.aborted = true;
options.fail({ errMsg: "request:fail abort" });
},
};
options.__task = task;
if (!holdResponse) queueMicrotask(() => options.success(nextResponse));
return task;
},
};
const { appApi, createRequestController } = await import(
toDataModuleUrl(`${prelude}\n${moduleBody}`)
);
const respond = (response) => {
nextResponse = response;
};
const sendSms = () => appApi.sendSmsCode({
sceneCode: "APP_REGISTER",
phone: "13800138000",
validToken: "ticket-1",
});
for (const invalid of [
{ statusCode: 200, data: null },
{ statusCode: 200, data: "<html>ok</html>" },
{ statusCode: 200, data: {} },
{ statusCode: 200, data: { code: "200", data: null } },
{ statusCode: 200, data: { code: null, data: null } },
{ statusCode: 200, data: { code: false, data: null } },
{ statusCode: 204, data: { code: 200, msg: "成功", data: null } },
]) {
respond(invalid);
await assert.rejects(sendSms(), /认证服务|响应|200/);
}
respond({ statusCode: 500, data: null });
await assert.rejects(sendSms(), /500/);
respond({ statusCode: 200, data: { code: 500, msg: "业务拒绝", data: null } });
await assert.rejects(sendSms(), /业务拒绝/);
respond({ statusCode: 200, data: { code: 200, msg: "操作成功", data: null } });
assert.strictEqual(await sendSms(), null, "合法 RVoid 必须精确解析为 null");
respond({ statusCode: 200, data: { code: 200 } });
assert.strictEqual(await sendSms(), null, "RVoid 未声明 data 必填,省略 data 仍必须解析为 null");
assert.strictEqual(requests.at(-1).header.clientid, "client-1");
respond({ statusCode: 200, data: null });
await assert.rejects(
appApi.resetPassword({
phone: "13800138000",
passwordHash: "a".repeat(32),
smsCode: "1234",
}),
/认证服务|响应/,
);
respond({ statusCode: 200, data: { code: 200 } });
assert.strictEqual(
await appApi.resetPassword({
phone: "13800138000",
passwordHash: "a".repeat(32),
smsCode: "1234",
}),
null,
"找回密码的 RVoid 省略 data 时仍必须解析为 null",
);
respond({
statusCode: 200,
data: { code: 200, msg: "操作成功", data: { access_token: "token-1" } },
});
const login = await appApi.loginWithSms({ phone: "13800138000", smsCode: "1234" });
assert.strictEqual(login.access_token, "token-1");
assert.deepStrictEqual(savedTokens, ["token-1"]);
holdResponse = true;
const requestController = createRequestController();
const cancelled = appApi.sendSmsCode(
{
sceneCode: "APP_REGISTER",
phone: "13800138000",
validToken: "ticket-1",
},
{ requestController },
);
const activeRequest = requests.at(-1);
const activeTask = activeRequest.__task;
assert.strictEqual(activeRequest.timeout, 15000, "认证请求必须限制弱网等待时间");
requestController.abort();
await assert.rejects(cancelled, (error) => error.code === "REQUEST_CANCELLED");
assert.strictEqual(activeTask.aborted, true, "页面离开时必须真正中止 RequestTask");
delete globalThis.uni;
delete globalThis.__savedTokens;
process.stdout.write("AUTH-API-RUNTIME-SMOKE PASS\n");
};
run().catch((error) => {
process.stderr.write(`${error.stack || error.message}\n`);
process.exit(1);
});
+122
View File
@@ -0,0 +1,122 @@
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
function Read-ProjectFile {
param([string]$Path)
$fullPath = Join-Path $root $Path
if (-not (Test-Path -LiteralPath $fullPath)) { throw "缺少 TAC 集成文件:$Path" }
return Get-Content -LiteralPath $fullPath -Raw -Encoding UTF8
}
function Require-Text {
param([string]$Content, [string]$Text, [string]$Label)
if (-not $Content.Contains($Text)) { throw "$Label 缺少:$Text" }
}
function Reject-Text {
param([string]$Content, [string]$Text, [string]$Label)
if ($Content.Contains($Text)) { throw "$Label 仍保留:$Text" }
}
$owner = Read-ProjectFile 'utils/auth-verification.js'
$adapter = Read-ProjectFile 'static/tac/js/jiapu-tac-adapter.js'
$component = Read-ProjectFile 'components/TacVerification.vue'
$api = Read-ProjectFile 'utils/api.js'
$a01 = Read-ProjectFile 'pages/auth/a01-entry.vue'
$a04 = Read-ProjectFile 'pages/auth/a04-register.vue'
$a05 = Read-ProjectFile 'pages/auth/a05-reset-password.vue'
$vendorAssets = [ordered]@{
'static/tac/css/tac.css' = '181694518971a9f991d551b6a6e6dab2bf750f940bfc1673a158213f92eedbe0'
'static/tac/js/tac.min.js' = '505f73c051908d7b805db458990790be3e91f792c4001cec0ea9377d7d302b55'
'static/tac/images/icon.png' = '53e37ffc5bb81c46e6306b7d61d2eaa3de57e47ca6cdb8d5210022ae815c21c2'
'static/tac/images/dun.jpeg' = 'd9178a8c4cca36e3df6c3acd7e895ce9d34dd60ef3f1cf4a70c94d4324ed96e7'
}
foreach ($entry in $vendorAssets.GetEnumerator()) {
$absolutePath = Join-Path $root $entry.Key
if (-not (Test-Path -LiteralPath $absolutePath)) { throw "缺少用户提供的 TAC 资产:$($entry.Key)" }
$actualHash = (Get-FileHash -LiteralPath $absolutePath -Algorithm SHA256).Hash.ToLowerInvariant()
if ($actualHash -ne $entry.Value) { throw "用户提供的 TAC 供应商资产发生漂移:$($entry.Key)" }
}
foreach ($token in @('lang="renderjs"', './static/tac/css/tac.css', './static/tac/js/tac.min.js', './static/tac/js/jiapu-tac-adapter.js', 'window.TAC', 'window.CaptchaConfig', 'window.JiapuTacAdapter', 'xhr.status >= 200 && xhr.status < 300', '$ownerInstance.callMethod', 'activeXhr', 'xhr.timeout = 15000', 'xhr.ontimeout', 'xhr.abort()', 'config.doSendRequest = (options) => this.sendStrictRequest(options)', '@media (max-width: 340px)')) {
Require-Text -Content $component -Text $token -Label 'TacVerification'
}
Reject-Text -Content $component -Text 'config.doSendRequest = this.sendStrictRequest' -Label '失去 renderjs 实例上下文的传输函数'
$staleGuard = 'if (generation !== this.generation || !this.context || this.context.visible !== true) return;'
if ([regex]::Matches($component, [regex]::Escape($staleGuard)).Count -lt 2) {
throw 'TacVerification 必须在资源加载成功与失败两条分支都拒绝过期代次'
}
Require-Text -Content $adapter -Text 'payload: { track:' -Label 'TAC payload.track 适配器'
foreach ($unsafe in @('code === 200 && response.data', 'passed !== false', "validToken: 'mock", 'mock-valid-token')) {
Reject-Text -Content ($owner + $adapter + $component + $api) -Text $unsafe -Label 'TAC 安全合同'
}
foreach ($method in @('getCaptchaRequirement', 'sendSmsCode', 'loginWithPassword', 'loginWithSms', 'registerWithPassword', 'resetPassword')) {
Require-Text -Content $api -Text "async $method" -Label '认证 API'
}
$authApiMatch = [regex]::Match($api, '(?s)async getCaptchaRequirement.*?(?=\s+async getProfile)')
if (-not $authApiMatch.Success) { throw '无法定位唯一认证 API 区段' }
Reject-Text -Content $authApiMatch.Value -Text "return { success: true }" -Label '认证短信 mock'
Reject-Text -Content $authApiMatch.Value -Text "mock-session-token" -Label '认证会话 mock'
Require-Text -Content $api -Text 'sceneCode, phone, validToken' -Label '短信票据请求'
foreach ($token in @('const requestAuth =', 'strictEnvelope: true', 'expectedStatus: 200', "hasOwnProperty.call(data, 'data')")) {
Require-Text -Content $api -Text $token -Label '认证严格响应 owner'
}
foreach ($token in @('const REQUEST_TIMEOUT_MS = 15000', 'export const createRequestController', "error?.code === 'REQUEST_CANCELLED'", 'task?.abort?.()')) {
Require-Text -Content $api -Text $token -Label '认证请求生命周期 owner'
}
foreach ($page in @($a01, $a04, $a05)) {
Require-Text -Content $page -Text '<TacVerification' -Label '认证页面'
Require-Text -Content $page -Text 'normalizeTacSuccess' -Label '认证页面'
Reject-Text -Content $page -Text '滑动验证待接口接入' -Label '认证页面占位'
Reject-Text -Content $page -Text '行为验证接口待接入' -Label '认证页面占位'
Reject-Text -Content $page -Text 'verification-layer' -Label '旧假验证浮层'
Require-Text -Content $page -Text 'isAuthPhone' -Label '认证手机号唯一校验器'
Reject-Text -Content $page -Text '/^1\d{10}$/' -Label '认证页面重复手机号规则'
Require-Text -Content $page -Text 'submitting: submitting.value || sendingCode.value' -Label '认证异步返回守卫'
Require-Text -Content $page -Text '"block-submitting"' -Label '认证异步返回守卫'
Require-Text -Content $page -Text 'let pageActive = true' -Label '认证页面卸载代次'
Require-Text -Content $page -Text 'pageActive = false' -Label '认证页面卸载代次'
Require-Text -Content $page -Text 'createRequestController' -Label '认证页面可取消请求'
Require-Text -Content $page -Text 'isRequestCancelled' -Label '认证页面取消静默处理'
Require-Text -Content $page -Text 'authRequestController.abort()' -Label '认证页面离页中止请求'
if ([regex]::Matches($page, [regex]::Escape('{ requestController: authRequestController }')).Count -lt 3) {
throw '认证页面的策略、短信与最终提交必须都绑定页面请求控制器'
}
Require-Text -Content $page -Text 'const requestedPhone = phone.value' -Label '认证手机号请求快照'
Require-Text -Content $page -Text 'subject: requestedPhone' -Label '认证手机号请求快照'
Require-Text -Content $page -Text ':disabled="sendingCode || cooldownSeconds > 0 || submitting"' -Label '短信流程手机号锁定'
if ([regex]::Matches($page, [regex]::Escape('if (!pageActive) return;')).Count -lt 3) {
throw '认证页面必须在策略、短信与最终提交的异步回流前拒绝卸载后的旧结果'
}
}
foreach ($pageContract in @(
@{ Content = $a01; Loading = '登录中…' },
@{ Content = $a04; Loading = '注册中…' },
@{ Content = $a05; Loading = '提交中…' }
)) {
Require-Text -Content $pageContract.Content -Text '请求中…' -Label '认证短信加载文案'
Require-Text -Content $pageContract.Content -Text $pageContract.Loading -Label '认证提交加载文案'
}
foreach ($token in @('const blockBusyAction = () =>', 'if (blockBusyAction()) return;', 'const prepareForgotPassword = () => {', 'const prepareRegister = () => {')) {
Require-Text -Content $a01 -Text $token -Label 'A01 忙碌动作门禁'
}
foreach ($token in @('AUTH_TAC_SCENE.SMS_LOGIN', 'appApi.loginWithSms', '/^\d{4}$/', 'PASSWORD_TAC_BLOCKED_MESSAGE')) {
Require-Text -Content $a01 -Text $token -Label 'A01'
}
Reject-Text -Content $a01 -Text '/^\d{6}$/' -Label 'A01 六位短信码'
foreach ($token in @('AUTH_TAC_SCENE.REGISTER', 'v-model.trim="verificationCode"', 'appApi.registerWithPassword', 'calcMD5(password.value)', '/^\d{4}$/', 'goRoot("G01")')) {
Require-Text -Content $a04 -Text $token -Label 'A04'
}
foreach ($token in @('AUTH_TAC_SCENE.FORGOT_PASSWORD', 'appApi.resetPassword', 'calcMD5(password.value)', '/^\d{4}$/', 'await appApi.resetPassword')) {
Require-Text -Content $a05 -Text $token -Label 'A05'
}
Reject-Text -Content $a05 -Text '/^\d{6}$/' -Label 'A05 六位短信码'
Write-Output 'AUTH-TAC-INTEGRATION-CONTRACT PASS'
+128
View File
@@ -0,0 +1,128 @@
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$json = Get-Content -LiteralPath (Join-Path $root 'APP.openapi.json') -Raw -Encoding UTF8 | ConvertFrom-Json
$yaml = Get-Content -LiteralPath (Join-Path $root 'APP.openapi.yaml') -Raw -Encoding UTF8
$blockers = [System.Collections.Generic.List[string]]::new()
function Require-Operation {
param([string]$Path, [string]$Method)
$pathProperty = $json.paths.PSObject.Properties[$Path]
if ($null -eq $pathProperty -or $null -eq $pathProperty.Value.PSObject.Properties[$Method]) {
throw "认证源合同缺少操作:$($Method.ToUpperInvariant()) $Path"
}
if ($yaml -notmatch [regex]::Escape(" $Path`:") -or $yaml -notmatch "(?m)^ $Method`:\s*$") {
throw "YAML 认证源合同缺少操作:$($Method.ToUpperInvariant()) $Path"
}
return $pathProperty.Value.PSObject.Properties[$Method].Value
}
function Require-Schema {
param([string]$Name)
$property = $json.components.schemas.PSObject.Properties[$Name]
if ($null -eq $property) { throw "认证源合同缺少 schema$Name" }
if ($yaml -notmatch "(?m)^ $([regex]::Escape($Name)):\s*$") { throw "YAML 认证源合同缺少 schema$Name" }
return $property.Value
}
function Assert-ExactSet {
param([object[]]$Actual, [object[]]$Expected, [string]$Label)
$actualSet = @($Actual | ForEach-Object { [string]$_ } | Sort-Object -Unique)
$expectedSet = @($Expected | ForEach-Object { [string]$_ } | Sort-Object -Unique)
if (($actualSet -join ',') -ne ($expectedSet -join ',')) {
throw "$Label 漂移:actual=[$($actualSet -join ',')] expected=[$($expectedSet -join ',')]"
}
}
$operations = @(
@('/captcha/require', 'get'),
@('/captcha/challenge', 'post'),
@('/captcha/verify', 'post'),
@('/genealogy/app/auth/sms/code', 'post'),
@('/genealogy/app/auth/login', 'post'),
@('/genealogy/app/auth/login/sms', 'post'),
@('/genealogy/app/auth/register', 'post'),
@('/genealogy/app/auth/password/reset', 'put')
)
foreach ($entry in $operations) { [void](Require-Operation -Path $entry[0] -Method $entry[1]) }
$expectedVerificationScenes = @('APP_SMS_LOGIN', 'APP_REGISTER', 'APP_FORGOT_PASSWORD', 'APP_PHONE_CHANGE', 'APP_ACCOUNT_DEACTIVATE')
foreach ($schemaName in @('VerificationChallengeBody', 'VerificationCheckBody')) {
$schema = Require-Schema -Name $schemaName
Assert-ExactSet -Actual @($schema.properties.sceneCode.enum) -Expected $expectedVerificationScenes -Label "$schemaName.sceneCode"
}
$check = Require-Schema -Name 'VerificationCheckBody'
Assert-ExactSet -Actual @($check.properties.payload.oneOf.'$ref') -Expected @('#/components/schemas/TianaiVerificationPayload', '#/components/schemas/SystemImageVerificationPayload') -Label 'VerificationCheckBody.payload.oneOf'
$requiredCheckFields = @('tenantId', 'clientId', 'sceneCode', 'subject', 'challengeId', 'providerCode', 'captchaType', 'payload')
$missingCheckFields = @($requiredCheckFields | Where-Object { $_ -notin @($check.required) })
if ($missingCheckFields.Count -gt 0) {
$blockers.Add("VerificationCheckBody 未强制字段:$($missingCheckFields -join '、')")
}
if ($check.additionalProperties -ne $false) {
$blockers.Add('VerificationCheckBody 未设置 additionalProperties=false,服务端校验边界仍可接受未声明字段。')
}
if (@($check.oneOf).Count -lt 2 -or $check.discriminator.propertyName -ne 'providerCode') {
$blockers.Add('VerificationCheckBody 未用 providerCode 判别至少两个 oneOf 分支,providerCode、captchaType 与 payload 形态无法被原子约束。')
}
$tianaiPayload = Require-Schema -Name 'TianaiVerificationPayload'
Assert-ExactSet -Actual @($tianaiPayload.required) -Expected @('track') -Label 'TianaiVerificationPayload.required'
if ($tianaiPayload.properties.track.'$ref' -ne '#/components/schemas/TianaiCaptchaTrack') { throw '天爱校验载荷必须唯一包装为 payload.track' }
if ($tianaiPayload.additionalProperties -ne $false) {
$blockers.Add('TianaiVerificationPayload 未设置 additionalProperties=false,历史直传字段仍可能绕过 payload.track 约束。')
}
$systemImagePayload = Require-Schema -Name 'SystemImageVerificationPayload'
if ($systemImagePayload.additionalProperties -ne $false) {
$blockers.Add('SystemImageVerificationPayload 未设置 additionalProperties=false,系统图形验证码载荷边界未闭合。')
}
$track = Require-Schema -Name 'TianaiCaptchaTrack'
Assert-ExactSet -Actual @($track.required) -Expected @('bgImageWidth', 'bgImageHeight', 'startTime', 'stopTime', 'trackList') -Label 'TianaiCaptchaTrack.required'
if ($track.properties.trackList.minItems -ne 1) { throw '天爱行为轨迹不得为空' }
$smsCode = Require-Schema -Name 'SmsCodeBody'
Assert-ExactSet -Actual @($smsCode.required) -Expected @('clientId', 'grantType', 'tenantId', 'sceneCode', 'phone', 'validToken') -Label 'SmsCodeBody.required'
if ($smsCode.additionalProperties -ne $false) { throw 'SmsCodeBody 必须拒绝历史供应商字段' }
$expectedPublicSmsScenes = @('APP_SMS_LOGIN', 'APP_REGISTER', 'APP_FORGOT_PASSWORD', 'APP_ACCOUNT_DEACTIVATE')
$actualPublicSmsScenes = @($smsCode.properties.sceneCode.enum | ForEach-Object { [string]$_ } | Sort-Object -Unique)
$expectedPublicSmsScenes = @($expectedPublicSmsScenes | Sort-Object -Unique)
if (($actualPublicSmsScenes -join ',') -ne ($expectedPublicSmsScenes -join ',')) {
$blockers.Add('公共 SmsCodeBody.sceneCode 必须删除 APP_PHONE_CHANGE;换绑发码只能由需要 SaToken 的专用 /auth/phone/sms/code operation 持有。')
}
$smsSecretProperty = $json.components.schemas.PSObject.Properties['SmsCodeSecret']
if ($null -eq $smsSecretProperty) {
$blockers.Add('缺少全认证场景共用的 SmsCodeSecret;当前四位码必须原子升级为严格六位 ASCII 数字,不能保留 4/6 双接受。')
} else {
$smsSecret = $smsSecretProperty.Value
if ($smsSecret.type -ne 'string' -or $smsSecret.writeOnly -ne $true -or
[int]$smsSecret.minLength -ne 6 -or [int]$smsSecret.maxLength -ne 6 -or
[string]$smsSecret.pattern -ne '^[0-9]{6}$' -or $smsSecret.example) {
$blockers.Add('SmsCodeSecret 必须是无示例、保留前导零的 writeOnly 六位 ASCII 数字字符串。')
}
}
foreach ($schemaName in @('SmsLoginBody', 'PasswordRegisterBody', 'PasswordResetBody')) {
$schema = Require-Schema -Name $schemaName
$actualRef = [string]$schema.properties.smsCode.'$ref'
if ($actualRef -ne '#/components/schemas/SmsCodeSecret') {
$blockers.Add("$schemaName.smsCode 必须引用唯一 SmsCodeSecret,禁止继续内联四位码或接受双长度。")
}
}
$passwordLogin = Require-Schema -Name 'PasswordLoginBody'
$passwordFields = @($passwordLogin.properties.PSObject.Properties.Name)
$passwordRequired = @($passwordLogin.required)
if ('validToken' -notin $passwordFields -or 'validToken' -notin $passwordRequired) {
$blockers.Add('PasswordLoginBody 未定义并强制消费 validToken,密码登录无法形成服务端 TAC 闭环,客户端先滑后登录仍可被绕过。')
}
if ($blockers.Count -gt 0) {
$details = $blockers | ForEach-Object { "- $_" }
throw (@(
'AUTH-TAC-OPENAPI-CONTRACT BLOCKED'
$details
'- 关闭条件:后端同步更新同版本 JSON/YAML;校验体按 providerCode 严格区分供应商并拒绝缺字段/多余字段;密码登录原子消费绑定租户、客户端、场景、手机号的一次性 TAC 票据;全活动短信码原子迁移为六位;APP_PHONE_CHANGE 改由专用受保护发码 operation;全部部署到 HTTPS 环境并通过反向用例。'
) -join [Environment]::NewLine)
}
Write-Output 'AUTH-TAC-OPENAPI-CONTRACT PASS'
+132
View File
@@ -0,0 +1,132 @@
"use strict";
const assert = require("assert");
const fs = require("fs");
const path = require("path");
const toDataModuleUrl = (source) =>
`data:text/javascript;base64,${Buffer.from(source).toString("base64")}`;
const run = async () => {
const source = fs.readFileSync(
path.join(__dirname, "../utils/auth-verification.js"),
"utf8",
);
const {
AUTH_TAC_SCENE,
PASSWORD_TAC_BLOCKED_MESSAGE,
isAuthPhone,
assertSmsCode,
normalizeCaptchaRequirement,
createTacRenderContext,
normalizeTacSuccess,
} = await import(toDataModuleUrl(source));
assert.deepStrictEqual(
{ ...AUTH_TAC_SCENE },
{
SMS_LOGIN: "APP_SMS_LOGIN",
REGISTER: "APP_REGISTER",
FORGOT_PASSWORD: "APP_FORGOT_PASSWORD",
},
"认证 TAC 场景必须由受保护 OpenAPI 的唯一枚举拥有",
);
assert.match(PASSWORD_TAC_BLOCKED_MESSAGE, /服务端|安全验证|验证码登录/);
assert.strictEqual(isAuthPhone("13800138000"), true);
for (const invalid of ["", "12800138000", "1380013800", "138001380000", 13800138000, null]) {
assert.strictEqual(isAuthPhone(invalid), false, `非法认证手机号被放行:${invalid}`);
}
assert.strictEqual(assertSmsCode("1234"), "1234");
for (const invalid of ["", "123", "12345", "12a4", 1234, null]) {
assert.throws(() => assertSmsCode(invalid), /4 位短信验证码/);
}
const requirement = normalizeCaptchaRequirement(
{
required: true,
providerCode: "TIANAI",
captchaType: "SLIDER",
sceneCode: AUTH_TAC_SCENE.REGISTER,
ttlSeconds: 300,
},
AUTH_TAC_SCENE.REGISTER,
);
assert.deepStrictEqual(requirement, {
required: true,
providerCode: "TIANAI",
captchaType: "SLIDER",
sceneCode: AUTH_TAC_SCENE.REGISTER,
ttlSeconds: 300,
});
assert.throws(
() => normalizeCaptchaRequirement({ ...requirement, required: false }, AUTH_TAC_SCENE.REGISTER),
/未要求行为验证|票据/,
);
assert.throws(
() => normalizeCaptchaRequirement({ ...requirement, sceneCode: AUTH_TAC_SCENE.SMS_LOGIN }, AUTH_TAC_SCENE.REGISTER),
/场景/,
);
assert.throws(
() => normalizeCaptchaRequirement({ ...requirement, providerCode: "OTHER" }, AUTH_TAC_SCENE.REGISTER),
/TIANAI/,
);
assert.throws(
() => normalizeCaptchaRequirement({ ...requirement, captchaType: "math" }, AUTH_TAC_SCENE.REGISTER),
/验证码类型/,
);
const context = createTacRenderContext({
requestId: "register-1",
baseUrl: "https://backend-api.ddxcjp.cn/",
clientId: "client-1",
tenantId: "000000",
sceneCode: AUTH_TAC_SCENE.REGISTER,
subject: "13800138000",
requirement,
});
assert.deepStrictEqual(context, {
requestId: "register-1",
baseUrl: "https://backend-api.ddxcjp.cn",
challengeUrl: "https://backend-api.ddxcjp.cn/captcha/challenge",
verifyUrl: "https://backend-api.ddxcjp.cn/captcha/verify",
clientId: "client-1",
tenantId: "000000",
sceneCode: AUTH_TAC_SCENE.REGISTER,
subject: "13800138000",
providerCode: "TIANAI",
captchaType: "SLIDER",
});
assert.throws(
() => createTacRenderContext({ ...context, baseUrl: "http://backend-api.ddxcjp.cn", requirement }),
/HTTPS/,
);
assert.throws(
() => createTacRenderContext({ ...context, subject: "1380013800", requirement }),
/手机号/,
);
assert.deepStrictEqual(
normalizeTacSuccess(
{ requestId: "register-1", validToken: "ticket-1", expireSeconds: 300 },
"register-1",
),
{ requestId: "register-1", validToken: "ticket-1", expireSeconds: 300 },
);
assert.throws(
() => normalizeTacSuccess({ requestId: "stale", validToken: "ticket-1" }, "register-1"),
/已过期|不匹配/,
);
assert.throws(
() => normalizeTacSuccess({ requestId: "register-1", validToken: "" }, "register-1"),
/票据/,
);
process.stdout.write("AUTH-VERIFICATION-RUNTIME-SMOKE PASS\n");
};
run().catch((error) => {
process.stderr.write(`${error.stack || error.message}\n`);
process.exit(1);
});
+57 -8
View File
@@ -1,4 +1,4 @@
$ErrorActionPreference = 'Stop'
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$requiredFiles = @('utils/config.js', 'utils/session.js', 'utils/genealogy-context.js', 'utils/api.js', 'pages/genealogy/g03-create-genealogy.vue', 'pages/family/f04-article-list.vue', 'pages/family/f02-publish-feed.vue')
@@ -23,7 +23,7 @@ foreach ($method in @('getCurrentGenealogyId', 'setCurrentGenealogyId', 'clearCu
}
$api = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'utils/api.js')
foreach ($method in @('unwrapResponse', 'sendSmsCode', 'loginWithPassword', 'loginWithSms')) {
foreach ($method in @('unwrapResponse', 'getCaptchaRequirement', 'sendSmsCode', 'loginWithPassword', 'loginWithSms', 'registerWithPassword', 'resetPassword')) {
if ($api -notmatch [regex]::Escape($method)) {
throw "Missing auth API method: $method"
}
@@ -53,11 +53,46 @@ if ($pages -match 'pages/genealogy/g04-first-ancestor') {
throw 'G04 first-person route must be merged into G03'
}
$createFlow = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/genealogy/g03-create-genealogy.vue')
foreach ($token in @('step=ancestor', 'submitAncestor', 'genealogyId')) {
foreach ($token in @('currentStep.value = "ancestor"', 'submitAncestor', 'genealogyId')) {
if ($createFlow -notmatch [regex]::Escape($token)) {
throw "Missing G03 first-person flow: $token"
}
}
if ($config -notmatch "mode:\s*'mock'" -or $config -notmatch "baseUrl:\s*'https://backend-api\.ddxcjp\.cn'") {
throw 'Runtime config must retain mock isolation while owning the new HTTPS backend base URL'
}
if ($config -match '182\.61\.18\.23|http://backend-api\.ddxcjp\.cn|https://backend-api\.ddxcjp\.cn/') {
throw 'Runtime config retains an obsolete, insecure or trailing-slash backend URL'
}
if (-not $api.Contains('loginResult?.access_token') -or $api -match 'loginResult\?\.(token|accessToken|tokenValue)') {
throw 'Session adapter must consume only the current AppLoginVo.access_token contract'
}
if ($api -match 'mock-session-token|mockResult') { throw '认证链路不得生成本地伪会话或伪票据' }
if (([regex]::Matches($api, "return saveLogin\(result\)")).Count -ne 3) {
throw '密码登录、短信登录与注册必须共用唯一 AppLoginVo 会话适配器'
}
if ($api -notmatch 'import \{ hasRemoteConfig, resolveRuntimeMode, runtimeConfig \}' -or ([regex]::Matches($api, 'requireRemoteAuth\(\)')).Count -ne 6) {
throw '六个认证传输必须通过共享运行模式解析器失败关闭'
}
if ($api -match 'if \(isMockMode\(\)\)') {
throw 'Auth transports must not treat every non-mock mode as remote'
}
foreach ($token in @(
'async auditApplication(genealogyId, applicationId, { status, auditRemark = '''' })',
'data: { status, auditRemark }',
'payload.relationDesc',
'payload.applyReason'
)) {
if (-not $api.Contains($token)) { throw "G-series API adapter contract missing: $token" }
}
if ($api.Contains('data: { approved }') -or $api.Contains('payload.message')) {
throw 'G-series API adapter retains the deleted approved/message payload contract'
}
if ($api -notmatch '!/\^\[12\]\$/\.test\(status\)' -or $api -notmatch 'Array\.from\(auditRemark\)\.length > 500') {
throw 'G-series audit adapter does not enforce the OpenAPI status pattern or remark length'
}
if ($createFlow -match 'step=ancestor|query\?\.step') { throw 'G03 first-person flow must not restore the retired route step contract' }
if ($createFlow -match 'createPerson') { throw 'G03 must not retain the removed createPerson entrypoint' }
foreach ($route in @('pages/family/f04-article-list', 'pages/family/f02-publish-feed')) {
if ($pages -notmatch [regex]::Escape($route)) {
@@ -74,8 +109,18 @@ foreach ($pageFile in @('pages/genealogy/g05-genealogy-overview.vue', 'pages/tre
if ($page -notmatch 'const\s+genealogyId\s*=\s*ref\(["'']["'']\)' -or $page -notmatch 'query\.genealogyId') {
throw 'G05 must own its explicit genealogyId route context'
}
} elseif ($page -notmatch 'genealogyContext') {
throw "Missing genealogy context in $pageFile"
} elseif ($pageFile -eq 'pages/tree/t01-tree-overview.vue') {
if ($page -notmatch 'genealogyContext') {
throw 'T01 must retain the selected genealogy fallback until its domain-data phase'
}
} else {
if ($page -notmatch 'const\s+genealogyId\s*=\s*ref\(["'']["'']\)' -or
$page -notmatch 'const\s+personId\s*=\s*ref\(["'']["'']\)' -or
$page -notmatch 'query\.genealogyId' -or
$page -notmatch 'query\.personId' -or
$page -match 'genealogyContext') {
throw 'T03 must use its validated genealogyId/personId route identity without mutable global fallback'
}
}
}
@@ -93,9 +138,12 @@ foreach ($pageFile in @('pages/genealogy/g10-application-review.vue', 'pages/not
}
$applications = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/genealogy/g10-application-review.vue')
if ($applications -notmatch 'genealogyContext') {
throw 'Missing genealogy context in applications page'
foreach ($token in @('const genealogyId = ref("")', 'genealogyId.value = String(query.genealogyId || "")', 'getGenealogyFixtureAccess(genealogyId.value)')) {
if ($applications -notmatch [regex]::Escape($token)) {
throw "Applications page must use its explicit fail-closed route context: $token"
}
}
if ($applications -match 'genealogyContext') { throw 'Applications page must not bypass its explicit route context through global genealogy context' }
$notifications = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/notification/n01-message-center.vue')
foreach ($method in @('openNotice', 'markAllRead', 'notice-state--list')) {
@@ -104,11 +152,12 @@ foreach ($method in @('openNotice', 'markAllRead', 'notice-state--list')) {
if ($notifications -match "@/utils/api\.js|\bappApi\b") { throw 'Notification design page must not connect the API layer' }
$family = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/family/f01-family-feed.vue')
foreach ($token in @('genealogyContext', 'openSection', 'pages/family/f04-article-list', 'pages/family/f07-album-list', 'pages/records/r05-ritual-list', 'pages/records/r10-memo-list', 'pages/family/f02-publish-feed')) {
foreach ($token in @('genealogyContext', 'openSection', 'articles: "F04"', 'albums: "F07"', 'rituals: "R05"', 'memos: "R10"', 'openPage("F02"')) {
if ($family -notmatch [regex]::Escape($token)) {
throw "Missing family content flow: $token"
}
}
if ($family -match '/pages/') { throw 'F01 family content flow must use the unique navigation registry' }
$profile = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/profile/m01-profile-home.vue')
foreach ($token in @('profile-state--ready', 'menuItems', 'toProfile')) {
+498 -9
View File
@@ -38,11 +38,21 @@ if ($designDocument -match '阶段 0 正在执行') {
if ($mappingDocument -match '当前阶段:阶段 0——迁移现行页面与业务事实') {
throw '接口与页面映射总表仍把阶段 0 迁移写成当前任务'
}
if ($mappingDocument -notmatch '阶段 0 已完成;导航栈与 T01 专项设计已完成三人终审,业务代码尚未实施') {
throw '接口与页面映射总表缺少阶段 0 完成、书面设计收口及业务代码未实施的准确边界'
if ($mappingDocument -notmatch '家谱工作区、G03 原子创建、M06 帮助、个人资料读写、通知读写、M10 服务端退出、M04 密码凭证与 M05 手机号换绑三人审查及 OpenAPI 红灯已完成' -or
$mappingDocument -notmatch 'T01、TAC、工作区、G03、帮助、profile、通知、logout、password 与 phone-change 后端接口门禁当前红灯') {
throw '接口与页面映射总表没有登记导航、TAC 客户端、后端红灯与 MuMu 边界'
}
if ($overviewDocument -notmatch '下一步从导航失败测试开始') {
throw '项目总览没有写明当前精确实施入口'
if ($designDocument -notmatch '导航任务 1—10 的静态实施和零债务门禁已经完成' -or
$designDocument -notmatch '当前 SFC 分段词法扫描的迁移债务已经清零' -or
$designDocument -notmatch 'MIGRATION-DEBT=0') {
throw '治理设计没有同步导航静态零债务结果'
}
if ($mappingDocument -notmatch '实际 `64/64` 个 Vue 文件') {
throw '接口与页面映射总表没有同步退役通用页面后的响应式覆盖实数'
}
if ($overviewDocument -notmatch 'G01/G05、G03、M06、M01/M02/M03 个人资料读写、N01/N02/M01/G01 通知域、M10 退出域、M04 密码凭证域与 M05 换绑域已完成三人接口审查和失败门禁' -or
$overviewDocument -notmatch '继续审查下一个不依赖现有红灯的业务域') {
throw '项目总览没有写明领域上下文与 M07 完成后的当前精确实施入口'
}
if ($overviewDocument -notmatch 'API-T01-001') {
throw '项目总览没有登记 T01 后端接口门禁'
@@ -53,14 +63,32 @@ if ($overviewDocument -match '当前 MuMu[^\r\n]*在线') {
if ($overviewDocument -notmatch '阶段 0 验收时的 MuMu 证据') {
throw '项目总览缺少带时间边界的 MuMu 验收证据'
}
$visualDocument = $documentContents['docs/视觉资产与构建基线.md']
if ($visualDocument -notmatch '`static/tac/` 当前共 5 个文件' -or
$visualDocument -notmatch '4 个后端提供的供应商文件' -or
$visualDocument -notmatch '`static/tac/js/jiapu-tac-adapter.js`' -or
$visualDocument -notmatch 'tests/auth-tac-integration-contract.ps1') {
throw '视觉资产基线没有登记 TAC 供应商资产、项目适配器及唯一校验入口'
}
if ($mappingDocument -notmatch 'A01、A04、A05 已接入同一个 `TacVerification`' -or
$mappingDocument -notmatch '不能把本地滑动成功冒充服务端验证' -or
$mappingDocument -notmatch '密码登录入口保持不可用') {
throw '接口页面映射没有准确登记 A01/A04/A05 的 TAC 客户端状态与密码登录硬关闭'
}
if ($mappingDocument -notmatch '任务 5 实施前' -or $mappingDocument -notmatch '这只是历史视觉基线' -or $mappingDocument -notmatch '任务 4—6 的当前代码仍须.*MuMu 流程矩阵') {
throw '接口页面映射把历史 MuMu 证据越界成了当前代码验收'
}
# 导航设计已经三人终审,文档合同必须保护其所有权、根语义、公开方法和阶段边界,不能只检查“有一份计划”。
foreach ($owner in @('utils/navigation-routes.js', 'utils/navigation.js')) {
if ($designDocument -notmatch [regex]::Escape($owner) -or $planDocument -notmatch [regex]::Escape($owner)) {
throw "导航设计或实施计划缺少唯一所有者:$owner"
}
if (-not (Test-Path -LiteralPath (Join-Path $root $owner) -PathType Leaf)) {
throw "导航唯一所有者尚未真实落地:$owner"
}
}
foreach ($semanticMethod in @('openPage', 'replaceStep', 'goBack', 'returnTo', 'finishPage', 'goRoot')) {
foreach ($semanticMethod in @('openPage', 'goBack', 'returnTo', 'finishPage', 'goRoot')) {
if ($designDocument -notmatch "(?m)^$([regex]::Escape($semanticMethod))\(") {
throw "导航设计缺少公开语义方法:$semanticMethod"
}
@@ -86,14 +114,475 @@ if ($planDocument -notmatch '导航阶段允许只迁移 T01 的现有导航调
if ($planDocument -notmatch 'T03_CONTEXT_CONFLICT') {
throw '实施计划缺少 T03 跨家谱上下文冲突规则'
}
if ($planDocument -notmatch 'T03_STACK_CONFLICT') {
throw '实施计划缺少 T03 历史重复实例冲突规则'
}
if ($planDocument -notmatch 'returnTo\(routeKey, targetParams = \{\}\)' -or $planDocument -notmatch 'finishPage\(routeKey, targetParams, result\)') {
throw '实施计划没有锁定普通返回与唯一完成结果入口'
}
if ($planDocument -match 'returnTo\([^\)\r\n]*,\s*result\s*\)') {
throw '实施计划重新引入了 returnTo 携带流程结果的旧入口'
}
if ($planDocument -notmatch 'own enumerable data properties' -or $planDocument -notmatch 'WeakMap') {
throw '实施计划缺少严格数据属性快照或页面实例弱身份令牌合同'
}
$navigationFoundation = [regex]::Match(
$planDocument,
'(?s)### 任务 1:建立路由语义注册表.*?(?=### 任务 3:迁移共享页头、底栏并退役通用母版)'
).Value
if ([string]::IsNullOrWhiteSpace($navigationFoundation) -or $navigationFoundation -match '- \[ \]') {
throw '实施计划没有把已经验证的导航任务 1/2 精确标为完成'
}
if ($planDocument -notmatch 'M04 密码凭证任务 33、M05 手机号换绑任务 34 和 G03 原子创建任务 35 已完成三人审查及 OpenAPI 红灯' -or
$planDocument -notmatch '等待后端期间转向 G/F/R 下一域') {
throw '实施计划没有登记领域上下文与 M07 完成后的独立实施入口'
}
$taskThree = [regex]::Match(
$planDocument,
'(?s)### 任务 3:迁移共享页头、底栏并退役通用母版.*?(?=### 任务 4:迁移认证导航)'
).Value
if ([string]::IsNullOrWhiteSpace($taskThree) -or $taskThree -match '- \[ \] \*\*步骤 [123]') {
throw '实施计划没有把任务 3 的静态实施步骤精确标为完成'
}
if ($taskThree -notmatch 'MuMu 复核待执行' -or $taskThree -notmatch '39') {
throw '实施计划没有明确任务 3 的 MuMu 边界或剩余迁移债务'
}
$taskFour = [regex]::Match(
$planDocument,
'(?s)### 任务 4:迁移认证导航.*?(?=### 任务 5:迁移 G 系列导航)'
).Value
if ([string]::IsNullOrWhiteSpace($taskFour) -or $taskFour -match '- \[ \] \*\*步骤 [123]') {
throw '实施计划没有把任务 4 的静态实施步骤精确标为完成'
}
if ($taskFour -notmatch '- \[ \] \*\*步骤 4:在 MuMu 复核认证流程' -or $taskFour -notmatch '35') {
throw '实施计划没有明确任务 4 的 MuMu 边界或剩余迁移债务'
}
if ($taskFour -notmatch 'tests/navigation-flow-contract.ps1' -or $taskFour -match 'navigation-auth-flow-contract') {
throw '认证导航没有消费跨批次唯一流程合同'
}
$taskFive = [regex]::Match(
$planDocument,
'(?s)### 任务 5:迁移 G 系列导航.*?(?=### 任务 6:迁移 T 系列并实现 T03 单实例轨迹)'
).Value
if ([string]::IsNullOrWhiteSpace($taskFive) -or $taskFive -match '- \[ \] \*\*步骤 [1234]') {
throw '实施计划没有把任务 5 的静态实施步骤精确标为完成'
}
if ($taskFive -notmatch '- \[ \] \*\*步骤 5:完成 G 系列 MuMu 矩阵' -or $taskFive -notmatch '29 个文件') {
throw '实施计划没有明确任务 5 的 MuMu 边界或剩余迁移债务'
}
if ($taskFive -match 'finishPage\("G05"' -or $taskFive -match 'finishPage\("G09"') {
throw '实施计划重新引入了 G 系列本地预览的伪后端完成结果'
}
if ($taskFive -notmatch '未知值失败关闭' -or $taskFive -notmatch '每批 50 行渲染') {
throw '实施计划没有登记 G11/G12 的最终静态合同'
}
$taskSix = [regex]::Match(
$planDocument,
'(?s)### 任务 6:迁移 T 系列并实现 T03 单实例轨迹.*?(?=### 任务 7:迁移 F 系列导航)'
).Value
if ([string]::IsNullOrWhiteSpace($taskSix) -or $taskSix -match '- \[ \] \*\*步骤 [123]') {
throw '实施计划没有把任务 6 的静态实施步骤精确标为完成'
}
if ($taskSix -notmatch '- \[ \] \*\*步骤 4:完成 T 系列 MuMu 矩阵' -or $taskSix -notmatch '22 个页面/表单组件文件') {
throw '实施计划没有明确任务 6 的 MuMu 边界或剩余迁移债务'
}
if ($taskSix -match 'finishPage\(' -or $taskSix -match 'relative-created|member-updated|relationship-updated') {
throw '实施计划在 T 系列本地预览阶段伪造了服务端写成功结果'
}
foreach ($taskSixContract in @(
'本地预览',
'尚未提交服务器',
'`goBack()`',
'宿主页路由身份',
'页内活动成员',
'listTreeMemberFixtures(genealogyId)',
'findTreeMemberFixture(genealogyId, personId)',
'深拷贝快照',
'跨谱隔离',
'失败关闭',
'tests/tree-member-fixture-runtime-smoke.js',
'PowerShell `122/122`',
'Node 语法 `35/35`',
'纯 Node `7/7`'
)) {
if ($taskSix -notmatch [regex]::Escape($taskSixContract)) {
throw "实施计划缺少任务 6 最终合同:$taskSixContract"
}
}
$taskSeven = [regex]::Match(
$planDocument,
'(?s)### 任务 7:迁移 F 系列导航.*?(?=### 任务 8:迁移 R 系列导航)'
).Value
if ($planDocument -match 'assert\.deepEqual\(consumeNavigationResult\("F04"\),\s*\{\s*operation:\s*"article-created"') {
throw '实施计划仍保留已经废止的 F04 伪写结果示例'
}
if ([string]::IsNullOrWhiteSpace($taskSeven) -or $taskSeven -match '- \[ \] \*\*步骤 [12345]') {
throw '实施计划没有把任务 7 的静态实施步骤精确标为完成'
}
if ($taskSeven -notmatch '- \[ \] \*\*步骤 6:完成 F 系列 MuMu 矩阵' -or $taskSeven -notmatch '13 个页面/表单组件文件') {
throw '实施计划没有明确任务 7 的 MuMu 边界或剩余迁移债务'
}
foreach ($taskSevenContract in @(
'F01—F10',
'跨谱',
'WRITE_UNAVAILABLE',
'feed-created/article-created/article-updated/media-uploaded',
'PowerShell `122/122`',
'Node 语法 `36/36`',
'纯 Node `8/8`',
'MIGRATION-DEBT=13'
)) {
if ($taskSeven -notmatch [regex]::Escape($taskSevenContract)) {
throw "实施计划缺少任务 7 最终合同:$taskSevenContract"
}
}
$taskEight = [regex]::Match(
$planDocument,
'(?s)### 任务 8:迁移 R 系列导航.*?(?=### 任务 9)'
).Value
foreach ($taskEightContract in @(
'R03/R04 归属 `relative-records`',
'`giftId` 全量退役为 `relativeId`',
'`ritualId` 全量退役为 `ceremonyId`',
'R09 必须保持硬关闭',
'resultOperations',
'本地预览,尚未提交服务器',
'只读复合身份 owner',
'MuMu'
)) {
if ($taskEight -notmatch [regex]::Escape($taskEightContract)) {
throw "实施计划缺少任务 8 三方审查结论:$taskEightContract"
}
}
if ([string]::IsNullOrWhiteSpace($taskEight) -or $taskEight -match '- \[ \] \*\*步骤 [123456]') {
throw '实施计划没有把任务 8 的静态实施步骤精确标为完成'
}
if ($taskEight -notmatch '- \[ \] \*\*步骤 7:完成 R 系列 MuMu 矩阵' -or $taskEight -notmatch 'MIGRATION-DEBT=6') {
throw '实施计划没有明确任务 8 的 MuMu 边界或剩余迁移债务'
}
foreach ($taskEightVerification in @('PowerShell `122/122`', 'Node 语法 `37/37`', '纯 Node `9/9`')) {
if ($taskEight -notmatch [regex]::Escape($taskEightVerification)) {
throw "实施计划缺少任务 8 最新验证:$taskEightVerification"
}
}
$taskNine = [regex]::Match(
$planDocument,
'(?s)### 任务 9:迁移 N/M 系列与安全通知目标.*?(?=### 任务 10:关闭导航阶段)'
).Value
if ([string]::IsNullOrWhiteSpace($taskNine) -or $taskNine -match '- \[ \] \*\*步骤 [1234]') {
throw '实施计划没有把任务 9 静态实施步骤精确标为完成'
}
if ($taskNine -notmatch '- \[ \] \*\*步骤 5:完成 N/M 系列 MuMu 矩阵' -or $taskNine -notmatch 'MIGRATION-DEBT=1') {
throw '实施计划没有明确任务 9 的 MuMu 边界或最后一项导航债务'
}
$taskTen = [regex]::Match(
$planDocument,
'(?s)### 任务 10:关闭导航阶段.*?(?=---\s*## 第二阶段:T01 大规模世系树)'
).Value
if ([string]::IsNullOrWhiteSpace($taskTen) -or $taskTen -match '- \[ \] \*\*步骤 [12]') {
throw '实施计划没有把任务 10 的静态门禁步骤精确标为完成'
}
if ($taskTen -notmatch '- \[ \] \*\*步骤 3:执行 NAV-MUMU-01 至 NAV-MUMU-08' -or
$taskTen -notmatch 'MIGRATION-DEBT=0' -or
$taskTen -notmatch 'TreeMemberForm\.vue') {
throw '实施计划没有记录导航零债务、孤儿删除或 MuMu 待验边界'
}
$taskEleven = [regex]::Match(
$planDocument,
'(?s)### 任务 11:向后端提交规范图合同并建立接口门禁.*?(?=### 任务 12:实现新图的规范化与严格校验)'
).Value
if ([string]::IsNullOrWhiteSpace($taskEleven) -or
$taskEleven -match '- \[ \] \*\*步骤 [12]' -or
$taskEleven -notmatch '- \[ \] \*\*步骤 [34]') {
throw '实施计划没有精确登记 T01 门禁已落地、后端双导出仍待提供'
}
foreach ($taskElevenFact in @('LINEAGE-OPENAPI-CONTRACT BLOCKED', 'JSON/YAML 各缺四条操作和三个固定根模型', '平铺 query parameters 无法由 OpenAPI 静态证明')) {
if ($taskEleven -notmatch [regex]::Escape($taskElevenFact)) {
throw "任务 11 缺少门禁分层事实:$taskElevenFact"
}
}
if ($mappingDocument -notmatch '### 2\.12 R 系列线上接口与静态迁移边界') {
throw '接口与页面映射总表缺少 R 系列三方接口审查账本'
}
$taskEighteen = [regex]::Match(
$planDocument,
'(?s)### 任务 18:接入新接口、mock 和跨页变更版本.*?(?=### 任务 19:完成 T01 MuMu、性能与三人终审)'
).Value
foreach ($taskEighteenContract in @(
'pages/tree/t05-edit-member.vue',
'appApi.updateLineagePerson(genealogyId, memberId, payload, treeVersion)',
'T04/T05/T06 完成回流',
'genealogyId/personId/memberId',
'personId=A',
'memberId=B',
'hostPersonId',
'editedMemberId',
'禁止 `memberId || personId` 双读',
'parentParamMap` 仍只负责无历史时构造父页',
'同步收紧 `tests/navigation-flow-contract.ps1`'
)) {
if ($taskEighteen -notmatch [regex]::Escape($taskEighteenContract)) {
throw "任务 18 缺少 T05 双身份或原子合同迁移约束:$taskEighteenContract"
}
}
foreach ($retiredOwner in @('components/ModulePage.vue', 'data/page-catalog.js')) {
if ($combined -match [regex]::Escape($retiredOwner)) {
throw "当前权威文档不得把退役通用页面重新登记为 owner:$retiredOwner"
}
}
if ($combined -notmatch 'tests/retired-module-page-contract.ps1') {
throw '当前权威文档缺少通用母版退役防回归合同'
}
$navigationSource = Get-Content -Raw -Encoding UTF8 -LiteralPath (Join-Path $root 'utils/navigation.js')
$actualNavigationExports = @(
[regex]::Matches($navigationSource, '(?m)^export const ([A-Za-z][A-Za-z0-9]*)') |
ForEach-Object { $_.Groups[1].Value } |
Sort-Object
)
$expectedNavigationExports = @(
'buildRouteUrl',
'consumeNavigationResult',
'finishPage',
'goBack',
'goRoot',
'handleBackPress',
'openNoticeTarget',
'openPage',
'resolveBackAction',
'returnTo',
'runBackGuard'
) | Sort-Object
if (($actualNavigationExports -join ',') -ne ($expectedNavigationExports -join ',')) {
throw "导航网关公开导出面漂移:$($actualNavigationExports -join ', ')"
}
if ($navigationSource -match '(?m)^export\s+(const|function)\s+replaceStep\b' -or $designDocument -match '(?m)^replaceStep\(') {
throw '当前没有替换边,不得恢复公开 replaceStep 入口'
}
if ($mappingDocument -match '将在阶段 1.*确定' -or $mappingDocument -match '阶段 1 依赖') {
throw '接口映射总表仍把已收口导航或未来业务错误绑定为阶段 1 待定项'
}
# A04 已有精确 OpenAPI 证据:注册成功必须建立会话并进入 G01,不能退回并行的“注册后再登录”终点。
if ($mappingDocument -notmatch '成功建立登录态并进入 G01' -or $mappingDocument -notmatch '注册成功响应为 `LoginResult`') {
throw 'A04 文档没有同时锁定 LoginResult 与建立登录态后进入 G01'
if ($overviewDocument -notmatch '当前物理库存为 `140` 个 PowerShell 合同、`47` 个 Node 文件' -or
$overviewDocument -notmatch 'PowerShell `126/140` 通过' -or
$overviewDocument -notmatch 'Node 语法 `47/47` 通过' -or
$overviewDocument -notmatch '纯 Node 冒烟 `19/19` 通过' -or
$overviewDocument -notmatch 'Vue 脚本模块语法 `64/64` 通过') {
throw '项目总览没有登记当前测试库存与最新全量验证证据'
}
foreach ($completedDomainFact in @(
'appApi.submitFeedback',
'/genealogy/app/feedback',
'WRITE_UNAVAILABLE',
'feedbackContent',
'撤权',
'禁止静默',
'uncertain'
)) {
if ($overviewDocument -notmatch [regex]::Escape($completedDomainFact) -and
$mappingDocument -notmatch [regex]::Escape($completedDomainFact) -and
$planDocument -notmatch [regex]::Escape($completedDomainFact)) {
throw "当前文档没有登记领域上下文或 M07 完成事实:$completedDomainFact"
}
}
foreach ($workspaceGateFact in @(
'API-GENEALOGY-WORKSPACE-001',
'genealogy-workspace-openapi-contract.ps1',
'RListAppGenealogyVo',
'RAppGenealogyVo',
'canView',
'GENEALOGY-WORKSPACE-OPENAPI-CONTRACT BLOCKED'
)) {
if ($overviewDocument -notmatch [regex]::Escape($workspaceGateFact) -and
$mappingDocument -notmatch [regex]::Escape($workspaceGateFact) -and
$planDocument -notmatch [regex]::Escape($workspaceGateFact)) {
throw "当前文档没有登记家谱工作区门禁事实:$workspaceGateFact"
}
}
foreach ($helpGateFact in @(
'API-M06-001',
'help-center-openapi-contract.ps1',
'RListHelpArticleVo',
'HelpArticleVo',
'list-only',
'HELP-CENTER-OPENAPI-CONTRACT BLOCKED'
)) {
if ($overviewDocument -notmatch [regex]::Escape($helpGateFact) -and
$mappingDocument -notmatch [regex]::Escape($helpGateFact) -and
$planDocument -notmatch [regex]::Escape($helpGateFact)) {
throw "当前文档没有登记 M06 帮助门禁事实:$helpGateFact"
}
}
foreach ($profileGateFact in @(
'API-PROFILE-READ-001',
'profile-openapi-contract.ps1',
'RAppProfileVo',
'AppProfileVo',
'maskedPhone',
'PROFILE-OPENAPI-CONTRACT BLOCKED'
)) {
if ($overviewDocument -notmatch [regex]::Escape($profileGateFact) -and
$mappingDocument -notmatch [regex]::Escape($profileGateFact) -and
$planDocument -notmatch [regex]::Escape($profileGateFact)) {
throw "当前文档没有登记个人资料读取门禁事实:$profileGateFact"
}
}
foreach ($profileUpdateGateFact in @(
'API-PROFILE-UPDATE-001',
'profile-update-openapi-contract.ps1',
'AppProfileMergeUpdateBody',
'profileVersion',
'If-Match',
'PROFILE_VERSION_CHANGED',
'PROFILE-UPDATE-OPENAPI-CONTRACT BLOCKED'
)) {
if ($overviewDocument -notmatch [regex]::Escape($profileUpdateGateFact) -and
$mappingDocument -notmatch [regex]::Escape($profileUpdateGateFact) -and
$planDocument -notmatch [regex]::Escape($profileUpdateGateFact)) {
throw "当前文档没有登记个人资料写入门禁事实:$profileUpdateGateFact"
}
}
foreach ($notificationGateFact in @(
'API-NOTIFICATION-READ-001',
'API-NOTIFICATION-STATE-001',
'notification-read-openapi-contract.ps1',
'notification-read-state-openapi-contract.ps1',
'RListNotificationVo',
'RNotificationUnreadCount',
'generationordinal',
'NOTIFICATION-READ-OPENAPI-CONTRACT BLOCKED',
'NOTIFICATION-READ-STATE-OPENAPI-CONTRACT BLOCKED'
)) {
if ($overviewDocument -notmatch [regex]::Escape($notificationGateFact) -and
$mappingDocument -notmatch [regex]::Escape($notificationGateFact) -and
$planDocument -notmatch [regex]::Escape($notificationGateFact)) {
throw "当前文档没有登记通知读取或已读写入门禁事实:$notificationGateFact"
}
}
foreach ($logoutGateFact in @(
'API-LOGOUT-001',
'logout-openapi-contract.ps1',
'RLogoutRejected',
'TOKEN_CLIENT_MISMATCH',
'LOGOUT-OPENAPI-CONTRACT BLOCKED',
'logoutCoordinator'
)) {
if ($overviewDocument -notmatch [regex]::Escape($logoutGateFact) -and
$mappingDocument -notmatch [regex]::Escape($logoutGateFact) -and
$planDocument -notmatch [regex]::Escape($logoutGateFact)) {
throw "当前文档没有登记 M10 服务端退出门禁事实:$logoutGateFact"
}
}
foreach ($passwordChangeGateFact in @(
'API-PASSWORD-001',
'API-PASSWORD-005',
'password-change-openapi-contract.ps1',
'CurrentPasswordSecret',
'NewPasswordSecret',
'RPasswordChangeRejected',
'CREDENTIAL_VERSION_CONFLICT',
'credentialChangeInFlight',
'PASSWORD-CHANGE-OPENAPI-CONTRACT BLOCKED'
)) {
if ($overviewDocument -notmatch [regex]::Escape($passwordChangeGateFact) -and
$mappingDocument -notmatch [regex]::Escape($passwordChangeGateFact) -and
$planDocument -notmatch [regex]::Escape($passwordChangeGateFact)) {
throw "当前文档没有登记 M04 密码凭证门禁事实:$passwordChangeGateFact"
}
}
foreach ($phoneChangeGateFact in @(
'API-PHONE-001',
'API-PHONE-005',
'phone-change-openapi-contract.ps1',
'PhoneChangeSmsCodeBody',
'NewBoundPhone',
'SmsCodeSecret',
'RPhoneChangeRejected',
'STEP_UP_UNAVAILABLE',
'PHONE-CHANGE-OPENAPI-CONTRACT BLOCKED'
)) {
if ($overviewDocument -notmatch [regex]::Escape($phoneChangeGateFact) -and
$mappingDocument -notmatch [regex]::Escape($phoneChangeGateFact) -and
$planDocument -notmatch [regex]::Escape($phoneChangeGateFact)) {
throw "当前文档没有登记 M05 手机号换绑门禁事实:$phoneChangeGateFact"
}
}
foreach ($g03BootstrapGateFact in @(
'API-G03-001',
'API-G03-005',
'g03-bootstrap-openapi-contract.ps1',
'AppGenealogyBootstrapBody',
'GenealogyBootstrapOperationKey',
'GenealogyAccessPreset',
'GenealogyRegionCode',
'FAILED_NO_COMMIT',
'x-bootstrap-root-editable-fields',
'x-state-transitions',
'x-domain-effects=NONE',
'任意精度',
'G03-BOOTSTRAP-OPENAPI-CONTRACT BLOCKED',
'g03-bootstrap-client-release-gate.ps1',
'G03-BOOTSTRAP-CLIENT-RELEASE BLOCKED',
'openapi-yaml-json-parity-runtime-smoke.js',
'/genealogy/app/region/search',
'GET 必须纯读',
'fatal/quarantined',
'家谱工作区读取门禁',
'If-Match、版本/CAS',
'receipt→`/mine` cache→context→G05'
)) {
if ($overviewDocument -notmatch [regex]::Escape($g03BootstrapGateFact) -and
$designDocument -notmatch [regex]::Escape($g03BootstrapGateFact) -and
$mappingDocument -notmatch [regex]::Escape($g03BootstrapGateFact) -and
$planDocument -notmatch [regex]::Escape($g03BootstrapGateFact)) {
throw "当前文档没有登记 G03 原子创建门禁事实:$g03BootstrapGateFact"
}
}
foreach ($liveOpenApiFact in @('https://backend-api.ddxcjp.cn/', '3.1.0', '722', '858', '507', '/captcha/challenge', 'validToken')) {
if ($overviewDocument -notmatch [regex]::Escape($liveOpenApiFact) -or $mappingDocument -notmatch [regex]::Escape($liveOpenApiFact)) {
throw "项目总览或接口映射缺少新线上 OpenAPI 事实:$liveOpenApiFact"
}
}
if ($mappingDocument -notmatch '密码登录体尚无票据字段' -or $mappingDocument -notmatch '没有任何 `/genealogy/app/v2/') {
throw '接口映射没有锁定 TAC 密码登录或 T01 v2 的线上硬缺口'
}
foreach ($lineageGateFact in @('LINEAGE-OPENAPI-CONTRACT BLOCKED', 'LineageGraphWindow/LineageOverview/LineageLocator')) {
if ($overviewDocument -notmatch [regex]::Escape($lineageGateFact) -and $mappingDocument -notmatch [regex]::Escape($lineageGateFact) -and $planDocument -notmatch [regex]::Escape($lineageGateFact)) {
throw "当前文档没有登记 T01 门禁事实:$lineageGateFact"
}
}
foreach ($authGateFact in @(
'AUTH-TAC-OPENAPI-CONTRACT BLOCKED',
'ANDROID-AUTH-ACCESSIBILITY-RELEASE BLOCKED',
'API-AUTH-TAC-001',
'API-AUTH-TAC-002',
'API-AUTH-TAC-003',
'API-AUTH-TAC-004',
'runtimeConfig.mode',
'mock',
'15 秒',
'APP_SMS_LOGIN',
'APP_REGISTER',
'APP_FORGOT_PASSWORD'
)) {
if ($overviewDocument -notmatch [regex]::Escape($authGateFact) -and $mappingDocument -notmatch [regex]::Escape($authGateFact) -and $planDocument -notmatch [regex]::Escape($authGateFact)) {
throw "当前文档没有登记认证门禁事实:$authGateFact"
}
}
if ($combined -notmatch '同一验证中心' -or
$combined -notmatch '不得.*无障碍.*绕过' -or
$combined -notmatch '非交互风控' -or
$combined -notmatch '已安全绑定设备' -or
$combined -notmatch '人工.*兜底' -or
$combined -notmatch 'POC') {
throw '当前文档没有锁定 TAC 可访问替代路径的统一票据、安全边界和待验证状态'
}
# A04 线上响应已经迁移,注册成功仍必须建立会话并进入 G01,不能保留旧令牌字段或“注册后再登录”终点。
if ($mappingDocument -notmatch '成功建立登录态并进入 G01' -or $mappingDocument -notmatch 'RAppLoginVo' -or $mappingDocument -notmatch 'AppLoginVo' -or $mappingDocument -notmatch 'access_token') {
throw 'A04 文档没有同时锁定线上登录响应与建立登录态后进入 G01'
}
if ($combined -match 'token/accessToken/tokenValue') { throw '当前权威文档仍把旧登录令牌字段写成目标合同' }
if ($designDocument -notmatch '正式终点不是“注册后再登录”' -or $planDocument -notmatch '不能先回 A01 再让用户重复登录') {
throw '设计或计划没有明确排除注册后再次登录的并行终点'
}
+1 -1
View File
@@ -134,7 +134,7 @@ const stressApplications = async (send, size) => {
const stressMedia = async (send, size) => {
await setSize(send, size)
await open(send, '/pages/family/f09-media-upload', '', '.media-upload-state--initial')
await open(send, '/pages/family/f09-media-upload', '?genealogyId=1001&albumId=201', '.media-upload-state--initial')
await valueOf(send, "document.querySelector('.media-primary-action')?.click()")
await waitFor(send, "document.querySelectorAll('.media-photo-tile').length === 4", 'F09 selected media did not render')
assert(await valueOf(send, `(() => {
@@ -0,0 +1,52 @@
const fs = require("node:fs");
const path = require("node:path");
const assert = require("node:assert/strict");
const root = path.resolve(__dirname, "..");
const modulePath = path.join(root, "utils", "discard-confirmation.js");
const loadModule = async () => {
const source = fs.readFileSync(modulePath, "utf8");
return import(`data:text/javascript;base64,${Buffer.from(source).toString("base64")}`);
};
const run = async () => {
const { createDiscardConfirmation } = await loadModule();
const visibility = [];
const controller = createDiscardConfirmation((visible) => {
visibility.push(visible);
});
const first = controller.request();
const repeated = controller.request();
assert.strictEqual(repeated, first, "重复请求必须复用同一个等待 Promise");
assert.deepEqual(visibility, [true], "重复请求不得重复打开确认框");
controller.cancel();
assert.equal(await first, false, "取消必须让等待者得到 false");
assert.deepEqual(visibility, [true, false], "取消必须关闭确认框");
const confirmed = controller.request();
controller.confirm();
assert.equal(await confirmed, true, "确认必须让等待者得到 true");
const disposed = controller.request();
controller.dispose();
assert.equal(await disposed, false, "页面卸载必须释放等待者并返回 false");
const afterDispose = controller.request();
assert.notStrictEqual(afterDispose, disposed, "释放后必须能建立新的确认周期");
controller.cancel();
assert.equal(await afterDispose, false);
assert.throws(
() => createDiscardConfirmation(null),
/setVisible 必须是函数/,
"必须拒绝无法同步可见状态的消费者",
);
console.log("DISCARD-CONFIRMATION-RUNTIME-SMOKE PASS");
};
run().catch((error) => {
console.error(error);
process.exitCode = 1;
});
+7 -27
View File
@@ -66,8 +66,8 @@
},
{
"file": "pages/family/f09-media-upload.vue",
"selector": ".media-photo-order, .media-photo-current, .media-photo-status",
"reason": "依附照片缩略图的顺序与状态角标"
"selector": ".media-photo-order, .media-photo-current",
"reason": "依附照片缩略图的顺序与当前预览角标"
},
{
"file": "pages/family/f09-media-upload.vue",
@@ -84,31 +84,6 @@
"selector": ".member-sheet__skin",
"reason": "固定底部详情抽屉内部的装饰框层"
},
{
"file": "pages/auth/a01-entry.vue",
"selector": ".feedback-toast",
"reason": "登录页面跨内容轻提示"
},
{
"file": "pages/auth/a01-entry.vue",
"selector": ".verification-layer",
"reason": "用户触发的验证码弹窗遮罩"
},
{
"file": "pages/auth/a04-register.vue",
"selector": ".feedback-toast",
"reason": "注册页面跨内容轻提示"
},
{
"file": "pages/auth/a05-reset-password.vue",
"selector": ".feedback-toast",
"reason": "重置密码页面跨内容轻提示"
},
{
"file": "pages/auth/a05-reset-password.vue",
"selector": ".success-layer",
"reason": "用户触发的重置成功弹窗遮罩"
},
{
"file": "pages/auth/a06-auth-status.vue",
"selector": ".recovery-layer",
@@ -149,6 +124,11 @@
"selector": ".app-dialog-layer",
"reason": "全屏弹窗遮罩层"
},
{
"file": "components/TacVerification.vue",
"selector": ".tac-layer",
"reason": "三个认证流程共用的真实滑动验证全屏遮罩"
},
{
"file": "components/AppToast.vue",
"selector": ".app-toast",
+7 -7
View File
@@ -13,23 +13,23 @@ function Assert-Contains([string]$source, [string]$expected, [string]$page) {
$contracts = [ordered]@{
'pages/family/f03-feed-detail.vue' = @(
'feedComments', 'commentDraft', 'submitComment', 'feed-state--expired',
'feedId', 'comment-state--saving', 'comment-state--error',
'/pages/family/f01-family-feed'
'genealogyId', 'feedId', 'comment-state--validating', 'comment-state--preview',
'findFamilyFeedFixture', 'returnTo("F01", { genealogyId: genealogyId.value })'
)
'pages/family/f04-article-list.vue' = @(
'articleCategories', 'filteredArticles', 'openArticle', 'createArticle',
'article-list-state--loading', 'article-list-state--empty', 'article-list-state--error',
'/pages/family/f05-article-detail?articleId=', '/pages/family/f06-article-editor?mode=create'
'listFamilyArticleFixtures', 'openPage(', 'genealogyId: genealogyId.value'
)
'pages/family/f05-article-detail.vue' = @(
'articleParagraphs', 'toggleFavorite', 'article-state--expired', 'backToArticles',
'articleParagraphs', 'disabled label=', 'article-state--expired', 'backToArticles',
'articleId', 'article-state--privacy', 'article-state--error',
'/pages/family/f04-article-list', '/pages/family/f06-article-editor?mode=edit&articleId='
'findFamilyArticleFixture', 'returnTo("F04", { genealogyId: genealogyId.value })'
)
'pages/family/f07-album-list.vue' = @(
'albums', 'openAlbum', 'createAlbum', 'album-state--empty',
'album-list-state--loading', 'album-list-state--error', 'albumNameDraft',
'/pages/family/f08-album-detail?albumId='
'listFamilyAlbumFixtures', 'localAlbumPreview', 'openPage('
)
}
@@ -39,7 +39,7 @@ foreach ($entry in $contracts.GetEnumerator()) {
foreach ($required in @('ModulePageBackground', 'PageHeader', 'AppButton', 'AppLoading')) {
Assert-Contains $source $required $entry.Key
}
foreach ($forbidden in @('import ModulePage from', 'uni.showToast', 'uni.showModal')) {
foreach ($forbidden in @('import ModulePage from', 'uni.showToast', 'uni.showModal', 'uni.navigateTo', 'uni.redirectTo', 'uni.reLaunch', '/pages/', 'finishPage(')) {
if ($source.Contains($forbidden)) { throw "$($entry.Key) retains forbidden implementation: $forbidden" }
}
if ($source -match '<ModulePage(?:\s|/|>)') { throw "$($entry.Key) retains forbidden ModulePage owner" }
+25 -10
View File
@@ -59,35 +59,50 @@ const run = async () => {
if (!(await valueOf(send, "document.querySelector('.app-toast')?.textContent.includes('请先写下动态内容')"))) {
throw new Error("F02 empty submit showed unexpected feedback");
}
await setInput(send, ".publish-form textarea", "这是一条本地动态预览。");
await click(send, ".publish-form .app-button");
await waitFor(send, "Boolean(document.querySelector('.publish-state--preview'))", "F02 did not enter honest local preview");
if (!(await valueOf(send, "document.querySelector('.publish-result')?.textContent.includes('尚未提交服务器')"))) {
throw new Error("F02 preview did not disclose that content was not published");
}
for (const size of [{ width: 320, height: 568 }, { width: 412, height: 915 }]) {
await send("Emulation.setDeviceMetricsOverride", { ...size, deviceScaleFactor: 1, mobile: true, screenWidth: size.width, screenHeight: size.height });
await open(send, "/pages/family/f04-article-list?count=50", ".article-card");
if ((await valueOf(send, "document.querySelectorAll('.article-card').length")) !== 50) throw new Error(`F04 did not render 50 articles at ${size.width}`);
await open(send, "/pages/family/f04-article-list?genealogyId=1001", ".article-card");
if ((await valueOf(send, "document.querySelectorAll('.article-card').length")) !== 3) throw new Error(`F04 did not render the scoped article owner at ${size.width}`);
if ((await valueOf(send, "document.documentElement.scrollWidth")) > size.width + 1) throw new Error(`F04 horizontal overflow at ${size.width}`);
await valueOf(send, "document.querySelector('.article-card:last-of-type').scrollIntoView()");
await open(send, "/pages/family/f07-album-list?count=30", ".album-card");
if ((await valueOf(send, "document.querySelectorAll('.album-card').length")) !== 30) throw new Error(`F07 did not render 30 albums at ${size.width}`);
await open(send, "/pages/family/f07-album-list?genealogyId=1001", ".album-card");
if ((await valueOf(send, "document.querySelectorAll('.album-card').length")) !== 3) throw new Error(`F07 did not render the scoped album owner at ${size.width}`);
if ((await valueOf(send, "document.documentElement.scrollWidth")) > size.width + 1) throw new Error(`F07 horizontal overflow at ${size.width}`);
}
await open(send, "/pages/family/f04-article-list", ".article-card");
await open(send, "/pages/family/f04-article-list?genealogyId=1001", ".article-card");
await click(send, ".article-card");
await waitFor(send, "location.hash.includes('/pages/family/f05-article-detail?articleId=101')", "F04 card did not open ID-driven F05");
await waitFor(send, "location.hash.includes('/pages/family/f05-article-detail?genealogyId=1001&articleId=101')", "F04 card did not open composite-identity F05");
await open(send, "/pages/family/f03-feed-detail?feedId=1", ".feed-comment-form textarea");
await open(send, "/pages/family/f03-feed-detail?genealogyId=1001&feedId=1", ".feed-comment-form textarea");
const before = await valueOf(send, "document.querySelectorAll('.feed-comment-card').length");
await setInput(send, ".feed-comment-form textarea", "愿家人岁岁平安,常聚常新。");
await click(send, ".feed-comment-form .app-button");
await waitFor(send, `document.querySelectorAll('.feed-comment-card').length === ${before + 1}`, "F03 comment was not appended");
await waitFor(send, "Boolean(document.querySelector('.comment-state--preview'))", "F03 did not enter comment preview");
if ((await valueOf(send, "document.querySelectorAll('.feed-comment-card').length")) !== before) throw new Error("F03 appended an unsubmitted comment");
if ((await valueOf(send, "document.querySelector('.feed-comment-form textarea').value")) !== "愿家人岁岁平安,常聚常新。") throw new Error("F03 cleared the unsubmitted comment draft");
await open(send, "/pages/family/f07-album-list", ".album-list > .app-button");
await open(send, "/pages/family/f07-album-list?genealogyId=1001", ".album-list > .app-button");
const albumCount = await valueOf(send, "document.querySelectorAll('.album-card').length");
await click(send, ".album-list > .app-button");
await waitFor(send, "Boolean(document.querySelector('.app-dialog-layer'))", "F07 create dialog did not open");
await setInput(send, ".album-dialog-field input", "清明祭祖影像");
await click(send, ".app-dialog__actions .app-button:last-child");
await waitFor(send, "document.querySelector('.album-card .album-card__copy').innerText.includes('清明祭祖影像')", "F07 created album was not added");
await waitFor(send, "document.querySelector('.album-local-preview')?.textContent.includes('清明祭祖影像')", "F07 local album preview did not render");
if ((await valueOf(send, "document.querySelectorAll('.album-card').length")) !== albumCount) throw new Error("F07 inserted an unsubmitted album into the official list");
await open(send, "/pages/family/f03-feed-detail?genealogyId=1002&feedId=1", ".feed-state--expired");
await open(send, "/pages/family/f05-article-detail?genealogyId=1002&articleId=101", ".article-state--expired");
await open(send, "/pages/family/f08-album-detail?genealogyId=1002&albumId=201", ".album-state--expired");
await open(send, "/pages/family/f09-media-upload?genealogyId=1002&albumId=201", ".media-upload-state--invalid");
process.stdout.write("F-BUSINESS-FLOW-RUNTIME-SMOKE PASS\n");
} finally {

Some files were not shown because too many files have changed in this diff Show More