fix(release): 发布1.4.5并加固登录与灵动岛体验
登录连续五次失败封禁五分钟,修复两端错误提示;教师导入逐人生成随机密码并提供一次性清单。统一自定义岛外观与控件,修复圆角配置和全天课表对齐,临近下课显示课程旁秒数徽标;客户端更新改为云端统一下发。同步发布版本、帮助文档及隔离回归。
This commit is contained in:
1 parent
9351203deb
commit
0b57e926bd
52 files changed
+746
-821
No files matched your search
@@ -1,8 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { h, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { ElButton, ElNotification } from 'element-plus';
|
||||
import type { UpdateInfo } from '@classhelper/shared';
|
||||
import {
|
||||
replayMissedNotifications,
|
||||
startIslandBridge,
|
||||
@@ -28,56 +26,10 @@ const realtime = useRealtimeStore();
|
||||
const booting = ref(true);
|
||||
const bootText = ref('正在读取本地配置...');
|
||||
|
||||
/**
|
||||
* 启动自动检查发现新版本时的提示(主进程查出后推过来,见 main/update.ts)。
|
||||
*
|
||||
* **为什么订阅放在 App.vue**:`onUpdateAvailable` 底层是 `ipcRenderer.on`,
|
||||
* 桥接层没有对应的 off —— 挂在会随"登出 → 登录"反复挂载的 ClientLayout 里,
|
||||
* 处理器会越堆越多(与灵动岛订阅同一个坑)。App.vue 整个应用生命周期只挂载一次。
|
||||
*
|
||||
* 提示是**一次性**且可永久消音:点「忽略此版本」写进 config.json,同一版本不再提示;
|
||||
* 「关于」页里仍可随时手动检查。
|
||||
*/
|
||||
function showUpdateAvailable(info: UpdateInfo): void {
|
||||
if (!info.latestVersion) return;
|
||||
ElNotification({
|
||||
title: `发现新版本 v${info.latestVersion}`,
|
||||
type: 'info',
|
||||
// 不自动消失:这是需要用户决定的事(去下载 / 忽略),滑过去就只能靠「关于」页再想起来
|
||||
duration: 0,
|
||||
message: h('div', { style: 'line-height: 1.7' }, [
|
||||
h('p', { style: 'margin: 0 0 10px' }, `当前版本 ${info.currentVersion},可前往下载更新。`),
|
||||
h('div', { style: 'display: flex; gap: 8px' }, [
|
||||
h(
|
||||
ElButton,
|
||||
{
|
||||
size: 'small',
|
||||
type: 'primary',
|
||||
onClick: () => {
|
||||
void window.desktop?.openExternal(info.releaseUrl);
|
||||
},
|
||||
},
|
||||
() => '前往下载',
|
||||
),
|
||||
h(
|
||||
ElButton,
|
||||
{
|
||||
size: 'small',
|
||||
onClick: () => {
|
||||
void window.desktop?.ignoreUpdateVersion(info.latestVersion ?? '');
|
||||
},
|
||||
},
|
||||
() => '忽略此版本',
|
||||
),
|
||||
]),
|
||||
]),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上线补弹「离线期间收到的消息」(需求 11)。
|
||||
*
|
||||
* **为什么订阅放在 App.vue**:与 `onUpdateAvailable` 同一条理由 —— App.vue 整个应用生命周期
|
||||
* **为什么订阅放在 App.vue**:App.vue 整个应用生命周期
|
||||
* 只挂载一次,而 `ClientLayout` 会随"登出 → 登录"反复挂载。而且恢复事件本身是"可达性由不可达
|
||||
* 变为可达"的那一刻,一次会话里可能发生多次,处理器必须是**幂等**的(`replayMissedNotifications`
|
||||
* 推完就清掉离线起点,重复触发时第二次读到空值、直接返回 0)。
|
||||
@@ -118,9 +70,6 @@ onMounted(async () => {
|
||||
// 离线期间收到的消息:可达性恢复的那一刻补弹到灵动岛(App.vue 常驻,所以每次恢复只跑一次)
|
||||
appStore.onServerRecovered(handleServerRecovered);
|
||||
|
||||
// 启动自动检查发现新版本时由主进程推过来(订阅只挂一次,理由见 showUpdateAvailable)
|
||||
window.desktop?.onUpdateAvailable?.(showUpdateAvailable);
|
||||
|
||||
if (auth.isAuthenticated) await router.replace('/schedule');
|
||||
else await router.replace('/login');
|
||||
|
||||
|
||||
@@ -61,7 +61,10 @@ http.interceptors.response.use(
|
||||
const status = error.response.status;
|
||||
const message = error.response.data?.message ?? `请求失败(${status})`;
|
||||
|
||||
if (status === 401) {
|
||||
const loginAttempt =
|
||||
error.config?.method?.toLowerCase() === 'post' &&
|
||||
/\/auth\/(?:class-)?login\/?(?:\?|$)/.test(error.config?.url ?? '');
|
||||
if (status === 401 && !loginAttempt) {
|
||||
ElMessage.warning('登录状态已失效,请重新登录');
|
||||
unauthorizedHandler();
|
||||
} else {
|
||||
|
||||
+3
-9
@@ -1168,18 +1168,12 @@ export async function aboutPageSelfTest(): Promise<SmokeCheckResult> {
|
||||
const hasDiagnostics = text.includes('诊断信息');
|
||||
const info = await window.desktop?.getAppInfo?.();
|
||||
const hasConfigPath = Boolean(info?.configPath);
|
||||
|
||||
// 检查更新入口(新功能回归):关于页要有这一块,且按钮可点。
|
||||
// 这里只断言"入口存在"——是否真有新版本取决于 GitHub,不该绑进冒烟(见 main/update.ts)
|
||||
const updateBlock = document.querySelector('[data-test="update-check"]');
|
||||
const updateButton = document.querySelector('[data-test="update-check-button"]');
|
||||
const hasUpdateCheck = Boolean(document.querySelector('[data-test="update-check"]'));
|
||||
|
||||
await router.push('/schedule');
|
||||
return {
|
||||
ok: hasThanks && hasDiagnostics && hasConfigPath && Boolean(updateBlock) && Boolean(updateButton),
|
||||
detail:
|
||||
`鸣谢=${hasThanks} 诊断=${hasDiagnostics} configPath=${hasConfigPath ? '有' : '无'} ` +
|
||||
`检查更新块=${updateBlock ? '有' : '无'} 按钮=${updateButton ? '有' : '无'}`,
|
||||
ok: hasThanks && hasDiagnostics && hasConfigPath && !hasUpdateCheck,
|
||||
detail: `鸣谢=${hasThanks} 诊断=${hasDiagnostics} configPath=${hasConfigPath ? '有' : '无'}`,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
|
||||
@@ -54,7 +54,7 @@ const container = computed(() => ['group', 'stack', 'slide', 'rolling'].includes
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
border-radius: 5px;
|
||||
border-radius: var(--ch-radius-control);
|
||||
}
|
||||
.component-chip {
|
||||
display: flex;
|
||||
@@ -62,9 +62,9 @@ const container = computed(() => ['group', 'stack', 'slide', 'rolling'].includes
|
||||
gap: 5px;
|
||||
min-height: 36px;
|
||||
padding: 5px 9px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 5px;
|
||||
background: transparent;
|
||||
border: 1px solid var(--ch-border);
|
||||
border-radius: var(--ch-radius-control);
|
||||
background: var(--ch-surface);
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
white-space: nowrap;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
min-width: 0;
|
||||
color: var(--ch-text);
|
||||
padding: 12px 24px 16px;
|
||||
background: var(--editor-background, var(--ch-bg));
|
||||
background: var(--ch-bg);
|
||||
}
|
||||
:global(.main:has(> .island-editor-page)) {
|
||||
display: flex;
|
||||
@@ -16,11 +16,6 @@
|
||||
.island-editor-page > * {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
:global(html.dark) .island-editor-page {
|
||||
--editor-background: #262626;
|
||||
--editor-divider: #3a3a3a;
|
||||
--editor-card: #2c2c2c;
|
||||
}
|
||||
.editor-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -77,7 +72,8 @@
|
||||
}
|
||||
.scheme-controls :deep(.el-select__wrapper) {
|
||||
min-height: 38px;
|
||||
background: var(--ch-card-subtle);
|
||||
background: var(--ch-surface);
|
||||
border-radius: var(--ch-radius-control);
|
||||
}
|
||||
.icon-button {
|
||||
width: 34px;
|
||||
@@ -139,7 +135,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 54px;
|
||||
border-radius: 6px;
|
||||
border-radius: var(--ch-radius-control);
|
||||
gap: 12px;
|
||||
padding: 4px;
|
||||
border: 1px solid transparent;
|
||||
@@ -180,7 +176,7 @@
|
||||
background: transparent;
|
||||
color: var(--ch-text-tertiary);
|
||||
padding: 10px 24px;
|
||||
border-radius: 5px;
|
||||
border-radius: var(--ch-radius-control);
|
||||
font: inherit;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
@@ -251,7 +247,7 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
.component-library {
|
||||
border-top: 6px solid var(--editor-divider, var(--ch-divider));
|
||||
border-top: 1px solid var(--ch-border);
|
||||
margin: 0 -24px;
|
||||
padding: 14px 24px 24px;
|
||||
flex: 1 0 auto;
|
||||
@@ -288,9 +284,9 @@
|
||||
text-align: left;
|
||||
min-height: 76px;
|
||||
padding: 10px 8px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
border: 1px solid var(--ch-border);
|
||||
border-radius: var(--ch-radius-control);
|
||||
background: var(--ch-surface);
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
cursor: grab;
|
||||
@@ -332,51 +328,6 @@
|
||||
font-size: calc(14px * var(--ch-font-scale));
|
||||
line-height: 1.5;
|
||||
}
|
||||
.message-library-title {
|
||||
color: var(--ch-text-tertiary);
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
margin: 20px 8px 4px;
|
||||
}
|
||||
.message-options .library-item {
|
||||
min-height: 64px;
|
||||
}
|
||||
.message-options .library-item strong {
|
||||
font-size: 15px;
|
||||
}
|
||||
.message-options .library-item > svg {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
flex-basis: 26px;
|
||||
}
|
||||
.editor-tip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 12px 16px;
|
||||
min-height: 60px;
|
||||
border: 1px solid var(--ch-border-strong);
|
||||
border-radius: 5px;
|
||||
background: var(--editor-card, var(--ch-card-subtle));
|
||||
font-size: 14px;
|
||||
}
|
||||
.editor-tip > span {
|
||||
flex: 1;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.tip-icon {
|
||||
color: var(--ch-accent);
|
||||
font-size: 22px;
|
||||
}
|
||||
.dismiss-tip {
|
||||
border: 0;
|
||||
color: var(--ch-text);
|
||||
background: transparent;
|
||||
font-size: 26px;
|
||||
cursor: pointer;
|
||||
margin-left: auto;
|
||||
padding: 0 8px;
|
||||
}
|
||||
.drag-ghost {
|
||||
position: fixed;
|
||||
z-index: 10000;
|
||||
@@ -392,6 +343,22 @@
|
||||
.inspector-tabs {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
:global(.island-inspector) {
|
||||
color: var(--ch-text);
|
||||
background: var(--ch-surface);
|
||||
}
|
||||
:global(.island-inspector .el-drawer__header) {
|
||||
color: var(--ch-text);
|
||||
}
|
||||
:global(.island-inspector .el-input-number),
|
||||
:global(.island-inspector .el-select) {
|
||||
width: 100%;
|
||||
}
|
||||
:global(.island-inspector .el-input__wrapper),
|
||||
:global(.island-inspector .el-select__wrapper) {
|
||||
background: var(--ch-surface);
|
||||
border-radius: var(--ch-radius-control);
|
||||
}
|
||||
.row-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
@@ -426,9 +393,6 @@
|
||||
.scheme-tools {
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
.editor-tip {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.preview-toolbar .hint {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import UpdateProgress from '../../components/UpdateProgress.vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import type { UpdateInfo } from '@classhelper/shared';
|
||||
import type { DesktopAppInfo } from '../../../types/desktop.js';
|
||||
import { useAppStore } from '../../stores/app.js';
|
||||
|
||||
/**
|
||||
* 关于(ClassIsland 同款折叠卡片式):
|
||||
* 应用信息(版本/运行时/常用链接/检查更新)→ 诊断信息(排查问题用)→ 鸣谢。
|
||||
* 应用信息(版本/运行时/常用链接)→ 诊断信息(排查问题用)→ 鸣谢。
|
||||
* 所有外链走主进程 openExternal(只放行 http/https,见 main/ipc.ts 的白名单)。
|
||||
*/
|
||||
const appStore = useAppStore();
|
||||
@@ -17,10 +15,6 @@ const appInfo = ref<DesktopAppInfo | null>(null);
|
||||
/** 折叠面板默认展开第一项(应用信息),诊断信息默认收起 */
|
||||
const expandedNames = ref(['app']);
|
||||
|
||||
/** 检查更新:结果由主进程直连 GitHub 得到(见 main/update.ts) */
|
||||
const checking = ref(false);
|
||||
const updateInfo = ref<UpdateInfo | null>(null);
|
||||
|
||||
const PROJECT_URL = 'https://github.com/LoveChengke/ClassHelper';
|
||||
const ISSUES_URL = 'https://github.com/LoveChengke/ClassHelper/issues';
|
||||
|
||||
@@ -38,40 +32,16 @@ async function openExternal(url: string): Promise<void> {
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查更新。
|
||||
*
|
||||
* @param force true = 用户主动点击(绕过主进程缓存);false = 进页面时带出启动自动检查的结果
|
||||
*/
|
||||
async function checkUpdate(force: boolean): Promise<void> {
|
||||
if (!window.desktop?.checkForUpdates) return;
|
||||
checking.value = true;
|
||||
try {
|
||||
updateInfo.value = await window.desktop.checkForUpdates(force);
|
||||
} finally {
|
||||
checking.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 忽略这个版本:写进配置,启动自动检查不再提示它 */
|
||||
async function ignoreVersion(): Promise<void> {
|
||||
const version = updateInfo.value?.latestVersion;
|
||||
if (!version) return;
|
||||
await window.desktop?.ignoreUpdateVersion(version);
|
||||
ElMessage.success(`已忽略 v${version} 的更新提示`);
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
if (!window.desktop) return;
|
||||
appInfo.value = await window.desktop.getAppInfo().catch(() => null);
|
||||
// 带出启动自动检查的结果(命中主进程缓存,不会再发一次请求)
|
||||
void checkUpdate(false);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page">
|
||||
<UpdateProgress />
|
||||
<p class="text-muted">客户端更新由管理端统一下发。</p>
|
||||
<div class="page-header">
|
||||
<div>
|
||||
<h2 class="page-title">关于</h2>
|
||||
@@ -107,51 +77,6 @@ onMounted(async () => {
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="平台">{{ appInfo?.platform ?? '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<!-- 检查更新:直连 GitHub 看最新的 Release 是不是比本机新 -->
|
||||
<div class="about-update" data-test="update-check">
|
||||
<div class="about-update-head">
|
||||
<span class="about-update-label">检查更新</span>
|
||||
<el-button
|
||||
size="small"
|
||||
:loading="checking"
|
||||
data-test="update-check-button"
|
||||
@click="checkUpdate(true)"
|
||||
>
|
||||
检查更新
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="about-update-body">
|
||||
<template v-if="checking">正在检查…</template>
|
||||
<template v-else-if="!updateInfo">尚未检查</template>
|
||||
<template v-else-if="!updateInfo.ok">
|
||||
<!-- 教室机器没有外网是常态,这里只是"查不到",不是错误 -->
|
||||
<span class="about-update-muted">{{ updateInfo.error ?? '暂时无法检查更新' }}</span>
|
||||
</template>
|
||||
<template v-else-if="updateInfo.hasUpdate">
|
||||
<el-tag size="small" type="success" effect="light">
|
||||
发现新版本 v{{ updateInfo.latestVersion }}
|
||||
</el-tag>
|
||||
<span class="about-update-muted">当前 v{{ updateInfo.currentVersion }}</span>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
data-test="update-download"
|
||||
@click="openExternal(updateInfo.releaseUrl)"
|
||||
>
|
||||
前往下载
|
||||
</el-button>
|
||||
<el-button link size="small" @click="ignoreVersion">忽略此版本</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-tag size="small" type="info" effect="plain">已是最新版本</el-tag>
|
||||
<span class="about-update-muted">
|
||||
v{{ updateInfo.currentVersion }} · {{ updateInfo.latestVersion }}
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
|
||||
@@ -248,55 +173,4 @@ onMounted(async () => {
|
||||
color: var(--ch-text-secondary);
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
/* 检查更新:颜色一律走 --ch-* 变量(深色主题下不能写死浅色底/深色字) */
|
||||
.about-update {
|
||||
margin-top: 12px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--ch-border);
|
||||
border-radius: var(--ch-radius-card);
|
||||
background: var(--ch-layer-alt);
|
||||
}
|
||||
|
||||
.about-update-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.about-update-label {
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
color: var(--ch-text-secondary);
|
||||
}
|
||||
|
||||
.about-update-body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
font-size: 12.5px;
|
||||
color: var(--ch-text);
|
||||
}
|
||||
|
||||
.about-update-muted {
|
||||
color: var(--ch-text-tertiary);
|
||||
}
|
||||
|
||||
.about-thanks {
|
||||
margin: 0;
|
||||
padding-left: 18px;
|
||||
line-height: 2;
|
||||
font-size: 12.5px;
|
||||
color: var(--ch-text-secondary);
|
||||
}
|
||||
|
||||
.about-quote {
|
||||
margin: 18px 0 4px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: var(--ch-text-tertiary);
|
||||
}
|
||||
</style>
|
||||
@@ -2,7 +2,7 @@
|
||||
import { confirmAction } from '../../composables/confirm.js';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { formatDate, relativeTime, type UpdateInfo } from '@classhelper/shared';
|
||||
import { formatDate, relativeTime } from '@classhelper/shared';
|
||||
import type { ClientAgentStatus, DesktopAppInfo } from '../../../types/desktop.js';
|
||||
import { useAppStore } from '../../stores/app.js';
|
||||
import { useUiStore } from '../../stores/ui.js';
|
||||
@@ -42,7 +42,6 @@ async function loadAll(): Promise<void> {
|
||||
try {
|
||||
await loadAppInfo();
|
||||
await refreshAgent();
|
||||
await loadIgnoredVersion();
|
||||
await appStore.refreshCacheStats();
|
||||
} finally {
|
||||
loading.value = false;
|
||||
@@ -110,51 +109,6 @@ async function openLogDir(): Promise<void> {
|
||||
if (!ok) ElMessage.warning('打开日志目录失败,请按上面的路径手动前往');
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ 更新 */
|
||||
|
||||
/**
|
||||
* 更新检查。
|
||||
*
|
||||
* 「立即检查」走 `checkForUpdates(true)`:**强制绕过主进程那 30 分钟缓存**。
|
||||
* 这是本页与「关于」页的区别 —— 那边用户点检查也可能是缓存结果(省流量),
|
||||
* 这边维护者要的是"现在到底拿得到什么",所以按钮默认就是强制的。
|
||||
*/
|
||||
const checking = ref(false);
|
||||
const updateInfo = ref<UpdateInfo | null>(null);
|
||||
const ignoredUpdateVersion = ref('');
|
||||
|
||||
async function checkUpdate(force: boolean): Promise<void> {
|
||||
if (!window.desktop?.checkForUpdates) return;
|
||||
checking.value = true;
|
||||
try {
|
||||
updateInfo.value = await window.desktop.checkForUpdates(force);
|
||||
} finally {
|
||||
checking.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadIgnoredVersion(): Promise<void> {
|
||||
if (!window.desktop?.getConfig) return;
|
||||
const stored = await window.desktop.getConfig().catch(() => null);
|
||||
ignoredUpdateVersion.value = stored?.ignoredUpdateVersion ?? '';
|
||||
}
|
||||
|
||||
async function ignoreVersion(): Promise<void> {
|
||||
const version = updateInfo.value?.latestVersion;
|
||||
if (!version || !window.desktop?.ignoreUpdateVersion) return;
|
||||
await window.desktop.ignoreUpdateVersion(version);
|
||||
ignoredUpdateVersion.value = version;
|
||||
ElMessage.success(`已忽略 v${version}:启动时的自动检查不再提示它`);
|
||||
}
|
||||
|
||||
/** 忽略是可逆的(排查线上"用户说不再提示"时经常要把它清掉),顺手给一个恢复入口 */
|
||||
async function clearIgnoredVersion(): Promise<void> {
|
||||
if (!window.desktop?.saveConfig) return;
|
||||
const saved = await window.desktop.saveConfig({ ignoredUpdateVersion: '' });
|
||||
ignoredUpdateVersion.value = saved.ignoredUpdateVersion;
|
||||
ElMessage.success('已恢复该版本的更新提示');
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ 调试工具 */
|
||||
|
||||
const openingDevTools = ref(false);
|
||||
@@ -211,8 +165,6 @@ async function clearCache(): Promise<void> {
|
||||
|
||||
onMounted(async () => {
|
||||
await loadAll();
|
||||
// 带出启动自动检查的结果(这次命中主进程缓存,不会真的再发一次请求)
|
||||
void checkUpdate(false);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -326,56 +278,6 @@ onMounted(async () => {
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 更新 -->
|
||||
<el-card shadow="never" class="mt-12">
|
||||
<template #header><span>更新</span></template>
|
||||
<div class="toolbar">
|
||||
<el-button :loading="checking" data-test="dev-check-update" @click="checkUpdate(true)">
|
||||
强制检查更新
|
||||
</el-button>
|
||||
<span class="text-muted">绕过主进程 30 分钟缓存,直接问 GitHub</span>
|
||||
</div>
|
||||
<el-descriptions :column="1" border size="small" class="mt-12">
|
||||
<el-descriptions-item label="本次结果">
|
||||
<template v-if="checking">正在检查…</template>
|
||||
<template v-else-if="!updateInfo">尚未检查</template>
|
||||
<template v-else-if="!updateInfo.ok">
|
||||
<span class="text-muted">{{ updateInfo.error ?? '暂时无法检查更新' }}</span>
|
||||
</template>
|
||||
<template v-else-if="updateInfo.hasUpdate">
|
||||
<el-tag size="small" type="success" effect="light">
|
||||
有新版本 v{{ updateInfo.latestVersion }}
|
||||
</el-tag>
|
||||
<span class="text-muted">当前 v{{ updateInfo.currentVersion }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-tag size="small" type="info" effect="plain">已是最新版本</el-tag>
|
||||
<span class="text-muted">v{{ updateInfo.currentVersion }}</span>
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="检查时间">
|
||||
{{ updateInfo?.checkedAt ? formatDate(updateInfo.checkedAt, true) : '—' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="已忽略的版本">
|
||||
<template v-if="ignoredUpdateVersion">
|
||||
<span class="mono">v{{ ignoredUpdateVersion }}</span>
|
||||
<el-button link type="primary" size="small" @click="clearIgnoredVersion">恢复提示</el-button>
|
||||
</template>
|
||||
<span v-else class="text-muted">无</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div class="toolbar mt-12">
|
||||
<el-button
|
||||
:disabled="!updateInfo?.latestVersion"
|
||||
data-test="dev-ignore-version"
|
||||
@click="ignoreVersion"
|
||||
>
|
||||
不再提示该版本
|
||||
</el-button>
|
||||
<span class="text-muted">写入配置后,启动时的自动检查会跳过它</span>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 调试工具 -->
|
||||
<el-card shadow="never" class="mt-12">
|
||||
<template #header><span>调试工具</span></template>
|
||||
|
||||
@@ -37,7 +37,6 @@ const selectedId = ref(''),
|
||||
rowId = ref(''),
|
||||
inspectorOpen = ref(false),
|
||||
editMode = ref(false),
|
||||
showTip = ref(true),
|
||||
zoom = ref(1),
|
||||
importInput = ref<HTMLInputElement>();
|
||||
const scheme = computed(() =>
|
||||
@@ -69,11 +68,6 @@ const library: { kind: IslandComponentKind; description: string }[] = [
|
||||
{ kind: 'group', description: '将多个组件组合到一个组件中显示。' },
|
||||
{ kind: 'stack', description: '将多个容器堆叠显示。' },
|
||||
];
|
||||
const messageLibrary: { kind: IslandComponentKind; description: string }[] = [
|
||||
{ kind: 'notification', description: '显示班级收到的通知。' },
|
||||
{ kind: 'homework', description: '显示班级作业提醒。' },
|
||||
{ kind: 'call', description: '显示教师的叫人提醒。' },
|
||||
];
|
||||
const containers: readonly string[] = ['group', 'stack', 'slide', 'rolling'];
|
||||
function id() {
|
||||
return crypto.randomUUID();
|
||||
@@ -773,34 +767,7 @@ function dropPreview(event: PointerEvent) {
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<h4 class="message-library-title">班级消息</h4>
|
||||
<div class="component-options message-options">
|
||||
<button
|
||||
v-for="item in messageLibrary"
|
||||
:key="item.kind"
|
||||
class="library-item"
|
||||
:data-library-kind="item.kind"
|
||||
:aria-label="`添加${ISLAND_COMPONENT_LABELS[item.kind]}`"
|
||||
@pointerdown="beginDrag($event, { kind: item.kind, label: ISLAND_COMPONENT_LABELS[item.kind] })"
|
||||
@click="add(item.kind)"
|
||||
>
|
||||
<ComponentIcon :kind="item.kind" />
|
||||
<span>
|
||||
<strong>{{ ISLAND_COMPONENT_LABELS[item.kind] }}</strong>
|
||||
<span class="component-description">{{ item.description }}</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
<div v-if="showTip" class="editor-tip" role="note">
|
||||
<el-icon class="tip-icon"><InfoFilled /></el-icon>
|
||||
<span>
|
||||
<strong>编辑提示:</strong>
|
||||
现在可以使用「编辑模式」更加直观地编辑主界面上的组件!
|
||||
</span>
|
||||
<el-button @click="editMode = !editMode">{{ editMode ? '退出编辑模式' : '进入编辑模式' }}</el-button>
|
||||
<button class="dismiss-tip" aria-label="关闭编辑提示" @click="showTip = false">×</button>
|
||||
</div>
|
||||
</template>
|
||||
<el-skeleton v-else :rows="8" animated />
|
||||
<input ref="importInput" type="file" accept="application/json,.json" hidden @change="importScheme" />
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ElMessage } from 'element-plus';
|
||||
import { useRouter } from 'vue-router';
|
||||
import {
|
||||
DEFAULT_ISLAND_APPEARANCE,
|
||||
defaultIslandLayouts,
|
||||
ISLAND_APPEARANCE_RANGES as RANGES,
|
||||
ISLAND_POSITION_LABELS,
|
||||
ISLAND_POSITIONS,
|
||||
@@ -30,6 +31,13 @@ function editLayout() {
|
||||
void router.push('/settings/island/editor');
|
||||
}
|
||||
const layoutMode = ref<'fixed' | 'custom'>('fixed');
|
||||
const layoutSettings = ref(defaultIslandLayouts());
|
||||
const activeScheme = computed(() =>
|
||||
layoutSettings.value.schemes.find((s) => s.id === layoutSettings.value.activeSchemeId)!,
|
||||
);
|
||||
const currentRadius = computed(() =>
|
||||
layoutMode.value === 'custom' ? activeScheme.value.radius : island.value.radius,
|
||||
);
|
||||
const residentEnabled = ref(false);
|
||||
const pointerFadeEnabled = ref(true);
|
||||
const pointerFadeReversed = ref(false);
|
||||
@@ -65,6 +73,7 @@ async function changePointerFade(
|
||||
}
|
||||
async function loadLayout() {
|
||||
const settings = (await window.desktop?.getConfig())?.islandLayout;
|
||||
if (settings) layoutSettings.value = settings;
|
||||
layoutMode.value = settings?.layout ?? 'fixed';
|
||||
residentEnabled.value = settings?.residentEnabled ?? false;
|
||||
pointerFadeEnabled.value = settings?.pointerFadeEnabled ?? true;
|
||||
@@ -103,6 +112,12 @@ async function loadIslandAppearance(): Promise<void> {
|
||||
/** 改动即生效:属性变化时先应用(实时预览),点"保存"再落盘 */
|
||||
function applyIslandAppearance(patch: Partial<IslandAppearance> = {}): void {
|
||||
island.value = { ...island.value, ...patch };
|
||||
if (layoutMode.value === 'custom' && patch.radius !== undefined) {
|
||||
activeScheme.value.radius = patch.radius;
|
||||
void window.desktop
|
||||
?.saveConfig({ islandLayout: JSON.parse(JSON.stringify(layoutSettings.value)) })
|
||||
.catch(() => ElMessage.error('圆角保存失败,请重试'));
|
||||
}
|
||||
window.desktop?.islandSetAppearance({ ...island.value });
|
||||
}
|
||||
|
||||
@@ -230,9 +245,9 @@ onMounted(async () => {
|
||||
@input="(value: number) => applyIslandAppearance({ width: value })"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="`圆角 ${island.radius}px`">
|
||||
<el-form-item :label="`圆角 ${currentRadius}px`">
|
||||
<el-slider
|
||||
:model-value="island.radius"
|
||||
:model-value="currentRadius"
|
||||
:min="RANGES.radius.min"
|
||||
:max="RANGES.radius.max"
|
||||
:step="1"
|
||||
|
||||
@@ -55,7 +55,7 @@ onMounted(loadGradeQuery);
|
||||
<el-card shadow="never" class="lesson-channel-settings">
|
||||
<template #header>上下课提醒</template>
|
||||
<p class="text-muted">
|
||||
沿用 ClassIsland 的遮罩、课前倒计时、上下课提示及下节课预告;课中显示课程进度,临近下课显示倒数。
|
||||
课前倒计时、上下课提示及下节课预告保留遮罩;课中显示课程进度,临近下课在课程名右侧显示蓝色圆形秒数倒计时。
|
||||
</p>
|
||||
<div
|
||||
v-for="channel in [
|
||||
|
||||
Reference in new issue
Block a user