完善桌面端界面、发布检查与邮箱域名同步
Client Quality Gates / Shared client and Web (push) Has been cancelled
Client Quality Gates / macOS Desktop (push) Has been cancelled

This commit is contained in:
Cheng Zhou
2026-07-01 10:49:31 +08:00
parent c923f887a0
commit 9cac75e85c
32 changed files with 5392 additions and 2684 deletions
+130 -3
View File
@@ -3,9 +3,9 @@
<header class="preferences-header">
<div>
<p class="preferences-kicker">CTMS Desktop</p>
<h3>桌面偏好</h3>
<h3>系统偏好</h3>
</div>
<el-button text :icon="Close" aria-label="关闭桌面偏好" @click="emit('close-request')" />
<el-button text :icon="Close" aria-label="关闭系统偏好" @click="emit('close-request')" />
</header>
<section class="preference-section">
@@ -17,6 +17,29 @@
</div>
</section>
<section class="preference-section">
<div class="section-title">外观</div>
<div class="preference-row">
<div>
<div class="row-title">界面主题</div>
<div class="row-desc">切换桌面工作台与系统弹窗的明暗配色</div>
</div>
<div class="theme-segmented" role="group" aria-label="界面主题">
<button
v-for="option in themeOptions"
:key="option.value"
type="button"
class="theme-option"
:class="{ active: desktopTheme === option.value }"
@click="setTheme(option.value)"
>
<el-icon><component :is="option.icon" /></el-icon>
<span>{{ option.label }}</span>
</button>
</div>
</div>
</section>
<section class="preference-section">
<div class="section-title">通知与更新</div>
<div class="preference-row">
@@ -63,7 +86,7 @@
import { computed, onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import { ElMessage } from "element-plus";
import { Close } from "@element-plus/icons-vue";
import { Close, Moon, Sunny } from "@element-plus/icons-vue";
import {
getDesktopNotificationSubscription,
setDesktopNotificationSubscription,
@@ -74,7 +97,10 @@ import {
getDesktopServerUrl,
getNotificationPermission,
isDesktopUpdaterAvailable,
readDesktopThemePreference,
requestNotificationPermission,
setDesktopThemePreference,
type DesktopThemePreference,
type NotificationPermissionState,
} from "../runtime";
import { checkDesktopUpdateAndPrompt } from "../session/desktopUpdateManager";
@@ -92,13 +118,19 @@ const desktopUpdaterAvailable = isDesktopUpdaterAvailable();
const desktopNotificationsEnabled = ref(false);
const desktopNotificationLoading = ref(false);
const desktopUpdateChecking = ref(false);
const desktopTheme = ref<DesktopThemePreference>(readDesktopThemePreference());
const notificationPermission = ref<NotificationPermissionState>("unsupported");
const themeOptions = [
{ value: "light" as const, label: "明亮", icon: Sunny },
{ value: "dark" as const, label: "暗黑", icon: Moon },
];
const clientMetadataRows = computed(() => [
{ label: "客户端", value: `${clientMetadata.clientType} ${clientMetadata.version}` },
{ label: "平台", value: clientMetadata.platform },
{ label: "构建通道", value: clientMetadata.channel },
{ label: "提交", value: clientMetadata.commit },
{ label: "主题", value: desktopTheme.value === "dark" ? "暗黑" : "明亮" },
{ label: "服务器", value: desktopServerUrl.value || "未配置" },
{
label: "能力",
@@ -168,6 +200,10 @@ const checkDesktopUpdateNow = async () => {
}
};
const setTheme = (theme: DesktopThemePreference) => {
desktopTheme.value = setDesktopThemePreference(theme);
};
const copyClientMetadata = async () => {
const text = clientMetadataRows.value.map((row) => `${row.label}: ${row.value}`).join("\n");
await navigator.clipboard?.writeText(text);
@@ -273,6 +309,45 @@ code {
gap: 10px;
}
.theme-segmented {
display: inline-grid;
grid-template-columns: repeat(2, minmax(76px, 1fr));
gap: 4px;
padding: 4px;
border: 1px solid #dbe6f2;
border-radius: 9px;
background: #f1f5f9;
}
.theme-option {
appearance: none;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-width: 76px;
height: 30px;
padding: 0 10px;
border: 0;
border-radius: 7px;
background: transparent;
color: #64748b;
cursor: pointer;
font: inherit;
font-size: 12px;
font-weight: 700;
}
.theme-option:hover {
color: #0f172a;
}
.theme-option.active {
background: #ffffff;
color: #24496f;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.metadata-panel {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
@@ -299,4 +374,56 @@ dd {
font-size: 12px;
overflow-wrap: anywhere;
}
:global([data-ctms-theme="dark"] .desktop-preferences-dialog .el-dialog__body) {
background: #111827;
}
:global([data-ctms-theme="dark"]) .desktop-preferences {
color: #e5edf7;
}
:global([data-ctms-theme="dark"]) .preferences-kicker {
color: #93c5fd;
}
:global([data-ctms-theme="dark"]) h3,
:global([data-ctms-theme="dark"]) .row-title,
:global([data-ctms-theme="dark"]) dd,
:global([data-ctms-theme="dark"]) code {
color: #f8fafc;
}
:global([data-ctms-theme="dark"]) .section-title,
:global([data-ctms-theme="dark"]) .server-label,
:global([data-ctms-theme="dark"]) .row-desc,
:global([data-ctms-theme="dark"]) dt {
color: #94a3b8;
}
:global([data-ctms-theme="dark"]) .server-card,
:global([data-ctms-theme="dark"]) .preference-row,
:global([data-ctms-theme="dark"]) .metadata-panel {
border-color: #26364a;
background: #172033;
}
:global([data-ctms-theme="dark"]) .theme-segmented {
border-color: #26364a;
background: #0f172a;
}
:global([data-ctms-theme="dark"]) .theme-option {
color: #94a3b8;
}
:global([data-ctms-theme="dark"]) .theme-option:hover {
color: #f8fafc;
}
:global([data-ctms-theme="dark"]) .theme-option.active {
background: #243247;
color: #bfdbfe;
box-shadow: none;
}
</style>