完善桌面端交互体验与发布检查

This commit is contained in:
Cheng Zhou
2026-06-30 22:26:34 +08:00
parent 628ff8828b
commit c923f887a0
30 changed files with 2507 additions and 141 deletions
+54 -2
View File
@@ -100,6 +100,12 @@
<span class="tab-item active">账号登录</span>
</div>
<div v-if="showDesktopServerSettings" class="desktop-server-status">
<span class="desktop-server-label">服务器</span>
<code>{{ desktopServerUrl || "未配置" }}</code>
<RouterLink to="/desktop/server-settings" class="desktop-server-action">设置</RouterLink>
</div>
<!-- 退出通知 -->
<div v-if="logoutNotice" class="logout-notice" :class="'logout-notice--' + logoutNotice.type">
<div class="ln-icon">
@@ -249,7 +255,7 @@
</template>
<script setup lang="ts">
import { computed, reactive, ref, onMounted, watch } from "vue";
import { computed, reactive, ref, onMounted, onUnmounted, watch } from "vue";
import { useRouter } from "vue-router";
import { ElMessage, type FormInstance, type FormRules } from "element-plus";
// 从 package.json 读取版本号,构建时由 Vite 注入
@@ -260,7 +266,7 @@ import { useAuthStore } from "../store/auth";
import { useStudyStore } from "../store/study";
import { fetchEmailDomains } from "../api/auth";
import { TEXT, requiredMessage } from "../locales";
import { isTauriRuntime } from "../runtime";
import { DESKTOP_SERVER_URL_CHANGED_EVENT, getDesktopServerUrl, isTauriRuntime } from "../runtime";
import {
consumeLogoutReason,
LOGOUT_REASON_AUTH_EXPIRED,
@@ -292,6 +298,11 @@ const logoutNotice = ref<{ type: "info" | "warning"; title: string; message: str
const loginError = ref<{ title: string; message?: string } | null>(null);
const protocolSections = authProtocolSections;
const showDesktopServerSettings = isTauriRuntime();
const desktopServerUrl = ref(getDesktopServerUrl());
const refreshDesktopServerUrl = () => {
desktopServerUrl.value = getDesktopServerUrl();
};
const normalizeDomain = (value: string) => value.trim().toLowerCase().replace(/^@/, "");
const availableEmailDomains = computed(() => Array.from(new Set([
@@ -345,6 +356,7 @@ const handleAccountPaste = (event: ClipboardEvent) => {
};
onMounted(async () => {
window.addEventListener(DESKTOP_SERVER_URL_CHANGED_EVENT, refreshDesktopServerUrl);
await loadEmailDomains();
const reason = consumeLogoutReason();
if (reason === LOGOUT_REASON_TIMEOUT) {
@@ -358,6 +370,10 @@ onMounted(async () => {
form.agreeProtocol = localStorage.getItem(AGREE_PROTOCOL_KEY) === "true";
});
onUnmounted(() => {
window.removeEventListener(DESKTOP_SERVER_URL_CHANGED_EVENT, refreshDesktopServerUrl);
});
watch(() => form.agreeProtocol, (checked) => localStorage.setItem(AGREE_PROTOCOL_KEY, String(checked)));
watch(() => [form.emailLocal, form.emailDomain], syncEmailFromParts);
@@ -786,6 +802,42 @@ const onSubmit = async () => {
border-radius: 2px;
}
.desktop-server-status {
display: grid;
grid-template-columns: auto minmax(0, 1fr) auto;
gap: 10px;
align-items: center;
margin: -18px 0 24px;
padding: 10px 12px;
border: 1px solid #dbe7f5;
border-radius: 8px;
background: #f8fafc;
color: #64748b;
font-size: 12px;
}
.desktop-server-label {
color: #64748b;
font-weight: 700;
}
.desktop-server-status code {
min-width: 0;
overflow-wrap: anywhere;
color: #1e293b;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.desktop-server-action {
color: #2563eb;
font-weight: 700;
text-decoration: none;
}
.desktop-server-action:hover {
color: #1d4ed8;
}
/* ═══════════════════════
通知与错误提示
═══════════════════════ */