fix: 统一用户有效期日期选择控件

This commit is contained in:
2026-07-11 17:05:31 +08:00
parent 85208972b7
commit 70be6ab657
2 changed files with 14 additions and 9 deletions

View File

@@ -285,13 +285,17 @@ async function createStudent() {
nickname: studentForm.nickname || null, nickname: studentForm.nickname || null,
status: studentForm.status, status: studentForm.status,
dailyChatLimit: studentForm.dailyChatLimit, dailyChatLimit: studentForm.dailyChatLimit,
expiredAt: studentForm.expiredAt || null, expiredAt: toExpiryDateTime(studentForm.expiredAt),
}); });
ElMessage.success("学员已添加"); ElMessage.success("学员已添加");
resetStudentForm(); resetStudentForm();
await loadCurrentMenu(); await loadCurrentMenu();
} }
function toExpiryDateTime(date: string) {
return date ? `${date}T23:59:59` : null;
}
function handleStudentImportFile(event: Event) { function handleStudentImportFile(event: Event) {
const input = event.target as HTMLInputElement; const input = event.target as HTMLInputElement;
studentImportFile.value = input.files?.[0] ?? null; studentImportFile.value = input.files?.[0] ?? null;
@@ -840,12 +844,10 @@ function formatRecordDateTime(value: string, boundary: "start" | "end") {
<el-input v-model="studentForm.name" placeholder="姓名" /> <el-input v-model="studentForm.name" placeholder="姓名" />
<el-input v-model="studentForm.nickname" placeholder="昵称(可选)" /> <el-input v-model="studentForm.nickname" placeholder="昵称(可选)" />
<el-input-number v-model="studentForm.dailyChatLimit" :min="0" /> <el-input-number v-model="studentForm.dailyChatLimit" :min="0" />
<el-date-picker <label class="record-date-field student-expiry-field">
v-model="studentForm.expiredAt" <span>有效期</span>
type="datetime" <input v-model="studentForm.expiredAt" type="date" aria-label="学员有效期" title="留空表示长期有效" />
value-format="YYYY-MM-DDTHH:mm:ss" </label>
placeholder="有效期(可选)"
/>
<div class="form-switch-row"> <div class="form-switch-row">
<span>启用</span> <span>启用</span>
<el-switch v-model="studentForm.status" :active-value="1" :inactive-value="0" /> <el-switch v-model="studentForm.status" :active-value="1" :inactive-value="0" />

View File

@@ -341,8 +341,11 @@ textarea {
} }
.student-form-grid .el-input, .student-form-grid .el-input,
.student-form-grid .el-input-number, .student-form-grid .el-input-number {
.student-form-grid .el-date-editor { width: 100%;
}
.student-expiry-field {
width: 100%; width: 100%;
} }