61 lines
2.9 KiB
Vue
61 lines
2.9 KiB
Vue
<!-- 页面编号:F-04;用途:谱文入口。列表 item DTO 未声明时不展示本地文章。 -->
|
||
<template>
|
||
<view class="article-list-page" :class="`article-list-state--${listState}`">
|
||
<ModulePageBackground module="family" />
|
||
<view class="article-list-header"><PageHeader title="谱文" :action="hasValidContext ? '新建' : ''" @action="createArticle" /></view>
|
||
<view class="article-list-content">
|
||
<view class="article-list-state-card">
|
||
<text>{{ stateCopy.title }}</text>
|
||
<text>{{ stateCopy.copy }}</text>
|
||
<AppButton block :label="stateCopy.action" @click="handleStateAction" />
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</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 { goBack, openPage } from "@/utils/navigation.js";
|
||
|
||
const genealogyId = ref("");
|
||
const hasValidContext = ref(false);
|
||
const listState = ref("unavailable");
|
||
const stateCopy = computed(() => hasValidContext.value
|
||
? {
|
||
title: "谱文列表待后端字段合同",
|
||
copy: "列表接口只声明通用对象数组,没有文章 ID、分类、标题、摘要、作者或更新时间字段;页面已停止展示本地文章和本地筛选。",
|
||
action: "新建谱文",
|
||
}
|
||
: {
|
||
title: "谱文入口无效",
|
||
copy: "没有取得有效家谱标识,页面不会展示其他家谱内容。",
|
||
action: "返回上一页",
|
||
},
|
||
);
|
||
onLoad((query) => {
|
||
genealogyId.value = String(query?.genealogyId || "");
|
||
hasValidContext.value = /^[1-9]\d*$/.test(genealogyId.value);
|
||
listState.value = hasValidContext.value ? "unavailable" : "invalid";
|
||
});
|
||
const createArticle = () => hasValidContext.value
|
||
? openPage("F06", { genealogyId: genealogyId.value, mode: "create" }, "F04")
|
||
: Promise.resolve(false);
|
||
const handleStateAction = () => hasValidContext.value ? createArticle() : goBack();
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
|
||
.article-list-page { display: flex; min-height: 100vh; flex-direction: column; background: $paper; }
|
||
.article-list-header, .article-list-content { z-index: 1; }
|
||
.article-list-content { padding: 18rpx 24rpx 72rpx; }
|
||
.article-list-state-card { @include adaptive.adaptive-family-content; width: 100%; min-height: 340rpx; margin-top: 30rpx; padding: 78rpx 52rpx 50rpx; text-align: center; }
|
||
.article-list-state-card > text { display: block; }
|
||
.article-list-state-card > text:first-child { color: $ink; font-family: STKaiti, KaiTi, serif; font-size: 35rpx; font-weight: 700; }
|
||
.article-list-state-card > text:nth-child(2) { margin-top: 18rpx; color: $ink-muted; font-size: 24rpx; line-height: 1.65; }
|
||
.article-list-state-card .app-button { margin-top: 28rpx; }
|
||
</style>
|