add About

This commit is contained in:
Timi
2026-09-10 17:06:11 +08:00
parent e508722326
commit 3e7fe5ce14
5 changed files with 351 additions and 2 deletions
+166
View File
@@ -0,0 +1,166 @@
<template>
<div class="about-page">
<section class="brand" v-entrance-transition>
<logo />
<h1 v-text="appName" />
<p v-text="appDescription" />
</section>
<t-cell-group title="协议" theme="card" v-entrance-transition="70">
<t-cell
v-for="item in agreementItemList"
:key="item.code"
:title="item.title"
arrow
hover
@click="openAgreement(item)"
>
<template #leftIcon>
<t-icon :name="item.icon" size="1.75rem" />
</template>
</t-cell>
</t-cell-group>
<footer class="footer" v-entrance-transition="140">
<p>技术支持:夜雨</p>
<p>Copyright © 2026 imyeyu.com</p>
</footer>
</div>
</template>
<script setup lang="ts">
import { type Setting, SettingAPI } from "timi-web-api";
import Logo from "@/pages/user/component/Logo.vue";
import { getErrorMessage } from "@/utils/error";
import { Message } from "@/utils/message";
type AgreementCode = "SERVICE_LICENSE" | "PRIVACY_LICENSE" | "OPEN_SOURCE_LICENSE";
type AgreementRouteName = "ServiceAgreement" | "PrivacyAgreement" | "OpenSourceAgreement";
type AgreementItem = {
code: AgreementCode;
icon: string;
routeName: AgreementRouteName;
title: string;
};
defineOptions({
name: "About"
});
const appName = "糕店客户管理";
const appDescription = "面向门店的客户、登记、积分与经营管理工具";
const router = useRouter();
const agreementItemList: AgreementItem[] = [
{
code: "SERVICE_LICENSE",
icon: "file-attachment",
routeName: "ServiceAgreement",
title: "服务协议"
},
{
code: "PRIVACY_LICENSE",
icon: "secured",
routeName: "PrivacyAgreement",
title: "隐私协议"
},
{
code: "OPEN_SOURCE_LICENSE",
icon: "code",
routeName: "OpenSourceAgreement",
title: "开源软件协议"
}
];
const settingMap = ref<Record<string, Setting>>({});
function getAgreementId(code: AgreementCode): string {
return settingMap.value[code]?.value?.trim() || "";
}
async function openAgreement(item: AgreementItem): Promise<void> {
const articleId = getAgreementId(item.code);
if (!articleId) {
Message.warning(`${item.title}暂未配置`);
return;
}
await router.push({
name: item.routeName,
params: {
id: articleId
}
});
}
async function loadSettings(): Promise<void> {
try {
settingMap.value = await SettingAPI.map("GAO_SYSTEM");
} catch (error) {
Message.error(getErrorMessage(error, "协议配置加载失败"));
}
}
onMounted(async () => {
await loadSettings();
});
</script>
<style scoped lang="less">
.about-page {
gap: 1rem;
display: flex;
padding: calc(var(--app-nav-height) + 1rem) 0 5rem;
flex-direction: column;
.brand {
padding: 1rem;
text-align: center;
.logo {
margin: 0 auto;
}
h1 {
margin: .875rem 0 .5rem;
color: #0f172a;
font-size: 1.5rem;
font-weight: 700;
}
p {
margin: 0;
color: #52607a;
font-size: .875rem;
line-height: 1.7;
}
}
.footer {
padding: 1.25rem 1rem calc(1rem + env(safe-area-inset-bottom, 0));
text-align: center;
p {
margin: 0;
color: #52607a;
font-size: .8125rem;
line-height: 1.8;
}
}
}
:global(html.theme-dark) {
.about-page {
.brand {
h1 {
color: #e2e8f0;
}
p {
color: #94a3b8;
}
}
.footer p {
color: #94a3b8;
}
}
}
</style>