mirror of
https://github.com/ZeroCatDev/Classworks.git
synced 2025-07-05 02:59:23 +00:00
1
This commit is contained in:
parent
4adc0474e4
commit
3ac1f86b96
@ -459,7 +459,7 @@ export default {
|
|||||||
.filter(([, value]) => value.content?.trim())
|
.filter(([, value]) => value.content?.trim())
|
||||||
.map(([key, value]) => ({
|
.map(([key, value]) => ({
|
||||||
key,
|
key,
|
||||||
name: value.name,
|
name: this.state.availableSubjects.find((s) => s.key === key)?.name || key,
|
||||||
content: value.content,
|
content: value.content,
|
||||||
order: this.state.subjectOrder.indexOf(key),
|
order: this.state.subjectOrder.indexOf(key),
|
||||||
rowSpan: Math.ceil(
|
rowSpan: Math.ceil(
|
||||||
@ -473,7 +473,6 @@ export default {
|
|||||||
? this.optimizeGridLayout(items)
|
? this.optimizeGridLayout(items)
|
||||||
: items.sort((a, b) => a.order - b.order);
|
: items.sort((a, b) => a.order - b.order);
|
||||||
|
|
||||||
// 使用方法更新缓存
|
|
||||||
this.updateSortedItemsCache(key, result);
|
this.updateSortedItemsCache(key, result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -706,10 +705,8 @@ export default {
|
|||||||
// 如果内容发生变化(包括清空),就视为修改
|
// 如果内容发生变化(包括清空),就视为修改
|
||||||
if (content !== originalContent.trim()) {
|
if (content !== originalContent.trim()) {
|
||||||
if (content) {
|
if (content) {
|
||||||
|
// 使用精简的数据结构
|
||||||
this.state.boardData.homework[this.currentEditSubject] = {
|
this.state.boardData.homework[this.currentEditSubject] = {
|
||||||
name: this.state.availableSubjects.find(
|
|
||||||
(s) => s.key === this.currentEditSubject
|
|
||||||
)?.name,
|
|
||||||
content,
|
content,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@ -782,16 +779,15 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.currentEditSubject = subject;
|
this.currentEditSubject = subject;
|
||||||
// 如果是新科目,需要创建对应的数据结构
|
// 如果是新科目,需要创建对应的精简数据结构
|
||||||
if (!this.state.boardData.homework[subject]) {
|
if (!this.state.boardData.homework[subject]) {
|
||||||
this.state.boardData.homework[subject] = {
|
this.state.boardData.homework[subject] = {
|
||||||
name:
|
|
||||||
this.state.availableSubjects.find((s) => s.key === subject)?.name ||
|
|
||||||
subject,
|
|
||||||
content: "",
|
content: "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.state.dialogTitle = this.state.boardData.homework[subject].name;
|
this.state.dialogTitle = this.state.availableSubjects.find(
|
||||||
|
(s) => s.key === subject
|
||||||
|
)?.name || subject;
|
||||||
this.state.textarea = this.state.boardData.homework[subject].content;
|
this.state.textarea = this.state.boardData.homework[subject].content;
|
||||||
this.state.dialogVisible = true;
|
this.state.dialogVisible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user