Files
console-dev/app/pages/home.htm.vue
T
cneicy 42dfead9cd
前端验证 / verify (push) Failing after 15m3s
feat(ui): 优化控制台响应式布局与视觉体验
- 统一页面标题、圆角、字体和响应式断点,调整暗色主题及图表配色
- 新增表格列标签插件,在窄屏下将表格转换为卡片布局,优化实例、订单、工单等列表展示
- 支持移动端点击订单行进入详情,并完善订单凭据的打印布局
- 在财务中心展示本月及累计消费,补充充值关闭时的提示
- 优化工单详情布局,将附件上传入口整合至富文本编辑器工具栏
- 调整实例操作按钮、SSH 密钥操作及安全菜单图标
- 为多个页面显式导入 definePageMeta,完善页面元数据声明
2026-11-07 00:09:57 +08:00

111 lines
3.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup>
/**
* 旧平台单点登录入口:路由守卫负责从 URL 提取并清理凭据;本页只发起服务端验证,支持失败后重试并在离页时取消待处理凭据。
*/
import { definePageMeta } from "#imports";
import { onBeforeUnmount, onMounted, ref } from "vue";
import { useHead, useRouter } from "#app";
import { NuxtLink } from "#components";
import Button from "primevue/button";
import Message from "primevue/message";
import { useAuth } from "~/lib/auth.js";
definePageMeta({ layout: "blank" });
useHead({
title: "正在进入会员中心",
meta: [{ name: "referrer", content: "no-referrer" }],
});
const auth = useAuth();
const router = useRouter();
const isVerifying = ref(false);
const verificationError = ref("");
let disposed = false;
// 通过会话核心验证已提取的旧平台登录,不再次读取 URL 中的敏感参数;只有组件仍存活时才进入首页。
async function verifyAndEnterConsole() {
if (isVerifying.value) return;
isVerifying.value = true;
verificationError.value = "";
try {
// The route guard owns credential extraction; this page never reads it from the URL.
await auth.verifyLegacyLogin();
if (!disposed) await router.replace("/");
} catch (error) {
if (!disposed) {
verificationError.value =
error instanceof Error ? error.message : "登录验证失败,请稍后重试。";
}
} finally {
if (!disposed) isVerifying.value = false;
}
}
onMounted(verifyAndEnterConsole);
onBeforeUnmount(() => {
disposed = true;
auth.cancelLegacyLogin();
});
</script>
<template>
<section
class="auth-card legacy-login"
:aria-busy="isVerifying"
aria-labelledby="legacy-login-title"
>
<span class="legacy-login-icon" aria-hidden="true">
<i :class="isVerifying ? 'pi pi-spin pi-spinner' : 'pi pi-user'" />
</span>
<h1 id="legacy-login-title">
{{ verificationError ? "暂时无法进入会员中心" : "正在进入会员中心" }}
</h1>
<Message v-if="verificationError" severity="error" :closable="false">
{{ verificationError }}
</Message>
<p v-else role="status">正在验证登录身份,请稍候…</p>
<div v-if="verificationError" class="legacy-login-actions">
<Button
label="重新验证"
icon="pi pi-refresh"
:loading="isVerifying"
@click="verifyAndEnterConsole"
/>
<NuxtLink to="/login" class="legacy-login-link">使用账号登录</NuxtLink>
</div>
</section>
</template>
<style scoped>
.legacy-login {
text-align: center;
}
.legacy-login-icon {
background: color-mix(in srgb, var(--p-primary-color) 10%, transparent);
width: 56px;
height: 56px;
color: var(--p-primary-color);
border-radius: 50%;
justify-content: center;
align-items: center;
margin-bottom: 20px;
font-size: 1.75em;
display: inline-flex;
}
.legacy-login p {
color: var(--p-text-muted-color);
margin: 0;
line-height: 1.6;
}
.legacy-login-actions {
flex-direction: column;
gap: 20px;
margin-top: 24px;
display: flex;
}
.legacy-login-link {
color: var(--p-primary-color);
text-underline-offset: 3px;
}
</style>