Integrate KDocs auto-upload
This commit is contained in:
@@ -11,7 +11,9 @@ import {
|
||||
changePassword,
|
||||
fetchEmailNotify,
|
||||
fetchUserEmail,
|
||||
fetchKdocsSettings,
|
||||
unbindEmail,
|
||||
updateKdocsSettings,
|
||||
updateEmailNotify,
|
||||
} from '../api/settings'
|
||||
import { useUserStore } from '../stores/user'
|
||||
@@ -111,6 +113,10 @@ const passwordForm = reactive({
|
||||
confirm_password: '',
|
||||
})
|
||||
|
||||
const kdocsLoading = ref(false)
|
||||
const kdocsSaving = ref(false)
|
||||
const kdocsUnitValue = ref('')
|
||||
|
||||
function syncIsMobile() {
|
||||
isMobile.value = Boolean(mediaQuery?.matches)
|
||||
if (!isMobile.value) drawerOpen.value = false
|
||||
@@ -231,7 +237,7 @@ async function openSettings() {
|
||||
}
|
||||
|
||||
async function loadSettings() {
|
||||
await Promise.all([loadEmailInfo(), loadEmailNotify()])
|
||||
await Promise.all([loadEmailInfo(), loadEmailNotify(), loadKdocsSettings()])
|
||||
}
|
||||
|
||||
async function loadEmailInfo() {
|
||||
@@ -262,6 +268,30 @@ async function loadEmailNotify() {
|
||||
}
|
||||
}
|
||||
|
||||
async function loadKdocsSettings() {
|
||||
kdocsLoading.value = true
|
||||
try {
|
||||
const data = await fetchKdocsSettings()
|
||||
kdocsUnitValue.value = data?.kdocs_unit || ''
|
||||
} catch {
|
||||
kdocsUnitValue.value = ''
|
||||
} finally {
|
||||
kdocsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function saveKdocsSettings() {
|
||||
kdocsSaving.value = true
|
||||
try {
|
||||
await updateKdocsSettings({ kdocs_unit: kdocsUnitValue.value.trim() })
|
||||
ElMessage.success('已更新表格县区设置')
|
||||
} catch {
|
||||
// handled by interceptor
|
||||
} finally {
|
||||
kdocsSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function onBindEmail() {
|
||||
const email = bindEmailValue.value.trim().toLowerCase()
|
||||
if (!email) {
|
||||
@@ -635,6 +665,24 @@ async function dismissAnnouncementPermanently() {
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="表格上传" name="kdocs">
|
||||
<div v-loading="kdocsLoading" class="settings-section">
|
||||
<el-form label-position="top">
|
||||
<el-form-item label="县区(可选)">
|
||||
<el-input v-model="kdocsUnitValue" placeholder="留空使用系统默认县区" />
|
||||
</el-form-item>
|
||||
<el-button type="primary" :loading="kdocsSaving" @click="saveKdocsSettings">保存</el-button>
|
||||
</el-form>
|
||||
<el-alert
|
||||
type="info"
|
||||
:closable="false"
|
||||
title="自动上传开关在“账号管理”页面设置(测试功能)。"
|
||||
show-icon
|
||||
class="settings-hint"
|
||||
/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="VIP信息" name="vip">
|
||||
<div class="settings-section">
|
||||
<el-alert
|
||||
|
||||
Reference in New Issue
Block a user