fix: 测试库按进程隔离,主题在无法写存储时仍能打开
This commit is contained in:
@@ -247,14 +247,6 @@ async function pollQr() {
|
||||
if (errorText.value === "网络异常,继续等待。") errorText.value = "";
|
||||
return;
|
||||
}
|
||||
if (payload.status === "expired") {
|
||||
stopPoll();
|
||||
stopQrTimer();
|
||||
qrExpired.value = true;
|
||||
qrLeft.value = 0;
|
||||
errorText.value = "";
|
||||
return;
|
||||
}
|
||||
applyResult(payload);
|
||||
} catch {
|
||||
errorText.value = "网络异常,继续等待。";
|
||||
|
||||
@@ -207,9 +207,7 @@ function workerPercent(row: StudyWorker) {
|
||||
}
|
||||
|
||||
function workerTitle(row: StudyWorker) {
|
||||
if (row.course) return row.course;
|
||||
if (workerPercent(row) >= 100) return "空闲";
|
||||
return "准备";
|
||||
return row.course;
|
||||
}
|
||||
|
||||
function showHeartbeat(row: StudyWorker) {
|
||||
|
||||
+14
-2
@@ -54,7 +54,15 @@ const schemes: Scheme[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const stored = localStorage.getItem("euniv-scheme");
|
||||
function readStoredScheme(): string | null {
|
||||
try {
|
||||
return localStorage.getItem("euniv-scheme");
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const stored = readStoredScheme();
|
||||
const schemeId = ref(stored === "day" ? "day" : "graphite");
|
||||
const scheme = computed(() => schemes.find((item) => item.id === schemeId.value) ?? schemes[0]);
|
||||
export const isDark = computed(() => scheme.value.dark);
|
||||
@@ -156,7 +164,11 @@ export const themeOverrides = computed<GlobalThemeOverrides>(() => {
|
||||
});
|
||||
|
||||
watch(scheme, (value) => {
|
||||
localStorage.setItem("euniv-scheme", value.id);
|
||||
try {
|
||||
localStorage.setItem("euniv-scheme", value.id);
|
||||
} catch {
|
||||
/* 浏览器禁用存储时仍使用当前主题 */
|
||||
}
|
||||
const root = document.documentElement;
|
||||
root.dataset.scheme = value.id;
|
||||
for (const [key, cssValue] of Object.entries(value.vars)) {
|
||||
|
||||
Reference in New Issue
Block a user