1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2026-03-21 09:13:10 +00:00

优化设备名称展示逻辑,支持离线模式下使用本地班级编号

This commit is contained in:
Sunwuyuan 2026-03-03 21:28:45 +08:00
parent cf3412db6a
commit 8f2c9be179
No known key found for this signature in database
GPG Key ID: A6A54CF66F56BB64

View File

@ -687,11 +687,21 @@ export default {
return this.mobile; return this.mobile;
}, },
titleText() { titleText() {
// const provider = getSetting("server.provider");
const deviceName = const isOnline = provider === "kv-server" || provider === "classworkscloud";
let displayName;
if (isOnline && this.state.namespaceInfo) {
// 线使
displayName =
this.state.namespaceInfo?.name ||
this.state.namespaceInfo?.device?.name || this.state.namespaceInfo?.device?.name ||
this.state.classNumber || this.state.classNumber ||
"高三八班"; "高三八班";
} else {
// 线使
displayName = this.state.classNumber || "高三八班";
}
const today = this.getToday(); const today = this.getToday();
const yesterday = new Date(today); const yesterday = new Date(today);
@ -702,11 +712,11 @@ export default {
const yesterdayStr = this.formatDate(yesterday); const yesterdayStr = this.formatDate(yesterday);
if (currentDateStr === todayStr) { if (currentDateStr === todayStr) {
return deviceName + " - 今天的作业"; return displayName + " - 今天的作业";
} else if (currentDateStr === yesterdayStr) { } else if (currentDateStr === yesterdayStr) {
return deviceName + " - 昨天的作业"; return displayName + " - 昨天的作业";
} else { } else {
return `${deviceName} - ${currentDateStr}的作业`; return `${displayName} - ${currentDateStr}的作业`;
} }
}, },
sortedItems() { sortedItems() {