feat: 实现已确认的登录、采集和任务导出
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { NButton, NInputNumber, NRadio, NRadioGroup, NTooltip } from "naive-ui";
|
||||
import Shell from "../../shell/Shell.vue";
|
||||
import { api } from "../../shared/http";
|
||||
|
||||
const mode = ref("local");
|
||||
const seconds = ref(300);
|
||||
const message = ref("");
|
||||
|
||||
async function load() {
|
||||
const result = await api<{ loginMode: string; credentialRefreshSeconds: number }>("/api/admin/settings");
|
||||
mode.value = result.loginMode;
|
||||
seconds.value = result.credentialRefreshSeconds;
|
||||
}
|
||||
|
||||
async function save() {
|
||||
message.value = "";
|
||||
try {
|
||||
await api("/api/admin/settings", {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ loginMode: mode.value, credentialRefreshSeconds: seconds.value }),
|
||||
});
|
||||
message.value = "已保存";
|
||||
} catch (error) {
|
||||
message.value = error instanceof Error ? error.message : "保存失败";
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Shell>
|
||||
<header class="topbar">
|
||||
<h1>登录方式 <n-tooltip><template #trigger><span class="hint">?</span></template>同时只启用一种登录方式</n-tooltip></h1>
|
||||
<n-button type="primary" @click="save">保存</n-button>
|
||||
</header>
|
||||
<div class="content">
|
||||
<div class="form-grid">
|
||||
<label>方式</label>
|
||||
<n-radio-group v-model:value="mode">
|
||||
<n-radio value="local">自有账号</n-radio>
|
||||
<n-radio value="nqi">大数据平台账号</n-radio>
|
||||
</n-radio-group>
|
||||
<label>刷新间隔</label>
|
||||
<n-input-number v-model:value="seconds" :min="60" :max="86400" />
|
||||
</div>
|
||||
<p>{{ message }}</p>
|
||||
</div>
|
||||
</Shell>
|
||||
</template>
|
||||
Reference in New Issue
Block a user