Force KDocs QR fetch and improve login detection

This commit is contained in:
2026-01-07 13:07:57 +08:00
parent 28e86b1147
commit 6b416dc5f1
22 changed files with 112 additions and 65 deletions

View File

@@ -5,8 +5,9 @@ export async function fetchKdocsStatus() {
return data
}
export async function fetchKdocsQr() {
const { data } = await api.post('/kdocs/qr', {})
export async function fetchKdocsQr(payload = {}) {
const body = { force: true, ...payload }
const { data } = await api.post('/kdocs/qr', body)
return data
}

View File

@@ -258,13 +258,13 @@ async function refreshKdocsStatus() {
async function onFetchKdocsQr() {
try {
const res = await fetchKdocsQr()
if (res?.logged_in) {
ElMessage.success('当前已登录,无需扫码')
await refreshKdocsStatus()
return
}
kdocsQrImage.value = res?.qr_image || ''
if (!kdocsQrImage.value) {
if (res?.logged_in) {
ElMessage.success('当前已登录,无需扫码')
await refreshKdocsStatus()
return
}
ElMessage.warning('未获取到二维码')
return
}