fix(release): 发布1.4.5并加固登录与灵动岛体验

登录连续五次失败封禁五分钟,修复两端错误提示;教师导入逐人生成随机密码并提供一次性清单。统一自定义岛外观与控件,修复圆角配置和全天课表对齐,临近下课显示课程旁秒数徽标;客户端更新改为云端统一下发。同步发布版本、帮助文档及隔离回归。
This commit is contained in:
LoveChengke committed 2026-11-08 09:55:33 +08:00
1 parent 9351203deb
commit 0b57e926bd
52 files changed
+746 -821

No files matched your search

@@ -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 [