fix: 账号页闪烁/浏览类型/截图复制/时区统一
This commit is contained in:
@@ -63,7 +63,7 @@ let timer = null
|
||||
|
||||
function recordUpdatedAt() {
|
||||
try {
|
||||
lastUpdatedAt.value = new Date().toLocaleTimeString('zh-CN', { hour12: false })
|
||||
lastUpdatedAt.value = new Date().toLocaleTimeString('zh-CN', { hour12: false, timeZone: 'Asia/Shanghai' })
|
||||
} catch {
|
||||
lastUpdatedAt.value = ''
|
||||
}
|
||||
|
||||
@@ -54,6 +54,11 @@ const scheduleWeekdayDisplay = computed(() =>
|
||||
.join('、'),
|
||||
)
|
||||
|
||||
function normalizeBrowseType(value) {
|
||||
if (String(value) === '注册前未读') return '注册前未读'
|
||||
return '应读'
|
||||
}
|
||||
|
||||
async function loadAll() {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -65,7 +70,7 @@ async function loadAll() {
|
||||
|
||||
scheduleEnabled.value = (system.schedule_enabled ?? 0) === 1
|
||||
scheduleTime.value = system.schedule_time || '02:00'
|
||||
scheduleBrowseType.value = system.schedule_browse_type || '应读'
|
||||
scheduleBrowseType.value = normalizeBrowseType(system.schedule_browse_type)
|
||||
|
||||
const weekdays = String(system.schedule_weekdays || '1,2,3,4,5,6,7')
|
||||
.split(',')
|
||||
@@ -279,7 +284,6 @@ onMounted(loadAll)
|
||||
<el-select v-model="scheduleBrowseType" style="width: 220px">
|
||||
<el-option label="注册前未读" value="注册前未读" />
|
||||
<el-option label="应读" value="应读" />
|
||||
<el-option label="未读" value="未读" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
@@ -2,9 +2,22 @@ export function parseSqliteDateTime(value) {
|
||||
if (!value) return null
|
||||
if (value instanceof Date) return value
|
||||
|
||||
const str = String(value)
|
||||
let str = String(value).trim()
|
||||
if (!str) return null
|
||||
|
||||
// "YYYY-MM-DD" -> "YYYY-MM-DDT00:00:00"
|
||||
if (/^\d{4}-\d{2}-\d{2}$/.test(str)) str = `${str}T00:00:00`
|
||||
|
||||
// "YYYY-MM-DD HH:mm:ss" -> "YYYY-MM-DDTHH:mm:ss"
|
||||
const iso = str.includes('T') ? str : str.replace(' ', 'T')
|
||||
let iso = str.includes('T') ? str : str.replace(' ', 'T')
|
||||
|
||||
// SQLite 可能带微秒,Date 仅可靠支持到毫秒
|
||||
iso = iso.replace(/\.(\d{3})\d+/, '.$1')
|
||||
|
||||
// 统一按北京时间解析(除非字符串本身已带时区)
|
||||
const hasTimezone = /([zZ]|[+-]\d{2}:\d{2})$/.test(iso)
|
||||
if (!hasTimezone) iso = `${iso}+08:00`
|
||||
|
||||
const date = new Date(iso)
|
||||
if (Number.isNaN(date.getTime())) return null
|
||||
return date
|
||||
@@ -14,4 +27,3 @@ export function formatDateTime(value) {
|
||||
if (!value) return '-'
|
||||
return String(value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user