修复了新增待办事项时默认为UTC时间的错误
This commit is contained in:
parent
0d9a30a614
commit
71cf311d7e
@ -185,10 +185,15 @@ class TodoComponent extends HTMLElement {
|
||||
showNewTodoModal() {
|
||||
const { modal, style } = TodoModal.createModal('new-todo');
|
||||
|
||||
// 设置计划时间的默认值为当前时间
|
||||
// 设置计划时间的默认值为当前本地时间
|
||||
const scheduleInput = modal.querySelector('#schedule');
|
||||
const now = new Date();
|
||||
scheduleInput.value = now.toISOString().slice(0, 16);
|
||||
const year = now.getFullYear();
|
||||
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(now.getDate()).padStart(2, '0');
|
||||
const hours = String(now.getHours()).padStart(2, '0');
|
||||
const minutes = String(now.getMinutes()).padStart(2, '0');
|
||||
scheduleInput.value = `${year}-${month}-${day}T${hours}:${minutes}`;
|
||||
|
||||
// 获取当前用户等级
|
||||
const currentUserLevel = this.currentUser.access_level || 0;
|
||||
|
@ -168,32 +168,48 @@ class TodoModal {
|
||||
.cancel-button:hover {
|
||||
background-color: #5a6268;
|
||||
}
|
||||
input[type="datetime-local"] {
|
||||
/* 日期时间选择器样式 */
|
||||
.form-group input[type="datetime-local"] {
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
border: 1px solid #d0d5dd;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
background-color: #fff;
|
||||
font-family: inherit;
|
||||
color: #333;
|
||||
color: #222;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 1px 2px rgba(16,30,54,0.04);
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
|
||||
.form-group input[type="datetime-local"]:focus {
|
||||
border-color: #7986E7;
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px rgba(121, 134, 231, 0.15);
|
||||
}
|
||||
.form-group input[type="datetime-local"]::-webkit-calendar-picker-indicator {
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
margin-right: 4px;
|
||||
opacity: 0.6;
|
||||
opacity: 0.7;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
|
||||
.form-group input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
input[type="datetime-local"]::-webkit-datetime-edit {
|
||||
.form-group input[type="datetime-local"]::-webkit-datetime-edit {
|
||||
padding: 0;
|
||||
}
|
||||
input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper {
|
||||
.form-group input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper {
|
||||
padding: 0;
|
||||
}
|
||||
input[type="datetime-local"]::-webkit-datetime-edit-text {
|
||||
.form-group input[type="datetime-local"]::-webkit-datetime-edit-text {
|
||||
padding: 0 2px;
|
||||
}
|
||||
input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
|
||||
input[type="datetime-local"]::-webkit-datetime-edit-minute-field,
|
||||
input[type="datetime-local"]::-webkit-datetime-edit-second-field,
|
||||
input[type="datetime-local"]::-webkit-datetime-edit-ampm-field {
|
||||
.form-group input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
|
||||
.form-group input[type="datetime-local"]::-webkit-datetime-edit-minute-field,
|
||||
.form-group input[type="datetime-local"]::-webkit-datetime-edit-second-field,
|
||||
.form-group input[type="datetime-local"]::-webkit-datetime-edit-ampm-field {
|
||||
padding: 0 2px;
|
||||
}
|
||||
.form-group textarea {
|
||||
@ -257,6 +273,36 @@ class TodoModal {
|
||||
.select-options::-webkit-scrollbar-thumb:hover {
|
||||
background: #6875D6;
|
||||
}
|
||||
/* 按钮风格优化 */
|
||||
.modal-footer .save-button {
|
||||
background-color: #7986E7;
|
||||
color: #fff;
|
||||
border-radius: 6px;
|
||||
font-size: 15px;
|
||||
padding: 8px 24px;
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
box-shadow: 0 1px 2px rgba(121,134,231,0.08);
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.modal-footer .save-button:hover {
|
||||
background-color: #5c6bc0;
|
||||
}
|
||||
.modal-footer .cancel-button {
|
||||
background-color: #f5f5f5;
|
||||
color: #333;
|
||||
border-radius: 6px;
|
||||
font-size: 15px;
|
||||
padding: 8px 24px;
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
margin-right: 8px;
|
||||
box-shadow: 0 1px 2px rgba(16,30,54,0.04);
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.modal-footer .cancel-button:hover {
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
`;
|
||||
|
||||
const modal = document.createElement('div');
|
||||
|
Loading…
x
Reference in New Issue
Block a user