Refactor index.vue to replace v-dialog with homework-edit-dialog for improved homework editing experience. Add HomeworkTemplateCard to settings.vue for homework management. Enhance kvServerProvider with additional error logging for better debugging.
This commit is contained in:
+22
-25
@@ -241,27 +241,13 @@
|
||||
</v-col>
|
||||
</div>
|
||||
|
||||
<v-dialog
|
||||
<homework-edit-dialog
|
||||
v-model="state.dialogVisible"
|
||||
width="500"
|
||||
@click:outside="handleClose"
|
||||
>
|
||||
<v-card border>
|
||||
<v-card-title>{{ state.dialogTitle }}</v-card-title>
|
||||
<v-card-subtitle>
|
||||
{{ autoSave ? "喵?喵呜!" : "写完后点击上传谢谢喵" }}
|
||||
</v-card-subtitle>
|
||||
<v-card-text>
|
||||
<v-textarea
|
||||
ref="inputRef"
|
||||
v-model="state.textarea"
|
||||
auto-grow
|
||||
placeholder="使用换行表示分条"
|
||||
rows="5"
|
||||
/>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
:title="state.dialogTitle"
|
||||
:initial-content="state.textarea"
|
||||
:auto-save="autoSave"
|
||||
@save="handleHomeworkSave"
|
||||
/>
|
||||
|
||||
<v-snackbar v-model="state.snackbar" :timeout="2000">
|
||||
{{ state.snackbarText }}
|
||||
@@ -622,6 +608,7 @@ import RandomPicker from "@/components/RandomPicker.vue";
|
||||
import NamespaceAccess from "@/components/NamespaceAccess.vue";
|
||||
import FloatingToolbar from "@/components/FloatingToolbar.vue";
|
||||
import FloatingICP from "@/components/FloatingICP.vue";
|
||||
import HomeworkEditDialog from "@/components/HomeworkEditDialog.vue";
|
||||
import dataProvider from "@/utils/dataProvider";
|
||||
import {
|
||||
getSetting,
|
||||
@@ -645,6 +632,7 @@ export default {
|
||||
NamespaceAccess,
|
||||
FloatingToolbar,
|
||||
FloatingICP,
|
||||
HomeworkEditDialog,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -1241,11 +1229,20 @@ export default {
|
||||
subject;
|
||||
this.state.textarea = this.state.boardData.homework[subject].content;
|
||||
this.state.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.inputRef) {
|
||||
this.$refs.inputRef.focus();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
async handleHomeworkSave(content) {
|
||||
if (!this.currentEditSubject) return;
|
||||
|
||||
this.state.boardData.homework[this.currentEditSubject] = {
|
||||
content: content,
|
||||
};
|
||||
|
||||
this.state.synced = false;
|
||||
|
||||
if (this.autoSave) {
|
||||
await this.trySave(true);
|
||||
}
|
||||
},
|
||||
|
||||
splitPoint(content) {
|
||||
|
||||
@@ -156,6 +156,9 @@
|
||||
<v-tabs-window-item value="randomPicker">
|
||||
<random-picker-card border :is-mobile="isMobile" />
|
||||
</v-tabs-window-item>
|
||||
<v-tabs-window-item value="homework">
|
||||
<homework-template-card border />
|
||||
</v-tabs-window-item>
|
||||
<v-tabs-window-item value="developer"
|
||||
><settings-card border title="开发者选项" icon="mdi-developer-board">
|
||||
<v-list>
|
||||
@@ -234,6 +237,7 @@ import SettingsExplorer from "@/components/settings/SettingsExplorer.vue";
|
||||
import SettingsLinkGenerator from "@/components/SettingsLinkGenerator.vue";
|
||||
import NamespaceSettingsCard from "@/components/settings/cards/NamespaceSettingsCard.vue";
|
||||
import RandomPickerCard from "@/components/settings/cards/RandomPickerCard.vue";
|
||||
import HomeworkTemplateCard from '@/components/settings/cards/HomeworkTemplateCard.vue';
|
||||
export default {
|
||||
name: "Settings",
|
||||
components: {
|
||||
@@ -252,6 +256,7 @@ export default {
|
||||
SettingsLinkGenerator,
|
||||
NamespaceSettingsCard,
|
||||
RandomPickerCard,
|
||||
HomeworkTemplateCard,
|
||||
},
|
||||
setup() {
|
||||
const { mobile } = useDisplay();
|
||||
@@ -389,6 +394,11 @@ export default {
|
||||
icon: "mdi-dice-multiple",
|
||||
value: "randomPicker",
|
||||
},
|
||||
{
|
||||
title: "作业模板",
|
||||
icon: "mdi-book-edit",
|
||||
value: "homework",
|
||||
},
|
||||
{
|
||||
title: "开发者",
|
||||
icon: "mdi-developer-board",
|
||||
|
||||
Reference in New Issue
Block a user