mirror of
https://github.com/ZeroCatDev/Classworks.git
synced 2026-03-21 09:13:10 +00:00
优化设备名称展示逻辑,支持离线模式下使用本地班级编号
This commit is contained in:
parent
cf3412db6a
commit
8f2c9be179
@ -687,11 +687,21 @@ export default {
|
||||
return this.mobile;
|
||||
},
|
||||
titleText() {
|
||||
// 优先展示当前设备名称(如果已从云端获取)
|
||||
const deviceName =
|
||||
const provider = getSetting("server.provider");
|
||||
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.classNumber ||
|
||||
"高三八班";
|
||||
} else {
|
||||
// 离线模式:使用本地设置的班级编号
|
||||
displayName = this.state.classNumber || "高三八班";
|
||||
}
|
||||
|
||||
const today = this.getToday();
|
||||
const yesterday = new Date(today);
|
||||
@ -702,11 +712,11 @@ export default {
|
||||
const yesterdayStr = this.formatDate(yesterday);
|
||||
|
||||
if (currentDateStr === todayStr) {
|
||||
return deviceName + " - 今天的作业";
|
||||
return displayName + " - 今天的作业";
|
||||
} else if (currentDateStr === yesterdayStr) {
|
||||
return deviceName + " - 昨天的作业";
|
||||
return displayName + " - 昨天的作业";
|
||||
} else {
|
||||
return `${deviceName} - ${currentDateStr}的作业`;
|
||||
return `${displayName} - ${currentDateStr}的作业`;
|
||||
}
|
||||
},
|
||||
sortedItems() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user