fix: 账号截图开关持久化与状态推送优化

This commit is contained in:
2025-12-16 18:27:45 +08:00
parent e699f4fb94
commit 2abb9ab494
19 changed files with 127 additions and 48 deletions

View File

@@ -37,7 +37,25 @@ const selectedIds = ref([])
const browseTypeById = reactive({})
const batchBrowseType = ref('应读')
const batchEnableScreenshot = ref(true)
const SCREENSHOT_TOGGLE_STORAGE_KEY = 'zsglpt:accounts:enable_screenshot'
function loadEnableScreenshot() {
try {
const raw = window.localStorage.getItem(SCREENSHOT_TOGGLE_STORAGE_KEY)
if (raw === '0' || raw === 'false') return false
if (raw === '1' || raw === 'true') return true
} catch {
// ignore
}
return true
}
const batchEnableScreenshot = ref(loadEnableScreenshot())
watch(batchEnableScreenshot, (value) => {
try {
window.localStorage.setItem(SCREENSHOT_TOGGLE_STORAGE_KEY, value ? '1' : '0')
} catch {
// ignore
}
})
const addOpen = ref(false)
const editOpen = ref(false)
@@ -173,7 +191,7 @@ async function refreshAccounts() {
async function onStart(acc) {
try {
await startAccount(acc.id, { browse_type: browseTypeById[acc.id] || '应读', enable_screenshot: true })
await startAccount(acc.id, { browse_type: browseTypeById[acc.id] || '应读', enable_screenshot: batchEnableScreenshot.value })
} catch (e) {
const data = e?.response?.data
ElMessage.error(data?.error || '启动失败')
@@ -620,13 +638,19 @@ onBeforeUnmount(() => {
<span class="card-name">{{ acc.username }}</span>
<el-tag size="small" :type="statusTagType(acc.status)" effect="light">{{ acc.status }}</el-tag>
</div>
<div class="card-sub app-muted">
{{ acc.remark || '—' }}
<span v-if="showRuntimeProgress(acc) && acc.detail_status"> · {{ acc.detail_status }}</span>
<span v-if="showRuntimeProgress(acc) && acc.elapsed_display"> · {{ acc.elapsed_display }}</span>
</div>
</div>
</div>
<div class="card-sub app-muted">
{{ acc.remark || '—' }}
<span v-if="showRuntimeProgress(acc) && acc.detail_status"> · {{ acc.detail_status }}</span>
<span v-if="showRuntimeProgress(acc) && acc.elapsed_display"> · {{ acc.elapsed_display }}</span>
<span v-if="String(acc.status || '').includes('排队') && acc.queue_ahead != null">
· 前面 {{ acc.queue_ahead }} · 运行中 {{ acc.queue_running_total ?? 0 }}
</span>
<span v-else-if="showRuntimeProgress(acc) && (acc.queue_pending_total != null || acc.queue_running_total != null)">
· 排队 {{ acc.queue_pending_total ?? 0 }} · 运行中 {{ acc.queue_running_total ?? 0 }}
</span>
</div>
</div>
</div>
<div v-if="showRuntimeProgress(acc)" class="progress">
<el-progress :percentage="toPercent(acc)" :stroke-width="10" :show-text="false" />