Review changes batch 6 of 6

This commit is contained in:
2026-07-20 06:52:33 +08:00
parent db97d3da27
commit 5a31a75da0
160 changed files with 9206 additions and 572 deletions
+349 -53
View File
@@ -1,72 +1,368 @@
<!-- 页面编号T-07用途成员目录搜索空态与失败状态 -->
<template>
<view class="directory-page" :class="{ 'directory-state--list': directoryState === 'list', 'directory-state--empty': directoryState === 'empty', 'directory-state--error': directoryState === 'error' }">
<view
class="directory-page"
:class="{
'directory-state--loading': directoryState === 'loading',
'directory-state--list': directoryState === 'list',
'directory-state--empty': directoryState === 'empty',
'directory-state--error': directoryState === 'error',
}"
>
<ModulePageBackground module="tree" />
<view class="directory-page__header"><PageHeader title="成员目录" /></view>
<view class="directory-search">
<image src="/static/assets/modules/genealogy/opaque/g06-search-input-wide.png" mode="scaleToFill" />
<input v-model="keyword" placeholder="按姓名、字辈或支系查找" placeholder-class="directory-placeholder" @confirm="searchMembers" />
<text @click="searchMembers">查找</text>
<view class="directory-context">
<text class="directory-context__name">汤氏家谱</text>
<text class="directory-context__meta"
>主支 · {{ members.length }} 位成员</text
>
</view>
<view
v-if="directoryState === 'list' || directoryState === 'empty'"
class="directory-search"
>
<image
class="directory-search__frame"
src="/static/assets/modules/tree/transparent/t07-search-input-frame.png"
mode="scaleToFill"
/>
<input
v-model="keyword"
aria-label="成员搜索关键词"
placeholder="按姓名、字辈或支系查找"
placeholder-class="directory-placeholder"
@confirm="searchMembers"
/>
<view
class="directory-search__action"
role="button"
aria-label="查找成员"
hover-class="action-hover"
@click="searchMembers"
><text>查找</text></view
>
</view>
<view class="directory-content">
<template v-if="directoryState === 'list'">
<view class="directory-summary"><text>家谱成员</text><text>{{ filteredMembers.length }} · 按世代排列</text></view>
<view v-for="item in filteredMembers" :key="item.id" class="directory-card" @click="openMember(item)">
<image src="/static/assets/modules/genealogy/opaque/application-status-card.png" mode="scaleToFill" />
<view class="directory-card__copy"><text>{{ item.name }}</text><text> {{ item.generation }} · {{ item.generationName }} · {{ item.branch }}</text><text>{{ item.note }}</text></view>
<AppLoading
v-if="directoryState === 'loading'"
text="正在整理成员目录"
description="请稍候,正在读取成员与世代信息。"
/>
<template v-else-if="directoryState === 'list'">
<view class="directory-summary"
><text>家谱成员</text
><text>{{ filteredMembers.length }} · 按世代排列</text></view
>
<view
v-for="item in filteredMembers"
:key="item.id"
class="directory-card"
@click="openMember(item)"
>
<image
class="directory-card__frame"
src="/static/assets/modules/genealogy/transparent/list-slip-frame.png"
mode="scaleToFill"
/>
<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>
</view>
</view>
</template>
<view v-else class="directory-state-card">
<image src="/static/assets/modules/genealogy/opaque/application-status-card.png" mode="scaleToFill" />
<view><text>{{ directoryState === 'empty' ? '没有找到相关成员' : '成员目录暂不可用' }}</text><text>{{ directoryState === 'empty' ? '换一个姓名、字辈或支系关键词再试。' : '请从当前家谱重新进入,成员资料不会受到影响。' }}</text></view>
<image
src="/static/assets/modules/genealogy/transparent/list-slip-frame.png"
mode="scaleToFill"
/>
<view
><text>{{
directoryState === "empty" ? "没有找到相关成员" : "成员目录暂不可用"
}}</text
><text>{{
directoryState === "empty"
? "换一个姓名、字辈或支系关键词再试。"
: "请从当前家谱重新进入,成员资料不会受到影响。"
}}</text></view
>
</view>
<AppButton
v-if="directoryState === 'error'"
block
type="secondary"
label="重新查看"
@click="retryDirectory"
/>
</view>
</view>
</template>
<script setup>
import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import ModulePageBackground from '@/components/ModulePageBackground.vue'
import PageHeader from '@/components/PageHeader.vue'
const genealogyId = ref('')
const keyword = ref('')
const directoryState = ref('loading')
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 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: '资料待补充' }
]
{
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 filteredMembers = computed(() => {
const value = keyword.value.trim()
if (!value) return members
return members.filter((item) => `${item.name}${item.generationName}${item.branch}`.includes(value))
})
onLoad((query) => { genealogyId.value = query.genealogyId || ''; directoryState.value = query.state === 'empty' ? 'empty' : query.state === 'error' ? 'error' : 'list' })
const searchMembers = () => { directoryState.value = filteredMembers.value.length ? 'list' : 'empty' }
const openMember = (item) => uni.navigateTo({ url: `/pages/tree/t03-member-profile?genealogyId=${genealogyId.value}&personId=${item.id}` })
const value = keyword.value.trim();
if (!value) return members;
return members.filter((item) =>
`${item.name}${item.generationName}${item.branch}`.includes(value),
);
});
onLoad((query) => {
genealogyId.value = query.genealogyId || "";
directoryState.value =
query.state === "loading"
? "loading"
: query.state === "empty"
? "empty"
: query.state === "error"
? "error"
: "list";
});
const searchMembers = () => {
directoryState.value = filteredMembers.value.length ? "list" : "empty";
};
const retryDirectory = () => {
directoryState.value = "list";
};
const openMember = (item) =>
uni.navigateTo({
url: `/pages/tree/t03-member-profile?genealogyId=${genealogyId.value}&personId=${item.id}`,
});
</script>
<style scoped lang="scss">
.directory-page { position: relative; min-height: 100vh; overflow: hidden; background: $paper; }
.directory-page__header, .directory-search, .directory-content { position: relative; z-index: 2; }
.directory-search { width: calc(100% - 48rpx); height: 84rpx; margin: 20rpx auto 0; }
.directory-search image { position: absolute; inset: 0; width: 100%; height: 100%; }
.directory-search input { position: absolute; top: 0; right: 110rpx; bottom: 0; left: 26rpx; z-index: 1; height: 84rpx; color: $ink; font-size: 22rpx; line-height: 84rpx; }
.directory-search > text { position: absolute; top: 29rpx; right: 28rpx; z-index: 1; color: $brand-red; font-size: 22rpx; font-weight: 700; }
.directory-placeholder { color: #a79884; }
.directory-content { padding: 22rpx 24rpx 50rpx; }
.directory-summary { display: flex; justify-content: space-between; margin: 0 8rpx 18rpx; }
.directory-summary text:first-child { color: $ink; font-family: 'STKaiti', 'KaiTi', serif; font-size: 29rpx; font-weight: 700; }
.directory-summary text:last-child { color: $ink-muted; font-size: 20rpx; }
.directory-card, .directory-state-card { position: relative; width: 100%; height: calc((100vw - 24px) * .34286); min-height: 220rpx; margin-bottom: 16rpx; }
.directory-card > image, .directory-state-card > image { position: absolute; inset: 0; width: 100%; height: 100%; }
.directory-card__copy { position: absolute; inset: 20% 9%; z-index: 1; }
.directory-card__copy text { display: block; }
.directory-card__copy text:first-child { color: $ink; font-family: 'STKaiti', 'KaiTi', serif; font-size: 29rpx; font-weight: 700; }
.directory-card__copy text:nth-child(2) { margin-top: 10rpx; color: $ink-muted; font-size: 21rpx; }
.directory-card__copy text:last-child { margin-top: 9rpx; color: $brand-red; font-size: 19rpx; }
.directory-state-card { margin-top: 70rpx; }
.directory-state-card > view { position: absolute; inset: 24% 12%; z-index: 1; text-align: center; }
.directory-state-card text { display: block; }
.directory-state-card text:first-child { color: $ink; font-family: 'STKaiti', 'KaiTi', serif; font-size: 30rpx; font-weight: 700; }
.directory-state-card text:last-child { margin-top: 14rpx; color: $ink-muted; font-size: 21rpx; line-height: 1.5; }
.directory-page {
position: relative;
min-height: 100vh;
overflow-x: hidden;
overflow-y: auto;
background: $paper;
}
.directory-page__header,
.directory-context,
.directory-search,
.directory-content {
position: relative;
z-index: 2;
}
.directory-context {
display: flex;
align-items: baseline;
justify-content: space-between;
box-sizing: border-box;
padding: 22rpx 32rpx 0;
}
.directory-context__name {
color: $ink;
font-family: "STKaiti", "KaiTi", serif;
font-size: 32rpx;
font-weight: 700;
}
.directory-context__meta {
color: #62584c;
font-size: 24rpx;
font-weight: 500;
}
.directory-search {
width: calc(100% - 48rpx);
height: 44px;
margin: 20rpx auto 0;
}
.directory-search__frame {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
pointer-events: none;
}
.directory-search input {
position: absolute;
top: 0;
right: 110rpx;
bottom: 0;
left: 26rpx;
z-index: 1;
height: 44px;
color: $ink;
font-size: 26rpx;
line-height: 44px;
}
.directory-search__action {
position: absolute;
top: 0;
right: 8rpx;
z-index: 1;
display: flex;
min-width: 88rpx;
min-height: 44px;
align-items: center;
justify-content: center;
color: $brand-red;
font-size: 24rpx;
font-weight: 700;
}
.directory-placeholder {
color: #776956;
}
.directory-content {
padding: 22rpx 24rpx 50rpx;
}
.directory-summary {
display: flex;
justify-content: space-between;
margin: 0 8rpx 18rpx;
}
.directory-summary text:first-child {
color: $ink;
font-family: "STKaiti", "KaiTi", serif;
font-size: 29rpx;
font-weight: 700;
}
.directory-summary text:last-child {
color: $ink-muted;
font-size: 23rpx;
}
.directory-card {
position: relative;
display: flex;
width: 100%;
height: 196rpx;
align-items: center;
box-sizing: border-box;
margin-bottom: 16rpx;
padding: 18rpx 28rpx;
}
.directory-card__frame {
position: absolute;
inset: 0;
z-index: 0;
width: 100%;
height: 100%;
pointer-events: none;
}
.directory-card__copy {
position: relative;
z-index: 1;
display: flex;
min-width: 0;
flex: 1;
flex-direction: column;
justify-content: center;
}
.directory-card__name {
overflow: hidden;
color: $ink;
font-family: "STKaiti", "KaiTi", serif;
font-size: 31rpx;
font-weight: 700;
text-overflow: ellipsis;
white-space: nowrap;
}
.directory-card__meta {
overflow: hidden;
margin-top: 7rpx;
color: #62584c;
font-size: 24rpx;
text-overflow: ellipsis;
white-space: nowrap;
}
.directory-card__status {
align-self: flex-start;
margin-top: 8rpx;
padding: 2rpx 10rpx;
border: 1rpx solid rgba(174, 45, 36, 0.32);
color: $brand-red;
font-size: 22rpx;
line-height: 30rpx;
}
.directory-state-card {
position: relative;
width: 100%;
height: 220rpx;
margin-bottom: 16rpx;
}
.directory-state-card > image {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
}
.directory-state-card {
margin-top: 70rpx;
}
.directory-state-card > view {
position: absolute;
inset: 24% 12%;
z-index: 1;
text-align: center;
}
.directory-state-card text {
display: block;
}
.directory-state-card text:first-child {
color: $ink;
font-family: "STKaiti", "KaiTi", serif;
font-size: 30rpx;
font-weight: 700;
}
.directory-state-card text:last-child {
margin-top: 14rpx;
color: $ink-muted;
font-size: 24rpx;
line-height: 1.5;
}
.directory-content > .app-button {
margin: 20rpx auto 0;
}
@media screen and (max-width: 340px) {
.directory-card {
height: 192rpx;
padding-right: 22rpx;
padding-left: 22rpx;
}
.directory-card__name {
font-size: 29rpx;
}
.directory-card__meta {
font-size: 22rpx;
}
.directory-card__status {
font-size: 20rpx;
}
}
</style>