1
This commit is contained in:
+104
-3
@@ -32,7 +32,7 @@
|
||||
|
||||
<v-col cols="12">
|
||||
<v-card>
|
||||
<v-card-title>学生列表设置</v-card-title>
|
||||
<v-card-title>云端学生列表设置</v-card-title>
|
||||
<v-card-text>
|
||||
<v-textarea v-model="students" label="学生列表" required />
|
||||
<v-btn color="primary" @click="saveStudents">保存</v-btn>
|
||||
@@ -41,10 +41,10 @@
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-card>
|
||||
<v-card disabled>
|
||||
<v-card-title>自动刷新设置</v-card-title>
|
||||
<v-card-text>
|
||||
<v-switch v-model="autoRefresh" label="启用自动刷新" />
|
||||
<v-switch v-model="autoRefresh" label="启用自动刷新"/>
|
||||
<v-text-field
|
||||
v-model="refreshInterval"
|
||||
type="number"
|
||||
@@ -55,6 +55,64 @@
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-card>
|
||||
<v-card-title>字体设置</v-card-title>
|
||||
<v-card-text>
|
||||
<v-row align="center">
|
||||
<v-col>
|
||||
<v-text-field
|
||||
v-model="fontSize"
|
||||
type="number"
|
||||
label="字体大小"
|
||||
suffix="px"
|
||||
:rules="[
|
||||
v => v >= 16 || '字体大小不能小于16px',
|
||||
v => v <= 100 || '字体大小不能大于100px'
|
||||
]"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col cols="auto">
|
||||
<v-btn color="primary" @click="saveFontSize">保存</v-btn>
|
||||
</v-col>
|
||||
<v-col cols="auto">
|
||||
<v-btn color="error" @click="resetFontSize">重置</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-card>
|
||||
<v-card-title>编辑设置</v-card-title>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-switch
|
||||
v-model="autoSave"
|
||||
label="启用自动保存"
|
||||
hint="编辑完成后自动上传到服务器"
|
||||
persistent-hint
|
||||
@change="saveEditSettings"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-switch
|
||||
v-model="refreshBeforeEdit"
|
||||
label="编辑前自动刷新"
|
||||
hint="打开编辑框前自动从服务器获取最新数据"
|
||||
persistent-hint
|
||||
@change="saveEditSettings"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
|
||||
@@ -77,6 +135,9 @@ export default {
|
||||
snackbarText: '',
|
||||
autoRefresh: false,
|
||||
refreshInterval: 300,
|
||||
fontSize: '28',
|
||||
autoSave: false,
|
||||
refreshBeforeEdit: false,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -102,6 +163,14 @@ export default {
|
||||
|
||||
this.autoRefresh = localStorage.getItem('autoRefresh') === 'true';
|
||||
this.refreshInterval = parseInt(localStorage.getItem('refreshInterval')) || 300;
|
||||
|
||||
const savedFontSize = localStorage.getItem('fontSize');
|
||||
if (savedFontSize) {
|
||||
this.fontSize = savedFontSize;
|
||||
}
|
||||
|
||||
this.autoSave = localStorage.getItem('autoSave') === 'true';
|
||||
this.refreshBeforeEdit = localStorage.getItem('refreshBeforeEdit') === 'true';
|
||||
},
|
||||
|
||||
saveServerSettings() {
|
||||
@@ -151,6 +220,38 @@ export default {
|
||||
this.showMessage('保存成功');
|
||||
},
|
||||
|
||||
saveFontSize() {
|
||||
try {
|
||||
const size = parseInt(this.fontSize);
|
||||
if (size >= 16 && size <= 100) {
|
||||
localStorage.setItem('fontSize', size.toString());
|
||||
this.showMessage('字体大小保存成功');
|
||||
} else {
|
||||
throw new Error('Invalid font size');
|
||||
}
|
||||
} catch (error) {
|
||||
this.showMessage('保存失败,字体大小必须在16-100之间');
|
||||
}
|
||||
},
|
||||
|
||||
resetFontSize() {
|
||||
localStorage.removeItem('fontSize');
|
||||
this.fontSize = '28';
|
||||
this.showMessage('字体大小已重置为默认值');
|
||||
},
|
||||
|
||||
saveEditSettings() {
|
||||
localStorage.setItem('autoSave', this.autoSave);
|
||||
localStorage.setItem('refreshBeforeEdit', this.refreshBeforeEdit);
|
||||
this.showMessage(
|
||||
this.autoSave
|
||||
? '已启用自动保存'
|
||||
: this.refreshBeforeEdit
|
||||
? '已启用编辑前刷新'
|
||||
: '已更新编辑设置'
|
||||
);
|
||||
},
|
||||
|
||||
showMessage(text) {
|
||||
this.snackbarText = text;
|
||||
this.snackbar = true;
|
||||
|
||||
Reference in New Issue
Block a user